Mistake on this page?
Report an issue in GitHub or email us
cybsp_wifi.h
Go to the documentation of this file.
1 /***********************************************************************************************//**
2  * \file cybsp_wifi.h
3  *
4  * \brief
5  * Basic abstraction layer for dealing with boards containing a Cypress MCU. This
6  * API provides convenience methods for initializing and manipulating different
7  * hardware found on the board.
8  *
9  ***************************************************************************************************
10  * \copyright
11  * Copyright 2018-2020 Cypress Semiconductor Corporation
12  * SPDX-License-Identifier: Apache-2.0
13  *
14  * Licensed under the Apache License, Version 2.0 (the "License");
15  * you may not use this file except in compliance with the License.
16  * You may obtain a copy of the License at
17  *
18  * http://www.apache.org/licenses/LICENSE-2.0
19  *
20  * Unless required by applicable law or agreed to in writing, software
21  * distributed under the License is distributed on an "AS IS" BASIS,
22  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23  * See the License for the specific language governing permissions and
24  * limitations under the License.
25  **************************************************************************************************/
26 
27 /**
28  * \addtogroup group_bsp_wifi WiFi Initialization
29  * \{
30  * Basic integration code for interfacing the WiFi Host Driver (WHD) with the Board
31  * Support Packages (BSPs).
32  */
33 #pragma once
34 
35 #include "cy_result.h"
36 #include "whd_wifi_api.h"
37 
38 #if defined(__cplusplus)
39 extern "C" {
40 #endif
41 
42 /** Initialization of the WiFi driver failed. */
43 #define CYBSP_RSLT_WIFI_INIT_FAILED \
44  (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_BOARD_LIB_WHD_INTEGRATION, 0))
45 
46 /** SDIO enumeration failed. */
47 #define CYBSP_RSLT_WIFI_SDIO_ENUM_TIMEOUT \
48  (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_BOARD_LIB_WHD_INTEGRATION, 1))
49 
50 /** Initializes the primary interface for the WiFi driver on the board. This sets up
51  * the WHD interface to use the \ref group_bsp_network_buffer APIs and to communicate
52  * over the SDIO interface on the board. This function does the following:<br>
53  * 1) Initializes the WiFi driver.<br>
54  * 2) Turns on the WiFi chip.
55  *
56  * @note This function cannot be called multiple times. If the interface needs to be
57  * reinitialized, \ref cybsp_wifi_deinit must be called before calling this function
58  * again.
59  *
60  * @param[out] interface Interface to be initialized
61  * @param[in] resource_if Pointer to resource interface to provide resources to the driver
62  * initialization process. Passing NULL will use the default.
63  * @param[in] buffer_if Pointer to a buffer interface to provide buffer related services to the
64  * driver instance. Passing NULL will use the default.
65  * @param[in] netif_if Pointer to a whd_netif_funcs_t to provide network stack services to the
66  * driver instance. Passing NULL will use the default.
67  *
68  * @return CY_RSLT_SUCCESS for successful initialization or error if initialization failed.
69  */
71  whd_resource_source_t* resource_if,
72  whd_buffer_funcs_t* buffer_if,
73  whd_netif_funcs_t* netif_if);
74 
75 /**
76  * Initializes the primary interface for the WiFi driver on the board using the default resource,
77  * buffer, and network interfaces.
78  * See cybsp_wifi_init_primary_extended() for more details.
79  *
80  * @param[out] interface Interface to be initialized
81  *
82  * @return CY_RSLT_SUCCESS for successful initialization or error if initialization failed.
83  */
84 static inline cy_rslt_t cybsp_wifi_init_primary(whd_interface_t* interface)
85 {
86  return cybsp_wifi_init_primary_extended(interface, NULL, NULL, NULL);
87 }
88 
89 
90 /** This function initializes and adds a secondary interface to the WiFi driver.
91  * @note This function does not initialize the WiFi driver or turn on the WiFi chip.
92  * That is required to be done by first calling \ref cybsp_wifi_init_primary.
93  *
94  * @param[out] interface Interface to be initialized
95  * @param[in] mac_address Mac address for secondary interface
96  *
97  * @return CY_RSLT_SUCCESS for successful initialization or error if initialization failed.
98  */
99 cy_rslt_t cybsp_wifi_init_secondary(whd_interface_t* interface, whd_mac_t* mac_address);
100 
101 /** De-initializes all WiFi interfaces and the WiFi driver. This function does the
102  * following:<br>
103  * 1) Deinitializes all WiFi interfaces and WiFi driver.<br>
104  * 2) Turns off the WiFi chip.
105  *
106  * @param[in] interface Interface to be de-initialized.
107  *
108  * @return CY_RSLT_SUCCESS for successful de-initialization or error if de-initialization failed.
109  */
110 cy_rslt_t cybsp_wifi_deinit(whd_interface_t interface);
111 
112 /** Gets the wifi driver instance initialized by the driver. This should only be called
113  * after being initialized by \ref cybsp_wifi_init_primary() and before being
114  * deinitialized by \ref cybsp_wifi_deinit(). This is also the only time where the
115  * driver reference is valid.
116  *
117  * @return Wifi driver instance pointer.
118  */
120 
121 #ifdef __cplusplus
122 }
123 #endif // __cplusplus
124 
125 /** \} group_bsp_wifi */
Contains functions which allows WHD to pass received data to the network stack, to send an ethernet f...
whd_driver_t cybsp_get_wifi_driver(void)
Gets the wifi driver instance initialized by the driver.
cy_rslt_t cybsp_wifi_deinit(whd_interface_t interface)
De-initializes all WiFi interfaces and the WiFi driver.
Structure for storing a MAC address (Wi-Fi Media Access Control address).
Definition: whd_types.h:385
cy_rslt_t cybsp_wifi_init_secondary(whd_interface_t *interface, whd_mac_t *mac_address)
This function initializes and adds a secondary interface to the WiFi driver.
Allows WHD to perform buffer related operations like, allocating, releasing, retrieving the current p...
static cy_rslt_t cybsp_wifi_init_primary(whd_interface_t *interface)
Initializes the primary interface for the WiFi driver on the board using the default resource...
Definition: cybsp_wifi.h:84
Prototypes of functions for controlling the Wi-Fi system.
cy_rslt_t cybsp_wifi_init_primary_extended(whd_interface_t *interface, whd_resource_source_t *resource_if, whd_buffer_funcs_t *buffer_if, whd_netif_funcs_t *netif_if)
Initializes the primary interface for the WiFi driver on the board.
Interface to a data source that provides external resources to the radio driver.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.