1 /* 2 * Copyright (c) 2021 Chipsea Technologies (Shenzhen) Corp., Ltd. All rights reserved. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef _WIFI_FHOST_API_H 16 #define _WIFI_FHOST_API_H 17 18 19 #include "wifi_mac.h" 20 21 /** 22 * FHOST configuration item description 23 */ 24 struct fhost_config_item 25 { 26 /** 27 * Id of the configuration item (@ref fhost_config_id) 28 */ 29 uint16_t id; 30 /** 31 * Size in bytes of data buffer 32 */ 33 uint16_t len; 34 /** 35 * Configuration data 36 */ 37 void *data; 38 }; 39 40 /** 41 * IDs for FHOST configuration items 42 */ 43 enum fhost_config_id 44 { 45 /** 46 * Inidicates last configuration item 47 */ 48 FHOST_CFG_END = 0, 49 /** 50 * - use: Configure MAC address 51 * - len: 6 52 * - data: MAC address 53 */ 54 FHOST_CFG_MAC_ADDR, 55 /** 56 * - use: Configure usage of Power Save mode 57 * - len: 4 58 * - data: 32bits boolean 59 */ 60 FHOST_CFG_PS, 61 /** 62 * - use: Configure usage of Short Guard interval for 20Mhz and 40Mhz channels. 63 * - len: 4 64 * - data: 32bits boolean 65 */ 66 FHOST_CFG_SGI, 67 /** 68 * - use: Configure usage of Short Guard interval for 80Mhz channels. 69 * - len: 4 70 * - data: 32bits boolean 71 */ 72 FHOST_CFG_SGI80, 73 /** 74 * - use: Configure the maximum number of Spatial Stream used. 75 * Default value is the max supported by the modem and invalid values are ignored. 76 * - len: 4 77 * - data: 32bits val 78 */ 79 FHOST_CFG_NSS, 80 /** 81 * - use: Configure tx lifetime. 82 * - len: 4 83 * - data: 32bits val, in ms 84 */ 85 FHOST_CFG_TX_LFT, 86 /** 87 * - use: Configure UAPSD timeout (for station). 88 * - len: 4 89 * - data: 32bits val, in ms 90 */ 91 FHOST_CFG_UAPSD_TIMEOUT, 92 /** 93 * - use: Configure Low Power clock accuracy. 94 * - len: 4 95 * - data: 32bits val, in ppm 96 */ 97 FHOST_CFG_LP_CLK_ACCURACY, 98 /** 99 * - use: Configure usage of HT. 100 * - len: 4 101 * - data: 32bits boolean 102 */ 103 FHOST_CFG_HT, 104 /** 105 * - use: Configure usage of 40Mhz in HT. 106 * - len: 4 107 * - data: 32bits boolean 108 */ 109 FHOST_CFG_40MHZ, 110 /** 111 * - use: Configure usage of VHT. 112 * - len: 4 113 * - data: 32bits boolean 114 */ 115 FHOST_CFG_VHT, 116 /** 117 * - use: Configure maximum MCS for VHT. (Ignored if SW or HW doesn't support VHT) 118 * - len: 4 119 * - data: 32bits val. 0=MCS0-7, 1=MCS0-8, 2=MCS0-9 120 */ 121 FHOST_CFG_VHT_MCS, 122 /** 123 * - use: Configure advertisment of LDPC RX support in HT/VHT. 124 * (Ignored if modem doesn't support it) 125 * - len: 4 126 * - data: 32bits boolean. 127 */ 128 FHOST_CFG_LDPC, 129 /** 130 * - use: Configure advertisment of STBC RX support in VHT. 131 * (Ignored if modem doesn't support it) 132 * - len: 4 133 * - data: 32bits boolean. 134 */ 135 FHOST_CFG_STBC, 136 /** 137 * - use: Configure advertisment of BEAMFORMEE support in VHT. 138 * (Ignored if modem doesn't support it) 139 * - len: 4 140 * - data: 32bits boolean. 141 */ 142 FHOST_CFG_BFMEE, 143 /** 144 * - use: Configure advertisment of BEAMFORMER support in VHT. 145 * (Ignored if modem doesn't support it) 146 * - len: 4 147 * - data: 32bits boolean. 148 */ 149 FHOST_CFG_BFMER, 150 /** 151 * - use: Configure advertisment of Multi User RX support in VHT. 152 * (Ignored if modem doesn't support it) 153 * - len: 4 154 * - data: 32bits boolean. 155 */ 156 FHOST_CFG_MURX, 157 /** 158 * - use: Configure advertisment of Multi User TX support in VHT. 159 * (Ignored if modem doesn't support it) 160 * - len: 4 161 * - data: 32bits boolean. 162 */ 163 FHOST_CFG_MUTX, 164 /** 165 * - use: Configure karst radio. (Ignored if other radio is used) 166 * - len: sizeof(struct phy_karst_cfg_tag) 167 * - data: struct phy_karst_cfg_tag. 168 */ 169 FHOST_CFG_PHY_KARST, 170 /** 171 * - use: Configure trident radio. (Ignored if other radio is used) 172 * - len: sizeof(struct phy_trd_cfg_tag) 173 * - data: struct phy_trd_cfg_tag. 174 */ 175 FHOST_CFG_PHY_TRD, 176 /** 177 * - use: Configure usage of Antenna Diversity. 178 * - len: 4 179 * - data: 32bits boolean 180 */ 181 FHOST_CFG_ANT_DIV, 182 /** 183 * - use: Configure number of seconds since Epoch at boot. 184 * - len: 4 185 * - data: 32bits unsigned value 186 */ 187 FHOST_CFG_EPOCH_SEC, 188 /** 189 * - use: Configure number of microseconds since Epoch at boot. 190 * - len: 4 191 * - data: 32bits unsigned value 192 */ 193 FHOST_CFG_EPOCH_USEC, 194 /** 195 * - use: Configure usage of HE. 196 * - len: 4 197 * - data: 32bits boolean 198 */ 199 FHOST_CFG_HE, 200 /** 201 * - use: Configure maximum MCS for HE. (Ignored if SW or HW doesn't support HE) 202 * - len: 4 203 * - data: 32bits val. 0=MCS0-7, 1=MCS0-9, 2=MCS0-11 204 */ 205 FHOST_CFG_HE_MCS, 206 /** 207 * - use: Configure usage of 80Mhz in VHT/HE. 208 * - len: 4 209 * - data: 32bits boolean 210 */ 211 FHOST_CFG_80MHZ, 212 /** 213 * - use: Configure usage of Dynamic Power-Save mode. 214 * - len: 4 215 * - data: 32bits boolean 216 */ 217 FHOST_CFG_DPSM, 218 /** 219 * - use: Configure UAPSD queues (for station). 220 * - len: 4 221 * - data: 32bits bitfield (Bit0 = VO, Bit1 = VI, Bit2 = BK, Bit3 = BE) 222 */ 223 FHOST_CFG_UAPSD_QUEUES, 224 FHOST_CFG_MAX, 225 }; 226 227 /** 228 * Fully hosted module status 229 */ 230 struct fhost_status 231 { 232 /** 233 * Maximum number of interface supported 234 */ 235 int vif_max_cnt; 236 /** 237 * Number of active interface 238 */ 239 int vif_active_cnt; 240 /** 241 * Index of the first active interface. (Valid only if vif_active_cnt is not 0) 242 */ 243 int vif_first_active; 244 /** 245 * Number of channel supported on 2.4GHz band 246 */ 247 int chan_2g4_cnt; 248 /** 249 * Number of channel supported on 5GHz band 250 */ 251 int chan_5g_cnt; 252 /** 253 * List of channels supported on 2.4GHz band 254 */ 255 const struct mac_chan_def *chan_2g4; 256 /** 257 * List of channels supported on 5GHz band 258 */ 259 const struct mac_chan_def *chan_5g; 260 }; 261 262 /** 263 * Fully hosted interface status 264 */ 265 struct fhost_vif_status 266 { 267 /** 268 * ID on the interface 269 */ 270 int index; 271 /** 272 * Type of the interface (@ref mac_vif_type) 273 */ 274 int type; 275 /** 276 * MAC address of the interface 277 */ 278 const uint8_t *mac_addr; 279 /** 280 * Current operating channel. 281 * Reset to 0 if there is no operating channel associated the interface 282 * (e.g. non connected STA interface) 283 */ 284 struct mac_chan_op chan; 285 union { 286 /** 287 * Fields specific to a STA interface 288 */ 289 struct { 290 /** 291 * BSSID of the AP. (Set to 0 if interface is not connected) 292 */ 293 struct mac_addr bssid; 294 /** 295 * RSSI (in dBm) of the last received beacon. (valid only if connected) 296 */ 297 int8_t rssi; 298 } sta; 299 }; 300 }; 301 302 /** 303 * Fully hosted frame information 304 */ 305 struct fhost_frame_info 306 { 307 /** 308 * Length (in bytes) of the frame. 309 */ 310 uint16_t length; 311 /** 312 * Primary channel frequency (in MHz) on which the frame has been received. 313 */ 314 uint16_t freq; 315 /** 316 * Received signal strength (in dBm) 317 */ 318 int8_t rssi; 319 /** 320 * Frame payload. Can be NULL if monitor mode is started with @p uf parameter set to 321 * true. In this case all other fields are still valid. 322 */ 323 uint8_t *payload; 324 }; 325 326 /** 327 * Function prototype for RX callbacks 328 */ 329 typedef void (*cb_fhost_rx)(struct fhost_frame_info *info, void *arg); 330 331 /** 332 * Configuration of VIF_MONITOR interface 333 */ 334 struct fhost_vif_monitor_cfg 335 { 336 /** 337 * Channel to monitor. 338 * @ref fhost_configure_vif will fail if channel is not valid. It will also limit 339 * the tx power. 340 */ 341 struct mac_chan_op chan; 342 /** 343 * Report 'Unsupported Frames'. 344 * If true, callback may be called with a payload parameter set to NULL 345 */ 346 bool uf; 347 /** 348 * Frame received callback. 349 * @attention The memory passed as parameter is only valid until it returns. 350 */ 351 cb_fhost_rx cb; 352 /** 353 * Parameter for the monitor callback 354 */ 355 void *cb_arg; 356 }; 357 358 /** 359 * Configuration for VIF_AP interface 360 */ 361 struct fhost_vif_sta_cfg 362 { 363 /** 364 * SSID to connect to (mandatory) 365 */ 366 struct mac_ssid ssid; 367 /** 368 * AP password/PSK passed as a string (i.e. MUST be terminated by a null byte) 369 */ 370 char key[64 + 1]; 371 /** 372 * AP BSSID. Optional, clear it to 0 if not set. 373 */ 374 struct mac_addr bssid; 375 /** 376 * AP frequency. Optional, you can specify up to two frequencies on which AP 377 * will be scanned. This is to speed up connection and should be set 0 if no used. 378 */ 379 uint16_t freq[2]; 380 /** 381 * Bit field of Authentication and Key Management (@ref mac_akm_suite) accepted 382 * for the connection. 383 * If set to 0, it default to MAC_AKM_NONE if @p key is the empty string and 384 * MAC_AKM_PSK otherwise. 385 */ 386 uint32_t akm; 387 /** 388 * Connection timeout in ms. If connection doesn't complete before timeout 389 * @ref fhost_configure_vif will return an error. 390 * If set to -1 timeout is disabled, and if set to 0 @ref fhost_configure_vif 391 * will return without waiting for the connection to complete. 392 */ 393 int timeout_ms; 394 }; 395 396 /** 397 * Configuration for VIF_AP interface 398 */ 399 struct fhost_vif_ap_cfg 400 { 401 /** 402 * SSID to connect to (mandatory) 403 */ 404 struct mac_ssid ssid; 405 /** 406 * AP operating channel (tx_power and flags fields are ignored). 407 */ 408 struct mac_chan_op chan; 409 /** 410 * Beacon interval in TU 411 */ 412 int bcn_interval; 413 /** 414 * DTIM period (number of beacon between 2 DTIM beacon) 415 */ 416 int dtim_period; 417 /** 418 * Bit field of Authentication and Key Management (@ref mac_akm_suite) 419 * Not all combination are possible 420 */ 421 uint32_t akm; 422 /** 423 * AP password/PSK passed as a string (i.e. MUST be terminated by a null byte) 424 */ 425 char key[64 + 1]; 426 /** 427 * Bit field of Cipher suites (@ref mac_cipher_suite) 428 * Can be left to 0 to use default one (depending of AKM selected) 429 */ 430 uint32_t unicast_cipher; 431 /** 432 * Bit field of Cipher suites (@ref mac_cipher_suite) 433 * Can be left to 0 to use default one (depending of AKM selected) 434 */ 435 uint32_t group_cipher; 436 /** 437 * Management Frame Protection (0: disable, 1: allowed, 2: required) 438 * (Ignored if not supported by selected AKM) 439 */ 440 int mfp; 441 /** 442 * Hidden ssid 443 */ 444 uint8_t hidden_ssid; 445 /** 446 * Value for maximum station inactivity, seconds 447 */ 448 int max_inactivity; 449 /** 450 * Enable HE 451 */ 452 uint8_t enable_he; 453 }; 454 455 /** 456 * Fully hosted interface configuration 457 */ 458 struct fhost_vif_cfg 459 { 460 /** 461 * Identify which part of the union has been updated 462 */ 463 enum mac_vif_type cfg_type; 464 union { 465 /** 466 * Configuration if @p cfg_type == VIF_STA 467 */ 468 struct fhost_vif_sta_cfg sta; 469 /** 470 * Configuration if @p cfg_type == VIF_MONITOR 471 */ 472 struct fhost_vif_monitor_cfg monitor; 473 /** 474 * Configuration if @p cfg_type == VIF_AP 475 */ 476 struct fhost_vif_ap_cfg ap; 477 }; 478 }; 479 480 /** 481 * Enum for IP address configuration mode 482 */ 483 enum fhost_ip_addr_mode 484 { 485 IP_ADDR_NONE, 486 IP_ADDR_STATIC_IPV4, 487 IP_ADDR_DHCP_CLIENT, 488 }; 489 490 /** 491 * Fully Hosted IP address configuration (only IPv4 for now) 492 */ 493 struct fhost_vif_ip_addr_cfg 494 { 495 /** 496 * Select how to configure ip address when calling @ref fhost_set_vif_ip 497 * Indicate how ip was configured when updated by @ref fhost_get_vif_ip 498 */ 499 enum fhost_ip_addr_mode mode; 500 /** 501 * Whether interface must be the default output interface 502 * (Unspecified when calling @ref fhost_get_vif_ip) 503 */ 504 bool default_output; 505 union { 506 /** 507 * IPv4 config. 508 * Must be set when calling @ref fhost_set_vif_ip with @p mode==IP_ADDR_STATIC_IPV4 509 * Always set when updated by @ref fhost_get_vif_ip (whatever the value of @p mode) 510 */ 511 struct { 512 /** 513 * IPv4 address 514 */ 515 uint32_t addr; 516 /** 517 * IPv4 address mask 518 */ 519 uint32_t mask; 520 /** 521 * IPv4 addres of the gateway 522 */ 523 uint32_t gw; 524 /** 525 * DNS server to use. (Ignored if set to 0) 526 */ 527 uint32_t dns; 528 } ipv4; 529 /** 530 * DHCP config. 531 * Must be set when calling @ref fhost_set_vif_ip with @p addr_mode==IP_ADDR_DHCP_CLIENT 532 */ 533 struct { 534 /** 535 * Timeout, in ms, to obtained an IP address 536 */ 537 uint32_t to_ms; 538 } dhcp; 539 }; 540 }; 541 542 typedef struct { 543 uint32_t ipc_irq_prio; 544 } fhost_user_cfg_t; 545 546 /// structure for super scan 547 struct fhost_super_scan_t { 548 /// SSID to scan (NULL: no care) 549 struct cfgrwnx_scan_ssid *ssids; 550 /// Number of SSID in ssids, max 2 (0: no care) 551 int ssid_cnt; 552 /// Array of frequencies to scan or %NULL for all frequencies. 553 /// The frequency is set in MHz. The array is zero-terminated. 554 /// band MUST set -1 555 int *freqs; 556 /// Band(0:2G4, 1:5G, -1: no care) 557 int band; 558 /// BSSID to scan, can be NULL for wildcard BSSID 559 const uint8_t *bssid; 560 /// Extra IE to add in the proce request (NULL: no care) 561 const uint8_t *extra_ies; 562 /// Size of the extra IEs (0: no care) 563 int extra_ies_len; 564 }; 565 566 /** 567 * Function prototype for frame transimission callbacks 568 * - frame_id is the one returned by @ref fhost_send_80211_frame 569 * - acknowledged indicates if the frame has been acknowledged by peer (or sucessfully sent 570 * for multicast frame) 571 * - arg is the private argument passed when frame has been pushed for transmission 572 */ 573 typedef void (*cb_fhost_tx)(uint32_t frame_id, bool acknowledged, void *arg); 574 575 struct fhost_cntrl_link; 576 577 /***************************************************************************************** 578 * Provided Functions 579 ****************************************************************************************/ 580 /** 581 **************************************************************************************** 582 * @brief Initialization of the fully hosted module. 583 * 584 * This function allocates all the resources needed by the different FHOST sub-modules. 585 * This function will use the rtos_al API to create tasks, semaphores, etc. As such it 586 * must be called after @ref rtos_init (or equivalent). 587 * 588 * @param[in] user_cfg User specified configure, NULL for default 589 **************************************************************************************** 590 */ 591 void fhost_init(fhost_user_cfg_t *usr_cfg); 592 593 /** 594 **************************************************************************************** 595 * @brief Retrieve fully hosted module status. 596 * 597 * @param[out] status Structure to retrieve status 598 **************************************************************************************** 599 */ 600 void fhost_get_status(struct fhost_status *status); 601 602 /** 603 **************************************************************************************** 604 * @brief Retrieve one interface status. 605 * 606 * @param[in] fvif_idx Index of the interface 607 * @param[out] status Structure to retrieve status 608 * 609 * @return 0 on success and != 0 if error occurred 610 **************************************************************************************** 611 */ 612 int fhost_get_vif_status(int fvif_idx, struct fhost_vif_status *status); 613 614 /** 615 **************************************************************************************** 616 * @brief Open a CFGRWNX link with the fhost firmware. 617 * 618 * A CFGRWNX link is used for communication with the 'CONTROL' task of the fhost firmware 619 * which centralizes all interaction with the 'WIFI' task. 620 * When no longer required a link must be close using @ref fhost_cntrl_cfgrwnx_link_close. 621 * 622 * @return pointer to fhost_cntrl_link structure on success, NULL otherwise 623 **************************************************************************************** 624 */ 625 struct fhost_cntrl_link *fhost_cntrl_cfgrwnx_link_open(); 626 627 /** 628 **************************************************************************************** 629 * @brief Close a CFGRWNX link. 630 * 631 * Close a link opened with @ref fhost_cntrl_cfgrwnx_link_open. 632 * 633 * @param[in] link Pointer to previously opened link 634 **************************************************************************************** 635 */ 636 void fhost_cntrl_cfgrwnx_link_close(struct fhost_cntrl_link *link); 637 638 /** 639 **************************************************************************************** 640 * @brief Change interface type 641 * 642 * When the interface type is changed, the current interface will first be cleared (i.e. 643 * close its connection, release its IP address ...) 644 * If interface is already of the requested type the function returns immediately. 645 * If you want to clear an interface without changing its type, you should first set its 646 * type to VIF_UNKNOWN and then reset it. 647 * 648 * @param[in] link Pointer to a cfgrwnx link 649 * @param[in] fvif_idx Index of the interface 650 * @param[in] type Type to set on the interface 651 * @param[in] p2p Whether interface will be used for a P2P (aka Wifi Direct) 652 * connection (Used only if @p type is VIF_STA of VIF_AP) 653 * 654 * @return 0 on success and <0 if any error occurred. 655 **************************************************************************************** 656 */ 657 int fhost_set_vif_type(struct fhost_cntrl_link *link, int fvif_idx, enum mac_vif_type type, 658 bool p2p); 659 660 /** 661 **************************************************************************************** 662 * @brief Configure an interface IP address 663 * 664 * If this is not supported by upper layer then this function can be used to configure 665 * ip address of an interface. So far only IPv4 is supported. 666 * If IP_ADDR_DHCP_CLIENT mode is used, upon success the @p cfg parameter is updated 667 * with the actual ip address obtained in cfg.ipv4. 668 * If IP_ADDR_STATIC_IPV4 mode is used and DNS is not set, upon success the @p cfg 669 * parameter is updated with the current DNS in cfg.ipv4.dns 670 * 671 * @note This function can only be used if the @ref FHOST_NET_AL implements the IP 672 * related functions 673 * 674 * @param[in] fvif_idx Index of the interface 675 * @param[in,out] cfg Configuration of the interface 676 * 677 * @return 0 on success and <0 if any error occurred. 678 **************************************************************************************** 679 */ 680 int fhost_set_vif_ip(int fvif_idx, struct fhost_vif_ip_addr_cfg *cfg); 681 682 /** 683 **************************************************************************************** 684 * @brief Retrieve IP address configuration of an interface 685 * 686 * If this is not supported by upper layer then this function can be used to retrieve 687 * ip address of an interface. So far only IPv4 is supported. 688 * 689 * @note Some fields of the @p cfg parameter have a slightly different meaning than when 690 * used by @ref fhost_set_vif_ip (see documentaion for @ref fhost_vif_ip_addr_cfg). 691 * 692 * @note This function can only be used if the @ref FHOST_NET_AL implements the IP 693 * related functions 694 * 695 * @param[in] fvif_idx Index of the interface 696 * @param[out] cfg Configuration of the interface 697 * 698 * @return 0 on success and <0 if any error occurred. 699 **************************************************************************************** 700 */ 701 int fhost_get_vif_ip(int fvif_idx, struct fhost_vif_ip_addr_cfg *cfg); 702 703 /** 704 **************************************************************************************** 705 * @brief Scan Access Points on a given interface 706 * 707 * This function is blocking until the scan is finished. Once the scan is complete you 708 * can use @ref fhost_get_scan_results to retrieve the results. 709 * 710 * @param[in] link Pointer to a cfgrwnx link 711 * @param[in] fvif_idx Index of the interface 712 * 713 * @return < 0 if an error occurred, otherwise it returns the number of Access point 714 * found. 715 **************************************************************************************** 716 */ 717 int fhost_scan(struct fhost_cntrl_link *link, int fvif_idx, int *freq_list); 718 int fhost_scan_for_busy_channel(struct fhost_cntrl_link *link, int fvif_idx, int *freq_list, uint16_t *busy_freq_list); 719 int fhost_scan_gt_rssi(struct fhost_cntrl_link *link, int fvif_idx, int *freq_list, int8_t rssi); 720 /** 721 **************************************************************************************** 722 * @brief Scan Access Points, support setting 723 * 724 * E.g. struct fhost_super_scan_t param; 725 * struct cfgrwnx_scan_ssid ssid; 726 * uint8_t *ssid_str = "AP-Test"; 727 * uint8_t bssid_str[] = {0x04, 0x03, 0x01, 0x05, 0x06, 0xc0}; 728 * int freqs[] = {5180}; 729 * ssid.len = strlen(ssid_str); 730 * ssid.ssid = ssid_str; 731 * memset(¶m, 0, sizeof(param)); 732 * param.band = -1; 733 * param.ssid_cnt = 1; 734 * param.ssids = &ssid; 735 * param.bssid = bssid_str; 736 * param.freqs = freqs; 737 * fhost_super_scan(console_cntrl_link, fvif_idx, ¶m); 738 * 739 * @param[in] link Pointer to a cfgrwnx link 740 * @param[in] fvif_idx Index of the interface 741 * 742 * @return < 0 if an error occurred, otherwise it returns the number of Access point 743 * found. 744 **************************************************************************************** 745 */ 746 int fhost_super_scan(struct fhost_cntrl_link *link, int fvif_idx, struct fhost_super_scan_t* param); 747 748 /** 749 **************************************************************************************** 750 * @brief Retrieve scan results 751 * 752 * This function retrieves up to @p max_nb_result scan results starting at index 753 * @p result_idx. 754 * To retrieve all scan results, first call this function with result_idx = 0; 755 * Then as long as the value returned is equal to @p max_nb_result you can retrieve the 756 * other results by updating @p result_idx value (incremented by the number of results 757 * already read). 758 * All results have been read when the value returned is lower than @p max_nb_result. 759 * 760 * @param[in] link Pointer to a cfgrwnx link 761 * @param[in] result_idx Index of the first result to read 762 * @param[in] max_nb_result Size, in number of element, of @p results 763 * @param[out] results Buffer to retrieve the scan results. 764 * 765 * @return The number of results written in @p results. 766 **************************************************************************************** 767 */ 768 int fhost_get_scan_results(struct fhost_cntrl_link *link, int result_idx, 769 int max_nb_result, struct mac_scan_result *results); 770 771 /** 772 **************************************************************************************** 773 * @brief Transmit a 802.11 frame 774 * 775 * This function is used to send a pre-formatted 802.11 frame (most likely a Management 776 * frame). The frame is sent as a singleton using basic rates. 777 * The memory passed as parameter is first copied before programming the transmission. 778 * It can then be re-used immediately once the function returns. 779 * 780 * @attention If callback function is provided it will be executed in WIFI task context 781 * and as such it should be fairly quick and cannot call any function of this API. 782 * 783 * @param[in] fvif_idx Index of the interface 784 * @param[in] frame Pointer to the data to send 785 * @param[in] length Size, in bytes, of the provided data 786 * @param[in] cfm_cb Callback when transmission has been completed (may be NULL) 787 * @param[in] cfm_cb_arg Private argument for the callback. 788 * 789 * @return A unique frame id (the one passed in the confirmation callback) and 0 if 790 * an error happened 791 **************************************************************************************** 792 */ 793 uint32_t fhost_send_80211_frame(int fvif_idx, const uint8_t *frame, uint32_t length, 794 cb_fhost_tx cfm_cb, void *cfm_cb_arg); 795 796 /***************************************************************************************** 797 * Required Functions 798 ****************************************************************************************/ 799 /** 800 **************************************************************************************** 801 * @brief Get the next configuration item. 802 * 803 * This function is used by the fully hosted firmware to retrieve its configuration as 804 * defined by @ref fhost_config_id. 805 * To retrieve its configuration, the firmware first calls this function with a @p item 806 * parameter with all its fields set to 0. On all subsequent calls, the @p item parameter 807 * is the one returned by the previous call. The firmware stops calling this function as 808 * soon as the item @ref FHOST_CFG_END is returned 809 * 810 * Currently the only mandatory configuration items are @ref FHOST_CFG_MAC_ADDR and 811 * FHOST_CFG_PHY_XXX (if applicable to your platform). For any other tiems that is not 812 * provided by this function the fullt hosted firmware will select a default value 813 * adapted to the MACHW used. 814 * 815 * @note The firmware may need to retrieve its configuration several times during the 816 * execution so this must be supported. 817 * 818 * @param[in,out] item Pointer to the previous configuration item updated 819 * with the next one. 820 **************************************************************************************** 821 */ 822 void fhost_config_get_next_item(struct fhost_config_item *item); 823 824 #endif // _WIFI_FHOST_API_H 825