mirror of https://github.com/ARMmbed/mbed-os.git
PSOC6: add WHD sources
parent
4f22853c1e
commit
8ede226c16
|
@ -0,0 +1,9 @@
|
|||
/*
|
||||
* This file is used to set the MAC address in NVRAM.
|
||||
* The MAC address of the Wi-Fi device may be configured in OTP and/or in NVRAM.
|
||||
* If both OTP and NVRAM contains the MAC address then OTP programmed MAC address will be used.
|
||||
* PSOC boards are usually programmed with OTP MAC address.
|
||||
* MAC address is printed during WHD power up
|
||||
*/
|
||||
|
||||
#define NVRAM_GENERATED_MAC_ADDRESS "macaddr=00:A0:50:45:2e:c8"
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file whd.h
|
||||
* Provides abstract pointer type to act as instance for: driver, interface, buffer funcs, network funcs, resource funcs and bus funcs.
|
||||
*/
|
||||
|
||||
#include "whd_types.h"
|
||||
|
||||
#ifndef INCLUDED_WHD_H
|
||||
#define INCLUDED_WHD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Abstract pointer type that acts as a handle to an instance of the driver
|
||||
*/
|
||||
typedef struct whd_driver *whd_driver_t;
|
||||
|
||||
/**
|
||||
* Abstract pointer type to handle instance of whd interface
|
||||
*/
|
||||
typedef struct whd_interface *whd_interface_t;
|
||||
|
||||
/**
|
||||
* Abstract type that acts as a handle to an instance of a buffer function
|
||||
*/
|
||||
typedef struct whd_buffer_funcs whd_buffer_funcs_t;
|
||||
|
||||
/**
|
||||
* Abstract type that acts as a handle to an instance of a network interface function
|
||||
*/
|
||||
typedef struct whd_netif_funcs whd_netif_funcs_t;
|
||||
|
||||
/**
|
||||
* Abstract type that acts as a handle to an instance of a resource function
|
||||
*/
|
||||
typedef struct whd_resource_source whd_resource_source_t;
|
||||
|
||||
/**
|
||||
* Abstract type that acts as a handle to an instance of a bus function used for SDIO specific functionality
|
||||
*/
|
||||
typedef struct whd_bus_funcs whd_sdio_funcs_t;
|
||||
|
||||
/**
|
||||
* Abstract type that acts as a handle to an instance of a bus function used for SPI specific functionality
|
||||
*/
|
||||
typedef struct whd_bus_funcs whd_spi_funcs_t;
|
||||
|
||||
/**
|
||||
* Structure for storing WHD init configurations
|
||||
*/
|
||||
typedef struct whd_init_config
|
||||
{
|
||||
void *thread_stack_start; /**< Pointer to the WHD thread stack */
|
||||
uint32_t thread_stack_size; /**< Size of the WHD thread stack */
|
||||
uint32_t thread_priority; /**< Priority to be set to WHD Thread */
|
||||
whd_country_code_t country; /**< Variable to strore country code information */
|
||||
} whd_init_config_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
#endif /* INCLUDED_WHD_H */
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file whd_bus_types.h
|
||||
* Defines common data types used with WHD SDIO/SPI bus
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_WHD_BUS_TYPES_H
|
||||
#define INCLUDED_WHD_BUS_TYPES_H
|
||||
|
||||
#include "whd.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/** @addtogroup busapi WHD Bus API
|
||||
* Allows WHD to operate with specific SDIO/SPI bus
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* WiFi device GPIO pin selections
|
||||
*/
|
||||
typedef enum whd_dev_gpio_sel
|
||||
{
|
||||
WHD_DEV_GPIO_SEL_GPIO0 = 0, /**< Select GPIO0 */
|
||||
} whd_dev_gpio_sel_t;
|
||||
|
||||
/**
|
||||
* Interrupt configuration structure
|
||||
*/
|
||||
typedef struct whd_intr_config
|
||||
{
|
||||
whd_dev_gpio_sel_t dev_gpio_sel; /**< WiFi device-side GPIO pin selection */
|
||||
whd_bool_t is_falling_edge; /**< Interrupt trigger (polarity) */
|
||||
} whd_intr_config_t;
|
||||
|
||||
/**
|
||||
* Prototype for a user-defined function to enable interrupt to be signaled.
|
||||
*
|
||||
* This function must be provided whenever @ref WHD_BUS_SDIO_OOB_INTR is set.
|
||||
*
|
||||
* WHD will call this function to enable or disable an interrupt depending on the enable bool variable. When the interrupt
|
||||
* is asserted, the IRQ handler must call the appropriate "asserted" function with the WHD
|
||||
* context pointer associated with the IRQ.
|
||||
*
|
||||
* @param whd_drv Pointer to handle instance of the driver
|
||||
* @param intr Opaque interrupt signal
|
||||
* @param enable WHD_TRUE means to enable the interrupt, otherwise disable.
|
||||
*/
|
||||
typedef void (*whd_enable_intr_func_t)(whd_driver_t whd_drv, const whd_variant_t intr, whd_bool_t enable);
|
||||
|
||||
/**
|
||||
* Prototype for a user-defined function to get interrupt configuration.
|
||||
*
|
||||
* WHD calls this function to get an interrupt's configuration.
|
||||
*
|
||||
* This function must be provided whenever @ref WHD_BUS_SDIO_OOB_INTR is set.
|
||||
*
|
||||
* @param whd_driver Pointer to handle instance of the driver
|
||||
* @param intr Opaque interrupt signal
|
||||
* @param config Pointer to the interrupt configuration
|
||||
*/
|
||||
typedef void (*whd_get_intr_config_func_t)(whd_driver_t whd_driver, const whd_variant_t intr,
|
||||
whd_intr_config_t *config);
|
||||
|
||||
/**
|
||||
* Structure of function pointers for bus operations.
|
||||
*/
|
||||
struct whd_bus_funcs
|
||||
{
|
||||
whd_enable_intr_func_t whd_enable_intr; /**< Enable interrupt to be signaled */
|
||||
whd_get_intr_config_func_t whd_get_intr_config; /**< Get interrupt configuration */
|
||||
};
|
||||
/* @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C" */
|
||||
#endif
|
||||
#endif /* INCLUDED_WHD_BUS_TYPES_H */
|
||||
|
|
@ -0,0 +1,226 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file whd_events.h
|
||||
* Header for Event detection
|
||||
*
|
||||
* Provides constants and prototypes for functions that allow
|
||||
* user applications to receive event callbacks and set event handlers
|
||||
*/
|
||||
#ifndef INCLUDED_WHD_EVENTS_API_H
|
||||
#define INCLUDED_WHD_EVENTS_API_H
|
||||
|
||||
#include "whd.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/* List of events */
|
||||
#define WLC_E_NONE (0x7FFFFFFE) /**< Indicates the end of the event array list */
|
||||
|
||||
#define WLC_E_SET_SSID 0 /**< Indicates status of set SSID. This event occurs when STA tries to join the AP*/
|
||||
#define WLC_E_AUTH 3 /**< 802.11 AUTH request event occurs when STA tries to get authenticated with the AP */
|
||||
#define WLC_E_DEAUTH 5 /**< 802.11 DEAUTH request event occurs when the the SOFTAP is stopped to deuthenticate the connected stations*/
|
||||
#define WLC_E_DEAUTH_IND 6 /**< 802.11 DEAUTH indication event occurs when the STA gets deauthenticated by the AP */
|
||||
#define WLC_E_ASSOC 7 /**< 802.11 ASSOC request event occurs when STA joins the AP */
|
||||
#define WLC_E_ASSOC_IND 8 /**< 802.11 ASSOC indication occurs when a station joins the SOFTAP that is started */
|
||||
#define WLC_E_REASSOC 9 /**< 802.11 REASSOC request event when the STA again gets associated with the AP */
|
||||
#define WLC_E_REASSOC_IND 10 /**< 802.11 REASSOC indication occurs when a station again reassociates with the SOFTAP*/
|
||||
#define WLC_E_DISASSOC 11 /**< 802.11 DISASSOC request occurs when the STA the tries to leave the AP*/
|
||||
#define WLC_E_DISASSOC_IND 12 /**< 802.11 DISASSOC indication occurs when the connected station gets disassociates from SOFTAP,
|
||||
also when STA gets diassociated by the AP*/
|
||||
#define WLC_E_LINK 16 /**< generic link indication */
|
||||
#define WLC_E_PROBREQ_MSG 44 /**< Indicates probe request received for the SOFTAP started*/
|
||||
#define WLC_E_PSK_SUP 46 /**< WPA Handshake fail during association*/
|
||||
#define WLC_E_ACTION_FRAME 59 /**< Indicates Action frame Rx */
|
||||
#define WLC_E_ACTION_FRAME_COMPLETE 60 /**< Indicates Action frame Tx complete */
|
||||
#define WLC_E_ESCAN_RESULT 69 /**< escan result event occurs when we scan for the networks */
|
||||
|
||||
/* List of status codes - Applicable for any event type */
|
||||
#define WLC_E_STATUS_SUCCESS 0 /**< operation was successful */
|
||||
#define WLC_E_STATUS_FAIL 1 /**< operation failed */
|
||||
#define WLC_E_STATUS_TIMEOUT 2 /**< operation timed out */
|
||||
#define WLC_E_STATUS_NO_NETWORKS 3 /**< failed due to no matching network found */
|
||||
#define WLC_E_STATUS_ABORT 4 /**< operation was aborted */
|
||||
#define WLC_E_STATUS_NO_ACK 5 /**< protocol failure: packet not ack'd */
|
||||
#define WLC_E_STATUS_UNSOLICITED 6 /**< AUTH or ASSOC packet was unsolicited */
|
||||
#define WLC_E_STATUS_ATTEMPT 7 /**< attempt to assoc to an auto auth configuration */
|
||||
#define WLC_E_STATUS_PARTIAL 8 /**< scan results are incomplete */
|
||||
#define WLC_E_STATUS_NEWSCAN 9 /**< scan aborted by another scan */
|
||||
#define WLC_E_STATUS_NEWASSOC 10 /**< scan aborted due to assoc in progress */
|
||||
#define WLC_E_STATUS_11HQUIET 11 /**< 802.11h quiet period started */
|
||||
#define WLC_E_STATUS_SUPPRESS 12 /**< user disabled scanning (WLC_SET_SCANSUPPRESS) */
|
||||
#define WLC_E_STATUS_NOCHANS 13 /**< no allowable channels to scan */
|
||||
#define WLC_E_STATUS_CCXFASTRM 14 /**< scan aborted due to CCX fast roam */
|
||||
#define WLC_E_STATUS_CS_ABORT 15 /**< abort channel select */
|
||||
#define WLC_E_STATUS_ERROR 16 /**< request failed due to error */
|
||||
#define WLC_E_STATUS_INVALID 0xff /**< Invalid status code to init variables. */
|
||||
|
||||
#define WLC_SUP_STATUS_OFFSET (256) /**< Status offset added to the status codes to match the values from firmware. */
|
||||
|
||||
/**
|
||||
* @brief Status code for event WLC_E_PSK_SUP
|
||||
*
|
||||
* -Basic supplicant authentication states
|
||||
*
|
||||
+ WLC_SUP_DISCONNECTED
|
||||
* + WLC_SUP_CONNECTING
|
||||
* + WLC_SUP_IDREQUIRED
|
||||
* + WLC_SUP_AUTHENTICATING
|
||||
* + WLC_SUP_AUTHENTICATED
|
||||
* + WLC_SUP_KEYXCHANGE
|
||||
* + WLC_SUP_KEYED
|
||||
* + WLC_SUP_TIMEOUT
|
||||
* + WLC_SUP_LAST_BASIC_STATE
|
||||
* -Extended supplicant authentication states
|
||||
* + WLC_SUP_KEYXCHANGE_WAIT_M1
|
||||
* + WLC_SUP_KEYXCHANGE_PREP_M2
|
||||
* + WLC_SUP_KEYXCHANGE_WAIT_M3
|
||||
* + WLC_SUP_KEYXCHANGE_PREP_M4
|
||||
* + WLC_SUP_KEYXCHANGE_WAIT_G1
|
||||
* + WLC_SUP_KEYXCHANGE_PREP_G2
|
||||
*/
|
||||
typedef enum sup_auth_status
|
||||
{
|
||||
WLC_SUP_DISCONNECTED = 0 + WLC_SUP_STATUS_OFFSET, /**< Disconnected */
|
||||
WLC_SUP_CONNECTING = 1 + WLC_SUP_STATUS_OFFSET, /**< Connecting */
|
||||
WLC_SUP_IDREQUIRED = 2 + WLC_SUP_STATUS_OFFSET, /**< ID Required */
|
||||
WLC_SUP_AUTHENTICATING = 3 + WLC_SUP_STATUS_OFFSET, /**< Authenticating */
|
||||
WLC_SUP_AUTHENTICATED = 4 + WLC_SUP_STATUS_OFFSET, /**< Authenticated */
|
||||
WLC_SUP_KEYXCHANGE = 5 + WLC_SUP_STATUS_OFFSET, /**< Key Exchange */
|
||||
WLC_SUP_KEYED = 6 + WLC_SUP_STATUS_OFFSET, /**< Key Exchanged */
|
||||
WLC_SUP_TIMEOUT = 7 + WLC_SUP_STATUS_OFFSET, /**< Timeout */
|
||||
WLC_SUP_LAST_BASIC_STATE = 8 + WLC_SUP_STATUS_OFFSET, /**< Last Basic State */
|
||||
WLC_SUP_KEYXCHANGE_WAIT_M1 = WLC_SUP_AUTHENTICATED, /**< Waiting to receive handshake msg M1 */
|
||||
WLC_SUP_KEYXCHANGE_PREP_M2 = WLC_SUP_KEYXCHANGE, /**< Preparing to send handshake msg M2 */
|
||||
WLC_SUP_KEYXCHANGE_WAIT_M3 = WLC_SUP_LAST_BASIC_STATE, /**< Waiting to receive handshake msg M3 */
|
||||
WLC_SUP_KEYXCHANGE_PREP_M4 = 9 + WLC_SUP_STATUS_OFFSET, /**< Preparing to send handshake msg M4 */
|
||||
WLC_SUP_KEYXCHANGE_WAIT_G1 = 10 + WLC_SUP_STATUS_OFFSET, /**< Waiting to receive handshake msg G1 */
|
||||
WLC_SUP_KEYXCHANGE_PREP_G2 = 11 + WLC_SUP_STATUS_OFFSET /**< Preparing to send handshake msg G2 */
|
||||
} sup_auth_status_t;
|
||||
|
||||
#define WHD_MSG_IFNAME_MAX 16 /**< Max length of Interface name */
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
/**
|
||||
* Structure to store ethernet header fields in event packets
|
||||
*/
|
||||
typedef struct whd_event_eth_hdr
|
||||
{
|
||||
uint16_t subtype; /**< Vendor specific..32769 */
|
||||
uint16_t length; /**< Length of ethernet header*/
|
||||
uint8_t version; /**< Version is 0 */
|
||||
uint8_t oui[3]; /**< Organizationally Unique Identifier */
|
||||
uint16_t usr_subtype; /**< User specific data */
|
||||
} whd_event_eth_hdr_t;
|
||||
|
||||
/**
|
||||
* Structure to store ethernet destination, source and ethertype in event packets
|
||||
*/
|
||||
typedef struct whd_event_ether_header
|
||||
{
|
||||
whd_mac_t destination_address; /**< Ethernet destination address */
|
||||
whd_mac_t source_address; /**< Ethernet source address */
|
||||
uint16_t ethertype; /**< Ethertype for identifying event packets */
|
||||
} whd_event_ether_header_t;
|
||||
|
||||
/**
|
||||
* Structure to store fields after ethernet header in event message
|
||||
*/
|
||||
struct whd_event_msg
|
||||
{
|
||||
uint16_t version; /**< Version */
|
||||
uint16_t flags; /**< see flags below */
|
||||
uint32_t event_type; /**< Event type indicating a response from firmware for IOCTLs/IOVARs sent */
|
||||
uint32_t status; /**< Status code corresponding to any event type */
|
||||
uint32_t reason; /**< Reason code associated with the event occurred */
|
||||
uint32_t auth_type; /**< WLC_E_AUTH: 802.11 AUTH request */
|
||||
uint32_t datalen; /**< Length of data in event message */
|
||||
whd_mac_t addr; /**< Station address (if applicable) */
|
||||
char ifname[WHD_MSG_IFNAME_MAX]; /**< name of the incoming packet interface */
|
||||
uint8_t ifidx; /**< destination OS i/f index */
|
||||
uint8_t bsscfgidx; /**< source bsscfg index */
|
||||
};
|
||||
|
||||
/**
|
||||
* Event structure used by driver msgs
|
||||
*/
|
||||
typedef struct whd_event
|
||||
{
|
||||
whd_event_ether_header_t eth; /**< Variable to store ethernet destination, source and ethertype in event packets */
|
||||
whd_event_eth_hdr_t eth_evt_hdr; /**< Variable to store ethernet header fields in event message */
|
||||
whd_event_header_t whd_event; /**< Variable to store rest of the event packet fields after ethernet header */
|
||||
/* data portion follows */
|
||||
} whd_event_t;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
/** @addtogroup event WHD Event handling API
|
||||
* Functions that allow user applications to receive event callbacks and set event handlers
|
||||
* @{
|
||||
*/
|
||||
/** Event handler prototype definition
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param event_header whd event header
|
||||
* @param event_data event data
|
||||
* @param handler_user_data semaphore data
|
||||
*/
|
||||
typedef void *(*whd_event_handler_t)(whd_interface_t ifp, const whd_event_header_t *event_header,
|
||||
const uint8_t *event_data, void *handler_user_data);
|
||||
|
||||
/** Registers a handler to receive event callbacks.
|
||||
*
|
||||
* This function registers a callback handler to be notified when
|
||||
* a particular event is received.
|
||||
*
|
||||
*
|
||||
* @note Currently each event may only be registered to one handler and there is a limit to the number of simultaneously
|
||||
* registered events. Maximum of 5 event handlers can registered simultaneously, this also includes the internal
|
||||
* event handler registration which happens during scan, join and starting an AP.
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param event_type Pointer to the event list array
|
||||
* @param handler_func A function pointer to the handler callback
|
||||
* @param handler_user_data A pointer value which will be passed to the event handler function
|
||||
* at the time an event is triggered (NULL is allowed)
|
||||
* @param event_index Entry where the event handler is registered in the list
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
uint32_t whd_wifi_set_event_handler(whd_interface_t ifp, const uint32_t *event_type, whd_event_handler_t handler_func,
|
||||
void *handler_user_data, uint16_t *event_index);
|
||||
/* @} */
|
||||
|
||||
/** Delete/Deregister the event entry where callback is registered
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param event_index Event index obtained during registration by whd_wifi_set_event_handler
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
|
||||
uint32_t whd_wifi_deregister_event_handler(whd_interface_t ifp, uint16_t event_index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
#endif /* ifndef */
|
||||
|
|
@ -0,0 +1,230 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file whd_network_types.h
|
||||
* Prototypes of functions corresponding to Buffer and Network Interface
|
||||
*
|
||||
* This file provides prototypes for functions which allows different functionalities related to:
|
||||
* - Buffer Interface: Allocate and release a packet buffer, Retrieve the current pointer and size of a packet buffer, etc.
|
||||
* - Network Interface: Called by WHD to pass received data to the network stack, to send an ethernet frame to WHD, etc.
|
||||
*/
|
||||
#include "whd.h"
|
||||
|
||||
#ifndef INC_WHD_NETWORK_TYPES_H_
|
||||
#define INC_WHD_NETWORK_TYPES_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
/** @addtogroup buffif WHD Buffer Interface API
|
||||
* Allows WHD to perform buffer related operations like, allocating, releasing, retrieving the current pointer of and size of a packet buffer.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Indicates transmit/receive direction that the packet buffer has
|
||||
* been used for. This is needed if tx/rx pools are separate.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
WHD_NETWORK_TX, /**< Transmit direction */
|
||||
WHD_NETWORK_RX /**< Recieve direction */
|
||||
} whd_buffer_dir_t;
|
||||
|
||||
/**
|
||||
* Allows WHD to perform buffer related operations like, allocating, releasing, retrieving the current pointer of and size of a packet buffer.
|
||||
*/
|
||||
struct whd_buffer_funcs
|
||||
{
|
||||
/** Allocates a packet buffer
|
||||
*
|
||||
* Implemented in the port layer interface which is specific to the
|
||||
* buffering scheme in use.
|
||||
* Attempts to allocate a packet buffer of the size requested. It can do this
|
||||
* by allocating a pre-existing packet from a pool, using a static buffer,
|
||||
* or by dynamically allocating memory. The method of allocation does not
|
||||
* concern WHD, however it must match the way the network stack expects packet
|
||||
* buffers to be allocated. Usually WHD requires packet of size of WHD_LINK_MTU
|
||||
* which includes the MTU, other other various header. Refer to whd_types.h
|
||||
* to find the size of WHD_LINK_MTU
|
||||
*
|
||||
* @param buffer A pointer which receives the allocated packet buffer handle
|
||||
* @param direction Indicates transmit/receive direction that the packet buffer is
|
||||
* used for. This may be needed if tx/rx pools are separate.
|
||||
* @param size The number of bytes to allocate.
|
||||
* @param wait Whether to wait for a packet buffer to be available
|
||||
*
|
||||
* @return WHD_SUCCESS or error code
|
||||
*
|
||||
*/
|
||||
whd_result_t (*whd_host_buffer_get)(whd_buffer_t *buffer, whd_buffer_dir_t direction, unsigned short size,
|
||||
unsigned long wait);
|
||||
|
||||
/** Releases a packet buffer
|
||||
*
|
||||
* Implemented in the port layer interface, which will be specific to the
|
||||
* buffering scheme in use.
|
||||
* This function is used by WHD to indicate that it no longer requires
|
||||
* a packet buffer. The buffer can then be released back into a pool for
|
||||
* reuse, or the dynamically allocated memory can be freed, according to
|
||||
* how the packet was allocated.
|
||||
* Returns void since WHD cannot do anything about failures
|
||||
*
|
||||
* @param buffer The handle of the packet buffer to be released
|
||||
* @param direction Indicates transmit/receive direction that the packet buffer has
|
||||
* been used for. This might be needed if tx/rx pools are separate.
|
||||
*
|
||||
*/
|
||||
void (*whd_buffer_release)(whd_buffer_t buffer, whd_buffer_dir_t direction);
|
||||
|
||||
/** Retrieves the current pointer of a packet buffer
|
||||
*
|
||||
* Implemented in the port layer interface which is specific to the
|
||||
* buffering scheme in use.
|
||||
* Since packet buffers usually need to be created with space at the
|
||||
* front for additional headers, this function allows WHD to get
|
||||
* the current 'front' location pointer.
|
||||
*
|
||||
* @param buffer The handle of the packet buffer whose pointer is to be retrieved
|
||||
*
|
||||
* @return The packet buffer's current pointer.
|
||||
*/
|
||||
uint8_t *(*whd_buffer_get_current_piece_data_pointer)(whd_buffer_t buffer);
|
||||
|
||||
/** Retrieves the size of a packet buffer
|
||||
*
|
||||
* Implemented in the port layer interface which is specific to the
|
||||
* buffering scheme in use.
|
||||
* Since packet buffers usually need to be created with space at the
|
||||
* front for additional headers, the memory block use to contain a packet buffer
|
||||
* will often be larger than the current size of the packet buffer data.
|
||||
* This function allows WHD to retrieve the current size of a packet buffer's data.
|
||||
*
|
||||
* @param buffer The handle of the packet buffer whose size is to be retrieved
|
||||
*
|
||||
* @return The size of the packet buffer.
|
||||
*/
|
||||
uint16_t (*whd_buffer_get_current_piece_size)(whd_buffer_t buffer);
|
||||
|
||||
/** Sets the current size of a WHD packet
|
||||
*
|
||||
* Implemented in the port layer interface which is specific to the
|
||||
* buffering scheme in use.
|
||||
* This function sets the current length of a WHD packet buffer
|
||||
*
|
||||
* @param buffer The packet to be modified
|
||||
* @param size The new size of the packet buffer
|
||||
*
|
||||
* @return WHD_SUCCESS or error code
|
||||
*/
|
||||
whd_result_t (*whd_buffer_set_size)(whd_buffer_t buffer, unsigned short size);
|
||||
|
||||
/** Moves the current pointer of a packet buffer
|
||||
*
|
||||
* Implemented in the port layer interface which is specific to the buffering scheme in use.
|
||||
*
|
||||
* Since packet buffers usually need to be created with space at the front for additional headers,
|
||||
* this function allows WHD to move the current 'front' location pointer so that it has space to
|
||||
* add headers to transmit packets, and so that the network stack does not see the internal WHD
|
||||
* headers on received packets.
|
||||
*
|
||||
* @param buffer A pointer to the handle of the current packet buffer for which the
|
||||
* current pointer will be moved. On return this may contain a pointer
|
||||
* to a newly allocated packet buffer which has been daisy chained to
|
||||
* the front of the given packet buffer. This would be the case if the given packet
|
||||
* buffer didn't have enough space at the front.
|
||||
* @param add_remove_amount This is the number of bytes to move the current pointer of the packet
|
||||
* buffer - a negative value increases the space for headers at the front
|
||||
* of the packet, a positive value decreases the space.
|
||||
*
|
||||
* @return WHD_SUCCESS or error code
|
||||
*/
|
||||
whd_result_t (*whd_buffer_add_remove_at_front)(whd_buffer_t *buffer, int32_t add_remove_amount);
|
||||
};
|
||||
/* @} */
|
||||
|
||||
/** @addtogroup netif WHD Network Interface API
|
||||
* Allows WHD to pass received data to the network stack, to send an ethernet frame to WHD, etc.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Contains functions which allows WHD to pass received data to the network stack, to send an ethernet frame to WHD, etc
|
||||
*/
|
||||
struct whd_netif_funcs
|
||||
{
|
||||
/** Called by WHD to pass received data to the network stack
|
||||
*
|
||||
*
|
||||
* Packets received from the Wi-Fi network by WHD are forwarded to by calling function ptr which
|
||||
* must be implemented in the network interface. Ethernet headers
|
||||
* are present at the start of these packet buffers.
|
||||
*
|
||||
* This function is called asynchronously in the context of the
|
||||
* WHD thread whenever new data has arrived.
|
||||
* Packet buffers are allocated within WHD, and ownership is transferred
|
||||
* to the network stack. The network stack or application is thus
|
||||
* responsible for releasing the packet buffers.
|
||||
* Most packet buffering systems have a pointer to the 'current point' within
|
||||
* the packet buffer. When this function is called, the pointer points
|
||||
* to the start of the Ethernet header. There is other inconsequential data
|
||||
* before the Ethernet header.
|
||||
*
|
||||
* It is preferable that the (whd_network_process_ethernet_data)() function simply puts
|
||||
* the received packet on a queue for processing by another thread. This avoids the
|
||||
* WHD thread being unnecessarily tied up which would delay other packets
|
||||
* being transmitted or received.
|
||||
*
|
||||
* @param interface The interface on which the packet was received.
|
||||
* @param buffer Handle of the packet which has just been received. Responsibility for
|
||||
* releasing this buffer is transferred from WHD at this point.
|
||||
*
|
||||
*/
|
||||
void (*whd_network_process_ethernet_data)(whd_interface_t ifp, whd_buffer_t buffer);
|
||||
};
|
||||
|
||||
/** To send an ethernet frame to WHD (called by the Network Stack)
|
||||
*
|
||||
* This function takes ethernet data from the network stack and queues it for transmission over the wireless network.
|
||||
* The function can be called from any thread context as it is thread safe, however
|
||||
* it must not be called from interrupt context since it might get blocked while waiting
|
||||
* for a lock on the transmit queue.
|
||||
*
|
||||
* This function returns immediately after the packet has been queued for transmit,
|
||||
* NOT after it has been transmitted. Packet buffers passed to the WHD
|
||||
* are released inside the WHD once they have been transmitted.
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param buffer Handle of the packet buffer to be sent.
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*
|
||||
*/
|
||||
extern void whd_network_send_ethernet_data(whd_interface_t ifp, whd_buffer_t buffer);
|
||||
/* @} */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C" */
|
||||
#endif
|
||||
#endif /* INC_WHD_NETWORK_TYPES_H_ */
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file whd_resource_api.h
|
||||
* Prototypes of functions for providing external resources to the radio driver
|
||||
*
|
||||
* This file provides prototypes for functions which allow
|
||||
* WHD to download firmware, NVRAM and CLM BLOB on a particular hardware platform.
|
||||
*
|
||||
*/
|
||||
#include "whd.h"
|
||||
|
||||
#ifndef INCLUDED_WHD_RESOURCE_API_H_
|
||||
#define INCLUDED_WHD_RESOURCE_API_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#define BLOCK_SIZE 1024 /**< Size of the block */
|
||||
/**
|
||||
* Type of resources
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
WHD_RESOURCE_WLAN_FIRMWARE, /**< Resource type: WLAN Firmware */
|
||||
WHD_RESOURCE_WLAN_NVRAM, /**< Resource type: NVRAM file */
|
||||
WHD_RESOURCE_WLAN_CLM, /**< Resource type: CLM_BLOB file */
|
||||
} whd_resource_type_t;
|
||||
|
||||
/******************************************************
|
||||
* Global Variables
|
||||
******************************************************/
|
||||
|
||||
/** @addtogroup res WHD Resource API
|
||||
* @brief Functions that enable WHD to download WLAN firmware, NVRAM and CLM BLOB on a particular hardware platform.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Interface to a data source that provides external resources to the radio driver
|
||||
*/
|
||||
|
||||
/** This data structure defines a source for data generally intended to be downloaded to the radio device.
|
||||
*
|
||||
* The data is assumed to be available as a set of blocks that are all the same size with the exception
|
||||
* of the last block. The whd_get_resource_block_size function returns this block size. The whd_get_resource_block call
|
||||
* returns a pointer to a block of data. The actual storage for the data block is owned by the data source, so only a pointer
|
||||
* to the block is returned. There are two predominate use cases. If the data is stored in the internal
|
||||
* flash memory, then whd_get_resource_no_of_blocks will return 1 and a call to whd_get_resource_block will return a pointer to
|
||||
* the data image with the size being the size of the data image. If the data is stored in an external flash of some
|
||||
* type, each block of data can be read from the external flash one at a time. whd_get_resource_no_of_blocks will return
|
||||
* the physical number of blocks in the data and each call to whd_get_resource_block will read data from the external memory
|
||||
* and make it available via an internal buffer.
|
||||
*/
|
||||
struct whd_resource_source
|
||||
{
|
||||
/** Gets the size of the resource for respective resource type
|
||||
*
|
||||
*
|
||||
* @param whd_drv Pointer to handle instance of the driver
|
||||
* @param resource Type of resource - WHD_RESOURCE_WLAN_FIRMWARE, WHD_RESOURCE_WLAN_NVRAM, WHD_RESOURCE_WLAN_CLM
|
||||
* @param size_out Size of the resource
|
||||
*
|
||||
* @return WHD_SUCCESS or error code
|
||||
*
|
||||
*/
|
||||
uint32_t (*whd_resource_size)(whd_driver_t whd_drv, whd_resource_type_t resource, uint32_t *size_out);
|
||||
|
||||
/** Gets the resource block for specified resource type
|
||||
*
|
||||
* @param whd_drv Pointer to handle instance of the driver
|
||||
* @param type Type of resource - WHD_RESOURCE_WLAN_FIRMWARE, WHD_RESOURCE_WLAN_NVRAM, WHD_RESOURCE_WLAN_CLM
|
||||
* @param data Pointer to a block of data
|
||||
* @param size_out Size of the resource
|
||||
*
|
||||
* @return WHD_SUCCESS or error code
|
||||
*
|
||||
*/
|
||||
uint32_t (*whd_get_resource_block)(whd_driver_t whd_drv, whd_resource_type_t type, const uint8_t **data,
|
||||
uint32_t *size_out);
|
||||
|
||||
/** Gets block count for the specified resource_type
|
||||
*
|
||||
* @param whd_drv Pointer to handle instance of the driver
|
||||
* @param type Type of resource - WHD_RESOURCE_WLAN_FIRMWARE, WHD_RESOURCE_WLAN_NVRAM, WHD_RESOURCE_WLAN_CLM
|
||||
* @param block_count Pointer to store block count for the resource
|
||||
*
|
||||
* @return WHD_SUCCESS or error code
|
||||
*
|
||||
*/
|
||||
uint32_t (*whd_get_resource_no_of_blocks)(whd_driver_t whd_drv, whd_resource_type_t type, uint32_t *block_count);
|
||||
|
||||
/** Gets block size for the specified resource_type
|
||||
*
|
||||
* @param whd_drv Pointer to handle instance of the driver
|
||||
* @param type Type of resources - WHD_RESOURCE_WLAN_FIRMWARE, WHD_RESOURCE_WLAN_NVRAM, WHD_RESOURCE_WLAN_CLM
|
||||
* @param size_out Pointer to store size of the block
|
||||
*
|
||||
* @return WHD_SUCCESS or error code
|
||||
*
|
||||
*/
|
||||
uint32_t (*whd_get_resource_block_size)(whd_driver_t whd_drv, whd_resource_type_t type, uint32_t *size_out);
|
||||
};
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
#endif /* ifndef INCLUDED_WHD_RESOURCE_API_H_ */
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,3 @@
|
|||
#define WHD_VERSION "1b9fceb7"
|
||||
#define WHD_BRANCH "master"
|
||||
#define WHD_DATE "2019-07-03 16:07:52 +0530"
|
|
@ -0,0 +1,913 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* Prototypes of functions for controlling the Wi-Fi system
|
||||
*
|
||||
* This file provides prototypes for end-user functions which allow
|
||||
* actions such as scanning for Wi-Fi networks, joining Wi-Fi
|
||||
* networks, getting the MAC address, etc
|
||||
*
|
||||
*/
|
||||
|
||||
#include "whd.h"
|
||||
#include "whd_types.h"
|
||||
|
||||
#ifndef INCLUDED_WHD_WIFI_API_H
|
||||
#define INCLUDED_WHD_WIFI_API_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Function declarations
|
||||
******************************************************/
|
||||
|
||||
/** @addtogroup wifi WHD Wi-Fi API
|
||||
* APIs for controlling the Wi-Fi system
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup wifimanagement WHD Wi-Fi Management API
|
||||
* @ingroup wifi
|
||||
* Initialisation and other management functions for WHD system
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Initialize an instance of the WHD driver
|
||||
*
|
||||
* @param whd_driver_ptr Pointer to Pointer to handle instance of the driver
|
||||
* @param whd_init_config Pointer to configuration data that controls how the driver is initialized
|
||||
* @param resource_ops Pointer to resource interface to provide resources to the driver initialization process
|
||||
* @param buffer_ops Pointer to a buffer interface to provide buffer related services to the driver instance
|
||||
* @param network_ops Pointer to a whd_netif_funcs_t to provide network stack services to the driver instance
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_init(whd_driver_t *whd_driver_ptr, whd_init_config_t *whd_init_config,
|
||||
whd_resource_source_t *resource_ops, whd_buffer_funcs_t *buffer_ops,
|
||||
whd_netif_funcs_t *network_ops);
|
||||
/* @} */
|
||||
/* @} */
|
||||
|
||||
/** @addtogroup busapi WHD Bus API
|
||||
* Allows WHD to operate with specific SDIO/SPI bus
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Attach the WLAN Device to a specific SDIO bus
|
||||
*
|
||||
* @param whd_driver Pointer to handle instance of the driver
|
||||
* @param whd_config Configuration for SDIO bus
|
||||
* @param sdio_obj The SDHC hardware interface, from the Level 3 CY HW APIs
|
||||
* @param sdio_ops Pointer to a whd_sdio_funcs_t to provide SDIO services to the driver instance
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_bus_sdio_attach(whd_driver_t whd_driver, whd_sdio_config_t *whd_config, void *sdio_obj,
|
||||
whd_sdio_funcs_t *sdio_ops);
|
||||
|
||||
/** Notify the WLAN device that the SDIO host-wake signal asserted.
|
||||
*
|
||||
* This function may be called after the WHD calls @ref whd_enable_intr_func_t with enable
|
||||
* set to WHD_TRUE.
|
||||
*
|
||||
* @param whd_driver Pointer to handle instance of the driver
|
||||
*/
|
||||
extern void whd_bus_sdio_oob_intr_asserted(whd_driver_t whd_driver);
|
||||
|
||||
/** Attach the WLAN Device to a specific SPI bus
|
||||
*
|
||||
* @param whd_driver Pointer to handle instance of the driver
|
||||
* @param whd_config Configuration for SPI bus
|
||||
* @param spi_obj The SPI hardware interface, from the Level 3 CY HW APIs
|
||||
* @param spi_ops Pointer to a whd_spi_funcs_t to provide SPI services to the driver instance
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_bus_spi_attach(whd_driver_t whd_driver, whd_spi_config_t *whd_config, void *spi_obj,
|
||||
whd_spi_funcs_t *spi_ops);
|
||||
|
||||
/**
|
||||
* Notify the WLAN device that the SPI interrupt signal asserted.
|
||||
*
|
||||
* This function may be called after the WHD calls @ref whd_enable_intr_func_t with enable
|
||||
* set to WHD_TRUE.
|
||||
*
|
||||
* @param whd_driver Pointer to the handle instance of the driver associated to the event
|
||||
*/
|
||||
extern void whd_bus_spi_oob_intr_asserted(whd_driver_t whd_driver);
|
||||
/* @} */
|
||||
|
||||
/** @addtogroup wifi WHD Wi-Fi API
|
||||
* APIs for controlling the Wi-Fi system
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup wifimanagement WHD Wi-Fi Management API
|
||||
* @ingroup wifi
|
||||
* Initialisation and other management functions for WHD system
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Turn on the Wi-Fi device
|
||||
*
|
||||
* Initialise Wi-Fi platform
|
||||
* Program various WiFi parameters and modes
|
||||
*
|
||||
* @param whd_driver Pointer to handle instance of the driver
|
||||
* @param ifpp Pointer to Pointer to handle instance of whd interface
|
||||
*
|
||||
* @return WHD_SUCCESS if initialization is successful, error code otherwise
|
||||
*/
|
||||
extern uint32_t whd_wifi_on(whd_driver_t whd_driver, whd_interface_t *ifpp);
|
||||
|
||||
/**
|
||||
* Turn off the Wi-Fi device
|
||||
*
|
||||
* - De-Initialises the required parts of the hardware platform
|
||||
* i.e. pins for SDIO/SPI, interrupt, reset, power etc.
|
||||
*
|
||||
* - De-Initialises the whd thread which arbitrates access
|
||||
* to the SDIO/SPI bus
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
*
|
||||
* @return WHD_SUCCESS if deinitialization is successful, Error code otherwise
|
||||
*/
|
||||
extern uint32_t whd_wifi_off(whd_interface_t ifp);
|
||||
|
||||
/** Shutdown this instance of the wifi driver, freeing all used resources
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_deinit(whd_interface_t ifp);
|
||||
|
||||
/** Brings up the Wi-Fi core
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_wifi_set_up(whd_interface_t ifp);
|
||||
|
||||
/** Bring down the Wi-Fi core
|
||||
*
|
||||
* WARNING / NOTE:
|
||||
* This brings down the Wi-Fi core and existing network connections will be lost.
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_wifi_set_down(whd_interface_t ifp);
|
||||
|
||||
/** Creates a secondary interface
|
||||
*
|
||||
* @param whd_drv Pointer to handle instance of the driver
|
||||
* @param mac_addr MAC address for the interface
|
||||
* @param ifpp Pointer to the whd interface pointer
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_add_secondary_interface(whd_driver_t whd_drv, whd_mac_t *mac_addr, whd_interface_t *ifpp);
|
||||
/* @} */
|
||||
|
||||
/** @addtogroup wifijoin WHD Wi-Fi Join, Scan and Halt API
|
||||
* @ingroup wifi
|
||||
* Wi-Fi APIs for join, scan & leave
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Scan result callback function pointer type
|
||||
*
|
||||
* @param result_ptr A pointer to the pointer that indicates where to put the next scan result
|
||||
* @param user_data User provided data
|
||||
* @param status Status of scan process
|
||||
*/
|
||||
typedef void (*whd_scan_result_callback_t)(whd_scan_result_t **result_ptr, void *user_data, whd_scan_status_t status);
|
||||
|
||||
/** Initiates a scan to search for 802.11 networks.
|
||||
*
|
||||
* This functions returns the scan results with limited sets of parameter in a buffer provided by the caller.
|
||||
* It is also a blocking call. It is an simplified version of the whd_wifi_scan().
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param scan_result pointer to user requested records buffer.
|
||||
* @param count No of records user is interested in.
|
||||
* If 0 return the total record count.
|
||||
*
|
||||
* @note When scanning specific channels, devices with a strong signal strength on nearby channels may be detected
|
||||
*
|
||||
* @return record count or Error code
|
||||
*/
|
||||
extern uint32_t whd_wifi_scan_synch(whd_interface_t ifp,
|
||||
whd_sync_scan_result_t *scan_result,
|
||||
uint32_t count
|
||||
);
|
||||
|
||||
/** Initiates a scan to search for 802.11 networks.
|
||||
*
|
||||
* The scan progressively accumulates results over time, and may take between 1 and 10 seconds to complete.
|
||||
* The results of the scan will be individually provided to the callback function.
|
||||
* Note: The callback function will be executed in the context of the WHD thread and so must not perform any
|
||||
* actions that may cause a bus transaction.
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param scan_type Specifies whether the scan should be Active, Passive or scan Prohibited channels
|
||||
* @param bss_type Specifies whether the scan should search for Infrastructure networks (those using
|
||||
* an Access Point), Ad-hoc networks, or both types.
|
||||
* @param optional_ssid If this is non-Null, then the scan will only search for networks using the specified SSID.
|
||||
* @param optional_mac If this is non-Null, then the scan will only search for networks where
|
||||
* the BSSID (MAC address of the Access Point) matches the specified MAC address.
|
||||
* @param optional_channel_list If this is non-Null, then the scan will only search for networks on the
|
||||
* specified channels - array of channel numbers to search, terminated with a zero
|
||||
* @param optional_extended_params If this is non-Null, then the scan will obey the specifications about
|
||||
* dwell times and number of probes.
|
||||
* @param callback The callback function which will receive and process the result data.
|
||||
* @param result_ptr Pointer to a pointer to a result storage structure.
|
||||
* @param user_data user specific data that will be passed directly to the callback function
|
||||
*
|
||||
* @note - When scanning specific channels, devices with a strong signal strength on nearby channels may be detected
|
||||
* - Callback must not use blocking functions, nor use WHD functions, since it is called from the context of the
|
||||
* WHD thread.
|
||||
* - The callback, result_ptr and user_data variables will be referenced after the function returns.
|
||||
* Those variables must remain valid until the scan is complete.
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_wifi_scan(whd_interface_t ifp,
|
||||
whd_scan_type_t scan_type,
|
||||
whd_bss_type_t bss_type,
|
||||
const whd_ssid_t *optional_ssid,
|
||||
const whd_mac_t *optional_mac,
|
||||
const uint16_t *optional_channel_list,
|
||||
const whd_scan_extended_params_t *optional_extended_params,
|
||||
whd_scan_result_callback_t callback,
|
||||
whd_scan_result_t **result_ptr,
|
||||
void *user_data);
|
||||
|
||||
/** Abort a previously issued scan
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_wifi_stop_scan(whd_interface_t ifp);
|
||||
|
||||
/** Joins a Wi-Fi network
|
||||
*
|
||||
* Scans for, associates and authenticates with a Wi-Fi network.
|
||||
* On successful return, the system is ready to send data packets.
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param ssid A null terminated string containing the SSID name of the network to join
|
||||
* @param auth_type Authentication type
|
||||
* @param security_key A byte array containing either the cleartext security key for WPA/WPA2/WPA3 secured networks
|
||||
* @param key_length The length of the security_key in bytes.
|
||||
*
|
||||
* @note In case of WPA3/WPA2 transition mode, the security_key value is WPA3 password.
|
||||
*
|
||||
* @return WHD_SUCCESS when the system is joined and ready to send data packets
|
||||
* Error code if an error occurred
|
||||
*/
|
||||
extern uint32_t whd_wifi_join(whd_interface_t ifp, const whd_ssid_t *ssid, whd_security_t auth_type,
|
||||
const uint8_t *security_key, uint8_t key_length);
|
||||
|
||||
/** Joins a specific Wi-Fi network
|
||||
*
|
||||
* Associates and authenticates with a specific Wi-Fi access point.
|
||||
* On successful return, the system is ready to send data packets.
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param ap A pointer to a whd_scan_result_t structure containing AP details
|
||||
* @param security_key A byte array containing either the cleartext security key for WPA/WPA2
|
||||
* secured networks
|
||||
* @param key_length The length of the security_key in bytes.
|
||||
*
|
||||
* @return WHD_SUCCESS when the system is joined and ready to send data packets
|
||||
* Error code if an error occurred
|
||||
*/
|
||||
extern uint32_t whd_wifi_join_specific(whd_interface_t ifp, const whd_scan_result_t *ap, const uint8_t *security_key,
|
||||
uint8_t key_length);
|
||||
|
||||
/* @} */
|
||||
|
||||
/** @addtogroup wifiutilities WHD Wi-Fi Utility API
|
||||
* @ingroup wifi
|
||||
* Allows WHD to perform utility operations
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Set the current channel on the WLAN radio
|
||||
*
|
||||
* @note On most WLAN devices this will set the channel for both AP *AND* STA
|
||||
* (since there is only one radio - it cannot be on two channels simulaneously)
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param channel The desired channel
|
||||
*
|
||||
* @return WHD_SUCCESS if the channel was successfully set
|
||||
* Error code if the channel was not successfully set
|
||||
*/
|
||||
extern uint32_t whd_wifi_set_channel(whd_interface_t ifp, uint32_t channel);
|
||||
|
||||
/** Get the current channel on the WLAN radio
|
||||
*
|
||||
* @note On most WLAN devices this will get the channel for both AP *AND* STA
|
||||
* (since there is only one radio - it cannot be on two channels simulaneously)
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param channel Pointer to receive the current channel
|
||||
*
|
||||
* @return WHD_SUCCESS if the channel was successfully retrieved
|
||||
* Error code if the channel was not successfully retrieved
|
||||
*/
|
||||
extern uint32_t whd_wifi_get_channel(whd_interface_t ifp, uint32_t *channel);
|
||||
|
||||
/** Set the passphrase
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param security_key The security key (passphrase) which is to be set
|
||||
* @param key_length length of the key
|
||||
*
|
||||
* @return WHD_SUCCESS when the key is set
|
||||
* Error code if an error occurred
|
||||
*/
|
||||
extern uint32_t whd_wifi_set_passphrase(whd_interface_t ifp, const uint8_t *security_key, uint8_t key_length);
|
||||
|
||||
/** Set the SAE password
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param security_key The security key (password) which is to be set
|
||||
* @param key_length length of the key
|
||||
*
|
||||
* @return WHD_SUCCESS when the key is set
|
||||
* Error code if an error occurred
|
||||
*/
|
||||
extern uint32_t whd_wifi_sae_password(whd_interface_t ifp, const uint8_t *security_key, uint8_t key_length);
|
||||
|
||||
/** Enable WHD internal supplicant and set WPA2 passphrase in case of WPA3/WPA2 transition mode
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param security_key_psk The security key (passphrase) which is to be set
|
||||
* @param psk_length length of the key
|
||||
* @param auth_type Authentication type: @ref WHD_SECURITY_WPA3_WPA2_PSK
|
||||
*
|
||||
* @return WHD_SUCCESS when the supplicant variable and wpa2 passphrase is set
|
||||
* Error code if an error occurred
|
||||
*/
|
||||
extern uint32_t whd_wifi_enable_sup_set_passphrase(whd_interface_t ifp, const uint8_t *security_key_psk,
|
||||
uint8_t psk_length, whd_security_t auth_type);
|
||||
|
||||
|
||||
/** Enable WHD internal supplicant
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param auth_type Authentication type
|
||||
*
|
||||
* @return WHD_SUCCESS when the supplicant variable is set
|
||||
* Error code if an error occurred
|
||||
*/
|
||||
extern uint32_t whd_wifi_enable_supplicant(whd_interface_t ifp, whd_security_t auth_type);
|
||||
|
||||
/** Retrieve the latest RSSI value
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param rssi The location where the RSSI value will be stored
|
||||
*
|
||||
* @return WHD_SUCCESS if the RSSI was successfully retrieved
|
||||
* Error code if the RSSI was not retrieved
|
||||
*/
|
||||
extern uint32_t whd_wifi_get_rssi(whd_interface_t ifp, int32_t *rssi);
|
||||
|
||||
/** Retrieve the associated STA's RSSI value
|
||||
*
|
||||
* @param ifp : Pointer to handle instance of whd interface
|
||||
* @param rssi : The location where the RSSI value will be stored
|
||||
* @param client_mac : Pointer to associated client's MAC address
|
||||
*
|
||||
* @return WHD_SUCCESS : if the RSSI was successfully retrieved
|
||||
* Error code : if the RSSI was not retrieved
|
||||
*/
|
||||
extern uint32_t whd_wifi_get_ap_client_rssi(whd_interface_t ifp, int32_t *rssi, const whd_mac_t *client_mac);
|
||||
|
||||
|
||||
/* @} */
|
||||
|
||||
/** @addtogroup wifijoin WHD Wi-Fi Join, Scan and Halt API
|
||||
* @ingroup wifi
|
||||
* Wi-Fi APIs for join, scan & leave
|
||||
* @{
|
||||
*/
|
||||
/** Disassociates from a Wi-Fi network.
|
||||
* Applicable only for STA role
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface.
|
||||
*
|
||||
* @return WHD_SUCCESS On successful disassociation from the AP
|
||||
* Error code If an error occurred
|
||||
*/
|
||||
extern uint32_t whd_wifi_leave(whd_interface_t ifp);
|
||||
/* @} */
|
||||
|
||||
/** @addtogroup wifiutilities WHD Wi-Fi Utility API
|
||||
* @ingroup wifi
|
||||
* Allows WHD to perform utility operations
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Retrieves the current Media Access Control (MAC) address
|
||||
* (or Ethernet hardware address) of the 802.11 device
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param mac Pointer to a variable that the current MAC address will be written to
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_wifi_get_mac_address(whd_interface_t ifp, whd_mac_t *mac);
|
||||
|
||||
/** Get the BSSID of the interface
|
||||
*
|
||||
* @param ifp Pointer to the whd_interface_t
|
||||
* @param bssid Returns the BSSID address (mac address) if associated
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_wifi_get_bssid(whd_interface_t ifp, whd_mac_t *bssid);
|
||||
/* @} */
|
||||
|
||||
/** @addtogroup wifisoftap WHD Wi-Fi SoftAP API
|
||||
* @ingroup wifi
|
||||
* Wi-Fi APIs to perform SoftAP related functionalities
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Initialises an infrastructure WiFi network (SoftAP)
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param ssid A null terminated string containing the SSID name of the network to join
|
||||
* @param auth_type Authentication type
|
||||
* @param security_key A byte array containing the cleartext security key for the network
|
||||
* @param key_length The length of the security_key in bytes.
|
||||
* @param channel 802.11 channel number
|
||||
*
|
||||
* @return WHD_SUCCESS if successfully initialises an AP
|
||||
* Error code if an error occurred
|
||||
*/
|
||||
extern uint32_t whd_wifi_init_ap(whd_interface_t ifp, whd_ssid_t *ssid, whd_security_t auth_type,
|
||||
const uint8_t *security_key, uint8_t key_length, uint8_t channel);
|
||||
|
||||
/** Start the infrastructure WiFi network (SoftAP)
|
||||
* using the parameter set by whd_wifi_init_ap() and optionaly by whd_wifi_manage_custom_ie()
|
||||
*
|
||||
* @return WHD_SUCCESS if successfully creates an AP
|
||||
* Error code if an error occurred
|
||||
*/
|
||||
extern uint32_t whd_wifi_start_ap(whd_interface_t ifp);
|
||||
|
||||
/** Stops an existing infrastructure WiFi network
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
*
|
||||
* @return WHD_SUCCESS if the AP is successfully stopped or if the AP has not yet been brought up
|
||||
* Error code if an error occurred
|
||||
*/
|
||||
extern uint32_t whd_wifi_stop_ap(whd_interface_t ifp);
|
||||
|
||||
|
||||
/** Get the maximum number of associations supported by AP interfaces
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param max_assoc The maximum number of associations supported by Soft AP interfaces.
|
||||
*
|
||||
* @return WHD_SUCCESS if the maximum number of associated clients was successfully read
|
||||
* WHD_ERROR if the maximum number of associated clients was not successfully read
|
||||
*/
|
||||
extern uint32_t whd_wifi_ap_get_max_assoc(whd_interface_t ifp, uint32_t *max_assoc);
|
||||
|
||||
/** Gets the current number of active connections
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param client_list_buffer Buffer to store list of associated clients
|
||||
* @param buffer_length Length of client list buffer
|
||||
*
|
||||
* @return WHD_SUCCESS if the active connections was successfully read
|
||||
* WHD_ERROR if the active connections was not successfully read
|
||||
*/
|
||||
extern uint32_t whd_wifi_get_associated_client_list(whd_interface_t ifp, void *client_list_buffer,
|
||||
uint16_t buffer_length);
|
||||
|
||||
/** Deauthenticates a STA which may or may not be associated to SoftAP
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param mac Pointer to a variable containing the MAC address to which the deauthentication will be sent
|
||||
* NULL mac address will deauthenticate all the associated STAs
|
||||
*
|
||||
* @param reason Deauthentication reason code
|
||||
*
|
||||
* @return WHD_SUCCESS On successful deauthentication of the other STA
|
||||
* WHD_ERROR If an error occurred
|
||||
*/
|
||||
extern uint32_t whd_wifi_deauth_sta(whd_interface_t ifp, whd_mac_t *mac, whd_dot11_reason_code_t reason);
|
||||
|
||||
/** Retrieves AP information
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param ap_info Returns a whd_bss_info_t structure containing AP details
|
||||
* @param security Authentication type
|
||||
*
|
||||
* @return WHD_SUCCESS if the AP info was successfully retrieved
|
||||
* Error code if the AP info was not successfully retrieved
|
||||
*/
|
||||
extern uint32_t whd_wifi_get_ap_info(whd_interface_t ifp, whd_bss_info_t *ap_info, whd_security_t *security);
|
||||
|
||||
/** Set the beacon interval.
|
||||
*
|
||||
* Note that the value needs to be set before ap_start in order to beacon interval to take effect.
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param interval Beacon interval in time units (Default: 100 time units = 102.4 ms)
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_wifi_ap_set_beacon_interval(whd_interface_t ifp, uint16_t interval);
|
||||
|
||||
/** Set the DTIM interval.
|
||||
*
|
||||
* Note that the value needs to be set before ap_start in order to DTIM interval to take effect.
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param interval DTIM interval, in unit of beacon interval
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_wifi_ap_set_dtim_interval(whd_interface_t ifp, uint16_t interval);
|
||||
/* @} */
|
||||
|
||||
|
||||
/** @addtogroup wifipowersave WHD Wi-Fi Power Save API
|
||||
* @ingroup wifi
|
||||
* Wi-Fi functions for WLAN low power modes
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Enables powersave mode on specified interface without regard for throughput reduction
|
||||
*
|
||||
* This function enables (legacy) 802.11 PS-Poll mode and should be used
|
||||
* to achieve the lowest power consumption possible when the Wi-Fi device
|
||||
* is primarily passively listening to the network
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_wifi_enable_powersave(whd_interface_t ifp);
|
||||
|
||||
/** Enables powersave mode on specified interface while attempting to maximise throughput
|
||||
*
|
||||
*
|
||||
* Network traffic is typically bursty. Reception of a packet often means that another
|
||||
* packet will be received shortly afterwards (and vice versa for transmit).
|
||||
*
|
||||
* In high throughput powersave mode, rather then entering powersave mode immediately
|
||||
* after receiving or sending a packet, the WLAN chip waits for a timeout period before
|
||||
* returning to sleep.
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param return_to_sleep_delay The variable to set return to sleep delay.
|
||||
* return to sleep delay must be set to a multiple of 10 and not equal to zero.
|
||||
*
|
||||
* @return WHD_SUCCESS if power save mode was successfully enabled
|
||||
* Error code if power save mode was not successfully enabled
|
||||
*
|
||||
*/
|
||||
extern uint32_t whd_wifi_enable_powersave_with_throughput(whd_interface_t ifp, uint16_t return_to_sleep_delay);
|
||||
|
||||
/** Get powersave mode on specified interface
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param value Value of the current powersave state
|
||||
* PM1_POWERSAVE_MODE, PM2_POWERSAVE_MODE, NO_POWERSAVE_MODE
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_wifi_get_powersave_mode(whd_interface_t ifp, uint32_t *value);
|
||||
|
||||
/** Disables 802.11 power save mode on specified interface
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
*
|
||||
* @return WHD_SUCCESS if power save mode was successfully disabled
|
||||
* Error code if power save mode was not successfully disabled
|
||||
*
|
||||
*/
|
||||
extern uint32_t whd_wifi_disable_powersave(whd_interface_t ifp);
|
||||
/* @} */
|
||||
|
||||
/** @addtogroup wifiutilities WHD Wi-Fi Utility API
|
||||
* @ingroup wifi
|
||||
* Allows WHD to perform utility operations
|
||||
* @{
|
||||
*/
|
||||
/** Registers interest in a multicast address
|
||||
*
|
||||
* Once a multicast address has been registered, all packets detected on the
|
||||
* medium destined for that address are forwarded to the host.
|
||||
* Otherwise they are ignored.
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param mac Ethernet MAC address
|
||||
*
|
||||
* @return WHD_SUCCESS if the address was registered successfully
|
||||
* Error code if the address was not registered
|
||||
*/
|
||||
extern uint32_t whd_wifi_register_multicast_address(whd_interface_t ifp, const whd_mac_t *mac);
|
||||
|
||||
/** Unregisters interest in a multicast address
|
||||
*
|
||||
* Once a multicast address has been unregistered, all packets detected on the
|
||||
* medium destined for that address are ignored.
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param mac Ethernet MAC address
|
||||
*
|
||||
* @return WHD_SUCCESS if the address was unregistered successfully
|
||||
* Error code if the address was not unregistered
|
||||
*/
|
||||
extern uint32_t whd_wifi_unregister_multicast_address(whd_interface_t ifp, const whd_mac_t *mac);
|
||||
|
||||
/** Sets the 802.11 powersave listen interval for a Wi-Fi client, and communicates
|
||||
* the listen interval to the Access Point. The listen interval will be set to
|
||||
* (listen_interval x time_unit) seconds.
|
||||
*
|
||||
* The default value for the listen interval is 0. With the default value of 0 set,
|
||||
* the Wi-Fi device wakes to listen for AP beacons every DTIM period.
|
||||
*
|
||||
* If the DTIM listen interval is non-zero, the DTIM listen interval will over ride
|
||||
* the beacon listen interval value.
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param listen_interval The desired beacon listen interval
|
||||
* @param time_unit The listen interval time unit; options are beacon period or DTIM period.
|
||||
*
|
||||
* @return WHD_SUCCESS If the listen interval was successfully set.
|
||||
* Error code If the listen interval was not successfully set.
|
||||
*/
|
||||
extern uint32_t whd_wifi_set_listen_interval(whd_interface_t ifp, uint8_t listen_interval,
|
||||
whd_listen_interval_time_unit_t time_unit);
|
||||
|
||||
/** Gets the current value of all beacon listen interval variables
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param li Powersave listen interval values
|
||||
* - listen_interval_beacon : The current value of the listen interval set as a multiple of the beacon period
|
||||
* - listen_interval_dtim : The current value of the listen interval set as a multiple of the DTIM period
|
||||
* - listen_interval_assoc : The current value of the listen interval sent to access points in an association request frame
|
||||
*
|
||||
* @return WHD_SUCCESS If all listen interval values are read successfully
|
||||
* Error code If at least one of the listen interval values are NOT read successfully
|
||||
*/
|
||||
extern uint32_t whd_wifi_get_listen_interval(whd_interface_t ifp, whd_listen_interval_t *li);
|
||||
|
||||
/** Determines if a particular interface is ready to transceive ethernet packets
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
*
|
||||
* @return WHD_SUCCESS if the interface is ready to transceive ethernet packets
|
||||
* WHD_NOTFOUND no AP with a matching SSID was found
|
||||
* WHD_NOT_AUTHENTICATED Matching AP was found but it won't let you authenticate.
|
||||
* This can occur if this device is in the block list on the AP.
|
||||
* WHD_NOT_KEYED Device has authenticated and associated but has not completed the key exchange.
|
||||
* This can occur if the passphrase is incorrect.
|
||||
* Error code if the interface is not ready to transceive ethernet packets
|
||||
*/
|
||||
extern uint32_t whd_wifi_is_ready_to_transceive(whd_interface_t ifp);
|
||||
|
||||
/* Certification APIs */
|
||||
|
||||
/** Retrieve the latest STA EDCF AC parameters
|
||||
*
|
||||
* Retrieve the latest Station (STA) interface EDCF (Enhanced Distributed
|
||||
* Coordination Function) Access Category parameters
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param acp The location where the array of AC parameters will be stored
|
||||
*
|
||||
* @return WHD_SUCCESS if the AC Parameters were successfully retrieved
|
||||
* Error code if the AC Parameters were not retrieved
|
||||
*/
|
||||
extern uint32_t whd_wifi_get_acparams(whd_interface_t ifp, whd_edcf_ac_param_t *acp);
|
||||
|
||||
/* Action Frames */
|
||||
|
||||
/** Manage the addition and removal of custom IEs
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param action the action to take (add or remove IE)
|
||||
* @param oui the oui of the custom IE
|
||||
* @param subtype the IE sub-type
|
||||
* @param data a pointer to the buffer that hold the custom IE
|
||||
* @param length the length of the buffer pointed to by 'data'
|
||||
* @param which_packets A mask to indicate in which all packets this IE should be included. See whd_ie_packet_flag_t.
|
||||
*
|
||||
* @return WHD_SUCCESS if the custom IE action was successful
|
||||
* Error code if the custom IE action failed
|
||||
*/
|
||||
extern uint32_t whd_wifi_manage_custom_ie(whd_interface_t ifp, whd_custom_ie_action_t action,
|
||||
const uint8_t *oui, uint8_t subtype, const void *data,
|
||||
uint16_t length, uint16_t which_packets);
|
||||
|
||||
/** Send a pre-prepared action frame
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param af_params A pointer to a pre-prepared action frame structure
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_wifi_send_action_frame(whd_interface_t ifp, whd_af_params_t *af_params);
|
||||
|
||||
/** Set coex configuration
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param coex_config Pointer to the structure whd_coex_config_t
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_wifi_set_coex_config(whd_interface_t ifp, whd_coex_config_t *coex_config);
|
||||
|
||||
/* @} */
|
||||
|
||||
/** @addtogroup wifiioctl WHD Wi-Fi IOCTL Set/Get API
|
||||
* @ingroup wifi
|
||||
* Set and get IOCTL values
|
||||
* @{
|
||||
*/
|
||||
/** Sends an IOCTL command - CDC_SET IOCTL value
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param ioctl CDC_SET - To set the I/O control
|
||||
* @param value Data value to be sent
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_wifi_set_ioctl_value(whd_interface_t ifp, uint32_t ioctl, uint32_t value);
|
||||
|
||||
/** Sends an IOCTL command - CDC_GET IOCTL value
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param ioctl CDC_GET - To get the I/O control
|
||||
* @param value Pointer to receive the data value
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_wifi_get_ioctl_value(whd_interface_t ifp, uint32_t ioctl, uint32_t *value);
|
||||
|
||||
/** Sends an IOCTL command - CDC_SET IOCTL buffer
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param ioctl CDC_SET - To set the I/O control
|
||||
* @param buffer Handle for a packet buffer containing the data value to be sent.
|
||||
* @param buffer_length Length of buffer
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_wifi_set_ioctl_buffer(whd_interface_t ifp, uint32_t ioctl, void *buffer, uint16_t buffer_length);
|
||||
|
||||
/** Sends an IOCTL command - CDC_GET IOCTL buffer
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param ioctl CDC_GET - To get the I/O control
|
||||
* @param out_buffer Pointer to receive the handle for the packet buffer containing the response data value received
|
||||
* @param out_length Length of out_buffer
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_wifi_get_ioctl_buffer(whd_interface_t ifp, uint32_t ioctl, uint8_t *out_buffer,
|
||||
uint16_t out_length);
|
||||
|
||||
/** Sends an IOVAR command
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param iovar_name SDPCM_GET - To get the I/O Variable
|
||||
* @param param Paramater to be passed for the IOVAR
|
||||
* @param paramlen Paramter length
|
||||
* @param out_buffer Pointer to receive the handle for the packet buffer containing the response data value received
|
||||
* @param out_length Length of out_buffer
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_wifi_get_iovar_buffer_with_param(whd_interface_t ifp, const char *iovar_name, void *param,
|
||||
uint32_t paramlen, uint8_t *out_buffer, uint32_t out_length);
|
||||
|
||||
/* @} */
|
||||
|
||||
/** @addtogroup dbg WHD Wi-Fi Debug API
|
||||
* @ingroup wifi
|
||||
* WHD APIs which allows debugging like, printing whd log information, getting whd stats, etc.
|
||||
* @{
|
||||
*/
|
||||
/** Retrieves the WLAN firmware version
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param version Pointer to a buffer that version information will be written to
|
||||
* @param length Length of the buffer
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_wifi_get_wifi_version(whd_interface_t ifp, char *version, uint8_t length);
|
||||
|
||||
/** Retrieves the WLAN CLM version
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param version Pointer to a buffer that version information will be written to
|
||||
* @param length Length of the buffer
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_wifi_get_clm_version(whd_interface_t ifp, char *version, uint8_t length);
|
||||
|
||||
/** To print whd log information
|
||||
*
|
||||
* @param whd_drv Pointer to handle instance of the driver
|
||||
* @param buffer Buffer to store read log results
|
||||
* @param buffer_size Variable to store size of the buffer
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_wifi_read_wlan_log(whd_driver_t whd_drv, char *buffer, uint32_t buffer_size);
|
||||
|
||||
/** To print whd log information
|
||||
*
|
||||
* @param whd_drv Pointer to handle instance of the driver
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_wifi_print_whd_log(whd_driver_t whd_drv);
|
||||
|
||||
/** Retrieves the ifidx from interface pointer.
|
||||
* ifidx is a unique value and be used to identify a instance of tcp/ip stack
|
||||
*
|
||||
* @param ifp Pointer to the whd_interface_t
|
||||
* @param ifidx Pointer to ifidx
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_network_get_ifidx_from_ifp(whd_interface_t ifp, uint8_t *ifidx);
|
||||
|
||||
/** Retrieves the bsscfgidx from interface pointer.
|
||||
*
|
||||
* Can be used to send IOCTL with requires bsscfgidx
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param bsscfgidx Pointer to bsscfgidx
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_network_get_bsscfgidx_from_ifp(whd_interface_t ifp, uint8_t *bsscfgidx);
|
||||
|
||||
|
||||
/** Retrives the bss info
|
||||
*
|
||||
* @param ifp Pointer to handle instance of whd interface
|
||||
* @param bi A pointer to the structure wl_bss_info_t
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_wifi_get_bss_info(whd_interface_t ifp, wl_bss_info_t *bi);
|
||||
|
||||
/** Prints WHD stats
|
||||
*
|
||||
* @param whd_drv Pointer to handle instance of the driver
|
||||
* @param reset_after_print Bool variable to decide if whd_stats to be reset
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_print_stats(whd_driver_t whd_drv, whd_bool_t reset_after_print);
|
||||
/* @} */
|
||||
/* @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
#endif /* ifndef INCLUDED_WHD_WIFI_H */
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
Permissive Binary License
|
||||
|
||||
Version 1.0, July 2019
|
||||
|
||||
Redistribution. Redistribution and use in binary form, without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1) Redistributions must reproduce the above copyright notice and the
|
||||
following disclaimer in the documentation and/or other materials
|
||||
provided with the distribution.
|
||||
|
||||
2) Unless to the extent explicitly permitted by law, no reverse
|
||||
engineering, decompilation, or disassembly of this software is
|
||||
permitted.
|
||||
|
||||
3) Redistribution as part of a software development kit must include the
|
||||
accompanying file named <20>DEPENDENCIES<45> and any dependencies listed in
|
||||
that file.
|
||||
|
||||
4) Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
Limited patent license. The copyright holders (and contributors) grant a
|
||||
worldwide, non-exclusive, no-charge, royalty-free patent license to
|
||||
make, have made, use, offer to sell, sell, import, and otherwise
|
||||
transfer this software, where such license applies only to those patent
|
||||
claims licensable by the copyright holders (and contributors) that are
|
||||
necessarily infringed by this software. This patent license shall not
|
||||
apply to any combinations that include this software. No hardware is
|
||||
licensed hereunder.
|
||||
|
||||
If you institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the software
|
||||
itself infringes your patent(s), then your rights granted under this
|
||||
license shall terminate as of the date such litigation is filed.
|
||||
|
||||
DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS." ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,427 @@
|
|||
/*
|
||||
* Copyright (c) 2019, Cypress Semiconductor Corporation, All Rights Reserved
|
||||
* SPDX-License-Identifier: LicenseRef-PBL
|
||||
*
|
||||
* This file and the related binary are licensed under the
|
||||
* Permissive Binary License, Version 1.0 (the "License");
|
||||
* you may not use these files except in compliance with the License.
|
||||
*
|
||||
* You may obtain a copy of the License here:
|
||||
* LICENSE-permissive-binary-license-1.0.txt and at
|
||||
* https://www.mbed.com/licenses/PBL-1.0
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "wiced_resource.h"
|
||||
|
||||
const unsigned char wifi_firmware_clm_blob_image_data[7697] =
|
||||
{
|
||||
66, 76, 79, 66, 60, 0, 0, 0, 67, 15, 222, 237, 1, 0, 0, 0, 2, 0, 0,
|
||||
0, 0, 0, 0, 0, 60, 0, 0, 0, 209, 29, 0, 0, 126, 28, 4, 82, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 13, 30, 0, 0, 4, 0, 0, 0, 147, 68, 77, 121, 0, 0, 0,
|
||||
0, 67, 76, 77, 32, 68, 65, 84, 65, 0, 0, 18, 0, 2, 0, 57, 46, 49, 48,
|
||||
46, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 46, 51, 54, 46,
|
||||
49, 0, 0, 0, 0, 0, 0, 0, 0, 40, 18, 0, 0, 67, 108, 109, 73, 109, 112,
|
||||
111, 114, 116, 58, 32, 49, 46, 51, 52, 46, 49, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 66, 114, 111, 97, 100, 99, 111, 109, 45, 48, 46, 48,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 132, 17, 0, 0, 16, 4, 5, 6,
|
||||
7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 18, 4, 5, 6, 7, 8,
|
||||
9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 35, 97, 0, 15, 18,
|
||||
17, 19, 10, 35, 110, 0, 16, 8, 255, 255, 0, 35, 114, 0, 15, 19, 17,
|
||||
20, 10, 48, 65, 0, 7, 8, 255, 255, 16, 48, 66, 0, 0, 14, 0, 17, 16,
|
||||
48, 67, 0, 7, 6, 12, 5, 25, 65, 67, 0, 16, 8, 255, 255, 16, 65, 68,
|
||||
0, 7, 33, 13, 39, 57, 65, 69, 0, 7, 8, 6, 7, 32, 65, 69, 1, 7, 33, 6,
|
||||
43, 32, 65, 70, 0, 7, 33, 13, 39, 57, 65, 71, 0, 7, 41, 6, 47, 32, 65,
|
||||
73, 0, 6, 15, 5, 18, 26, 65, 76, 0, 7, 33, 6, 43, 32, 65, 77, 0, 7,
|
||||
5, 12, 3, 9, 65, 78, 0, 7, 14, 6, 17, 32, 65, 79, 0, 7, 8, 255, 255,
|
||||
16, 65, 81, 0, 16, 8, 255, 255, 16, 65, 82, 0, 7, 25, 6, 25, 0, 65,
|
||||
82, 1, 7, 14, 6, 17, 0, 65, 83, 0, 6, 15, 5, 18, 26, 65, 84, 0, 7, 33,
|
||||
6, 43, 32, 65, 84, 1, 7, 37, 6, 36, 32, 65, 85, 0, 18, 42, 22, 46, 9,
|
||||
65, 85, 2, 18, 42, 21, 45, 0, 65, 87, 0, 7, 34, 6, 31, 1, 65, 88, 0,
|
||||
16, 8, 255, 255, 16, 65, 90, 0, 7, 14, 6, 17, 32, 66, 65, 0, 7, 33,
|
||||
6, 43, 32, 66, 66, 0, 7, 22, 12, 23, 25, 66, 68, 0, 7, 46, 6, 58, 0,
|
||||
66, 69, 0, 7, 33, 6, 43, 32, 66, 69, 1, 7, 37, 6, 36, 32, 66, 70, 0,
|
||||
7, 33, 13, 39, 25, 66, 71, 0, 7, 33, 6, 43, 32, 66, 71, 1, 7, 37, 6,
|
||||
36, 32, 66, 72, 0, 7, 21, 6, 22, 0, 66, 73, 0, 7, 33, 13, 39, 25, 66,
|
||||
74, 0, 7, 33, 13, 39, 57, 66, 76, 0, 16, 8, 255, 255, 16, 66, 77, 0,
|
||||
6, 15, 5, 18, 26, 66, 78, 0, 7, 8, 255, 255, 0, 66, 78, 1, 17, 41, 20,
|
||||
47, 0, 66, 79, 0, 7, 15, 12, 18, 42, 66, 81, 0, 16, 8, 255, 255, 16,
|
||||
66, 82, 0, 7, 43, 6, 52, 32, 66, 83, 0, 18, 21, 21, 22, 0, 66, 84, 0,
|
||||
7, 8, 12, 7, 56, 66, 86, 0, 16, 8, 255, 255, 16, 66, 87, 0, 7, 45, 12,
|
||||
51, 57, 66, 89, 0, 7, 33, 255, 255, 0, 66, 90, 0, 7, 15, 12, 18, 26,
|
||||
67, 65, 0, 0, 21, 0, 22, 0, 67, 65, 2, 6, 15, 5, 18, 26, 67, 67, 0,
|
||||
16, 8, 255, 255, 16, 67, 68, 0, 7, 33, 13, 39, 57, 67, 70, 0, 7, 33,
|
||||
13, 39, 25, 67, 71, 0, 7, 33, 13, 39, 57, 67, 72, 0, 7, 33, 6, 43, 32,
|
||||
67, 72, 1, 7, 37, 6, 36, 32, 67, 73, 0, 7, 33, 13, 39, 57, 67, 75, 0,
|
||||
7, 44, 12, 50, 25, 67, 76, 0, 7, 7, 6, 6, 1, 67, 77, 0, 7, 33, 13, 39,
|
||||
25, 67, 78, 0, 21, 48, 24, 53, 0, 67, 79, 0, 7, 13, 6, 11, 32, 67, 80,
|
||||
0, 16, 8, 255, 255, 16, 67, 82, 0, 7, 14, 6, 15, 32, 67, 85, 0, 7, 8,
|
||||
13, 255, 57, 67, 86, 0, 7, 33, 13, 39, 25, 67, 87, 0, 16, 8, 255, 255,
|
||||
16, 67, 88, 0, 18, 42, 21, 46, 25, 67, 89, 0, 7, 33, 6, 43, 32, 67,
|
||||
89, 1, 7, 37, 6, 36, 32, 67, 90, 0, 7, 33, 6, 43, 32, 67, 90, 1, 7,
|
||||
37, 6, 36, 32, 68, 69, 0, 7, 33, 6, 43, 32, 68, 69, 3, 7, 37, 6, 36,
|
||||
32, 68, 74, 0, 7, 8, 255, 255, 16, 68, 75, 0, 7, 33, 6, 43, 32, 68,
|
||||
75, 1, 7, 37, 6, 36, 32, 68, 77, 0, 7, 15, 12, 18, 26, 68, 79, 0, 7,
|
||||
15, 12, 18, 26, 68, 90, 0, 7, 5, 6, 4, 32, 69, 48, 0, 7, 12, 6, 13,
|
||||
32, 69, 67, 0, 7, 14, 6, 17, 32, 69, 69, 0, 7, 33, 6, 43, 32, 69, 69,
|
||||
1, 7, 37, 6, 36, 32, 69, 71, 0, 7, 41, 19, 48, 0, 69, 72, 0, 7, 6, 12,
|
||||
5, 25, 69, 82, 0, 7, 8, 255, 255, 16, 69, 83, 0, 7, 33, 6, 43, 32, 69,
|
||||
83, 1, 7, 37, 6, 36, 32, 69, 84, 0, 7, 33, 6, 43, 0, 70, 73, 0, 7, 33,
|
||||
6, 43, 32, 70, 73, 1, 7, 37, 6, 36, 32, 70, 74, 0, 7, 42, 12, 46, 25,
|
||||
70, 75, 0, 7, 33, 13, 39, 25, 70, 77, 0, 6, 15, 5, 18, 26, 70, 79, 0,
|
||||
7, 33, 13, 39, 57, 70, 82, 0, 7, 33, 6, 43, 32, 70, 82, 1, 7, 37, 6,
|
||||
36, 32, 71, 65, 0, 7, 33, 13, 39, 25, 71, 66, 0, 7, 33, 6, 43, 32, 71,
|
||||
66, 1, 7, 37, 6, 36, 32, 71, 68, 0, 7, 43, 6, 52, 0, 71, 69, 0, 7, 33,
|
||||
13, 39, 57, 71, 70, 0, 7, 33, 6, 43, 0, 71, 71, 0, 7, 33, 13, 39, 25,
|
||||
71, 72, 0, 7, 33, 13, 39, 57, 71, 73, 0, 7, 33, 13, 39, 25, 71, 76,
|
||||
0, 16, 8, 255, 255, 16, 71, 77, 0, 7, 33, 13, 39, 25, 71, 78, 0, 7,
|
||||
33, 13, 39, 57, 71, 80, 0, 7, 33, 6, 43, 0, 71, 81, 0, 7, 33, 13, 39,
|
||||
25, 71, 82, 0, 7, 33, 6, 43, 32, 71, 82, 1, 7, 37, 6, 36, 32, 71, 83,
|
||||
0, 16, 8, 255, 255, 16, 71, 84, 0, 7, 14, 11, 17, 16, 71, 85, 0, 0,
|
||||
14, 0, 17, 0, 71, 87, 0, 7, 33, 13, 39, 25, 71, 89, 0, 7, 46, 12, 54,
|
||||
25, 72, 75, 0, 18, 43, 22, 52, 0, 72, 77, 0, 16, 8, 255, 255, 16, 72,
|
||||
78, 0, 7, 47, 12, 60, 10, 72, 82, 0, 7, 33, 6, 43, 32, 72, 82, 1, 7,
|
||||
37, 6, 36, 32, 72, 84, 0, 7, 46, 12, 54, 9, 72, 85, 0, 7, 33, 6, 43,
|
||||
32, 72, 85, 1, 7, 37, 6, 36, 32, 73, 68, 0, 7, 8, 6, 7, 0, 73, 68, 5,
|
||||
7, 53, 13, 64, 25, 73, 69, 0, 7, 33, 6, 43, 32, 73, 69, 1, 7, 37, 6,
|
||||
36, 32, 73, 76, 0, 7, 5, 6, 4, 32, 73, 77, 0, 7, 33, 13, 39, 25, 73,
|
||||
78, 0, 17, 41, 20, 47, 32, 73, 79, 0, 7, 33, 13, 39, 25, 73, 81, 0,
|
||||
7, 33, 13, 39, 25, 73, 82, 0, 7, 8, 13, 255, 57, 73, 83, 0, 7, 33, 6,
|
||||
43, 32, 73, 83, 1, 7, 37, 6, 36, 32, 73, 84, 0, 7, 33, 6, 43, 32, 73,
|
||||
84, 1, 7, 37, 6, 36, 32, 74, 48, 0, 7, 38, 15, 42, 0, 74, 49, 0, 14,
|
||||
12, 255, 255, 0, 74, 50, 0, 14, 5, 255, 255, 0, 74, 51, 0, 14, 38, 255,
|
||||
255, 0, 74, 52, 0, 14, 24, 255, 255, 0, 74, 53, 0, 14, 27, 255, 255,
|
||||
0, 74, 54, 0, 14, 28, 255, 255, 0, 74, 55, 0, 14, 29, 255, 255, 0, 74,
|
||||
56, 0, 14, 40, 255, 255, 0, 74, 57, 0, 7, 28, 15, 27, 0, 74, 69, 0,
|
||||
7, 33, 13, 39, 25, 74, 77, 0, 7, 46, 13, 59, 25, 74, 79, 0, 7, 1, 6,
|
||||
0, 32, 74, 80, 0, 14, 39, 16, 40, 1, 74, 80, 1, 14, 28, 15, 27, 0, 74,
|
||||
80, 3, 14, 39, 15, 41, 1, 75, 65, 0, 20, 17, 23, 16, 3, 75, 67, 0, 20,
|
||||
46, 23, 54, 3, 75, 68, 0, 7, 49, 6, 56, 3, 75, 69, 0, 7, 33, 6, 38,
|
||||
33, 75, 71, 0, 7, 33, 13, 39, 25, 75, 72, 0, 7, 43, 6, 52, 0, 75, 73,
|
||||
0, 18, 42, 21, 46, 25, 75, 75, 0, 20, 8, 23, 7, 0, 75, 77, 0, 7, 33,
|
||||
13, 39, 25, 75, 78, 0, 7, 15, 12, 18, 26, 75, 80, 0, 16, 8, 255, 255,
|
||||
16, 75, 82, 0, 16, 53, 18, 44, 0, 75, 82, 4, 21, 30, 24, 28, 17, 75,
|
||||
87, 0, 7, 8, 6, 7, 32, 75, 87, 1, 7, 5, 6, 4, 32, 75, 88, 0, 7, 46,
|
||||
6, 54, 3, 75, 89, 0, 0, 14, 0, 17, 0, 75, 90, 0, 7, 36, 12, 34, 8, 76,
|
||||
65, 0, 7, 34, 6, 31, 1, 76, 66, 0, 7, 46, 6, 58, 32, 76, 67, 0, 7, 15,
|
||||
12, 18, 26, 76, 73, 0, 7, 33, 6, 43, 0, 76, 73, 1, 7, 37, 6, 36, 0,
|
||||
76, 75, 0, 17, 43, 20, 52, 0, 76, 82, 0, 7, 43, 19, 50, 17, 76, 83,
|
||||
0, 7, 33, 6, 43, 0, 76, 84, 0, 7, 33, 6, 43, 32, 76, 84, 1, 7, 37, 6,
|
||||
36, 32, 76, 85, 0, 7, 33, 6, 43, 32, 76, 85, 1, 7, 37, 6, 36, 32, 76,
|
||||
86, 0, 7, 33, 6, 43, 32, 76, 86, 1, 7, 37, 6, 36, 32, 76, 89, 0, 7,
|
||||
8, 14, 255, 16, 77, 65, 0, 7, 12, 19, 12, 32, 77, 65, 1, 7, 5, 19, 4,
|
||||
32, 77, 67, 0, 7, 33, 6, 43, 0, 77, 68, 0, 7, 33, 6, 43, 32, 77, 69,
|
||||
0, 7, 33, 6, 43, 32, 77, 70, 0, 7, 45, 12, 51, 25, 77, 71, 0, 7, 33,
|
||||
13, 39, 57, 77, 72, 0, 16, 8, 255, 255, 16, 77, 75, 0, 7, 33, 6, 43,
|
||||
32, 77, 76, 0, 7, 33, 13, 39, 25, 77, 77, 0, 7, 33, 13, 39, 25, 77,
|
||||
78, 0, 7, 14, 11, 17, 32, 77, 79, 0, 7, 49, 6, 58, 0, 77, 80, 0, 6,
|
||||
15, 5, 18, 26, 77, 81, 0, 7, 33, 6, 43, 0, 77, 82, 0, 7, 33, 6, 43,
|
||||
0, 77, 83, 0, 7, 33, 13, 39, 57, 77, 84, 0, 7, 33, 6, 43, 32, 77, 84,
|
||||
1, 7, 37, 6, 36, 32, 77, 85, 0, 7, 33, 6, 43, 32, 77, 86, 0, 7, 10,
|
||||
6, 10, 32, 77, 87, 0, 7, 46, 6, 58, 32, 77, 88, 0, 7, 5, 6, 4, 0, 77,
|
||||
88, 1, 7, 21, 6, 22, 0, 77, 89, 0, 17, 41, 20, 47, 0, 77, 90, 0, 7,
|
||||
16, 12, 14, 26, 78, 65, 0, 7, 16, 12, 14, 26, 78, 67, 0, 7, 33, 13,
|
||||
39, 25, 78, 69, 0, 7, 33, 13, 39, 25, 78, 70, 0, 7, 42, 11, 45, 0, 78,
|
||||
71, 0, 7, 26, 13, 26, 57, 78, 73, 0, 7, 14, 6, 17, 32, 78, 76, 0, 7,
|
||||
33, 6, 43, 32, 78, 76, 1, 7, 37, 6, 36, 32, 78, 79, 0, 7, 33, 6, 43,
|
||||
32, 78, 79, 1, 7, 37, 6, 36, 32, 78, 80, 0, 17, 9, 20, 8, 0, 78, 82,
|
||||
0, 7, 33, 13, 39, 25, 78, 85, 0, 7, 14, 255, 255, 16, 78, 90, 0, 7,
|
||||
43, 6, 52, 32, 79, 77, 0, 7, 33, 6, 43, 32, 80, 65, 0, 17, 0, 20, 24,
|
||||
32, 80, 69, 0, 7, 14, 6, 17, 32, 80, 70, 0, 7, 33, 13, 39, 25, 80, 71,
|
||||
0, 7, 2, 6, 0, 0, 80, 72, 0, 7, 43, 6, 52, 32, 80, 75, 0, 7, 49, 11,
|
||||
55, 33, 80, 76, 0, 7, 33, 6, 43, 32, 80, 76, 1, 7, 37, 6, 36, 32, 80,
|
||||
77, 0, 7, 33, 13, 39, 25, 80, 78, 0, 16, 8, 255, 255, 16, 80, 82, 0,
|
||||
0, 14, 0, 17, 0, 80, 83, 0, 16, 8, 255, 255, 0, 80, 84, 0, 7, 33, 6,
|
||||
43, 32, 80, 84, 1, 7, 37, 6, 36, 32, 80, 87, 0, 7, 15, 12, 18, 26, 80,
|
||||
89, 0, 7, 46, 6, 58, 0, 80, 89, 1, 7, 43, 6, 52, 0, 81, 49, 0, 2, 8,
|
||||
2, 7, 0, 81, 50, 0, 0, 31, 0, 29, 0, 81, 65, 0, 7, 49, 13, 57, 57, 82,
|
||||
69, 0, 7, 33, 6, 43, 0, 82, 79, 0, 7, 33, 6, 43, 32, 82, 79, 1, 7, 37,
|
||||
6, 36, 32, 82, 83, 0, 7, 33, 6, 43, 32, 82, 85, 0, 7, 8, 255, 255, 0,
|
||||
82, 85, 5, 7, 11, 11, 9, 1, 82, 87, 0, 7, 33, 13, 39, 57, 83, 65, 0,
|
||||
7, 34, 6, 32, 33, 83, 66, 0, 7, 8, 255, 255, 16, 83, 67, 0, 7, 45, 12,
|
||||
51, 25, 83, 68, 0, 7, 8, 13, 255, 57, 83, 69, 0, 7, 33, 6, 43, 32, 83,
|
||||
69, 1, 7, 37, 6, 36, 32, 83, 71, 0, 17, 44, 20, 50, 33, 83, 72, 0, 16,
|
||||
8, 255, 255, 16, 83, 73, 0, 7, 33, 6, 43, 32, 83, 73, 1, 7, 37, 6, 36,
|
||||
32, 83, 74, 0, 16, 8, 255, 255, 16, 83, 75, 0, 7, 33, 6, 43, 32, 83,
|
||||
75, 1, 7, 37, 6, 36, 32, 83, 76, 0, 7, 33, 13, 39, 25, 83, 77, 0, 7,
|
||||
33, 13, 39, 25, 83, 78, 0, 7, 33, 6, 43, 32, 83, 79, 0, 7, 8, 255, 255,
|
||||
16, 83, 82, 0, 7, 33, 13, 39, 25, 83, 84, 0, 7, 33, 13, 39, 25, 83,
|
||||
86, 0, 7, 14, 11, 17, 32, 83, 88, 0, 16, 8, 255, 255, 16, 83, 89, 0,
|
||||
16, 8, 255, 255, 16, 83, 90, 0, 7, 33, 13, 39, 25, 84, 65, 0, 16, 8,
|
||||
255, 255, 16, 84, 67, 0, 7, 33, 13, 39, 25, 84, 68, 0, 7, 33, 13, 39,
|
||||
25, 84, 70, 0, 7, 33, 13, 39, 25, 84, 71, 0, 7, 33, 13, 39, 25, 84,
|
||||
72, 0, 7, 43, 6, 52, 32, 84, 74, 0, 7, 33, 13, 39, 25, 84, 75, 0, 16,
|
||||
8, 255, 255, 16, 84, 76, 0, 7, 33, 13, 39, 57, 84, 77, 0, 7, 33, 13,
|
||||
39, 25, 84, 78, 0, 7, 5, 6, 4, 32, 84, 79, 0, 7, 8, 255, 255, 16, 84,
|
||||
82, 0, 7, 5, 6, 4, 32, 84, 82, 7, 7, 33, 13, 39, 57, 84, 84, 0, 7, 43,
|
||||
6, 52, 32, 84, 86, 0, 7, 8, 255, 255, 16, 84, 87, 0, 0, 50, 0, 63, 0,
|
||||
84, 87, 2, 0, 51, 0, 61, 0, 84, 90, 0, 7, 33, 13, 39, 25, 85, 65, 0,
|
||||
7, 8, 255, 255, 0, 85, 71, 0, 7, 34, 6, 31, 33, 85, 77, 0, 0, 14, 0,
|
||||
17, 0, 85, 83, 0, 5, 32, 4, 30, 10, 85, 83, 25, 11, 8, 9, 7, 0, 85,
|
||||
83, 26, 4, 8, 1, 7, 0, 85, 89, 0, 18, 43, 21, 52, 0, 85, 90, 0, 7, 33,
|
||||
13, 39, 25, 86, 65, 0, 7, 33, 6, 43, 0, 86, 67, 0, 7, 15, 12, 18, 26,
|
||||
86, 69, 0, 7, 41, 6, 47, 0, 86, 71, 0, 7, 33, 6, 43, 0, 86, 73, 0, 0,
|
||||
14, 0, 17, 0, 86, 78, 0, 7, 5, 6, 4, 0, 86, 85, 0, 7, 43, 12, 49, 25,
|
||||
87, 70, 0, 7, 33, 12, 43, 25, 87, 83, 0, 7, 43, 11, 49, 17, 88, 48,
|
||||
0, 3, 20, 0, 21, 0, 88, 49, 0, 7, 41, 6, 47, 0, 88, 50, 0, 19, 3, 6,
|
||||
2, 0, 88, 51, 0, 7, 33, 6, 35, 32, 88, 65, 0, 7, 3, 255, 255, 0, 88,
|
||||
66, 0, 0, 23, 255, 255, 0, 88, 82, 0, 1, 52, 3, 62, 0, 88, 83, 0, 12,
|
||||
4, 10, 1, 33, 88, 84, 0, 11, 8, 9, 7, 32, 88, 85, 0, 8, 37, 7, 37, 32,
|
||||
88, 86, 0, 10, 8, 8, 7, 32, 88, 87, 0, 20, 35, 23, 33, 34, 88, 88, 0,
|
||||
9, 33, 255, 255, 32, 88, 89, 0, 7, 33, 6, 43, 32, 88, 90, 0, 13, 8,
|
||||
255, 255, 32, 89, 49, 0, 0, 14, 255, 255, 16, 89, 50, 0, 0, 14, 255,
|
||||
255, 16, 89, 51, 0, 0, 14, 255, 255, 16, 89, 52, 0, 0, 14, 255, 255,
|
||||
16, 89, 53, 0, 0, 14, 255, 255, 16, 89, 54, 0, 0, 14, 255, 255, 16,
|
||||
89, 55, 0, 0, 14, 255, 255, 16, 89, 69, 0, 7, 45, 12, 51, 25, 89, 84,
|
||||
0, 7, 33, 6, 43, 0, 89, 89, 0, 16, 8, 255, 255, 0, 90, 49, 0, 16, 8,
|
||||
255, 255, 16, 90, 50, 0, 16, 8, 255, 255, 16, 90, 51, 0, 16, 8, 255,
|
||||
255, 16, 90, 52, 0, 16, 8, 255, 255, 16, 90, 53, 0, 16, 8, 255, 255,
|
||||
16, 90, 54, 0, 16, 8, 255, 255, 16, 90, 55, 0, 16, 8, 255, 255, 16,
|
||||
90, 56, 0, 16, 8, 255, 255, 16, 90, 57, 0, 16, 8, 255, 255, 16, 90,
|
||||
65, 0, 7, 33, 6, 43, 32, 90, 77, 0, 17, 41, 20, 47, 0, 90, 87, 0, 7,
|
||||
33, 13, 39, 57, 38, 62, 8, 102, 142, 8, 151, 175, 8, 16, 4, 5, 6, 7,
|
||||
8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 18, 4, 5, 6, 7, 8, 9,
|
||||
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 4, 5, 76, 0, 3, 76,
|
||||
6, 3, 76, 10, 3, 76, 11, 3, 66, 12, 3, 1, 4, 62, 0, 0, 66, 4, 0, 62,
|
||||
9, 0, 58, 10, 0, 4, 3, 58, 0, 3, 66, 7, 3, 58, 12, 3, 1, 5, 42, 0, 0,
|
||||
50, 3, 0, 60, 8, 0, 54, 9, 0, 46, 10, 0, 4, 1, 56, 2, 3, 1, 1, 32, 1,
|
||||
0, 4, 5, 58, 0, 3, 68, 6, 3, 74, 10, 3, 68, 11, 3, 66, 12, 3, 1, 5,
|
||||
48, 0, 0, 58, 3, 0, 66, 8, 0, 58, 9, 0, 54, 10, 0, 4, 3, 86, 0, 0, 126,
|
||||
7, 0, 86, 12, 0, 1, 3, 78, 0, 1, 126, 5, 1, 78, 10, 1, 4, 5, 70, 0,
|
||||
0, 80, 6, 0, 80, 10, 0, 80, 11, 0, 72, 12, 0, 1, 5, 58, 0, 1, 68, 3,
|
||||
1, 80, 8, 1, 68, 9, 1, 60, 10, 1, 4, 1, 64, 4, 0, 1, 1, 64, 2, 1, 4,
|
||||
1, 76, 4, 3, 1, 1, 72, 2, 0, 4, 4, 60, 0, 3, 64, 8, 3, 44, 13, 3, 44,
|
||||
16, 3, 1, 3, 40, 0, 0, 52, 5, 0, 46, 11, 0, 0, 2, 64, 3, 3, 46, 16,
|
||||
3, 4, 2, 64, 2, 0, 44, 14, 0, 1, 3, 54, 0, 1, 64, 6, 1, 52, 12, 1, 6,
|
||||
1, 76, 4, 0, 3, 1, 76, 2, 1, 6, 1, 76, 4, 0, 3, 1, 76, 2, 1, 6, 1, 76,
|
||||
4, 0, 3, 1, 76, 2, 1, 6, 1, 76, 4, 0, 3, 1, 128, 2, 1, 4, 1, 64, 4,
|
||||
0, 1, 1, 64, 2, 1, 6, 1, 84, 4, 3, 3, 1, 72, 2, 0, 4, 2, 120, 4, 0,
|
||||
120, 17, 3, 1, 1, 120, 2, 1, 0, 0, 0, 1, 64, 4, 3, 4, 1, 80, 4, 0, 1,
|
||||
1, 64, 2, 1, 4, 1, 88, 4, 0, 1, 1, 60, 2, 1, 6, 1, 100, 4, 0, 3, 1,
|
||||
88, 2, 1, 4, 1, 64, 2, 3, 1, 1, 52, 1, 0, 4, 3, 56, 0, 3, 64, 9, 3,
|
||||
56, 16, 3, 1, 2, 46, 0, 0, 52, 7, 0, 1, 18, 1, 255, 1, 58, 1, 14, 1,
|
||||
15, 3, 29, 41, 55, 2, 19, 55, 3, 11, 1, 1, 1, 1, 10, 1, 11, 1, 12, 1,
|
||||
13, 1, 14, 2, 2, 2, 10, 2, 11, 2, 12, 3, 9, 10, 10, 11, 11, 12, 12,
|
||||
12, 13, 12, 14, 13, 13, 14, 14, 34, 46, 36, 48, 36, 64, 36, 116, 36,
|
||||
140, 36, 144, 36, 161, 36, 165, 36, 177, 52, 52, 52, 60, 52, 64, 52,
|
||||
124, 52, 140, 52, 144, 52, 165, 56, 60, 56, 64, 64, 64, 64, 100, 100,
|
||||
100, 100, 116, 100, 140, 100, 144, 100, 165, 104, 128, 104, 136, 104,
|
||||
140, 104, 165, 132, 140, 132, 144, 132, 165, 140, 140, 144, 144, 144,
|
||||
165, 149, 149, 149, 161, 149, 165, 149, 177, 153, 161, 165, 165, 0,
|
||||
145, 0, 146, 0, 147, 0, 148, 0, 149, 0, 150, 0, 151, 0, 152, 0, 153,
|
||||
0, 154, 0, 0, 0, 4, 0, 0, 0, 28, 18, 0, 0, 42, 42, 42, 58, 42, 106,
|
||||
42, 122, 42, 138, 42, 155, 42, 171, 58, 58, 106, 106, 106, 122, 106,
|
||||
138, 106, 155, 122, 122, 122, 138, 122, 171, 138, 138, 138, 155, 155,
|
||||
155, 155, 171, 42, 106, 106, 42, 58, 106, 106, 58, 42, 122, 122, 42,
|
||||
58, 122, 122, 58, 42, 138, 138, 42, 58, 138, 138, 58, 106, 138, 138,
|
||||
106, 42, 155, 155, 42, 58, 155, 155, 58, 106, 155, 155, 106, 122, 155,
|
||||
155, 122, 138, 155, 155, 138, 42, 171, 171, 42, 58, 171, 171, 58, 106,
|
||||
171, 171, 106, 122, 171, 171, 122, 138, 171, 171, 138, 0, 0, 1, 0, 0,
|
||||
0, 164, 17, 0, 0, 1, 0, 0, 0, 81, 17, 0, 0, 1, 0, 0, 0, 6, 18, 0, 0,
|
||||
24, 0, 159, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 93, 16, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 1, 0, 255, 1, 30, 2, 0, 3, 76, 1, 4, 76, 2, 2,
|
||||
66, 12, 4, 1, 0, 255, 1, 30, 2, 0, 7, 72, 0, 2, 58, 0, 4, 68, 6, 4,
|
||||
74, 8, 2, 74, 10, 4, 68, 11, 4, 66, 12, 4, 1, 0, 255, 1, 30, 2, 0, 2,
|
||||
64, 2, 2, 56, 2, 4, 1, 0, 255, 1, 30, 2, 0, 5, 72, 0, 2, 76, 1, 4, 76,
|
||||
7, 2, 72, 12, 2, 66, 12, 4, 1, 0, 255, 1, 30, 2, 0, 4, 58, 0, 4, 68,
|
||||
2, 2, 66, 7, 4, 58, 12, 4, 1, 0, 255, 1, 30, 2, 0, 5, 92, 0, 2, 86,
|
||||
0, 4, 126, 7, 1, 92, 12, 2, 86, 12, 4, 1, 0, 255, 1, 30, 2, 0, 5, 70,
|
||||
0, 4, 80, 1, 2, 80, 7, 4, 76, 12, 2, 72, 12, 4, 2, 4, 255, 1, 20, 4,
|
||||
2, 1, 76, 4, 1, 2, 0, 255, 1, 20, 4, 0, 1, 76, 4, 1, 3, 0, 4, 1, 20,
|
||||
5, 2, 5, 76, 1, 4, 76, 4, 2, 70, 12, 4, 76, 14, 4, 54, 17, 2, 3, 0,
|
||||
4, 1, 20, 5, 0, 6, 60, 0, 4, 68, 2, 2, 64, 8, 4, 48, 14, 2, 44, 14,
|
||||
4, 64, 17, 2, 3, 0, 4, 1, 20, 5, 0, 3, 64, 3, 4, 64, 5, 2, 46, 16, 4,
|
||||
2, 0, 3, 1, 20, 4, 0, 3, 64, 2, 1, 48, 14, 2, 44, 14, 4, 3, 0, 4, 1,
|
||||
20, 5, 0, 6, 62, 0, 4, 66, 4, 2, 66, 7, 4, 62, 12, 4, 66, 14, 4, 42,
|
||||
17, 2, 3, 0, 255, 1, 20, 5, 2, 2, 84, 4, 4, 78, 5, 2, 3, 0, 255, 1,
|
||||
30, 5, 0, 1, 120, 5, 1, 0, 0, 255, 0, 0, 0, 2, 0, 255, 1, 23, 4, 2,
|
||||
1, 92, 4, 1, 2, 0, 255, 1, 36, 4, 2, 1, 100, 4, 1, 2, 4, 3, 1, 20, 4,
|
||||
2, 1, 76, 4, 1, 1, 0, 255, 1, 20, 2, 2, 1, 76, 2, 1, 2, 0, 255, 1, 20,
|
||||
4, 4, 3, 56, 0, 4, 64, 9, 4, 56, 16, 4, 2, 1, 76, 4, 2, 0, 0, 0, 1,
|
||||
0, 0, 0, 192, 29, 0, 0, 1, 0, 0, 0, 195, 29, 0, 0, 1, 0, 0, 0, 198,
|
||||
29, 0, 0, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 8, 12, 13, 14,
|
||||
15, 16, 17, 18, 19, 8, 4, 5, 6, 7, 8, 9, 10, 11, 0, 12, 4, 10, 2, 2,
|
||||
2, 9, 1, 1, 1, 1, 1, 1, 3, 3, 4, 4, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1,
|
||||
1, 0, 9, 0, 19, 0, 22, 0, 24, 0, 32, 0, 35, 0, 42, 0, 53, 0, 59, 0,
|
||||
73, 0, 75, 0, 77, 0, 80, 0, 87, 0, 92, 0, 95, 0, 101, 0, 104, 0, 117,
|
||||
0, 127, 0, 130, 0, 132, 0, 134, 0, 142, 0, 144, 0, 160, 0, 173, 0, 175,
|
||||
0, 183, 0, 188, 0, 190, 0, 192, 0, 195, 0, 212, 0, 217, 0, 227, 0, 229,
|
||||
0, 242, 0, 248, 0, 251, 0, 1, 1, 4, 1, 11, 1, 15, 1, 18, 1, 42, 1, 46,
|
||||
1, 53, 1, 6, 2, 2, 1, 1, 1, 1, 0, 6, 2, 5, 1, 1, 1, 7, 2, 4, 1, 1, 1,
|
||||
2, 8, 4, 2, 2, 1, 1, 1, 14, 2, 2, 1, 1, 1, 1, 0, 6, 2, 5, 5, 1, 1, 7,
|
||||
2, 4, 1, 1, 1, 2, 8, 4, 2, 2, 1, 1, 1, 13, 2, 2, 1, 1, 1, 1, 18, 4,
|
||||
2, 2, 5, 1, 1, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 12, 0, 1,
|
||||
2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 4, 0, 1, 2, 3, 8, 12, 13, 14, 15, 16,
|
||||
17, 18, 19, 8, 4, 5, 6, 7, 8, 9, 10, 11, 21, 2, 2, 18, 4, 5, 6, 7, 8,
|
||||
9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 50, 48, 49, 57, 45,
|
||||
48, 54, 45, 49, 49, 32, 48, 48, 58, 48, 56, 58, 53, 49, 0, 0, 3, 0,
|
||||
0, 0, 196, 11, 0, 0, 1, 14, 1, 0, 3, 0, 0, 0, 120, 14, 0, 0, 42, 58,
|
||||
16, 106, 138, 16, 155, 171, 16, 0, 0, 0, 3, 0, 0, 0, 28, 23, 0, 0, 21,
|
||||
2, 2, 0, 9, 0, 19, 0, 22, 0, 24, 0, 32, 0, 35, 0, 42, 0, 53, 0, 59,
|
||||
0, 73, 0, 75, 0, 77, 0, 80, 0, 87, 0, 92, 0, 95, 0, 101, 0, 104, 0,
|
||||
117, 0, 127, 0, 130, 0, 132, 0, 134, 0, 142, 0, 144, 0, 160, 0, 173,
|
||||
0, 175, 0, 183, 0, 188, 0, 190, 0, 192, 0, 195, 0, 212, 0, 217, 0, 227,
|
||||
0, 229, 0, 242, 0, 248, 0, 251, 0, 1, 1, 4, 1, 11, 1, 15, 1, 18, 1,
|
||||
46, 1, 52, 1, 21, 2, 2, 0, 0, 0, 3, 0, 0, 0, 40, 16, 0, 0, 102, 1, 0,
|
||||
0, 148, 0, 0, 0, 34, 46, 4, 36, 64, 4, 100, 144, 4, 149, 177, 4, 104,
|
||||
0, 0, 0, 4, 14, 0, 0, 119, 13, 0, 0, 99, 13, 0, 0, 112, 22, 0, 0, 64,
|
||||
16, 0, 0, 172, 14, 0, 0, 232, 18, 0, 0, 241, 11, 0, 0, 76, 23, 0, 0,
|
||||
20, 18, 0, 0, 156, 17, 0, 0, 84, 29, 0, 0, 255, 80, 161, 4, 76, 29,
|
||||
0, 0, 184, 29, 0, 0, 92, 29, 0, 0, 12, 14, 0, 0, 201, 29, 0, 0, 112,
|
||||
0, 0, 0, 84, 17, 0, 0, 6, 23, 0, 0, 34, 17, 0, 0, 205, 11, 0, 0, 103,
|
||||
17, 0, 0, 176, 29, 0, 0, 124, 17, 0, 0, 64, 23, 0, 0, 248, 22, 0, 0,
|
||||
104, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
12, 18, 0, 0, 136, 17, 0, 0, 10, 2, 255, 3, 17, 19, 24, 29, 30, 55,
|
||||
0, 4, 56, 19, 2, 70, 28, 2, 58, 36, 2, 70, 55, 2, 14, 0, 255, 2, 23,
|
||||
19, 23, 55, 2, 2, 84, 19, 2, 84, 55, 2, 14, 0, 255, 2, 23, 19, 23, 55,
|
||||
0, 2, 66, 19, 2, 66, 55, 2, 23, 1, 1, 4, 23, 19, 17, 29, 23, 40, 30,
|
||||
55, 2, 2, 84, 22, 2, 84, 55, 2, 24, 1, 5, 2, 23, 23, 30, 55, 0, 4, 56,
|
||||
19, 2, 58, 29, 2, 60, 41, 2, 70, 55, 2, 15, 1, 255, 1, 23, 20, 2, 1,
|
||||
84, 20, 2, 15, 1, 255, 1, 23, 20, 2, 1, 84, 20, 2, 20, 1, 255, 2, 21,
|
||||
20, 21, 55, 2, 2, 84, 20, 2, 84, 55, 2, 0, 0, 255, 0, 0, 0, 19, 1, 255,
|
||||
2, 23, 20, 23, 54, 0, 2, 66, 20, 2, 66, 54, 2, 20, 1, 255, 2, 23, 20,
|
||||
20, 55, 0, 2, 66, 20, 2, 64, 55, 2, 20, 1, 255, 2, 23, 20, 20, 55, 2,
|
||||
2, 92, 20, 2, 80, 55, 2, 9, 0, 255, 1, 23, 19, 2, 1, 84, 19, 2, 9, 0,
|
||||
255, 1, 20, 19, 0, 1, 56, 19, 2, 11, 2, 255, 3, 17, 19, 24, 31, 30,
|
||||
55, 0, 5, 56, 19, 2, 70, 28, 2, 58, 36, 2, 68, 40, 2, 70, 55, 2, 13,
|
||||
2, 255, 3, 17, 19, 24, 32, 30, 55, 0, 5, 56, 19, 2, 78, 28, 2, 64, 36,
|
||||
2, 68, 38, 2, 78, 46, 2, 26, 1, 255, 2, 23, 20, 30, 42, 2, 2, 84, 23,
|
||||
2, 112, 55, 2, 13, 2, 255, 3, 17, 19, 24, 32, 30, 55, 0, 7, 58, 19,
|
||||
2, 84, 27, 2, 76, 35, 2, 72, 38, 2, 80, 44, 2, 68, 50, 2, 80, 52, 2,
|
||||
27, 0, 255, 1, 30, 26, 0, 1, 120, 26, 2, 26, 2, 255, 1, 30, 25, 0, 1,
|
||||
120, 25, 2, 10, 2, 2, 3, 17, 19, 24, 29, 30, 55, 0, 4, 56, 19, 2, 70,
|
||||
28, 2, 58, 36, 2, 70, 55, 2, 10, 2, 255, 3, 17, 19, 24, 29, 30, 55,
|
||||
0, 4, 56, 19, 2, 66, 28, 2, 60, 36, 2, 66, 55, 2, 20, 2, 255, 2, 23,
|
||||
20, 33, 55, 2, 2, 84, 20, 2, 84, 55, 2, 10, 2, 1, 3, 17, 19, 24, 29,
|
||||
30, 55, 0, 4, 56, 19, 2, 70, 28, 2, 58, 36, 2, 70, 55, 2, 32, 2, 255,
|
||||
1, 30, 40, 2, 1, 84, 40, 2, 29, 2, 255, 2, 21, 29, 30, 55, 0, 2, 60,
|
||||
29, 2, 68, 55, 2, 29, 1, 255, 2, 30, 29, 30, 55, 2, 2, 112, 29, 2, 112,
|
||||
55, 2, 5, 2, 0, 2, 23, 18, 23, 19, 2, 2, 84, 18, 2, 84, 19, 2, 7, 2,
|
||||
0, 2, 23, 18, 23, 20, 2, 2, 84, 18, 2, 84, 20, 2, 8, 2, 0, 3, 23, 18,
|
||||
23, 20, 30, 40, 2, 2, 84, 18, 2, 84, 22, 2, 6, 1, 255, 4, 14, 18, 14,
|
||||
19, 20, 30, 20, 54, 0, 4, 48, 18, 2, 48, 19, 2, 60, 30, 2, 60, 54, 2,
|
||||
14, 0, 255, 2, 17, 19, 30, 55, 0, 2, 56, 19, 2, 68, 55, 2, 12, 2, 255,
|
||||
3, 17, 19, 24, 32, 30, 56, 0, 6, 62, 19, 2, 90, 28, 2, 80, 37, 2, 90,
|
||||
43, 2, 86, 48, 2, 118, 56, 2, 22, 1, 255, 2, 23, 20, 30, 40, 2, 1, 84,
|
||||
22, 2, 25, 1, 255, 1, 23, 24, 2, 1, 84, 24, 2, 14, 0, 6, 2, 17, 19,
|
||||
20, 55, 0, 2, 56, 19, 2, 60, 55, 2, 18, 1, 255, 2, 20, 20, 20, 47, 2,
|
||||
2, 72, 20, 2, 72, 47, 2, 22, 1, 255, 2, 23, 20, 30, 40, 2, 1, 84, 22,
|
||||
2, 22, 2, 255, 1, 20, 22, 0, 2, 62, 20, 2, 66, 40, 2, 16, 2, 255, 2,
|
||||
20, 20, 28, 40, 2, 2, 84, 20, 2, 112, 40, 2, 4, 0, 255, 1, 23, 18, 2,
|
||||
1, 84, 18, 2, 20, 1, 255, 2, 23, 20, 30, 55, 2, 2, 84, 20, 2, 84, 55,
|
||||
2, 21, 1, 255, 3, 23, 20, 30, 39, 30, 49, 2, 2, 84, 21, 2, 84, 49, 2,
|
||||
26, 1, 255, 3, 23, 20, 24, 41, 30, 55, 2, 1, 84, 25, 2, 26, 1, 255,
|
||||
3, 23, 20, 24, 41, 30, 55, 2, 1, 84, 25, 2, 17, 1, 255, 2, 23, 20, 30,
|
||||
42, 2, 2, 84, 20, 2, 112, 42, 2, 34, 0, 255, 1, 27, 55, 2, 1, 84, 55,
|
||||
2, 34, 0, 255, 1, 30, 55, 0, 1, 78, 55, 2, 34, 0, 255, 1, 27, 55, 2,
|
||||
1, 84, 55, 2, 34, 0, 255, 1, 20, 55, 2, 1, 76, 55, 2, 31, 2, 255, 2,
|
||||
17, 35, 30, 55, 0, 2, 68, 35, 2, 68, 55, 2, 30, 2, 255, 3, 17, 35, 24,
|
||||
40, 30, 55, 0, 3, 56, 35, 2, 68, 40, 2, 68, 55, 2, 28, 2, 255, 3, 17,
|
||||
29, 24, 40, 30, 55, 0, 3, 56, 29, 2, 58, 40, 2, 62, 55, 2, 33, 0, 255,
|
||||
1, 27, 54, 2, 1, 84, 54, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2,
|
||||
1, 4, 1, 5, 1, 18, 2, 18, 19, 4, 18, 19, 30, 54, 2, 18, 20, 2, 18, 22,
|
||||
1, 19, 3, 19, 29, 55, 3, 19, 31, 55, 3, 19, 32, 56, 2, 19, 33, 2, 19,
|
||||
55, 1, 20, 2, 20, 40, 2, 20, 42, 2, 20, 47, 2, 20, 54, 2, 20, 55, 2,
|
||||
21, 49, 1, 22, 2, 22, 55, 2, 23, 55, 1, 24, 1, 25, 1, 26, 3, 29, 40,
|
||||
55, 2, 29, 55, 3, 35, 40, 55, 2, 35, 55, 1, 40, 1, 54, 1, 55, 0, 0,
|
||||
0, 1, 0, 0, 0, 220, 16, 0, 0, 4, 0, 0, 0, 227, 16, 0, 0, 5, 0, 0, 0,
|
||||
255, 16, 0, 0, 50, 50, 32, 114, 114, 32, 163, 163, 32, 0, 0, 0, 3, 0,
|
||||
0, 0, 236, 22, 0, 0, 84, 0, 69, 1, 74, 1, 18, 4, 5, 6, 7, 8, 9, 10,
|
||||
11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 0, 0, 0, 68, 69, 0, 0, 3,
|
||||
0, 0, 0, 0, 23, 0, 0, 74, 80, 0, 0, 10, 0, 0, 0, 238, 13, 0, 0, 85,
|
||||
83, 0, 0, 2, 0, 0, 0, 72, 23, 0, 0, 3, 0, 0, 0, 144, 17, 0, 0, 252,
|
||||
0, 253, 0, 4, 2, 64, 19, 1, 64, 55, 1, 1, 2, 40, 14, 0, 40, 39, 0, 4,
|
||||
4, 56, 19, 0, 58, 29, 0, 60, 41, 0, 70, 55, 0, 5, 3, 52, 15, 1, 64,
|
||||
30, 1, 72, 39, 1, 8, 3, 52, 1, 0, 64, 10, 0, 72, 17, 0, 4, 3, 60, 20,
|
||||
1, 60, 40, 1, 60, 55, 1, 1, 3, 56, 14, 0, 60, 25, 0, 60, 39, 0, 6, 1,
|
||||
84, 20, 0, 7, 1, 84, 15, 1, 10, 1, 84, 1, 0, 4, 1, 60, 20, 1, 1, 1,
|
||||
56, 15, 0, 6, 1, 84, 20, 0, 7, 1, 88, 15, 1, 10, 1, 88, 1, 0, 6, 2,
|
||||
84, 20, 0, 84, 55, 0, 7, 2, 84, 15, 1, 84, 39, 1, 10, 2, 84, 1, 0, 84,
|
||||
17, 0, 0, 0, 4, 2, 66, 20, 1, 66, 54, 1, 1, 2, 54, 15, 0, 54, 39, 0,
|
||||
6, 2, 92, 20, 0, 80, 55, 0, 7, 2, 88, 15, 1, 76, 39, 1, 10, 2, 88, 1,
|
||||
0, 76, 17, 0, 4, 2, 66, 20, 1, 64, 55, 1, 1, 2, 56, 15, 0, 56, 39, 0,
|
||||
4, 1, 56, 19, 1, 1, 1, 48, 14, 0, 4, 1, 60, 19, 1, 1, 1, 56, 14, 0,
|
||||
4, 1, 60, 19, 1, 1, 1, 56, 14, 0, 6, 2, 84, 23, 0, 112, 55, 0, 7, 2,
|
||||
88, 19, 1, 116, 39, 1, 10, 2, 88, 4, 0, 116, 17, 0, 4, 5, 56, 19, 1,
|
||||
70, 28, 1, 58, 36, 1, 68, 40, 1, 70, 55, 1, 1, 7, 52, 13, 0, 66, 22,
|
||||
0, 68, 23, 0, 52, 26, 0, 62, 27, 0, 72, 33, 0, 74, 39, 0, 4, 11, 58,
|
||||
19, 0, 84, 27, 0, 76, 34, 0, 76, 36, 0, 72, 38, 0, 80, 44, 0, 68, 50,
|
||||
0, 80, 51, 0, 80, 53, 0, 80, 57, 0, 80, 58, 0, 5, 10, 58, 13, 1, 66,
|
||||
22, 1, 80, 23, 1, 62, 26, 1, 66, 27, 1, 82, 32, 1, 74, 35, 1, 76, 37,
|
||||
1, 72, 38, 1, 80, 41, 1, 8, 5, 52, 0, 0, 58, 7, 0, 50, 8, 0, 82, 13,
|
||||
0, 72, 17, 0, 4, 6, 56, 19, 1, 68, 28, 1, 56, 36, 1, 68, 38, 1, 68,
|
||||
45, 1, 68, 55, 1, 1, 6, 48, 14, 0, 68, 23, 0, 48, 26, 0, 62, 27, 0,
|
||||
74, 33, 0, 72, 39, 0, 4, 5, 56, 19, 0, 78, 28, 0, 64, 36, 0, 68, 38,
|
||||
0, 78, 46, 0, 5, 10, 62, 13, 1, 62, 22, 1, 78, 23, 1, 50, 26, 1, 56,
|
||||
27, 1, 78, 32, 1, 78, 35, 1, 78, 37, 1, 60, 38, 1, 78, 41, 1, 8, 6,
|
||||
58, 0, 0, 64, 7, 0, 76, 8, 0, 76, 12, 0, 78, 15, 0, 72, 17, 0, 4, 1,
|
||||
120, 26, 0, 5, 1, 120, 21, 1, 12, 1, 120, 6, 0, 76, 34, 120, 19, 0,
|
||||
120, 20, 0, 120, 21, 0, 120, 22, 0, 120, 23, 0, 120, 24, 0, 120, 25,
|
||||
0, 120, 26, 0, 120, 27, 0, 120, 28, 0, 120, 29, 0, 120, 30, 0, 120,
|
||||
31, 0, 120, 32, 0, 120, 33, 0, 120, 34, 0, 120, 35, 0, 120, 36, 0, 120,
|
||||
37, 0, 120, 38, 0, 120, 39, 0, 120, 40, 0, 120, 41, 0, 120, 42, 0, 120,
|
||||
43, 0, 120, 44, 0, 120, 45, 0, 120, 46, 0, 120, 47, 0, 120, 48, 0, 120,
|
||||
49, 0, 120, 50, 0, 120, 51, 0, 120, 52, 0, 9, 1, 120, 2, 0, 4, 1, 120,
|
||||
25, 0, 5, 1, 120, 20, 1, 12, 1, 120, 5, 0, 76, 24, 120, 19, 0, 120,
|
||||
20, 0, 120, 21, 0, 120, 22, 0, 120, 23, 0, 120, 24, 0, 120, 25, 0, 120,
|
||||
26, 0, 120, 27, 0, 120, 28, 0, 120, 29, 0, 120, 30, 0, 120, 31, 0, 120,
|
||||
32, 0, 120, 33, 0, 120, 34, 0, 120, 35, 0, 120, 36, 0, 120, 37, 0, 120,
|
||||
38, 0, 120, 39, 0, 120, 40, 0, 120, 41, 0, 120, 42, 0, 9, 1, 120, 1,
|
||||
0, 4, 4, 56, 19, 1, 70, 28, 1, 58, 36, 1, 70, 55, 1, 1, 4, 48, 14, 0,
|
||||
62, 23, 0, 48, 26, 0, 60, 39, 0, 4, 4, 56, 19, 1, 66, 28, 1, 60, 36,
|
||||
1, 66, 55, 1, 1, 3, 56, 14, 0, 60, 24, 0, 60, 39, 0, 6, 2, 84, 20, 0,
|
||||
84, 55, 0, 7, 2, 88, 15, 1, 88, 39, 1, 10, 2, 88, 1, 0, 88, 17, 0, 4,
|
||||
4, 56, 19, 1, 70, 28, 1, 58, 36, 1, 70, 55, 1, 1, 4, 48, 14, 0, 62,
|
||||
23, 0, 48, 26, 0, 60, 39, 0, 4, 2, 60, 29, 1, 68, 55, 1, 1, 2, 56, 24,
|
||||
0, 56, 39, 0, 6, 2, 112, 29, 0, 112, 55, 0, 7, 2, 112, 24, 1, 112, 39,
|
||||
1, 10, 2, 112, 7, 0, 112, 17, 0, 0, 2, 64, 18, 1, 64, 20, 1, 4, 4, 48,
|
||||
18, 0, 48, 19, 0, 60, 30, 0, 60, 54, 0, 5, 2, 48, 17, 1, 48, 39, 1,
|
||||
8, 2, 48, 2, 0, 48, 17, 0, 4, 2, 56, 19, 1, 68, 55, 1, 1, 2, 48, 14,
|
||||
0, 60, 39, 0, 4, 6, 62, 19, 0, 90, 28, 0, 80, 37, 0, 90, 43, 0, 86,
|
||||
48, 0, 118, 56, 0, 5, 6, 74, 14, 1, 98, 23, 1, 66, 26, 1, 74, 27, 1,
|
||||
98, 34, 1, 118, 40, 1, 8, 5, 74, 0, 0, 78, 7, 0, 82, 9, 0, 98, 15, 0,
|
||||
118, 18, 0, 6, 1, 84, 24, 0, 7, 1, 88, 20, 1, 10, 1, 88, 5, 0, 6, 1,
|
||||
84, 24, 0, 7, 1, 88, 20, 1, 10, 1, 88, 5, 0, 4, 2, 56, 19, 0, 60, 55,
|
||||
0, 5, 2, 48, 14, 1, 60, 39, 1, 8, 2, 64, 0, 0, 70, 17, 0, 6, 2, 72,
|
||||
20, 0, 72, 47, 0, 3, 2, 76, 15, 1, 76, 35, 1, 4, 2, 60, 20, 1, 60, 40,
|
||||
1, 1, 2, 56, 15, 0, 64, 29, 0, 4, 2, 60, 20, 1, 60, 40, 1, 1, 1, 56,
|
||||
18, 0, 4, 2, 84, 20, 1, 84, 40, 1, 1, 1, 56, 18, 0, 6, 1, 84, 22, 0,
|
||||
7, 1, 88, 18, 1, 10, 1, 88, 3, 0, 6, 1, 84, 22, 0, 7, 1, 88, 18, 1,
|
||||
10, 1, 88, 3, 0, 6, 2, 84, 20, 0, 112, 40, 0, 3, 2, 68, 15, 1, 96, 29,
|
||||
1, 4, 2, 66, 20, 0, 66, 40, 0, 1, 2, 42, 15, 1, 64, 29, 1, 4, 2, 62,
|
||||
20, 1, 66, 40, 1, 1, 2, 42, 15, 0, 64, 29, 0, 4, 2, 60, 20, 0, 60, 40,
|
||||
0, 1, 2, 56, 15, 1, 64, 29, 1, 0, 0, 4, 4, 60, 20, 1, 60, 39, 1, 60,
|
||||
47, 1, 60, 55, 1, 1, 4, 56, 15, 0, 60, 28, 0, 60, 35, 0, 60, 39, 0,
|
||||
6, 2, 84, 21, 0, 84, 49, 0, 7, 2, 88, 16, 1, 88, 36, 1, 10, 2, 88, 2,
|
||||
0, 88, 16, 0, 4, 2, 60, 20, 1, 60, 55, 1, 1, 2, 56, 15, 0, 60, 39, 0,
|
||||
0, 2, 60, 20, 1, 60, 55, 1, 6, 1, 84, 25, 0, 7, 1, 84, 20, 1, 10, 1,
|
||||
84, 5, 0, 6, 1, 84, 25, 0, 7, 1, 88, 20, 1, 10, 1, 88, 5, 0, 6, 2, 84,
|
||||
20, 0, 112, 42, 0, 7, 2, 88, 15, 1, 116, 31, 1, 10, 2, 88, 1, 0, 116,
|
||||
11, 0, 4, 3, 60, 20, 1, 60, 40, 1, 60, 55, 1, 1, 3, 56, 15, 0, 64, 29,
|
||||
0, 60, 39, 0, 4, 1, 60, 55, 1, 1, 1, 52, 39, 0, 6, 1, 80, 55, 0, 7,
|
||||
1, 80, 39, 1, 10, 1, 80, 17, 0, 6, 1, 80, 55, 0, 7, 1, 80, 39, 1, 10,
|
||||
1, 80, 17, 0, 6, 1, 76, 55, 0, 7, 1, 68, 39, 1, 10, 1, 68, 17, 0, 6,
|
||||
1, 76, 55, 0, 7, 1, 76, 39, 1, 10, 1, 76, 17, 0, 4, 1, 60, 55, 1, 1,
|
||||
1, 60, 39, 0, 6, 1, 84, 55, 0, 7, 1, 88, 39, 1, 10, 1, 88, 17, 0, 4,
|
||||
1, 78, 55, 0, 5, 1, 78, 39, 1, 8, 1, 78, 17, 0, 4, 3, 56, 35, 1, 68,
|
||||
40, 1, 68, 55, 1, 1, 4, 48, 26, 0, 62, 27, 0, 74, 33, 0, 72, 39, 0,
|
||||
4, 3, 56, 29, 1, 58, 40, 1, 62, 55, 1, 1, 4, 46, 23, 0, 48, 26, 0, 56,
|
||||
29, 0, 56, 39, 0, 4, 2, 68, 35, 1, 68, 55, 1, 1, 2, 66, 26, 0, 60, 39,
|
||||
0, 2, 1, 84, 54, 0, 0, 0, 88, 65, 0, 0, 2, 0, 0, 0, 144, 14, 0, 0, 88,
|
||||
84, 0, 0, 47, 0, 0, 0, 168, 17, 0, 0, 88, 86, 0, 0, 48, 0, 0, 0, 124,
|
||||
16, 0, 0, 3, 0, 0, 0, 212, 22, 0, 0, 3, 0, 0, 0, 40, 29, 0, 0, 3, 3,
|
||||
3, 9, 3, 11, 4, 4, 4, 7, 4, 8, 4, 10, 4, 11, 5, 7, 8, 8, 9, 9, 9, 11,
|
||||
11, 11, 38, 38, 38, 46, 38, 62, 38, 110, 38, 118, 38, 134, 38, 142,
|
||||
38, 159, 38, 175, 46, 46, 54, 54, 54, 62, 54, 134, 62, 62, 102, 102,
|
||||
102, 110, 102, 134, 102, 142, 102, 159, 110, 126, 110, 134, 110, 142,
|
||||
134, 134, 134, 159, 142, 142, 151, 151, 151, 159, 151, 175, 159, 159,
|
||||
1, 0, 0, 0, 116, 13, 0, 0, 3, 0, 0, 0, 148, 14, 0, 0, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 50, 50, 50, 114, 50, 163, 114, 163, 4, 168, 0, 0
|
||||
};
|
||||
const resource_hnd_t wifi_firmware_clm_blob =
|
||||
{ RESOURCE_IN_MEMORY, 7697, {.mem = { (const char *)wifi_firmware_clm_blob_image_data }}};
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) 2019, Cypress Semiconductor Corporation, All Rights Reserved
|
||||
* SPDX-License-Identifier: LicenseRef-PBL
|
||||
*
|
||||
* This file and the related binary are licensed under the
|
||||
* Permissive Binary License, Version 1.0 (the "License");
|
||||
* you may not use these files except in compliance with the License.
|
||||
*
|
||||
* You may obtain a copy of the License here:
|
||||
* LICENSE-permissive-binary-license-1.0.txt and at
|
||||
* https://www.mbed.com/licenses/PBL-1.0
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* Automatically generated file - this comment ensures resources.h file creation */
|
||||
/* Auto-generated header file. Do not edit */
|
||||
#ifndef INCLUDED_RESOURCES_H_
|
||||
#define INCLUDED_RESOURCES_H_
|
||||
#include "wiced_resource.h"
|
||||
|
||||
extern const resource_hnd_t wifi_firmware_image;
|
||||
extern const char wifi_firmware_image_data[360823];
|
||||
extern const resource_hnd_t wifi_firmware_clm_blob;
|
||||
extern const char wifi_firmware_clm_blob_image_data[7697];
|
||||
|
||||
#endif /* ifndef INCLUDED_RESOURCES_H_ */
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,400 @@
|
|||
/*
|
||||
* Copyright (c) 2019, Cypress Semiconductor Corporation, All Rights Reserved
|
||||
* SPDX-License-Identifier: LicenseRef-PBL
|
||||
*
|
||||
* This file and the related binary are licensed under the
|
||||
* Permissive Binary License, Version 1.0 (the "License");
|
||||
* you may not use these files except in compliance with the License.
|
||||
*
|
||||
* You may obtain a copy of the License here:
|
||||
* LICENSE-permissive-binary-license-1.0.txt and at
|
||||
* https://www.mbed.com/licenses/PBL-1.0
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "wiced_resource.h"
|
||||
|
||||
const unsigned char wifi_firmware_clm_blob_image_data[7222] =
|
||||
{
|
||||
66, 76, 79, 66, 60, 0, 0, 0, 190, 201, 240, 7, 1, 0, 0, 0, 2, 0, 0,
|
||||
0, 0, 0, 0, 0, 60, 0, 0, 0, 246, 27, 0, 0, 227, 111, 211, 135, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 50, 28, 0, 0, 4, 0, 0, 0, 42, 255, 237, 159, 0, 0,
|
||||
0, 0, 67, 76, 77, 32, 68, 65, 84, 65, 0, 0, 12, 0, 2, 0, 57, 46, 49,
|
||||
48, 46, 51, 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 46, 50, 57,
|
||||
46, 52, 0, 0, 0, 0, 0, 0, 0, 0, 184, 10, 0, 0, 67, 108, 109, 73, 109,
|
||||
112, 111, 114, 116, 58, 32, 49, 46, 51, 54, 46, 51, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 66, 114, 111, 97, 100, 99, 111, 109, 45, 48, 46,
|
||||
48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 49, 0, 81, 50, 0, 3, 3, 3, 9,
|
||||
3, 11, 4, 4, 4, 7, 4, 8, 4, 10, 4, 11, 5, 7, 8, 8, 9, 9, 9, 11, 11,
|
||||
11, 38, 38, 38, 46, 38, 62, 38, 110, 38, 118, 38, 134, 38, 142, 38,
|
||||
159, 38, 175, 46, 46, 54, 54, 54, 62, 54, 134, 62, 62, 102, 102, 102,
|
||||
110, 102, 134, 102, 142, 102, 159, 110, 126, 110, 134, 110, 142, 134,
|
||||
134, 134, 159, 142, 142, 151, 151, 151, 159, 151, 175, 159, 159, 65,
|
||||
69, 1, 65, 82, 1, 65, 84, 1, 65, 85, 2, 66, 69, 1, 66, 71, 1, 66, 78,
|
||||
1, 67, 65, 2, 67, 72, 1, 67, 89, 1, 67, 90, 1, 68, 69, 3, 68, 75, 1,
|
||||
69, 69, 1, 69, 83, 1, 70, 73, 1, 70, 82, 1, 71, 66, 1, 71, 82, 1, 72,
|
||||
82, 1, 72, 85, 1, 73, 68, 5, 73, 69, 1, 73, 83, 1, 73, 84, 1, 74, 80,
|
||||
3, 75, 82, 4, 75, 87, 1, 76, 73, 1, 76, 84, 1, 76, 85, 1, 76, 86, 1,
|
||||
77, 65, 1, 77, 84, 1, 77, 88, 1, 78, 76, 1, 78, 79, 1, 80, 76, 1, 80,
|
||||
84, 1, 80, 89, 1, 82, 79, 1, 82, 85, 5, 83, 69, 1, 83, 73, 1, 83, 75,
|
||||
1, 84, 82, 7, 84, 87, 2, 85, 83, 26, 1, 0, 255, 1, 30, 2, 0, 3, 76,
|
||||
1, 3, 76, 2, 1, 66, 12, 3, 1, 0, 255, 1, 30, 2, 0, 7, 72, 0, 1, 58,
|
||||
0, 3, 68, 6, 3, 74, 8, 1, 74, 10, 3, 68, 11, 3, 66, 12, 3, 1, 0, 255,
|
||||
1, 30, 2, 0, 2, 64, 2, 1, 56, 2, 3, 1, 0, 255, 1, 30, 2, 0, 5, 72, 0,
|
||||
1, 76, 1, 3, 76, 7, 1, 72, 12, 1, 66, 12, 3, 1, 0, 255, 1, 30, 2, 0,
|
||||
4, 58, 0, 3, 68, 2, 1, 66, 7, 3, 58, 12, 3, 1, 0, 255, 1, 30, 2, 0,
|
||||
5, 92, 0, 1, 86, 0, 3, 126, 7, 0, 92, 12, 1, 86, 12, 3, 1, 0, 255, 1,
|
||||
30, 2, 0, 5, 70, 0, 3, 80, 1, 1, 80, 7, 3, 76, 12, 1, 72, 12, 3, 2,
|
||||
4, 255, 1, 20, 4, 2, 1, 76, 4, 0, 2, 0, 3, 1, 20, 4, 2, 1, 76, 4, 1,
|
||||
2, 0, 255, 1, 20, 4, 0, 1, 76, 4, 0, 3, 0, 4, 1, 20, 5, 2, 5, 76, 1,
|
||||
3, 76, 4, 1, 70, 12, 3, 76, 14, 3, 54, 17, 1, 3, 0, 4, 1, 20, 5, 0,
|
||||
6, 60, 0, 3, 68, 2, 1, 64, 8, 3, 48, 14, 1, 44, 14, 3, 64, 17, 1, 3,
|
||||
0, 4, 1, 20, 5, 0, 3, 64, 3, 3, 64, 5, 1, 46, 16, 3, 2, 0, 3, 1, 20,
|
||||
4, 0, 3, 64, 2, 0, 48, 14, 1, 44, 14, 3, 3, 0, 4, 1, 20, 5, 0, 6, 62,
|
||||
0, 3, 66, 4, 1, 66, 7, 3, 62, 12, 3, 66, 14, 3, 42, 17, 1, 3, 0, 255,
|
||||
1, 20, 5, 2, 2, 84, 4, 3, 78, 5, 1, 1, 0, 255, 1, 20, 2, 0, 2, 69, 2,
|
||||
1, 79, 2, 3, 3, 0, 255, 1, 30, 5, 0, 1, 120, 5, 0, 0, 0, 255, 0, 0,
|
||||
0, 2, 0, 255, 1, 23, 4, 2, 1, 92, 4, 0, 2, 0, 255, 1, 36, 4, 2, 1, 100,
|
||||
4, 0, 2, 4, 3, 1, 20, 4, 2, 1, 76, 4, 0, 1, 0, 255, 1, 20, 2, 2, 1,
|
||||
76, 2, 0, 2, 0, 255, 1, 20, 4, 4, 3, 56, 0, 3, 64, 9, 3, 56, 16, 3,
|
||||
2, 1, 76, 4, 1, 74, 48, 0, 74, 49, 0, 74, 50, 0, 74, 51, 0, 74, 52,
|
||||
0, 74, 53, 0, 74, 54, 0, 74, 55, 0, 74, 56, 0, 74, 57, 0, 0, 0, 4, 0,
|
||||
0, 0, 37, 4, 0, 0, 12, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 4, 0, 1,
|
||||
2, 3, 8, 12, 13, 14, 15, 16, 17, 18, 19, 8, 4, 5, 6, 7, 8, 9, 10, 11,
|
||||
1, 1, 1, 10, 1, 11, 1, 12, 1, 13, 1, 14, 2, 2, 2, 10, 2, 11, 2, 12,
|
||||
3, 9, 10, 10, 11, 11, 12, 12, 12, 13, 12, 14, 13, 13, 14, 14, 34, 46,
|
||||
36, 48, 36, 64, 36, 116, 36, 140, 36, 144, 36, 161, 36, 165, 36, 177,
|
||||
52, 60, 52, 64, 52, 124, 52, 140, 52, 144, 52, 165, 56, 64, 64, 64,
|
||||
64, 100, 100, 100, 100, 116, 100, 140, 100, 144, 100, 165, 104, 128,
|
||||
104, 140, 104, 165, 132, 140, 132, 144, 132, 165, 149, 149, 149, 161,
|
||||
149, 165, 149, 177, 153, 161, 165, 165, 0, 1, 2, 1, 4, 1, 5, 1, 18,
|
||||
2, 18, 19, 4, 18, 19, 29, 48, 2, 18, 20, 2, 18, 22, 1, 19, 3, 19, 28,
|
||||
49, 3, 19, 30, 49, 3, 19, 31, 50, 2, 19, 32, 2, 19, 49, 1, 20, 2, 20,
|
||||
38, 2, 20, 40, 2, 20, 44, 2, 20, 48, 2, 20, 49, 2, 21, 46, 1, 22, 2,
|
||||
22, 49, 2, 23, 49, 1, 24, 1, 25, 1, 26, 3, 28, 38, 49, 2, 28, 49, 3,
|
||||
33, 38, 49, 2, 33, 49, 1, 38, 1, 48, 1, 49, 69, 48, 0, 88, 65, 0, 88,
|
||||
85, 0, 65, 85, 2, 74, 80, 1, 0, 0, 3, 0, 0, 0, 124, 10, 0, 0, 16, 4,
|
||||
5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 34, 46, 4, 36,
|
||||
64, 4, 100, 144, 4, 149, 177, 4, 50, 48, 49, 57, 45, 48, 54, 45, 48,
|
||||
55, 32, 48, 54, 58, 53, 57, 58, 53, 50, 0, 4, 2, 64, 19, 0, 64, 49,
|
||||
0, 1, 2, 40, 14, 0, 40, 39, 0, 4, 4, 56, 19, 0, 58, 28, 0, 60, 39, 0,
|
||||
70, 49, 0, 1, 3, 52, 15, 0, 64, 30, 0, 72, 39, 0, 4, 3, 60, 20, 0, 60,
|
||||
38, 0, 60, 49, 0, 1, 3, 56, 14, 0, 60, 25, 0, 60, 39, 0, 6, 1, 84, 20,
|
||||
0, 3, 1, 84, 15, 0, 4, 1, 60, 20, 0, 1, 1, 56, 15, 0, 6, 1, 84, 20,
|
||||
0, 3, 1, 88, 15, 0, 6, 2, 84, 20, 0, 84, 49, 0, 3, 2, 84, 15, 0, 84,
|
||||
39, 0, 0, 0, 4, 2, 66, 20, 0, 66, 48, 0, 1, 2, 54, 15, 0, 54, 39, 0,
|
||||
6, 2, 92, 20, 0, 80, 49, 0, 3, 2, 88, 15, 0, 76, 39, 0, 4, 2, 66, 20,
|
||||
0, 64, 49, 0, 1, 2, 56, 15, 0, 56, 39, 0, 4, 1, 56, 19, 0, 1, 1, 48,
|
||||
14, 0, 4, 1, 60, 19, 0, 1, 1, 56, 14, 0, 4, 1, 60, 19, 0, 1, 1, 56,
|
||||
14, 0, 6, 2, 84, 23, 0, 112, 49, 0, 3, 2, 88, 19, 0, 116, 39, 0, 4,
|
||||
5, 56, 19, 0, 70, 27, 0, 58, 34, 0, 68, 38, 0, 70, 49, 0, 1, 7, 52,
|
||||
13, 0, 66, 22, 0, 68, 23, 0, 52, 26, 0, 62, 27, 0, 72, 33, 0, 74, 39,
|
||||
0, 4, 4, 58, 19, 0, 80, 47, 0, 80, 51, 0, 80, 52, 0, 1, 4, 58, 13, 0,
|
||||
66, 22, 0, 72, 38, 0, 80, 41, 0, 4, 6, 56, 19, 0, 68, 27, 0, 56, 34,
|
||||
0, 68, 36, 0, 68, 42, 0, 68, 49, 0, 1, 6, 48, 14, 0, 68, 23, 0, 48,
|
||||
26, 0, 62, 27, 0, 74, 33, 0, 72, 39, 0, 4, 5, 56, 19, 0, 78, 27, 0,
|
||||
64, 34, 0, 68, 36, 0, 78, 43, 0, 1, 10, 62, 13, 0, 62, 22, 0, 78, 23,
|
||||
0, 50, 26, 0, 56, 27, 0, 78, 32, 0, 78, 35, 0, 78, 37, 0, 60, 38, 0,
|
||||
78, 41, 0, 4, 1, 120, 26, 0, 1, 1, 120, 21, 0, 4, 1, 120, 25, 0, 1,
|
||||
1, 120, 20, 0, 4, 4, 56, 19, 0, 70, 27, 0, 58, 34, 0, 70, 49, 0, 1,
|
||||
4, 48, 14, 0, 62, 23, 0, 48, 26, 0, 60, 39, 0, 4, 4, 56, 19, 0, 66,
|
||||
27, 0, 60, 34, 0, 66, 49, 0, 1, 3, 56, 14, 0, 60, 24, 0, 60, 39, 0,
|
||||
6, 2, 84, 20, 0, 84, 49, 0, 3, 2, 88, 15, 0, 88, 39, 0, 4, 4, 56, 19,
|
||||
0, 70, 27, 0, 58, 34, 0, 70, 49, 0, 1, 4, 48, 14, 0, 62, 23, 0, 48,
|
||||
26, 0, 60, 39, 0, 4, 2, 60, 28, 0, 68, 49, 0, 1, 2, 56, 24, 0, 56, 39,
|
||||
0, 6, 2, 112, 28, 0, 112, 49, 0, 3, 2, 112, 24, 0, 112, 39, 0, 0, 2,
|
||||
64, 18, 0, 64, 20, 0, 4, 4, 48, 18, 0, 48, 19, 0, 60, 29, 0, 60, 48,
|
||||
0, 1, 2, 48, 17, 0, 48, 39, 0, 4, 2, 56, 19, 0, 68, 49, 0, 1, 2, 48,
|
||||
14, 0, 60, 39, 0, 4, 6, 62, 19, 0, 90, 27, 0, 80, 35, 0, 90, 41, 0,
|
||||
86, 45, 0, 118, 50, 0, 1, 6, 74, 14, 0, 98, 23, 0, 66, 26, 0, 74, 27,
|
||||
0, 98, 34, 0, 118, 40, 0, 6, 1, 84, 24, 0, 3, 1, 88, 20, 0, 6, 1, 84,
|
||||
24, 0, 3, 1, 88, 20, 0, 4, 2, 56, 19, 0, 60, 49, 0, 1, 2, 48, 14, 0,
|
||||
60, 39, 0, 6, 2, 72, 20, 0, 72, 44, 0, 3, 2, 76, 15, 0, 76, 35, 0, 4,
|
||||
2, 60, 20, 0, 60, 38, 0, 1, 2, 56, 15, 0, 64, 29, 0, 4, 2, 60, 20, 0,
|
||||
60, 38, 0, 1, 1, 56, 18, 0, 4, 2, 84, 20, 0, 84, 38, 0, 1, 1, 56, 18,
|
||||
0, 6, 1, 84, 22, 0, 3, 1, 88, 18, 0, 6, 1, 84, 22, 0, 3, 1, 88, 18,
|
||||
0, 6, 2, 84, 20, 0, 112, 38, 0, 3, 2, 68, 15, 0, 96, 29, 0, 4, 2, 66,
|
||||
20, 0, 66, 38, 0, 1, 2, 42, 15, 0, 64, 29, 0, 4, 2, 62, 20, 0, 66, 38,
|
||||
0, 1, 2, 42, 15, 0, 64, 29, 0, 4, 2, 60, 20, 0, 60, 38, 0, 1, 2, 56,
|
||||
15, 0, 64, 29, 0, 0, 0, 4, 4, 60, 20, 0, 60, 37, 0, 60, 44, 0, 60, 49,
|
||||
0, 1, 4, 56, 15, 0, 60, 28, 0, 60, 35, 0, 60, 39, 0, 6, 2, 84, 21, 0,
|
||||
84, 46, 0, 3, 2, 88, 16, 0, 88, 36, 0, 4, 2, 60, 20, 0, 60, 49, 0, 1,
|
||||
2, 56, 15, 0, 60, 39, 0, 0, 2, 60, 20, 0, 60, 49, 0, 6, 1, 84, 25, 0,
|
||||
3, 1, 84, 20, 0, 6, 1, 84, 25, 0, 3, 1, 88, 20, 0, 6, 2, 84, 20, 0,
|
||||
112, 40, 0, 3, 2, 88, 15, 0, 116, 31, 0, 4, 3, 60, 20, 0, 60, 38, 0,
|
||||
60, 49, 0, 1, 3, 56, 15, 0, 64, 29, 0, 60, 39, 0, 4, 1, 60, 49, 0, 1,
|
||||
1, 52, 39, 0, 6, 1, 80, 49, 0, 3, 1, 80, 39, 0, 6, 1, 80, 49, 0, 3,
|
||||
1, 80, 39, 0, 6, 2, 80, 19, 0, 80, 49, 0, 3, 2, 80, 14, 0, 80, 39, 0,
|
||||
6, 1, 76, 49, 0, 3, 1, 76, 39, 0, 6, 1, 76, 48, 0, 3, 1, 68, 39, 0,
|
||||
4, 1, 60, 49, 0, 1, 1, 60, 39, 0, 6, 1, 84, 49, 0, 3, 1, 88, 39, 0,
|
||||
4, 1, 78, 49, 0, 1, 1, 78, 39, 0, 4, 3, 56, 33, 0, 68, 38, 0, 68, 49,
|
||||
0, 1, 4, 48, 26, 0, 62, 27, 0, 74, 33, 0, 72, 39, 0, 4, 3, 56, 28, 0,
|
||||
58, 38, 0, 62, 49, 0, 1, 4, 46, 23, 0, 48, 26, 0, 56, 29, 0, 56, 39,
|
||||
0, 4, 2, 68, 33, 0, 68, 49, 0, 1, 2, 66, 26, 0, 60, 39, 0, 2, 1, 84,
|
||||
48, 0, 65, 69, 1, 65, 82, 1, 65, 84, 1, 65, 85, 2, 66, 69, 1, 66, 71,
|
||||
1, 66, 78, 1, 67, 65, 2, 67, 72, 1, 67, 89, 1, 67, 90, 1, 68, 69, 3,
|
||||
68, 75, 1, 69, 69, 1, 69, 83, 1, 70, 73, 1, 70, 82, 1, 71, 66, 1, 71,
|
||||
82, 1, 72, 82, 1, 72, 85, 1, 73, 68, 5, 73, 69, 1, 73, 83, 1, 73, 84,
|
||||
1, 74, 80, 3, 75, 82, 4, 75, 87, 1, 76, 73, 1, 76, 84, 1, 76, 85, 1,
|
||||
76, 86, 1, 77, 65, 1, 77, 84, 1, 77, 88, 1, 78, 76, 1, 78, 79, 1, 80,
|
||||
76, 1, 80, 84, 1, 80, 89, 1, 82, 79, 1, 82, 85, 5, 83, 69, 1, 83, 73,
|
||||
1, 83, 75, 1, 84, 87, 2, 85, 83, 25, 4, 5, 76, 0, 2, 76, 6, 2, 76, 10,
|
||||
2, 76, 11, 2, 66, 12, 2, 1, 4, 62, 0, 0, 66, 4, 0, 62, 9, 0, 58, 10,
|
||||
0, 4, 3, 58, 0, 2, 66, 7, 2, 58, 12, 2, 1, 5, 42, 0, 0, 50, 3, 0, 60,
|
||||
8, 0, 54, 9, 0, 46, 10, 0, 4, 1, 56, 2, 2, 1, 1, 32, 1, 0, 4, 5, 58,
|
||||
0, 2, 68, 6, 2, 74, 10, 2, 68, 11, 2, 66, 12, 2, 1, 5, 48, 0, 0, 58,
|
||||
3, 0, 66, 8, 0, 58, 9, 0, 54, 10, 0, 4, 3, 86, 0, 2, 126, 7, 2, 86,
|
||||
12, 2, 1, 3, 78, 0, 0, 126, 5, 0, 78, 10, 0, 4, 5, 70, 0, 2, 80, 6,
|
||||
2, 80, 10, 2, 80, 11, 2, 72, 12, 2, 1, 5, 58, 0, 0, 68, 3, 0, 80, 8,
|
||||
0, 68, 9, 0, 60, 10, 0, 4, 1, 64, 4, 2, 1, 1, 64, 2, 0, 4, 1, 76, 4,
|
||||
2, 1, 1, 72, 2, 0, 0, 1, 64, 4, 2, 4, 4, 60, 0, 2, 64, 8, 2, 44, 13,
|
||||
2, 44, 16, 2, 1, 3, 40, 0, 0, 52, 5, 0, 46, 11, 0, 0, 2, 64, 3, 2, 46,
|
||||
16, 2, 4, 2, 64, 2, 2, 44, 14, 2, 1, 3, 54, 0, 0, 64, 6, 0, 52, 12,
|
||||
0, 6, 1, 76, 4, 2, 3, 1, 76, 2, 0, 6, 1, 76, 4, 2, 3, 1, 76, 2, 0, 6,
|
||||
1, 76, 4, 2, 3, 1, 76, 2, 0, 6, 1, 76, 4, 2, 3, 1, 128, 2, 0, 4, 1,
|
||||
64, 4, 2, 1, 1, 64, 2, 0, 6, 1, 84, 4, 2, 3, 1, 72, 2, 0, 0, 1, 79,
|
||||
2, 2, 4, 2, 120, 4, 2, 120, 17, 2, 1, 1, 120, 2, 0, 0, 0, 0, 1, 64,
|
||||
4, 2, 4, 1, 80, 4, 2, 1, 1, 64, 2, 0, 4, 1, 88, 4, 2, 1, 1, 60, 2, 0,
|
||||
6, 1, 100, 4, 2, 3, 1, 88, 2, 0, 4, 1, 64, 2, 2, 1, 1, 52, 1, 0, 4,
|
||||
3, 56, 0, 2, 64, 9, 2, 56, 16, 2, 1, 2, 46, 0, 0, 52, 7, 0, 68, 69,
|
||||
0, 0, 3, 0, 0, 0, 251, 3, 0, 0, 74, 80, 0, 0, 10, 0, 0, 0, 228, 2, 0,
|
||||
0, 85, 83, 0, 0, 2, 0, 0, 0, 104, 0, 0, 0, 8, 12, 13, 14, 15, 16, 17,
|
||||
18, 19, 8, 4, 5, 6, 7, 8, 9, 10, 11, 1, 14, 1, 0, 0, 0, 112, 11, 0,
|
||||
0, 4, 3, 0, 0, 48, 3, 0, 0, 229, 27, 0, 0, 154, 3, 0, 0, 160, 10, 0,
|
||||
0, 82, 1, 0, 0, 67, 24, 0, 0, 0, 9, 0, 0, 69, 4, 0, 0, 156, 11, 0, 0,
|
||||
12, 4, 0, 0, 204, 27, 0, 0, 127, 178, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 212, 27, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 12, 3, 0, 0, 20, 4, 0, 0, 49, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 178, 10, 0, 0, 88, 65, 0, 0, 2,
|
||||
0, 0, 0, 4, 4, 0, 0, 88, 84, 0, 0, 47, 0, 0, 0, 115, 8, 0, 0, 88, 86,
|
||||
0, 0, 48, 0, 0, 0, 194, 0, 0, 0, 103, 1, 0, 0, 164, 11, 0, 0, 35, 97,
|
||||
0, 17, 18, 19, 19, 0, 0, 35, 110, 0, 18, 8, 255, 255, 240, 0, 35, 114,
|
||||
0, 17, 19, 19, 20, 0, 0, 48, 65, 0, 7, 8, 255, 255, 240, 16, 48, 66,
|
||||
0, 0, 14, 0, 17, 0, 16, 48, 67, 0, 7, 6, 13, 5, 0, 16, 65, 67, 0, 18,
|
||||
8, 255, 255, 240, 16, 65, 68, 0, 7, 33, 14, 39, 0, 48, 65, 69, 0, 7,
|
||||
8, 6, 7, 0, 32, 65, 69, 1, 7, 33, 6, 43, 0, 32, 65, 70, 0, 7, 33, 14,
|
||||
39, 0, 48, 65, 71, 0, 7, 41, 6, 47, 0, 32, 65, 73, 0, 6, 15, 5, 18,
|
||||
0, 16, 65, 76, 0, 7, 33, 6, 43, 0, 32, 65, 77, 0, 7, 5, 13, 3, 0, 0,
|
||||
65, 78, 0, 7, 14, 6, 17, 0, 32, 65, 79, 0, 7, 8, 255, 255, 240, 16,
|
||||
65, 81, 0, 18, 8, 255, 255, 240, 16, 65, 82, 0, 7, 25, 6, 25, 0, 0,
|
||||
65, 82, 1, 7, 14, 6, 17, 0, 0, 65, 83, 0, 6, 15, 5, 18, 0, 16, 65, 84,
|
||||
0, 7, 33, 6, 43, 0, 32, 65, 84, 1, 7, 37, 6, 36, 0, 32, 65, 85, 0, 20,
|
||||
42, 24, 46, 0, 0, 65, 85, 2, 20, 42, 23, 45, 0, 0, 65, 87, 0, 7, 34,
|
||||
6, 31, 0, 0, 65, 88, 0, 18, 8, 255, 255, 240, 16, 65, 90, 0, 7, 14,
|
||||
6, 17, 0, 32, 66, 65, 0, 7, 33, 6, 43, 0, 32, 66, 66, 0, 7, 22, 13,
|
||||
23, 0, 16, 66, 68, 0, 7, 46, 6, 59, 0, 0, 66, 69, 0, 7, 33, 6, 43, 0,
|
||||
32, 66, 69, 1, 7, 37, 6, 36, 0, 32, 66, 70, 0, 7, 33, 14, 39, 0, 16,
|
||||
66, 71, 0, 7, 33, 6, 43, 0, 32, 66, 71, 1, 7, 37, 6, 36, 0, 32, 66,
|
||||
72, 0, 7, 21, 6, 22, 0, 0, 66, 73, 0, 7, 33, 14, 39, 0, 16, 66, 74,
|
||||
0, 7, 33, 14, 39, 0, 48, 66, 76, 0, 18, 8, 255, 255, 240, 16, 66, 77,
|
||||
0, 6, 15, 5, 18, 0, 16, 66, 78, 0, 7, 8, 255, 255, 240, 0, 66, 78, 1,
|
||||
19, 41, 22, 47, 0, 0, 66, 79, 0, 7, 15, 13, 18, 0, 32, 66, 81, 0, 18,
|
||||
8, 255, 255, 240, 16, 66, 82, 0, 7, 43, 6, 52, 0, 32, 66, 83, 0, 20,
|
||||
21, 23, 22, 0, 0, 66, 84, 0, 7, 8, 13, 7, 0, 48, 66, 86, 0, 18, 8, 255,
|
||||
255, 240, 16, 66, 87, 0, 7, 45, 13, 51, 0, 48, 66, 89, 0, 7, 33, 255,
|
||||
255, 240, 0, 66, 90, 0, 7, 15, 13, 18, 0, 16, 67, 65, 0, 0, 21, 0, 22,
|
||||
0, 0, 67, 65, 2, 6, 15, 5, 18, 0, 16, 67, 67, 0, 18, 8, 255, 255, 240,
|
||||
16, 67, 68, 0, 7, 33, 14, 39, 0, 48, 67, 70, 0, 7, 33, 14, 39, 0, 16,
|
||||
67, 71, 0, 7, 33, 14, 39, 0, 48, 67, 72, 0, 7, 33, 6, 43, 0, 32, 67,
|
||||
72, 1, 7, 37, 6, 36, 0, 32, 67, 73, 0, 7, 33, 14, 39, 0, 48, 67, 75,
|
||||
0, 7, 44, 13, 50, 0, 16, 67, 76, 0, 7, 7, 6, 6, 0, 0, 67, 77, 0, 7,
|
||||
33, 14, 39, 0, 16, 67, 78, 0, 23, 49, 26, 53, 0, 0, 67, 79, 0, 7, 13,
|
||||
6, 11, 0, 32, 67, 80, 0, 18, 8, 255, 255, 240, 16, 67, 82, 0, 7, 14,
|
||||
6, 15, 0, 32, 67, 85, 0, 7, 8, 14, 255, 192, 48, 67, 86, 0, 7, 33, 14,
|
||||
39, 0, 16, 67, 87, 0, 18, 8, 255, 255, 240, 16, 67, 88, 0, 20, 42, 23,
|
||||
46, 0, 16, 67, 89, 0, 7, 33, 6, 43, 0, 32, 67, 89, 1, 7, 37, 6, 36,
|
||||
0, 32, 67, 90, 0, 7, 33, 6, 43, 0, 32, 67, 90, 1, 7, 37, 6, 36, 0, 32,
|
||||
68, 69, 0, 7, 33, 6, 43, 0, 32, 68, 69, 3, 7, 37, 6, 36, 0, 32, 68,
|
||||
74, 0, 7, 8, 255, 255, 240, 16, 68, 75, 0, 7, 33, 6, 43, 0, 32, 68,
|
||||
75, 1, 7, 37, 6, 36, 0, 32, 68, 77, 0, 7, 15, 13, 18, 0, 16, 68, 79,
|
||||
0, 7, 15, 13, 18, 0, 16, 68, 90, 0, 7, 5, 6, 4, 0, 32, 69, 48, 0, 7,
|
||||
12, 6, 13, 0, 32, 69, 67, 0, 7, 14, 6, 17, 0, 32, 69, 69, 0, 7, 33,
|
||||
6, 43, 0, 32, 69, 69, 1, 7, 37, 6, 36, 0, 32, 69, 71, 0, 7, 41, 21,
|
||||
48, 0, 0, 69, 72, 0, 7, 6, 13, 5, 0, 16, 69, 82, 0, 7, 8, 255, 255,
|
||||
240, 16, 69, 83, 0, 7, 33, 6, 43, 0, 32, 69, 83, 1, 7, 37, 6, 36, 0,
|
||||
32, 69, 84, 0, 7, 33, 6, 43, 0, 0, 70, 73, 0, 7, 33, 6, 43, 0, 32, 70,
|
||||
73, 1, 7, 37, 6, 36, 0, 32, 70, 74, 0, 7, 42, 13, 46, 0, 16, 70, 75,
|
||||
0, 7, 33, 14, 39, 0, 16, 70, 77, 0, 6, 15, 5, 18, 0, 16, 70, 79, 0,
|
||||
7, 33, 14, 39, 0, 48, 70, 82, 0, 7, 33, 6, 43, 0, 32, 70, 82, 1, 7,
|
||||
37, 6, 36, 0, 32, 71, 65, 0, 7, 33, 14, 39, 0, 16, 71, 66, 0, 7, 33,
|
||||
6, 43, 0, 32, 71, 66, 1, 7, 37, 6, 36, 0, 32, 71, 68, 0, 7, 43, 6, 52,
|
||||
0, 0, 71, 69, 0, 7, 33, 14, 39, 0, 48, 71, 70, 0, 7, 33, 6, 43, 0, 0,
|
||||
71, 71, 0, 7, 33, 14, 39, 0, 16, 71, 72, 0, 7, 33, 14, 39, 0, 48, 71,
|
||||
73, 0, 7, 33, 14, 39, 0, 16, 71, 76, 0, 18, 8, 255, 255, 240, 16, 71,
|
||||
77, 0, 7, 33, 14, 39, 0, 16, 71, 78, 0, 7, 33, 14, 39, 0, 48, 71, 80,
|
||||
0, 7, 33, 6, 43, 0, 0, 71, 81, 0, 7, 33, 14, 39, 0, 16, 71, 82, 0, 7,
|
||||
33, 6, 43, 0, 32, 71, 82, 1, 7, 37, 6, 36, 0, 32, 71, 83, 0, 18, 8,
|
||||
255, 255, 240, 16, 71, 84, 0, 7, 14, 12, 17, 0, 16, 71, 85, 0, 0, 14,
|
||||
0, 17, 0, 0, 71, 87, 0, 7, 33, 14, 39, 0, 16, 71, 89, 0, 7, 46, 13,
|
||||
54, 0, 16, 72, 75, 0, 20, 43, 24, 52, 0, 0, 72, 77, 0, 18, 8, 255, 255,
|
||||
240, 16, 72, 78, 0, 7, 47, 13, 61, 0, 0, 72, 82, 0, 7, 33, 6, 43, 0,
|
||||
32, 72, 82, 1, 7, 37, 6, 36, 0, 32, 72, 84, 0, 7, 46, 13, 54, 0, 0,
|
||||
72, 85, 0, 7, 33, 6, 43, 0, 32, 72, 85, 1, 7, 37, 6, 36, 0, 32, 73,
|
||||
68, 0, 7, 8, 6, 7, 0, 0, 73, 68, 5, 7, 55, 14, 65, 0, 16, 73, 69, 0,
|
||||
7, 33, 6, 43, 0, 32, 73, 69, 1, 7, 37, 6, 36, 0, 32, 73, 76, 0, 7, 5,
|
||||
6, 4, 0, 32, 73, 77, 0, 7, 33, 14, 39, 0, 16, 73, 78, 0, 19, 41, 22,
|
||||
47, 0, 32, 73, 79, 0, 7, 33, 14, 39, 0, 16, 73, 81, 0, 7, 33, 14, 39,
|
||||
0, 16, 73, 82, 0, 7, 8, 14, 255, 192, 48, 73, 83, 0, 7, 33, 6, 43, 0,
|
||||
32, 73, 83, 1, 7, 37, 6, 36, 0, 32, 73, 84, 0, 7, 33, 6, 43, 0, 32,
|
||||
73, 84, 1, 7, 37, 6, 36, 0, 32, 74, 48, 0, 7, 38, 16, 42, 0, 0, 74,
|
||||
49, 0, 15, 12, 255, 255, 240, 0, 74, 50, 0, 15, 5, 255, 255, 240, 0,
|
||||
74, 51, 0, 15, 38, 255, 255, 240, 0, 74, 52, 0, 15, 24, 255, 255, 240,
|
||||
0, 74, 53, 0, 15, 27, 255, 255, 240, 0, 74, 54, 0, 15, 28, 255, 255,
|
||||
240, 0, 74, 55, 0, 15, 29, 255, 255, 240, 0, 74, 56, 0, 15, 40, 255,
|
||||
255, 240, 0, 74, 57, 0, 7, 28, 16, 27, 0, 0, 74, 69, 0, 7, 33, 14, 39,
|
||||
0, 16, 74, 77, 0, 7, 46, 14, 60, 0, 16, 74, 79, 0, 7, 1, 6, 0, 0, 32,
|
||||
74, 80, 0, 15, 39, 17, 40, 0, 0, 74, 80, 1, 15, 28, 16, 27, 0, 0, 74,
|
||||
80, 3, 15, 39, 16, 41, 0, 0, 74, 80, 88, 16, 8, 18, 7, 0, 0, 75, 65,
|
||||
0, 22, 17, 25, 16, 0, 0, 75, 67, 0, 22, 46, 25, 54, 0, 0, 75, 68, 0,
|
||||
7, 51, 6, 58, 0, 0, 75, 69, 0, 7, 33, 6, 38, 0, 32, 75, 71, 0, 7, 33,
|
||||
14, 39, 0, 16, 75, 72, 0, 7, 43, 6, 52, 0, 0, 75, 73, 0, 20, 42, 23,
|
||||
46, 0, 16, 75, 75, 0, 22, 8, 25, 7, 0, 0, 75, 77, 0, 7, 33, 14, 39,
|
||||
0, 16, 75, 78, 0, 7, 15, 13, 18, 0, 16, 75, 80, 0, 18, 8, 255, 255,
|
||||
240, 16, 75, 82, 0, 18, 55, 20, 44, 0, 0, 75, 82, 4, 23, 30, 26, 28,
|
||||
0, 16, 75, 87, 0, 7, 8, 6, 7, 0, 32, 75, 87, 1, 7, 5, 6, 4, 0, 32, 75,
|
||||
88, 0, 7, 48, 6, 56, 0, 0, 75, 89, 0, 8, 8, 8, 7, 0, 0, 75, 90, 0, 7,
|
||||
36, 13, 34, 0, 0, 76, 65, 0, 7, 34, 6, 31, 0, 0, 76, 66, 0, 7, 46, 6,
|
||||
59, 0, 32, 76, 67, 0, 7, 15, 13, 18, 0, 16, 76, 73, 0, 7, 33, 6, 43,
|
||||
0, 0, 76, 73, 1, 7, 37, 6, 36, 0, 0, 76, 75, 0, 19, 43, 22, 52, 0, 0,
|
||||
76, 82, 0, 7, 43, 21, 50, 0, 16, 76, 83, 0, 7, 33, 6, 43, 0, 0, 76,
|
||||
84, 0, 7, 33, 6, 43, 0, 32, 76, 84, 1, 7, 37, 6, 36, 0, 32, 76, 85,
|
||||
0, 7, 33, 6, 43, 0, 32, 76, 85, 1, 7, 37, 6, 36, 0, 32, 76, 86, 0, 7,
|
||||
33, 6, 43, 0, 32, 76, 86, 1, 7, 37, 6, 36, 0, 32, 76, 89, 0, 7, 8, 15,
|
||||
255, 192, 16, 77, 65, 0, 7, 12, 21, 12, 0, 32, 77, 65, 1, 7, 5, 21,
|
||||
4, 0, 32, 77, 67, 0, 7, 33, 6, 43, 0, 0, 77, 68, 0, 7, 33, 6, 43, 0,
|
||||
32, 77, 69, 0, 7, 33, 6, 43, 0, 32, 77, 70, 0, 7, 45, 13, 51, 0, 16,
|
||||
77, 71, 0, 7, 33, 14, 39, 0, 48, 77, 72, 0, 18, 8, 255, 255, 240, 16,
|
||||
77, 75, 0, 7, 33, 6, 43, 0, 32, 77, 76, 0, 7, 33, 14, 39, 0, 16, 77,
|
||||
77, 0, 7, 33, 14, 39, 0, 16, 77, 78, 0, 7, 14, 12, 17, 0, 32, 77, 79,
|
||||
0, 7, 50, 6, 59, 0, 0, 77, 80, 0, 6, 15, 5, 18, 0, 16, 77, 81, 0, 7,
|
||||
33, 6, 43, 0, 0, 77, 82, 0, 7, 33, 6, 43, 0, 0, 77, 83, 0, 7, 33, 14,
|
||||
39, 0, 48, 77, 84, 0, 7, 33, 6, 43, 0, 32, 77, 84, 1, 7, 37, 6, 36,
|
||||
0, 32, 77, 85, 0, 7, 33, 6, 43, 0, 32, 77, 86, 0, 7, 10, 6, 10, 0, 32,
|
||||
77, 87, 0, 7, 46, 6, 59, 0, 32, 77, 88, 0, 7, 5, 6, 4, 0, 0, 77, 88,
|
||||
1, 7, 21, 6, 22, 0, 0, 77, 89, 0, 19, 41, 22, 47, 0, 0, 77, 90, 0, 7,
|
||||
16, 13, 14, 0, 16, 78, 65, 0, 7, 16, 13, 14, 0, 16, 78, 67, 0, 7, 33,
|
||||
14, 39, 0, 16, 78, 69, 0, 7, 33, 14, 39, 0, 16, 78, 70, 0, 7, 42, 12,
|
||||
45, 0, 0, 78, 71, 0, 7, 26, 14, 26, 0, 48, 78, 73, 0, 7, 14, 6, 17,
|
||||
0, 32, 78, 76, 0, 7, 33, 6, 43, 0, 32, 78, 76, 1, 7, 37, 6, 36, 0, 32,
|
||||
78, 79, 0, 7, 33, 6, 43, 0, 32, 78, 79, 1, 7, 37, 6, 36, 0, 32, 78,
|
||||
80, 0, 19, 9, 22, 8, 0, 0, 78, 82, 0, 7, 33, 14, 39, 0, 16, 78, 85,
|
||||
0, 7, 14, 255, 255, 240, 16, 78, 90, 0, 7, 43, 6, 52, 0, 32, 79, 77,
|
||||
0, 7, 33, 6, 43, 0, 32, 80, 65, 0, 19, 0, 22, 24, 0, 32, 80, 69, 0,
|
||||
7, 14, 6, 17, 0, 32, 80, 70, 0, 7, 33, 14, 39, 0, 16, 80, 71, 0, 7,
|
||||
2, 6, 0, 0, 0, 80, 72, 0, 7, 43, 6, 52, 0, 32, 80, 75, 0, 7, 50, 12,
|
||||
55, 0, 32, 80, 76, 0, 7, 33, 6, 43, 0, 32, 80, 76, 1, 7, 37, 6, 36,
|
||||
0, 32, 80, 77, 0, 7, 33, 14, 39, 0, 16, 80, 78, 0, 18, 8, 255, 255,
|
||||
240, 16, 80, 82, 0, 0, 14, 0, 17, 0, 0, 80, 83, 0, 18, 8, 255, 255,
|
||||
240, 0, 80, 84, 0, 7, 33, 6, 43, 0, 32, 80, 84, 1, 7, 37, 6, 36, 0,
|
||||
32, 80, 87, 0, 7, 15, 13, 18, 0, 16, 80, 89, 0, 7, 46, 6, 59, 0, 0,
|
||||
80, 89, 1, 7, 43, 6, 52, 0, 0, 81, 49, 0, 2, 8, 2, 7, 0, 0, 81, 50,
|
||||
0, 0, 31, 0, 29, 0, 0, 81, 65, 0, 7, 50, 14, 57, 0, 48, 82, 69, 0, 7,
|
||||
33, 6, 43, 0, 0, 82, 79, 0, 7, 33, 6, 43, 0, 32, 82, 79, 1, 7, 37, 6,
|
||||
36, 0, 32, 82, 83, 0, 7, 33, 6, 43, 0, 32, 82, 85, 0, 7, 8, 255, 255,
|
||||
240, 0, 82, 85, 5, 7, 11, 12, 9, 0, 0, 82, 87, 0, 7, 33, 14, 39, 0,
|
||||
48, 83, 65, 0, 7, 34, 6, 32, 0, 32, 83, 66, 0, 7, 8, 255, 255, 240,
|
||||
16, 83, 67, 0, 7, 45, 13, 51, 0, 16, 83, 68, 0, 7, 8, 14, 255, 192,
|
||||
48, 83, 69, 0, 7, 33, 6, 43, 0, 32, 83, 69, 1, 7, 37, 6, 36, 0, 32,
|
||||
83, 71, 0, 19, 44, 22, 50, 0, 32, 83, 72, 0, 18, 8, 255, 255, 240, 16,
|
||||
83, 73, 0, 7, 33, 6, 43, 0, 32, 83, 73, 1, 7, 37, 6, 36, 0, 32, 83,
|
||||
74, 0, 18, 8, 255, 255, 240, 16, 83, 75, 0, 7, 33, 6, 43, 0, 32, 83,
|
||||
75, 1, 7, 37, 6, 36, 0, 32, 83, 76, 0, 7, 33, 14, 39, 0, 16, 83, 77,
|
||||
0, 7, 33, 14, 39, 0, 16, 83, 78, 0, 7, 33, 6, 43, 0, 32, 83, 79, 0,
|
||||
7, 8, 255, 255, 240, 16, 83, 82, 0, 7, 33, 14, 39, 0, 16, 83, 84, 0,
|
||||
7, 33, 14, 39, 0, 16, 83, 86, 0, 7, 14, 12, 17, 0, 32, 83, 88, 0, 18,
|
||||
8, 255, 255, 240, 16, 83, 89, 0, 18, 8, 255, 255, 240, 16, 83, 90, 0,
|
||||
7, 33, 14, 39, 0, 16, 84, 65, 0, 18, 8, 255, 255, 240, 16, 84, 67, 0,
|
||||
7, 33, 14, 39, 0, 16, 84, 68, 0, 7, 33, 14, 39, 0, 16, 84, 70, 0, 7,
|
||||
33, 14, 39, 0, 16, 84, 71, 0, 7, 33, 14, 39, 0, 16, 84, 72, 0, 7, 43,
|
||||
6, 52, 0, 32, 84, 74, 0, 7, 33, 14, 39, 0, 16, 84, 75, 0, 18, 8, 255,
|
||||
255, 240, 16, 84, 76, 0, 7, 33, 14, 39, 0, 48, 84, 77, 0, 7, 33, 14,
|
||||
39, 0, 16, 84, 78, 0, 7, 5, 6, 4, 0, 32, 84, 79, 0, 7, 8, 255, 255,
|
||||
240, 16, 84, 82, 0, 7, 5, 6, 4, 0, 32, 84, 82, 7, 7, 33, 14, 39, 0,
|
||||
48, 84, 84, 0, 7, 43, 6, 52, 0, 32, 84, 86, 0, 7, 8, 255, 255, 240,
|
||||
16, 84, 87, 0, 0, 52, 0, 64, 0, 0, 84, 87, 2, 0, 53, 0, 62, 0, 0, 84,
|
||||
90, 0, 7, 33, 14, 39, 0, 16, 85, 65, 0, 7, 8, 255, 255, 240, 0, 85,
|
||||
71, 0, 7, 34, 6, 31, 0, 32, 85, 77, 0, 0, 14, 0, 17, 0, 0, 85, 83, 0,
|
||||
5, 32, 4, 30, 0, 0, 85, 83, 25, 12, 8, 10, 7, 0, 0, 85, 83, 26, 4, 8,
|
||||
1, 7, 0, 0, 85, 89, 0, 20, 43, 23, 52, 0, 0, 85, 90, 0, 7, 33, 14, 39,
|
||||
0, 16, 86, 65, 0, 7, 33, 6, 43, 0, 0, 86, 67, 0, 7, 15, 13, 18, 0, 16,
|
||||
86, 69, 0, 7, 41, 6, 47, 0, 0, 86, 71, 0, 7, 33, 6, 43, 0, 0, 86, 73,
|
||||
0, 0, 14, 0, 17, 0, 0, 86, 78, 0, 7, 5, 6, 4, 0, 0, 86, 85, 0, 7, 43,
|
||||
13, 49, 0, 16, 87, 70, 0, 7, 33, 13, 43, 0, 16, 87, 83, 0, 7, 43, 12,
|
||||
49, 0, 16, 88, 48, 0, 3, 20, 0, 21, 0, 0, 88, 49, 0, 7, 41, 6, 47, 0,
|
||||
0, 88, 50, 0, 21, 3, 6, 2, 0, 0, 88, 51, 0, 7, 33, 6, 35, 0, 32, 88,
|
||||
65, 0, 7, 3, 255, 255, 240, 0, 88, 66, 0, 0, 23, 255, 255, 240, 0, 88,
|
||||
82, 0, 1, 54, 3, 63, 0, 0, 88, 83, 0, 13, 4, 11, 1, 0, 32, 88, 84, 0,
|
||||
12, 8, 10, 7, 0, 32, 88, 85, 0, 9, 37, 7, 37, 0, 32, 88, 86, 0, 11,
|
||||
8, 9, 7, 0, 32, 88, 87, 0, 22, 35, 25, 33, 0, 32, 88, 88, 0, 10, 33,
|
||||
255, 255, 240, 32, 88, 89, 0, 7, 33, 6, 43, 0, 32, 88, 90, 0, 14, 8,
|
||||
255, 255, 240, 32, 89, 49, 0, 0, 14, 255, 255, 240, 16, 89, 50, 0, 0,
|
||||
14, 255, 255, 240, 16, 89, 51, 0, 0, 14, 255, 255, 240, 16, 89, 52,
|
||||
0, 0, 14, 255, 255, 240, 16, 89, 53, 0, 0, 14, 255, 255, 240, 16, 89,
|
||||
54, 0, 0, 14, 255, 255, 240, 16, 89, 55, 0, 0, 14, 255, 255, 240, 16,
|
||||
89, 69, 0, 7, 45, 13, 51, 0, 16, 89, 84, 0, 7, 33, 6, 43, 0, 0, 89,
|
||||
89, 0, 18, 8, 255, 255, 240, 0, 90, 49, 0, 18, 8, 255, 255, 240, 16,
|
||||
90, 50, 0, 18, 8, 255, 255, 240, 16, 90, 51, 0, 18, 8, 255, 255, 240,
|
||||
16, 90, 52, 0, 18, 8, 255, 255, 240, 16, 90, 53, 0, 18, 8, 255, 255,
|
||||
240, 16, 90, 54, 0, 18, 8, 255, 255, 240, 16, 90, 55, 0, 18, 8, 255,
|
||||
255, 240, 16, 90, 56, 0, 18, 8, 255, 255, 240, 16, 90, 57, 0, 18, 8,
|
||||
255, 255, 240, 16, 90, 65, 0, 7, 33, 6, 43, 0, 32, 90, 77, 0, 19, 41,
|
||||
22, 47, 0, 0, 90, 87, 0, 7, 33, 14, 39, 0, 48, 10, 2, 255, 3, 17, 19,
|
||||
24, 28, 30, 49, 0, 4, 56, 19, 1, 70, 27, 1, 58, 34, 1, 70, 49, 1, 14,
|
||||
0, 255, 2, 23, 19, 23, 49, 2, 2, 84, 19, 1, 84, 49, 1, 14, 0, 255, 2,
|
||||
23, 19, 23, 49, 0, 2, 66, 19, 1, 66, 49, 1, 23, 1, 1, 4, 23, 19, 17,
|
||||
28, 23, 38, 30, 49, 2, 2, 84, 22, 1, 84, 49, 1, 24, 1, 5, 2, 23, 23,
|
||||
30, 49, 0, 4, 56, 19, 1, 58, 28, 1, 60, 39, 1, 70, 49, 1, 15, 1, 255,
|
||||
1, 23, 20, 2, 1, 84, 20, 1, 15, 1, 255, 1, 23, 20, 2, 1, 84, 20, 1,
|
||||
20, 1, 255, 2, 21, 20, 21, 49, 2, 2, 84, 20, 1, 84, 49, 1, 0, 0, 255,
|
||||
0, 0, 0, 19, 1, 255, 2, 23, 20, 23, 48, 0, 2, 66, 20, 1, 66, 48, 1,
|
||||
20, 1, 255, 2, 23, 20, 20, 49, 0, 2, 66, 20, 1, 64, 49, 1, 20, 1, 255,
|
||||
2, 23, 20, 20, 49, 2, 2, 92, 20, 1, 80, 49, 1, 9, 0, 255, 1, 23, 19,
|
||||
2, 1, 84, 19, 1, 9, 0, 255, 1, 20, 19, 0, 1, 56, 19, 1, 11, 2, 255,
|
||||
3, 17, 19, 24, 30, 30, 49, 0, 5, 56, 19, 1, 70, 27, 1, 58, 34, 1, 68,
|
||||
38, 1, 70, 49, 1, 13, 2, 255, 3, 17, 19, 24, 31, 30, 49, 0, 5, 56, 19,
|
||||
1, 78, 27, 1, 64, 34, 1, 68, 36, 1, 78, 43, 1, 26, 1, 255, 2, 23, 20,
|
||||
30, 40, 2, 2, 84, 23, 1, 112, 49, 1, 14, 2, 255, 2, 17, 19, 30, 49,
|
||||
0, 2, 58, 19, 1, 80, 49, 1, 27, 0, 255, 1, 30, 26, 0, 1, 120, 26, 1,
|
||||
26, 2, 255, 1, 30, 25, 0, 1, 120, 25, 1, 10, 2, 2, 3, 17, 19, 24, 28,
|
||||
30, 49, 0, 4, 56, 19, 1, 70, 27, 1, 58, 34, 1, 70, 49, 1, 10, 2, 255,
|
||||
3, 17, 19, 24, 28, 30, 49, 0, 4, 56, 19, 1, 66, 27, 1, 60, 34, 1, 66,
|
||||
49, 1, 20, 2, 255, 2, 23, 20, 33, 49, 2, 2, 84, 20, 1, 84, 49, 1, 10,
|
||||
2, 1, 3, 17, 19, 24, 28, 30, 49, 0, 4, 56, 19, 1, 70, 27, 1, 58, 34,
|
||||
1, 70, 49, 1, 32, 2, 255, 1, 30, 38, 2, 1, 84, 38, 1, 29, 2, 255, 2,
|
||||
21, 28, 30, 49, 0, 2, 60, 28, 1, 68, 49, 1, 29, 1, 255, 2, 30, 28, 30,
|
||||
49, 2, 2, 112, 28, 1, 112, 49, 1, 5, 2, 0, 2, 23, 18, 23, 19, 2, 2,
|
||||
84, 18, 1, 84, 19, 1, 7, 2, 0, 2, 23, 18, 23, 20, 2, 2, 84, 18, 1, 84,
|
||||
20, 1, 8, 2, 0, 3, 23, 18, 23, 20, 30, 38, 2, 2, 84, 18, 1, 84, 22,
|
||||
1, 6, 1, 255, 4, 14, 18, 14, 19, 20, 29, 20, 48, 0, 4, 48, 18, 1, 48,
|
||||
19, 1, 60, 29, 1, 60, 48, 1, 14, 0, 255, 2, 17, 19, 30, 49, 0, 2, 56,
|
||||
19, 1, 68, 49, 1, 12, 2, 255, 3, 17, 19, 24, 31, 30, 50, 0, 6, 62, 19,
|
||||
1, 90, 27, 1, 80, 35, 1, 90, 41, 1, 86, 45, 1, 118, 50, 1, 22, 1, 255,
|
||||
2, 23, 20, 30, 38, 2, 1, 84, 22, 1, 25, 1, 255, 1, 23, 24, 2, 1, 84,
|
||||
24, 1, 14, 0, 6, 2, 17, 19, 20, 49, 0, 2, 56, 19, 1, 60, 49, 1, 18,
|
||||
1, 255, 2, 20, 20, 20, 44, 2, 2, 72, 20, 1, 72, 44, 1, 22, 1, 255, 2,
|
||||
23, 20, 30, 38, 2, 1, 84, 22, 1, 22, 2, 255, 1, 20, 22, 0, 2, 62, 20,
|
||||
1, 66, 38, 1, 16, 2, 255, 2, 20, 20, 28, 38, 2, 2, 84, 20, 1, 112, 38,
|
||||
1, 4, 0, 255, 1, 23, 18, 2, 1, 84, 18, 1, 20, 1, 255, 2, 23, 20, 30,
|
||||
49, 2, 2, 84, 20, 1, 84, 49, 1, 21, 1, 255, 3, 23, 20, 30, 37, 30, 46,
|
||||
2, 2, 84, 21, 1, 84, 46, 1, 26, 1, 255, 3, 23, 20, 24, 39, 30, 49, 2,
|
||||
1, 84, 25, 1, 26, 1, 255, 3, 23, 20, 24, 39, 30, 49, 2, 1, 84, 25, 1,
|
||||
17, 1, 255, 2, 23, 20, 30, 40, 2, 2, 84, 20, 1, 112, 40, 1, 34, 0, 255,
|
||||
1, 27, 49, 2, 1, 84, 49, 1, 34, 0, 255, 1, 30, 49, 0, 1, 78, 49, 1,
|
||||
14, 0, 255, 2, 27, 19, 27, 49, 2, 2, 84, 19, 1, 84, 49, 1, 34, 0, 255,
|
||||
1, 27, 49, 2, 1, 84, 49, 1, 34, 0, 255, 1, 20, 49, 2, 1, 76, 49, 1,
|
||||
33, 0, 255, 1, 20, 48, 2, 1, 76, 48, 1, 31, 2, 255, 2, 17, 33, 30, 49,
|
||||
0, 2, 68, 33, 1, 68, 49, 1, 30, 2, 255, 3, 17, 33, 24, 38, 30, 49, 0,
|
||||
3, 56, 33, 1, 68, 38, 1, 68, 49, 1, 28, 2, 255, 3, 17, 28, 24, 38, 30,
|
||||
49, 0, 3, 56, 28, 1, 58, 38, 1, 62, 49, 1, 33, 0, 255, 1, 27, 48, 2,
|
||||
1, 84, 48, 1, 0, 0, 3, 0, 0, 0, 120, 11, 0, 0, 16, 4, 5, 6, 7, 8, 9,
|
||||
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1, 18, 1, 255, 1, 52, 1, 14,
|
||||
1, 15, 3, 28, 39, 49, 2, 19, 49, 166, 169, 0, 0
|
||||
};
|
||||
const resource_hnd_t wifi_firmware_clm_blob =
|
||||
{ RESOURCE_IN_MEMORY, 7222, {.mem = { (const char *)wifi_firmware_clm_blob_image_data }}};
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) 2019, Cypress Semiconductor Corporation, All Rights Reserved
|
||||
* SPDX-License-Identifier: LicenseRef-PBL
|
||||
*
|
||||
* This file and the related binary are licensed under the
|
||||
* Permissive Binary License, Version 1.0 (the "License");
|
||||
* you may not use these files except in compliance with the License.
|
||||
*
|
||||
* You may obtain a copy of the License here:
|
||||
* LICENSE-permissive-binary-license-1.0.txt and at
|
||||
* https://www.mbed.com/licenses/PBL-1.0
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* Automatically generated file - this comment ensures resources.h file creation */
|
||||
/* Auto-generated header file. Do not edit */
|
||||
#ifndef INCLUDED_RESOURCES_H_
|
||||
#define INCLUDED_RESOURCES_H_
|
||||
#include "wiced_resource.h"
|
||||
|
||||
extern const resource_hnd_t wifi_firmware_image;
|
||||
extern const resource_hnd_t wifi_firmware_clm_blob;
|
||||
extern const unsigned char wifi_firmware_image_data[416801];
|
||||
extern const unsigned char wifi_firmware_clm_blob_image_data[7222];
|
||||
|
||||
#endif /* ifndef INCLUDED_RESOURCES_H_ */
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
* Copyright (c) 2019, Cypress Semiconductor Corporation, All Rights Reserved
|
||||
* SPDX-License-Identifier: LicenseRef-PBL
|
||||
*
|
||||
* This file and the related binary are licensed under the
|
||||
* Permissive Binary License, Version 1.0 (the "License");
|
||||
* you may not use these files except in compliance with the License.
|
||||
*
|
||||
* You may obtain a copy of the License here:
|
||||
* LICENSE-permissive-binary-license-1.0.txt and at
|
||||
* https://www.mbed.com/licenses/PBL-1.0
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* NVRAM variables taken from BCM943438WLPTH nvram file (2.4 GHz, 20 MHz BW mode)
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_NVRAM_IMAGE_H_
|
||||
#define INCLUDED_NVRAM_IMAGE_H_
|
||||
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include "generated_mac_address.txt"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Character array of NVRAM image
|
||||
*/
|
||||
|
||||
static const char wifi_nvram_image[] =
|
||||
// # The following parameter values are just placeholders, need to be updated.
|
||||
"manfid=0x2d0" "\x00"
|
||||
"prodid=0x0726" "\x00"
|
||||
"vendid=0x14e4" "\x00"
|
||||
"devid=0x43e2" "\x00"
|
||||
"boardtype=0x0726" "\x00"
|
||||
"boardrev=0x1101" "\x00"
|
||||
"boardnum=22" "\x00"
|
||||
"xtalfreq=37400" "\x00"
|
||||
"sromrev=11" "\x00"
|
||||
"boardflags=0x00404201" "\x00"
|
||||
"boardflags3=0x08000000" "\x00"
|
||||
NVRAM_GENERATED_MAC_ADDRESS "\x00"
|
||||
"nocrc=1" "\x00"
|
||||
"ag0=255" "\x00"
|
||||
"aa2g=1" "\x00"
|
||||
"ccode=ALL"
|
||||
"\x00"
|
||||
//#Antenna diversity
|
||||
"swdiv_en=1" "\x00"
|
||||
"swdiv_gpio=1" "\x00"
|
||||
"swdiv_gpio_1=2" "\x00"
|
||||
|
||||
"pa0itssit=0x20" "\x00"
|
||||
"extpagain2g=0" "\x00"
|
||||
//#PA parameters for 2.4GHz, measured at CHIP OUTPUT
|
||||
"pa2ga0=-168,6905,-799" "\x00"
|
||||
"AvVmid_c0=0x0,0xc8" "\x00"
|
||||
"cckpwroffset0=5" "\x00"
|
||||
//# PPR params
|
||||
"maxp2ga0=84" "\x00"
|
||||
"txpwrbckof=6" "\x00"
|
||||
"cckbw202gpo=0" "\x00"
|
||||
"legofdmbw202gpo=0x66111111" "\x00"
|
||||
"mcsbw202gpo=0x77711111" "\x00"
|
||||
"propbw202gpo=0xdd" "\x00"
|
||||
//# OFDM IIR :
|
||||
"ofdmdigfilttype=18" "\x00"
|
||||
"ofdmdigfilttypebe=18" "\x00"
|
||||
//# PAPD mode:
|
||||
"papdmode=1" "\x00"
|
||||
"papdvalidtest=1" "\x00"
|
||||
"pacalidx2g=32" "\x00"
|
||||
"papdepsoffset=-36" "\x00"
|
||||
"papdendidx=61" "\x00"
|
||||
//# LTECX flags
|
||||
// "ltecxmux=1" "\x00"
|
||||
//"ltecxpadnum=0x02030401" "\x00"
|
||||
// "ltecxfnsel=0x3003" "\x00"
|
||||
// "ltecxgcigpio=0x3012" "\x00"
|
||||
//#il0macaddr=00:90:4c:c5:12:38
|
||||
"wl0id=0x431b" "\x00"
|
||||
"deadman_to=0xffffffff" "\x00"
|
||||
//# muxenab: 0x1 for UART enable, 0x2 for GPIOs, 0x8 for JTAG, 0x10 for HW OOB
|
||||
"muxenab=0x11" "\x00"
|
||||
//# CLDO PWM voltage settings - 0x4 - 1.1 volt
|
||||
//#cldo_pwm=0x4 "\x00"
|
||||
//#VCO freq 326.4MHz
|
||||
"spurconfig=0x3" "\x00"
|
||||
"\x00\x00";
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#else /* ifndef INCLUDED_NVRAM_IMAGE_H_ */
|
||||
|
||||
#error Wi-Fi NVRAM image included twice
|
||||
|
||||
#endif /* ifndef INCLUDED_NVRAM_IMAGE_H_ */
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
* Copyright (c) 2019, Cypress Semiconductor Corporation, All Rights Reserved
|
||||
* SPDX-License-Identifier: LicenseRef-PBL
|
||||
*
|
||||
* This file and the related binary are licensed under the
|
||||
* Permissive Binary License, Version 1.0 (the "License");
|
||||
* you may not use these files except in compliance with the License.
|
||||
*
|
||||
* You may obtain a copy of the License here:
|
||||
* LICENSE-permissive-binary-license-1.0.txt and at
|
||||
* https://www.mbed.com/licenses/PBL-1.0
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* NVRAM variables taken from BCM943438WLPTH nvram file (2.4 GHz, 20 MHz BW mode)
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_NVRAM_IMAGE_H_
|
||||
#define INCLUDED_NVRAM_IMAGE_H_
|
||||
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include "generated_mac_address.txt"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Character array of NVRAM image
|
||||
*/
|
||||
|
||||
static const char wifi_nvram_image[] =
|
||||
// # The following parameter values are just placeholders, need to be updated.
|
||||
"manfid=0x2d0" "\x00"
|
||||
"prodid=0x0726" "\x00"
|
||||
"vendid=0x14e4" "\x00"
|
||||
"devid=0x43e2" "\x00"
|
||||
"boardtype=0x0726" "\x00"
|
||||
"boardrev=0x1101" "\x00"
|
||||
"boardnum=22" "\x00"
|
||||
"xtalfreq=37400" "\x00"
|
||||
"sromrev=11" "\x00"
|
||||
"boardflags=0x00404201" "\x00"
|
||||
"boardflags3=0x08000000" "\x00"
|
||||
NVRAM_GENERATED_MAC_ADDRESS "\x00"
|
||||
"nocrc=1" "\x00"
|
||||
"ag0=255" "\x00"
|
||||
"aa2g=1" "\x00"
|
||||
"ccode=ALL"
|
||||
"\x00"
|
||||
//#Antenna diversity
|
||||
"swdiv_en=1" "\x00"
|
||||
"swdiv_gpio=1" "\x00"
|
||||
"swdiv_gpio_1=2" "\x00"
|
||||
|
||||
"pa0itssit=0x20" "\x00"
|
||||
"extpagain2g=0" "\x00"
|
||||
//#PA parameters for 2.4GHz, measured at CHIP OUTPUT
|
||||
"pa2ga0=-168,6905,-799" "\x00"
|
||||
"AvVmid_c0=0x0,0xc8" "\x00"
|
||||
"cckpwroffset0=5" "\x00"
|
||||
//# PPR params
|
||||
"maxp2ga0=84" "\x00"
|
||||
"txpwrbckof=6" "\x00"
|
||||
"cckbw202gpo=0" "\x00"
|
||||
"legofdmbw202gpo=0x66111111" "\x00"
|
||||
"mcsbw202gpo=0x77711111" "\x00"
|
||||
"propbw202gpo=0xdd" "\x00"
|
||||
//# OFDM IIR :
|
||||
"ofdmdigfilttype=18" "\x00"
|
||||
"ofdmdigfilttypebe=18" "\x00"
|
||||
//# PAPD mode:
|
||||
"papdmode=1" "\x00"
|
||||
"papdvalidtest=1" "\x00"
|
||||
"pacalidx2g=32" "\x00"
|
||||
"papdepsoffset=-36" "\x00"
|
||||
"papdendidx=61" "\x00"
|
||||
//# LTECX flags
|
||||
// "ltecxmux=1" "\x00"
|
||||
//"ltecxpadnum=0x02030401" "\x00"
|
||||
// "ltecxfnsel=0x3003" "\x00"
|
||||
// "ltecxgcigpio=0x3012" "\x00"
|
||||
//#il0macaddr=00:90:4c:c5:12:38
|
||||
"wl0id=0x431b" "\x00"
|
||||
"deadman_to=0xffffffff" "\x00"
|
||||
//# muxenab: 0x1 for UART enable, 0x2 for GPIOs, 0x8 for JTAG, 0x10 for HW OOB
|
||||
"muxenab=0x11" "\x00"
|
||||
//# CLDO PWM voltage settings - 0x4 - 1.1 volt
|
||||
//#cldo_pwm=0x4 "\x00"
|
||||
//#VCO freq 326.4MHz
|
||||
"spurconfig=0x3" "\x00"
|
||||
"\x00\x00";
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#else /* ifndef INCLUDED_NVRAM_IMAGE_H_ */
|
||||
|
||||
#error Wi-Fi NVRAM image included twice
|
||||
|
||||
#endif /* ifndef INCLUDED_NVRAM_IMAGE_H_ */
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
* Copyright (c) 2019, Cypress Semiconductor Corporation, All Rights Reserved
|
||||
* SPDX-License-Identifier: LicenseRef-PBL
|
||||
*
|
||||
* This file and the related binary are licensed under the
|
||||
* Permissive Binary License, Version 1.0 (the "License");
|
||||
* you may not use these files except in compliance with the License.
|
||||
*
|
||||
* You may obtain a copy of the License here:
|
||||
* LICENSE-permissive-binary-license-1.0.txt and at
|
||||
* https://www.mbed.com/licenses/PBL-1.0
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* NVRAM variables taken from BCM943438WLPTH nvram file (2.4 GHz, 20 MHz BW mode)
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_NVRAM_IMAGE_H_
|
||||
#define INCLUDED_NVRAM_IMAGE_H_
|
||||
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include "generated_mac_address.txt"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Character array of NVRAM image
|
||||
*/
|
||||
|
||||
static const char wifi_nvram_image[] =
|
||||
// # The following parameter values are just placeholders, need to be updated.
|
||||
"manfid=0x2d0" "\x00"
|
||||
"prodid=0x0726" "\x00"
|
||||
"vendid=0x14e4" "\x00"
|
||||
"devid=0x43e2" "\x00"
|
||||
"boardtype=0x0726" "\x00"
|
||||
"boardrev=0x1101" "\x00"
|
||||
"boardnum=22" "\x00"
|
||||
"xtalfreq=37400" "\x00"
|
||||
"sromrev=11" "\x00"
|
||||
"boardflags=0x00404201" "\x00"
|
||||
"boardflags3=0x08000000" "\x00"
|
||||
NVRAM_GENERATED_MAC_ADDRESS "\x00"
|
||||
"nocrc=1" "\x00"
|
||||
"ag0=255" "\x00"
|
||||
"aa2g=1" "\x00"
|
||||
"ccode=ALL"
|
||||
"\x00"
|
||||
//#Antenna diversity
|
||||
"swdiv_en=1" "\x00"
|
||||
"swdiv_gpio=1" "\x00"
|
||||
"swdiv_gpio_1=2" "\x00"
|
||||
|
||||
"pa0itssit=0x20" "\x00"
|
||||
"extpagain2g=0" "\x00"
|
||||
//#PA parameters for 2.4GHz, measured at CHIP OUTPUT
|
||||
"pa2ga0=-168,6905,-799" "\x00"
|
||||
"AvVmid_c0=0x0,0xc8" "\x00"
|
||||
"cckpwroffset0=5" "\x00"
|
||||
//# PPR params
|
||||
"maxp2ga0=84" "\x00"
|
||||
"txpwrbckof=6" "\x00"
|
||||
"cckbw202gpo=0" "\x00"
|
||||
"legofdmbw202gpo=0x66111111" "\x00"
|
||||
"mcsbw202gpo=0x77711111" "\x00"
|
||||
"propbw202gpo=0xdd" "\x00"
|
||||
//# OFDM IIR :
|
||||
"ofdmdigfilttype=18" "\x00"
|
||||
"ofdmdigfilttypebe=18" "\x00"
|
||||
//# PAPD mode:
|
||||
"papdmode=1" "\x00"
|
||||
"papdvalidtest=1" "\x00"
|
||||
"pacalidx2g=32" "\x00"
|
||||
"papdepsoffset=-36" "\x00"
|
||||
"papdendidx=61" "\x00"
|
||||
//# LTECX flags
|
||||
// "ltecxmux=1" "\x00"
|
||||
//"ltecxpadnum=0x02030401" "\x00"
|
||||
// "ltecxfnsel=0x3003" "\x00"
|
||||
// "ltecxgcigpio=0x3012" "\x00"
|
||||
//#il0macaddr=00:90:4c:c5:12:38
|
||||
"wl0id=0x431b" "\x00"
|
||||
"deadman_to=0xffffffff" "\x00"
|
||||
//# muxenab: 0x1 for UART enable, 0x2 for GPIOs, 0x8 for JTAG, 0x10 for HW OOB
|
||||
"muxenab=0x11" "\x00"
|
||||
//# CLDO PWM voltage settings - 0x4 - 1.1 volt
|
||||
//#cldo_pwm=0x4 "\x00"
|
||||
//#VCO freq 326.4MHz
|
||||
"spurconfig=0x3" "\x00"
|
||||
"\x00\x00";
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#else /* ifndef INCLUDED_NVRAM_IMAGE_H_ */
|
||||
|
||||
#error Wi-Fi NVRAM image included twice
|
||||
|
||||
#endif /* ifndef INCLUDED_NVRAM_IMAGE_H_ */
|
||||
|
|
@ -0,0 +1,176 @@
|
|||
/*
|
||||
* Copyright (c) 2019, Cypress Semiconductor Corporation, All Rights Reserved
|
||||
* SPDX-License-Identifier: LicenseRef-PBL
|
||||
*
|
||||
* This file and the related binary are licensed under the
|
||||
* Permissive Binary License, Version 1.0 (the "License");
|
||||
* you may not use these files except in compliance with the License.
|
||||
*
|
||||
* You may obtain a copy of the License here:
|
||||
* LICENSE-permissive-binary-license-1.0.txt and at
|
||||
* https://www.mbed.com/licenses/PBL-1.0
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_NVRAM_IMAGE_H_
|
||||
#define INCLUDED_NVRAM_IMAGE_H_
|
||||
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include "generated_mac_address.txt"
|
||||
|
||||
/*
|
||||
* CYW43012 Rev C0 WLCSP Murata module EVB
|
||||
* Rev History
|
||||
* 1. 6/22/2017 copied from bcm bcm943012mdcspad.txt
|
||||
* 2. 6/22/2017 updated boardtype, boardrev, macadd
|
||||
* 3. 7/10/2017 udpated swctrlmap*
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Character array of NVRAM image generated from
|
||||
* cyw943012csp_ty1LV.TXT
|
||||
*/
|
||||
static const char wifi_nvram_image[] =
|
||||
"NVRAMRev=$Rev: 351687 $" "\x00"
|
||||
"sromrev=11" "\x00"
|
||||
"cckdigfilttype=4" "\x00"
|
||||
"cckpwroffset0=3" "\x00"
|
||||
"bphyscale=0x20" "\x00"
|
||||
"boardflags3=0x40000100" "\x00"
|
||||
"vendid=0x14e4" "\x00"
|
||||
"devid=0xA804" "\x00"
|
||||
"manfid=0x2d0" "\x00"
|
||||
"prodid=0x052e" "\x00"
|
||||
"#macaddr=00:90:4c:2a:80:00" "\x00"
|
||||
"macaddr=00:90:4c:2a:9${maclo12}" "\x00"
|
||||
"#macaddr=00:90:4c:2a:80:80" "\x00"
|
||||
"mac_clkgating=1" "\x00"
|
||||
"nocrc=1" "\x00"
|
||||
"boardtype=0x0842" "\x00"
|
||||
"boardrev=0x1100" "\x00"
|
||||
"xtalfreq=37400" "\x00"
|
||||
"boardflags2=0xc0000000" "\x00"
|
||||
"boardflags=0x00000000" "\x00"
|
||||
"etmode=0x11" "\x00"
|
||||
"extpagain2g=2" "\x00"
|
||||
"extpagain5g=2" "\x00"
|
||||
"ccode=0" "\x00"
|
||||
"regrev=0" "\x00"
|
||||
"antswitch = 0" "\x00"
|
||||
"rxgains2gelnagaina0=0" "\x00"
|
||||
"rxgains2gtrisoa0=15" "\x00"
|
||||
"rxgains2gtrelnabypa0=0" "\x00"
|
||||
"rxgains5gelnagaina0=0" "\x00"
|
||||
"rxgains5gtrisoa0=9" "\x00"
|
||||
"rxgains5gtrelnabypa0=0" "\x00"
|
||||
"pdgain5g=0" "\x00"
|
||||
"pdgain2g=0" "\x00"
|
||||
"tworangetssi2g=0" "\x00"
|
||||
"tworangetssi5g=0" "\x00"
|
||||
"rxchain=1" "\x00"
|
||||
"txchain=1" "\x00"
|
||||
"aa2g=1" "\x00"
|
||||
"aa5g=1" "\x00"
|
||||
"tssipos5g=0" "\x00"
|
||||
"tssipos2g=0" "\x00"
|
||||
"femctrl=17" "\x00"
|
||||
"subband5gver=4" "\x00"
|
||||
"pa2ga0=-108,5627,-638" "\x00"
|
||||
"# pa5ga0=-23,5933,-815,-29,5959,-814,-60,6093,-813,-50,6414,-836" "\x00"
|
||||
"pa5ga0=-41,6533,-726,-29,6654,-746,9,6914,-772,12,7008,-806" "\x00"
|
||||
"pdoffset40ma0=0" "\x00"
|
||||
"pdoffset80ma0=0" "\x00"
|
||||
"lowpowerrange2g=0" "\x00"
|
||||
"lowpowerrange5g=0" "\x00"
|
||||
"ed_thresh2g=-63" "\x00"
|
||||
"ed_thresh5g=-63" "\x00"
|
||||
"swctrlmap_2g=0x10101010,0x20202020,0x10101010,0x414040,0x3ff" "\x00"
|
||||
"swctrlmapext_2g=0x00000100,0x01000100,0x01000100,0x010000,0x301" "\x00"
|
||||
"swctrlmap_5g=0x80808080,0x00000000,0x80808080,0x404040,0x3ff" "\x00"
|
||||
"swctrlmapext_5g=0x01000100,0x01000100,0x00000000,0x000100,0x303" "\x00"
|
||||
"ulpnap=0" "\x00"
|
||||
"ulpadc=1" "\x00"
|
||||
"ssagc_en=0" "\x00"
|
||||
"ds1_nap=0" "\x00"
|
||||
"spurcan_ch_list_MHz=2422,2427,2432,2437,2462,2467,2472" "\x00"
|
||||
"spurcan_sp_freq_KHz=9000,4000,-1000,-6000,6400,1400,-3600" "\x00"
|
||||
"spurcan_NumSpur=7" "\x00"
|
||||
"epacal2g=0" "\x00"
|
||||
"epacal5g=0" "\x00"
|
||||
"papdcck=0" "\x00"
|
||||
"epacal2g_mask=0x3fff" "\x00"
|
||||
"maxp2ga0=82" "\x00"
|
||||
"ofdmlrbw202gpo=0x0077" "\x00"
|
||||
"dot11agofdmhrbw202gpo=0x8888" "\x00"
|
||||
"mcsbw202gpo=0x99999999" "\x00"
|
||||
"#mcsbw402gpo=0x99555533" "\x00"
|
||||
"maxp5ga0=82,82,82,82" "\x00"
|
||||
"mcsbw205glpo=0x99999999" "\x00"
|
||||
"mcsbw205gmpo=0x99999999" "\x00"
|
||||
"mcsbw205ghpo=0x99999999" "\x00"
|
||||
"femctrlwar=0" "\x00"
|
||||
"use5gpllfor2g=1" "\x00"
|
||||
"pt5db_gaintbl=0" "\x00"
|
||||
|
||||
"txwbpapden=1" "\x00"
|
||||
"wb_rxattn=0x0303" "\x00"
|
||||
"wb_txattn=0x0203" "\x00"
|
||||
"wb_papdcalidx=0x0808" "\x00"
|
||||
"wb_papdcalidx_5g=0x00101010" "\x00"
|
||||
"wb_eps_offset=0x01ba01a8" "\x00"
|
||||
"wb_eps_offset_5g=0x01ba01bc" "\x00"
|
||||
"wb_bbmult=0x2040" "\x00"
|
||||
"wb_bbmult_5g=0x00303030" "\x00"
|
||||
"wb_calref_db=0x1c2e" "\x00"
|
||||
"wb_tia_gain_mode=0x0606" "\x00"
|
||||
"wb_txbuf_offset=0x1e1e" "\x00"
|
||||
"wb_frac_del=0x6991" "\x00"
|
||||
"wb_g_frac_bits=0xab" "\x00"
|
||||
|
||||
|
||||
"nb_rxattn=0x0404" "\x00"
|
||||
"nb_txattn=0x0404" "\x00"
|
||||
"nb_papdcalidx=0x1414" "\x00"
|
||||
"nb_eps_offset=0x01d701d7" "\x00"
|
||||
"nb_bbmult=0x5A5A" "\x00"
|
||||
"nb_tia_gain_mode=0x0000" "\x00"
|
||||
"# AvVmid_c0=6,100,3,141,3,141,3,141,3,141" "\x00"
|
||||
"AvVmid_c0=6,100,7,70,7,70,7,70,7,70" "\x00"
|
||||
|
||||
"tssisleep_en=0x5" "\x00"
|
||||
"lpflags=0x28" "\x00"
|
||||
"lpo_select=4" "\x00"
|
||||
|
||||
"paprrmcsgamma2g=450,500,550,600,675,950,950,950,950,950,950,950" "\x00"
|
||||
"paprrmcsgamma5g20=450,500,550,600,800,950,1100,1100,1100,1100,1100,1100" "\x00"
|
||||
"#paprdis=1" "\x00"
|
||||
|
||||
"#SW-Diversity Related parameters" "\x00"
|
||||
"swdiv_en=1 #To enable SW-DIV feature" "\x00"
|
||||
"swdiv_gpio=0" "\x00"
|
||||
"swdiv_swctrl_en=2" "\x00"
|
||||
"swdiv_swctrl_ant0=0" "\x00"
|
||||
"swdiv_swctrl_ant1=1" "\x00"
|
||||
"swdiv_antmap2g_main=1" "\x00"
|
||||
"swdiv_antmap5g_main=1" "\x00"
|
||||
|
||||
"swdiv_snrlim=10000 #Only enable sw_div if the snr on present antenna is less than 10000/8=1250"
|
||||
"swdiv_thresh=3000 #No.of rxpkts threshold" "\x00"
|
||||
"swdiv_snrthresh=24 #Difference between antenna's snr is greater than 24/8=3dB, then shift the antennas"
|
||||
"\x00\x00";
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C" */
|
||||
#endif
|
||||
|
||||
#else /* ifndef INCLUDED_NVRAM_IMAGE_H_ */
|
||||
#error Wi-Fi NVRAM image included twice
|
||||
#endif /* ifndef INCLUDED_NVRAM_IMAGE_H_ */
|
||||
|
|
@ -0,0 +1,300 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* Defines WHD resource functions for BCM943340WCD1 platform
|
||||
*/
|
||||
#include "resources.h"
|
||||
#include "wifi_nvram_image.h"
|
||||
#include "whd_resource_api.h"
|
||||
#include "whd_debug.h"
|
||||
#include "whd.h"
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
#define BLOCK_BUFFER_SIZE (1024)
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
|
||||
#if defined(WHD_DYNAMIC_NVRAM)
|
||||
#define NVRAM_SIZE dynamic_nvram_size
|
||||
#define NVRAM_IMAGE_VARIABLE dynamic_nvram_image
|
||||
#else
|
||||
#define NVRAM_SIZE sizeof(wifi_nvram_image)
|
||||
#define NVRAM_IMAGE_VARIABLE wifi_nvram_image
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Enumerations
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Type Definitions
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Structures
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Static Function Declarations
|
||||
******************************************************/
|
||||
uint32_t host_platform_resource_size(whd_driver_t whd_drv, whd_resource_type_t resource, uint32_t *size_out);
|
||||
uint32_t host_get_resource_block(whd_driver_t whd_drv, whd_resource_type_t type, const uint8_t **data,
|
||||
uint32_t *size_out);
|
||||
uint32_t host_get_resource_no_of_blocks(whd_driver_t whd_drv, whd_resource_type_t type, uint32_t *block_count);
|
||||
uint32_t host_get_resource_block_size(whd_driver_t whd_drv, whd_resource_type_t type, uint32_t *size_out);
|
||||
resource_result_t resource_read(const resource_hnd_t *resource, uint32_t offset, uint32_t maxsize, uint32_t *size,
|
||||
void *buffer);
|
||||
|
||||
/******************************************************
|
||||
* Variable Definitions
|
||||
******************************************************/
|
||||
|
||||
extern const resource_hnd_t wifi_firmware_image;
|
||||
extern const resource_hnd_t wifi_firmware_clm_blob;
|
||||
unsigned char r_buffer[BLOCK_BUFFER_SIZE];
|
||||
|
||||
#if defined(WHD_DYNAMIC_NVRAM)
|
||||
uint32_t dynamic_nvram_size = sizeof(wifi_nvram_image);
|
||||
void *dynamic_nvram_image = &wifi_nvram_image;
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Function Definitions
|
||||
******************************************************/
|
||||
|
||||
resource_result_t resource_read(const resource_hnd_t *resource, uint32_t offset, uint32_t maxsize, uint32_t *size,
|
||||
void *buffer)
|
||||
{
|
||||
if (offset > resource->size)
|
||||
{
|
||||
return RESOURCE_OFFSET_TOO_BIG;
|
||||
}
|
||||
|
||||
*size = MIN(maxsize, resource->size - offset);
|
||||
|
||||
if (resource->location == RESOURCE_IN_MEMORY)
|
||||
{
|
||||
memcpy(buffer, &resource->val.mem.data[offset], *size);
|
||||
}
|
||||
#ifdef USES_RESOURCES_IN_EXTERNAL_STORAGE
|
||||
else if (resource->location == RESOURCE_IN_EXTERNAL_STORAGE)
|
||||
{
|
||||
return platform_read_external_resource(resource, offset, maxsize, size, buffer);
|
||||
}
|
||||
#endif
|
||||
#ifdef USES_RESOURCE_GENERIC_FILESYSTEM
|
||||
else
|
||||
{
|
||||
wiced_file_t file_handle;
|
||||
uint64_t size64;
|
||||
uint64_t maxsize64 = maxsize;
|
||||
if (WICED_SUCCESS !=
|
||||
wiced_filesystem_file_open (&resource_fs_handle, &file_handle, resource->val.fs.filename,
|
||||
WICED_FILESYSTEM_OPEN_FOR_READ) )
|
||||
{
|
||||
return RESOURCE_FILE_OPEN_FAIL;
|
||||
}
|
||||
if (WICED_SUCCESS != wiced_filesystem_file_seek (&file_handle, (offset + resource->val.fs.offset), SEEK_SET) )
|
||||
{
|
||||
return RESOURCE_FILE_SEEK_FAIL;
|
||||
}
|
||||
if (WICED_SUCCESS != wiced_filesystem_file_read (&file_handle, buffer, maxsize64, &size64) )
|
||||
{
|
||||
wiced_filesystem_file_close (&file_handle);
|
||||
return RESOURCE_FILE_READ_FAIL;
|
||||
}
|
||||
*size = (uint32_t)size64;
|
||||
wiced_filesystem_file_close (&file_handle);
|
||||
}
|
||||
#else
|
||||
#ifdef USES_RESOURCE_FILESYSTEM
|
||||
else
|
||||
{
|
||||
wicedfs_file_t file_hnd;
|
||||
|
||||
if (0 != wicedfs_fopen(&resource_fs_handle, &file_hnd, resource->val.fs.filename) )
|
||||
{
|
||||
return RESOURCE_FILE_OPEN_FAIL;
|
||||
}
|
||||
|
||||
if (0 != wicedfs_fseek(&file_hnd, (long)(offset + resource->val.fs.offset), SEEK_SET) )
|
||||
{
|
||||
wicedfs_fclose(&file_hnd);
|
||||
return RESOURCE_FILE_SEEK_FAIL;
|
||||
}
|
||||
|
||||
if (*size != wicedfs_fread(buffer, 1, *size, &file_hnd) )
|
||||
{
|
||||
wicedfs_fclose(&file_hnd);
|
||||
return RESOURCE_FILE_READ_FAIL;
|
||||
}
|
||||
|
||||
wicedfs_fclose(&file_hnd);
|
||||
}
|
||||
#endif /* ifdef USES_RESOURCE_FILESYSTEM */
|
||||
#endif /* USES_RESOURCE_GENERIC_FILESYSTEM */
|
||||
return RESOURCE_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t host_platform_resource_size(whd_driver_t whd_drv, whd_resource_type_t resource, uint32_t *size_out)
|
||||
{
|
||||
if (resource == WHD_RESOURCE_WLAN_FIRMWARE)
|
||||
{
|
||||
#ifdef NO_WIFI_FIRMWARE
|
||||
whd_assert("Request firmware in a no wifi firmware application", 0 == 1);
|
||||
*size_out = 0;
|
||||
#else
|
||||
#ifdef WIFI_FIRMWARE_IN_MULTI_APP
|
||||
wiced_app_t wifi_app;
|
||||
|
||||
*size_out = 0;
|
||||
if (wiced_waf_app_open(DCT_WIFI_FIRMWARE_INDEX, &wifi_app) != WICED_SUCCESS)
|
||||
{
|
||||
return ( whd_result_t )RESOURCE_UNSUPPORTED;
|
||||
}
|
||||
wiced_waf_app_get_size(&wifi_app, size_out);
|
||||
#else
|
||||
*size_out = (uint32_t)resource_get_size(&wifi_firmware_image);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
}
|
||||
else if (resource == WHD_RESOURCE_WLAN_NVRAM)
|
||||
{
|
||||
*size_out = NVRAM_SIZE;
|
||||
}
|
||||
else
|
||||
{
|
||||
*size_out = (uint32_t)resource_get_size(&wifi_firmware_clm_blob);
|
||||
}
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t host_get_resource_block(whd_driver_t whd_drv, whd_resource_type_t type, const uint8_t **data,
|
||||
uint32_t *size_out)
|
||||
{
|
||||
uint32_t resource_size;
|
||||
uint32_t block_size;
|
||||
uint32_t block_count;
|
||||
static uint32_t transfer_progress;
|
||||
static uint32_t i;
|
||||
uint32_t result;
|
||||
|
||||
host_platform_resource_size(whd_drv, type, &resource_size);
|
||||
host_get_resource_block_size(whd_drv, type, &block_size);
|
||||
host_get_resource_no_of_blocks(whd_drv, type, &block_count);
|
||||
memset(r_buffer, 0, block_size);
|
||||
if (i < block_count)
|
||||
{
|
||||
transfer_progress = i * block_size;
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
i = 0;
|
||||
transfer_progress = i * block_size;
|
||||
i++;
|
||||
}
|
||||
|
||||
if (type == WHD_RESOURCE_WLAN_FIRMWARE)
|
||||
{
|
||||
result = resource_read( (const resource_hnd_t *)&wifi_firmware_image, transfer_progress, block_size, size_out,
|
||||
r_buffer );
|
||||
if (result != WHD_SUCCESS)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
*data = (uint8_t *)&r_buffer;
|
||||
/*
|
||||
* In case of local buffer read use the following code
|
||||
*
|
||||
* *size_out = MIN(BLOCK_BUFFER_SIZE, resource_size - transfer_progress);
|
||||
* *data = (uint8_t *)wifi_firmware_image_data;
|
||||
*
|
||||
* For sending the entire buffer in single block set size out as following
|
||||
* *size_out = (uint32_t)resource_get_size(&wifi_firmware_image);
|
||||
*/
|
||||
}
|
||||
else if (type == WHD_RESOURCE_WLAN_NVRAM)
|
||||
{
|
||||
*size_out = NVRAM_SIZE;
|
||||
*data = (uint8_t *)NVRAM_IMAGE_VARIABLE;
|
||||
i = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = resource_read( (const resource_hnd_t *)&wifi_firmware_clm_blob, transfer_progress, block_size,
|
||||
size_out,
|
||||
r_buffer );
|
||||
if (result != WHD_SUCCESS)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
*data = (uint8_t *)&r_buffer;
|
||||
/*
|
||||
* In case of local buffer read use the following code
|
||||
*
|
||||
* *size_out = MIN(BLOCK_BUFFER_SIZE, resource_size - transfer_progress);
|
||||
* *data = (uint8_t *)wifi_firmware_clm_blob_image_data;
|
||||
*
|
||||
* For sending the entire buffer in single block set size out as following
|
||||
* *size_out = sizeof(wifi_firmware_clm_blob_image_data);
|
||||
*/
|
||||
|
||||
}
|
||||
transfer_progress = 0;
|
||||
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t host_get_resource_block_size(whd_driver_t whd_drv, whd_resource_type_t type, uint32_t *size_out)
|
||||
{
|
||||
*size_out = BLOCK_BUFFER_SIZE;
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t host_get_resource_no_of_blocks(whd_driver_t whd_drv, whd_resource_type_t type, uint32_t *block_count)
|
||||
{
|
||||
if (type == WHD_RESOURCE_WLAN_NVRAM)
|
||||
*block_count = 1;
|
||||
else
|
||||
{
|
||||
uint32_t resource_size;
|
||||
uint32_t block_size;
|
||||
|
||||
host_platform_resource_size(whd_drv, type, &resource_size);
|
||||
host_get_resource_block_size(whd_drv, type, &block_size);
|
||||
*block_count = resource_size / block_size;
|
||||
if (resource_size % block_size)
|
||||
*block_count += 1;
|
||||
}
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
whd_resource_source_t resource_ops =
|
||||
{
|
||||
.whd_resource_size = host_platform_resource_size,
|
||||
.whd_get_resource_block_size = host_get_resource_block_size,
|
||||
.whd_get_resource_no_of_blocks = host_get_resource_no_of_blocks,
|
||||
.whd_get_resource_block = host_get_resource_block
|
||||
};
|
||||
|
|
@ -0,0 +1,209 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* WICED Resource API's
|
||||
* The Resource Management functions reads resource from a resource location
|
||||
* and returns the number of bytes from an offset in an caller filled buffer.
|
||||
*
|
||||
* Functions to get the resource size and resource data
|
||||
*
|
||||
* The Resource could be one of the three locations
|
||||
*
|
||||
* - Wiced Filesystem (File System)
|
||||
* - Internal Memory (Embedded Flash memory)
|
||||
* - External Storage ( External Flash connected via SPI interface)
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_RESOURCE_H_
|
||||
#define INCLUDED_RESOURCE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
#ifndef MIN
|
||||
#define MIN(x, y) ( (x) < (y) ? (x) : (y) )
|
||||
#endif /* ifndef MIN */
|
||||
|
||||
/* Suppress unused parameter warning */
|
||||
#ifndef UNUSED_PARAMETER
|
||||
#define UNUSED_PARAMETER(x) ( (void)(x) )
|
||||
#endif
|
||||
|
||||
#ifndef RESULT_ENUM
|
||||
#define RESULT_ENUM(prefix, name, value) prefix ## name = (value)
|
||||
#endif /* ifndef RESULT_ENUM */
|
||||
|
||||
|
||||
/* These Enum result values are for Resource errors
|
||||
* Values: 4000 - 4999
|
||||
*/
|
||||
#define RESOURCE_RESULT_LIST(prefix) \
|
||||
RESULT_ENUM(prefix, SUCCESS, 0), /**< Success */ \
|
||||
RESULT_ENUM(prefix, UNSUPPORTED, 7), /**< Unsupported function */ \
|
||||
RESULT_ENUM(prefix, OFFSET_TOO_BIG, 4001), /**< Offset past end of resource */ \
|
||||
RESULT_ENUM(prefix, FILE_OPEN_FAIL, 4002), /**< Failed to open resource file */ \
|
||||
RESULT_ENUM(prefix, FILE_SEEK_FAIL, 4003), /**< Failed to seek to requested offset in resource file */ \
|
||||
RESULT_ENUM(prefix, FILE_READ_FAIL, 4004), /**< Failed to read resource file */
|
||||
|
||||
#define resource_get_size(resource) ( (resource)->size )
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
|
||||
#define RESOURCE_ENUM_OFFSET (1300)
|
||||
|
||||
/******************************************************
|
||||
* Enumerations
|
||||
******************************************************/
|
||||
|
||||
/**
|
||||
* Result type for WICED Resource function
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
RESOURCE_RESULT_LIST(RESOURCE_)
|
||||
} resource_result_t;
|
||||
|
||||
/******************************************************
|
||||
* Type Definitions
|
||||
******************************************************/
|
||||
|
||||
typedef const void *resource_data_t;
|
||||
typedef unsigned long resource_size_t;
|
||||
|
||||
/******************************************************
|
||||
* Structures
|
||||
******************************************************/
|
||||
|
||||
/**
|
||||
* Memory handle
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
const char *data; /**< resource data */
|
||||
} memory_resource_handle_t;
|
||||
|
||||
/**
|
||||
* Filesystem handle
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
unsigned long offset; /**< Offset to the start of the resource */
|
||||
const char *filename; /**< name of the resource */
|
||||
} filesystem_resource_handle_t;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RESOURCE_IN_MEMORY, /**< resource location in memory */
|
||||
RESOURCE_IN_FILESYSTEM, /**< resource location in filesystem */
|
||||
RESOURCE_IN_EXTERNAL_STORAGE /**< resource location in external storage */
|
||||
} resource_location_t;
|
||||
|
||||
/**
|
||||
* Resource handle structure
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
resource_location_t location; /**< resource location */
|
||||
unsigned long size; /**< resource size */
|
||||
union
|
||||
{
|
||||
filesystem_resource_handle_t fs; /** < filesystem resource handle */
|
||||
memory_resource_handle_t mem; /** < memory resource handle */
|
||||
void *external_storage_context; /** < external storage context */
|
||||
} val;
|
||||
} resource_hnd_t;
|
||||
|
||||
/******************************************************
|
||||
* Global Variables
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Function Declarations
|
||||
******************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/** @addtogroup resourceapi Wiced Resource Management API's
|
||||
* @ingroup framework
|
||||
*
|
||||
* WCIED Resource Management API's has functions to get the
|
||||
* resource size and reads resource data from a resource
|
||||
* location and returns the number of bytes in an caller
|
||||
* filled buffer
|
||||
*
|
||||
* The Resource could be one of the three locations
|
||||
*
|
||||
* - Wiced Filesystem ( File System)
|
||||
* - Internal Memory (Embedded Flash memory)
|
||||
* - External Storage ( External Flash connected via SPI interface )
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Read resource using the handle specified
|
||||
*
|
||||
* @param[in] resource : handle of the resource to read
|
||||
* @param[in] offset : offset from the beginning of the resource block
|
||||
* @param[in] maxsize : size of the buffer
|
||||
* @param[out] size : size of the data successfully read
|
||||
* @param[in] buffer : pointer to a buffer to contain the read data
|
||||
*
|
||||
* @return @ref resource_result_t
|
||||
*/
|
||||
extern resource_result_t resource_read(const resource_hnd_t *resource, uint32_t offset, uint32_t maxsize,
|
||||
uint32_t *size, void *buffer);
|
||||
|
||||
/** Retrieve a read only resource buffer using the handle specified
|
||||
*
|
||||
* @param[in] resource : handle of the resource to read
|
||||
* @param[in] offset : offset from the beginning of the resource block
|
||||
* @param[in] maxsize : size of the buffer
|
||||
* @param[out] size : size of the data successfully read
|
||||
* @param[out] buffer : pointer to a buffer pointer to point to the resource data
|
||||
*
|
||||
* @return @ref resource_result_t
|
||||
*/
|
||||
extern resource_result_t resource_get_readonly_buffer(const resource_hnd_t *resource, uint32_t offset, uint32_t maxsize,
|
||||
uint32_t *size_out, const void **buffer);
|
||||
|
||||
/** Free a read only resource buffer using the handle specified
|
||||
*
|
||||
* @param[in] resource : handle of the resource to read
|
||||
* @param[in] buffer : pointer to a buffer set using resource_get_readonly_buffer
|
||||
*
|
||||
* @return @ref resource_result_t
|
||||
*/
|
||||
extern resource_result_t resource_free_readonly_buffer(const resource_hnd_t *handle, const void *buffer);
|
||||
/* @} */
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* ifndef INCLUDED_RESOURCE_H_ */
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
*
|
||||
*/
|
||||
|
||||
#include "whd_bus.h"
|
||||
#include "whd_int.h"
|
||||
|
||||
whd_result_t whd_bus_init(whd_driver_t whd_driver)
|
||||
{
|
||||
return whd_driver->bus_if->whd_bus_init_fptr(whd_driver);
|
||||
}
|
||||
|
||||
whd_result_t whd_bus_deinit(whd_driver_t whd_driver)
|
||||
{
|
||||
return whd_driver->bus_if->whd_bus_deinit_fptr(whd_driver);
|
||||
}
|
||||
|
||||
whd_bool_t whd_bus_wake_interrupt_present(whd_driver_t whd_driver)
|
||||
{
|
||||
return whd_driver->bus_if->whd_bus_wake_interrupt_present_fptr(whd_driver);
|
||||
}
|
||||
|
||||
whd_result_t whd_bus_send_buffer(whd_driver_t whd_driver, whd_buffer_t buffer)
|
||||
{
|
||||
return whd_driver->bus_if->whd_bus_send_buffer_fptr(whd_driver, buffer);
|
||||
}
|
||||
|
||||
uint32_t whd_bus_packet_available_to_read(whd_driver_t whd_driver)
|
||||
{
|
||||
return whd_driver->bus_if->whd_bus_packet_available_to_read_fptr(whd_driver);
|
||||
}
|
||||
|
||||
whd_result_t whd_bus_read_frame(whd_driver_t whd_driver, whd_buffer_t *buffer)
|
||||
{
|
||||
return whd_driver->bus_if->whd_bus_read_frame_fptr(whd_driver, buffer);
|
||||
}
|
||||
|
||||
whd_result_t whd_bus_write_backplane_value(whd_driver_t whd_driver, uint32_t address, uint8_t register_length,
|
||||
uint32_t value)
|
||||
{
|
||||
return whd_driver->bus_if->whd_bus_write_backplane_value_fptr(whd_driver, address, register_length, value);
|
||||
}
|
||||
|
||||
whd_result_t whd_bus_read_backplane_value(whd_driver_t whd_driver, uint32_t address, uint8_t register_length,
|
||||
uint8_t *value)
|
||||
{
|
||||
return whd_driver->bus_if->whd_bus_read_backplane_value_fptr(whd_driver, address, register_length, value);
|
||||
}
|
||||
|
||||
whd_result_t whd_bus_read_register_value(whd_driver_t whd_driver, whd_bus_function_t function, uint32_t address,
|
||||
uint8_t value_length, uint8_t *value)
|
||||
{
|
||||
return whd_driver->bus_if->whd_bus_read_register_value_fptr(whd_driver, function, address, value_length, value);
|
||||
}
|
||||
|
||||
whd_result_t whd_bus_write_register_value(whd_driver_t whd_driver, whd_bus_function_t function, uint32_t address,
|
||||
uint8_t value_length, uint32_t value)
|
||||
{
|
||||
return whd_driver->bus_if->whd_bus_write_register_value_fptr(whd_driver, function, address, value_length, value);
|
||||
}
|
||||
|
||||
whd_result_t whd_bus_transfer_bytes(whd_driver_t whd_driver, whd_bus_transfer_direction_t direction,
|
||||
whd_bus_function_t function, uint32_t address, uint16_t size,
|
||||
whd_transfer_bytes_packet_t *data)
|
||||
{
|
||||
return whd_driver->bus_if->whd_bus_transfer_bytes_fptr(whd_driver, direction, function, address, size, data);
|
||||
}
|
||||
|
||||
whd_result_t whd_bus_poke_wlan(whd_driver_t whd_driver)
|
||||
{
|
||||
return whd_driver->bus_if->whd_bus_poke_wlan_fptr(whd_driver);
|
||||
}
|
||||
|
||||
whd_result_t whd_bus_wakeup(whd_driver_t whd_driver)
|
||||
{
|
||||
return whd_driver->bus_if->whd_bus_wakeup_fptr(whd_driver);
|
||||
}
|
||||
|
||||
whd_result_t whd_bus_sleep(whd_driver_t whd_driver)
|
||||
{
|
||||
return whd_driver->bus_if->whd_bus_sleep_fptr(whd_driver);
|
||||
}
|
||||
|
||||
whd_result_t whd_bus_wait_for_wlan_event(whd_driver_t whd_driver, cy_semaphore_t *transceive_semaphore)
|
||||
{
|
||||
return whd_driver->bus_if->whd_bus_wait_for_wlan_event_fptr(whd_driver, transceive_semaphore);
|
||||
}
|
||||
|
||||
whd_bool_t whd_bus_use_status_report_scheme(whd_driver_t whd_driver)
|
||||
{
|
||||
return whd_driver->bus_if->whd_bus_use_status_report_scheme_fptr(whd_driver);
|
||||
}
|
||||
|
||||
uint8_t whd_bus_backplane_read_padd_size(whd_driver_t whd_driver)
|
||||
{
|
||||
return whd_driver->bus_if->whd_bus_backplane_read_padd_size_fptr(whd_driver);
|
||||
}
|
||||
|
||||
uint32_t whd_bus_get_max_transfer_size(whd_driver_t whd_driver)
|
||||
{
|
||||
return whd_driver->bus_if->whd_bus_get_max_transfer_size_fptr(whd_driver);
|
||||
}
|
||||
|
||||
void whd_bus_init_stats(whd_driver_t whd_driver)
|
||||
{
|
||||
whd_driver->bus_if->whd_bus_init_stats_fptr(whd_driver);
|
||||
}
|
||||
|
||||
whd_result_t whd_bus_print_stats(whd_driver_t whd_driver, whd_bool_t reset_after_print)
|
||||
{
|
||||
return whd_driver->bus_if->whd_bus_print_stats_fptr(whd_driver, reset_after_print);
|
||||
}
|
||||
|
||||
whd_result_t whd_bus_reinit_stats(whd_driver_t whd_driver, whd_bool_t wake_from_firmware)
|
||||
{
|
||||
return whd_driver->bus_if->whd_bus_reinit_stats_fptr(whd_driver, wake_from_firmware);
|
||||
}
|
||||
|
||||
whd_result_t whd_bus_irq_register(whd_driver_t whd_driver)
|
||||
{
|
||||
return whd_driver->bus_if->whd_bus_irq_register_fptr(whd_driver);
|
||||
}
|
||||
|
||||
whd_result_t whd_bus_irq_enable(whd_driver_t whd_driver, whd_bool_t enable)
|
||||
{
|
||||
return whd_driver->bus_if->whd_bus_irq_enable_fptr(whd_driver, enable);
|
||||
}
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
*
|
||||
*/
|
||||
|
||||
#include "whd_bus_protocol_interface.h"
|
||||
|
||||
#ifndef INCLUDED_WHD_BUS_H_
|
||||
#define INCLUDED_WHD_BUS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
typedef struct whd_bus_if *whd_bus_if_t;
|
||||
|
||||
typedef whd_result_t (*whd_bus_transfer_t)(whd_bus_if_t *bus_if, whd_bus_transfer_direction_t dir,
|
||||
uint8_t *data, uint16_t data_size, void *arg1, void *arg2, void *arg3,
|
||||
void *arg4);
|
||||
#endif
|
||||
|
||||
typedef whd_result_t (*whd_bus_init_t)(whd_driver_t whd_driver);
|
||||
typedef whd_result_t (*whd_bus_deinit_t)(whd_driver_t whd_driver);
|
||||
|
||||
typedef whd_result_t (*whd_bus_ack_interrupt_t)(whd_driver_t whd_driver, uint32_t intstatus);
|
||||
typedef whd_bool_t (*whd_bus_wake_interrupt_present_t)(whd_driver_t whd_driver);
|
||||
typedef uint32_t (*whd_bus_packet_available_to_read_t)(whd_driver_t whd_driver);
|
||||
typedef whd_result_t (*whd_bus_read_frame_t)(whd_driver_t whd_driver, whd_buffer_t *buffer);
|
||||
|
||||
typedef whd_result_t (*whd_bus_write_backplane_value_t)(whd_driver_t whd_driver, uint32_t address,
|
||||
uint8_t register_length, uint32_t value);
|
||||
typedef whd_result_t (*whd_bus_read_backplane_value_t)(whd_driver_t whd_driver, uint32_t address,
|
||||
uint8_t register_length, uint8_t *value);
|
||||
|
||||
typedef whd_result_t (*whd_bus_write_register_value_t)(whd_driver_t whd_driver, whd_bus_function_t function,
|
||||
uint32_t address, uint8_t value_length, uint32_t value);
|
||||
typedef whd_result_t (*whd_bus_read_register_value_t)(whd_driver_t whd_driver, whd_bus_function_t function,
|
||||
uint32_t address, uint8_t value_length, uint8_t *value);
|
||||
|
||||
typedef whd_result_t (*whd_bus_transfer_bytes_t)(whd_driver_t whd_driver, whd_bus_transfer_direction_t direction,
|
||||
whd_bus_function_t function, uint32_t address, uint16_t size,
|
||||
whd_transfer_bytes_packet_t *data);
|
||||
|
||||
typedef whd_result_t (*whd_bus_poke_wlan_t)(whd_driver_t whd_driver);
|
||||
|
||||
typedef whd_result_t (*whd_bus_wakeup_t)(whd_driver_t whd_driver);
|
||||
typedef whd_result_t (*whd_bus_sleep_t)(whd_driver_t whd_driver);
|
||||
typedef uint8_t (*whd_bus_backplane_read_padd_size_t)(whd_driver_t whd_driver);
|
||||
typedef whd_result_t (*whd_bus_send_buffer_t)(whd_driver_t whd_driver, whd_buffer_t buffer);
|
||||
typedef whd_result_t (*whd_bus_wait_for_wlan_event_t)(whd_driver_t whd_driver,
|
||||
cy_semaphore_t *transceive_semaphore);
|
||||
typedef whd_bool_t (*whd_bus_use_status_report_scheme_t)(whd_driver_t whd_driver);
|
||||
typedef uint32_t (*whd_bus_get_max_transfer_size_t)(whd_driver_t whd_driver);
|
||||
|
||||
typedef void (*whd_bus_init_stats_t)(whd_driver_t whd_driver);
|
||||
typedef whd_result_t (*whd_bus_print_stats_t)(whd_driver_t whd_driver, whd_bool_t reset_after_print);
|
||||
typedef whd_result_t (*whd_bus_reinit_stats_t)(whd_driver_t whd_driver, whd_bool_t wake_from_firmware);
|
||||
typedef whd_result_t (*whd_bus_irq_register_t)(whd_driver_t whd_driver);
|
||||
typedef whd_result_t (*whd_bus_irq_enable_t)(whd_driver_t whd_driver, whd_bool_t enable);
|
||||
|
||||
typedef struct whd_bus_info
|
||||
{
|
||||
whd_bus_init_t whd_bus_init_fptr;
|
||||
whd_bus_deinit_t whd_bus_deinit_fptr;
|
||||
|
||||
whd_bus_ack_interrupt_t whd_bus_ack_interrupt_fptr;
|
||||
whd_bus_send_buffer_t whd_bus_send_buffer_fptr;
|
||||
|
||||
whd_bus_wake_interrupt_present_t whd_bus_wake_interrupt_present_fptr;
|
||||
whd_bus_packet_available_to_read_t whd_bus_packet_available_to_read_fptr;
|
||||
whd_bus_read_frame_t whd_bus_read_frame_fptr;
|
||||
|
||||
whd_bus_write_backplane_value_t whd_bus_write_backplane_value_fptr;
|
||||
whd_bus_read_backplane_value_t whd_bus_read_backplane_value_fptr;
|
||||
|
||||
whd_bus_write_register_value_t whd_bus_write_register_value_fptr;
|
||||
whd_bus_read_register_value_t whd_bus_read_register_value_fptr;
|
||||
|
||||
whd_bus_transfer_bytes_t whd_bus_transfer_bytes_fptr;
|
||||
|
||||
whd_bus_poke_wlan_t whd_bus_poke_wlan_fptr;
|
||||
|
||||
whd_bus_wakeup_t whd_bus_wakeup_fptr;
|
||||
whd_bus_sleep_t whd_bus_sleep_fptr;
|
||||
|
||||
whd_bus_backplane_read_padd_size_t whd_bus_backplane_read_padd_size_fptr;
|
||||
|
||||
whd_bus_wait_for_wlan_event_t whd_bus_wait_for_wlan_event_fptr;
|
||||
whd_bus_use_status_report_scheme_t whd_bus_use_status_report_scheme_fptr;
|
||||
|
||||
whd_bus_get_max_transfer_size_t whd_bus_get_max_transfer_size_fptr;
|
||||
|
||||
whd_bus_init_stats_t whd_bus_init_stats_fptr;
|
||||
whd_bus_print_stats_t whd_bus_print_stats_fptr;
|
||||
whd_bus_reinit_stats_t whd_bus_reinit_stats_fptr;
|
||||
whd_bus_irq_register_t whd_bus_irq_register_fptr;
|
||||
whd_bus_irq_enable_t whd_bus_irq_enable_fptr;
|
||||
} whd_bus_info_t;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
#endif /* ifndef INCLUDED_WHD_BUS_H_ */
|
||||
|
|
@ -0,0 +1,588 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
*
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include "cyabs_rtos.h"
|
||||
|
||||
#include "whd_bus_common.h"
|
||||
#include "whd_chip_reg.h"
|
||||
#include "whd_sdio.h"
|
||||
#include "whd_chip_constants.h"
|
||||
#include "whd_int.h"
|
||||
#include "whd_chip.h"
|
||||
#include "whd_bus_protocol_interface.h"
|
||||
#include "whd_debug.h"
|
||||
#include "whd_buffer_api.h"
|
||||
#include "whd_resource_if.h"
|
||||
#include "whd_resource_api.h"
|
||||
#include "whd_types_int.h"
|
||||
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
#define WHD_SAVE_INTERRUPTS(flags) do { UNUSED_PARAMETER(flags); } while (0);
|
||||
#define WHD_RESTORE_INTERRUPTS(flags) do { } while (0);
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
#define INDIRECT_BUFFER_SIZE (1024)
|
||||
#define WHD_BUS_ROUND_UP_ALIGNMENT (64)
|
||||
#define WHD_BUS_MAX_TRANSFER_SIZE (WHD_BUS_MAX_BACKPLANE_TRANSFER_SIZE)
|
||||
|
||||
#define WHD_BUS_WLAN_ALLOW_SLEEP_INVALID_MS ( (uint32_t)-1 )
|
||||
|
||||
/******************************************************
|
||||
* Structures
|
||||
******************************************************/
|
||||
|
||||
struct whd_bus_common_info
|
||||
{
|
||||
whd_bool_t bus_is_up;
|
||||
|
||||
whd_time_t delayed_bus_release_deadline;
|
||||
whd_bool_t delayed_bus_release_scheduled;
|
||||
uint32_t delayed_bus_release_timeout_ms;
|
||||
volatile uint32_t delayed_bus_release_timeout_ms_request;
|
||||
|
||||
uint32_t backplane_window_current_base_address;
|
||||
whd_bool_t bus_flow_control;
|
||||
volatile whd_bool_t resource_download_abort;
|
||||
|
||||
};
|
||||
|
||||
/******************************************************
|
||||
* Variables
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Function declarations
|
||||
******************************************************/
|
||||
static whd_result_t whd_bus_common_download_resource(whd_driver_t whd_driver, whd_resource_type_t resource,
|
||||
whd_bool_t direct_resource, uint32_t address);
|
||||
|
||||
/******************************************************
|
||||
* Function definitions
|
||||
******************************************************/
|
||||
|
||||
whd_bool_t whd_bus_is_up(whd_driver_t whd_driver)
|
||||
{
|
||||
return whd_driver->bus_common_info->bus_is_up;
|
||||
}
|
||||
|
||||
void whd_bus_set_state(whd_driver_t whd_driver, whd_bool_t state)
|
||||
{
|
||||
whd_driver->bus_common_info->bus_is_up = state;
|
||||
}
|
||||
|
||||
whd_result_t whd_bus_set_flow_control(whd_driver_t whd_driver, uint8_t value)
|
||||
{
|
||||
if (value != 0)
|
||||
{
|
||||
whd_driver->bus_common_info->bus_flow_control = WHD_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
whd_driver->bus_common_info->bus_flow_control = WHD_FALSE;
|
||||
}
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
whd_bool_t whd_bus_is_flow_controlled(whd_driver_t whd_driver)
|
||||
{
|
||||
return whd_driver->bus_common_info->bus_flow_control;
|
||||
}
|
||||
|
||||
static whd_result_t whd_bus_common_download_resource(whd_driver_t whd_driver, whd_resource_type_t resource,
|
||||
whd_bool_t direct_resource, uint32_t address)
|
||||
{
|
||||
uint32_t transfer_progress;
|
||||
whd_buffer_t buffer;
|
||||
uint32_t block_size;
|
||||
whd_result_t result = WHD_SUCCESS;
|
||||
uint8_t *image;
|
||||
uint32_t image_size;
|
||||
uint8_t *packet;
|
||||
uint16_t transfer_size = 0;
|
||||
uint32_t segment_size;
|
||||
uint32_t blocks_count = 0;
|
||||
uint32_t i, j, num_buff;
|
||||
uint32_t size_out;
|
||||
uint32_t reset_instr = 0;
|
||||
|
||||
result = whd_resource_size(whd_driver, resource, &image_size);
|
||||
|
||||
if (result != WHD_SUCCESS)
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Fatal error: download_resource doesn't exist, %s failed at line %d \n", __func__,
|
||||
__LINE__) );
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (image_size <= 0)
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Fatal error: download_resource cannot load with invalid size, %s failed at line %d \n",
|
||||
__func__, __LINE__) );
|
||||
result = WHD_BADARG;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* Transfer firmware image into the RAM */
|
||||
result = whd_get_resource_block_size(whd_driver, resource, &block_size);
|
||||
if (result != WHD_SUCCESS)
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Fatal error: download_resource block size not know, %s failed at line %d \n", __func__,
|
||||
__LINE__) );
|
||||
goto exit;
|
||||
}
|
||||
|
||||
result = whd_get_resource_no_of_blocks(whd_driver, resource, &blocks_count);
|
||||
if (result != WHD_SUCCESS)
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Fatal error: download_resource blocks count not known, %s failed at line %d \n", __func__,
|
||||
__LINE__) );
|
||||
goto exit;
|
||||
}
|
||||
|
||||
result = whd_host_buffer_get(whd_driver, &buffer, WHD_NETWORK_TX,
|
||||
(uint16_t)(BLOCK_SIZE + sizeof(whd_buffer_header_t) ), WHD_FALSE);
|
||||
if (result != WHD_SUCCESS)
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("%s:%d whd_host_buffer_get() failed\n", __func__, __LINE__) );
|
||||
goto exit;
|
||||
}
|
||||
|
||||
transfer_progress = 0;
|
||||
for (i = 0; i < blocks_count; i++)
|
||||
{
|
||||
/*
|
||||
* In case of direct read the no of blocks is one and we would be getting a pointer pointing to entire resource
|
||||
* In case of indirect read the no of blocks is the size of the resource/ size of blocks,
|
||||
* get resource block would return pointer to the block
|
||||
*/
|
||||
CHECK_RETURN(whd_get_resource_block(whd_driver, resource, (const uint8_t **)&image, &size_out) );
|
||||
/* Need to find the min size last block will be less that block_size */
|
||||
transfer_size = MIN_OF(BLOCK_SIZE, size_out);
|
||||
num_buff = (size_out + transfer_size - 1) / transfer_size;
|
||||
|
||||
if (blocks_count != 1)
|
||||
transfer_progress = 0;
|
||||
for (j = 0; j < num_buff; j++)
|
||||
{
|
||||
transfer_size = (uint16_t)MIN_OF(BLOCK_SIZE, image_size - transfer_progress);
|
||||
packet = (uint8_t *)whd_buffer_get_current_piece_data_pointer(whd_driver, buffer);
|
||||
memcpy(packet + sizeof(whd_buffer_header_t), &image[transfer_progress], transfer_size);
|
||||
|
||||
/* Round up the size of the chunk */
|
||||
transfer_size = (uint16_t)ROUND_UP(transfer_size, WHD_BUS_ROUND_UP_ALIGNMENT);
|
||||
segment_size = transfer_size;
|
||||
transfer_size = (uint16_t)MIN_OF(whd_bus_get_max_transfer_size(whd_driver), transfer_size);
|
||||
|
||||
if (address != 0)
|
||||
{
|
||||
if ( (resource == WHD_RESOURCE_WLAN_FIRMWARE) && (reset_instr == 0) )
|
||||
{
|
||||
/* Copy the starting address of the firmware into a global variable */
|
||||
reset_instr = *( (uint32_t *)(packet + sizeof(whd_buffer_header_t) ) );
|
||||
}
|
||||
}
|
||||
for (; segment_size != 0;
|
||||
segment_size -= transfer_size, packet += transfer_size)
|
||||
{
|
||||
if (whd_driver->bus_common_info->resource_download_abort == WHD_TRUE)
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Download_resource is aborted; terminating after %" PRIu32 " iterations\n",
|
||||
transfer_progress) );
|
||||
CHECK_RETURN(whd_buffer_release(whd_driver, buffer, WHD_NETWORK_TX) );
|
||||
result = WHD_UNFINISHED;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
result = whd_bus_set_backplane_window(whd_driver, address);
|
||||
if (result != WHD_SUCCESS)
|
||||
{
|
||||
CHECK_RETURN(whd_buffer_release(whd_driver, buffer, WHD_NETWORK_TX) );
|
||||
goto exit;
|
||||
}
|
||||
result = whd_bus_transfer_bytes(whd_driver, BUS_WRITE, BACKPLANE_FUNCTION,
|
||||
(address & BACKPLANE_ADDRESS_MASK), transfer_size,
|
||||
(whd_transfer_bytes_packet_t *)(packet +
|
||||
sizeof(whd_buffer_queue_ptr_t) ) );
|
||||
if (result != WHD_SUCCESS)
|
||||
{
|
||||
CHECK_RETURN(whd_buffer_release(whd_driver, buffer, WHD_NETWORK_TX) );
|
||||
goto exit;
|
||||
}
|
||||
|
||||
address += transfer_size;
|
||||
transfer_progress = transfer_progress + transfer_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
CHECK_RETURN(whd_buffer_release(whd_driver, buffer, WHD_NETWORK_TX) );
|
||||
/* Below part of the code is applicable to arm_CR4 type chips only
|
||||
* The CR4 chips by default firmware is not loaded at 0. So we need
|
||||
* load the first 32 bytes with the offset of the firmware load address
|
||||
* which is been copied before during the firmware download
|
||||
*/
|
||||
if ( (address != 0) && (reset_instr != 0) )
|
||||
{
|
||||
/* write address 0 with reset instruction */
|
||||
result = whd_bus_write_backplane_value(whd_driver, 0, sizeof(reset_instr), reset_instr);
|
||||
|
||||
if (result == WHD_SUCCESS)
|
||||
{
|
||||
uint32_t tmp;
|
||||
|
||||
/* verify reset instruction value */
|
||||
result = whd_bus_read_backplane_value(whd_driver, 0, sizeof(tmp), (uint8_t *)&tmp);
|
||||
|
||||
if ( (result == WHD_SUCCESS) && (tmp != reset_instr) )
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("%s: Failed to write 0x%08" PRIx32 " to addr 0\n", __FUNCTION__, reset_instr) );
|
||||
WPRINT_WHD_ERROR( ("%s: contents of addr 0 is 0x%08" PRIx32 "\n", __FUNCTION__, tmp) );
|
||||
return WHD_WLAN_SDIO_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
exit: return result;
|
||||
}
|
||||
|
||||
void whd_bus_common_info_init(whd_driver_t whd_driver)
|
||||
{
|
||||
struct whd_bus_common_info *bus_common = (struct whd_bus_common_info *)malloc(sizeof(struct whd_bus_common_info) );
|
||||
|
||||
if (bus_common != NULL)
|
||||
{
|
||||
whd_driver->bus_common_info = bus_common;
|
||||
|
||||
bus_common->delayed_bus_release_deadline = 0;
|
||||
bus_common->delayed_bus_release_scheduled = WHD_FALSE;
|
||||
bus_common->delayed_bus_release_timeout_ms = PLATFORM_WLAN_ALLOW_BUS_TO_SLEEP_DELAY_MS;
|
||||
bus_common->delayed_bus_release_timeout_ms_request = WHD_BUS_WLAN_ALLOW_SLEEP_INVALID_MS;
|
||||
bus_common->backplane_window_current_base_address = 0;
|
||||
|
||||
bus_common->bus_is_up = WHD_FALSE;
|
||||
bus_common->bus_flow_control = WHD_FALSE;
|
||||
|
||||
bus_common->resource_download_abort = WHD_FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Memory allocation failed for whd_bus_common_info in %s\n", __FUNCTION__) );
|
||||
}
|
||||
}
|
||||
|
||||
void whd_delayed_bus_release_schedule_update(whd_driver_t whd_driver, whd_bool_t is_scheduled)
|
||||
{
|
||||
whd_driver->bus_common_info->delayed_bus_release_scheduled = is_scheduled;
|
||||
whd_driver->bus_common_info->delayed_bus_release_deadline = 0;
|
||||
}
|
||||
|
||||
uint32_t whd_bus_handle_delayed_release(whd_driver_t whd_driver)
|
||||
{
|
||||
uint32_t time_until_release = 0;
|
||||
uint32_t current_time = 0;
|
||||
struct whd_bus_common_info *bus_common = whd_driver->bus_common_info;
|
||||
|
||||
if (bus_common->delayed_bus_release_timeout_ms_request != WHD_BUS_WLAN_ALLOW_SLEEP_INVALID_MS)
|
||||
{
|
||||
whd_bool_t schedule =
|
||||
( (bus_common->delayed_bus_release_scheduled != 0) ||
|
||||
(bus_common->delayed_bus_release_deadline != 0) ) ? WHD_TRUE : WHD_FALSE;
|
||||
uint32_t flags;
|
||||
|
||||
WHD_SAVE_INTERRUPTS(flags);
|
||||
bus_common->delayed_bus_release_timeout_ms = bus_common->delayed_bus_release_timeout_ms_request;
|
||||
bus_common->delayed_bus_release_timeout_ms_request = WHD_BUS_WLAN_ALLOW_SLEEP_INVALID_MS;
|
||||
WHD_RESTORE_INTERRUPTS(flags);
|
||||
|
||||
DELAYED_BUS_RELEASE_SCHEDULE(whd_driver, schedule);
|
||||
}
|
||||
|
||||
if (bus_common->delayed_bus_release_scheduled == WHD_TRUE)
|
||||
{
|
||||
bus_common->delayed_bus_release_scheduled = WHD_FALSE;
|
||||
|
||||
if (bus_common->delayed_bus_release_timeout_ms != 0)
|
||||
{
|
||||
cy_rtos_get_time(¤t_time);
|
||||
bus_common->delayed_bus_release_deadline = current_time +
|
||||
bus_common->delayed_bus_release_timeout_ms;
|
||||
time_until_release = bus_common->delayed_bus_release_timeout_ms;
|
||||
}
|
||||
}
|
||||
else if (bus_common->delayed_bus_release_deadline != 0)
|
||||
{
|
||||
whd_time_t now;
|
||||
|
||||
cy_rtos_get_time(&now);
|
||||
|
||||
if (bus_common->delayed_bus_release_deadline - now <= bus_common->delayed_bus_release_timeout_ms)
|
||||
{
|
||||
time_until_release = bus_common->delayed_bus_release_deadline - now;
|
||||
}
|
||||
|
||||
if (time_until_release == 0)
|
||||
{
|
||||
bus_common->delayed_bus_release_deadline = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (time_until_release != 0)
|
||||
{
|
||||
if (whd_bus_is_up(whd_driver) == WHD_FALSE)
|
||||
{
|
||||
time_until_release = 0;
|
||||
}
|
||||
else if (whd_bus_platform_mcu_power_save_deep_sleep_enabled(whd_driver) )
|
||||
{
|
||||
time_until_release = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return time_until_release;
|
||||
}
|
||||
|
||||
whd_bool_t whd_bus_platform_mcu_power_save_deep_sleep_enabled(whd_driver_t whd_driver)
|
||||
{
|
||||
return WHD_FALSE;
|
||||
}
|
||||
|
||||
void whd_bus_init_backplane_window(whd_driver_t whd_driver)
|
||||
{
|
||||
whd_driver->bus_common_info->backplane_window_current_base_address = 0;
|
||||
}
|
||||
|
||||
whd_result_t whd_bus_write_wifi_firmware_image(whd_driver_t whd_driver)
|
||||
{
|
||||
whd_result_t result = WHD_SUCCESS;
|
||||
uint32_t ram_start_address;
|
||||
|
||||
/* Pass the ram_start_address to the firmware Download
|
||||
* CR4 chips have offset and CM3 starts from 0 */
|
||||
|
||||
ram_start_address = GET_C_VAR(whd_driver, ATCM_RAM_BASE_ADDRESS);
|
||||
result = whd_bus_common_download_resource(whd_driver, WHD_RESOURCE_WLAN_FIRMWARE, WHD_FALSE, ram_start_address);
|
||||
|
||||
if (result != WHD_SUCCESS)
|
||||
WPRINT_WHD_ERROR( ("Bus common resource download failed, %s failed at %d \n", __func__, __LINE__) );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
whd_result_t whd_bus_write_wifi_nvram_image(whd_driver_t whd_driver)
|
||||
{
|
||||
uint32_t image_size;
|
||||
uint32_t img_base;
|
||||
uint32_t img_end;
|
||||
|
||||
/* Get the size of the variable image */
|
||||
CHECK_RETURN(whd_resource_size(whd_driver, WHD_RESOURCE_WLAN_NVRAM, &image_size) );
|
||||
|
||||
/* Round up the size of the image */
|
||||
image_size = ROUND_UP(image_size, WHD_BUS_ROUND_UP_ALIGNMENT);
|
||||
|
||||
/* Write image */
|
||||
img_end = GET_C_VAR(whd_driver, CHIP_RAM_SIZE) - 4;
|
||||
img_base = (img_end - image_size);
|
||||
img_base += GET_C_VAR(whd_driver, ATCM_RAM_BASE_ADDRESS);
|
||||
|
||||
CHECK_RETURN(whd_bus_common_download_resource(whd_driver, WHD_RESOURCE_WLAN_NVRAM, WHD_FALSE, img_base) );
|
||||
|
||||
/* Write the variable image size at the end */
|
||||
image_size = (~(image_size / 4) << 16) | (image_size / 4);
|
||||
|
||||
img_end += GET_C_VAR(whd_driver, ATCM_RAM_BASE_ADDRESS);
|
||||
|
||||
CHECK_RETURN(whd_bus_write_backplane_value(whd_driver, (uint32_t)img_end, 4, image_size) );
|
||||
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
void whd_bus_set_resource_download_halt(whd_driver_t whd_driver, whd_bool_t halt)
|
||||
{
|
||||
whd_driver->bus_common_info->resource_download_abort = halt;
|
||||
}
|
||||
|
||||
/*
|
||||
* Update the backplane window registers
|
||||
*/
|
||||
whd_result_t whd_bus_set_backplane_window(whd_driver_t whd_driver, uint32_t addr)
|
||||
{
|
||||
whd_result_t result = WHD_BUS_WRITE_REGISTER_ERROR;
|
||||
uint32_t base = addr & ( (uint32_t) ~BACKPLANE_ADDRESS_MASK );
|
||||
const uint32_t upper_32bit_mask = 0xFF000000;
|
||||
const uint32_t upper_middle_32bit_mask = 0x00FF0000;
|
||||
const uint32_t lower_middle_32bit_mask = 0x0000FF00;
|
||||
struct whd_bus_common_info *bus_common_info = whd_driver->bus_common_info;
|
||||
|
||||
if (base == bus_common_info->backplane_window_current_base_address)
|
||||
{
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
if ( (base & upper_32bit_mask) != (bus_common_info->backplane_window_current_base_address & upper_32bit_mask) )
|
||||
{
|
||||
if (WHD_SUCCESS !=
|
||||
(result = whd_bus_write_register_value(whd_driver, BACKPLANE_FUNCTION, SDIO_BACKPLANE_ADDRESS_HIGH,
|
||||
(uint8_t)1, (base >> 24) ) ) )
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Failed to write register value to the bus, %s failed at %d \n", __func__, __LINE__) );
|
||||
return result;
|
||||
}
|
||||
/* clear old */
|
||||
bus_common_info->backplane_window_current_base_address &= ~upper_32bit_mask;
|
||||
/* set new */
|
||||
bus_common_info->backplane_window_current_base_address |= (base & upper_32bit_mask);
|
||||
}
|
||||
|
||||
if ( (base & upper_middle_32bit_mask) !=
|
||||
(bus_common_info->backplane_window_current_base_address & upper_middle_32bit_mask) )
|
||||
{
|
||||
if (WHD_SUCCESS !=
|
||||
(result = whd_bus_write_register_value(whd_driver, BACKPLANE_FUNCTION, SDIO_BACKPLANE_ADDRESS_MID,
|
||||
(uint8_t)1, (base >> 16) ) ) )
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Failed to write register value to the bus, %s failed at %d \n", __func__, __LINE__) );
|
||||
return result;
|
||||
}
|
||||
/* clear old */
|
||||
bus_common_info->backplane_window_current_base_address &= ~upper_middle_32bit_mask;
|
||||
/* set new */
|
||||
bus_common_info->backplane_window_current_base_address |= (base & upper_middle_32bit_mask);
|
||||
}
|
||||
|
||||
if ( (base & lower_middle_32bit_mask) !=
|
||||
(bus_common_info->backplane_window_current_base_address & lower_middle_32bit_mask) )
|
||||
{
|
||||
if (WHD_SUCCESS !=
|
||||
(result = whd_bus_write_register_value(whd_driver, BACKPLANE_FUNCTION, SDIO_BACKPLANE_ADDRESS_LOW,
|
||||
(uint8_t)1, (base >> 8) ) ) )
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Failed to write register value to the bus, %s failed at %d \n", __func__, __LINE__) );
|
||||
return result;
|
||||
}
|
||||
|
||||
/* clear old */
|
||||
bus_common_info->backplane_window_current_base_address &= ~lower_middle_32bit_mask;
|
||||
/* set new */
|
||||
bus_common_info->backplane_window_current_base_address |= (base & lower_middle_32bit_mask);
|
||||
}
|
||||
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
/* Default implementation of WHD bus resume function, which does nothing */
|
||||
whd_result_t whd_bus_resume_after_deep_sleep(whd_driver_t whd_driver)
|
||||
{
|
||||
whd_assert("In order to support deep-sleep platform need to implement this function", 0);
|
||||
return WHD_UNSUPPORTED;
|
||||
}
|
||||
|
||||
whd_result_t whd_bus_transfer_backplane_bytes(whd_driver_t whd_driver, whd_bus_transfer_direction_t direction,
|
||||
uint32_t address, uint32_t size, uint8_t *data)
|
||||
{
|
||||
whd_buffer_t pkt_buffer = NULL;
|
||||
uint8_t *packet;
|
||||
uint32_t transfer_size;
|
||||
uint32_t remaining_buf_size;
|
||||
uint32_t window_offset_address;
|
||||
whd_result_t result;
|
||||
|
||||
result = whd_host_buffer_get(whd_driver, &pkt_buffer, (direction == BUS_READ) ? WHD_NETWORK_RX : WHD_NETWORK_TX,
|
||||
( uint16_t )(whd_bus_get_max_transfer_size(whd_driver) +
|
||||
whd_bus_backplane_read_padd_size(
|
||||
whd_driver) + MAX_BUS_HEADER_SIZE), WHD_TRUE);
|
||||
if (result != WHD_SUCCESS)
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Packet buffer allocation failed in %s at %d \n", __func__, __LINE__) );
|
||||
goto done;
|
||||
}
|
||||
packet = (uint8_t *)whd_buffer_get_current_piece_data_pointer(whd_driver, pkt_buffer);
|
||||
|
||||
result = whd_ensure_wlan_bus_is_up(whd_driver);
|
||||
if (result != WHD_SUCCESS)
|
||||
{
|
||||
goto done;
|
||||
}
|
||||
|
||||
for (remaining_buf_size = size; remaining_buf_size != 0;
|
||||
remaining_buf_size -= transfer_size, address += transfer_size)
|
||||
{
|
||||
transfer_size = (remaining_buf_size >
|
||||
whd_bus_get_max_transfer_size(whd_driver) ) ? whd_bus_get_max_transfer_size(whd_driver) :
|
||||
remaining_buf_size;
|
||||
|
||||
/* Check if the transfer crosses the backplane window boundary */
|
||||
window_offset_address = address & BACKPLANE_ADDRESS_MASK;
|
||||
if ( (window_offset_address + transfer_size) > BACKPLANE_ADDRESS_MASK )
|
||||
{
|
||||
/* Adjust the transfer size to within current window */
|
||||
transfer_size = BACKPLANE_WINDOW_SIZE - window_offset_address;
|
||||
}
|
||||
result = whd_bus_set_backplane_window(whd_driver, address);
|
||||
if (result != WHD_SUCCESS)
|
||||
{
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (direction == BUS_WRITE)
|
||||
{
|
||||
DISABLE_COMPILER_WARNING(diag_suppress = Pa039)
|
||||
memcpy( ( (whd_transfer_bytes_packet_t *)packet )->data, data + size - remaining_buf_size, transfer_size );
|
||||
ENABLE_COMPILER_WARNING(diag_suppress = Pa039)
|
||||
result = whd_bus_transfer_bytes(whd_driver, direction, BACKPLANE_FUNCTION,
|
||||
(address & BACKPLANE_ADDRESS_MASK), (uint16_t)transfer_size,
|
||||
(whd_transfer_bytes_packet_t *)packet);
|
||||
if (result != WHD_SUCCESS)
|
||||
{
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result = whd_bus_transfer_bytes(whd_driver, direction, BACKPLANE_FUNCTION,
|
||||
(address & BACKPLANE_ADDRESS_MASK),
|
||||
( uint16_t )(transfer_size + whd_bus_backplane_read_padd_size(whd_driver) ),
|
||||
(whd_transfer_bytes_packet_t *)packet);
|
||||
if (result != WHD_SUCCESS)
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("whd_bus_transfer_bytes failed\n") );
|
||||
goto done;
|
||||
}
|
||||
DISABLE_COMPILER_WARNING(diag_suppress = Pa039)
|
||||
memcpy(data + size - remaining_buf_size, (uint8_t *)( (whd_transfer_bytes_packet_t *)packet )->data +
|
||||
whd_bus_backplane_read_padd_size(whd_driver), transfer_size);
|
||||
ENABLE_COMPILER_WARNING(diag_suppress = Pa039)
|
||||
}
|
||||
}
|
||||
|
||||
done: CHECK_RETURN(whd_bus_set_backplane_window(whd_driver, CHIPCOMMON_BASE_ADDRESS) );
|
||||
if (pkt_buffer != NULL)
|
||||
{
|
||||
CHECK_RETURN(whd_buffer_release(whd_driver, pkt_buffer,
|
||||
(direction == BUS_READ) ? WHD_NETWORK_RX : WHD_NETWORK_TX) );
|
||||
}
|
||||
CHECK_RETURN(result);
|
||||
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "whd.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef INCLUDED_WHD_BUS_COMMON_H
|
||||
#define INCLUDED_WHD_BUS_COMMON_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct whd_bus_common_info;
|
||||
|
||||
void whd_bus_common_info_init(whd_driver_t whd_driver);
|
||||
|
||||
/* Configure delayed sleep of bus.
|
||||
* A high number will mean a longer delay before sleep after the last operation (higher performance)
|
||||
* A shorter delay will mean quicker sleep after last operation (lower power use)
|
||||
*/
|
||||
extern void whd_bus_sdio_wlan_set_delayed_bus_powersave_milliseconds(whd_driver_t whd_driver, uint32_t time_ms);
|
||||
extern whd_result_t whd_bus_resume_after_deep_sleep(whd_driver_t whd_driver);
|
||||
|
||||
extern whd_result_t whd_bus_write_wifi_firmware_image(whd_driver_t whd_driver);
|
||||
extern whd_result_t whd_bus_write_wifi_nvram_image(whd_driver_t whd_driver);
|
||||
extern void whd_bus_set_resource_download_halt(whd_driver_t whd_driver, whd_bool_t halt);
|
||||
|
||||
extern whd_result_t whd_bus_transfer_backplane_bytes(whd_driver_t whd_driver, whd_bus_transfer_direction_t direction,
|
||||
uint32_t address, uint32_t size, uint8_t *data);
|
||||
extern void whd_bus_init_backplane_window(whd_driver_t whd_driver);
|
||||
whd_result_t whd_bus_set_backplane_window(whd_driver_t whd_driver, uint32_t addr);
|
||||
|
||||
whd_bool_t whd_bus_is_up(whd_driver_t whd_driver);
|
||||
extern whd_result_t whd_bus_set_flow_control(whd_driver_t whd_driver, uint8_t value);
|
||||
extern whd_bool_t whd_bus_is_flow_controlled(whd_driver_t whd_driver);
|
||||
|
||||
void whd_bus_set_state(whd_driver_t whd_driver, whd_bool_t state);
|
||||
|
||||
extern void whd_delayed_bus_release_schedule_update(whd_driver_t whd_driver, whd_bool_t is_scheduled);
|
||||
|
||||
/* handle delayed sleep of bus */
|
||||
extern uint32_t whd_bus_handle_delayed_release(whd_driver_t whd_driver);
|
||||
whd_bool_t whd_bus_platform_mcu_power_save_deep_sleep_enabled(whd_driver_t whd_driver);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,128 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "cyabs_rtos.h"
|
||||
|
||||
#include "whd.h"
|
||||
#include "whd_network_types.h"
|
||||
#include "whd_types_int.h"
|
||||
|
||||
#ifndef INCLUDED_WHD_BUS_PROTOCOL_INTERFACE_H_
|
||||
#define INCLUDED_WHD_BUS_PROTOCOL_INTERFACE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BUS_FUNCTION = 0,
|
||||
BACKPLANE_FUNCTION = 1,
|
||||
WLAN_FUNCTION = 2
|
||||
} whd_bus_function_t;
|
||||
|
||||
#define BUS_FUNCTION_MASK (0x3) /* Update this if adding functions */
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
#define PLATFORM_WLAN_ALLOW_BUS_TO_SLEEP_DELAY_MS 10
|
||||
|
||||
#define DELAYED_BUS_RELEASE_SCHEDULE(whd_driver, schedule) do { whd_delayed_bus_release_schedule_update(whd_driver, \
|
||||
schedule); \
|
||||
} while (0)
|
||||
|
||||
/******************************************************
|
||||
* Structures
|
||||
******************************************************/
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t bus_header[MAX_BUS_HEADER_SIZE];
|
||||
uint32_t data[1];
|
||||
} whd_transfer_bytes_packet_t;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
typedef void (*whd_bus_irq_callback_t)(void *handler_arg, uint32_t event);
|
||||
|
||||
/******************************************************
|
||||
* Function declarations
|
||||
******************************************************/
|
||||
|
||||
/* Initialisation functions */
|
||||
extern whd_result_t whd_bus_init(whd_driver_t whd_driver);
|
||||
extern whd_result_t whd_bus_deinit(whd_driver_t whd_driver);
|
||||
|
||||
/* Device register access functions */
|
||||
extern whd_result_t whd_bus_write_backplane_value(whd_driver_t whd_driver, uint32_t address, uint8_t register_length,
|
||||
uint32_t value);
|
||||
extern whd_result_t whd_bus_read_backplane_value(whd_driver_t whd_driver, uint32_t address, uint8_t register_length,
|
||||
uint8_t *value);
|
||||
extern whd_result_t whd_bus_write_register_value(whd_driver_t whd_driver, whd_bus_function_t function, uint32_t address,
|
||||
uint8_t value_length, uint32_t value);
|
||||
extern whd_result_t whd_bus_read_register_value(whd_driver_t whd_driver, whd_bus_function_t function, uint32_t address,
|
||||
uint8_t value_length, uint8_t *value);
|
||||
|
||||
/* Device data transfer functions */
|
||||
extern whd_result_t whd_bus_send_buffer(whd_driver_t whd_driver, whd_buffer_t buffer);
|
||||
extern whd_result_t whd_bus_transfer_bytes(whd_driver_t whd_driver, whd_bus_transfer_direction_t direction,
|
||||
whd_bus_function_t function, uint32_t address, uint16_t size,
|
||||
whd_transfer_bytes_packet_t *data);
|
||||
|
||||
/* Frame transfer function */
|
||||
extern whd_result_t whd_bus_read_frame(whd_driver_t whd_driver, whd_buffer_t *buffer);
|
||||
|
||||
extern uint32_t whd_bus_packet_available_to_read(whd_driver_t whd_driver);
|
||||
extern whd_result_t whd_bus_poke_wlan(whd_driver_t whd_driver);
|
||||
extern whd_result_t whd_bus_wait_for_wlan_event(whd_driver_t whd_driver, cy_semaphore_t *transceive_semaphore);
|
||||
|
||||
extern whd_result_t whd_bus_ack_interrupt(whd_driver_t whd_driver, uint32_t intstatus);
|
||||
extern whd_bool_t whd_bus_wake_interrupt_present(whd_driver_t whd_driver);
|
||||
|
||||
extern whd_result_t whd_bus_set_flow_control(whd_driver_t whd_driver, uint8_t value);
|
||||
extern whd_bool_t whd_bus_is_flow_controlled(whd_driver_t whd_driver);
|
||||
|
||||
extern whd_result_t whd_bus_wakeup(whd_driver_t whd_driver);
|
||||
extern whd_result_t whd_bus_sleep(whd_driver_t whd_driver);
|
||||
|
||||
extern uint8_t whd_bus_backplane_read_padd_size(whd_driver_t whd_driver);
|
||||
extern whd_bool_t whd_bus_use_status_report_scheme(whd_driver_t whd_driver);
|
||||
extern uint32_t whd_bus_get_max_transfer_size(whd_driver_t whd_driver);
|
||||
|
||||
extern void whd_bus_init_stats(whd_driver_t whd_driver);
|
||||
extern whd_result_t whd_bus_print_stats(whd_driver_t whd_driver, whd_bool_t reset_after_print);
|
||||
extern whd_result_t whd_bus_reinit_stats(whd_driver_t whd_driver, whd_bool_t wake_from_firmware);
|
||||
extern whd_result_t whd_bus_irq_enable(whd_driver_t whd_driver, whd_bool_t enable);
|
||||
extern whd_result_t whd_bus_irq_register(whd_driver_t whd_driver);
|
||||
/******************************************************
|
||||
* Global variables
|
||||
******************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* ifndef INCLUDED_WHD_BUS_PROTOCOL_INTERFACE_H_ */
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,229 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "whd.h"
|
||||
#include "bus_protocols/whd_bus_protocol_interface.h"
|
||||
|
||||
#ifndef INCLUDED_SDIO_WHD_BUS_PROTOCOL_H
|
||||
#define INCLUDED_SDIO_WHD_BUS_PROTOCOL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
#define BIT_MASK(x) ( (1 << x) - 1 )
|
||||
|
||||
#define WHD_BUS_HEADER_SIZE (0)
|
||||
|
||||
#define WHD_BUS_SDIO_MAX_BACKPLANE_TRANSFER_SIZE (WHD_PAYLOAD_MTU)
|
||||
#define WHD_BUS_SDIO_BACKPLANE_READ_PADD_SIZE (0)
|
||||
|
||||
/******************************************************
|
||||
* Structures
|
||||
******************************************************/
|
||||
#pragma pack(1)
|
||||
typedef struct
|
||||
{
|
||||
unsigned char stuff_bits;
|
||||
unsigned int ocr : 24;
|
||||
} sdio_cmd5_argument_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int _unique2 : 9; /* 0-8 */
|
||||
unsigned int register_address : 17; /* 9-25 */
|
||||
unsigned int _unique : 2; /* 26-27 */
|
||||
unsigned int function_number : 3; /* 28-30 */
|
||||
unsigned int rw_flag : 1; /* 31 */
|
||||
} sdio_cmd5x_argument_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t write_data; /* 0 - 7 */
|
||||
unsigned int _stuff2 : 1; /* 8 */
|
||||
unsigned int register_address : 17; /* 9-25 */
|
||||
unsigned int _stuff : 1; /* 26 */
|
||||
unsigned int raw_flag : 1; /* 27 */
|
||||
unsigned int function_number : 3; /* 28-30 */
|
||||
unsigned int rw_flag : 1; /* 31 */
|
||||
} whd_bus_sdio_cmd52_argument_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int count : 9; /* 0-8 */
|
||||
unsigned int register_address : 17; /* 9-25 */
|
||||
unsigned int op_code : 1; /* 26 */
|
||||
unsigned int block_mode : 1; /* 27 */
|
||||
unsigned int function_number : 3; /* 28-30 */
|
||||
unsigned int rw_flag : 1; /* 31 */
|
||||
} whd_bus_sdio_cmd53_argument_t;
|
||||
|
||||
typedef union
|
||||
{
|
||||
uint32_t value;
|
||||
sdio_cmd5_argument_t cmd5;
|
||||
sdio_cmd5x_argument_t cmd5x;
|
||||
whd_bus_sdio_cmd52_argument_t cmd52;
|
||||
whd_bus_sdio_cmd53_argument_t cmd53;
|
||||
} sdio_cmd_argument_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int ocr : 24; /* 0-23 */
|
||||
unsigned int stuff_bits : 3; /* 24-26 */
|
||||
unsigned int memory_present : 1; /* 27 */
|
||||
unsigned int function_count : 3; /* 28-30 */
|
||||
unsigned int c : 1; /* 31 */
|
||||
} sdio_response4_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t data; /* 0-7 */
|
||||
uint8_t response_flags; /* 8-15 */
|
||||
uint16_t stuff; /* 16-31 */
|
||||
} sdio_response5_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t card_status; /* 0-15 */
|
||||
uint16_t rca; /* 16-31 */
|
||||
} sdio_response6_t;
|
||||
|
||||
typedef union
|
||||
{
|
||||
uint32_t value;
|
||||
sdio_response4_t r4;
|
||||
sdio_response5_t r5;
|
||||
sdio_response6_t r6;
|
||||
} sdio_response_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SDIO_BLOCK_MODE = (0 << 2), /* These are STM32 implementation specific */
|
||||
SDIO_BYTE_MODE = (1 << 2) /* These are STM32 implementation specific */
|
||||
} sdio_transfer_mode_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SDIO_1B_BLOCK = 1, SDIO_2B_BLOCK = 2, SDIO_4B_BLOCK = 4, SDIO_8B_BLOCK = 8, SDIO_16B_BLOCK = 16,
|
||||
SDIO_32B_BLOCK = 32, SDIO_64B_BLOCK = 64, SDIO_128B_BLOCK = 128, SDIO_256B_BLOCK = 256, SDIO_512B_BLOCK = 512,
|
||||
SDIO_1024B_BLOCK = 1024, SDIO_2048B_BLOCK = 2048
|
||||
} sdio_block_size_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RESPONSE_NEEDED, NO_RESPONSE
|
||||
} sdio_response_needed_t;
|
||||
|
||||
|
||||
#pragma pack()
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
#define WHD_BUS_STATS_INCREMENT_VARIABLE(bus_priv, var) \
|
||||
do { bus_priv->whd_bus_stats.var++; } while (0)
|
||||
|
||||
#define WHD_BUS_STATS_CONDITIONAL_INCREMENT_VARIABLE(bus_priv, condition, var) \
|
||||
do { if (condition){ bus_priv->whd_bus_stats.var++; }} while (0)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t cmd52; /* Number of cmd52 reads/writes issued */
|
||||
uint32_t cmd53_read; /* Number of cmd53 reads */
|
||||
uint32_t cmd53_write; /* Number of cmd53 writes */
|
||||
uint32_t cmd52_fail; /* Number of cmd52 read/write fails */
|
||||
uint32_t cmd53_read_fail; /* Number of cmd53 read fails */
|
||||
uint32_t cmd53_write_fail; /* Number of cmd53 write fails */
|
||||
uint32_t oob_intrs; /* Number of OOB interrupts generated by wlan chip */
|
||||
uint32_t sdio_intrs; /* Number of SDIO interrupts generated by wlan chip */
|
||||
uint32_t error_intrs; /* Number of SDIO error interrupts generated by wlan chip */
|
||||
uint32_t read_aborts; /* Number of times read aborts are called */
|
||||
} whd_bus_stats_t;
|
||||
|
||||
/******************************************************
|
||||
* Structures
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Function declarations
|
||||
******************************************************/
|
||||
/* Initialisation functions */
|
||||
extern whd_result_t whd_bus_sdio_init(whd_driver_t whd_driver);
|
||||
extern whd_result_t whd_bus_sdio_resume_after_deep_sleep(whd_driver_t whd_driver);
|
||||
extern whd_result_t whd_bus_sdio_deinit(whd_driver_t whd_driver);
|
||||
|
||||
/* Device register access functions */
|
||||
extern whd_result_t whd_bus_sdio_write_backplane_value(whd_driver_t whd_driver, uint32_t address,
|
||||
uint8_t register_length, uint32_t value);
|
||||
extern whd_result_t whd_bus_sdio_read_backplane_value(whd_driver_t whd_driver, uint32_t address,
|
||||
uint8_t register_length, uint8_t *value);
|
||||
extern whd_result_t whd_bus_sdio_write_register_value(whd_driver_t whd_driver, whd_bus_function_t function,
|
||||
uint32_t address, uint8_t value_length, uint32_t value);
|
||||
extern whd_result_t whd_bus_sdio_read_register_value(whd_driver_t whd_driver, whd_bus_function_t function,
|
||||
uint32_t address, uint8_t value_length, uint8_t *value);
|
||||
|
||||
/* Device data transfer functions */
|
||||
extern whd_result_t whd_bus_sdio_send_buffer(whd_driver_t whd_driver, whd_buffer_t buffer);
|
||||
extern whd_result_t whd_bus_sdio_transfer_bytes(whd_driver_t whd_driver, whd_bus_transfer_direction_t direction,
|
||||
whd_bus_function_t function, uint32_t address, uint16_t size,
|
||||
whd_transfer_bytes_packet_t *data);
|
||||
extern whd_result_t whd_bus_sdio_transfer_backplane_bytes(whd_driver_t whd_driver,
|
||||
whd_bus_transfer_direction_t direction, uint32_t address,
|
||||
uint32_t size, uint8_t *data);
|
||||
|
||||
/* Frame transfer function */
|
||||
extern whd_result_t whd_bus_sdio_read_frame(whd_driver_t whd_driver, whd_buffer_t *buffer);
|
||||
|
||||
extern whd_result_t whd_bus_sdio_poke_wlan(whd_driver_t whd_driver);
|
||||
extern uint32_t whd_bus_sdio_packet_available_to_read(whd_driver_t whd_driver);
|
||||
extern whd_result_t whd_bus_sdio_ack_interrupt(whd_driver_t whd_driver, uint32_t intstatus);
|
||||
|
||||
extern whd_result_t whd_bus_sdio_set_backplane_window(whd_driver_t whd_driver, uint32_t addr);
|
||||
|
||||
extern void whd_delayed_bus_release_schedule_update(whd_driver_t whd_driver, whd_bool_t is_scheduled);
|
||||
#define DELAYED_BUS_RELEASE_SCHEDULE(whd_driver, schedule) \
|
||||
do { whd_delayed_bus_release_schedule_update(whd_driver, schedule); } while (0)
|
||||
|
||||
extern whd_bool_t whd_bus_sdio_wake_interrupt_present(whd_driver_t whd_driver);
|
||||
|
||||
extern whd_result_t whd_bus_sdio_wakeup(whd_driver_t whd_driver);
|
||||
extern whd_result_t whd_bus_sdio_sleep(whd_driver_t whd_driver);
|
||||
|
||||
extern void whd_bus_sdio_init_stats(whd_driver_t whd_driver);
|
||||
extern whd_result_t whd_bus_sdio_print_stats(whd_driver_t whd_driver, whd_bool_t reset_after_print);
|
||||
extern whd_result_t whd_bus_sdio_reinit_stats(whd_driver_t whd_driver, whd_bool_t wake_from_firmware);
|
||||
|
||||
uint8_t whd_bus_sdio_backplane_read_padd_size(whd_driver_t whd_driver);
|
||||
|
||||
extern whd_result_t whd_bus_sdio_wait_for_wlan_event(whd_driver_t whd_driver,
|
||||
cy_semaphore_t *transceive_semaphore);
|
||||
extern whd_bool_t whd_bus_sdio_use_status_report_scheme(whd_driver_t whd_driver);
|
||||
extern uint32_t whd_bus_sdio_get_max_transfer_size(whd_driver_t whd_driver);
|
||||
/******************************************************
|
||||
* Global variables
|
||||
******************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* ifndef INCLUDED_SDIO_WHD_BUS_PROTOCOL_H */
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "whd.h"
|
||||
#include "whd_bus_protocol_interface.h"
|
||||
#include "cy_result.h"
|
||||
#include "cyhal_spi.h"
|
||||
|
||||
#ifndef INCLUDED_SPI_WHD_BUS_PROTOCOL_H
|
||||
#define INCLUDED_SPI_WHD_BUS_PROTOCOL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Structures
|
||||
******************************************************/
|
||||
|
||||
typedef uint32_t whd_bus_gspi_header_t;
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
whd_bus_gspi_header_t gspi_header;
|
||||
} whd_bus_header_t;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#define WHD_BUS_SPI_HEADER_SIZE (sizeof(whd_bus_header_t) )
|
||||
|
||||
#define WHD_BUS_SPI_USE_STATUS_REPORT_SCHEME (1 == 1)
|
||||
|
||||
#define WHD_BUS_SPI_MAX_BACKPLANE_TRANSFER_SIZE (64) /* Max packet size on F1 */
|
||||
#define WHD_BUS_SPI_BACKPLANE_READ_PADD_SIZE (4)
|
||||
|
||||
/******************************************************
|
||||
* Function declarations
|
||||
******************************************************/
|
||||
extern whd_result_t whd_bus_spi_send_buffer(whd_driver_t whd_driver, whd_buffer_t buffer);
|
||||
extern whd_result_t whd_bus_spi_poke_wlan(whd_driver_t whd_driver);
|
||||
extern whd_result_t whd_bus_spi_ack_interrupt(whd_driver_t whd_driver, uint32_t intstatus);
|
||||
extern uint32_t whd_bus_spi_packet_available_to_read(whd_driver_t whd_driver);
|
||||
extern whd_result_t whd_bus_spi_read_frame(whd_driver_t whd_driver, whd_buffer_t *buffer);
|
||||
extern whd_result_t whd_bus_spi_init(whd_driver_t whd_driver);
|
||||
extern whd_result_t whd_bus_spi_deinit(whd_driver_t whd_driver);
|
||||
extern whd_bool_t whd_bus_spi_wake_interrupt_present(whd_driver_t whd_driver);
|
||||
extern whd_result_t whd_bus_spi_wait_for_wlan_event(whd_driver_t whd_driver,
|
||||
cy_semaphore_t *transceive_semaphore);
|
||||
extern whd_result_t whd_bus_spi_write_register_value(whd_driver_t whd_driver, whd_bus_function_t function,
|
||||
uint32_t address, uint8_t value_length, uint32_t value);
|
||||
extern whd_result_t whd_bus_spi_read_register_value(whd_driver_t whd_driver, whd_bus_function_t function,
|
||||
uint32_t address, uint8_t value_length, uint8_t *value);
|
||||
extern whd_result_t whd_bus_spi_write_backplane_value(whd_driver_t whd_driver, uint32_t address,
|
||||
uint8_t register_length, uint32_t value);
|
||||
extern whd_result_t whd_bus_spi_read_backplane_value(whd_driver_t whd_driver, uint32_t address, uint8_t register_length,
|
||||
uint8_t *value);
|
||||
extern whd_result_t whd_bus_spi_transfer_bytes(whd_driver_t whd_driver, whd_bus_transfer_direction_t direction,
|
||||
whd_bus_function_t function, uint32_t address, uint16_t size,
|
||||
whd_transfer_bytes_packet_t *packet);
|
||||
extern whd_result_t whd_bus_spi_wakeup(whd_driver_t whd_driver);
|
||||
extern whd_result_t whd_bus_spi_sleep(whd_driver_t whd_driver);
|
||||
extern void whd_bus_spi_init_stats(whd_driver_t whd_driver);
|
||||
extern whd_result_t whd_bus_spi_print_stats(whd_driver_t whd_driver, whd_bool_t reset_after_print);
|
||||
extern whd_result_t whd_bus_spi_reinit_stats(whd_driver_t whd_driver, whd_bool_t wake_from_firmware);
|
||||
extern uint8_t whd_bus_spi_backplane_read_padd_size(whd_driver_t whd_driver);
|
||||
extern whd_bool_t whd_bus_spi_use_status_report_scheme(whd_driver_t whd_driver);
|
||||
extern uint32_t whd_bus_spi_get_max_transfer_size(whd_driver_t whd_driver);
|
||||
extern whd_result_t whd_bus_spi_irq_register(whd_driver_t whd_driver);
|
||||
extern whd_result_t whd_bus_spi_irq_enable(whd_driver_t whd_driver, whd_bool_t enable);
|
||||
extern void whd_bus_spi_irq_handler(void *handler_arg, cyhal_spi_irq_event_t event);
|
||||
|
||||
/******************************************************
|
||||
* Global variables
|
||||
******************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* ifndef INCLUDED_SPI_WHD_BUS_PROTOCOL_H */
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_WHD_CHIP_REG_H_
|
||||
#define INCLUDED_WHD_CHIP_REG_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Architecture Constants
|
||||
******************************************************/
|
||||
|
||||
/* D11 registers and SHM */
|
||||
#define D11_BASE_ADDR 0x18001000
|
||||
#define D11_AXI_BASE_ADDR 0xE8000000
|
||||
#define D11_SHM_BASE_ADDR (D11_AXI_BASE_ADDR + 0x4000)
|
||||
|
||||
#define D11REG_ADDR(offset) (D11_BASE_ADDR + offset)
|
||||
#define D11IHR_ADDR(offset) (D11_AXI_BASE_ADDR + 0x400 + (2 * offset) )
|
||||
#define D11SHM_ADDR(offset) (D11_SHM_BASE_ADDR + offset)
|
||||
|
||||
#define M_DS1_CTRL_STATUS (0xe0b * 2)
|
||||
|
||||
/* RMC operational modes */
|
||||
enum ds1_ctrl_status
|
||||
{
|
||||
DS1_SLEEP = 0, /* DS1_SLEEP */
|
||||
MAC_ON = 1, /* MAC_ON */
|
||||
RADIO_PHY_ON = 2, /* RADIO_PHY_ON */
|
||||
DS1_EXIT = 3 /* DS1_EXIT.*/
|
||||
};
|
||||
|
||||
#define M_DS1_CTRL_SDIO (0xe0c * 2)
|
||||
|
||||
#define C_DS1_CTRL_SDIO_DS1_SLEEP (1 << 0)
|
||||
#define C_DS1_CTRL_SDIO_MAC_ON (1 << 1)
|
||||
#define C_DS1_CTRL_SDIO_RADIO_PHY_ON (1 << 2)
|
||||
#define C_DS1_CTRL_SDIO_DS1_EXIT (1 << 3)
|
||||
#define C_DS1_CTRL_PROC_DONE (1 << 8)
|
||||
#define C_DS1_CTRL_REQ_VALID (1 << 9)
|
||||
/* MacControl register */
|
||||
#define D11_MACCONTROL_REG D11REG_ADDR(0x120)
|
||||
#define D11_MACCONTROL_REG_SIZE 4
|
||||
#define D11_MACCONTROL_REG_WAKE (1 << 26)
|
||||
#define D11_MACCONTROL_CLEAR_WAKE (0xFBFFFFFF)
|
||||
#define PMU_MINRESMASK (PMU_BASE_ADDRESS + 0x618)
|
||||
#define DEFAULT_43012_MIN_RES_MASK 0x0f8bfe77
|
||||
|
||||
/* Backplane architecture */
|
||||
#define CHIPCOMMON_BASE_ADDRESS 0x18000000 /* Chipcommon core register region */
|
||||
#define I2S0_BASE_ADDRESS 0x18001000 /* I2S0 core register region */
|
||||
#define I2S1_BASE_ADDRESS 0x18002000 /* I2S1 core register region */
|
||||
#define APPS_ARMCR4_BASE_ADDRESS 0x18003000 /* Apps Cortex-R4 core register region */
|
||||
#define DMA_BASE_ADDRESS 0x18004000 /* DMA core register region */
|
||||
#define GMAC_BASE_ADDRESS 0x18005000 /* GMAC core register region */
|
||||
#define USB20H0_BASE_ADDRESS 0x18006000 /* USB20H0 core register region */
|
||||
#define USB20D_BASE_ADDRESS 0x18007000 /* USB20D core register region */
|
||||
#define SDIOH_BASE_ADDRESS 0x18008000 /* SDIOH Device core register region */
|
||||
#define WLAN_ARMCM3_BASE_ADDRESS 0x18003000 /* ARMCM3 core register region */
|
||||
#define PMU_BASE_ADDRESS 0x18012000 /* PMU core register region */
|
||||
#define DOT11MAC_BASE_ADDRESS 0x18001000
|
||||
#define SDIO_BASE_ADDRESS 0x18002000
|
||||
#define SOCSRAM_BASE_ADDRESS 0x18004000
|
||||
#define WLAN_ARMCR4_BASE_ADDRESS 0x18003000 /* ARMCR4 core register region */
|
||||
|
||||
#define BACKPLANE_ADDRESS_MASK 0x7FFF
|
||||
#define BACKPLANE_WINDOW_SIZE (BACKPLANE_ADDRESS_MASK + 1)
|
||||
|
||||
#define CHIP_STA_INTERFACE 0
|
||||
#define CHIP_AP_INTERFACE 1
|
||||
#define CHIP_P2P_INTERFACE 2
|
||||
|
||||
/* Chipcommon registers */
|
||||
#define CHIPCOMMON_CORE_CAPEXT_ADDR ( (uint32_t)(CHIPCOMMON_BASE_ADDRESS + 0x64c) )
|
||||
#define CHIPCOMMON_CORE_CAPEXT_SR_SUPPORTED ( (uint32_t)(1 << 1) )
|
||||
#define CHIPCOMMON_CORE_RCTL_LOGIC_DISABLE ( (uint32_t)(1 << 27) )
|
||||
#define CHIPCOMMON_CORE_RCTL_MACPHY_DISABLE ( (uint32_t)(1 << 26) )
|
||||
#define CHIPCOMMON_CORE_RETENTION_CTL ( (uint32_t)(CHIPCOMMON_BASE_ADDRESS + 0x670) )
|
||||
|
||||
#define CHIPCOMMON_GPIO_CONTROL ( (uint32_t)(CHIPCOMMON_BASE_ADDRESS + 0x6C) )
|
||||
#define CHIPCOMMON_SR_CONTROL0 ( (uint32_t)(CHIPCOMMON_BASE_ADDRESS + 0x504) )
|
||||
#define CHIPCOMMON_SR_CONTROL1 ( (uint32_t)(CHIPCOMMON_BASE_ADDRESS + 0x508) )
|
||||
|
||||
/* SOCSRAM core registers */
|
||||
#define SOCSRAM_BANKX_INDEX ( (uint32_t)(SOCSRAM_BASE_ADDRESS + 0x10) )
|
||||
#define SOCSRAM_BANKX_PDA ( (uint32_t)(SOCSRAM_BASE_ADDRESS + 0x44) )
|
||||
|
||||
/* PMU core registers */
|
||||
#define RETENTION_CTL ( (uint32_t)(PMU_BASE_ADDRESS + 0x670) )
|
||||
#define RCTL_MACPHY_DISABLE ( (uint32_t)(1 << 26) )
|
||||
#define RCTL_LOGIC_DISABLE ( (uint32_t)(1 << 27) )
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* ifndef INCLUDED_WHD_CHIP_REG_H_ */
|
||||
|
|
@ -0,0 +1,234 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_WHD_SDIO_H_
|
||||
#define INCLUDED_WHD_SDIO_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* SDIO Constants
|
||||
******************************************************/
|
||||
/* CurrentSdiodProgGuide r23 */
|
||||
|
||||
/* Base registers */
|
||||
#define SDIO_CORE ( (uint32_t)(SDIO_BASE_ADDRESS + 0x00) )
|
||||
#define SDIO_INT_STATUS ( (uint32_t)(SDIO_BASE_ADDRESS + 0x20) )
|
||||
#define SDIO_TO_SB_MAILBOX ( (uint32_t)(SDIO_BASE_ADDRESS + 0x40) )
|
||||
#define SDIO_TO_SB_MAILBOX_DATA ( (uint32_t)(SDIO_BASE_ADDRESS + 0x48) )
|
||||
#define SDIO_TO_HOST_MAILBOX_DATA ( (uint32_t)(SDIO_BASE_ADDRESS + 0x4C) )
|
||||
#define SDIO_TO_SB_MAIL_BOX ( (uint32_t)(SDIO_BASE_ADDRESS + 0x40) )
|
||||
#define SDIO_INT_HOST_MASK ( (uint32_t)(SDIO_BASE_ADDRESS + 0x24) )
|
||||
#define SDIO_FUNCTION_INT_MASK ( (uint32_t)(SDIO_BASE_ADDRESS + 0x34) )
|
||||
|
||||
/* SDIO Function 0 (SDIO Bus) register addresses */
|
||||
|
||||
/* SDIO Device CCCR offsets */
|
||||
/* TODO: What does CIS/CCCR stand for? */
|
||||
/* CCCR accesses do not require backpane clock */
|
||||
#define SDIOD_CCCR_REV ( (uint32_t)0x00 ) /* CCCR/SDIO Revision */
|
||||
#define SDIOD_CCCR_SDREV ( (uint32_t)0x01 ) /* SD Revision */
|
||||
#define SDIOD_CCCR_IOEN ( (uint32_t)0x02 ) /* I/O Enable */
|
||||
#define SDIOD_CCCR_IORDY ( (uint32_t)0x03 ) /* I/O Ready */
|
||||
#define SDIOD_CCCR_INTEN ( (uint32_t)0x04 ) /* Interrupt Enable */
|
||||
#define SDIOD_CCCR_INTPEND ( (uint32_t)0x05 ) /* Interrupt Pending */
|
||||
#define SDIOD_CCCR_IOABORT ( (uint32_t)0x06 ) /* I/O Abort */
|
||||
#define SDIOD_CCCR_BICTRL ( (uint32_t)0x07 ) /* Bus Interface control */
|
||||
#define SDIOD_CCCR_CAPABLITIES ( (uint32_t)0x08 ) /* Card Capabilities */
|
||||
#define SDIOD_CCCR_CISPTR_0 ( (uint32_t)0x09 ) /* Common CIS Base Address Pointer Register 0 (LSB) */
|
||||
#define SDIOD_CCCR_CISPTR_1 ( (uint32_t)0x0A ) /* Common CIS Base Address Pointer Register 1 */
|
||||
#define SDIOD_CCCR_CISPTR_2 ( (uint32_t)0x0B ) /* Common CIS Base Address Pointer Register 2 (MSB - only bit 1 valid)*/
|
||||
#define SDIOD_CCCR_BUSSUSP ( (uint32_t)0x0C ) /* */
|
||||
#define SDIOD_CCCR_FUNCSEL ( (uint32_t)0x0D ) /* */
|
||||
#define SDIOD_CCCR_EXECFLAGS ( (uint32_t)0x0E ) /* */
|
||||
#define SDIOD_CCCR_RDYFLAGS ( (uint32_t)0x0F ) /* */
|
||||
#define SDIOD_CCCR_BLKSIZE_0 ( (uint32_t)0x10 ) /* Function 0 (Bus) SDIO Block Size Register 0 (LSB) */
|
||||
#define SDIOD_CCCR_BLKSIZE_1 ( (uint32_t)0x11 ) /* Function 0 (Bus) SDIO Block Size Register 1 (MSB) */
|
||||
#define SDIOD_CCCR_POWER_CONTROL ( (uint32_t)0x12 ) /* Power Control */
|
||||
#define SDIOD_CCCR_SPEED_CONTROL ( (uint32_t)0x13 ) /* Bus Speed Select (control device entry into high-speed clocking mode) */
|
||||
#define SDIOD_CCCR_UHS_I ( (uint32_t)0x14 ) /* UHS-I Support */
|
||||
#define SDIOD_CCCR_DRIVE ( (uint32_t)0x15 ) /* Drive Strength */
|
||||
#define SDIOD_CCCR_INTEXT ( (uint32_t)0x16 ) /* Interrupt Extension */
|
||||
#define SDIOD_CCCR_BRCM_CARDCAP ( (uint32_t)0xF0 ) /* Brcm Card Capability */
|
||||
#define SDIOD_SEP_INT_CTL ( (uint32_t)0xF2 ) /* Separate Interrupt Control*/
|
||||
#define SDIOD_CCCR_F1INFO ( (uint32_t)0x100 ) /* Function 1 (Backplane) Info */
|
||||
#define SDIOD_CCCR_F1HP ( (uint32_t)0x102 ) /* Function 1 (Backplane) High Power */
|
||||
#define SDIOD_CCCR_F1CISPTR_0 ( (uint32_t)0x109 ) /* Function 1 (Backplane) CIS Base Address Pointer Register 0 (LSB) */
|
||||
#define SDIOD_CCCR_F1CISPTR_1 ( (uint32_t)0x10A ) /* Function 1 (Backplane) CIS Base Address Pointer Register 1 */
|
||||
#define SDIOD_CCCR_F1CISPTR_2 ( (uint32_t)0x10B ) /* Function 1 (Backplane) CIS Base Address Pointer Register 2 (MSB - only bit 1 valid) */
|
||||
#define SDIOD_CCCR_F1BLKSIZE_0 ( (uint32_t)0x110 ) /* Function 1 (Backplane) SDIO Block Size Register 0 (LSB) */
|
||||
#define SDIOD_CCCR_F1BLKSIZE_1 ( (uint32_t)0x111 ) /* Function 1 (Backplane) SDIO Block Size Register 1 (MSB) */
|
||||
#define SDIOD_CCCR_F2INFO ( (uint32_t)0x200 ) /* Function 2 (WLAN Data FIFO) Info */
|
||||
#define SDIOD_CCCR_F2HP ( (uint32_t)0x202 ) /* Function 2 (WLAN Data FIFO) High Power */
|
||||
#define SDIOD_CCCR_F2CISPTR_0 ( (uint32_t)0x209 ) /* Function 2 (WLAN Data FIFO) CIS Base Address Pointer Register 0 (LSB) */
|
||||
#define SDIOD_CCCR_F2CISPTR_1 ( (uint32_t)0x20A ) /* Function 2 (WLAN Data FIFO) CIS Base Address Pointer Register 1 */
|
||||
#define SDIOD_CCCR_F2CISPTR_2 ( (uint32_t)0x20B ) /* Function 2 (WLAN Data FIFO) CIS Base Address Pointer Register 2 (MSB - only bit 1 valid) */
|
||||
#define SDIOD_CCCR_F2BLKSIZE_0 ( (uint32_t)0x210 ) /* Function 2 (WLAN Data FIFO) SDIO Block Size Register 0 (LSB) */
|
||||
#define SDIOD_CCCR_F2BLKSIZE_1 ( (uint32_t)0x211 ) /* Function 2 (WLAN Data FIFO) SDIO Block Size Register 1 (MSB) */
|
||||
#define SDIOD_CCCR_F3INFO ( (uint32_t)0x300 ) /* Function 3 (Bluetooth Data FIFO) Info */
|
||||
#define SDIOD_CCCR_F3HP ( (uint32_t)0x302 ) /* Function 3 (Bluetooth Data FIFO) High Power */
|
||||
#define SDIOD_CCCR_F3CISPTR_0 ( (uint32_t)0x309 ) /* Function 3 (Bluetooth Data FIFO) CIS Base Address Pointer Register 0 (LSB) */
|
||||
#define SDIOD_CCCR_F3CISPTR_1 ( (uint32_t)0x30A ) /* Function 3 (Bluetooth Data FIFO) CIS Base Address Pointer Register 1 */
|
||||
#define SDIOD_CCCR_F3CISPTR_2 ( (uint32_t)0x30B ) /* Function 3 (Bluetooth Data FIFO) CIS Base Address Pointer Register 2 (MSB - only bit 1 valid) */
|
||||
#define SDIOD_CCCR_F3BLKSIZE_0 ( (uint32_t)0x310 ) /* Function 3 (Bluetooth Data FIFO) SDIO Block Size Register 0 (LSB) */
|
||||
#define SDIOD_CCCR_F3BLKSIZE_1 ( (uint32_t)0x311 ) /* Function 3 (Bluetooth Data FIFO) SDIO Block Size Register 1 (MSB) */
|
||||
|
||||
|
||||
/* SDIO Function 1 (Backplane) register addresses */
|
||||
/* Addresses 0x00000000 - 0x0000FFFF are directly access the backplane
|
||||
* throught the backplane window. Addresses above 0x0000FFFF are
|
||||
* registers relating to backplane access, and do not require a backpane
|
||||
* clock to access them
|
||||
*/
|
||||
#define SDIO_GPIO_SELECT ( (uint32_t)0x10005 )
|
||||
#define SDIO_GPIO_OUTPUT ( (uint32_t)0x10006 )
|
||||
#define SDIO_GPIO_ENABLE ( (uint32_t)0x10007 )
|
||||
#define SDIO_FUNCTION2_WATERMARK ( (uint32_t)0x10008 )
|
||||
#define SDIO_DEVICE_CONTROL ( (uint32_t)0x10009 )
|
||||
#define SDIO_BACKPLANE_ADDRESS_LOW ( (uint32_t)0x1000A )
|
||||
#define SDIO_BACKPLANE_ADDRESS_MID ( (uint32_t)0x1000B )
|
||||
#define SDIO_BACKPLANE_ADDRESS_HIGH ( (uint32_t)0x1000C )
|
||||
#define SDIO_FRAME_CONTROL ( (uint32_t)0x1000D )
|
||||
#define SDIO_CHIP_CLOCK_CSR ( (uint32_t)0x1000E )
|
||||
#define SDIO_PULL_UP ( (uint32_t)0x1000F )
|
||||
#define SDIO_READ_FRAME_BC_LOW ( (uint32_t)0x1001B )
|
||||
#define SDIO_READ_FRAME_BC_HIGH ( (uint32_t)0x1001C )
|
||||
#define SDIO_WAKEUP_CTRL ( (uint32_t)0x1001E )
|
||||
#define SDIO_SLEEP_CSR ( (uint32_t)0x1001F )
|
||||
#define I_HMB_SW_MASK ( (uint32_t)0x000000F0 )
|
||||
#define I_HMB_FRAME_IND (1 << 6)
|
||||
#define I_HMB_HOST_INT (1 << 7)
|
||||
#define FRAME_AVAILABLE_MASK I_HMB_SW_MASK
|
||||
|
||||
/******************************************************
|
||||
* Bit Masks
|
||||
******************************************************/
|
||||
|
||||
/* SDIOD_CCCR_REV Bits */
|
||||
#define SDIO_REV_SDIOID_MASK ( (uint32_t)0xF0 ) /* SDIO spec revision number */
|
||||
#define SDIO_REV_CCCRID_MASK ( (uint32_t)0x0F ) /* CCCR format version number */
|
||||
|
||||
/* SDIOD_CCCR_SDREV Bits */
|
||||
#define SD_REV_PHY_MASK ( (uint32_t)0x0F ) /* SD format version number */
|
||||
|
||||
/* SDIOD_CCCR_IOEN Bits */
|
||||
#define SDIO_FUNC_ENABLE_1 ( (uint32_t)0x02 ) /* function 1 I/O enable */
|
||||
#define SDIO_FUNC_ENABLE_2 ( (uint32_t)0x04 ) /* function 2 I/O enable */
|
||||
#define SDIO_FUNC_ENABLE_3 ( (uint32_t)0x08 ) /* function 3 I/O enable */
|
||||
|
||||
/* SDIOD_CCCR_IORDY Bits */
|
||||
#define SDIO_FUNC_READY_1 ( (uint32_t)0x02 ) /* function 1 I/O ready */
|
||||
#define SDIO_FUNC_READY_2 ( (uint32_t)0x04 ) /* function 2 I/O ready */
|
||||
#define SDIO_FUNC_READY_3 ( (uint32_t)0x08 ) /* function 3 I/O ready */
|
||||
|
||||
/* SDIOD_CCCR_INTEN Bits */
|
||||
#define INTR_CTL_MASTER_EN ( (uint32_t)0x01 ) /* interrupt enable master */
|
||||
#define INTR_CTL_FUNC1_EN ( (uint32_t)0x02 ) /* interrupt enable for function 1 */
|
||||
#define INTR_CTL_FUNC2_EN ( (uint32_t)0x04 ) /* interrupt enable for function 2 */
|
||||
|
||||
/* SDIOD_SEP_INT_CTL Bits */
|
||||
#define SEP_INTR_CTL_MASK ( (uint32_t)0x01 ) /* out-of-band interrupt mask */
|
||||
#define SEP_INTR_CTL_EN ( (uint32_t)0x02 ) /* out-of-band interrupt output enable */
|
||||
#define SEP_INTR_CTL_POL ( (uint32_t)0x04 ) /* out-of-band interrupt polarity */
|
||||
|
||||
/* SDIOD_CCCR_INTPEND Bits */
|
||||
#define INTR_STATUS_FUNC1 ( (uint32_t)0x02 ) /* interrupt pending for function 1 */
|
||||
#define INTR_STATUS_FUNC2 ( (uint32_t)0x04 ) /* interrupt pending for function 2 */
|
||||
#define INTR_STATUS_FUNC3 ( (uint32_t)0x08 ) /* interrupt pending for function 3 */
|
||||
|
||||
/* SDIOD_CCCR_IOABORT Bits */
|
||||
#define IO_ABORT_RESET_ALL ( (uint32_t)0x08 ) /* I/O card reset */
|
||||
#define IO_ABORT_FUNC_MASK ( (uint32_t)0x07 ) /* abort selction: function x */
|
||||
|
||||
/* SDIOD_CCCR_BICTRL Bits */
|
||||
#define BUS_CARD_DETECT_DIS ( (uint32_t)0x80 ) /* Card Detect disable */
|
||||
#define BUS_SPI_CONT_INTR_CAP ( (uint32_t)0x40 ) /* support continuous SPI interrupt */
|
||||
#define BUS_SPI_CONT_INTR_EN ( (uint32_t)0x20 ) /* continuous SPI interrupt enable */
|
||||
#define BUS_SD_DATA_WIDTH_MASK ( (uint32_t)0x03 ) /* bus width mask */
|
||||
#define BUS_SD_DATA_WIDTH_4BIT ( (uint32_t)0x02 ) /* bus width 4-bit mode */
|
||||
#define BUS_SD_DATA_WIDTH_1BIT ( (uint32_t)0x00 ) /* bus width 1-bit mode */
|
||||
|
||||
/* SDIOD_CCCR_CAPABLITIES Bits */
|
||||
#define SDIO_CAP_4BLS ( (uint32_t)0x80 ) /* 4-bit support for low speed card */
|
||||
#define SDIO_CAP_LSC ( (uint32_t)0x40 ) /* low speed card */
|
||||
#define SDIO_CAP_E4MI ( (uint32_t)0x20 ) /* enable interrupt between block of data in 4-bit mode */
|
||||
#define SDIO_CAP_S4MI ( (uint32_t)0x10 ) /* support interrupt between block of data in 4-bit mode */
|
||||
#define SDIO_CAP_SBS ( (uint32_t)0x08 ) /* support suspend/resume */
|
||||
#define SDIO_CAP_SRW ( (uint32_t)0x04 ) /* support read wait */
|
||||
#define SDIO_CAP_SMB ( (uint32_t)0x02 ) /* support multi-block transfer */
|
||||
#define SDIO_CAP_SDC ( (uint32_t)0x01 ) /* Support Direct commands during multi-byte transfer */
|
||||
|
||||
/* SDIOD_CCCR_POWER_CONTROL Bits */
|
||||
#define SDIO_POWER_SMPC ( (uint32_t)0x01 ) /* supports master power control (RO) */
|
||||
#define SDIO_POWER_EMPC ( (uint32_t)0x02 ) /* enable master power control (allow > 200mA) (RW) */
|
||||
|
||||
/* SDIOD_CCCR_SPEED_CONTROL Bits */
|
||||
#define SDIO_SPEED_SHS ( (uint32_t)0x01 ) /* supports high-speed [clocking] mode (RO) */
|
||||
#define SDIO_SPEED_EHS ( (uint32_t)0x02 ) /* enable high-speed [clocking] mode (RW) */
|
||||
|
||||
/* SDIOD_CCCR_BRCM_CARDCAP Bits */
|
||||
#define SDIOD_CCCR_BRCM_CARDCAP_CMD14_SUPPORT ( (uint32_t)0x02 ) /* Supports CMD14 */
|
||||
#define SDIOD_CCCR_BRCM_CARDCAP_CMD14_EXT ( (uint32_t)0x04 ) /* CMD14 is allowed in FSM command state */
|
||||
#define SDIOD_CCCR_BRCM_CARDCAP_CMD_NODEC ( (uint32_t)0x08 ) /* sdiod_aos does not decode any command */
|
||||
|
||||
/* SDIO_FUNCTION_INT_MASK Bits*/
|
||||
#define SDIO_FUNC_MASK_F1 ( (uint32_t)0x01 ) /* interrupt mask enable for function 1 */
|
||||
#define SDIO_FUNC_MASK_F2 ( (uint32_t)0x02 ) /* interrupt mask enable for function 2 */
|
||||
|
||||
/* SDIO_DEVICE_CONTROL Bits */
|
||||
#define SDIO_DATA_PAD_ISO ( (uint32_t)0x08 ) /* isolate internal SDIO data bus signals */
|
||||
|
||||
/* SDIO_CHIP_CLOCK_CSR Bits */
|
||||
#define SBSDIO_FORCE_ALP ( (uint32_t)0x01 ) /* Force ALP request to backplane */
|
||||
#define SBSDIO_FORCE_HT ( (uint32_t)0x02 ) /* Force HT request to backplane */
|
||||
#define SBSDIO_FORCE_ILP ( (uint32_t)0x04 ) /* Force ILP request to backplane */
|
||||
#define SBSDIO_ALP_AVAIL_REQ ( (uint32_t)0x08 ) /* Make ALP ready (power up xtal) */
|
||||
#define SBSDIO_HT_AVAIL_REQ ( (uint32_t)0x10 ) /* Make HT ready (power up PLL) */
|
||||
#define SBSDIO_FORCE_HW_CLKREQ_OFF ( (uint32_t)0x20 ) /* Squelch clock requests from HW */
|
||||
#define SBSDIO_ALP_AVAIL ( (uint32_t)0x40 ) /* Status: ALP is ready */
|
||||
#define SBSDIO_HT_AVAIL ( (uint32_t)0x80 ) /* Status: HT is ready */
|
||||
#define SBSDIO_Rev8_HT_AVAIL ( (uint32_t)0x40 )
|
||||
#define SBSDIO_Rev8_ALP_AVAIL ( (uint32_t)0x80 )
|
||||
|
||||
/* SDIO_FRAME_CONTROL Bits */
|
||||
#define SFC_RF_TERM ( (uint32_t)(1 << 0) ) /* Read Frame Terminate */
|
||||
#define SFC_WF_TERM ( (uint32_t)(1 << 1) ) /* Write Frame Terminate */
|
||||
#define SFC_CRC4WOOS ( (uint32_t)(1 << 2) ) /* HW reports CRC error for write out of sync */
|
||||
#define SFC_ABORTALL ( (uint32_t)(1 << 3) ) /* Abort cancels all in-progress frames */
|
||||
|
||||
/* SDIO_TO_SB_MAIL_BOX bits corresponding to intstatus bits */
|
||||
#define SMB_NAK ( (uint32_t)(1 << 0) ) /* To SB Mailbox Frame NAK */
|
||||
#define SMB_INT_ACK ( (uint32_t)(1 << 1) ) /* To SB Mailbox Host Interrupt ACK */
|
||||
#define SMB_USE_OOB ( (uint32_t)(1 << 2) ) /* To SB Mailbox Use OOB Wakeup */
|
||||
#define SMB_DEV_INT ( (uint32_t)(1 << 3) ) /* To SB Mailbox Miscellaneous Interrupt */
|
||||
|
||||
/* SDIO_WAKEUP_CTRL bits */
|
||||
#define SBSDIO_WCTRL_WAKE_TILL_ALP_AVAIL ( (uint32_t)(1 << 0) ) /* WakeTillAlpAvail bit */
|
||||
#define SBSDIO_WCTRL_WAKE_TILL_HT_AVAIL ( (uint32_t)(1 << 1) ) /* WakeTillHTAvail bit */
|
||||
|
||||
/* SDIO_SLEEP_CSR bits */
|
||||
#define SBSDIO_SLPCSR_KEEP_SDIO_ON ( (uint32_t)(1 << 0) ) /* KeepSdioOn bit */
|
||||
#define SBSDIO_SLPCSR_DEVICE_ON ( (uint32_t)(1 << 1) ) /* DeviceOn bit */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* ifndef INCLUDED_WHD_SDIO_H_ */
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_WHD_SPI_H_
|
||||
#define INCLUDED_WHD_SPI_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* SPI Constants
|
||||
******************************************************/
|
||||
/* GSPI v1 */
|
||||
#define SPI_FRAME_CONTROL ( (uint32_t)0x1000D )
|
||||
|
||||
/* Register addresses */
|
||||
#define SPI_BUS_CONTROL ( (uint32_t)0x0000 )
|
||||
#define SPI_RESPONSE_DELAY ( (uint32_t)0x0001 )
|
||||
#define SPI_STATUS_ENABLE ( (uint32_t)0x0002 )
|
||||
#define SPI_RESET_BP ( (uint32_t)0x0003 ) /* (corerev >= 1) */
|
||||
#define SPI_INTERRUPT_REGISTER ( (uint32_t)0x0004 ) /* 16 bits - Interrupt status */
|
||||
#define SPI_INTERRUPT_ENABLE_REGISTER ( (uint32_t)0x0006 ) /* 16 bits - Interrupt mask */
|
||||
#define SPI_STATUS_REGISTER ( (uint32_t)0x0008 ) /* 32 bits */
|
||||
#define SPI_FUNCTION1_INFO ( (uint32_t)0x000C ) /* 16 bits */
|
||||
#define SPI_FUNCTION2_INFO ( (uint32_t)0x000E ) /* 16 bits */
|
||||
#define SPI_FUNCTION3_INFO ( (uint32_t)0x0010 ) /* 16 bits */
|
||||
#define SPI_READ_TEST_REGISTER ( (uint32_t)0x0014 ) /* 32 bits */
|
||||
#define SPI_RESP_DELAY_F0 ( (uint32_t)0x001c ) /* 8 bits (corerev >= 3) */
|
||||
#define SPI_RESP_DELAY_F1 ( (uint32_t)0x001d ) /* 8 bits (corerev >= 3) */
|
||||
#define SPI_RESP_DELAY_F2 ( (uint32_t)0x001e ) /* 8 bits (corerev >= 3) */
|
||||
#define SPI_RESP_DELAY_F3 ( (uint32_t)0x001f ) /* 8 bits (corerev >= 3) */
|
||||
|
||||
/******************************************************
|
||||
* Bit Masks
|
||||
******************************************************/
|
||||
|
||||
/* GSPI */
|
||||
#define SPI_READ_TEST_REGISTER_VALUE ( (uint32_t)0xFEEDBEAD )
|
||||
#define SPI_READ_TEST_REG_LSB ( ( (SPI_READ_TEST_REGISTER_VALUE) ) & 0xff )
|
||||
#define SPI_READ_TEST_REG_LSB_SFT1 ( ( (SPI_READ_TEST_REGISTER_VALUE << 1) ) & 0xff )
|
||||
#define SPI_READ_TEST_REG_LSB_SFT2 ( ( (SPI_READ_TEST_REGISTER_VALUE << 1) + 1 ) & 0xff )
|
||||
#define SPI_READ_TEST_REG_LSB_SFT3 ( ( (SPI_READ_TEST_REGISTER_VALUE + 1) << 1 ) & 0xff )
|
||||
|
||||
/* SPI_BUS_CONTROL Bits */
|
||||
#define WORD_LENGTH_32 ( (uint32_t)0x01 ) /* 0/1 16/32 bit word length */
|
||||
#define ENDIAN_BIG ( (uint32_t)0x02 ) /* 0/1 Little/Big Endian */
|
||||
#define CLOCK_PHASE ( (uint32_t)0x04 ) /* 0/1 clock phase delay */
|
||||
#define CLOCK_POLARITY ( (uint32_t)0x08 ) /* 0/1 Idle state clock polarity is low/high */
|
||||
#define HIGH_SPEED_MODE ( (uint32_t)0x10 ) /* 1/0 High Speed mode / Normal mode */
|
||||
#define INTERRUPT_POLARITY_HIGH ( (uint32_t)0x20 ) /* 1/0 Interrupt active polarity is high/low */
|
||||
#define WAKE_UP ( (uint32_t)0x80 ) /* 0/1 Wake-up command from Host to WLAN */
|
||||
|
||||
/* SPI_RESPONSE_DELAY Bit mask */
|
||||
#define RESPONSE_DELAY_MASK 0xFF /* Configurable rd response delay in multiples of 8 bits */
|
||||
|
||||
/* SPI_STATUS_ENABLE Bits */
|
||||
#define STATUS_ENABLE ( (uint32_t)0x01 ) /* 1/0 Status sent/not sent to host after read/write */
|
||||
#define INTR_WITH_STATUS ( (uint32_t)0x02 ) /* 0/1 Do-not / do-interrupt if status is sent */
|
||||
#define RESP_DELAY_ALL ( (uint32_t)0x04 ) /* Applicability of resp delay to F1 or all func's read */
|
||||
#define DWORD_PKT_LEN_EN ( (uint32_t)0x08 ) /* Packet len denoted in dwords instead of bytes */
|
||||
#define CMD_ERR_CHK_EN ( (uint32_t)0x20 ) /* Command error check enable */
|
||||
#define DATA_ERR_CHK_EN ( (uint32_t)0x40 ) /* Data error check enable */
|
||||
|
||||
/* SPI_RESET_BP Bits*/
|
||||
#define RESET_ON_WLAN_BP_RESET ( (uint32_t)0x04 ) /* enable reset for WLAN backplane */
|
||||
#define RESET_SPI ( (uint32_t)0x80 ) /* reset the above enabled logic */
|
||||
|
||||
/* SPI_INTERRUPT_REGISTER and SPI_INTERRUPT_ENABLE_REGISTER Bits */
|
||||
#define DATA_UNAVAILABLE ( (uint32_t)0x0001 ) /* Requested data not available; Clear by writing a "1" */
|
||||
#define F2_F3_FIFO_RD_UNDERFLOW ( (uint32_t)0x0002 )
|
||||
#define F2_F3_FIFO_WR_OVERFLOW ( (uint32_t)0x0004 )
|
||||
#define COMMAND_ERROR ( (uint32_t)0x0008 ) /* Cleared by writing 1 */
|
||||
#define DATA_ERROR ( (uint32_t)0x0010 ) /* Cleared by writing 1 */
|
||||
#define F2_PACKET_AVAILABLE ( (uint32_t)0x0020 )
|
||||
#define F3_PACKET_AVAILABLE ( (uint32_t)0x0040 )
|
||||
#define F1_OVERFLOW ( (uint32_t)0x0080 ) /* Due to last write. Bkplane has pending write requests */
|
||||
#define MISC_INTR0 ( (uint32_t)0x0100 )
|
||||
#define MISC_INTR1 ( (uint32_t)0x0200 )
|
||||
#define MISC_INTR2 ( (uint32_t)0x0400 )
|
||||
#define MISC_INTR3 ( (uint32_t)0x0800 )
|
||||
#define MISC_INTR4 ( (uint32_t)0x1000 )
|
||||
#define F1_INTR ( (uint32_t)0x2000 )
|
||||
#define F2_INTR ( (uint32_t)0x4000 )
|
||||
#define F3_INTR ( (uint32_t)0x8000 )
|
||||
|
||||
/* SPI_STATUS_REGISTER Bits */
|
||||
#define STATUS_DATA_NOT_AVAILABLE ( (uint32_t)0x00000001 )
|
||||
#define STATUS_UNDERFLOW ( (uint32_t)0x00000002 )
|
||||
#define STATUS_OVERFLOW ( (uint32_t)0x00000004 )
|
||||
#define STATUS_F2_INTR ( (uint32_t)0x00000008 )
|
||||
#define STATUS_F3_INTR ( (uint32_t)0x00000010 )
|
||||
#define STATUS_F2_RX_READY ( (uint32_t)0x00000020 )
|
||||
#define STATUS_F3_RX_READY ( (uint32_t)0x00000040 )
|
||||
#define STATUS_HOST_CMD_DATA_ERR ( (uint32_t)0x00000080 )
|
||||
#define STATUS_F2_PKT_AVAILABLE ( (uint32_t)0x00000100 )
|
||||
#define STATUS_F2_PKT_LEN_MASK ( (uint32_t)0x000FFE00 )
|
||||
#define STATUS_F2_PKT_LEN_SHIFT ( (uint32_t)9 )
|
||||
#define STATUS_F3_PKT_AVAILABLE ( (uint32_t)0x00100000 )
|
||||
#define STATUS_F3_PKT_LEN_MASK ( (uint32_t)0xFFE00000 )
|
||||
#define STATUS_F3_PKT_LEN_SHIFT ( (uint32_t)21 )
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* ifndef INCLUDED_WHD_SPI_H_ */
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* Provides prototypes / declarations for APSTA functionality
|
||||
*/
|
||||
#ifndef INCLUDED_WHD_AP_H
|
||||
#define INCLUDED_WHD_AP_H
|
||||
|
||||
#include "whd.h"
|
||||
#include "cyabs_rtos.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
#define AMPDU_RX_FACTOR_8K 0 /* max receive AMPDU length is 8kb */
|
||||
#define AMPDU_RX_FACTOR_16K 1 /* max receive AMPDU length is 16kb */
|
||||
#define AMPDU_RX_FACTOR_32K 2 /* max receive AMPDU length is 32kb */
|
||||
#define AMPDU_RX_FACTOR_64K 3 /* max receive AMPDU length is 64kb */
|
||||
#define AMPDU_RX_FACTOR_INVALID 0xff /* invalid rx factor; ignore */
|
||||
#define AMPDU_MPDU_AUTO (-1) /* Auto number of mpdu in ampdu */
|
||||
|
||||
|
||||
#define BANDWIDTH_20MHZ (20) /* 802.11n, 802.11ac 20Mhz Bandwidth */
|
||||
#define BANDWIDTH_40MHZ (40) /* 802.11n, 802.11ac 40Mhz Bandwidth */
|
||||
#define BANDWIDTH_80MHZ (80) /* 802.11ac 80Mhz Bandwidth */
|
||||
|
||||
#define WHD_WIFI_CONFIG_AP_MAX_ASSOC 5
|
||||
|
||||
#define CHECK_IOCTL_BUFFER_WITH_SEMAPHORE(buff, \
|
||||
sema) if (buff == \
|
||||
NULL){ WPRINT_WHD_ERROR( ("Buffer alloc failed in %s at %d \n", \
|
||||
__func__, __LINE__) ); \
|
||||
whd_assert("Buffer alloc failed\n", 0 == 1); \
|
||||
(void)cy_rtos_deinit_semaphore(sema); \
|
||||
return WHD_BUFFER_ALLOC_FAIL; }
|
||||
|
||||
#define CHECK_RETURN_WITH_SEMAPHORE(expr, sema) { whd_result_t check_res = (expr); if (check_res != WHD_SUCCESS) \
|
||||
{ WPRINT_WHD_ERROR( ("Command failed in %s at %d \n", __func__, \
|
||||
__LINE__) ); \
|
||||
whd_assert("Command failed\n", 0 == 1); \
|
||||
(void)cy_rtos_deinit_semaphore(sema); \
|
||||
return check_res; } }
|
||||
|
||||
/******************************************************
|
||||
* Structures
|
||||
******************************************************/
|
||||
typedef struct whd_ap_int_info
|
||||
{
|
||||
whd_bool_t ap_is_up;
|
||||
cy_semaphore_t whd_wifi_sleep_flag;
|
||||
|
||||
} whd_ap_int_info_t;
|
||||
|
||||
/******************************************************
|
||||
* Function prototypes
|
||||
******************************************************/
|
||||
extern whd_result_t whd_wifi_set_block_ack_window_size_common(whd_interface_t interface, uint16_t ap_win_size,
|
||||
uint16_t sta_win_size);
|
||||
extern whd_result_t whd_wifi_set_ampdu_parameters_common(whd_interface_t interface, uint8_t ba_window_size,
|
||||
int8_t ampdu_mpdu, uint8_t rx_factor);
|
||||
extern void whd_wifi_set_ap_is_up(whd_driver_t whd_driver, whd_bool_t new_state);
|
||||
extern whd_bool_t whd_wifi_get_ap_is_up(whd_driver_t whd_driver);
|
||||
void whd_ap_info_init(whd_driver_t whd_driver);
|
||||
whd_result_t whd_wifi_set_block_ack_window_size(whd_interface_t ifp);
|
||||
|
||||
|
||||
/** Set the AMPDU parameters for both Soft AP and STA
|
||||
*
|
||||
* Sets various AMPDU parameters for Soft AP and STA to ensure that the number of buffers dedicated to AMPDUs does
|
||||
* not exceed the resources of the chip. Both Soft AP and STA interfaces must be down.
|
||||
*
|
||||
* @return WHD_SUCCESS : if the AMPDU parameters were successfully set
|
||||
* WHD_ERROR : if the AMPDU parameters were not successfully set
|
||||
*/
|
||||
extern whd_result_t whd_wifi_set_ampdu_parameters(whd_interface_t ifp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* ifndef INCLUDED_WHD_AP_H */
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* Provides prototypes / declarations for common APSTA functionality
|
||||
*/
|
||||
#ifndef _WHD_INTERNAL_BUFFER_API_H_
|
||||
#define _WHD_INTERNAL_BUFFER_API_H_
|
||||
|
||||
#include "whd.h"
|
||||
#include "whd_int.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Structures
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Function prototypes
|
||||
******************************************************/
|
||||
/** Allocates a packet buffer
|
||||
*
|
||||
* Implemented in the port layer interface which is specific to the
|
||||
* buffering scheme in use.
|
||||
* Attempts to allocate a packet buffer of the size requested. It can do this
|
||||
* by allocating a pre-existing packet from a pool, using a static buffer,
|
||||
* or by dynamically allocating memory. The method of allocation does not
|
||||
* concern WHD, however it must match the way the network stack expects packet
|
||||
* buffers to be allocated.
|
||||
*
|
||||
* @param buffer : A pointer which receives the allocated packet buffer handle
|
||||
* @param direction : Indicates transmit/receive direction that the packet buffer is
|
||||
* used for. This may be needed if tx/rx pools are separate.
|
||||
* @param size : The number of bytes to allocate.
|
||||
* @param wait : Whether to wait for a packet buffer to be available
|
||||
*
|
||||
* @return : WHD_SUCCESS or error code
|
||||
*
|
||||
*/
|
||||
whd_result_t whd_host_buffer_get(whd_driver_t whd_driver, whd_buffer_t *buffer, whd_buffer_dir_t direction,
|
||||
uint16_t size, uint32_t wait);
|
||||
|
||||
/** Releases a packet buffer
|
||||
*
|
||||
* Implemented in the port layer interface, which will be specific to the
|
||||
* buffering scheme in use.
|
||||
* This function is used by WHD to indicate that it no longer requires
|
||||
* a packet buffer. The buffer can then be released back into a pool for
|
||||
* reuse, or the dynamically allocated memory can be freed, according to
|
||||
* how the packet was allocated.
|
||||
* Returns void since WHD cannot do anything about failures
|
||||
*
|
||||
* @param buffer : The handle of the packet buffer to be released
|
||||
* @param direction : Indicates transmit/receive direction that the packet buffer has
|
||||
* been used for. This might be needed if tx/rx pools are separate.
|
||||
*
|
||||
*/
|
||||
whd_result_t whd_buffer_release(whd_driver_t whd_driver, whd_buffer_t buffer, whd_buffer_dir_t direction);
|
||||
|
||||
/** Retrieves the current pointer of a packet buffer
|
||||
*
|
||||
* Implemented in the port layer interface which is specific to the
|
||||
* buffering scheme in use.
|
||||
* Since packet buffers usually need to be created with space at the
|
||||
* front for additional headers, this function allows WHD to get
|
||||
* the current 'front' location pointer.
|
||||
*
|
||||
* @param buffer : The handle of the packet buffer whose pointer is to be retrieved
|
||||
*
|
||||
* @return : The packet buffer's current pointer.
|
||||
*/
|
||||
uint8_t *whd_buffer_get_current_piece_data_pointer(whd_driver_t whd_driver, whd_buffer_t buffer);
|
||||
|
||||
/** Retrieves the size of a packet buffer
|
||||
*
|
||||
* Implemented in the port layer interface which is specific to the
|
||||
* buffering scheme in use.
|
||||
* Since packet buffers usually need to be created with space at the
|
||||
* front for additional headers, the memory block used to contain a packet buffer
|
||||
* will often be larger than the current size of the packet buffer data.
|
||||
* This function allows WHD to retrieve the current size of a packet buffer's data.
|
||||
*
|
||||
* @param buffer : The handle of the packet buffer whose size is to be retrieved
|
||||
*
|
||||
* @return : The size of the packet buffer.
|
||||
*/
|
||||
uint16_t whd_buffer_get_current_piece_size(whd_driver_t whd_driver, whd_buffer_t buffer);
|
||||
|
||||
/** Sets the current size of a WHD packet
|
||||
*
|
||||
*
|
||||
* Implemented in the port layer interface which is specific to the
|
||||
* buffering scheme in use.
|
||||
* This function sets the current length of a WHD packet buffer
|
||||
*
|
||||
* @param buffer : The packet to be modified
|
||||
* @param size : The new size of the packet buffer
|
||||
*
|
||||
* @return : WHD_SUCCESS or error code
|
||||
*/
|
||||
whd_result_t whd_buffer_set_size(whd_driver_t whd_driver, whd_buffer_t buffer, uint16_t size);
|
||||
|
||||
/** Moves the current pointer of a packet buffer
|
||||
*
|
||||
* Implemented in the port layer interface which is specific to the buffering scheme in use.
|
||||
*
|
||||
* Since packet buffers usually need to be created with space at the front for additional headers,
|
||||
* this function allows WHD to move the current 'front' location pointer so that it has space to
|
||||
* add headers to transmit packets, and so that the network stack does not see the internal WHD
|
||||
* headers on received packets.
|
||||
*
|
||||
* @param buffer : A pointer to the handle of the current packet buffer for which the
|
||||
* current pointer will be moved. On return this may contain a pointer
|
||||
* to a newly allocated packet buffer which has been daisy chained to
|
||||
* the front of the given one. This would be the case if the given packet
|
||||
* buffer didn't have enough space at the front.
|
||||
* @param add_remove_amount : This is the number of bytes to move the current pointer of the packet
|
||||
* buffer - a negative value increases the space for headers at the front
|
||||
* of the packet, a positive value decreases the space.
|
||||
*
|
||||
* @return : WHD_SUCCESS or error code
|
||||
*/
|
||||
whd_result_t whd_buffer_add_remove_at_front(whd_driver_t whd_driver, whd_buffer_t *buffer, int32_t add_remove_amount);
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* ifndef _WHD_INTERNAL_BUFFER_API_H_ */
|
||||
|
|
@ -0,0 +1,157 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_WHD_CDC_BDC_H
|
||||
#define INCLUDED_WHD_CDC_BDC_H
|
||||
|
||||
#include "whd.h"
|
||||
#include "cyabs_rtos.h"
|
||||
#include "whd_events_int.h"
|
||||
#include "whd_types_int.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
|
||||
/* CDC flag definition taken from bcmcdc.h */
|
||||
#define CDCF_IOC_SET (0x02) /** 0=get, 1=set cmd */
|
||||
#define WHD_EVENT_HANDLER_LIST_SIZE (5) /** Maximum number of simultaneously registered event handlers */
|
||||
#define WHD_SDALIGN 32
|
||||
|
||||
/* CDC flag definitions taken from bcmcdc.h */
|
||||
#define CDCF_IOC_ERROR (0x01) /** 0=success, 1=ioctl cmd failed */
|
||||
#define CDCF_IOC_IF_MASK (0xF000) /** I/F index */
|
||||
#define CDCF_IOC_IF_SHIFT (12) /** # of bits of shift for I/F Mask */
|
||||
#define CDCF_IOC_ID_MASK (0xFFFF0000) /** used to uniquely id an ioctl req/resp pairing */
|
||||
#define CDCF_IOC_ID_SHIFT (16) /** # of bits of shift for ID Mask */
|
||||
|
||||
#define DATA_AFTER_HEADER(x) ( (void *)(&x[1]) )
|
||||
|
||||
#define BDC_HEADER_LEN (4)
|
||||
|
||||
/******************************************************
|
||||
* Enumerations
|
||||
******************************************************/
|
||||
|
||||
typedef enum sdpcm_command_type_enum
|
||||
{
|
||||
CDC_GET = 0x00,
|
||||
CDC_SET = CDCF_IOC_SET
|
||||
} cdc_command_type_t;
|
||||
|
||||
/******************************************************
|
||||
* Structures
|
||||
******************************************************/
|
||||
#pragma pack(1)
|
||||
typedef struct
|
||||
{
|
||||
uint32_t cmd; /* ioctl command value */
|
||||
uint32_t len; /* lower 16: output buflen; upper 16: input buflen (excludes header) */
|
||||
uint32_t flags; /* flag defns given in bcmcdc.h */
|
||||
uint32_t status; /* status code returned from the device */
|
||||
} cdc_header_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t flags; /* Flags */
|
||||
uint8_t priority; /* 802.1d Priority (low 3 bits) */
|
||||
uint8_t flags2;
|
||||
uint8_t data_offset; /* Offset from end of BDC header to packet data, in 4-uint8_t words.
|
||||
* Leaves room for optional headers.*/
|
||||
} bdc_header_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
whd_mac_t destination_address;
|
||||
whd_mac_t source_address;
|
||||
uint16_t ethertype;
|
||||
} ethernet_header_t;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
/** Event list element structure
|
||||
*
|
||||
* events : A pointer to a whd_event_num_t array that is terminated with a WLC_E_NONE event
|
||||
* handler: A pointer to the whd_event_handler_t function that will receive the event
|
||||
* handler_user_data : User provided data that will be passed to the handler when a matching event occurs
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
whd_bool_t event_set;
|
||||
whd_event_num_t events[WHD_MAX_EVENT_SUBSCRIPTION];
|
||||
whd_event_handler_t handler;
|
||||
void *handler_user_data;
|
||||
uint8_t ifidx;
|
||||
} event_list_elem_t;
|
||||
|
||||
/** @endcond */
|
||||
|
||||
typedef struct whd_cdc_info
|
||||
{
|
||||
/* Event list variables */
|
||||
event_list_elem_t whd_event_list[WHD_EVENT_HANDLER_LIST_SIZE];
|
||||
cy_semaphore_t event_list_mutex;
|
||||
|
||||
/* IOCTL variables*/
|
||||
uint16_t requested_ioctl_id;
|
||||
cy_semaphore_t ioctl_mutex;
|
||||
whd_buffer_t ioctl_response;
|
||||
cy_semaphore_t ioctl_sleep;
|
||||
|
||||
} whd_cdc_bdc_info_t;
|
||||
|
||||
/******************************************************
|
||||
* Function Declarations
|
||||
******************************************************/
|
||||
|
||||
whd_result_t whd_cdc_bdc_info_init(whd_driver_t whd_driver);
|
||||
|
||||
whd_result_t whd_cdc_send_iovar(whd_interface_t ifp, cdc_command_type_t type,
|
||||
whd_buffer_t send_buffer_hnd,
|
||||
whd_buffer_t *response_buffer_hnd);
|
||||
|
||||
whd_result_t whd_cdc_send_ioctl(whd_interface_t ifp, cdc_command_type_t type, uint32_t command,
|
||||
whd_buffer_t send_buffer_hnd,
|
||||
whd_buffer_t *response_buffer_hnd);
|
||||
|
||||
void *whd_cdc_get_iovar_buffer(whd_driver_t whd_driver,
|
||||
whd_buffer_t *buffer,
|
||||
uint16_t data_length,
|
||||
const char *name);
|
||||
void whd_network_send_ethernet_data(whd_interface_t ifp, whd_buffer_t buffer);
|
||||
|
||||
void *whd_cdc_get_ioctl_buffer(whd_driver_t whd_driver,
|
||||
whd_buffer_t *buffer,
|
||||
uint16_t data_length);
|
||||
|
||||
void whd_process_cdc(whd_driver_t whd_driver, whd_buffer_t buffer);
|
||||
|
||||
void whd_process_bdc(whd_driver_t whd_driver, whd_buffer_t buffer);
|
||||
|
||||
void whd_process_bdc_event(whd_driver_t whd_driver, whd_buffer_t buffer, uint16_t size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* ifndef INCLUDED_WHD_CDC_BDC_H */
|
||||
|
|
@ -0,0 +1,393 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_WHD_CHIP_H
|
||||
#define INCLUDED_WHD_CHIP_H
|
||||
|
||||
#include "cyabs_rtos.h" /* For cy_semaphore_t */
|
||||
|
||||
#include "whd_endian.h"
|
||||
#include "whd.h"
|
||||
#include "whd_wifi_api.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
#define WHD_WLAN_WAKE_TIMEOUT (10000)
|
||||
#define WHD_SHARED_MEMORY_POLLING_DELAY (10)
|
||||
#define SICF_CPUHALT (0x0020)
|
||||
|
||||
/******************************************************
|
||||
* Enumerations
|
||||
******************************************************/
|
||||
/**
|
||||
* Enumerated list of aggregate codes and edit WHD_COUNTRY_AGGREGATE_CUSTOMER for supporting new aggregate
|
||||
* as per customer like XZ/278
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
WHD_COUNTRY_AGGREGATE_XA_0 = MK_CNTRY('X', 'A', 0),
|
||||
WHD_COUNTRY_AGGREGATE_XT_0 = MK_CNTRY('X', 'T', 0),
|
||||
WHD_COUNTRY_AGGREGATE_XV_0 = MK_CNTRY('X', 'V', 0),
|
||||
WHD_COUNTRY_AGGREGATE_CUSTOMER = MK_CNTRY('X', 'Z', 278),
|
||||
} whd_aggregate_code_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
/* Note : If changing this, core_base_address must be changed also */
|
||||
WLAN_ARM_CORE = 0, SOCRAM_CORE = 1, SDIOD_CORE = 2
|
||||
} device_core_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
WLAN_DOWN, WLAN_UP, WLAN_OFF
|
||||
} wlan_state_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
WLAN_CORE_FLAG_NONE, WLAN_CORE_FLAG_CPU_HALT,
|
||||
} wlan_core_flag_t;
|
||||
|
||||
/**
|
||||
* Enumeration of AKM (authentication and key management) suites. Table 8-140 802.11mc D3.0.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
WHD_AKM_RESERVED = 0,
|
||||
WHD_AKM_8021X = 1, /**< WPA2 enterprise */
|
||||
WHD_AKM_PSK = 2, /**< WPA2 PSK */
|
||||
WHD_AKM_FT_8021X = 3, /**< 802.11r Fast Roaming enterprise */
|
||||
WHD_AKM_FT_PSK = 4, /**< 802.11r Fast Roaming PSK */
|
||||
WHD_AKM_8021X_SHA256 = 5,
|
||||
WHD_AKM_PSK_SHA256 = 6,
|
||||
WHD_AKM_TDLS = 7, /**< Tunneled Direct Link Setup */
|
||||
WHD_AKM_SAE_SHA256 = 8,
|
||||
WHD_AKM_FT_SAE_SHA256 = 9,
|
||||
WHD_AKM_AP_PEER_KEY_SHA256 = 10,
|
||||
WHD_AKM_SUITEB_8021X_HMAC_SHA256 = 11,
|
||||
WHD_AKM_SUITEB_8021X_HMAC_SHA384 = 12,
|
||||
WHD_AKM_SUITEB_FT_8021X_HMAC_SHA384 = 13,
|
||||
} whd_akm_suite_t;
|
||||
|
||||
/**
|
||||
* Enumeration of cipher suites. Table 8-138 802.11mc D3.0.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
WHD_CIPHER_GROUP = 0, /**< Use group cipher suite */
|
||||
WHD_CIPHER_WEP_40 = 1, /**< WEP-40 */
|
||||
WHD_CIPHER_TKIP = 2, /**< TKIP */
|
||||
WHD_CIPHER_RESERVED = 3, /**< Reserved */
|
||||
WHD_CIPHER_CCMP_128 = 4, /**< CCMP-128 - default pairwise and group cipher suite in an RSNA */
|
||||
WHD_CIPHER_WEP_104 = 5, /**< WEP-104 - also known as WEP-128 */
|
||||
WHD_CIPHER_BIP_CMAC_128 = 6, /**< BIP-CMAC-128 - default management frame cipher suite */
|
||||
WHD_CIPHER_GROUP_DISALLOWED = 7, /**< Group address traffic not allowed */
|
||||
WHD_CIPHER_GCMP_128 = 8, /**< GCMP-128 - default for 60 GHz STAs */
|
||||
WHD_CIPHER_GCMP_256 = 9, /**< GCMP-256 - introduced for Suite B */
|
||||
WHD_CIPHER_CCMP_256 = 10, /**< CCMP-256 - introduced for suite B */
|
||||
WHD_CIPHER_BIP_GMAC_128 = 11, /**< BIP-GMAC-128 - introduced for suite B */
|
||||
WHD_CIPHER_BIP_GMAC_256 = 12, /**< BIP-GMAC-256 - introduced for suite B */
|
||||
WHD_CIPHER_BIP_CMAC_256 = 13, /**< BIP-CMAC-256 - introduced for suite B */
|
||||
} whd_80211_cipher_t;
|
||||
|
||||
/******************************************************
|
||||
* Structures
|
||||
******************************************************/
|
||||
|
||||
typedef struct whd_chip_info
|
||||
{
|
||||
uint16_t chip_id;
|
||||
whd_bool_t save_restore_enable;
|
||||
|
||||
} whd_chip_info_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
wlan_state_t state;
|
||||
whd_country_code_t country_code;
|
||||
whd_aggregate_code_t aggregate_code;
|
||||
uint32_t keep_wlan_awake;
|
||||
} whd_wlan_status_t;
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
/* 802.11 Information Element structures */
|
||||
|
||||
/* Country Information */
|
||||
#define COUNTRY_INFO_IE_MINIMUM_LENGTH (6)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t first_chan_num;
|
||||
uint8_t num_chans;
|
||||
uint8_t max_tx_pwr_level;
|
||||
} country_chan_info_t;
|
||||
|
||||
/* Structures for TLVs with 8-bit type and 8-bit length */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t type;
|
||||
uint8_t length;
|
||||
} whd_tlv8_header_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t type;
|
||||
uint8_t length;
|
||||
uint8_t data[1];
|
||||
} whd_tlv8_data_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
whd_tlv8_header_t tlv_header; /* id, length */
|
||||
char ccode[2]; /* dot11CountryString MIB octet 1~2, two letter country code */
|
||||
uint8_t env; /* dot11CountryString MIB octet 3, indicate indoor/outdoor environment */
|
||||
country_chan_info_t country_chan_info[1]; /* At least one country channel info triples */
|
||||
} country_info_ie_fixed_portion_t;
|
||||
|
||||
/* Robust Secure Network */
|
||||
typedef struct
|
||||
{
|
||||
whd_tlv8_header_t tlv_header; /* id, length */
|
||||
uint16_t version;
|
||||
uint32_t group_key_suite; /* See whd_80211_cipher_t for values */
|
||||
uint16_t pairwise_suite_count;
|
||||
uint32_t pairwise_suite_list[1];
|
||||
} rsn_ie_fixed_portion_t;
|
||||
|
||||
#define RSN_IE_MINIMUM_LENGTH (8)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
whd_tlv8_header_t tlv_header; /* id, length */
|
||||
uint8_t oui[4];
|
||||
} vendor_specific_ie_header_t;
|
||||
|
||||
#define VENDOR_SPECIFIC_IE_MINIMUM_LENGTH (4)
|
||||
|
||||
/* WPA IE */
|
||||
typedef struct
|
||||
{
|
||||
vendor_specific_ie_header_t vendor_specific_header;
|
||||
uint16_t version;
|
||||
uint32_t multicast_suite;
|
||||
uint16_t unicast_suite_count;
|
||||
uint8_t unicast_suite_list[1][4];
|
||||
} wpa_ie_fixed_portion_t;
|
||||
|
||||
#define WPA_IE_MINIMUM_LENGTH (12)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t akm_suite_count;
|
||||
uint32_t akm_suite_list[1];
|
||||
} akm_suite_portion_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
whd_tlv8_header_t tlv_header; /* id, length */
|
||||
uint16_t ht_capabilities_info;
|
||||
uint8_t ampdu_parameters;
|
||||
uint8_t rx_mcs[10];
|
||||
uint16_t rxhighest_supported_data_rate;
|
||||
uint8_t tx_supported_mcs_set;
|
||||
uint8_t tx_mcs_info[3];
|
||||
uint16_t ht_extended_capabilities;
|
||||
uint32_t transmit_beam_forming_capabilities;
|
||||
uint8_t antenna_selection_capabilities;
|
||||
} ht_capabilities_ie_t;
|
||||
|
||||
#define HT_CAPABILITIES_INFO_LDPC_CODING_CAPABILITY (1 << 0)
|
||||
#define HT_CAPABILITIES_INFO_SUPPORTED_CHANNEL_WIDTH_SET (1 << 1)
|
||||
#define HT_CAPABILITIES_INFO_SM_POWER_SAVE_OFFSET (1 << 2)
|
||||
#define HT_CAPABILITIES_INFO_SM_POWER_SAVE_MASK (3 << 2)
|
||||
#define HT_CAPABILITIES_INFO_HT_GREENFIELD (1 << 4)
|
||||
#define HT_CAPABILITIES_INFO_SHORT_GI_FOR_20MHZ (1 << 5)
|
||||
#define HT_CAPABILITIES_INFO_SHORT_GI_FOR_40MHZ (1 << 6)
|
||||
#define HT_CAPABILITIES_INFO_TX_STBC (1 << 7)
|
||||
#define HT_CAPABILITIES_INFO_RX_STBC_OFFSET (1 << 8)
|
||||
#define HT_CAPABILITIES_INFO_RX_STBC_MASK (3 << 8)
|
||||
#define HT_CAPABILITIES_INFO_HT_DELAYED_BLOCK_ACK (1 << 10)
|
||||
#define HT_CAPABILITIES_INFO_MAXIMUM_A_MSDU_LENGTH (1 << 11)
|
||||
#define HT_CAPABILITIES_INFO_DSSS_CCK_MODE_IN_40MHZ (1 << 12)
|
||||
/* bit 13 reserved */
|
||||
#define HT_CAPABILITIES_INFO_40MHZ_INTOLERANT (1 << 14)
|
||||
#define HT_CAPABILITIES_INFO_L_SIG_TXOP_PROTECTION_SUPPORT (1 << 15)
|
||||
|
||||
typedef unsigned int uint;
|
||||
typedef struct
|
||||
{
|
||||
uint buf;
|
||||
uint buf_size;
|
||||
uint idx;
|
||||
uint out_idx; /* output index */
|
||||
} hnd_log_t;
|
||||
|
||||
#define CBUF_LEN 128
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* Virtual UART
|
||||
* When there is no UART (e.g. Quickturn), the host should write a complete
|
||||
* input line directly into cbuf and then write the length into vcons_in.
|
||||
* This may also be used when there is a real UART (at risk of conflicting with
|
||||
* the real UART). vcons_out is currently unused.
|
||||
*/
|
||||
volatile uint vcons_in;
|
||||
volatile uint vcons_out;
|
||||
|
||||
/* Output (logging) buffer
|
||||
* Console output is written to a ring buffer log_buf at index log_idx.
|
||||
* The host may read the output when it sees log_idx advance.
|
||||
* Output will be lost if the output wraps around faster than the host polls.
|
||||
*/
|
||||
hnd_log_t log;
|
||||
|
||||
/* Console input line buffer
|
||||
* Characters are read one at a time into cbuf until <CR> is received, then
|
||||
* the buffer is processed as a command line. Also used for virtual UART.
|
||||
*/
|
||||
uint cbuf_idx;
|
||||
char cbuf[CBUF_LEN];
|
||||
} hnd_cons_t;
|
||||
|
||||
typedef struct wifi_console
|
||||
{
|
||||
uint count; /* Poll interval msec counter */
|
||||
uint log_addr; /* Log struct address (fixed) */
|
||||
hnd_log_t log; /* Log struct (host copy) */
|
||||
uint bufsize; /* Size of log buffer */
|
||||
char *buf; /* Log buffer (host copy) */
|
||||
uint last; /* Last buffer read index */
|
||||
} wifi_console_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint flags;
|
||||
uint trap_addr;
|
||||
uint assert_exp_addr;
|
||||
uint assert_file_addr;
|
||||
uint assert_line;
|
||||
uint console_addr;
|
||||
uint msgtrace_addr;
|
||||
uint fwid;
|
||||
} wlan_shared_t;
|
||||
|
||||
/* Buffer size to be allocated to read wlan log */
|
||||
#define WLAN_LOG_BUF_LEN (4 * 1024)
|
||||
|
||||
#define WHD_IOCTL_LOG_SIZE 64
|
||||
#define WHD_IOVAR_STRING_SIZE 128
|
||||
#define WHD_MAX_DATA_SIZE 64
|
||||
|
||||
#define WHD_IOCTL_LOG_ADD(x, y, z) whd_ioctl_log_add(x, y, z)
|
||||
#define WHD_IOCTL_LOG_ADD_EVENT(w, x, y, z) whd_ioctl_log_add_event(w, x, y, z)
|
||||
#define WHD_IOCTL_PRINT(x) whd_ioctl_print(x)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t ioct_log;
|
||||
uint8_t is_this_event;
|
||||
uint8_t data[WHD_MAX_DATA_SIZE];
|
||||
uint32_t data_size;
|
||||
uint16_t flag;
|
||||
uint32_t reason;
|
||||
}whd_ioctl_log_t;
|
||||
|
||||
void whd_ioctl_log_add(whd_driver_t whd_driver, uint32_t cmd, whd_buffer_t buffer);
|
||||
void whd_ioctl_log_add_event(whd_driver_t whd_driver, uint32_t cmd, uint16_t flag, uint32_t data);
|
||||
|
||||
whd_result_t whd_ioctl_print(whd_driver_t whd_driver);
|
||||
|
||||
#pragma pack()
|
||||
|
||||
typedef struct whd_internal_info
|
||||
{
|
||||
whd_wlan_status_t whd_wlan_status;
|
||||
wifi_console_t *c;
|
||||
wifi_console_t console;
|
||||
wlan_shared_t sh;
|
||||
uint32_t console_addr;
|
||||
whd_scan_result_callback_t scan_result_callback;
|
||||
whd_scan_result_t **whd_scan_result_ptr;
|
||||
/* The semaphore used to wait for completion of a join;
|
||||
* whd_wifi_join_halt uses this to release waiting threads (if any) */
|
||||
cy_semaphore_t *active_join_semaphore;
|
||||
whd_bool_t active_join_mutex_initted;
|
||||
cy_semaphore_t active_join_mutex;
|
||||
uint con_lastpos;
|
||||
whd_bool_t whd_wifi_p2p_go_is_up;
|
||||
uint32_t whd_join_status[3];
|
||||
|
||||
} whd_internal_info_t;
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char abbrev[3];
|
||||
uint8_t rev;
|
||||
uint8_t data[64];
|
||||
} whd_country_info_t;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
void whd_internal_info_init(whd_driver_t whd_driver);
|
||||
|
||||
/******************************************************
|
||||
* Function Declarations
|
||||
******************************************************/
|
||||
|
||||
extern void whd_wifi_chip_info_init(whd_driver_t whd_driver);
|
||||
extern whd_result_t whd_wlan_bus_complete_ds_wake(whd_driver_t whd_driver, whd_bool_t wake_from_firmware,
|
||||
uint32_t wake_event_indication_addr, uint32_t wake_indication_addr,
|
||||
uint32_t sdio_control_addr);
|
||||
extern whd_result_t whd_wifi_set_custom_country_code(whd_interface_t ifp, const whd_country_info_t *country_code);
|
||||
|
||||
/* Device core control functions */
|
||||
extern whd_result_t whd_disable_device_core(whd_driver_t whd_driver, device_core_t core_id, wlan_core_flag_t core_flag);
|
||||
extern whd_result_t whd_reset_device_core(whd_driver_t whd_driver, device_core_t core_id, wlan_core_flag_t core_flag);
|
||||
extern whd_result_t whd_reset_core(whd_driver_t whd_driver, device_core_t core_id, uint32_t bits, uint32_t resetbits);
|
||||
extern whd_result_t whd_wlan_armcore_run(whd_driver_t whd_driver, device_core_t core_id, wlan_core_flag_t core_flag);
|
||||
extern whd_result_t whd_device_core_is_up(whd_driver_t whd_driver, device_core_t core_id);
|
||||
|
||||
/* Chip specific functions */
|
||||
extern whd_result_t whd_allow_wlan_bus_to_sleep(whd_driver_t whd_driver);
|
||||
extern whd_result_t whd_ensure_wlan_bus_is_up(whd_driver_t whd_driver);
|
||||
|
||||
extern whd_result_t whd_chip_specific_init(whd_driver_t whd_driver);
|
||||
extern whd_result_t whd_chip_specific_socsram_init(whd_driver_t whd_driver);
|
||||
extern whd_result_t whd_wifi_read_wlan_log(whd_driver_t whd_driver, char *buffer, uint32_t buffer_size);
|
||||
extern whd_result_t whd_wifi_print_whd_log(whd_driver_t whd_driver);
|
||||
extern whd_result_t whd_wifi_read_wlan_log_unsafe(whd_driver_t whd_driver, uint32_t wlan_shared_address, char *buffer,
|
||||
uint32_t buffer_size);
|
||||
|
||||
extern void whd_wifi_peek(whd_driver_t whd_driver, uint32_t address, uint8_t register_length, uint8_t *value);
|
||||
extern void whd_wifi_poke(whd_driver_t whd_driver, uint32_t address, uint8_t register_length, uint32_t value);
|
||||
extern uint32_t whd_wifi_get_btc_params(whd_driver_t whd_driver, uint32_t address, whd_interface_t interface);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* ifndef INCLUDED_WHD_CHIP_H */
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_CHIP_CONSTANTS_H_
|
||||
#define INCLUDED_CHIP_CONSTANTS_H_
|
||||
|
||||
#include "whd.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum chip_var
|
||||
{
|
||||
BUS_CREDIT_DIFF = 1,
|
||||
CHIP_RAM_SIZE,
|
||||
ATCM_RAM_BASE_ADDRESS,
|
||||
SOCRAM_SRMEM_SIZE,
|
||||
CHANSPEC_BAND_MASK,
|
||||
CHANSPEC_BAND_2G,
|
||||
CHANSPEC_BAND_5G,
|
||||
CHANSPEC_BAND_SHIFT,
|
||||
CHANSPEC_BW_10,
|
||||
CHANSPEC_BW_20,
|
||||
CHANSPEC_BW_40,
|
||||
CHANSPEC_BW_MASK,
|
||||
CHANSPEC_BW_SHIFT,
|
||||
CHANSPEC_CTL_SB_LOWER,
|
||||
CHANSPEC_CTL_SB_UPPER,
|
||||
CHANSPEC_CTL_SB_NONE,
|
||||
CHANSPEC_CTL_SB_MASK
|
||||
} chip_var_t;
|
||||
|
||||
#define VERIFY_RESULT(x) { whd_result_t verify_result = WHD_SUCCESS; verify_result = (x); \
|
||||
if (verify_result != WHD_SUCCESS){ \
|
||||
WPRINT_WHD_ERROR( ("Function %s failed at line %d \n", __func__, __LINE__) ); \
|
||||
return verify_result; } }
|
||||
#define GET_C_VAR(whd_driver, var) get_whd_var(whd_driver, var)
|
||||
|
||||
uint32_t get_whd_var(whd_driver_t whd_driver, chip_var_t var);
|
||||
|
||||
whd_result_t get_chip_max_bus_data_credit_diff(uint16_t, uint32_t *);
|
||||
whd_result_t get_chip_ram_size(uint16_t, uint32_t *);
|
||||
whd_result_t get_atcm_ram_base_address(uint16_t, uint32_t *);
|
||||
whd_result_t get_socsram_srmem_size(uint16_t, uint32_t *);
|
||||
whd_result_t get_wl_chanspec_band_mask(uint16_t, uint32_t *);
|
||||
whd_result_t get_wl_chanspec_band_2G(uint16_t, uint32_t *);
|
||||
whd_result_t get_wl_chanspec_band_5G(uint16_t, uint32_t *);
|
||||
whd_result_t get_wl_chanspec_band_shift(uint16_t, uint32_t *);
|
||||
whd_result_t get_wl_chanspec_bw_10(uint16_t, uint32_t *);
|
||||
whd_result_t get_wl_chanspec_bw_20(uint16_t, uint32_t *);
|
||||
whd_result_t get_wl_chanspec_bw_40(uint16_t, uint32_t *);
|
||||
whd_result_t get_wl_chanspec_bw_mask(uint16_t, uint32_t *);
|
||||
whd_result_t get_wl_chanspec_bw_shift(uint16_t, uint32_t *);
|
||||
whd_result_t get_wl_chanspec_ctl_sb_lower(uint16_t, uint32_t *);
|
||||
whd_result_t get_wl_chanspec_ctl_sb_upper(uint16_t, uint32_t *);
|
||||
whd_result_t get_wl_chanspec_ctl_sb_none(uint16_t, uint32_t *);
|
||||
whd_result_t get_wl_chanspec_ctl_sb_mask(uint16_t, uint32_t *);
|
||||
|
||||
uint32_t whd_chip_set_chip_id(whd_driver_t whd_driver, uint16_t id);
|
||||
uint16_t whd_chip_get_chip_id(whd_driver_t whd_driver);
|
||||
|
||||
#undef CHIP_FIRMWARE_SUPPORTS_PM_LIMIT_IOVAR
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* ifndef INCLUDED_CHIP_CONSTANTS_H_ */
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* Provides generic clm blob file download functionality
|
||||
*/
|
||||
#ifndef _WHD_INTERNAL_CLM_H_
|
||||
#define _WHD_INTERNAL_CLM_H_
|
||||
|
||||
#include "whd.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
|
||||
|
||||
/******************************************************
|
||||
* Function prototypes
|
||||
******************************************************/
|
||||
whd_result_t whd_process_clm_data(whd_interface_t ifp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* ifndef _WHD_INTERNAL_CLM_H_ */
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "whd.h"
|
||||
|
||||
#ifndef INCLUDED_WHD_DEBUG_H
|
||||
#define INCLUDED_WHD_DEBUG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
#define WPRINT_ENABLE_WHD_ERROR
|
||||
/* #define WPRINT_ENABLE_WHD_INFO */
|
||||
/* #define WPRINT_ENABLE_WHD_DEBUG */
|
||||
|
||||
#define WHD_ENABLE_STATS
|
||||
/*#define WHD_LOGGING_BUFFER_ENABLE*/
|
||||
|
||||
#if defined (__GNUC__)
|
||||
#define WHD_TRIGGER_BREAKPOINT( ) do { __asm__ ("bkpt"); } while (0)
|
||||
|
||||
#elif defined (__IAR_SYSTEMS_ICC__)
|
||||
#define WHD_TRIGGER_BREAKPOINT( ) do { __asm("bkpt 0"); } while (0)
|
||||
|
||||
#else
|
||||
#define WHD_TRIGGER_BREAKPOINT( )
|
||||
#endif
|
||||
|
||||
#ifdef WPRINT_ENABLE_ERROR
|
||||
#define WPRINT_ERROR(args) do { WPRINT_MACRO(args); } while (0)
|
||||
#define whd_assert(error_string, assertion) do { if (!(assertion) ){ WHD_TRIGGER_BREAKPOINT(); } } while (0)
|
||||
#define whd_minor_assert(error_string, \
|
||||
assertion) do { if (!(assertion) ) WPRINT_MACRO( (error_string) ); } while (0)
|
||||
#else
|
||||
#define whd_assert(error_string, assertion) do { if (!(assertion) ) WPRINT_MACRO( (error_string) ); } while (0)
|
||||
#define whd_minor_assert(error_string, assertion) do { (void)(assertion); } while (0)
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Print declarations
|
||||
******************************************************/
|
||||
#if defined(WHD_LOGGING_BUFFER_ENABLE)
|
||||
#define WPRINT_MACRO(args) do { whd_buffer_printf args; } while (0 == 1)
|
||||
#else
|
||||
#define WPRINT_MACRO(args) do { printf args;} while (0 == 1)
|
||||
#endif
|
||||
|
||||
|
||||
/* WICED printing macros for Wiced Wi-Fi Driver*/
|
||||
#ifdef WPRINT_ENABLE_WHD_INFO
|
||||
#define WPRINT_WHD_INFO(args) WPRINT_MACRO(args)
|
||||
#else
|
||||
#define WPRINT_WHD_INFO(args)
|
||||
#endif
|
||||
|
||||
#ifdef WPRINT_ENABLE_WHD_DEBUG
|
||||
#define WPRINT_WHD_DEBUG(args) WPRINT_MACRO(args)
|
||||
#else
|
||||
#define WPRINT_WHD_DEBUG(args)
|
||||
#endif
|
||||
|
||||
#ifdef WPRINT_ENABLE_WHD_ERROR
|
||||
#define WPRINT_WHD_ERROR(args) WPRINT_MACRO(args);
|
||||
#else
|
||||
#define WPRINT_WHD_ERROR(args)
|
||||
#endif
|
||||
|
||||
#ifdef WPRINT_ENABLE_WHD_DATA_LOG
|
||||
#define WPRINT_WHD_DATA_LOG(args) WPRINT_MACRO(args)
|
||||
#else
|
||||
#define WPRINT_WHD_DATA_LOG(args)
|
||||
#endif
|
||||
|
||||
#define WHD_STATS_INCREMENT_VARIABLE(whd_driver, var) \
|
||||
do { whd_driver->whd_stats.var++; } while (0)
|
||||
|
||||
#define WHD_STATS_CONDITIONAL_INCREMENT_VARIABLE(whd_driver, condition, var) \
|
||||
do { if (condition){ whd_driver->whd_stats.var++; }} while (0)
|
||||
|
||||
#if (defined(__GNUC__) && (__GNUC__ >= 6) )
|
||||
#define __FUNCTION__ __func__
|
||||
#endif
|
||||
|
||||
|
||||
void whd_init_stats(whd_driver_t whd_driver);
|
||||
void whd_print_logbuffer(void);
|
||||
|
||||
|
||||
#ifdef WHD_LOGGING_BUFFER_ENABLE
|
||||
#define LOGGING_BUFFER_SIZE (4 * 1024)
|
||||
int whd_buffer_printf(const char *format, ...);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t buffer_write;
|
||||
uint32_t buffer_read;
|
||||
char buffer[LOGGING_BUFFER_SIZE + 1];
|
||||
whd_bool_t roll_over;
|
||||
whd_bool_t over_write;
|
||||
} whd_logging_t;
|
||||
#else
|
||||
#define whd_print_logbuffer()
|
||||
#endif /* WHD_LOGGING_BUFFER_ENABLE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
#endif /* ifndef INCLUDED_WHD_DEBUG_H */
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
* Byte order utilities
|
||||
*
|
||||
* This file by default provides proper behavior on little-endian architectures.
|
||||
* On big-endian architectures, IL_BIGENDIAN should be defined.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_WHD_ENDIAN_H
|
||||
#define INCLUDED_WHD_ENDIAN_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/* Reverse the bytes in a 16-bit value */
|
||||
#define SWAP16(val) \
|
||||
( (uint16_t)( ( ( (uint16_t)(val) & (uint16_t)0x00ffU ) << 8 ) | \
|
||||
( ( (uint16_t)(val) & (uint16_t)0xff00U ) >> 8 ) ) )
|
||||
|
||||
/* Reverse the bytes in a 32-bit value */
|
||||
#define SWAP32(val) \
|
||||
( (uint32_t)( ( ( (uint32_t)(val) & (uint32_t)0x000000ffU ) << 24 ) | \
|
||||
( ( (uint32_t)(val) & (uint32_t)0x0000ff00U ) << 8 ) | \
|
||||
( ( (uint32_t)(val) & (uint32_t)0x00ff0000U ) >> 8 ) | \
|
||||
( ( (uint32_t)(val) & (uint32_t)0xff000000U ) >> 24 ) ) )
|
||||
|
||||
#ifdef IL_BIGENDIAN
|
||||
#define htod32(i) SWAP32(i)
|
||||
#define htod16(i) SWAP16(i)
|
||||
#define dtoh32(i) SWAP32(i)
|
||||
#define dtoh16(i) SWAP16(i)
|
||||
#define hton16(i) (i)
|
||||
#define hton32(i) (i)
|
||||
#define ntoh16(i) (i)
|
||||
#define ntoh32(i) (i)
|
||||
#else /* IL_BIGENDIAN */
|
||||
#define htod32(i) (i)
|
||||
#define htod16(i) (i)
|
||||
#define dtoh32(i) (i)
|
||||
#define dtoh16(i) (i)
|
||||
#define hton16(i) SWAP16(i)
|
||||
#define hton32(i) SWAP32(i)
|
||||
#define ntoh16(i) SWAP16(i)
|
||||
#define ntoh32(i) SWAP32(i)
|
||||
#endif /* IL_BIGENDIAN */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* INCLUDED_WHD_ENDIAN_H */
|
||||
|
|
@ -0,0 +1,463 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* Header for Event detection
|
||||
*
|
||||
* Provides constants and prototypes for functions that allow both
|
||||
* whd and user applications to receive event callbacks.
|
||||
*/
|
||||
|
||||
#include "whd.h"
|
||||
|
||||
#ifndef INCLUDED_WHD_EVENTS_INT_H
|
||||
#define INCLUDED_WHD_EVENTS_INT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* @cond Typedefs
|
||||
******************************************************/
|
||||
|
||||
/**
|
||||
* Enumerated list of event types
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
WLC_E_NONE = 0x7FFFFFFE,
|
||||
WLC_E_SET_SSID = 0 /** indicates status of set SSID */,
|
||||
WLC_E_JOIN = 1, /** differentiates join IBSS from found (WLC_E_START) IBSS */
|
||||
WLC_E_START = 2, /** STA founded an IBSS or AP started a BSS */
|
||||
WLC_E_AUTH = 3, /** 802.11 AUTH request */
|
||||
WLC_E_AUTH_IND = 4, /** 802.11 AUTH indication */
|
||||
WLC_E_DEAUTH = 5, /** 802.11 DEAUTH request */
|
||||
WLC_E_DEAUTH_IND = 6, /** 802.11 DEAUTH indication */
|
||||
WLC_E_ASSOC = 7, /** 802.11 ASSOC request */
|
||||
WLC_E_ASSOC_IND = 8, /** 802.11 ASSOC indication */
|
||||
WLC_E_REASSOC = 9, /** 802.11 REASSOC request */
|
||||
WLC_E_REASSOC_IND = 10, /** 802.11 REASSOC indication */
|
||||
WLC_E_DISASSOC = 11, /** 802.11 DISASSOC request */
|
||||
WLC_E_DISASSOC_IND = 12, /** 802.11 DISASSOC indication */
|
||||
WLC_E_QUIET_START = 13, /** 802.11h Quiet period started */
|
||||
WLC_E_QUIET_END = 14, /** 802.11h Quiet period ended */
|
||||
WLC_E_BEACON_RX = 15, /** BEACONS received/lost indication */
|
||||
WLC_E_LINK = 16, /** generic link indication */
|
||||
WLC_E_MIC_ERROR = 17, /** TKIP MIC error occurred */
|
||||
WLC_E_NDIS_LINK = 18, /** NDIS style link indication */
|
||||
WLC_E_ROAM = 19, /** roam attempt occurred: indicate status & reason */
|
||||
WLC_E_TXFAIL = 20, /** change in dot11FailedCount (txfail) */
|
||||
WLC_E_PMKID_CACHE = 21, /** WPA2 pmkid cache indication */
|
||||
WLC_E_RETROGRADE_TSF = 22, /** current AP's TSF value went backward */
|
||||
WLC_E_PRUNE = 23, /** AP was pruned from join list for reason */
|
||||
WLC_E_AUTOAUTH = 24, /** report AutoAuth table entry match for join attempt */
|
||||
WLC_E_EAPOL_MSG = 25, /** Event encapsulating an EAPOL message */
|
||||
WLC_E_SCAN_COMPLETE = 26, /** Scan results are ready or scan was aborted */
|
||||
WLC_E_ADDTS_IND = 27, /** indicate to host addts fail/success */
|
||||
WLC_E_DELTS_IND = 28, /** indicate to host delts fail/success */
|
||||
WLC_E_BCNSENT_IND = 29, /** indicate to host of beacon transmit */
|
||||
WLC_E_BCNRX_MSG = 30, /** Send the received beacon up to the host */
|
||||
WLC_E_BCNLOST_MSG = 31, /** indicate to host loss of beacon */
|
||||
WLC_E_ROAM_PREP = 32, /** before attempting to roam */
|
||||
WLC_E_PFN_NET_FOUND = 33, /** PFN network found event */
|
||||
WLC_E_PFN_NET_LOST = 34, /** PFN network lost event */
|
||||
WLC_E_RESET_COMPLETE = 35, WLC_E_JOIN_START = 36, WLC_E_ROAM_START = 37, WLC_E_ASSOC_START = 38,
|
||||
WLC_E_IBSS_ASSOC = 39, WLC_E_RADIO = 40, WLC_E_PSM_WATCHDOG = 41, /** PSM microcode watchdog fired */
|
||||
WLC_E_CCX_ASSOC_START = 42, /** CCX association start */
|
||||
WLC_E_CCX_ASSOC_ABORT = 43, /** CCX association abort */
|
||||
WLC_E_PROBREQ_MSG = 44, /** probe request received */
|
||||
WLC_E_SCAN_CONFIRM_IND = 45, WLC_E_PSK_SUP = 46, /** WPA Handshake */
|
||||
WLC_E_COUNTRY_CODE_CHANGED = 47, WLC_E_EXCEEDED_MEDIUM_TIME = 48, /** WMMAC excedded medium time */
|
||||
WLC_E_ICV_ERROR = 49, /** WEP ICV error occurred */
|
||||
WLC_E_UNICAST_DECODE_ERROR = 50, /** Unsupported unicast encrypted frame */
|
||||
WLC_E_MULTICAST_DECODE_ERROR = 51, /** Unsupported multicast encrypted frame */
|
||||
WLC_E_TRACE = 52, WLC_E_BTA_HCI_EVENT = 53, /** BT-AMP HCI event */
|
||||
WLC_E_IF = 54, /** I/F change (for wlan host notification) */
|
||||
WLC_E_P2P_DISC_LISTEN_COMPLETE = 55, /** P2P Discovery listen state expires */
|
||||
WLC_E_RSSI = 56, /** indicate RSSI change based on configured levels */
|
||||
WLC_E_PFN_BEST_BATCHING = 57, /** PFN best network batching event */
|
||||
WLC_E_EXTLOG_MSG = 58, WLC_E_ACTION_FRAME = 59, /** Action frame reception */
|
||||
WLC_E_ACTION_FRAME_COMPLETE = 60, /** Action frame Tx complete */
|
||||
WLC_E_PRE_ASSOC_IND = 61, /** assoc request received */
|
||||
WLC_E_PRE_REASSOC_IND = 62, /** re-assoc request received */
|
||||
WLC_E_CHANNEL_ADOPTED = 63, /** channel adopted (xxx: obsoleted) */
|
||||
WLC_E_AP_STARTED = 64, /** AP started */
|
||||
WLC_E_DFS_AP_STOP = 65, /** AP stopped due to DFS */
|
||||
WLC_E_DFS_AP_RESUME = 66, /** AP resumed due to DFS */
|
||||
WLC_E_WAI_STA_EVENT = 67, /** WAI stations event */
|
||||
WLC_E_WAI_MSG = 68, /** event encapsulating an WAI message */
|
||||
WLC_E_ESCAN_RESULT = 69, /** escan result event */
|
||||
WLC_E_ACTION_FRAME_OFF_CHAN_COMPLETE = 70, /** action frame off channel complete *//* NOTE - This used to be WLC_E_WAKE_EVENT */
|
||||
WLC_E_PROBRESP_MSG = 71, /** probe response received */
|
||||
WLC_E_P2P_PROBREQ_MSG = 72, /** P2P Probe request received */
|
||||
WLC_E_DCS_REQUEST = 73, WLC_E_FIFO_CREDIT_MAP = 74, /** credits for D11 FIFOs. [AC0,AC1,AC2,AC3,BC_MC,ATIM] */
|
||||
WLC_E_ACTION_FRAME_RX = 75, /** Received action frame event WITH wl_event_rx_frame_data_t header */
|
||||
WLC_E_WAKE_EVENT = 76, /** Wake Event timer fired, used for wake WLAN test mode */
|
||||
WLC_E_RM_COMPLETE = 77, /** Radio measurement complete */
|
||||
WLC_E_HTSFSYNC = 78, /** Synchronize TSF with the host */
|
||||
WLC_E_OVERLAY_REQ = 79, /** request an overlay IOCTL/iovar from the host */
|
||||
WLC_E_CSA_COMPLETE_IND = 80, WLC_E_EXCESS_PM_WAKE_EVENT = 81, /** excess PM Wake Event to inform host */
|
||||
WLC_E_PFN_SCAN_NONE = 82, /** no PFN networks around */
|
||||
WLC_E_PFN_SCAN_ALLGONE = 83, /** last found PFN network gets lost */
|
||||
WLC_E_GTK_PLUMBED = 84, WLC_E_ASSOC_IND_NDIS = 85, /** 802.11 ASSOC indication for NDIS only */
|
||||
WLC_E_REASSOC_IND_NDIS = 86, /** 802.11 REASSOC indication for NDIS only */
|
||||
WLC_E_ASSOC_REQ_IE = 87, WLC_E_ASSOC_RESP_IE = 88, WLC_E_ASSOC_RECREATED = 89, /** association recreated on resume */
|
||||
WLC_E_ACTION_FRAME_RX_NDIS = 90, /** rx action frame event for NDIS only */
|
||||
WLC_E_AUTH_REQ = 91, /** authentication request received */
|
||||
WLC_E_TDLS_PEER_EVENT = 92, /** discovered peer, connected/disconnected peer */
|
||||
WLC_E_MESH_DHCP_SUCCESS = 92, /** DHCP handshake successful for a mesh interface */
|
||||
WLC_E_SPEEDY_RECREATE_FAIL = 93, /** fast assoc recreation failed */
|
||||
WLC_E_NATIVE = 94, /** port-specific event and payload (e.g. NDIS) */
|
||||
WLC_E_PKTDELAY_IND = 95, /** event for tx pkt delay suddently jump */
|
||||
WLC_E_AWDL_AW = 96, /** AWDL AW period starts */
|
||||
WLC_E_AWDL_ROLE = 97, /** AWDL Master/Slave/NE master role event */
|
||||
WLC_E_AWDL_EVENT = 98, /** Generic AWDL event */
|
||||
WLC_E_NIC_AF_TXS = 99, /** NIC AF txstatus */
|
||||
WLC_E_NAN = 100, /** NAN event */
|
||||
WLC_E_BEACON_FRAME_RX = 101, WLC_E_SERVICE_FOUND = 102, /** desired service found */
|
||||
WLC_E_GAS_FRAGMENT_RX = 103, /** GAS fragment received */
|
||||
WLC_E_GAS_COMPLETE = 104, /** GAS sessions all complete */
|
||||
WLC_E_P2PO_ADD_DEVICE = 105, /** New device found by p2p offload */
|
||||
WLC_E_P2PO_DEL_DEVICE = 106, /** device has been removed by p2p offload */
|
||||
WLC_E_WNM_STA_SLEEP = 107, /** WNM event to notify STA enter sleep mode */
|
||||
WLC_E_TXFAIL_THRESH = 108, /** Indication of MAC tx failures (exhaustion of 802.11 retries) exceeding threshold(s) */
|
||||
WLC_E_PROXD = 109, /** Proximity Detection event */
|
||||
WLC_E_IBSS_COALESCE = 110, /** IBSS Coalescing */
|
||||
WLC_E_MESH_PAIRED = 110, /** Mesh peer found and paired */
|
||||
WLC_E_AWDL_RX_PRB_RESP = 111, /** AWDL RX Probe response */
|
||||
WLC_E_AWDL_RX_ACT_FRAME = 112, /** AWDL RX Action Frames */
|
||||
WLC_E_AWDL_WOWL_NULLPKT = 113, /** AWDL Wowl nulls */
|
||||
WLC_E_AWDL_PHYCAL_STATUS = 114, /** AWDL Phycal status */
|
||||
WLC_E_AWDL_OOB_AF_STATUS = 115, /** AWDL OOB AF status */
|
||||
WLC_E_AWDL_SCAN_STATUS = 116, /** Interleaved Scan status */
|
||||
WLC_E_AWDL_AW_START = 117, /** AWDL AW Start */
|
||||
WLC_E_AWDL_AW_END = 118, /** AWDL AW End */
|
||||
WLC_E_AWDL_AW_EXT = 119, /** AWDL AW Extensions */
|
||||
WLC_E_AWDL_PEER_CACHE_CONTROL = 120, WLC_E_CSA_START_IND = 121, WLC_E_CSA_DONE_IND = 122,
|
||||
WLC_E_CSA_FAILURE_IND = 123, WLC_E_CCA_CHAN_QUAL = 124, /** CCA based channel quality report */
|
||||
WLC_E_BSSID = 125, /** to report change in BSSID while roaming */
|
||||
WLC_E_TX_STAT_ERROR = 126, /** tx error indication */
|
||||
WLC_E_BCMC_CREDIT_SUPPORT = 127, /** credit check for BCMC supported */
|
||||
WLC_E_PSTA_PRIMARY_INTF_IND = 128, /** psta primary interface indication */
|
||||
WLC_E_BT_WIFI_HANDOVER_REQ = 130, /* Handover Request Initiated */
|
||||
WLC_E_SPW_TXINHIBIT = 131, /* Southpaw TxInhibit notification */
|
||||
WLC_E_FBT_AUTH_REQ_IND = 132, /* FBT Authentication Request Indication */
|
||||
WLC_E_RSSI_LQM = 133, /* Enhancement addition for WLC_E_RSSI */
|
||||
WLC_E_PFN_GSCAN_FULL_RESULT = 134, /* Full probe/beacon (IEs etc) results */
|
||||
WLC_E_PFN_SWC = 135, /* Significant change in rssi of bssids being tracked */
|
||||
WLC_E_AUTHORIZED = 136, /* a STA been authroized for traffic */
|
||||
WLC_E_PROBREQ_MSG_RX = 137, /* probe req with wl_event_rx_frame_data_t header */
|
||||
WLC_E_PFN_SCAN_COMPLETE = 138, /* PFN completed scan of network list */
|
||||
WLC_E_RMC_EVENT = 139, /* RMC Event */
|
||||
WLC_E_DPSTA_INTF_IND = 140, /* DPSTA interface indication */
|
||||
WLC_E_RRM = 141, /* RRM Event */
|
||||
WLC_E_ULP = 146, /* ULP entry event */
|
||||
WLC_E_LAST = 147, /** highest val + 1 for range checking */
|
||||
} whd_event_num_t;
|
||||
|
||||
#define WLC_SUP_STATUS_OFFSET (256)
|
||||
#define WLC_DOT11_SC_STATUS_OFFSET (512)
|
||||
/**
|
||||
* Enumerated list of event status codes
|
||||
* @note : WLC_SUP values overlap other values, so it is necessary
|
||||
* to check the event type
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
WLC_E_STATUS_SUCCESS = 0, /** operation was successful */
|
||||
WLC_E_STATUS_FAIL = 1, /** operation failed */
|
||||
WLC_E_STATUS_TIMEOUT = 2, /** operation timed out */
|
||||
WLC_E_STATUS_NO_NETWORKS = 3, /** failed due to no matching network found */
|
||||
WLC_E_STATUS_ABORT = 4, /** operation was aborted */
|
||||
WLC_E_STATUS_NO_ACK = 5, /** protocol failure: packet not ack'd */
|
||||
WLC_E_STATUS_UNSOLICITED = 6, /** AUTH or ASSOC packet was unsolicited */
|
||||
WLC_E_STATUS_ATTEMPT = 7, /** attempt to assoc to an auto auth configuration */
|
||||
WLC_E_STATUS_PARTIAL = 8, /** scan results are incomplete */
|
||||
WLC_E_STATUS_NEWSCAN = 9, /** scan aborted by another scan */
|
||||
WLC_E_STATUS_NEWASSOC = 10, /** scan aborted due to assoc in progress */
|
||||
WLC_E_STATUS_11HQUIET = 11, /** 802.11h quiet period started */
|
||||
WLC_E_STATUS_SUPPRESS = 12, /** user disabled scanning (WLC_SET_SCANSUPPRESS) */
|
||||
WLC_E_STATUS_NOCHANS = 13, /** no allowable channels to scan */
|
||||
WLC_E_STATUS_CCXFASTRM = 14, /** scan aborted due to CCX fast roam */
|
||||
WLC_E_STATUS_CS_ABORT = 15, /** abort channel select */
|
||||
|
||||
/* for WLC_SUP messages */
|
||||
WLC_SUP_DISCONNECTED = 0 + WLC_SUP_STATUS_OFFSET, WLC_SUP_CONNECTING = 1 + WLC_SUP_STATUS_OFFSET,
|
||||
WLC_SUP_IDREQUIRED = 2 + WLC_SUP_STATUS_OFFSET, WLC_SUP_AUTHENTICATING = 3 + WLC_SUP_STATUS_OFFSET,
|
||||
WLC_SUP_AUTHENTICATED = 4 + WLC_SUP_STATUS_OFFSET, WLC_SUP_KEYXCHANGE = 5 + WLC_SUP_STATUS_OFFSET,
|
||||
WLC_SUP_KEYED = 6 + WLC_SUP_STATUS_OFFSET, WLC_SUP_TIMEOUT = 7 + WLC_SUP_STATUS_OFFSET,
|
||||
WLC_SUP_LAST_BASIC_STATE = 8 + WLC_SUP_STATUS_OFFSET,
|
||||
/* Extended supplicant authentication states */
|
||||
WLC_SUP_KEYXCHANGE_WAIT_M1 = WLC_SUP_AUTHENTICATED, /** Waiting to receive handshake msg M1 */
|
||||
WLC_SUP_KEYXCHANGE_PREP_M2 = WLC_SUP_KEYXCHANGE, /** Preparing to send handshake msg M2 */
|
||||
WLC_SUP_KEYXCHANGE_WAIT_M3 = WLC_SUP_LAST_BASIC_STATE, /** Waiting to receive handshake msg M3 */
|
||||
WLC_SUP_KEYXCHANGE_PREP_M4 = 9 + WLC_SUP_STATUS_OFFSET, /** Preparing to send handshake msg M4 */
|
||||
WLC_SUP_KEYXCHANGE_WAIT_G1 = 10 + WLC_SUP_STATUS_OFFSET, /** Waiting to receive handshake msg G1 */
|
||||
WLC_SUP_KEYXCHANGE_PREP_G2 = 11 + WLC_SUP_STATUS_OFFSET, /** Preparing to send handshake msg G2 */
|
||||
|
||||
WLC_DOT11_SC_SUCCESS = 0 + WLC_DOT11_SC_STATUS_OFFSET, /* Successful */
|
||||
WLC_DOT11_SC_FAILURE = 1 + WLC_DOT11_SC_STATUS_OFFSET, /* Unspecified failure */
|
||||
WLC_DOT11_SC_CAP_MISMATCH = 10 + WLC_DOT11_SC_STATUS_OFFSET, /* Cannot support all requested capabilities in the Capability Information field */
|
||||
WLC_DOT11_SC_REASSOC_FAIL = 11 + WLC_DOT11_SC_STATUS_OFFSET, /* Reassociation denied due to inability to confirm that association exists */
|
||||
WLC_DOT11_SC_ASSOC_FAIL = 12 + WLC_DOT11_SC_STATUS_OFFSET, /* Association denied due to reason outside the scope of this standard */
|
||||
WLC_DOT11_SC_AUTH_MISMATCH = 13 + WLC_DOT11_SC_STATUS_OFFSET, /* Responding station does not support the specified authentication algorithm */
|
||||
WLC_DOT11_SC_AUTH_SEQ = 14 + WLC_DOT11_SC_STATUS_OFFSET, /* Received an Authentication frame with authentication transaction sequence number out of expected sequence */
|
||||
WLC_DOT11_SC_AUTH_CHALLENGE_FAIL = 15 + WLC_DOT11_SC_STATUS_OFFSET, /* Authentication rejected because of challenge failure */
|
||||
WLC_DOT11_SC_AUTH_TIMEOUT = 16 + WLC_DOT11_SC_STATUS_OFFSET, /* Authentication rejected due to timeout waiting for next frame in sequence */
|
||||
WLC_DOT11_SC_ASSOC_BUSY_FAIL = 17 + WLC_DOT11_SC_STATUS_OFFSET, /* Association denied because AP is unable to handle additional associated stations */
|
||||
WLC_DOT11_SC_ASSOC_RATE_MISMATCH = 18 + WLC_DOT11_SC_STATUS_OFFSET, /* Association denied due to requesting station not supporting all of the data rates in the BSSBasicRateSet parameter */
|
||||
WLC_DOT11_SC_ASSOC_SHORT_REQUIRED = 19 + WLC_DOT11_SC_STATUS_OFFSET, /* Association denied due to requesting station not supporting the Short Preamble option */
|
||||
WLC_DOT11_SC_ASSOC_PBCC_REQUIRED = 20 + WLC_DOT11_SC_STATUS_OFFSET, /* Association denied due to requesting station not supporting the PBCC Modulation option */
|
||||
WLC_DOT11_SC_ASSOC_AGILITY_REQUIRED = 21 + WLC_DOT11_SC_STATUS_OFFSET, /* Association denied due to requesting station not supporting the Channel Agility option */
|
||||
WLC_DOT11_SC_ASSOC_SPECTRUM_REQUIRED = 22 + WLC_DOT11_SC_STATUS_OFFSET, /* Association denied because Spectrum Management capability is required. */
|
||||
WLC_DOT11_SC_ASSOC_BAD_POWER_CAP = 23 + WLC_DOT11_SC_STATUS_OFFSET, /* Association denied because the info in the Power Cap element is unacceptable. */
|
||||
WLC_DOT11_SC_ASSOC_BAD_SUP_CHANNELS = 24 + WLC_DOT11_SC_STATUS_OFFSET, /* Association denied because the info in the Supported Channel element is unacceptable */
|
||||
WLC_DOT11_SC_ASSOC_SHORTSLOT_REQUIRED = 25 + WLC_DOT11_SC_STATUS_OFFSET, /* Association denied due to requesting station not supporting the Short Slot Time option */
|
||||
WLC_DOT11_SC_ASSOC_ERPBCC_REQUIRED = 26 + WLC_DOT11_SC_STATUS_OFFSET, /* Association denied due to requesting station not supporting the ER-PBCC Modulation option */
|
||||
WLC_DOT11_SC_ASSOC_DSSOFDM_REQUIRED = 27 + WLC_DOT11_SC_STATUS_OFFSET, /* Association denied due to requesting station not supporting the DSS-OFDM option */
|
||||
WLC_DOT11_SC_DECLINED = 37 + WLC_DOT11_SC_STATUS_OFFSET, /* request declined */
|
||||
WLC_DOT11_SC_INVALID_PARAMS = 38 + WLC_DOT11_SC_STATUS_OFFSET, /* One or more params have invalid values */
|
||||
WLC_DOT11_SC_INVALID_AKMP = 43 + WLC_DOT11_SC_STATUS_OFFSET, /* Association denied due to invalid AKMP */
|
||||
WLC_DOT11_SC_INVALID_MDID = 54 + WLC_DOT11_SC_STATUS_OFFSET, /* Association denied due to invalid MDID */
|
||||
WLC_DOT11_SC_INVALID_FTIE = 55 + WLC_DOT11_SC_STATUS_OFFSET, /* Association denied due to invalid FTIE */
|
||||
|
||||
WLC_E_STATUS_FORCE_32_BIT = 0x7FFFFFFE /** Force enum to be stored in 32 bit variable */
|
||||
} whd_event_status_t;
|
||||
|
||||
#define WLC_E_PRUNE_REASON_OFFSET (256)
|
||||
#define WLC_E_SUP_REASON_OFFSET (512)
|
||||
#define WLC_E_DOT11_RC_REASON_OFFSET (768)
|
||||
|
||||
/**
|
||||
* Enumerated list of event reason codes
|
||||
* @note : Several values overlap other values, so it is necessary
|
||||
* to check the event type
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
/* roam reason codes */
|
||||
WLC_E_REASON_INITIAL_ASSOC = 0, /** initial assoc */
|
||||
WLC_E_REASON_LOW_RSSI = 1, /** roamed due to low RSSI */
|
||||
WLC_E_REASON_DEAUTH = 2, /** roamed due to DEAUTH indication */
|
||||
WLC_E_REASON_DISASSOC = 3, /** roamed due to DISASSOC indication */
|
||||
WLC_E_REASON_BCNS_LOST = 4, /** roamed due to lost beacons */
|
||||
WLC_E_REASON_FAST_ROAM_FAILED = 5, /** roamed due to fast roam failure */
|
||||
WLC_E_REASON_DIRECTED_ROAM = 6, /** roamed due to request by AP */
|
||||
WLC_E_REASON_TSPEC_REJECTED = 7, /** roamed due to TSPEC rejection */
|
||||
WLC_E_REASON_BETTER_AP = 8, /** roamed due to finding better AP */
|
||||
|
||||
/* NAN sub-events comes as a reason code with event as WLC_E_NAN */
|
||||
WLC_E_NAN_EVENT_STATUS_CHG = 9, /* generated on any change in nan_mac status */
|
||||
WLC_E_NAN_EVENT_MERGE = 10, /* Merged to a NAN cluster */
|
||||
WLC_E_NAN_EVENT_STOP = 11, /* NAN stopped */
|
||||
WLC_E_NAN_EVENT_P2P = 12, /* NAN P2P EVENT */
|
||||
|
||||
/* XXX: Dont use below four events: They will be cleanup, use WL_NAN_EVENT_POST_DISC */
|
||||
WLC_E_NAN_EVENT_WINDOW_BEGIN_P2P = 13, /* Event for begin of P2P further availability window */
|
||||
WLC_E_NAN_EVENT_WINDOW_BEGIN_MESH = 14, WLC_E_NAN_EVENT_WINDOW_BEGIN_IBSS = 15,
|
||||
WLC_E_NAN_EVENT_WINDOW_BEGIN_RANGING = 16, WLC_E_NAN_EVENT_POST_DISC = 17, /* Event for post discovery data */
|
||||
WLC_E_NAN_EVENT_DATA_IF_ADD = 18, /* Event for Data IF add */
|
||||
WLC_E_NAN_EVENT_DATA_PEER_ADD = 19, /* Event for peer add */
|
||||
|
||||
/* nan 2.0 */
|
||||
WLC_E_NAN_EVENT_DATA_IND = 20, /* Data Indication to Host */
|
||||
WLC_E_NAN_EVENT_DATA_CONF = 21, /* Data Response to Host */
|
||||
WLC_E_NAN_EVENT_SDF_RX = 22, /* entire service discovery frame */
|
||||
WLC_E_NAN_EVENT_DATA_END = 23, WLC_E_NAN_EVENT_BCN_RX = 24, /* received beacon payload */
|
||||
|
||||
/* prune reason codes */
|
||||
WLC_E_PRUNE_ENCR_MISMATCH = 1 + WLC_E_PRUNE_REASON_OFFSET, /** encryption mismatch */
|
||||
WLC_E_PRUNE_BCAST_BSSID = 2 + WLC_E_PRUNE_REASON_OFFSET, /** AP uses a broadcast BSSID */
|
||||
WLC_E_PRUNE_MAC_DENY = 3 + WLC_E_PRUNE_REASON_OFFSET, /** STA's MAC addr is in AP's MAC deny list */
|
||||
WLC_E_PRUNE_MAC_NA = 4 + WLC_E_PRUNE_REASON_OFFSET, /** STA's MAC addr is not in AP's MAC allow list */
|
||||
WLC_E_PRUNE_REG_PASSV = 5 + WLC_E_PRUNE_REASON_OFFSET, /** AP not allowed due to regulatory restriction */
|
||||
WLC_E_PRUNE_SPCT_MGMT = 6 + WLC_E_PRUNE_REASON_OFFSET, /** AP does not support STA locale spectrum mgmt */
|
||||
WLC_E_PRUNE_RADAR = 7 + WLC_E_PRUNE_REASON_OFFSET, /** AP is on a radar channel of STA locale */
|
||||
WLC_E_RSN_MISMATCH = 8 + WLC_E_PRUNE_REASON_OFFSET, /** STA does not support AP's RSN */
|
||||
WLC_E_PRUNE_NO_COMMON_RATES = 9 + WLC_E_PRUNE_REASON_OFFSET, /** No rates in common with AP */
|
||||
WLC_E_PRUNE_BASIC_RATES = 10 + WLC_E_PRUNE_REASON_OFFSET, /** STA does not support all basic rates of BSS */
|
||||
WLC_E_PRUNE_CCXFAST_PREVAP = 11 + WLC_E_PRUNE_REASON_OFFSET, /** CCX FAST ROAM: prune previous AP */
|
||||
WLC_E_PRUNE_CIPHER_NA = 12 + WLC_E_PRUNE_REASON_OFFSET, /** BSS's cipher not supported */
|
||||
WLC_E_PRUNE_KNOWN_STA = 13 + WLC_E_PRUNE_REASON_OFFSET, /** AP is already known to us as a STA */
|
||||
WLC_E_PRUNE_CCXFAST_DROAM = 14 + WLC_E_PRUNE_REASON_OFFSET, /** CCX FAST ROAM: prune unqualified AP */
|
||||
WLC_E_PRUNE_WDS_PEER = 15 + WLC_E_PRUNE_REASON_OFFSET, /** AP is already known to us as a WDS peer */
|
||||
WLC_E_PRUNE_QBSS_LOAD = 16 + WLC_E_PRUNE_REASON_OFFSET, /** QBSS LOAD - AAC is too low */
|
||||
WLC_E_PRUNE_HOME_AP = 17 + WLC_E_PRUNE_REASON_OFFSET, /** prune home AP */
|
||||
WLC_E_PRUNE_AP_BLOCKED = 18 + WLC_E_PRUNE_REASON_OFFSET, /** prune blocked AP */
|
||||
WLC_E_PRUNE_NO_DIAG_SUPPORT = 19 + WLC_E_PRUNE_REASON_OFFSET, /** prune due to diagnostic mode not supported */
|
||||
|
||||
/* WPA failure reason codes carried in the WLC_E_PSK_SUP event */
|
||||
WLC_E_SUP_OTHER = 0 + WLC_E_SUP_REASON_OFFSET, /** Other reason */
|
||||
WLC_E_SUP_DECRYPT_KEY_DATA = 1 + WLC_E_SUP_REASON_OFFSET, /** Decryption of key data failed */
|
||||
WLC_E_SUP_BAD_UCAST_WEP128 = 2 + WLC_E_SUP_REASON_OFFSET, /** Illegal use of ucast WEP128 */
|
||||
WLC_E_SUP_BAD_UCAST_WEP40 = 3 + WLC_E_SUP_REASON_OFFSET, /** Illegal use of ucast WEP40 */
|
||||
WLC_E_SUP_UNSUP_KEY_LEN = 4 + WLC_E_SUP_REASON_OFFSET, /** Unsupported key length */
|
||||
WLC_E_SUP_PW_KEY_CIPHER = 5 + WLC_E_SUP_REASON_OFFSET, /** Unicast cipher mismatch in pairwise key */
|
||||
WLC_E_SUP_MSG3_TOO_MANY_IE = 6 + WLC_E_SUP_REASON_OFFSET, /** WPA IE contains > 1 RSN IE in key msg 3 */
|
||||
WLC_E_SUP_MSG3_IE_MISMATCH = 7 + WLC_E_SUP_REASON_OFFSET, /** WPA IE mismatch in key message 3 */
|
||||
WLC_E_SUP_NO_INSTALL_FLAG = 8 + WLC_E_SUP_REASON_OFFSET, /** INSTALL flag unset in 4-way msg */
|
||||
WLC_E_SUP_MSG3_NO_GTK = 9 + WLC_E_SUP_REASON_OFFSET, /** encapsulated GTK missing from msg 3 */
|
||||
WLC_E_SUP_GRP_KEY_CIPHER = 10 + WLC_E_SUP_REASON_OFFSET, /** Multicast cipher mismatch in group key */
|
||||
WLC_E_SUP_GRP_MSG1_NO_GTK = 11 + WLC_E_SUP_REASON_OFFSET, /** encapsulated GTK missing from group msg 1 */
|
||||
WLC_E_SUP_GTK_DECRYPT_FAIL = 12 + WLC_E_SUP_REASON_OFFSET, /** GTK decrypt failure */
|
||||
WLC_E_SUP_SEND_FAIL = 13 + WLC_E_SUP_REASON_OFFSET, /** message send failure */
|
||||
WLC_E_SUP_DEAUTH = 14 + WLC_E_SUP_REASON_OFFSET, /** received FC_DEAUTH */
|
||||
WLC_E_SUP_WPA_PSK_TMO = 15 + WLC_E_SUP_REASON_OFFSET, /** WPA PSK 4-way handshake timeout */
|
||||
|
||||
DOT11_RC_RESERVED = 0 + WLC_E_DOT11_RC_REASON_OFFSET, /* d11 RC reserved */
|
||||
DOT11_RC_UNSPECIFIED = 1 + WLC_E_DOT11_RC_REASON_OFFSET, /* Unspecified reason */
|
||||
DOT11_RC_AUTH_INVAL = 2 + WLC_E_DOT11_RC_REASON_OFFSET, /* Previous authentication no longer valid */
|
||||
DOT11_RC_DEAUTH_LEAVING = 3 + WLC_E_DOT11_RC_REASON_OFFSET, /* Deauthenticated because sending station is leaving (or has left) IBSS or ESS */
|
||||
DOT11_RC_INACTIVITY = 4 + WLC_E_DOT11_RC_REASON_OFFSET, /* Disassociated due to inactivity */
|
||||
DOT11_RC_BUSY = 5 + WLC_E_DOT11_RC_REASON_OFFSET, /* Disassociated because AP is unable to handle all currently associated stations */
|
||||
DOT11_RC_INVAL_CLASS_2 = 6 + WLC_E_DOT11_RC_REASON_OFFSET, /* Class 2 frame received from nonauthenticated station */
|
||||
DOT11_RC_INVAL_CLASS_3 = 7 + WLC_E_DOT11_RC_REASON_OFFSET, /* Class 3 frame received from nonassociated station */
|
||||
DOT11_RC_DISASSOC_LEAVING = 8 + WLC_E_DOT11_RC_REASON_OFFSET, /* Disassociated because sending station is leaving (or has left) BSS */
|
||||
DOT11_RC_NOT_AUTH = 9 + WLC_E_DOT11_RC_REASON_OFFSET, /* Station requesting (re)association is not * authenticated with responding station */
|
||||
DOT11_RC_BAD_PC = 10 + WLC_E_DOT11_RC_REASON_OFFSET, /* Unacceptable power capability element */
|
||||
DOT11_RC_BAD_CHANNELS = 11 + WLC_E_DOT11_RC_REASON_OFFSET, /* Unacceptable supported channels element */
|
||||
/* 12 is unused */
|
||||
/* XXX 13-23 are WPA/802.11i reason codes defined in proto/wpa.h */
|
||||
/* 32-39 are QSTA specific reasons added in 11e */
|
||||
DOT11_RC_UNSPECIFIED_QOS = 32 + WLC_E_DOT11_RC_REASON_OFFSET, /* unspecified QoS-related reason */
|
||||
DOT11_RC_INSUFFCIENT_BW = 33 + WLC_E_DOT11_RC_REASON_OFFSET, /* QAP lacks sufficient bandwidth */
|
||||
DOT11_RC_EXCESSIVE_FRAMES = 34 + WLC_E_DOT11_RC_REASON_OFFSET, /* excessive number of frames need ack */
|
||||
DOT11_RC_TX_OUTSIDE_TXOP = 35 + WLC_E_DOT11_RC_REASON_OFFSET, /* transmitting outside the limits of txop */
|
||||
DOT11_RC_LEAVING_QBSS = 36 + WLC_E_DOT11_RC_REASON_OFFSET, /* QSTA is leaving the QBSS (or restting) */
|
||||
DOT11_RC_BAD_MECHANISM = 37 + WLC_E_DOT11_RC_REASON_OFFSET, /* does not want to use the mechanism */
|
||||
DOT11_RC_SETUP_NEEDED = 38 + WLC_E_DOT11_RC_REASON_OFFSET, /* mechanism needs a setup */
|
||||
DOT11_RC_TIMEOUT = 39 + WLC_E_DOT11_RC_REASON_OFFSET, /* timeout */
|
||||
DOT11_RC_MAX = 23 + WLC_E_DOT11_RC_REASON_OFFSET, /* Reason codes > 23 are reserved */
|
||||
|
||||
WLC_E_REASON_FORCE_32_BIT = 0x7FFFFFFE /** Force enum to be stored in 32 bit variable */
|
||||
} whd_event_reason_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
WLC_E_NAN_EVENT_START = 1, /* NAN cluster started */
|
||||
WLC_E_NAN_EVENT_JOIN = 2, /* Joined to a NAN cluster */
|
||||
WLC_E_NAN_EVENT_ROLE = 3, /* Role or State changed */
|
||||
WLC_E_NAN_EVENT_SCAN_COMPLETE = 4, WLC_E_NAN_EVENT_DISCOVERY_RESULT = 5, WLC_E_NAN_EVENT_REPLIED = 6,
|
||||
WLC_E_NAN_EVENT_TERMINATED = 7, /* the instance ID will be present in the ev data */
|
||||
WLC_E_NAN_EVENT_RECEIVE = 8
|
||||
|
||||
} whd_nan_events_t;
|
||||
|
||||
/**
|
||||
* Event handler prototype definition
|
||||
*
|
||||
* @param[out] whd_event_header_t : whd event header
|
||||
* @param[out] uint8_t* : event data
|
||||
* @param[out] handler_user_data : semaphore data
|
||||
*/
|
||||
typedef void *(*whd_event_handler_t)(whd_interface_t ifp, const whd_event_header_t *event_header,
|
||||
const uint8_t *event_data, void *handler_user_data);
|
||||
/** @endcond */
|
||||
|
||||
|
||||
extern whd_result_t whd_management_set_event_handler_locally(whd_interface_t ifp,
|
||||
const whd_event_num_t *event_nums,
|
||||
whd_event_handler_t handler_func,
|
||||
void *handler_user_data, uint16_t *event_index);
|
||||
|
||||
extern whd_result_t whd_management_set_event_handler(whd_interface_t ifp, const whd_event_num_t *event_nums,
|
||||
whd_event_handler_t handler_func,
|
||||
void *handler_user_data, uint16_t *event_index);
|
||||
|
||||
extern uint32_t whd_wifi_set_event_handler(whd_interface_t ifp, const uint32_t *event_type,
|
||||
whd_event_handler_t handler_func,
|
||||
void *handler_user_data, uint16_t *event_index);
|
||||
|
||||
extern uint32_t whd_wifi_deregister_event_handler(whd_interface_t ifp, uint16_t event_index);
|
||||
|
||||
/** @cond */
|
||||
|
||||
//extern void* whd_rrm_report_handler( const whd_event_header_t* event_header, const uint8_t* event_data, void* handler_user_data );
|
||||
|
||||
extern void *whd_nan_scan_handler(const whd_event_header_t *event_header, const uint8_t *event_data,
|
||||
void *handler_user_data);
|
||||
|
||||
#define WHD_MSG_IFNAME_MAX 16
|
||||
|
||||
/* Maximum number of events registered at a time */
|
||||
#define WHD_MAX_EVENT_SUBSCRIPTION 33
|
||||
|
||||
#define WHD_EVENT_NOT_REGISTERED 0xFF
|
||||
/* Enum to index and find the entry of paricular event registered */
|
||||
typedef enum
|
||||
{
|
||||
WHD_SCAN_EVENT_ENTRY = 0,
|
||||
WHD_JOIN_EVENT_ENTRY,
|
||||
WHD_AP_EVENT_ENTRY,
|
||||
WHD_P2P_EVENT_ENTRY,
|
||||
WHD_EVENT_ENTRY_MAX
|
||||
} whd_event_entry_t;
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct whd_event_eth_hdr
|
||||
{
|
||||
uint16_t subtype; /** Vendor specific..32769 */
|
||||
uint16_t length;
|
||||
uint8_t version; /** Version is 0 */
|
||||
uint8_t oui[3]; /** OUI */
|
||||
uint16_t usr_subtype; /** user specific Data */
|
||||
} whd_event_eth_hdr_t;
|
||||
|
||||
typedef struct whd_event_ether_header
|
||||
{
|
||||
whd_mac_t destination_address;
|
||||
whd_mac_t source_address;
|
||||
uint16_t ethertype;
|
||||
} whd_event_ether_header_t;
|
||||
|
||||
struct whd_event_msg
|
||||
{
|
||||
uint16_t version;
|
||||
uint16_t flags; /* see flags below */
|
||||
uint32_t event_type; /* Message (see below) */
|
||||
uint32_t status; /* Status code (see below) */
|
||||
uint32_t reason; /* Reason code (if applicable) */
|
||||
uint32_t auth_type; /* WLC_E_AUTH */
|
||||
uint32_t datalen; /* data buf */
|
||||
whd_mac_t addr; /* Station address (if applicable) */
|
||||
char ifname[WHD_MSG_IFNAME_MAX]; /* name of the packet incoming interface */
|
||||
uint8_t ifidx; /* destination OS i/f index */
|
||||
uint8_t bsscfgidx; /* source bsscfg index */
|
||||
};
|
||||
|
||||
/* used by driver msgs */
|
||||
typedef struct whd_event
|
||||
{
|
||||
whd_event_ether_header_t eth;
|
||||
whd_event_eth_hdr_t eth_evt_hdr;
|
||||
whd_event_header_t whd_event;
|
||||
/* data portion follows */
|
||||
} whd_event_t;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
/** @endcond */
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
#endif /* ifndef INCLUDED_WHD_EVENTS_H */
|
||||
|
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* Header for whd_driver structure
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_WHD_INT_H
|
||||
#define INCLUDED_WHD_INT_H
|
||||
|
||||
#include "whd_thread.h"
|
||||
#include "whd_sdpcm.h"
|
||||
#include "whd_cdc_bdc.h"
|
||||
#include "whd_chip.h"
|
||||
#include "whd_ap.h"
|
||||
#include "whd_debug.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t tx_total; /* Total number of TX packets sent from WHD */
|
||||
uint32_t rx_total; /* Total number of RX packets received at WHD */
|
||||
uint32_t tx_no_mem; /* Number of times WHD could not send due to no buffer */
|
||||
uint32_t rx_no_mem; /* Number of times WHD could not receive due to no buffer */
|
||||
uint32_t tx_fail; /* Number of times TX packet failed */
|
||||
uint32_t no_credit; /* Number of times WHD could not send due to no credit */
|
||||
uint32_t flow_control; /* Number of times WHD Flow control is enabled */
|
||||
uint32_t internal_host_buffer_fail_with_timeout; /* Internal host buffer get failed after timeout */
|
||||
} whd_stats_t;
|
||||
|
||||
#define WHD_INTERFACE_MAX 3
|
||||
typedef enum
|
||||
{
|
||||
WHD_INVALID_ROLE = 0,
|
||||
WHD_STA_ROLE = 1, /**< STA or Client Interface */
|
||||
WHD_AP_ROLE = 2, /**< softAP Interface */
|
||||
WHD_P2P_ROLE = 3, /**< P2P Interface */
|
||||
} whd_interface_role_t;
|
||||
|
||||
|
||||
struct whd_interface
|
||||
{
|
||||
whd_driver_t whd_driver;
|
||||
uint8_t ifidx;
|
||||
uint8_t bsscfgidx;
|
||||
|
||||
char if_name[WHD_MSG_IFNAME_MAX];
|
||||
whd_interface_role_t role;
|
||||
whd_mac_t mac_addr;
|
||||
uint8_t event_reg_list[WHD_EVENT_ENTRY_MAX];
|
||||
whd_bool_t state;
|
||||
};
|
||||
|
||||
struct whd_driver
|
||||
{
|
||||
whd_interface_t iflist[WHD_INTERFACE_MAX];
|
||||
uint8_t if2ifp[WHD_INTERFACE_MAX];
|
||||
|
||||
/* Bus variables */
|
||||
struct whd_bus_info *bus_if;
|
||||
struct whd_bus_priv *bus_priv;
|
||||
struct whd_bus_common_info *bus_common_info;
|
||||
whd_buffer_funcs_t *buffer_if;
|
||||
whd_netif_funcs_t *network_if;
|
||||
whd_resource_source_t *resource_if;
|
||||
|
||||
whd_bool_t bus_gspi_32bit;
|
||||
|
||||
whd_thread_info_t thread_info;
|
||||
whd_cdc_bdc_info_t cdc_bdc_info;
|
||||
whd_sdpcm_info_t sdpcm_info;
|
||||
whd_internal_info_t internal_info;
|
||||
whd_ap_int_info_t ap_info;
|
||||
whd_chip_info_t chip_info;
|
||||
|
||||
whd_stats_t whd_stats;
|
||||
whd_country_code_t country;
|
||||
|
||||
whd_ioctl_log_t whd_ioctl_log[WHD_IOCTL_LOG_SIZE];
|
||||
int whd_ioctl_log_index;
|
||||
};
|
||||
|
||||
whd_result_t whd_add_interface(whd_driver_t whd_driver, uint8_t bsscfgidx, uint8_t ifidx,
|
||||
const char *name, whd_mac_t *mac_addr, whd_interface_t *ifpp);
|
||||
|
||||
whd_result_t whd_add_primary_interface(whd_driver_t whd_driver, whd_interface_t *ifpp);
|
||||
|
||||
whd_interface_t whd_get_primary_interface(whd_driver_t whd_driver);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
#endif /* INCLUDED_WHD_INT_H */
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* Provides prototypes / declarations for common APSTA functionality
|
||||
*/
|
||||
#ifndef _WHD_INTERNAL_NETWORK_API_H_
|
||||
#define _WHD_INTERNAL_NETWORK_API_H_
|
||||
|
||||
#include "whd.h"
|
||||
#include "whd_int.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Structures
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Function prototypes
|
||||
******************************************************/
|
||||
/** Called by WHD to pass received data to the network stack
|
||||
*
|
||||
*
|
||||
* Packets received from the Wi-Fi network by WHD are forwarded to by calling function ptr which
|
||||
* must be implemented in the network interface. Ethernet headers
|
||||
* are present at the start of these packet buffers.
|
||||
*
|
||||
* This function is called asynchronously in the context of the
|
||||
* WHD thread whenever new data has arrived.
|
||||
* Packet buffers are allocated within WHD, and ownership is transferred
|
||||
* to the network stack. The network stack or application is thus
|
||||
* responsible for releasing the packet buffers.
|
||||
* Most packet buffering systems have a pointer to the 'current point' within
|
||||
* the packet buffer. When this function is called, the pointer points
|
||||
* to the start of the Ethernet header. There is other inconsequential data
|
||||
* before the Ethernet header.
|
||||
*
|
||||
* It is preferable that the (whd_network_process_ethernet_data)() function simply puts
|
||||
* the received packet on a queue for processing by another thread. This avoids the
|
||||
* WHD thread being unnecessarily tied up which would delay other packets
|
||||
* being transmitted or received.
|
||||
*
|
||||
* @param interface : The interface on which the packet was received.
|
||||
* @param buffer : Handle of the packet which has just been received. Responsibility for
|
||||
* releasing this buffer is transferred from WHD at this point.
|
||||
*
|
||||
*/
|
||||
whd_result_t whd_network_process_ethernet_data(whd_interface_t ifp, whd_buffer_t buffer);
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* ifndef _WHD_INTERNAL_NETWORK_API_H_ */
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* Header for using WHD with no RTOS or network stack
|
||||
*
|
||||
* It is possible to use these WHD without any operating system. To do this,
|
||||
* the user application is required to periodically use the functions in this
|
||||
* file to allow WHD to send and receive data across the SPI/SDIO bus.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "whd.h"
|
||||
|
||||
#ifndef INCLUDED_WHD_POLL_H
|
||||
#define INCLUDED_WHD_POLL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Function declarations
|
||||
******************************************************/
|
||||
|
||||
|
||||
/** Sends the first queued packet
|
||||
*
|
||||
* Checks the queue to determine if there is any packets waiting
|
||||
* to be sent. If there are, then it sends the first one.
|
||||
*
|
||||
* This function is normally used by the WHD Thread, but can be
|
||||
* called periodically by systems which have no RTOS to ensure
|
||||
* packets get sent.
|
||||
*
|
||||
* @return 1 : packet was sent
|
||||
* 0 : no packet sent
|
||||
*/
|
||||
extern int8_t whd_thread_send_one_packet(whd_driver_t whd_driver);
|
||||
|
||||
|
||||
/** Receives a packet if one is waiting
|
||||
*
|
||||
* Checks the wifi chip fifo to determine if there is any packets waiting
|
||||
* to be received. If there are, then it receives the first one, and calls
|
||||
* the callback @ref whd_sdpcm_process_rx_packet (in whd_sdpcm.c).
|
||||
*
|
||||
* This function is normally used by the WHD Thread, but can be
|
||||
* called periodically by systems which have no RTOS to ensure
|
||||
* packets get received properly.
|
||||
*
|
||||
* @return 1 : packet was received
|
||||
* 0 : no packet waiting
|
||||
*/
|
||||
extern int8_t whd_thread_receive_one_packet(whd_driver_t whd_driver);
|
||||
|
||||
|
||||
/** Sends and Receives all waiting packets
|
||||
*
|
||||
* Repeatedly calls whd_thread_send_one_packet and whd_thread_receive_one_packet
|
||||
* to send and receive packets, until there are no more packets waiting to
|
||||
* be transferred.
|
||||
*
|
||||
* This function is normally used by the WHD Thread, but can be
|
||||
* called periodically by systems which have no RTOS to ensure
|
||||
* packets get send and received properly.
|
||||
*
|
||||
* @return 1 : packet was sent or received
|
||||
* 0 : no packet was sent or received
|
||||
*/
|
||||
extern int8_t whd_thread_poll_all(whd_driver_t whd_driver);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
#endif /* ifndef INCLUDED_WHD_POLL_H */
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* Provides prototypes / declarations for common APSTA functionality
|
||||
*/
|
||||
#ifndef _WHD_INTERNAL_RESOURCE_API_H_
|
||||
#define _WHD_INTERNAL_RESOURCE_API_H_
|
||||
|
||||
#include "whd.h"
|
||||
#include "whd_int.h"
|
||||
#include "whd_resource_api.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Structures
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Function prototypes
|
||||
******************************************************/
|
||||
uint32_t whd_resource_size(whd_driver_t whd_driver, whd_resource_type_t resource, uint32_t *size_out);
|
||||
uint32_t whd_get_resource_block_size(whd_driver_t whd_drv, whd_resource_type_t type, uint32_t *size_out);
|
||||
uint32_t whd_get_resource_no_of_blocks(whd_driver_t whd_drv, whd_resource_type_t type, uint32_t *block_count);
|
||||
uint32_t whd_get_resource_block(whd_driver_t whd_driver, whd_resource_type_t type, const uint8_t **data,
|
||||
uint32_t *size_out);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* ifndef _WHD_INTERNAL_RESOURCE_API_H_ */
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* Provides whd with function prototypes for IOCTL commands,
|
||||
* and for communicating with the SDPCM module
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_WHD_SDPCM_H
|
||||
#define INCLUDED_WHD_SDPCM_H
|
||||
|
||||
#include "whd.h"
|
||||
#include "whd_events_int.h"
|
||||
#include "cyabs_rtos.h"
|
||||
#include "whd_network_types.h"
|
||||
#include "whd_types_int.h"
|
||||
#include "whd_cdc_bdc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
typedef enum
|
||||
{
|
||||
DATA_HEADER = 2,
|
||||
ASYNCEVENT_HEADER = 1,
|
||||
CONTROL_HEADER = 0
|
||||
} sdpcm_header_type_t;
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
|
||||
#define BUS_HEADER_LEN (12)
|
||||
#define IOCTL_OFFSET (sizeof(whd_buffer_header_t) + 12 + 16)
|
||||
|
||||
/******************************************************
|
||||
* Structures
|
||||
******************************************************/
|
||||
typedef struct whd_sdpcm_info
|
||||
{
|
||||
/* Bus data credit variables */
|
||||
uint8_t packet_transmit_sequence_number;
|
||||
uint8_t last_bus_data_credit;
|
||||
uint8_t credit_diff;
|
||||
uint8_t largest_credit_diff;
|
||||
|
||||
/* Packet send queue variables */
|
||||
cy_semaphore_t send_queue_mutex;
|
||||
whd_buffer_t send_queue_head;
|
||||
whd_buffer_t send_queue_tail;
|
||||
|
||||
} whd_sdpcm_info_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
whd_buffer_header_t buffer_header;
|
||||
uint8_t bus_header[BUS_HEADER_LEN];
|
||||
} bus_common_header_t;
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct
|
||||
{
|
||||
bus_common_header_t common;
|
||||
cdc_header_t cdc_header;
|
||||
} control_header_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bus_common_header_t common;
|
||||
uint8_t _padding[2];
|
||||
bdc_header_t bdc_header;
|
||||
} data_header_t;
|
||||
#pragma pack()
|
||||
|
||||
/******************************************************
|
||||
* Function declarations
|
||||
******************************************************/
|
||||
|
||||
extern void whd_sdpcm_process_rx_packet(whd_driver_t whd_driver, whd_buffer_t buffer);
|
||||
extern whd_result_t whd_sdpcm_init(whd_driver_t whd_driver);
|
||||
extern void whd_sdpcm_quit(whd_driver_t whd_driver);
|
||||
extern void whd_sdpcm_bus_vars_init(whd_driver_t whd_driver);
|
||||
extern void whd_sdpcm_quit(whd_driver_t whd_driver);
|
||||
extern whd_bool_t whd_sdpcm_has_tx_packet(whd_driver_t whd_driver);
|
||||
|
||||
extern whd_result_t whd_sdpcm_get_packet_to_send(whd_driver_t whd_driver, whd_buffer_t *buffer);
|
||||
extern void whd_sdpcm_update_credit(whd_driver_t whd_driver, uint8_t *data);
|
||||
extern uint8_t whd_sdpcm_get_available_credits(whd_driver_t whd_driver);
|
||||
extern void whd_update_host_interface_to_bss_index_mapping(whd_driver_t whd_driver, whd_interface_t interface,
|
||||
uint32_t bssid_index);
|
||||
|
||||
extern void whd_send_to_bus(whd_driver_t whd_driver, whd_buffer_t buffer,
|
||||
sdpcm_header_type_t header_type);
|
||||
|
||||
/******************************************************
|
||||
* Global variables
|
||||
******************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* ifndef INCLUDED_WHD_SDPCM_H */
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* The whd Thread allows thread safe access to the whd hardware bus
|
||||
* This is an whd internal file and should not be used by functions outside whd.
|
||||
*
|
||||
* This file provides prototypes for functions which allow multiple threads to use the whd hardware bus (SDIO or SPI)
|
||||
* This is achieved by having a single thread (the "whd Thread") which queues messages to be sent, sending
|
||||
* them sequentially, as well as receiving messages as they arrive.
|
||||
*
|
||||
* Messages to be sent come from the @ref whd_sdpcm_send_common function in whd_sdpcm.c . The messages already
|
||||
* contain SDPCM headers, but not any bus headers (GSPI), and are passed via a queue
|
||||
* This function can be called from any thread.
|
||||
*
|
||||
* Messages are received by way of a callback supplied by in whd_sdpcm.c - whd_sdpcm_process_rx_packet
|
||||
* Received messages are delivered in the context of the whd Thread, so the callback function needs to avoid blocking.
|
||||
*
|
||||
*/
|
||||
#include "cyabs_rtos.h"
|
||||
#include "whd.h"
|
||||
|
||||
#ifndef INCLUDED_WHD_THREAD_H_
|
||||
#define INCLUDED_WHD_THREAD_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
#define WHD_THREAD_RX_BOUND (20)
|
||||
|
||||
typedef struct whd_thread_info
|
||||
{
|
||||
|
||||
volatile whd_bool_t thread_quit_flag;
|
||||
volatile whd_bool_t whd_inited;
|
||||
cy_thread_t whd_thread;
|
||||
cy_semaphore_t transceive_semaphore;
|
||||
volatile whd_bool_t bus_interrupt;
|
||||
void *thread_stack_start;
|
||||
uint32_t thread_stack_size;
|
||||
cy_thread_priority_t thread_priority;
|
||||
|
||||
} whd_thread_info_t;
|
||||
|
||||
void whd_thread_info_init(whd_driver_t whd_driver, whd_init_config_t *whd_init_config);
|
||||
|
||||
/** Initialises the whd Thread
|
||||
*
|
||||
* Initialises the whd thread, and its flags/semaphores,
|
||||
* then starts it running
|
||||
*
|
||||
* @return whd result code
|
||||
*/
|
||||
extern whd_result_t whd_thread_init(whd_driver_t whd_driver);
|
||||
|
||||
|
||||
/** Terminates the whd Thread
|
||||
*
|
||||
* Sets a flag then wakes the whd Thread to force it to terminate.
|
||||
*
|
||||
*/
|
||||
extern void whd_thread_quit(whd_driver_t whd_driver);
|
||||
|
||||
|
||||
extern void whd_thread_notify(whd_driver_t whd_driver);
|
||||
extern void whd_thread_notify_irq(whd_driver_t whd_driver);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* ifndef INCLUDED_WHD_THREAD_H_ */
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_WHD_THREAD_INTERNAL_H
|
||||
#define INCLUDED_WHD_THREAD_INTERNAL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "whd_debug.h"
|
||||
#include "whd_int.h"
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
|
||||
#define WHD_WLAN_KEEP_AWAKE(whd_driver) \
|
||||
do { \
|
||||
whd_result_t verify_result; \
|
||||
whd_driver->internal_info.whd_wlan_status.keep_wlan_awake++; \
|
||||
verify_result = whd_ensure_wlan_bus_is_up(whd_driver); \
|
||||
whd_assert("Could not bring bus up", (verify_result == WHD_SUCCESS) ); \
|
||||
} while (0)
|
||||
#define WHD_WLAN_LET_SLEEP(whd_driver) \
|
||||
do { \
|
||||
whd_driver->internal_info.whd_wlan_status.keep_wlan_awake--; \
|
||||
if (whd_driver->internal_info.whd_wlan_status.keep_wlan_awake == 0) \
|
||||
whd_thread_notify(whd_driver); \
|
||||
} while (0)
|
||||
#define WHD_WLAN_MAY_SLEEP() \
|
||||
( (whd_driver->internal_info.whd_wlan_status.keep_wlan_awake == 0) && \
|
||||
(whd_driver->internal_info.whd_wlan_status.state == WLAN_UP) )
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* ifndef INCLUDED_WHD_THREAD_INTERNAL_H */
|
||||
|
|
@ -0,0 +1,407 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* Defines common constants used with WHD within src folder
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_WHD_TYPES_INT_H_
|
||||
#define INCLUDED_WHD_TYPES_INT_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
#define MAX_BUS_HEADER_SIZE 4
|
||||
|
||||
/**
|
||||
* The size of an Ethernet header
|
||||
*/
|
||||
#define WHD_ETHERNET_SIZE (14)
|
||||
|
||||
/**
|
||||
* Ethernet Ethertypes
|
||||
*/
|
||||
#define WHD_ETHERTYPE_IPv4 0x0800
|
||||
#define WHD_ETHERTYPE_IPv6 0x86DD
|
||||
#define WHD_ETHERTYPE_ARP 0x0806
|
||||
#define WHD_ETHERTYPE_RARP 0x8035
|
||||
#define WHD_ETHERTYPE_EAPOL 0x888E
|
||||
#define WHD_ETHERTYPE_DOT1AS 0x88F7
|
||||
#define WHD_ETHERTYPE_8021Q 0x8100
|
||||
|
||||
/* bss_info_cap_t flags */
|
||||
#define WL_BSS_FLAGS_FROM_BEACON 0x01 /* bss_info derived from beacon */
|
||||
#define WL_BSS_FLAGS_FROM_CACHE 0x02 /* bss_info collected from cache */
|
||||
#define WL_BSS_FLAGS_RSSI_ONCHANNEL 0x04 /* rssi info received on channel (vs offchannel) */
|
||||
#define WL_BSS_FLAGS_HS20 0x08 /* hotspot 2.0 capable */
|
||||
#define WL_BSS_FLAGS_RSSI_INVALID 0x10 /* BSS contains invalid RSSI */
|
||||
#define WL_BSS_FLAGS_RSSI_INACCURATE 0x20 /* BSS contains inaccurate RSSI */
|
||||
#define WL_BSS_FLAGS_SNR_INVALID 0x40 /* BSS contains invalid SNR */
|
||||
#define WL_BSS_FLAGS_NF_INVALID 0x80 /* BSS contains invalid noise floor */
|
||||
|
||||
#define HT_CAPABILITIES_IE_LENGTH (26)
|
||||
#define DOT11_OUI_LEN (3)/** Length in bytes of 802.11 OUI*/
|
||||
|
||||
#define WHD_ETHER_ADDR_STR_LEN (18)
|
||||
#define WHD_ETHER_ADDR_LEN (6)
|
||||
|
||||
#define CHECK_IOCTL_BUFFER(buff) if (buff == \
|
||||
NULL){ WPRINT_WHD_ERROR( ("Buffer alloc failed in function %s at line %d \n", \
|
||||
__func__, __LINE__) ); \
|
||||
return WHD_BUFFER_ALLOC_FAIL; }
|
||||
#define CHECK_RETURN(expr) { \
|
||||
whd_result_t check_res = (expr); \
|
||||
if (check_res != WHD_SUCCESS) \
|
||||
{ \
|
||||
WPRINT_WHD_ERROR( ("Function %s failed at line %d checkres = %u \n", \
|
||||
__func__, __LINE__, \
|
||||
(unsigned int)check_res) ); \
|
||||
return check_res; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define CHECK_RETURN_UNSUPPORTED_OK(expr) { whd_result_t check_res = (expr); \
|
||||
if (check_res != WHD_SUCCESS) \
|
||||
{ \
|
||||
return check_res; \
|
||||
} \
|
||||
}
|
||||
#define CHECK_RETURN_UNSUPPORTED_CONTINUE(expr) { whd_result_t check_res = (expr); \
|
||||
if (check_res != WHD_SUCCESS && check_res != WHD_WLAN_UNSUPPORTED) \
|
||||
{ \
|
||||
return check_res; \
|
||||
} \
|
||||
}
|
||||
#define RETURN_WITH_ASSERT(expr) { whd_result_t check_res = (expr); \
|
||||
whd_assert("Command failed\n", check_res == WHD_SUCCESS); \
|
||||
return check_res; }
|
||||
|
||||
#define CHECK_RETURN_IGNORE(expr) { whd_result_t check_res = (expr); \
|
||||
if (check_res != WHD_SUCCESS) \
|
||||
{ \
|
||||
} \
|
||||
}
|
||||
|
||||
#define CHECK_IFP_NULL(ifp) if (ifp == \
|
||||
NULL){ WPRINT_WHD_ERROR( ( \
|
||||
"Interface is not up/NULL and failed in function %s at line %d \n", \
|
||||
__func__, __LINE__) ); \
|
||||
return WHD_UNKNOWN_INTERFACE; }
|
||||
|
||||
#define CHECK_DRIVER_NULL(driver) if (driver == \
|
||||
NULL){ WPRINT_WHD_ERROR( ( \
|
||||
"WHD driver is not up/NULL and failed in function %s at line %d \n", \
|
||||
__func__, __LINE__) ); \
|
||||
return WHD_DOES_NOT_EXIST; }
|
||||
|
||||
#define MIN_OF(x, y) ( (x) < (y) ? (x) : (y) )
|
||||
#define MAX_OF(x, y) ( (x) > (y) ? (x) : (y) )
|
||||
|
||||
#ifndef ROUND_UP
|
||||
#define ROUND_UP(x, y) ( (x) % (y) ? (x) + (y) - ( (x) % (y) ) : (x) )
|
||||
#endif
|
||||
|
||||
#ifndef DIV_ROUND_UP
|
||||
#define DIV_ROUND_UP(m, n) ( ( (m) + (n) - 1 ) / (n) )
|
||||
#endif
|
||||
|
||||
#define WHD_WRITE_16(pointer, value) (*( (uint16_t *)pointer ) = value)
|
||||
#define WHD_WRITE_32(pointer, value) (*( (uint32_t *)pointer ) = value)
|
||||
#define WHD_READ_16(pointer) *( (uint16_t *)pointer )
|
||||
#define WHD_READ_32(pointer) *( (uint32_t *)pointer )
|
||||
|
||||
/**
|
||||
* Macro for checking for NULL MAC addresses
|
||||
*/
|
||||
#define NULL_MAC(a) ( ( ( ( (unsigned char *)a )[0] ) == 0 ) && \
|
||||
( ( ( (unsigned char *)a )[1] ) == 0 ) && \
|
||||
( ( ( (unsigned char *)a )[2] ) == 0 ) && \
|
||||
( ( ( (unsigned char *)a )[3] ) == 0 ) && \
|
||||
( ( ( (unsigned char *)a )[4] ) == 0 ) && \
|
||||
( ( ( (unsigned char *)a )[5] ) == 0 ) )
|
||||
|
||||
/**
|
||||
* Macro for checking for Broadcast address
|
||||
*/
|
||||
#define BROADCAST_ID(a) ( ( ( ( (unsigned char *)a )[0] ) == 255 ) && \
|
||||
( ( ( (unsigned char *)a )[1] ) == 255 ) && \
|
||||
( ( ( (unsigned char *)a )[2] ) == 255 ) && \
|
||||
( ( ( (unsigned char *)a )[3] ) == 255 ) && \
|
||||
( ( ( (unsigned char *)a )[4] ) == 255 ) && \
|
||||
( ( ( (unsigned char *)a )[5] ) == 255 ) )
|
||||
|
||||
/* Suppress unused variable warning occurring due to an assert which is disabled in release mode */
|
||||
#define REFERENCE_DEBUG_ONLY_VARIABLE(x) ( (void)(x) )
|
||||
|
||||
/* Suppress unused parameter warning */
|
||||
#define UNUSED_PARAMETER(x) ( (void)(x) )
|
||||
|
||||
/* Suppress unused variable warning */
|
||||
#define UNUSED_VARIABLE(x) ( (void)(x) )
|
||||
|
||||
#if defined (__IAR_SYSTEMS_ICC__)
|
||||
#define DISABLE_COMPILER_WARNING(x) _Pragma(#x)
|
||||
#define ENABLE_COMPILER_WARNING(x) _Pragma(#x)
|
||||
#else
|
||||
#define DISABLE_COMPILER_WARNING(x)
|
||||
#define ENABLE_COMPILER_WARNING(x)
|
||||
#endif
|
||||
|
||||
/******************************************************
|
||||
* Type Definitions
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Structures and Enumerations
|
||||
******************************************************/
|
||||
#pragma pack(1)
|
||||
typedef struct
|
||||
{
|
||||
whd_buffer_queue_ptr_t queue_next;
|
||||
char bus_header[MAX_BUS_HEADER_SIZE];
|
||||
} whd_buffer_header_t;
|
||||
#pragma pack()
|
||||
|
||||
/* 802.11 Information Element Identification Numbers (as per section 8.4.2.1 of 802.11-2012) */
|
||||
typedef enum
|
||||
{
|
||||
DOT11_IE_ID_SSID = 0,
|
||||
DOT11_IE_ID_SUPPORTED_RATES = 1,
|
||||
DOT11_IE_ID_FH_PARAMETER_SET = 2,
|
||||
DOT11_IE_ID_DSSS_PARAMETER_SET = 3,
|
||||
DOT11_IE_ID_CF_PARAMETER_SET = 4,
|
||||
DOT11_IE_ID_TIM = 5,
|
||||
DOT11_IE_ID_IBSS_PARAMETER_SET = 6,
|
||||
DOT11_IE_ID_COUNTRY = 7,
|
||||
DOT11_IE_ID_HOPPING_PATTERN_PARAMETERS = 8,
|
||||
DOT11_IE_ID_HOPPING_PATTERN_TABLE = 9,
|
||||
DOT11_IE_ID_REQUEST = 10,
|
||||
DOT11_IE_ID_BSS_LOAD = 11,
|
||||
DOT11_IE_ID_EDCA_PARAMETER_SET = 12,
|
||||
DOT11_IE_ID_TSPEC = 13,
|
||||
DOT11_IE_ID_TCLAS = 14,
|
||||
DOT11_IE_ID_SCHEDULE = 15,
|
||||
DOT11_IE_ID_CHALLENGE_TEXT = 16,
|
||||
/* 17-31 Reserved */
|
||||
DOT11_IE_ID_POWER_CONSTRAINT = 32,
|
||||
DOT11_IE_ID_POWER_CAPABILITY = 33,
|
||||
DOT11_IE_ID_TPC_REQUEST = 34,
|
||||
DOT11_IE_ID_TPC_REPORT = 35,
|
||||
DOT11_IE_ID_SUPPORTED_CHANNELS = 36,
|
||||
DOT11_IE_ID_CHANNEL_SWITCH_ANNOUNCEMENT = 37,
|
||||
DOT11_IE_ID_MEASUREMENT_REQUEST = 38,
|
||||
DOT11_IE_ID_MEASUREMENT_REPORT = 39,
|
||||
DOT11_IE_ID_QUIET = 40,
|
||||
DOT11_IE_ID_IBSS_DFS = 41,
|
||||
DOT11_IE_ID_ERP = 42,
|
||||
DOT11_IE_ID_TS_DELAY = 43,
|
||||
DOT11_IE_ID_TCLAS_PROCESSING = 44,
|
||||
DOT11_IE_ID_HT_CAPABILITIES = 45,
|
||||
DOT11_IE_ID_QOS_CAPABILITY = 46,
|
||||
/* 47 Reserved */
|
||||
DOT11_IE_ID_RSN = 48,
|
||||
/* 49 Reserved */
|
||||
DOT11_IE_ID_EXTENDED_SUPPORTED_RATES = 50,
|
||||
DOT11_IE_ID_AP_CHANNEL_REPORT = 51,
|
||||
DOT11_IE_ID_NEIGHBOR_REPORT = 52,
|
||||
DOT11_IE_ID_RCPI = 53,
|
||||
DOT11_IE_ID_MOBILITY_DOMAIN = 54,
|
||||
DOT11_IE_ID_FAST_BSS_TRANSITION = 55,
|
||||
DOT11_IE_ID_TIMEOUT_INTERVAL = 56,
|
||||
DOT11_IE_ID_RIC_DATA = 57,
|
||||
DOT11_IE_ID_DSE_REGISTERED_LOCATION = 58,
|
||||
DOT11_IE_ID_SUPPORTED_OPERATING_CLASSES = 59,
|
||||
DOT11_IE_ID_EXTENDED_CHANNEL_SWITCH_ANNOUNCEMENT = 60,
|
||||
DOT11_IE_ID_HT_OPERATION = 61,
|
||||
DOT11_IE_ID_SECONDARY_CHANNEL_OFFSET = 62,
|
||||
DOT11_IE_ID_BSS_AVERAGE_ACCESS_DELAY = 63,
|
||||
DOT11_IE_ID_ANTENNA = 64,
|
||||
DOT11_IE_ID_RSNI = 65,
|
||||
DOT11_IE_ID_MEASUREMENT_PILOT_TRANSMISSION = 66,
|
||||
DOT11_IE_ID_BSS_AVAILABLE_ADMISSION_CAPACITY = 67,
|
||||
DOT11_IE_ID_BSS_AC_ACCESS_DELAY = 68,
|
||||
DOT11_IE_ID_TIME_ADVERTISEMENT = 69,
|
||||
DOT11_IE_ID_RM_ENABLED_CAPABILITIES = 70,
|
||||
DOT11_IE_ID_MULTIPLE_BSSID = 71,
|
||||
DOT11_IE_ID_20_40_BSS_COEXISTENCE = 72,
|
||||
DOT11_IE_ID_20_40_BSS_INTOLERANT_CHANNEL_REPORT = 73,
|
||||
DOT11_IE_ID_OVERLAPPING_BSS_SCAN_PARAMETERS = 74,
|
||||
DOT11_IE_ID_RIC_DESCRIPTOR = 75,
|
||||
DOT11_IE_ID_MANAGEMENT_MIC = 76,
|
||||
DOT11_IE_ID_EVENT_REQUEST = 78,
|
||||
DOT11_IE_ID_EVENT_REPORT = 79,
|
||||
DOT11_IE_ID_DIAGNOSTIC_REQUEST = 80,
|
||||
DOT11_IE_ID_DIAGNOSTIC_REPORT = 81,
|
||||
DOT11_IE_ID_LOCATION_PARAMETERS = 82,
|
||||
DOT11_IE_ID_NONTRANSMITTED_BSSID_CAPABILITY = 83,
|
||||
DOT11_IE_ID_SSID_LIST = 84,
|
||||
DOT11_IE_ID_MULTIPLE_BSSID_INDEX = 85,
|
||||
DOT11_IE_ID_FMS_DESCRIPTOR = 86,
|
||||
DOT11_IE_ID_FMS_REQUEST = 87,
|
||||
DOT11_IE_ID_FMS_RESPONSE = 88,
|
||||
DOT11_IE_ID_QOS_TRAFFIC_CAPABILITY = 89,
|
||||
DOT11_IE_ID_BSS_MAX_IDLE_PERIOD = 90,
|
||||
DOT11_IE_ID_TFS_REQUEST = 91,
|
||||
DOT11_IE_ID_TFS_RESPONSE = 92,
|
||||
DOT11_IE_ID_WNM_SLEEP_MODE = 93,
|
||||
DOT11_IE_ID_TIM_BROADCAST_REQUEST = 94,
|
||||
DOT11_IE_ID_TIM_BROADCAST_RESPONSE = 95,
|
||||
DOT11_IE_ID_COLLOCATED_INTERFERENCE_REPORT = 96,
|
||||
DOT11_IE_ID_CHANNEL_USAGE = 97,
|
||||
DOT11_IE_ID_TIME_ZONE = 98,
|
||||
DOT11_IE_ID_DMS_REQUEST = 99,
|
||||
DOT11_IE_ID_DMS_RESPONSE = 100,
|
||||
DOT11_IE_ID_LINK_IDENTIFIER = 101,
|
||||
DOT11_IE_ID_WAKEUP_SCHEDULE = 102,
|
||||
/* 103 Reserved */
|
||||
DOT11_IE_ID_CHANNEL_SWITCH_TIMING = 104,
|
||||
DOT11_IE_ID_PTI_CONTROL = 105,
|
||||
DOT11_IE_ID_TPU_BUFFER_STATUS = 106,
|
||||
DOT11_IE_ID_INTERWORKING = 107,
|
||||
DOT11_IE_ID_ADVERTISMENT_PROTOCOL = 108,
|
||||
DOT11_IE_ID_EXPEDITED_BANDWIDTH_REQUEST = 109,
|
||||
DOT11_IE_ID_QOS_MAP_SET = 110,
|
||||
DOT11_IE_ID_ROAMING_CONSORTIUM = 111,
|
||||
DOT11_IE_ID_EMERGENCY_ALERT_IDENTIFIER = 112,
|
||||
DOT11_IE_ID_MESH_CONFIGURATION = 113,
|
||||
DOT11_IE_ID_MESH_ID = 114,
|
||||
DOT11_IE_ID_MESH_LINK_METRIC_REPORT = 115,
|
||||
DOT11_IE_ID_CONGESTION_NOTIFICATION = 116,
|
||||
DOT11_IE_ID_MESH_PEERING_MANAGEMENT = 117,
|
||||
DOT11_IE_ID_MESH_CHANNEL_SWITCH_PARAMETERS = 118,
|
||||
DOT11_IE_ID_MESH_AWAKE_WINDOW = 119,
|
||||
DOT11_IE_ID_BEACON_TIMING = 120,
|
||||
DOT11_IE_ID_MCCAOP_SETUP_REQUEST = 121,
|
||||
DOT11_IE_ID_MCCAOP_SETUP_REPLY = 122,
|
||||
DOT11_IE_ID_MCCAOP_ADVERTISMENT = 123,
|
||||
DOT11_IE_ID_MCCAOP_TEARDOWN = 124,
|
||||
DOT11_IE_ID_GANN = 125,
|
||||
DOT11_IE_ID_RANN = 126,
|
||||
DOT11_IE_ID_EXTENDED_CAPABILITIES = 127,
|
||||
/* 128-129 Reserved */
|
||||
DOT11_IE_ID_PREQ = 130,
|
||||
DOT11_IE_ID_PREP = 131,
|
||||
DOT11_IE_ID_PERR = 132,
|
||||
/* 133-136 Reserved */
|
||||
DOT11_IE_ID_PXU = 137,
|
||||
DOT11_IE_ID_PXUC = 138,
|
||||
DOT11_IE_ID_AUTHENTICATED_MESH_PEERING_EXCHANGE = 139,
|
||||
DOT11_IE_ID_MIC = 140,
|
||||
DOT11_IE_ID_DESTINATION_URI = 141,
|
||||
DOT11_IE_ID_U_APSD_COEXISTENCE = 142,
|
||||
/* 143-173 Reserved */
|
||||
DOT11_IE_ID_MCCAOP_ADVERTISMENT_OVERVIEW = 174,
|
||||
/* 175-220 Reserved */
|
||||
DOT11_IE_ID_VENDOR_SPECIFIC = 221,
|
||||
/* 222-255 Reserved */
|
||||
} dot11_ie_id_t;
|
||||
|
||||
uint32_t whd_wifi_get_iovar_value(whd_interface_t ifp, const char *iovar, uint32_t *value);
|
||||
uint32_t whd_wifi_set_iovar_buffers(whd_interface_t ifp, const char *iovar, const void **in_buffers,
|
||||
const uint16_t *lengths, const uint8_t num_buffers);
|
||||
uint32_t whd_wifi_set_iovar_value(whd_interface_t ifp, const char *iovar, uint32_t value);
|
||||
|
||||
/** Sends an IOVAR command
|
||||
*
|
||||
* @param ifp : Pointer to handle instance of whd interface
|
||||
* @param iovar : IOVAR name
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_wifi_set_iovar_void(whd_interface_t ifp, const char *iovar);
|
||||
|
||||
/** Sends an IOVAR command
|
||||
*
|
||||
* @param ifp : Pointer to handle instance of whd interface
|
||||
* @param iovar : IOVAR name
|
||||
* @param buffer : Handle for a packet buffer containing the data value to be sent.
|
||||
* @param buffer_length : Length of out_buffer
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_wifi_set_iovar_buffer(whd_interface_t ifp, const char *iovar, void *buffer, uint16_t buffer_length);
|
||||
|
||||
/** Sends an IOVAR command
|
||||
*
|
||||
* @param ifp : Pointer to handle instance of whd interface
|
||||
* @param iovar : IOVAR name
|
||||
* @param in_buffers : Handle for a packet buffers containing the data value to be sent.
|
||||
* @param in_buffer_lengths : Length of in_buffers
|
||||
* @param num_buffers : Number of handle buffers
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_wifi_set_iovar_buffers(whd_interface_t ifp, const char *iovar, const void **in_buffers,
|
||||
const uint16_t *in_buffer_lengths, const uint8_t num_buffers);
|
||||
|
||||
/** Sends an IOVAR command
|
||||
*
|
||||
* @param ifp : Pointer to handle instance of whd interface
|
||||
* @param iovar : IOVAR name
|
||||
* @param out_buffer : Pointer to receive the handle for the packet buffer containing the response data value received
|
||||
* @param out_length : Length of out_buffer
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_wifi_get_iovar_buffer(whd_interface_t ifp, const char *iovar_name, uint8_t *out_buffer,
|
||||
uint16_t out_length);
|
||||
|
||||
/** Sends an IOVAR command
|
||||
*
|
||||
* @param ifp : Pointer to handle instance of whd interface
|
||||
* @param iovar : IOVAR name
|
||||
* @param buffer : Handle for a packet buffer containing the data value to be sent.
|
||||
* @param buffer_length : Length of out_buffer
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_wifi_set_iovar_buffer(whd_interface_t ifp, const char *iovar, void *buffer, uint16_t buffer_length);
|
||||
|
||||
/** Sends an IOVAR command
|
||||
*
|
||||
* @param ifp : Pointer to handle instance of whd interface
|
||||
* @param iovar : IOVAR name
|
||||
* @param in_buffers : Handle for a packet buffers containing the data value to be sent.
|
||||
* @param in_buffer_lengths : Length of in_buffers
|
||||
* @param num_buffers : Number of handle buffers
|
||||
*
|
||||
* @return WHD_SUCCESS or Error code
|
||||
*/
|
||||
extern uint32_t whd_wifi_set_iovar_buffers(whd_interface_t ifp, const char *iovar, const void **in_buffers,
|
||||
const uint16_t *in_buffer_lengths, const uint8_t num_buffers);
|
||||
|
||||
extern uint32_t whd_wifi_set_mac_address(whd_interface_t ifp, whd_mac_t mac);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
#endif /* ifndef INCLUDED_WHD_TYPES_INT_H_ */
|
||||
|
|
@ -0,0 +1,159 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file WHD utilities
|
||||
*
|
||||
* Utilities to help do specialized (not general purpose) WHD specific things
|
||||
*/
|
||||
#include "whd_chip.h"
|
||||
#include "whd_events_int.h"
|
||||
#include "whd_types_int.h"
|
||||
|
||||
#ifndef INCLUDED_WHD_UTILS_H_
|
||||
#define INCLUDED_WHD_UTILS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Searches for a specific WiFi Information Element in a byte array
|
||||
*
|
||||
* Traverse a string of 1-byte tag/1-byte length/variable-length value
|
||||
* triples, returning a pointer to the substring whose first element
|
||||
* matches tag
|
||||
*
|
||||
* @note : This function has been copied directly from the standard Broadcom host driver file wl/exe/wlu.c
|
||||
*
|
||||
*
|
||||
* @param tlv_buf : The byte array containing the Information Elements (IEs)
|
||||
* @param buflen : The length of the tlv_buf byte array
|
||||
* @param key : The Information Element tag to search for
|
||||
*
|
||||
* @return NULL : if no matching Information Element was found
|
||||
* Non-Null : Pointer to the start of the matching Information Element
|
||||
*/
|
||||
|
||||
whd_tlv8_header_t *whd_parse_tlvs(const whd_tlv8_header_t *tlv_buf, uint32_t buflen, dot11_ie_id_t key);
|
||||
|
||||
/** Checks if a WiFi Information Element is a WPA entry
|
||||
*
|
||||
* Is this body of this tlvs entry a WPA entry? If
|
||||
* not update the tlvs buffer pointer/length
|
||||
*
|
||||
* @note : This function has been copied directly from the standard Broadcom host driver file wl/exe/wlu.c
|
||||
*
|
||||
* @param wpaie : The byte array containing the Information Element (IE)
|
||||
* @param tlvs : The larger IE array to be updated if not a WPA IE
|
||||
* @param tlvs_len : The current length of larger IE array
|
||||
*
|
||||
* @return WHD_TRUE : if IE matches the WPA OUI (Organizationally Unique Identifier) and its type = 1
|
||||
* WHD_FALSE : otherwise
|
||||
*/
|
||||
whd_bool_t whd_is_wpa_ie(vendor_specific_ie_header_t *wpaie, whd_tlv8_header_t **tlvs, uint32_t *tlvs_len);
|
||||
|
||||
/** Searches for a specific WiFi Information Element in a byte array
|
||||
*
|
||||
* Traverse a string of 1-byte tag/1-byte length/variable-length value
|
||||
* triples, returning a pointer to the substring whose first element
|
||||
* matches tag
|
||||
*
|
||||
* @note : This function has been copied directly from the standard Broadcom host driver file wl/exe/wlu.c
|
||||
*
|
||||
*
|
||||
* @param tlv_buf : The byte array containing the Information Elements (IEs)
|
||||
* @param buflen : The length of the tlv_buf byte array
|
||||
* @param key : The Information Element tag to search for
|
||||
*
|
||||
* @return NULL : if no matching Information Element was found
|
||||
* Non-Null : Pointer to the start of the matching Information Element
|
||||
*/
|
||||
whd_tlv8_header_t *whd_parse_dot11_tlvs(const whd_tlv8_header_t *tlv_buf, uint32_t buflen, dot11_ie_id_t key);
|
||||
|
||||
/******************************************************
|
||||
* Debug helper functionality
|
||||
******************************************************/
|
||||
#ifdef WPRINT_ENABLE_WHD_DEBUG
|
||||
const char *whd_event_to_string(whd_event_num_t var);
|
||||
char *whd_ssid_to_string(uint8_t *value, uint8_t length, char *ssid_buf, uint8_t ssid_buf_len);
|
||||
const char *whd_status_to_string(whd_event_status_t status);
|
||||
const char *whd_reason_to_string(whd_event_reason_t reason);
|
||||
char *whd_ether_ntoa(const uint8_t *ea, char *buf, uint8_t buf_len);
|
||||
#endif /* ifdef WPRINT_ENABLE_WHD_DEBUG */
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* Prints partial details of a scan result on a single line
|
||||
* @param[in] record : A pointer to the whd_scan_result_t record
|
||||
*
|
||||
*/
|
||||
extern void whd_print_scan_result(whd_scan_result_t *record);
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* Convert a security bitmap to string
|
||||
* @param[in] security : security of type whd_security_t
|
||||
* @param[in] out_str : a character array to store output
|
||||
* @param[in] out_str_len : length of out_str char array
|
||||
*
|
||||
*/
|
||||
extern void whd_convert_security_type_to_string(whd_security_t security, char *out_str, uint16_t out_str_len);
|
||||
|
||||
/*!
|
||||
******************************************************************************
|
||||
* Convert an IOCTL to a string.
|
||||
*
|
||||
* @param[in] cmd The ioct_log value.
|
||||
* @param[out] ioctl_str The string value after conversion.
|
||||
* @param[out] ioctl_str_len The string length of the IOCTL string.
|
||||
*
|
||||
* @result
|
||||
*/
|
||||
void whd_ioctl_to_string(uint32_t cmd, char *ioctl_str, uint16_t ioctl_str_len);
|
||||
|
||||
/*!
|
||||
******************************************************************************
|
||||
* Convert event, status and reason value coming from firmware to string.
|
||||
*
|
||||
* @param[in] cmd The event value in numeric form.
|
||||
* @param[in] flag The status value in numeric form.
|
||||
* @param[in] reason The reson value in numeric form.
|
||||
* @param[out] ioctl_str The string representation of event, status and reason.
|
||||
* @param[out] ioctl_str_len The str_len of ioctl_str.
|
||||
*
|
||||
* @result
|
||||
*/
|
||||
void whd_event_info_to_string(uint32_t cmd, uint16_t flag, uint32_t reason, char *ioctl_str, uint16_t ioctl_str_len);
|
||||
|
||||
/*!
|
||||
******************************************************************************
|
||||
* Prints Hexdump and ASCII dump for data passed as argument.
|
||||
*
|
||||
* @param[in] data The data which has to be converted into hex and ascii format.
|
||||
* @param[in] data_len The length of data.
|
||||
*
|
||||
* @result
|
||||
*/
|
||||
void whd_hexdump(uint8_t *data, uint32_t data_len);
|
||||
|
||||
extern wl_chanspec_t whd_channel_to_wl_band(whd_driver_t whd_driver, uint32_t channel);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "cyabs_rtos.h" /* For semaphores */
|
||||
#include "whd.h"
|
||||
|
||||
|
||||
#ifndef INCLUDED_WHD_WIFI_P2P_H
|
||||
#define INCLUDED_WHD_WIFI_P2P_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/** @cond !ADDTHIS*/
|
||||
|
||||
/**
|
||||
* Set whether the p2p GO is up or not
|
||||
* @param is_up : specify whether the p2p GO is up currently or not
|
||||
*/
|
||||
extern void whd_wifi_p2p_set_go_is_up(whd_driver_t whd_driver, whd_bool_t is_up);
|
||||
|
||||
/**
|
||||
* @return WHD_TRUE if the P2P GO is currently up
|
||||
*/
|
||||
extern whd_bool_t whd_wifi_p2p_is_go_up(whd_driver_t whd_driver);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* ifndef INCLUDED_WHD_WIFI_P2P_H */
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,731 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* Provides generic APSTA functionality that chip specific files use
|
||||
*/
|
||||
#include "whd_debug.h"
|
||||
#include "whd_ap.h"
|
||||
#include "bus_protocols/whd_chip_reg.h"
|
||||
#include "whd_chip_constants.h"
|
||||
#include "whd_chip.h"
|
||||
#include "whd_sdpcm.h"
|
||||
#include "whd_thread_internal.h"
|
||||
#include "whd_events_int.h"
|
||||
#include "whd_int.h"
|
||||
#include "whd_utils.h"
|
||||
#include "whd_wifi_api.h"
|
||||
#include "whd_buffer_api.h"
|
||||
#include "whd_wlioctl.h"
|
||||
|
||||
/******************************************************
|
||||
** @cond Constants
|
||||
*******************************************************/
|
||||
|
||||
#define WLC_EVENT_MSG_LINK (0x01)
|
||||
#define RATE_SETTING_11_MBPS (11000000 / 500000)
|
||||
#define AMPDU_AP_DEFAULT_BA_WSIZE 8
|
||||
#define AMPDU_STA_DEFAULT_BA_WSIZE 8
|
||||
#define AMPDU_STA_DEFAULT_MPDU 4 /* STA default num MPDU per AMPDU */
|
||||
#define WEP40_KEY_LENGTH 5
|
||||
#define WEP104_KEY_LENGTH 13
|
||||
#define FORMATTED_ASCII_WEP40_KEY_LENGTH 28 /* For 5 bytes key */
|
||||
#define FORMATTED_ASCII_WEP104_KEY_LENGTH 60 /* For 13 bytes key */
|
||||
|
||||
/******************************************************
|
||||
** Enumerations
|
||||
*******************************************************/
|
||||
typedef enum
|
||||
{
|
||||
BSS_AP = 3,
|
||||
BSS_STA = 2,
|
||||
BSS_UP = 1,
|
||||
BSS_DOWN = 0
|
||||
} bss_arg_option_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
WEP_OPEN_SYSTEM_AUTHENTICATION = 0,
|
||||
WEP_SHARED_KEY_AUTHENTICATION = 1
|
||||
} wep_authentication_type_t;
|
||||
|
||||
/******************************************************
|
||||
* * Function Declarations
|
||||
* ******************************************************/
|
||||
static void *whd_handle_apsta_event(whd_interface_t ifp, const whd_event_header_t *event_header,
|
||||
const uint8_t *event_data, void *handler_user_data);
|
||||
|
||||
/******************************************************
|
||||
* Variables Definitions
|
||||
*****************************************************/
|
||||
static const whd_event_num_t apsta_events[] = { WLC_E_IF, WLC_E_LINK, WLC_E_NONE };
|
||||
/******************************************************
|
||||
* Function Definitions
|
||||
******************************************************/
|
||||
|
||||
void whd_ap_info_init(whd_driver_t whd_driver)
|
||||
{
|
||||
whd_driver->ap_info.ap_is_up = WHD_FALSE;
|
||||
}
|
||||
|
||||
void whd_wifi_set_ap_is_up(whd_driver_t whd_driver, whd_bool_t new_state)
|
||||
{
|
||||
if (whd_driver->ap_info.ap_is_up != new_state)
|
||||
{
|
||||
whd_driver->ap_info.ap_is_up = new_state;
|
||||
}
|
||||
}
|
||||
|
||||
whd_bool_t whd_wifi_get_ap_is_up(whd_driver_t whd_driver)
|
||||
{
|
||||
return whd_driver->ap_info.ap_is_up;
|
||||
}
|
||||
|
||||
whd_result_t whd_wifi_set_block_ack_window_size_common(whd_interface_t ifp, uint16_t ap_win_size, uint16_t sta_win_size)
|
||||
{
|
||||
whd_result_t retval;
|
||||
uint16_t block_ack_window_size = ap_win_size;
|
||||
|
||||
/* If the AP interface is already up then don't change the Block Ack window size */
|
||||
if (ifp->role == WHD_AP_ROLE)
|
||||
{
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
if (ifp->role == WHD_STA_ROLE)
|
||||
{
|
||||
block_ack_window_size = sta_win_size;
|
||||
}
|
||||
|
||||
retval = whd_wifi_set_iovar_value(ifp, IOVAR_STR_AMPDU_BA_WINDOW_SIZE, ( uint32_t )block_ack_window_size);
|
||||
|
||||
whd_assert("set_block_ack_window_size: Failed to set block ack window size\r\n", retval == WHD_SUCCESS);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
whd_result_t whd_wifi_set_ampdu_parameters_common(whd_interface_t ifp, uint8_t ba_window_size, int8_t ampdu_mpdu,
|
||||
uint8_t rx_factor)
|
||||
{
|
||||
CHECK_RETURN(whd_wifi_set_iovar_value(ifp, IOVAR_STR_AMPDU_BA_WINDOW_SIZE, ba_window_size) );
|
||||
|
||||
/* Set number of MPDUs available for AMPDU */
|
||||
CHECK_RETURN(whd_wifi_set_iovar_value(ifp, IOVAR_STR_AMPDU_MPDU, ( uint32_t )ampdu_mpdu) );
|
||||
|
||||
if (rx_factor != AMPDU_RX_FACTOR_INVALID)
|
||||
{
|
||||
CHECK_RETURN(whd_wifi_set_iovar_value(ifp, IOVAR_STR_AMPDU_RX_FACTOR, rx_factor) );
|
||||
}
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
/** Sets the chip specific AMPDU parameters for AP and STA
|
||||
* For SDK 3.0, and beyond, each chip will need it's own function for setting AMPDU parameters.
|
||||
*/
|
||||
whd_result_t whd_wifi_set_ampdu_parameters(whd_interface_t ifp)
|
||||
{
|
||||
whd_driver_t whd_driver = ifp->whd_driver;
|
||||
/* Get the chip number */
|
||||
uint16_t wlan_chip_id = whd_chip_get_chip_id(whd_driver);
|
||||
|
||||
if ( (wlan_chip_id == 43012) || (wlan_chip_id == 43455) )
|
||||
{
|
||||
return whd_wifi_set_ampdu_parameters_common(ifp, AMPDU_STA_DEFAULT_BA_WSIZE, AMPDU_MPDU_AUTO,
|
||||
AMPDU_RX_FACTOR_64K);
|
||||
}
|
||||
else if (wlan_chip_id == 43909)
|
||||
{
|
||||
return whd_wifi_set_ampdu_parameters_common(ifp, AMPDU_STA_DEFAULT_BA_WSIZE, AMPDU_MPDU_AUTO,
|
||||
AMPDU_RX_FACTOR_INVALID);
|
||||
}
|
||||
else
|
||||
{
|
||||
return whd_wifi_set_ampdu_parameters_common(ifp, AMPDU_STA_DEFAULT_BA_WSIZE, AMPDU_STA_DEFAULT_MPDU,
|
||||
AMPDU_RX_FACTOR_8K);
|
||||
}
|
||||
}
|
||||
|
||||
/* All chips */
|
||||
static void *whd_handle_apsta_event(whd_interface_t ifp, const whd_event_header_t *event_header,
|
||||
const uint8_t *event_data, void *handler_user_data)
|
||||
{
|
||||
whd_driver_t whd_driver = ifp->whd_driver;
|
||||
|
||||
UNUSED_PARAMETER(event_header);
|
||||
UNUSED_PARAMETER(event_data);
|
||||
UNUSED_PARAMETER(handler_user_data);
|
||||
|
||||
WHD_IOCTL_LOG_ADD_EVENT(whd_driver, event_header->event_type, event_header->flags, event_header->reason);
|
||||
|
||||
if ( (event_header->event_type == (whd_event_num_t)WLC_E_LINK) ||
|
||||
(event_header->event_type == WLC_E_IF) )
|
||||
{
|
||||
whd_result_t result;
|
||||
result = cy_rtos_set_semaphore(&whd_driver->ap_info.whd_wifi_sleep_flag, WHD_FALSE);
|
||||
whd_assert("failed to post AP link semaphore", result == WHD_SUCCESS);
|
||||
REFERENCE_DEBUG_ONLY_VARIABLE(result);
|
||||
}
|
||||
return handler_user_data;
|
||||
}
|
||||
|
||||
/* All chips */
|
||||
uint32_t whd_wifi_init_ap(whd_interface_t ifp, whd_ssid_t *ssid, whd_security_t auth_type,
|
||||
const uint8_t *security_key, uint8_t key_length, uint8_t channel)
|
||||
{
|
||||
whd_bool_t wait_for_interface = WHD_FALSE;
|
||||
whd_result_t result;
|
||||
whd_buffer_t response;
|
||||
whd_buffer_t buffer;
|
||||
uint32_t *data;
|
||||
whd_ap_int_info_t *ap;
|
||||
uint32_t bss_index;
|
||||
uint16_t wlan_chip_id;
|
||||
uint16_t event_entry = (uint16_t)0xFF;
|
||||
whd_interface_t prim_ifp;
|
||||
whd_driver_t whd_driver;
|
||||
|
||||
CHECK_IFP_NULL(ifp);
|
||||
|
||||
whd_driver = ifp->whd_driver;
|
||||
|
||||
CHECK_DRIVER_NULL(whd_driver);
|
||||
|
||||
prim_ifp = whd_get_primary_interface(whd_driver);
|
||||
if (prim_ifp == NULL)
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("%s failed at %d \n", __func__, __LINE__) );
|
||||
return WHD_UNKNOWN_INTERFACE;
|
||||
}
|
||||
ap = &whd_driver->ap_info;
|
||||
bss_index = ifp->bsscfgidx;
|
||||
/* Get the Chip Number */
|
||||
wlan_chip_id = whd_chip_get_chip_id(whd_driver);
|
||||
|
||||
/* Configuration need to come from some structure whd_driver */
|
||||
#if 0
|
||||
uint32_t *auth;
|
||||
uint16_t length;
|
||||
#endif
|
||||
|
||||
ifp->role = WHD_AP_ROLE;
|
||||
|
||||
if (wlan_chip_id == 4334)
|
||||
{
|
||||
if (auth_type == WHD_SECURITY_WEP_PSK)
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("WEP auth type is not allowed , %s failed at line %d \n", __func__, __LINE__) );
|
||||
return WHD_WEP_NOT_ALLOWED;
|
||||
}
|
||||
}
|
||||
if ( ( (auth_type == WHD_SECURITY_WPA_TKIP_PSK) || (auth_type == WHD_SECURITY_WPA2_AES_PSK) ||
|
||||
(auth_type == WHD_SECURITY_WPA2_MIXED_PSK) ) &&
|
||||
( (key_length < (uint8_t)8) || (key_length > (uint8_t)64) ) )
|
||||
{
|
||||
WPRINT_WHD_INFO( ("Error: WPA security key length must be between 8 and 64\n") );
|
||||
return WHD_WPA_KEYLEN_BAD;
|
||||
}
|
||||
|
||||
/* Need to decide on the wep configuration */
|
||||
#if 0
|
||||
else if ( ( (auth_type == WHD_SECURITY_WEP_PSK) || (auth_type == WHD_SECURITY_WEP_SHARED) ) &&
|
||||
( (key_length != FORMATTED_ASCII_WEP40_KEY_LENGTH) &&
|
||||
(key_length != FORMATTED_ASCII_WEP104_KEY_LENGTH) ) )
|
||||
{
|
||||
WPRINT_WHD_INFO( ("Error: WEP security Key length must be either 5 / 13 bytes\n") );
|
||||
return WHD_WEP_KEYLEN_BAD;
|
||||
}
|
||||
#endif
|
||||
if ( (whd_wifi_get_ap_is_up(whd_driver) == WHD_TRUE) )
|
||||
{
|
||||
WPRINT_WHD_INFO( ("Error: Soft AP or Wi-Fi Direct group owner already up\n") );
|
||||
return WHD_AP_ALREADY_UP;
|
||||
}
|
||||
|
||||
/* if (wlan_chip_id == 4334 || wlan_chip_id == 43340 || wlan_chip_id == 43342 )
|
||||
{
|
||||
if ( whd_wifi_set_block_ack_window_size( ifp ) != WHD_SUCCESS )
|
||||
{
|
||||
return WHD_SET_BLOCK_ACK_WINDOW_FAIL;
|
||||
}
|
||||
}*/
|
||||
|
||||
/* Query bss state (does it exist? if so is it UP?) */
|
||||
data = (uint32_t *)whd_cdc_get_iovar_buffer(whd_driver, &buffer, (uint16_t)4, IOVAR_STR_BSS);
|
||||
CHECK_IOCTL_BUFFER(data);
|
||||
|
||||
if ( (wlan_chip_id == 4334) || (wlan_chip_id == 43340) || (wlan_chip_id == 43342) )
|
||||
{
|
||||
*data = htod32( (uint32_t)CHIP_AP_INTERFACE );
|
||||
}
|
||||
else
|
||||
{
|
||||
*data = htod32( (uint32_t)bss_index );
|
||||
}
|
||||
|
||||
|
||||
if ( (wlan_chip_id == 43340) || (wlan_chip_id == 43342) )
|
||||
{
|
||||
if (whd_cdc_send_iovar(ifp, CDC_GET, buffer, &response) != WHD_SUCCESS)
|
||||
{
|
||||
/* Note: We don't need to release the response packet since the iovar failed */
|
||||
wait_for_interface = WHD_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Check if the BSS is already UP, if so return */
|
||||
uint32_t *data2 = (uint32_t *)whd_buffer_get_current_piece_data_pointer(whd_driver, response);
|
||||
*data2 = dtoh32 (*data2);
|
||||
if (*data2 == (uint32_t)BSS_UP)
|
||||
{
|
||||
CHECK_RETURN(whd_buffer_release(whd_driver, response, WHD_NETWORK_RX) );
|
||||
whd_wifi_set_ap_is_up(whd_driver, WHD_TRUE);
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
CHECK_RETURN(whd_buffer_release(whd_driver, response, WHD_NETWORK_RX) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (whd_cdc_send_iovar(prim_ifp, CDC_GET, buffer, &response) != WHD_SUCCESS)
|
||||
{
|
||||
/* Note: We don't need to release the response packet since the iovar failed */
|
||||
wait_for_interface = WHD_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Check if the BSS is already UP, if so return */
|
||||
uint32_t *data2 = (uint32_t *)whd_buffer_get_current_piece_data_pointer(whd_driver, response);
|
||||
*data2 = dtoh32 (*data2);
|
||||
if (*data2 == (uint32_t)BSS_UP)
|
||||
{
|
||||
CHECK_RETURN(whd_buffer_release(whd_driver, response, WHD_NETWORK_RX) );
|
||||
whd_wifi_set_ap_is_up(whd_driver, WHD_TRUE);
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
CHECK_RETURN(whd_buffer_release(whd_driver, response, WHD_NETWORK_RX) );
|
||||
}
|
||||
}
|
||||
|
||||
CHECK_RETURN(cy_rtos_init_semaphore(&ap->whd_wifi_sleep_flag, 1, 0) );
|
||||
|
||||
/* Register for interested events */
|
||||
CHECK_RETURN_WITH_SEMAPHORE(whd_management_set_event_handler(ifp, apsta_events, whd_handle_apsta_event,
|
||||
NULL, &event_entry), &ap->whd_wifi_sleep_flag);
|
||||
if (event_entry >= WHD_EVENT_HANDLER_LIST_SIZE)
|
||||
{
|
||||
WPRINT_WHD_DEBUG( ("Event handler registration failed for AP events in function %s and line %d\n", __func__,
|
||||
__LINE__) );
|
||||
return WHD_UNFINISHED;
|
||||
}
|
||||
ifp->event_reg_list[WHD_AP_EVENT_ENTRY] = event_entry;
|
||||
if (prim_ifp == ifp)
|
||||
{
|
||||
/* Set AP mode */
|
||||
data = (uint32_t *)whd_cdc_get_ioctl_buffer(whd_driver, &buffer, (uint16_t)4);
|
||||
CHECK_IOCTL_BUFFER_WITH_SEMAPHORE(data, &ap->whd_wifi_sleep_flag);
|
||||
*data = 1; /* Turn on AP */
|
||||
CHECK_RETURN_WITH_SEMAPHORE(whd_cdc_send_ioctl(ifp, CDC_SET, WLC_SET_AP, buffer, 0),
|
||||
&ap->whd_wifi_sleep_flag);
|
||||
}
|
||||
#if 0
|
||||
if (whd_wifi_set_block_ack_window_size(ifp) != WHD_SUCCESS)
|
||||
{
|
||||
return WHD_SET_BLOCK_ACK_WINDOW_FAIL;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (NULL_MAC(ifp->mac_addr.octet) )
|
||||
{
|
||||
/* Change the AP MAC address to be different from STA MAC */
|
||||
if ( (result = whd_wifi_get_mac_address(prim_ifp, &ifp->mac_addr) ) != WHD_SUCCESS )
|
||||
{
|
||||
WPRINT_WHD_INFO ( (" Get STA MAC address failed result=%" PRIu32 "\n", result) );
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
WPRINT_WHD_INFO ( (" Get STA MAC address success\n") );
|
||||
}
|
||||
}
|
||||
|
||||
if ( (result = whd_wifi_set_mac_address(ifp, ifp->mac_addr) ) != WHD_SUCCESS )
|
||||
{
|
||||
WPRINT_WHD_INFO ( (" Set AP MAC address failed result=%" PRIu32 "\n", result) );
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Set the SSID */
|
||||
data = (uint32_t *)whd_cdc_get_iovar_buffer(whd_driver, &buffer, (uint16_t)40, "bsscfg:" IOVAR_STR_SSID);
|
||||
CHECK_IOCTL_BUFFER_WITH_SEMAPHORE(data, &ap->whd_wifi_sleep_flag);
|
||||
if (wlan_chip_id == 4334)
|
||||
{
|
||||
data[0] = htod32( (uint32_t)CHIP_AP_INTERFACE ); /* Set the bsscfg index */
|
||||
}
|
||||
else
|
||||
{
|
||||
data[0] = htod32(bss_index); /* Set the bsscfg index */
|
||||
}
|
||||
data[1] = htod32(ssid->length); /* Set the ssid length */
|
||||
memcpy(&data[2], (uint8_t *)ssid->value, ssid->length);
|
||||
if ( (wlan_chip_id == 43340) || (wlan_chip_id == 43342) )
|
||||
{
|
||||
CHECK_RETURN_WITH_SEMAPHORE(whd_cdc_send_iovar(ifp, CDC_SET, buffer, 0), &ap->whd_wifi_sleep_flag);
|
||||
}
|
||||
else
|
||||
{
|
||||
CHECK_RETURN_WITH_SEMAPHORE(whd_cdc_send_iovar(prim_ifp, CDC_SET, buffer, 0), &ap->whd_wifi_sleep_flag);
|
||||
}
|
||||
|
||||
if ( (wlan_chip_id == 4334) || (wlan_chip_id == 43340) || (wlan_chip_id == 43342) )
|
||||
{
|
||||
/* Check if we need to wait for interface to be created */
|
||||
if (wait_for_interface == WHD_TRUE)
|
||||
{
|
||||
CHECK_RETURN_WITH_SEMAPHORE(cy_rtos_get_semaphore(&ap->whd_wifi_sleep_flag, (uint32_t)10000,
|
||||
WHD_FALSE), &ap->whd_wifi_sleep_flag);
|
||||
}
|
||||
}
|
||||
/* Set the channel */
|
||||
data = (uint32_t *)whd_cdc_get_ioctl_buffer(whd_driver, &buffer, (uint16_t)4);
|
||||
CHECK_IOCTL_BUFFER_WITH_SEMAPHORE(data, &ap->whd_wifi_sleep_flag);
|
||||
*data = htod32(channel);
|
||||
CHECK_RETURN_WITH_SEMAPHORE(whd_cdc_send_ioctl(ifp, CDC_SET, WLC_SET_CHANNEL, buffer, 0),
|
||||
&ap->whd_wifi_sleep_flag);
|
||||
|
||||
/* Need to decide on the wep configuration */
|
||||
#if 0
|
||||
if ( (auth_type == WHD_SECURITY_WEP_PSK) || (auth_type == WHD_SECURITY_WEP_SHARED) )
|
||||
{
|
||||
for (length = 0; length < key_length; length = (uint16_t)(length + 2 + security_key[1]) )
|
||||
{
|
||||
const whd_wep_key_t *in_key = (const whd_wep_key_t *)&security_key[length];
|
||||
wl_wsec_key_t *out_key = (wl_wsec_key_t *)whd_cdc_get_ioctl_buffer(&buffer, sizeof(wl_wsec_key_t) );
|
||||
CHECK_IOCTL_BUFFER_WITH_SEMAPHORE(out_key, &ap->whd_wifi_sleep_flag);
|
||||
memset(out_key, 0, sizeof(wl_wsec_key_t) );
|
||||
out_key->index = in_key->index;
|
||||
out_key->len = in_key->length;
|
||||
memcpy(out_key->data, in_key->data, in_key->length);
|
||||
switch (in_key->length)
|
||||
{
|
||||
case WEP40_KEY_LENGTH:
|
||||
out_key->algo = (uint32_t)CRYPTO_ALGO_WEP1;
|
||||
break;
|
||||
case WEP104_KEY_LENGTH:
|
||||
out_key->algo = (uint32_t)CRYPTO_ALGO_WEP128;
|
||||
break;
|
||||
default:
|
||||
whd_buffer_release(whd_driver, buffer, WHD_NETWORK_TX);
|
||||
return WHD_INVALID_KEY;
|
||||
}
|
||||
/* Set the first entry as primary key by default */
|
||||
|
||||
if (length == 0)
|
||||
{
|
||||
out_key->flags |= WL_PRIMARY_KEY;
|
||||
}
|
||||
out_key->index = htod32(out_key->index);
|
||||
out_key->len = htod32(out_key->len);
|
||||
out_key->algo = htod32(out_key->algo);
|
||||
out_key->flags = htod32(out_key->flags);
|
||||
CHECK_RETURN_WITH_SEMAPHORE(whd_cdc_send_ioctl(ifp, CDC_SET, WLC_SET_KEY, buffer,
|
||||
NULL), &ap->whd_wifi_sleep_flag);
|
||||
}
|
||||
|
||||
/* Set authentication type */
|
||||
auth = (uint32_t *)whd_cdc_get_ioctl_buffer(&buffer, (uint16_t)4);
|
||||
CHECK_IOCTL_BUFFER_WITH_SEMAPHORE(auth, &ap->whd_wifi_sleep_flag);
|
||||
if (auth_type == WHD_SECURITY_WEP_SHARED)
|
||||
{
|
||||
*auth = WEP_SHARED_KEY_AUTHENTICATION; /* 1 = Shared Key authentication */
|
||||
}
|
||||
else
|
||||
{
|
||||
*auth = WEP_OPEN_SYSTEM_AUTHENTICATION; /* 0 = Open System authentication */
|
||||
}
|
||||
CHECK_RETURN_WITH_SEMAPHORE(whd_cdc_send_ioctl(ifp, CDC_SET, WLC_SET_AUTH, buffer,
|
||||
0), &ap->whd_wifi_sleep_flag);
|
||||
}
|
||||
#endif
|
||||
|
||||
data = (uint32_t *)whd_cdc_get_iovar_buffer(whd_driver, &buffer, (uint16_t)8, "bsscfg:" IOVAR_STR_WSEC);
|
||||
CHECK_IOCTL_BUFFER_WITH_SEMAPHORE(data, &ap->whd_wifi_sleep_flag);
|
||||
if ( (wlan_chip_id == 4334) || (wlan_chip_id == 43340) || (wlan_chip_id == 43342) )
|
||||
{
|
||||
data[0] = htod32( (uint32_t)CHIP_AP_INTERFACE );
|
||||
}
|
||||
else
|
||||
{
|
||||
data[0] = htod32(bss_index);
|
||||
}
|
||||
if ( (auth_type & WPS_ENABLED) != 0 )
|
||||
{
|
||||
data[1] = htod32( (uint32_t)( (auth_type & (~WPS_ENABLED) ) | SES_OW_ENABLED ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
data[1] = htod32( (uint32_t)auth_type );
|
||||
}
|
||||
CHECK_RETURN_WITH_SEMAPHORE(whd_cdc_send_iovar(prim_ifp, CDC_SET, buffer, 0), &ap->whd_wifi_sleep_flag);
|
||||
if (wlan_chip_id == 4334)
|
||||
{
|
||||
if (auth_type != WHD_SECURITY_OPEN)
|
||||
{
|
||||
wsec_pmk_t *psk;
|
||||
|
||||
/* Set the wpa auth */
|
||||
data =
|
||||
(uint32_t *)whd_cdc_get_iovar_buffer(whd_driver, &buffer, (uint16_t)8, "bsscfg:" IOVAR_STR_WPA_AUTH);
|
||||
CHECK_IOCTL_BUFFER_WITH_SEMAPHORE(data, &ap->whd_wifi_sleep_flag);
|
||||
data[0] = htod32( (uint32_t)CHIP_AP_INTERFACE );
|
||||
data[1] = htod32( (uint32_t)(auth_type == WHD_SECURITY_WPA_TKIP_PSK) ?
|
||||
(WPA_AUTH_PSK) : (WPA2_AUTH_PSK | WPA_AUTH_PSK) );
|
||||
CHECK_RETURN_WITH_SEMAPHORE(whd_cdc_send_iovar(prim_ifp, CDC_SET, buffer, 0), &ap->whd_wifi_sleep_flag);
|
||||
|
||||
/* Set the passphrase */
|
||||
psk = (wsec_pmk_t *)whd_cdc_get_ioctl_buffer(whd_driver, &buffer, sizeof(wsec_pmk_t) );
|
||||
CHECK_IOCTL_BUFFER_WITH_SEMAPHORE(psk, &ap->whd_wifi_sleep_flag);
|
||||
memcpy(psk->key, security_key, key_length);
|
||||
psk->key_len = htod16(key_length);
|
||||
psk->flags = htod16( (uint16_t)WSEC_PASSPHRASE );
|
||||
CHECK_RETURN(cy_rtos_delay_milliseconds(1) );
|
||||
/* Delay required to allow radio firmware to be ready to receive PMK and avoid intermittent failure */
|
||||
CHECK_RETURN_WITH_SEMAPHORE(whd_cdc_send_ioctl(ifp, CDC_SET, WLC_SET_WSEC_PMK, buffer, 0),
|
||||
&ap->whd_wifi_sleep_flag);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( (auth_type != WHD_SECURITY_OPEN) && (auth_type != WHD_SECURITY_WEP_PSK) &&
|
||||
(auth_type != WHD_SECURITY_WEP_SHARED) )
|
||||
{
|
||||
wsec_pmk_t *psk;
|
||||
|
||||
/* Set the wpa auth */
|
||||
data =
|
||||
(uint32_t *)whd_cdc_get_iovar_buffer(whd_driver, &buffer, (uint16_t)8, "bsscfg:" IOVAR_STR_WPA_AUTH);
|
||||
CHECK_IOCTL_BUFFER_WITH_SEMAPHORE(data, &ap->whd_wifi_sleep_flag);
|
||||
if ( (wlan_chip_id == 43340) || (wlan_chip_id == 43342) )
|
||||
{
|
||||
data[0] = htod32( (uint32_t)CHIP_AP_INTERFACE );
|
||||
}
|
||||
else
|
||||
{
|
||||
data[0] = htod32(bss_index);
|
||||
}
|
||||
data[1] =
|
||||
htod32( (uint32_t)(auth_type ==
|
||||
WHD_SECURITY_WPA_TKIP_PSK) ? (WPA_AUTH_PSK) : (WPA2_AUTH_PSK | WPA_AUTH_PSK) );
|
||||
if ( (wlan_chip_id == 43340) || (wlan_chip_id == 43342) )
|
||||
{
|
||||
CHECK_RETURN_WITH_SEMAPHORE(whd_cdc_send_iovar(ifp, CDC_SET, buffer, 0), &ap->whd_wifi_sleep_flag);
|
||||
}
|
||||
else
|
||||
{
|
||||
CHECK_RETURN_WITH_SEMAPHORE(whd_cdc_send_iovar(prim_ifp, CDC_SET, buffer, 0),
|
||||
&ap->whd_wifi_sleep_flag);
|
||||
}
|
||||
|
||||
/* Set the passphrase */
|
||||
psk = (wsec_pmk_t *)whd_cdc_get_ioctl_buffer(whd_driver, &buffer, sizeof(wsec_pmk_t) );
|
||||
CHECK_IOCTL_BUFFER_WITH_SEMAPHORE(psk, &ap->whd_wifi_sleep_flag);
|
||||
memcpy(psk->key, security_key, key_length);
|
||||
psk->key_len = htod16(key_length);
|
||||
psk->flags = htod16( (uint16_t)WSEC_PASSPHRASE );
|
||||
CHECK_RETURN(cy_rtos_delay_milliseconds(1) );
|
||||
/* Delay required to allow radio firmware to be ready to receive PMK and avoid intermittent failure */
|
||||
CHECK_RETURN_WITH_SEMAPHORE(whd_cdc_send_ioctl(ifp, CDC_SET, WLC_SET_WSEC_PMK, buffer,
|
||||
0), &ap->whd_wifi_sleep_flag);
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the multicast transmission rate to 11 Mbps rather than the default 1 Mbps */
|
||||
data = (uint32_t *)whd_cdc_get_iovar_buffer(whd_driver, &buffer, (uint16_t)4, IOVAR_STR_2G_MULTICAST_RATE);
|
||||
CHECK_IOCTL_BUFFER(data);
|
||||
*data = htod32( (uint32_t)RATE_SETTING_11_MBPS );
|
||||
if ( (wlan_chip_id == 4334) || (wlan_chip_id == 43340) || (wlan_chip_id == 43342) )
|
||||
{
|
||||
result = whd_cdc_send_iovar(ifp, CDC_SET, buffer, NULL);
|
||||
whd_assert("start_ap: Failed to set multicast transmission rate\r\n", result == WHD_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
CHECK_RETURN_WITH_SEMAPHORE(whd_cdc_send_iovar(ifp, CDC_SET, buffer, NULL), &ap->whd_wifi_sleep_flag);
|
||||
}
|
||||
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t whd_wifi_start_ap(whd_interface_t ifp)
|
||||
{
|
||||
whd_buffer_t buffer;
|
||||
uint32_t *data;
|
||||
uint16_t wlan_chip_id;
|
||||
whd_ap_int_info_t *ap;
|
||||
whd_interface_t prim_ifp;
|
||||
whd_driver_t whd_driver;
|
||||
|
||||
CHECK_IFP_NULL(ifp);
|
||||
|
||||
whd_driver = ifp->whd_driver;
|
||||
|
||||
CHECK_DRIVER_NULL(whd_driver);
|
||||
|
||||
prim_ifp = whd_get_primary_interface(whd_driver);
|
||||
|
||||
if (prim_ifp == NULL)
|
||||
{
|
||||
return WHD_UNKNOWN_INTERFACE;
|
||||
}
|
||||
|
||||
ap = &whd_driver->ap_info;
|
||||
/* Get the Chip Number */
|
||||
wlan_chip_id = whd_chip_get_chip_id(whd_driver);
|
||||
|
||||
data = (uint32_t *)whd_cdc_get_iovar_buffer(whd_driver, &buffer, (uint16_t)8, IOVAR_STR_BSS);
|
||||
CHECK_IOCTL_BUFFER_WITH_SEMAPHORE(data, &ap->whd_wifi_sleep_flag);
|
||||
|
||||
if ( (wlan_chip_id == 43012) || (wlan_chip_id == 43362) || (wlan_chip_id == 43455) || (wlan_chip_id == 43430) )
|
||||
{
|
||||
data[0] = htod32(ifp->bsscfgidx);
|
||||
}
|
||||
else
|
||||
{
|
||||
data[0] = htod32( (uint32_t)CHIP_AP_INTERFACE );
|
||||
}
|
||||
|
||||
data[1] = htod32( (uint32_t)BSS_UP );
|
||||
CHECK_RETURN_WITH_SEMAPHORE(whd_cdc_send_iovar(prim_ifp, CDC_SET, buffer, 0), &ap->whd_wifi_sleep_flag);
|
||||
|
||||
/* Wait until AP is brought up */
|
||||
CHECK_RETURN_WITH_SEMAPHORE(cy_rtos_get_semaphore(&ap->whd_wifi_sleep_flag, (uint32_t)10000,
|
||||
WHD_FALSE), &ap->whd_wifi_sleep_flag);
|
||||
|
||||
whd_wifi_set_ap_is_up(whd_driver, WHD_TRUE);
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t whd_wifi_stop_ap(whd_interface_t ifp)
|
||||
{
|
||||
uint32_t *data;
|
||||
whd_buffer_t buffer;
|
||||
whd_buffer_t response;
|
||||
whd_result_t result;
|
||||
whd_result_t result2;
|
||||
whd_interface_t prim_ifp;
|
||||
whd_driver_t whd_driver;
|
||||
|
||||
CHECK_IFP_NULL(ifp);
|
||||
|
||||
whd_driver = ifp->whd_driver;
|
||||
|
||||
CHECK_DRIVER_NULL(whd_driver);
|
||||
|
||||
prim_ifp = whd_get_primary_interface(whd_driver);
|
||||
|
||||
if (prim_ifp == NULL)
|
||||
{
|
||||
return WHD_UNKNOWN_INTERFACE;
|
||||
}
|
||||
|
||||
/* Get Chip Number */
|
||||
uint16_t wlan_chip_id = whd_chip_get_chip_id(whd_driver);
|
||||
if ( (wlan_chip_id == 43012) || (wlan_chip_id == 43362) || (wlan_chip_id == 43455) || (wlan_chip_id == 43430) )
|
||||
{
|
||||
/* Query bss state (does it exist? if so is it UP?) */
|
||||
data = (uint32_t *)whd_cdc_get_iovar_buffer(whd_driver, &buffer, (uint16_t)4, IOVAR_STR_BSS);
|
||||
CHECK_IOCTL_BUFFER(data);
|
||||
*data = ifp->bsscfgidx;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Query bss state (does it exist? if so is it UP?) */
|
||||
data = whd_cdc_get_iovar_buffer(whd_driver, &buffer, (uint16_t)4, IOVAR_STR_BSS);
|
||||
CHECK_IOCTL_BUFFER(data);
|
||||
*data = htod32( (uint32_t)CHIP_AP_INTERFACE );
|
||||
}
|
||||
result = whd_cdc_send_iovar(prim_ifp, CDC_GET, buffer, &response);
|
||||
if (result == WHD_WLAN_NOTFOUND)
|
||||
{
|
||||
/* AP interface does not exist - i.e. it is down */
|
||||
whd_wifi_set_ap_is_up(whd_driver, WHD_FALSE);
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
CHECK_RETURN(result);
|
||||
|
||||
*data = dtoh32(*(uint32_t *)whd_buffer_get_current_piece_data_pointer(whd_driver, response) );
|
||||
if (data[0] != (uint32_t)BSS_UP)
|
||||
{
|
||||
/* AP interface indicates it is not up - i.e. it is down */
|
||||
CHECK_RETURN(whd_buffer_release(whd_driver, response, WHD_NETWORK_RX) );
|
||||
whd_wifi_set_ap_is_up(whd_driver, WHD_FALSE);
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
CHECK_RETURN(whd_buffer_release(whd_driver, response, WHD_NETWORK_RX) );
|
||||
|
||||
/* set BSS down */
|
||||
if ( (wlan_chip_id == 43012) || (wlan_chip_id == 43362) || (wlan_chip_id == 43455) || (wlan_chip_id == 43430) )
|
||||
{
|
||||
data = (uint32_t *)whd_cdc_get_iovar_buffer(whd_driver, &buffer, (uint16_t)8, IOVAR_STR_BSS);
|
||||
CHECK_IOCTL_BUFFER(data);
|
||||
data[0] = htod32(ifp->bsscfgidx);
|
||||
data[1] = htod32( (uint32_t)BSS_DOWN );
|
||||
CHECK_RETURN(whd_cdc_send_iovar(prim_ifp, CDC_SET, buffer, 0) );
|
||||
}
|
||||
else
|
||||
{
|
||||
data = whd_cdc_get_iovar_buffer(whd_driver, &buffer, (uint16_t)8, IOVAR_STR_BSS);
|
||||
CHECK_IOCTL_BUFFER(data);
|
||||
data[0] = htod32( (uint32_t)CHIP_AP_INTERFACE );
|
||||
data[1] = htod32( (uint32_t)BSS_DOWN );
|
||||
CHECK_RETURN(whd_cdc_send_iovar(ifp, CDC_SET, buffer, 0) );
|
||||
}
|
||||
|
||||
/* Wait until AP is brought down */
|
||||
result = cy_rtos_get_semaphore(&whd_driver->ap_info.whd_wifi_sleep_flag, (uint32_t)10000, WHD_FALSE);
|
||||
result2 = cy_rtos_deinit_semaphore(&whd_driver->ap_info.whd_wifi_sleep_flag);
|
||||
if (result != WHD_SUCCESS)
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Error getting a semaphore, %s failed at %d \n", __func__, __LINE__) );
|
||||
return result;
|
||||
}
|
||||
if (result2 != WHD_SUCCESS)
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Error deleting semaphore, %s failed at %d \n", __func__, __LINE__) );
|
||||
return result2;
|
||||
}
|
||||
|
||||
/* Disable AP mode */
|
||||
data = (uint32_t *)whd_cdc_get_ioctl_buffer(whd_driver, &buffer, (uint16_t)4);
|
||||
CHECK_IOCTL_BUFFER_WITH_SEMAPHORE(data, &whd_driver->ap_info.whd_wifi_sleep_flag);
|
||||
*data = 0; /* Turn off AP */
|
||||
CHECK_RETURN_WITH_SEMAPHORE(whd_cdc_send_ioctl(ifp, CDC_SET, WLC_SET_AP, buffer, 0),
|
||||
&whd_driver->ap_info.whd_wifi_sleep_flag);
|
||||
|
||||
CHECK_RETURN(whd_wifi_deregister_event_handler(ifp, ifp->event_reg_list[WHD_AP_EVENT_ENTRY]) );
|
||||
ifp->event_reg_list[WHD_AP_EVENT_ENTRY] = WHD_EVENT_NOT_REGISTERED;
|
||||
whd_wifi_set_ap_is_up(whd_driver, WHD_FALSE);
|
||||
|
||||
ifp->role = WHD_INVALID_ROLE;
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
|
@ -0,0 +1,220 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* Provides generic APSTA functionality that chip specific files use
|
||||
*/
|
||||
|
||||
#include "whd_debug.h"
|
||||
#include "whd_buffer_api.h"
|
||||
|
||||
/******************************************************
|
||||
** @cond Constants
|
||||
*******************************************************/
|
||||
|
||||
/******************************************************
|
||||
** Enumerations
|
||||
*******************************************************/
|
||||
|
||||
/******************************************************
|
||||
** Function Declarations
|
||||
*******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Variables Definitions
|
||||
*****************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Function Definitions
|
||||
******************************************************/
|
||||
/** Allocates a packet buffer
|
||||
*
|
||||
* Implemented in the port layer interface which is specific to the
|
||||
* buffering scheme in use.
|
||||
* Attempts to allocate a packet buffer of the size requested. It can do this
|
||||
* by allocating a pre-existing packet from a pool, using a static buffer,
|
||||
* or by dynamically allocating memory. The method of allocation does not
|
||||
* concern WHD, however it must match the way the network stack expects packet
|
||||
* buffers to be allocated.
|
||||
*
|
||||
* @param buffer : A pointer which receives the allocated packet buffer handle
|
||||
* @param direction : Indicates transmit/receive direction that the packet buffer is
|
||||
* used for. This may be needed if tx/rx pools are separate.
|
||||
* @param size : The number of bytes to allocate.
|
||||
* @param wait : Whether to wait for a packet buffer to be available
|
||||
*
|
||||
* @return : WHD_SUCCESS or error code
|
||||
*
|
||||
*/
|
||||
whd_result_t whd_host_buffer_get(whd_driver_t whd_driver, whd_buffer_t *buffer, whd_buffer_dir_t direction,
|
||||
uint16_t size, uint32_t wait)
|
||||
{
|
||||
if (whd_driver->buffer_if->whd_host_buffer_get)
|
||||
{
|
||||
return whd_driver->buffer_if->whd_host_buffer_get(buffer, direction, size, wait);
|
||||
}
|
||||
else
|
||||
{
|
||||
WPRINT_WHD_INFO( ("Function pointers not provided .\n") );
|
||||
}
|
||||
|
||||
return WHD_WLAN_NOFUNCTION;
|
||||
}
|
||||
|
||||
/** Releases a packet buffer
|
||||
*
|
||||
* Implemented in the port layer interface, which will be specific to the
|
||||
* buffering scheme in use.
|
||||
* This function is used by WHD to indicate that it no longer requires
|
||||
* a packet buffer. The buffer can then be released back into a pool for
|
||||
* reuse, or the dynamically allocated memory can be freed, according to
|
||||
* how the packet was allocated.
|
||||
* Returns void since WHD cannot do anything about failures
|
||||
*
|
||||
* @param buffer : The handle of the packet buffer to be released
|
||||
* @param direction : Indicates transmit/receive direction that the packet buffer has
|
||||
* been used for. This might be needed if tx/rx pools are separate.
|
||||
*
|
||||
*/
|
||||
whd_result_t whd_buffer_release(whd_driver_t whd_driver, whd_buffer_t buffer, whd_buffer_dir_t direction)
|
||||
{
|
||||
if (whd_driver->buffer_if->whd_buffer_release)
|
||||
{
|
||||
whd_driver->buffer_if->whd_buffer_release(buffer, direction);
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
WPRINT_WHD_INFO( ("Function pointers not provided .\n") );
|
||||
}
|
||||
|
||||
return WHD_WLAN_NOFUNCTION;
|
||||
}
|
||||
|
||||
/** Retrieves the current pointer of a packet buffer
|
||||
*
|
||||
* Implemented in the port layer interface which is specific to the
|
||||
* buffering scheme in use.
|
||||
* Since packet buffers usually need to be created with space at the
|
||||
* front for additional headers, this function allows WHD to get
|
||||
* the current 'front' location pointer.
|
||||
*
|
||||
* @param buffer : The handle of the packet buffer whose pointer is to be retrieved
|
||||
*
|
||||
* @return : The packet buffer's current pointer.
|
||||
*/
|
||||
uint8_t *whd_buffer_get_current_piece_data_pointer(whd_driver_t whd_driver, whd_buffer_t buffer)
|
||||
{
|
||||
if (whd_driver->buffer_if->whd_buffer_get_current_piece_data_pointer)
|
||||
{
|
||||
return whd_driver->buffer_if->whd_buffer_get_current_piece_data_pointer(buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
WPRINT_WHD_INFO( ("Function pointers not provided .\n") );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** Retrieves the size of a packet buffer
|
||||
*
|
||||
* Implemented in the port layer interface which is specific to the
|
||||
* buffering scheme in use.
|
||||
* Since packet buffers usually need to be created with space at the
|
||||
* front for additional headers, the memory block used to contain a packet buffer
|
||||
* will often be larger than the current size of the packet buffer data.
|
||||
* This function allows WHD to retrieve the current size of a packet buffer's data.
|
||||
*
|
||||
* @param buffer : The handle of the packet buffer whose size is to be retrieved
|
||||
*
|
||||
* @return : The size of the packet buffer.
|
||||
*/
|
||||
uint16_t whd_buffer_get_current_piece_size(whd_driver_t whd_driver, whd_buffer_t buffer)
|
||||
{
|
||||
if (whd_driver->buffer_if->whd_buffer_get_current_piece_size)
|
||||
{
|
||||
return whd_driver->buffer_if->whd_buffer_get_current_piece_size(buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
WPRINT_WHD_INFO( ("Function pointers not provided .\n") );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Sets the current size of a WHD packet
|
||||
*
|
||||
*
|
||||
* Implemented in the port layer interface which is specific to the
|
||||
* buffering scheme in use.
|
||||
* This function sets the current length of a WHD packet buffer
|
||||
*
|
||||
* @param buffer : The packet to be modified
|
||||
* @param size : The new size of the packet buffer
|
||||
*
|
||||
* @return : WHD_SUCCESS or error code
|
||||
*/
|
||||
whd_result_t whd_buffer_set_size(whd_driver_t whd_driver, whd_buffer_t buffer, uint16_t size)
|
||||
{
|
||||
if (whd_driver->buffer_if->whd_buffer_set_size)
|
||||
{
|
||||
return whd_driver->buffer_if->whd_buffer_set_size(buffer, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
WPRINT_WHD_INFO( ("Function pointers not provided .\n") );
|
||||
}
|
||||
|
||||
return WHD_WLAN_NOFUNCTION;
|
||||
}
|
||||
|
||||
/** Moves the current pointer of a packet buffer
|
||||
*
|
||||
* Implemented in the port layer interface which is specific to the buffering scheme in use.
|
||||
*
|
||||
* Since packet buffers usually need to be created with space at the front for additional headers,
|
||||
* this function allows WHD to move the current 'front' location pointer so that it has space to
|
||||
* add headers to transmit packets, and so that the network stack does not see the internal WHD
|
||||
* headers on received packets.
|
||||
*
|
||||
* @param buffer : A pointer to the handle of the current packet buffer for which the
|
||||
* current pointer will be moved. On return this may contain a pointer
|
||||
* to a newly allocated packet buffer which has been daisy chained to
|
||||
* the front of the given one. This would be the case if the given packet
|
||||
* buffer didn't have enough space at the front.
|
||||
* @param add_remove_amount : This is the number of bytes to move the current pointer of the packet
|
||||
* buffer - a negative value increases the space for headers at the front
|
||||
* of the packet, a positive value decreases the space.
|
||||
*
|
||||
* @return : WHD_SUCCESS or error code
|
||||
*/
|
||||
whd_result_t whd_buffer_add_remove_at_front(whd_driver_t whd_driver, whd_buffer_t *buffer, int32_t add_remove_amount)
|
||||
{
|
||||
if (whd_driver->buffer_if->whd_buffer_add_remove_at_front)
|
||||
{
|
||||
return whd_driver->buffer_if->whd_buffer_add_remove_at_front(buffer, add_remove_amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
WPRINT_WHD_INFO( ("Function pointers not provided .\n") );
|
||||
}
|
||||
|
||||
return WHD_WLAN_NOFUNCTION;
|
||||
}
|
||||
|
|
@ -0,0 +1,697 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "whd_int.h"
|
||||
#include "whd_cdc_bdc.h"
|
||||
#include "whd_events_int.h"
|
||||
#include "cyabs_rtos.h"
|
||||
#include "whd_network_types.h"
|
||||
#include "whd_types_int.h"
|
||||
#include "whd_wlioctl.h"
|
||||
#include "whd_thread_internal.h"
|
||||
#include "whd_buffer_api.h"
|
||||
#include "whd_network_if.h"
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
|
||||
#define BDC_PROTO_VER (2) /** Version number of BDC header */
|
||||
#define BDC_FLAG_VER_SHIFT (4) /** Number of bits to shift BDC version number in the flags field */
|
||||
#define BDC_FLAG2_IF_MASK (0x0f)
|
||||
|
||||
#define ETHER_TYPE_BRCM (0x886C) /** Broadcom Ethertype for identifying event packets - Copied from DHD include/proto/ethernet.h */
|
||||
#define BRCM_OUI "\x00\x10\x18" /** Broadcom OUI (Organizationally Unique Identifier): Used in the proprietary(221) IE (Information Element) in all Broadcom devices */
|
||||
|
||||
/* QoS related definitions (type of service) */
|
||||
#define IPV4_DSCP_OFFSET (15) /** Offset for finding the DSCP field in an IPv4 header */
|
||||
|
||||
#define IOCTL_OFFSET (sizeof(whd_buffer_header_t) + 12 + 16)
|
||||
#define WHD_IOCTL_PACKET_TIMEOUT (0xFFFFFFFF)
|
||||
#define WHD_IOCTL_TIMEOUT_MS (5000) /** Need to give enough time for coming out of Deep sleep (was 400) */
|
||||
#define WHD_IOCTL_MAX_TX_PKT_LEN (1500)
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Local Structures
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Static Variables
|
||||
******************************************************/
|
||||
|
||||
static const uint8_t dscp_to_wmm_qos[] =
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, /* 0 - 7 */
|
||||
1, 1, 1, 1, 1, 1, 1, /* 8 - 14 */
|
||||
1, 1, 1, 1, 1, 1, 1, /* 15 - 21 */
|
||||
1, 1, 0, 0, 0, 0, 0, /* 22 - 28 */
|
||||
0, 0, 0, 5, 5, 5, 5, /* 29 - 35 */
|
||||
5, 5, 5, 5, 5, 5, 5, /* 36 - 42 */
|
||||
5, 5, 5, 5, 5, 7, 7, /* 43 - 49 */
|
||||
7, 7, 7, 7, 7, 7, 7, /* 50 - 56 */
|
||||
7, 7, 7, 7, 7, 7, 7, /* 57 - 63 */
|
||||
};
|
||||
|
||||
/******************************************************
|
||||
* Static Function Prototypes
|
||||
******************************************************/
|
||||
|
||||
static uint8_t whd_map_dscp_to_priority(whd_driver_t whd_driver, uint8_t dscp_val);
|
||||
|
||||
/******************************************************
|
||||
* Static Functions
|
||||
******************************************************/
|
||||
|
||||
/** Map a DSCP value from an IP header to a WMM QoS priority
|
||||
*
|
||||
* @param dscp_val : DSCP value from IP header
|
||||
*
|
||||
* @return wmm_qos : WMM priority
|
||||
*
|
||||
*/
|
||||
static uint8_t whd_map_dscp_to_priority(whd_driver_t whd_driver, uint8_t val)
|
||||
{
|
||||
uint8_t dscp_val = (uint8_t)(val >> 2); /* DSCP field is the high 6 bits of the second byte of an IPv4 header */
|
||||
|
||||
return dscp_to_wmm_qos[dscp_val];
|
||||
}
|
||||
|
||||
whd_result_t whd_cdc_bdc_info_init(whd_driver_t whd_driver)
|
||||
{
|
||||
whd_cdc_bdc_info_t *cdc_bdc_info = &whd_driver->cdc_bdc_info;
|
||||
|
||||
/* Create the mutex protecting the packet send queue */
|
||||
if (cy_rtos_init_semaphore(&cdc_bdc_info->ioctl_mutex, 1, 0) != WHD_SUCCESS)
|
||||
{
|
||||
return WHD_SEMAPHORE_ERROR;
|
||||
}
|
||||
if (cy_rtos_set_semaphore(&cdc_bdc_info->ioctl_mutex, WHD_FALSE) != WHD_SUCCESS)
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Error setting semaphore in %s at %d \n", __func__, __LINE__) );
|
||||
return WHD_SEMAPHORE_ERROR;
|
||||
}
|
||||
|
||||
/* Create the event flag which signals the whd thread needs to wake up */
|
||||
if (cy_rtos_init_semaphore(&cdc_bdc_info->ioctl_sleep, 1, 0) != WHD_SUCCESS)
|
||||
{
|
||||
cy_rtos_deinit_semaphore(&cdc_bdc_info->ioctl_mutex);
|
||||
return WHD_SEMAPHORE_ERROR;
|
||||
}
|
||||
|
||||
/* Create semaphore to protect event list management */
|
||||
if (cy_rtos_init_semaphore(&cdc_bdc_info->event_list_mutex, 1, 0) != WHD_SUCCESS)
|
||||
{
|
||||
cy_rtos_deinit_semaphore(&cdc_bdc_info->ioctl_sleep);
|
||||
cy_rtos_deinit_semaphore(&cdc_bdc_info->ioctl_mutex);
|
||||
return WHD_SEMAPHORE_ERROR;
|
||||
}
|
||||
if (cy_rtos_set_semaphore(&cdc_bdc_info->event_list_mutex, WHD_FALSE) != WHD_SUCCESS)
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Error setting semaphore in %s at %d \n", __func__, __LINE__) );
|
||||
return WHD_SEMAPHORE_ERROR;
|
||||
}
|
||||
|
||||
/* Initialise the list of event handler functions */
|
||||
memset(cdc_bdc_info->whd_event_list, 0, sizeof(cdc_bdc_info->whd_event_list) );
|
||||
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
/** Sends an IOCTL command
|
||||
*
|
||||
* Sends a I/O Control command to the Broadcom 802.11 device.
|
||||
* The data which is set or retrieved must be in a format structure which is appropriate for the particular
|
||||
* I/O control being sent. These structures can only be found in the DHD source code such as wl/exe/wlu.c.
|
||||
* The I/O control will always respond with a packet buffer which may contain data in a format specific to
|
||||
* the I/O control being used.
|
||||
*
|
||||
* @Note: The caller is responsible for releasing the response buffer.
|
||||
* @Note: The function blocks until the IOCTL has completed
|
||||
* @Note: Only one IOCTL may happen simultaneously.
|
||||
*
|
||||
* @param type : CDC_SET or CDC_GET - indicating whether to set or get the I/O control
|
||||
* @param send_buffer_hnd : A handle for a packet buffer containing the data value to be sent.
|
||||
* @param response_buffer_hnd : A pointer which will receive the handle for the packet buffer
|
||||
* containing the response data value received.
|
||||
* @param interface : Which interface to send the iovar to (WHD_STA_INTERFACE or WHD_AP_INTERFACE)
|
||||
*
|
||||
* @return WHD result code
|
||||
*/
|
||||
whd_result_t whd_cdc_send_ioctl(whd_interface_t ifp, cdc_command_type_t type, uint32_t command,
|
||||
whd_buffer_t send_buffer_hnd,
|
||||
whd_buffer_t *response_buffer_hnd)
|
||||
{
|
||||
|
||||
uint32_t data_length;
|
||||
uint32_t flags;
|
||||
uint32_t requested_ioctl_id;
|
||||
whd_result_t retval;
|
||||
control_header_t *send_packet;
|
||||
cdc_header_t *cdc_header;
|
||||
uint32_t bss_index = ifp->bsscfgidx;
|
||||
whd_driver_t whd_driver = ifp->whd_driver;
|
||||
whd_cdc_bdc_info_t *cdc_bdc_info = &whd_driver->cdc_bdc_info;
|
||||
|
||||
/* Acquire mutex which prevents multiple simultaneous IOCTLs */
|
||||
retval = cy_rtos_get_semaphore(&cdc_bdc_info->ioctl_mutex, CY_RTOS_NEVER_TIMEOUT, WHD_FALSE);
|
||||
if (retval != WHD_SUCCESS)
|
||||
{
|
||||
CHECK_RETURN(whd_buffer_release(whd_driver, send_buffer_hnd, WHD_NETWORK_TX) );
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Count request ioctl ID after acquiring ioctl mutex */
|
||||
requested_ioctl_id = (uint32_t)(++cdc_bdc_info->requested_ioctl_id);
|
||||
|
||||
/* Get the data length and cast packet to a CDC BUS header */
|
||||
data_length =
|
||||
(uint32_t)(whd_buffer_get_current_piece_size(whd_driver,
|
||||
send_buffer_hnd) - sizeof(bus_common_header_t) -
|
||||
sizeof(cdc_header_t) );
|
||||
|
||||
send_packet = (control_header_t *)whd_buffer_get_current_piece_data_pointer(whd_driver, send_buffer_hnd);
|
||||
|
||||
WHD_IOCTL_LOG_ADD(ifp->whd_driver, command, send_buffer_hnd);
|
||||
|
||||
/* Check if IOCTL is actually IOVAR */
|
||||
if ( (command == WLC_SET_VAR) || (command == WLC_GET_VAR) )
|
||||
{
|
||||
uint8_t *data = (uint8_t *)DATA_AFTER_HEADER(send_packet);
|
||||
uint8_t *ptr = data;
|
||||
|
||||
/* Calculate the offset added to compensate for IOVAR string creating unaligned data section */
|
||||
while (*ptr == 0)
|
||||
{
|
||||
ptr++;
|
||||
}
|
||||
if (data != ptr)
|
||||
{
|
||||
data_length -= (uint32_t)(ptr - data);
|
||||
memmove(data, ptr, data_length);
|
||||
CHECK_RETURN(whd_buffer_set_size(whd_driver, send_buffer_hnd,
|
||||
(uint16_t)(data_length + sizeof(bus_common_header_t) +
|
||||
sizeof(cdc_header_t) ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
/* Prepare the CDC header */
|
||||
send_packet->cdc_header.cmd = htod32(command);
|
||||
send_packet->cdc_header.len = htod32(data_length);
|
||||
|
||||
send_packet->cdc_header.flags = ( (requested_ioctl_id << CDCF_IOC_ID_SHIFT)
|
||||
& CDCF_IOC_ID_MASK ) | type | bss_index << CDCF_IOC_IF_SHIFT;
|
||||
send_packet->cdc_header.flags = htod32(send_packet->cdc_header.flags);
|
||||
|
||||
send_packet->cdc_header.status = 0;
|
||||
|
||||
/* Manufacturing test can receive big buffers, but sending big buffers causes a wlan firmware error */
|
||||
/* Even though data portion needs to be truncated, cdc_header should have the actual length of the ioctl packet */
|
||||
if (whd_buffer_get_current_piece_size(whd_driver, send_buffer_hnd) > WHD_IOCTL_MAX_TX_PKT_LEN)
|
||||
{
|
||||
CHECK_RETURN(whd_buffer_set_size(whd_driver, send_buffer_hnd, WHD_IOCTL_MAX_TX_PKT_LEN) );
|
||||
}
|
||||
|
||||
/* Store the length of the data and the IO control header and pass "down" */
|
||||
whd_send_to_bus(whd_driver, send_buffer_hnd, CONTROL_HEADER);
|
||||
|
||||
|
||||
/* Wait till response has been received */
|
||||
retval = cy_rtos_get_semaphore(&cdc_bdc_info->ioctl_sleep, (uint32_t)WHD_IOCTL_TIMEOUT_MS, WHD_FALSE);
|
||||
if (retval != WHD_SUCCESS)
|
||||
{
|
||||
/* Release the mutex since ioctl response will no longer be referenced. */
|
||||
CHECK_RETURN(cy_rtos_set_semaphore(&cdc_bdc_info->ioctl_mutex, WHD_FALSE) );
|
||||
return retval;
|
||||
}
|
||||
|
||||
cdc_header = (cdc_header_t *)whd_buffer_get_current_piece_data_pointer(whd_driver, cdc_bdc_info->ioctl_response);
|
||||
flags = dtoh32(cdc_header->flags);
|
||||
|
||||
retval = (whd_result_t)(WLAN_ENUM_OFFSET - dtoh32(cdc_header->status) );
|
||||
|
||||
/* Check if the caller wants the response */
|
||||
if (response_buffer_hnd != NULL)
|
||||
{
|
||||
*response_buffer_hnd = cdc_bdc_info->ioctl_response;
|
||||
CHECK_RETURN(whd_buffer_add_remove_at_front(whd_driver, response_buffer_hnd, sizeof(cdc_header_t) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
CHECK_RETURN(whd_buffer_release(whd_driver, cdc_bdc_info->ioctl_response, WHD_NETWORK_RX) );
|
||||
}
|
||||
|
||||
cdc_bdc_info->ioctl_response = NULL;
|
||||
|
||||
/* Release the mutex since ioctl response will no longer be referenced. */
|
||||
CHECK_RETURN(cy_rtos_set_semaphore(&cdc_bdc_info->ioctl_mutex, WHD_FALSE) );
|
||||
|
||||
/* Check whether the IOCTL response indicates it failed. */
|
||||
if ( (flags & CDCF_IOC_ERROR) != 0 )
|
||||
{
|
||||
if (response_buffer_hnd != NULL)
|
||||
{
|
||||
CHECK_RETURN(whd_buffer_release(whd_driver, *response_buffer_hnd, WHD_NETWORK_RX) );
|
||||
*response_buffer_hnd = NULL;
|
||||
}
|
||||
whd_minor_assert("IOCTL failed\n", 0 != 0);
|
||||
return retval;
|
||||
}
|
||||
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
/** Sets/Gets an I/O Variable (IOVar)
|
||||
*
|
||||
* This function either sets or retrieves the value of an I/O variable from the Broadcom 802.11 device.
|
||||
* The data which is set or retrieved must be in a format structure which is appropriate for the particular
|
||||
* I/O variable being accessed. These structures can only be found in the DHD source code such as wl/exe/wlu.c.
|
||||
*
|
||||
* @Note: The function blocks until the I/O variable read/write has completed
|
||||
*
|
||||
* @param type : CDC_SET or CDC_GET - indicating whether to set or get the I/O variable value
|
||||
* @param send_buffer_hnd : A handle for a packet buffer containing the data value to be sent.
|
||||
* @param response_buffer_hnd : A pointer which will receive the handle for the packet buffer
|
||||
* containing the response data value received.
|
||||
* @param interface : Which interface to send the iovar to (AP or STA)
|
||||
*
|
||||
* @return WHD result code
|
||||
*/
|
||||
whd_result_t whd_cdc_send_iovar(whd_interface_t ifp, cdc_command_type_t type,
|
||||
whd_buffer_t send_buffer_hnd,
|
||||
whd_buffer_t *response_buffer_hnd)
|
||||
{
|
||||
if (type == CDC_SET)
|
||||
{
|
||||
return whd_cdc_send_ioctl(ifp, CDC_SET, (uint32_t)WLC_SET_VAR, send_buffer_hnd, response_buffer_hnd);
|
||||
}
|
||||
else
|
||||
{
|
||||
return whd_cdc_send_ioctl(ifp, CDC_GET, (uint32_t)WLC_GET_VAR, send_buffer_hnd, response_buffer_hnd);
|
||||
}
|
||||
}
|
||||
|
||||
/** A helper function to easily acquire and initialise a buffer destined for use as an iovar
|
||||
*
|
||||
* @param buffer : A pointer to a whd_buffer_t object where the created buffer will be stored
|
||||
* @param data_length : The length of space reserved for user data
|
||||
* @param name : The name of the iovar
|
||||
*
|
||||
* @return A pointer to the start of user data with data_length space available
|
||||
*/
|
||||
void *whd_cdc_get_iovar_buffer(whd_driver_t whd_driver,
|
||||
whd_buffer_t *buffer,
|
||||
uint16_t data_length,
|
||||
const char *name)
|
||||
{
|
||||
uint32_t name_length = (uint32_t)strlen(name) + 1; /* + 1 for terminating null */
|
||||
uint32_t name_length_alignment_offset = (64 - name_length) % sizeof(uint32_t);
|
||||
|
||||
if (whd_host_buffer_get(whd_driver, buffer, WHD_NETWORK_TX,
|
||||
(unsigned short)(IOCTL_OFFSET + data_length + name_length + name_length_alignment_offset),
|
||||
(unsigned long)WHD_IOCTL_PACKET_TIMEOUT) == WHD_SUCCESS)
|
||||
{
|
||||
uint8_t *data = (whd_buffer_get_current_piece_data_pointer(whd_driver, *buffer) + IOCTL_OFFSET);
|
||||
memset(data, 0, name_length_alignment_offset);
|
||||
memcpy(data + name_length_alignment_offset, name, name_length);
|
||||
return (data + name_length + name_length_alignment_offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Error - failed to allocate a packet buffer for IOVAR\n") );
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/** Sends a data packet.
|
||||
*
|
||||
* This function should be called by the bottom of the network stack in order for it
|
||||
* to send an ethernet frame.
|
||||
* The function prepends a BDC header, before sending to @ref whd_send_to_bus where
|
||||
* the BUS header will be added
|
||||
*
|
||||
* @param buffer : The ethernet packet buffer to be sent
|
||||
* @param interface : the interface over which to send the packet (AP or STA)
|
||||
*
|
||||
*/
|
||||
/* Returns immediately - whd_buffer_tx_completed will be called once the transmission has finished */
|
||||
void whd_network_send_ethernet_data(whd_interface_t ifp, whd_buffer_t buffer)
|
||||
{
|
||||
data_header_t *packet;
|
||||
whd_result_t result;
|
||||
uint8_t *dscp = NULL;
|
||||
uint8_t priority = 0;
|
||||
uint8_t whd_tos_map[8] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };
|
||||
whd_driver_t whd_driver = ifp->whd_driver;
|
||||
ethernet_header_t *ethernet_header = (ethernet_header_t *)whd_buffer_get_current_piece_data_pointer(
|
||||
whd_driver, buffer);
|
||||
uint16_t ether_type;
|
||||
|
||||
ether_type = ntoh16(ethernet_header->ethertype);
|
||||
if ( (ether_type == WHD_ETHERTYPE_IPv4) || (ether_type == WHD_ETHERTYPE_DOT1AS) )
|
||||
{
|
||||
dscp = (uint8_t *)whd_buffer_get_current_piece_data_pointer(whd_driver, buffer) + IPV4_DSCP_OFFSET;
|
||||
}
|
||||
|
||||
WPRINT_WHD_DATA_LOG( ("Wcd:> DATA pkt 0x%08lX len %d\n", (unsigned long)buffer,
|
||||
(int)whd_buffer_get_current_piece_size(whd_driver, buffer) ) );
|
||||
|
||||
|
||||
/* Add link space at front of packet */
|
||||
result = whd_buffer_add_remove_at_front(whd_driver, &buffer, -(int)(sizeof(data_header_t) ) );
|
||||
if (result != WHD_SUCCESS)
|
||||
{
|
||||
WPRINT_WHD_DEBUG( ("Unable to adjust header space\n") );
|
||||
result = whd_buffer_release(ifp->whd_driver, buffer, WHD_NETWORK_TX);
|
||||
if (result != WHD_SUCCESS)
|
||||
WPRINT_WHD_ERROR( ("buffer release failed in %s at %d \n", __func__, __LINE__) );
|
||||
return;
|
||||
}
|
||||
|
||||
packet = (data_header_t *)whd_buffer_get_current_piece_data_pointer(whd_driver, buffer);
|
||||
|
||||
if (ifp->bsscfgidx > WHD_INTERFACE_MAX)
|
||||
{
|
||||
WPRINT_WHD_DEBUG( ("No interface for packet send\n") );
|
||||
result = whd_buffer_release(ifp->whd_driver, buffer, WHD_NETWORK_TX);
|
||||
if (result != WHD_SUCCESS)
|
||||
WPRINT_WHD_ERROR( ("buffer release failed in %s at %d \n", __func__, __LINE__) );
|
||||
return;
|
||||
}
|
||||
|
||||
/* Prepare the BDC header */
|
||||
packet->bdc_header.flags = 0;
|
||||
packet->bdc_header.flags = (uint8_t)(BDC_PROTO_VER << BDC_FLAG_VER_SHIFT);
|
||||
/* If it's an IPv4 packet set the BDC header priority based on the DSCP field */
|
||||
if ( ( (ether_type == WHD_ETHERTYPE_IPv4) || (ether_type == WHD_ETHERTYPE_DOT1AS) ) && (dscp != NULL) )
|
||||
{
|
||||
if (*dscp != 0) /* If it's equal 0 then it's best effort traffic and nothing needs to be done */
|
||||
{
|
||||
priority = whd_map_dscp_to_priority(whd_driver, *dscp);
|
||||
}
|
||||
}
|
||||
|
||||
/* If STA interface, re-map prio to the prio allowed by the AP, regardless of whether it's an IPv4 packet */
|
||||
if (ifp->role == WHD_STA_ROLE)
|
||||
{
|
||||
packet->bdc_header.priority = whd_tos_map[priority];
|
||||
}
|
||||
else
|
||||
{
|
||||
packet->bdc_header.priority = priority;
|
||||
}
|
||||
|
||||
packet->bdc_header.flags2 = ifp->bsscfgidx;
|
||||
packet->bdc_header.data_offset = 0;
|
||||
|
||||
/* Add the length of the BDC header and pass "down" */
|
||||
whd_send_to_bus(whd_driver, buffer, DATA_HEADER);
|
||||
|
||||
}
|
||||
|
||||
/** A helper function to easily acquire and initialise a buffer destined for use as an ioctl
|
||||
*
|
||||
* @param buffer : A pointer to a whd_buffer_t object where the created buffer will be stored
|
||||
* @param data_length : The length of space reserved for user data
|
||||
*
|
||||
* @return A pointer to the start of user data with data_length space available
|
||||
*/
|
||||
void *whd_cdc_get_ioctl_buffer(whd_driver_t whd_driver,
|
||||
whd_buffer_t *buffer,
|
||||
uint16_t data_length)
|
||||
{
|
||||
if (whd_host_buffer_get(whd_driver, buffer, WHD_NETWORK_TX, (unsigned short)(IOCTL_OFFSET + data_length),
|
||||
(unsigned long)WHD_IOCTL_PACKET_TIMEOUT) == WHD_SUCCESS)
|
||||
{
|
||||
return (whd_buffer_get_current_piece_data_pointer(whd_driver, *buffer) + IOCTL_OFFSET);
|
||||
}
|
||||
else
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Error - failed to allocate a packet buffer for IOCTL\n") );
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/** Processes CDC header information received in the RX packet and sets IOCTL response buffer
|
||||
*
|
||||
* @param whd_driver : WHD driver instance
|
||||
* @param buffer : A pointer to a whd_buffer_t object where the created buffer will be stored
|
||||
*/
|
||||
|
||||
void whd_process_cdc(whd_driver_t whd_driver, whd_buffer_t buffer)
|
||||
{
|
||||
uint32_t flags;
|
||||
uint16_t id;
|
||||
whd_cdc_bdc_info_t *cdc_bdc_info = &whd_driver->cdc_bdc_info;
|
||||
whd_result_t result;
|
||||
cdc_header_t *cdc_header = (cdc_header_t *)whd_buffer_get_current_piece_data_pointer(whd_driver, buffer);
|
||||
whd_result_t ioctl_mutex_res;
|
||||
|
||||
flags = dtoh32(cdc_header->flags);
|
||||
id = (uint16_t)( (flags & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT );
|
||||
|
||||
/* Validate request ioctl ID and check if whd_cdc_send_ioctl is still waiting for response*/
|
||||
if ( ( (ioctl_mutex_res = cy_rtos_get_semaphore(&cdc_bdc_info->ioctl_mutex, 0, WHD_FALSE) ) != WHD_SUCCESS ) &&
|
||||
(id == cdc_bdc_info->requested_ioctl_id) )
|
||||
{
|
||||
/* Save the response packet in a variable */
|
||||
cdc_bdc_info->ioctl_response = buffer;
|
||||
|
||||
WPRINT_WHD_DATA_LOG( ("Wcd:< Procd pkt 0x%08lX: IOCTL Response (%d bytes)\n", (unsigned long)buffer,
|
||||
size) );
|
||||
|
||||
/* Wake the thread which sent the IOCTL/IOVAR so that it will resume */
|
||||
result = cy_rtos_set_semaphore(&cdc_bdc_info->ioctl_sleep, WHD_FALSE);
|
||||
if (result != WHD_SUCCESS)
|
||||
WPRINT_WHD_ERROR( ("Error setting semaphore in %s at %d \n", __func__, __LINE__) );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Received buffer request ID: %d (expectation: %d)\n",
|
||||
id, cdc_bdc_info->requested_ioctl_id) );
|
||||
if (ioctl_mutex_res == WHD_SUCCESS)
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("whd_cdc_send_ioctl is already timed out, drop the buffer\n") );
|
||||
result = cy_rtos_set_semaphore(&cdc_bdc_info->ioctl_mutex, WHD_FALSE);
|
||||
if (result != WHD_SUCCESS)
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Error setting semaphore in %s at %d \n", __func__, __LINE__) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Received a response for a different IOCTL - retry\n") );
|
||||
}
|
||||
|
||||
result = whd_buffer_release(whd_driver, buffer, WHD_NETWORK_RX);
|
||||
if (result != WHD_SUCCESS)
|
||||
WPRINT_WHD_ERROR( ("buffer release failed in %s at %d \n", __func__, __LINE__) );
|
||||
}
|
||||
}
|
||||
|
||||
/** Processes BDC header information received in the RX packet and sends data to network stack
|
||||
*
|
||||
* @param whd_driver : WHD driver instance
|
||||
* @param buffer : A pointer to a whd_buffer_t object where the created buffer will be stored
|
||||
*/
|
||||
|
||||
void whd_process_bdc(whd_driver_t whd_driver, whd_buffer_t buffer)
|
||||
{
|
||||
int32_t headers_len_below_payload;
|
||||
uint32_t ip_data_start_add;
|
||||
uint32_t bssid_index;
|
||||
whd_interface_t ifp;
|
||||
whd_result_t result;
|
||||
bdc_header_t *bdc_header = (bdc_header_t *)whd_buffer_get_current_piece_data_pointer(whd_driver, buffer);
|
||||
|
||||
/* Calculate where the payload is */
|
||||
headers_len_below_payload =
|
||||
(int32_t)( (int32_t)BDC_HEADER_LEN + (int32_t)(bdc_header->data_offset << 2) );
|
||||
|
||||
/* Move buffer pointer past gSPI, BUS, BCD headers and padding,
|
||||
* so that the network stack or 802.11 monitor sees only the payload */
|
||||
if (WHD_SUCCESS != whd_buffer_add_remove_at_front(whd_driver, &buffer, headers_len_below_payload) )
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("No space for headers without chaining. this should never happen\n") );
|
||||
result = whd_buffer_release(whd_driver, buffer, WHD_NETWORK_RX);
|
||||
if (result != WHD_SUCCESS)
|
||||
WPRINT_WHD_ERROR( ("buffer release failed in %s at %d \n", __func__, __LINE__) );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* It is preferable to have IP data at address aligned to 4 bytes. IP data startes after ethernet header */
|
||||
ip_data_start_add =
|
||||
(uint32_t )whd_buffer_get_current_piece_data_pointer(whd_driver, buffer) + WHD_ETHERNET_SIZE;
|
||||
if ( ( (ip_data_start_add >> 2) << 2 ) != ip_data_start_add )
|
||||
{
|
||||
WPRINT_WHD_DATA_LOG( ("IP data not aligned to 4 bytes %lx\n", ip_data_start_add) );
|
||||
}
|
||||
|
||||
WPRINT_WHD_DATA_LOG( ("Wcd:< Procd pkt 0x%08lX: Data (%d bytes)\n", (unsigned long)buffer, size) );
|
||||
bssid_index = (uint32_t)(bdc_header->flags2 & BDC_FLAG2_IF_MASK);
|
||||
ifp = whd_driver->iflist[bssid_index];
|
||||
|
||||
/* Send packet to bottom of network stack */
|
||||
result = whd_network_process_ethernet_data(ifp, buffer);
|
||||
if (result != WHD_SUCCESS)
|
||||
WPRINT_WHD_ERROR( ("%s failed at %d \n", __func__, __LINE__) );
|
||||
}
|
||||
|
||||
/** Processes BDC header information and extracts the event packets
|
||||
* Event Packets are decoded to determine which event occurred, and the event handler list is consulted
|
||||
* and the appropriate event handler is called
|
||||
*
|
||||
* @param whd_driver : WHD driver instance
|
||||
* @param buffer : A pointer to a whd_buffer_t object where the created buffer will be stored
|
||||
* @param size : Size of the complete packet received from WLAN device
|
||||
*/
|
||||
void whd_process_bdc_event(whd_driver_t whd_driver, whd_buffer_t buffer, uint16_t size)
|
||||
{
|
||||
uint16_t ether_type;
|
||||
whd_event_header_t *whd_event;
|
||||
whd_event_t *event;
|
||||
whd_cdc_bdc_info_t *cdc_bdc_info = &whd_driver->cdc_bdc_info;
|
||||
whd_result_t result;
|
||||
bdc_header_t *bdc_header = (bdc_header_t *)whd_buffer_get_current_piece_data_pointer(whd_driver, buffer);
|
||||
uint16_t i;
|
||||
uint16_t j;
|
||||
|
||||
event = (whd_event_t *)&bdc_header[bdc_header->data_offset + 1];
|
||||
|
||||
ether_type = ntoh16(event->eth.ethertype);
|
||||
|
||||
/* If frame is truly an event, it should have EtherType equal to the Broadcom type. */
|
||||
if (ether_type != (uint16_t)ETHER_TYPE_BRCM)
|
||||
{
|
||||
WPRINT_WHD_DEBUG( ("Error - received a channel 1 packet which was not BRCM ethertype\n") );
|
||||
result = whd_buffer_release(whd_driver, buffer, WHD_NETWORK_RX);
|
||||
if (result != WHD_SUCCESS)
|
||||
WPRINT_WHD_ERROR( ("buffer release failed in %s at %d \n", __func__, __LINE__) );
|
||||
return;
|
||||
}
|
||||
|
||||
/* If ethertype is correct, the contents of the ethernet packet
|
||||
* are a structure of type bcm_event_t
|
||||
*/
|
||||
|
||||
/* Check that the OUI matches the Broadcom OUI */
|
||||
if (0 != memcmp(BRCM_OUI, &event->eth_evt_hdr.oui[0], (size_t)DOT11_OUI_LEN) )
|
||||
{
|
||||
WPRINT_WHD_DEBUG( ("Event OUI mismatch\n") );
|
||||
result = whd_buffer_release(whd_driver, buffer, WHD_NETWORK_RX);
|
||||
if (result != WHD_SUCCESS)
|
||||
WPRINT_WHD_ERROR( ("buffer release failed in %s at %d \n", __func__, __LINE__) );
|
||||
return;
|
||||
}
|
||||
|
||||
whd_event = &event->whd_event;
|
||||
|
||||
/* Search for the event type in the list of event handler functions
|
||||
* event data is stored in network endianness
|
||||
*/
|
||||
whd_event->flags = ntoh16(whd_event->flags);
|
||||
whd_event->event_type = (whd_event_num_t)ntoh32(whd_event->event_type);
|
||||
whd_event->status = (whd_event_status_t)ntoh32(whd_event->status);
|
||||
whd_event->reason = (whd_event_reason_t)ntoh32(whd_event->reason);
|
||||
whd_event->auth_type = ntoh32(whd_event->auth_type);
|
||||
whd_event->datalen = ntoh32(whd_event->datalen);
|
||||
|
||||
/* Ensure data length is correct */
|
||||
if (whd_event->datalen >
|
||||
(uint32_t)(size - ( (char *)DATA_AFTER_HEADER(event) - (char *)bdc_header ) ) )
|
||||
{
|
||||
WPRINT_WHD_ERROR( (
|
||||
"Error - (data length received [%d] > expected data length [%d]). Bus header packet size = [%d]. Ignoring the packet\n",
|
||||
(int)whd_event->datalen,
|
||||
size - ( (char *)DATA_AFTER_HEADER(event) - (char *)bdc_header ),
|
||||
size) );
|
||||
result = whd_buffer_release(whd_driver, buffer, WHD_NETWORK_RX);
|
||||
if (result != WHD_SUCCESS)
|
||||
WPRINT_WHD_ERROR( ("buffer release failed in %s at %d \n", __func__, __LINE__) );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* This is necessary because people who defined event statuses and reasons overlapped values. */
|
||||
if (whd_event->event_type == WLC_E_PSK_SUP)
|
||||
{
|
||||
whd_event->status = (whd_event_status_t)( (int)whd_event->status + WLC_SUP_STATUS_OFFSET );
|
||||
whd_event->reason = (whd_event_reason_t)( (int)whd_event->reason + WLC_E_SUP_REASON_OFFSET );
|
||||
}
|
||||
else if (whd_event->event_type == WLC_E_PRUNE)
|
||||
{
|
||||
whd_event->reason = (whd_event_reason_t)( (int)whd_event->reason + WLC_E_PRUNE_REASON_OFFSET );
|
||||
}
|
||||
else if ( (whd_event->event_type == WLC_E_DISASSOC) || (whd_event->event_type == WLC_E_DEAUTH) )
|
||||
{
|
||||
whd_event->status = (whd_event_status_t)( (int)whd_event->status + WLC_DOT11_SC_STATUS_OFFSET );
|
||||
whd_event->reason = (whd_event_reason_t)( (int)whd_event->reason + WLC_E_DOT11_RC_REASON_OFFSET );
|
||||
}
|
||||
|
||||
/* do any needed debug logging of event */
|
||||
WHD_IOCTL_LOG_ADD_EVENT(whd_driver, whd_event->event_type, whd_event->status,
|
||||
whd_event->reason);
|
||||
|
||||
if (cy_rtos_get_semaphore(&cdc_bdc_info->event_list_mutex, CY_RTOS_NEVER_TIMEOUT, WHD_FALSE) != WHD_SUCCESS)
|
||||
{
|
||||
WPRINT_WHD_DEBUG( ("Failed to obtain mutex for event list access!\n") );
|
||||
result = whd_buffer_release(whd_driver, buffer, WHD_NETWORK_RX);
|
||||
if (result != WHD_SUCCESS)
|
||||
WPRINT_WHD_ERROR( ("buffer release failed in %s at %d \n", __func__, __LINE__) );
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < (uint16_t)WHD_EVENT_HANDLER_LIST_SIZE; i++)
|
||||
{
|
||||
if (cdc_bdc_info->whd_event_list[i].event_set)
|
||||
{
|
||||
for (j = 0; cdc_bdc_info->whd_event_list[i].events[j] != WLC_E_NONE; ++j)
|
||||
{
|
||||
if ( (cdc_bdc_info->whd_event_list[i].events[j] == whd_event->event_type) &&
|
||||
(cdc_bdc_info->whd_event_list[i].ifidx == whd_event->ifidx) )
|
||||
{
|
||||
/* Correct event type has been found - call the handler function and exit loop */
|
||||
cdc_bdc_info->whd_event_list[i].handler_user_data =
|
||||
cdc_bdc_info->whd_event_list[i].handler(whd_driver->iflist[whd_event->bsscfgidx],
|
||||
whd_event,
|
||||
(uint8_t *)DATA_AFTER_HEADER(
|
||||
event),
|
||||
cdc_bdc_info->whd_event_list[i].handler_user_data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result = cy_rtos_set_semaphore(&cdc_bdc_info->event_list_mutex, WHD_FALSE);
|
||||
if (result != WHD_SUCCESS)
|
||||
WPRINT_WHD_ERROR( ("Error setting semaphore in %s at %d \n", __func__, __LINE__) );
|
||||
|
||||
WPRINT_WHD_DATA_LOG( ("Wcd:< Procd pkt 0x%08lX: Evnt %d (%d bytes)\n", (unsigned long)buffer,
|
||||
(int)whd_event->event_type, size) );
|
||||
|
||||
/* Release the event packet buffer */
|
||||
result = whd_buffer_release(whd_driver, buffer, WHD_NETWORK_RX);
|
||||
if (result != WHD_SUCCESS)
|
||||
WPRINT_WHD_ERROR( ("buffer release failed in %s at %d \n", __func__, __LINE__) );
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,362 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "whd_chip_constants.h"
|
||||
#include "whd_wlioctl.h"
|
||||
#include "whd_int.h"
|
||||
#include "whd_types_int.h"
|
||||
|
||||
|
||||
/******************************************************
|
||||
* Function Definitions
|
||||
******************************************************/
|
||||
|
||||
uint32_t whd_chip_set_chip_id(whd_driver_t whd_driver, uint16_t id)
|
||||
{
|
||||
whd_driver->chip_info.chip_id = id;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16_t whd_chip_get_chip_id(whd_driver_t whd_driver)
|
||||
{
|
||||
return whd_driver->chip_info.chip_id;
|
||||
}
|
||||
|
||||
uint32_t get_whd_var(whd_driver_t whd_driver, chip_var_t var)
|
||||
{
|
||||
uint32_t val;
|
||||
|
||||
uint16_t wlan_chip_id = whd_chip_get_chip_id(whd_driver);
|
||||
switch (var)
|
||||
{
|
||||
case BUS_CREDIT_DIFF:
|
||||
CHECK_RETURN(get_chip_max_bus_data_credit_diff(wlan_chip_id, &val) );
|
||||
break;
|
||||
case CHIP_RAM_SIZE:
|
||||
CHECK_RETURN(get_chip_ram_size(wlan_chip_id, &val) );
|
||||
break;
|
||||
case ATCM_RAM_BASE_ADDRESS:
|
||||
CHECK_RETURN(get_atcm_ram_base_address(wlan_chip_id, &val) );
|
||||
break;
|
||||
case SOCRAM_SRMEM_SIZE:
|
||||
CHECK_RETURN(get_socsram_srmem_size(wlan_chip_id, &val) );
|
||||
break;
|
||||
case CHANSPEC_BAND_MASK:
|
||||
CHECK_RETURN(get_wl_chanspec_band_mask(wlan_chip_id, &val) );
|
||||
break;
|
||||
case CHANSPEC_BAND_2G:
|
||||
CHECK_RETURN(get_wl_chanspec_band_2G(wlan_chip_id, &val) );
|
||||
break;
|
||||
case CHANSPEC_BAND_5G:
|
||||
CHECK_RETURN(get_wl_chanspec_band_5G(wlan_chip_id, &val) );
|
||||
break;
|
||||
case CHANSPEC_BAND_SHIFT:
|
||||
CHECK_RETURN(get_wl_chanspec_band_shift(wlan_chip_id, &val) );
|
||||
break;
|
||||
case CHANSPEC_BW_10:
|
||||
CHECK_RETURN(get_wl_chanspec_bw_10(wlan_chip_id, &val) );
|
||||
break;
|
||||
case CHANSPEC_BW_20:
|
||||
CHECK_RETURN(get_wl_chanspec_bw_20(wlan_chip_id, &val) );
|
||||
break;
|
||||
case CHANSPEC_BW_40:
|
||||
CHECK_RETURN(get_wl_chanspec_bw_40(wlan_chip_id, &val) );
|
||||
break;
|
||||
case CHANSPEC_BW_MASK:
|
||||
CHECK_RETURN(get_wl_chanspec_bw_mask(wlan_chip_id, &val) );
|
||||
break;
|
||||
case CHANSPEC_BW_SHIFT:
|
||||
CHECK_RETURN(get_wl_chanspec_bw_shift(wlan_chip_id, &val) );
|
||||
break;
|
||||
case CHANSPEC_CTL_SB_LOWER:
|
||||
CHECK_RETURN(get_wl_chanspec_ctl_sb_lower(wlan_chip_id, &val) );
|
||||
break;
|
||||
case CHANSPEC_CTL_SB_UPPER:
|
||||
CHECK_RETURN(get_wl_chanspec_ctl_sb_upper(wlan_chip_id, &val) );
|
||||
break;
|
||||
case CHANSPEC_CTL_SB_NONE:
|
||||
CHECK_RETURN(get_wl_chanspec_ctl_sb_none(wlan_chip_id, &val) );
|
||||
break;
|
||||
case CHANSPEC_CTL_SB_MASK:
|
||||
CHECK_RETURN(get_wl_chanspec_ctl_sb_mask(wlan_chip_id, &val) );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
whd_result_t get_chip_max_bus_data_credit_diff(uint16_t wlan_chip_id, uint32_t *credit_diff)
|
||||
{
|
||||
*credit_diff = 0;
|
||||
if (wlan_chip_id == 43362)
|
||||
{
|
||||
*credit_diff = 7;
|
||||
}
|
||||
else if (wlan_chip_id == 43455)
|
||||
{
|
||||
*credit_diff = 50;
|
||||
}
|
||||
else
|
||||
{
|
||||
*credit_diff = 20;
|
||||
}
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
whd_result_t get_chip_ram_size(uint16_t wlan_chip_id, uint32_t *size)
|
||||
{
|
||||
*size = 0;
|
||||
if ( (wlan_chip_id == 4334) || (wlan_chip_id == 43340) || (wlan_chip_id == 43342) || (wlan_chip_id == 43430) )
|
||||
{
|
||||
*size = (512 * 1024);
|
||||
}
|
||||
else if ( (wlan_chip_id == 43362) || (wlan_chip_id == 4390) )
|
||||
{
|
||||
*size = 0x3C000;
|
||||
}
|
||||
else if (wlan_chip_id == 43909)
|
||||
{
|
||||
*size = 0x90000;
|
||||
}
|
||||
else if (wlan_chip_id == 43012)
|
||||
{
|
||||
*size = 0xA0000;
|
||||
}
|
||||
else
|
||||
{
|
||||
*size = 0x80000;
|
||||
}
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
whd_result_t get_atcm_ram_base_address(uint16_t wlan_chip_id, uint32_t *size)
|
||||
{
|
||||
*size = 0;
|
||||
if (wlan_chip_id == 43455)
|
||||
{
|
||||
*size = 0x198000;
|
||||
}
|
||||
else
|
||||
{
|
||||
*size = 0;
|
||||
}
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
whd_result_t get_socsram_srmem_size(uint16_t wlan_chip_id, uint32_t *mem_size)
|
||||
{
|
||||
*mem_size = 0;
|
||||
if ( (wlan_chip_id == 43340) || (wlan_chip_id == 43342) )
|
||||
{
|
||||
*mem_size = (32 * 1024);
|
||||
}
|
||||
else if (wlan_chip_id == 43430)
|
||||
{
|
||||
*mem_size = (64 * 1024);
|
||||
}
|
||||
else
|
||||
{
|
||||
*mem_size = 0;
|
||||
}
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
whd_result_t get_wl_chanspec_band_mask(uint16_t wlan_chip_id, uint32_t *band_mask)
|
||||
{
|
||||
*band_mask = 0;
|
||||
if ( (wlan_chip_id == 43362) || (wlan_chip_id == 4334) || (wlan_chip_id == 43340) || (wlan_chip_id == 43342) )
|
||||
{
|
||||
*band_mask = 0xf000;
|
||||
}
|
||||
else
|
||||
{
|
||||
*band_mask = 0xc000;
|
||||
}
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
whd_result_t get_wl_chanspec_band_2G(uint16_t wlan_chip_id, uint32_t *band_2g)
|
||||
{
|
||||
*band_2g = 0;
|
||||
if ( (wlan_chip_id == 43362) || (wlan_chip_id == 4334) || (wlan_chip_id == 43340) || (wlan_chip_id == 43342) )
|
||||
{
|
||||
*band_2g = 0x2000;
|
||||
}
|
||||
else
|
||||
{
|
||||
*band_2g = 0x0000;
|
||||
}
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
whd_result_t get_wl_chanspec_band_5G(uint16_t wlan_chip_id, uint32_t *band_5g)
|
||||
{
|
||||
*band_5g = 0;
|
||||
if ( (wlan_chip_id == 43362) || (wlan_chip_id == 4334) || (wlan_chip_id == 43340) || (wlan_chip_id == 43342) )
|
||||
{
|
||||
*band_5g = 0x1000;
|
||||
}
|
||||
else
|
||||
{
|
||||
*band_5g = 0xc000;
|
||||
}
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
whd_result_t get_wl_chanspec_band_shift(uint16_t wlan_chip_id, uint32_t *band_shift)
|
||||
{
|
||||
*band_shift = 0;
|
||||
if ( (wlan_chip_id == 4334) || (wlan_chip_id == 43340) || (wlan_chip_id == 43342) )
|
||||
{
|
||||
*band_shift = 12;
|
||||
}
|
||||
else
|
||||
{
|
||||
*band_shift = 14;
|
||||
}
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
whd_result_t get_wl_chanspec_bw_10(uint16_t wlan_chip_id, uint32_t *bw_10)
|
||||
{
|
||||
*bw_10 = 0;
|
||||
if ( (wlan_chip_id == 43362) || (wlan_chip_id == 4334) || (wlan_chip_id == 43340) || (wlan_chip_id == 43342) )
|
||||
{
|
||||
*bw_10 = 0x0400;
|
||||
}
|
||||
else
|
||||
{
|
||||
*bw_10 = 0x0800;
|
||||
}
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
whd_result_t get_wl_chanspec_bw_20(uint16_t wlan_chip_id, uint32_t *bw_20)
|
||||
{
|
||||
*bw_20 = 0;
|
||||
if ( (wlan_chip_id == 43362) || (wlan_chip_id == 4334) || (wlan_chip_id == 43340) || (wlan_chip_id == 43342) )
|
||||
{
|
||||
*bw_20 = 0x0800;
|
||||
}
|
||||
else
|
||||
{
|
||||
*bw_20 = 0x1000;
|
||||
}
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
whd_result_t get_wl_chanspec_bw_40(uint16_t wlan_chip_id, uint32_t *bw_40)
|
||||
{
|
||||
*bw_40 = 0;
|
||||
if ( (wlan_chip_id == 43362) || (wlan_chip_id == 4334) || (wlan_chip_id == 43340) || (wlan_chip_id == 43342) )
|
||||
{
|
||||
*bw_40 = 0x0C00;
|
||||
}
|
||||
else
|
||||
{
|
||||
*bw_40 = 0x1800;
|
||||
}
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
whd_result_t get_wl_chanspec_bw_mask(uint16_t wlan_chip_id, uint32_t *bw_mask)
|
||||
{
|
||||
*bw_mask = 0;
|
||||
if ( (wlan_chip_id == 43362) || (wlan_chip_id == 4334) || (wlan_chip_id == 43340) || (wlan_chip_id == 43342) )
|
||||
{
|
||||
*bw_mask = 0x0C00;
|
||||
}
|
||||
else
|
||||
{
|
||||
*bw_mask = 0x3800;
|
||||
}
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
whd_result_t get_wl_chanspec_bw_shift(uint16_t wlan_chip_id, uint32_t *bw_shift)
|
||||
{
|
||||
*bw_shift = 0;
|
||||
if ( (wlan_chip_id == 4334) || (wlan_chip_id == 43340) || (wlan_chip_id == 43342) )
|
||||
{
|
||||
*bw_shift = 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
*bw_shift = 11;
|
||||
}
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
whd_result_t get_wl_chanspec_ctl_sb_lower(uint16_t wlan_chip_id, uint32_t *sb_lower)
|
||||
{
|
||||
*sb_lower = 0;
|
||||
if ( (wlan_chip_id == 43362) || (wlan_chip_id == 4334) || (wlan_chip_id == 43340) || (wlan_chip_id == 43342) )
|
||||
{
|
||||
*sb_lower = 0x0100;
|
||||
}
|
||||
else
|
||||
{
|
||||
*sb_lower = WL_CHANSPEC_CTL_SB_LLL;
|
||||
}
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
whd_result_t get_wl_chanspec_ctl_sb_upper(uint16_t wlan_chip_id, uint32_t *sb_upper)
|
||||
{
|
||||
*sb_upper = 0;
|
||||
if ( (wlan_chip_id == 43362) || (wlan_chip_id == 4334) || (wlan_chip_id == 43340) || (wlan_chip_id == 43342) )
|
||||
{
|
||||
*sb_upper = 0x0200;
|
||||
}
|
||||
else
|
||||
{
|
||||
*sb_upper = WL_CHANSPEC_CTL_SB_LLU;
|
||||
}
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
whd_result_t get_wl_chanspec_ctl_sb_none(uint16_t wlan_chip_id, uint32_t *sb_none)
|
||||
{
|
||||
*sb_none = 0;
|
||||
if ( (wlan_chip_id == 43362) || (wlan_chip_id == 4334) || (wlan_chip_id == 43340) || (wlan_chip_id == 43342) )
|
||||
{
|
||||
*sb_none = 0x0300;
|
||||
}
|
||||
else
|
||||
{
|
||||
*sb_none = WL_CHANSPEC_CTL_SB_LLL;
|
||||
}
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
whd_result_t get_wl_chanspec_ctl_sb_mask(uint16_t wlan_chip_id, uint32_t *sb_mask)
|
||||
{
|
||||
*sb_mask = 0;
|
||||
if ( (wlan_chip_id == 43362) || (wlan_chip_id == 4334) || (wlan_chip_id == 43340) || (wlan_chip_id == 43342) )
|
||||
{
|
||||
*sb_mask = 0x0300;
|
||||
}
|
||||
else
|
||||
{
|
||||
*sb_mask = 0x0700;
|
||||
}
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
|
@ -0,0 +1,173 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* Provides generic clm blob file download functionality
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "whd_clm.h"
|
||||
#include "whd_wlioctl.h"
|
||||
#include "whd_cdc_bdc.h"
|
||||
#include "whd_debug.h"
|
||||
#include "whd_int.h"
|
||||
#include "whd_buffer_api.h"
|
||||
#include "whd_resource_if.h"
|
||||
#include "whd_resource_api.h"
|
||||
#include "whd_types_int.h"
|
||||
|
||||
/******************************************************
|
||||
* @cond Constants
|
||||
******************************************************/
|
||||
|
||||
/*
|
||||
Generic interface for downloading required data onto the dongle
|
||||
*/
|
||||
static int whd_download_wifi_clm_image(whd_interface_t ifp, const char *iovar, uint16_t flag, uint16_t dload_type,
|
||||
unsigned char *dload_buf, uint32_t len)
|
||||
{
|
||||
wl_dload_data_t *dload_ptr = (wl_dload_data_t *)dload_buf;
|
||||
unsigned int dload_data_offset;
|
||||
whd_buffer_t buffer;
|
||||
uint8_t *iov_data;
|
||||
whd_driver_t whd_driver = ifp->whd_driver;
|
||||
|
||||
dload_data_offset = offsetof(wl_dload_data_t, data);
|
||||
dload_ptr->flag = htod16( (DLOAD_HANDLER_VER << DLOAD_FLAG_VER_SHIFT) | flag );
|
||||
dload_ptr->dload_type = htod16(dload_type);
|
||||
dload_ptr->len = htod32(len - dload_data_offset);
|
||||
|
||||
dload_ptr->crc = 0;
|
||||
|
||||
whd_assert("dload buffer too large", len < 0xffffffff - 8);
|
||||
len = len + 8 - (len % 8);
|
||||
|
||||
iov_data = (uint8_t *)whd_cdc_get_iovar_buffer(whd_driver, &buffer, (uint16_t)len, iovar);
|
||||
CHECK_IOCTL_BUFFER(iov_data);
|
||||
memcpy(iov_data, (uint8_t *)dload_ptr, len);
|
||||
CHECK_RETURN(whd_cdc_send_iovar(ifp, CDC_SET, buffer, NULL) );
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
whd_result_t whd_process_clm_data(whd_interface_t ifp)
|
||||
{
|
||||
whd_result_t ret = WHD_SUCCESS;
|
||||
uint32_t clm_blob_size;
|
||||
unsigned int size2alloc, data_offset;
|
||||
unsigned char *chunk_buf;
|
||||
uint16_t dl_flag = DL_BEGIN;
|
||||
unsigned int chunk_len;
|
||||
uint32_t size_read;
|
||||
uint8_t *image;
|
||||
uint32_t blocks_count = 0;
|
||||
uint16_t datalen = 0;
|
||||
uint32_t i, j, num_buff;
|
||||
unsigned int transfer_progress;
|
||||
whd_driver_t whd_driver = ifp->whd_driver;
|
||||
|
||||
/* clm file size is the initial datalen value which is decremented */
|
||||
ret = whd_resource_size(whd_driver, WHD_RESOURCE_WLAN_CLM, &clm_blob_size);
|
||||
|
||||
if (ret != WHD_SUCCESS)
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Fatal error: download_resource doesn't exist\n") );
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = whd_get_resource_no_of_blocks(whd_driver, WHD_RESOURCE_WLAN_CLM, &blocks_count);
|
||||
if (ret != WHD_SUCCESS)
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Fatal error: download_resource blocks count not know\n") );
|
||||
return ret;
|
||||
}
|
||||
|
||||
data_offset = offsetof(wl_dload_data_t, data);
|
||||
size2alloc = data_offset + BLOCK_SIZE;
|
||||
|
||||
|
||||
if ( (chunk_buf = (unsigned char *)malloc(size2alloc) ) != NULL )
|
||||
{
|
||||
memset(chunk_buf, 0, size2alloc);
|
||||
transfer_progress = 0;
|
||||
for (i = 0; i < blocks_count; i++)
|
||||
{
|
||||
whd_get_resource_block(whd_driver, WHD_RESOURCE_WLAN_CLM, (const uint8_t **)&image, &size_read);
|
||||
|
||||
num_buff = (size_read + BLOCK_SIZE - 1) / BLOCK_SIZE;
|
||||
if (blocks_count != 1)
|
||||
transfer_progress = 0;
|
||||
|
||||
if (size_read >= BLOCK_SIZE)
|
||||
chunk_len = BLOCK_SIZE;
|
||||
else
|
||||
chunk_len = (int)size_read;
|
||||
|
||||
for (j = 0; j < num_buff; j++)
|
||||
{
|
||||
memcpy(chunk_buf + data_offset, &image[transfer_progress], chunk_len);
|
||||
|
||||
if (datalen + chunk_len == clm_blob_size)
|
||||
{
|
||||
dl_flag |= DL_END;
|
||||
}
|
||||
|
||||
ret = whd_download_wifi_clm_image(ifp, IOVAR_STR_CLMLOAD, dl_flag, DL_TYPE_CLM, chunk_buf,
|
||||
data_offset + chunk_len);
|
||||
dl_flag &= (uint16_t) ~DL_BEGIN;
|
||||
transfer_progress += chunk_len;
|
||||
size_read = size_read - chunk_len;
|
||||
datalen += chunk_len;
|
||||
}
|
||||
}
|
||||
|
||||
free(chunk_buf);
|
||||
if (ret != WHD_SUCCESS)
|
||||
{
|
||||
whd_result_t ret_clmload_status;
|
||||
whd_buffer_t buffer;
|
||||
whd_buffer_t response;
|
||||
void *data;
|
||||
|
||||
WPRINT_WHD_DEBUG( ("clmload (%" PRIu32 " byte file) failed with return %" PRIu32 "; ", clm_blob_size,
|
||||
ret) );
|
||||
data = (int *)whd_cdc_get_iovar_buffer(whd_driver, &buffer, 4, IOVAR_STR_CLMLOAD_STATUS);
|
||||
CHECK_IOCTL_BUFFER(data);
|
||||
ret_clmload_status = whd_cdc_send_iovar(ifp, CDC_GET, buffer, &response);
|
||||
if (ret_clmload_status != WHD_SUCCESS)
|
||||
{
|
||||
WPRINT_WHD_DEBUG( ("clmload_status failed with return %lu\n", ret_clmload_status) );
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8_t *clmload_status = (uint8_t *)whd_buffer_get_current_piece_data_pointer(whd_driver, response);
|
||||
if (clmload_status != NULL)
|
||||
{
|
||||
WPRINT_WHD_DEBUG( ("clmload_status is %d\n", *clmload_status) );
|
||||
CHECK_RETURN(whd_buffer_release(whd_driver, response, WHD_NETWORK_RX) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Memory allocation failure, %s failed at %d \n", __func__, __LINE__) );
|
||||
ret = WHD_MALLOC_FAILURE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "whd_debug.h"
|
||||
#include "whd_int.h"
|
||||
#include "bus_protocols/whd_bus_protocol_interface.h"
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Structures
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Variables
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Function definitions
|
||||
******************************************************/
|
||||
void whd_init_stats(whd_driver_t whd_driver)
|
||||
{
|
||||
memset(&whd_driver->whd_stats, 0, sizeof(whd_driver->whd_stats) );
|
||||
}
|
||||
|
||||
uint32_t whd_print_stats(whd_driver_t whd_driver, whd_bool_t reset_after_print)
|
||||
{
|
||||
WPRINT_MACRO( ("WHD Stats.. \n"
|
||||
"tx_total:%" PRIu32 ", rx_total:%" PRIu32 ", tx_no_mem:%" PRIu32 ", rx_no_mem:%" PRIu32 "\n"
|
||||
"tx_fail:%" PRIu32 ", no_credit:%" PRIu32 ", flow_control:%" PRIu32 "\n",
|
||||
whd_driver->whd_stats.tx_total, whd_driver->whd_stats.rx_total,
|
||||
whd_driver->whd_stats.tx_no_mem, whd_driver->whd_stats.rx_no_mem,
|
||||
whd_driver->whd_stats.tx_fail, whd_driver->whd_stats.no_credit,
|
||||
whd_driver->whd_stats.flow_control) );
|
||||
|
||||
if (reset_after_print == WHD_TRUE)
|
||||
{
|
||||
memset(&whd_driver->whd_stats, 0, sizeof(whd_driver->whd_stats) );
|
||||
}
|
||||
|
||||
CHECK_RETURN(whd_bus_print_stats(whd_driver, reset_after_print) );
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
|
@ -0,0 +1,479 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "whd_int.h"
|
||||
#include "whd_cdc_bdc.h"
|
||||
#include "whd_events_int.h"
|
||||
#include "cyabs_rtos.h"
|
||||
#include "whd_network_types.h"
|
||||
#include "whd_types_int.h"
|
||||
#include "whd_wlioctl.h"
|
||||
#include "whd_thread_internal.h"
|
||||
#include "whd_buffer_api.h"
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
/* bit map related macros */
|
||||
#define NBBY 8 /* 8 bits per byte */
|
||||
#define setbit(a, i) ( ( (uint8_t *)a )[(int)(i) / (int)(NBBY)] |= (uint8_t)(1 << ( (i) % NBBY ) ) )
|
||||
#define clrbit(a, i) ( ( (uint8_t *)a )[(int)(i) / (int)(NBBY)] &= (uint8_t) ~(1 << ( (i) % NBBY ) ) )
|
||||
#define isset(a, i) ( ( (const uint8_t *)a )[(int)(i) / (int)(NBBY)]& (1 << ( (i) % NBBY ) ) )
|
||||
#define isclr(a, i) ( ( ( (const uint8_t *)a )[(int)(i) / (int)(NBBY)]& (1 << ( (i) % NBBY ) ) ) == 0 )
|
||||
|
||||
/******************************************************
|
||||
* Local Structures
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Static Variables
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Static Function Prototypes
|
||||
******************************************************/
|
||||
/* helper function for event messages ext API */
|
||||
static uint8_t *whd_management_alloc_event_msgs_buffer(whd_interface_t ifp, whd_buffer_t *buffer);
|
||||
static uint8_t whd_find_number_of_events(const whd_event_num_t *event_nums);
|
||||
|
||||
/******************************************************
|
||||
* Static Functions
|
||||
******************************************************/
|
||||
|
||||
static uint8_t whd_find_number_of_events(const whd_event_num_t *event_nums)
|
||||
{
|
||||
uint8_t count = 0;
|
||||
|
||||
while (*event_nums != WLC_E_NONE)
|
||||
{
|
||||
count++;
|
||||
event_nums++;
|
||||
|
||||
if (count >= WHD_MAX_EVENT_SUBSCRIPTION)
|
||||
return 0;
|
||||
}
|
||||
return count + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers locally a handler to receive event callbacks.
|
||||
* Does not notify Wi-Fi about event subscription change.
|
||||
* Can be used to refresh local callbacks (e.g. after deep-sleep)
|
||||
* if Wi-Fi is already notified about them.
|
||||
*
|
||||
* This function registers a callback handler to be notified when
|
||||
* a particular event is received.
|
||||
*
|
||||
* Alternately the function clears callbacks for given event type.
|
||||
*
|
||||
* @note : Currently each event may only be registered to one handler
|
||||
* and there is a limit to the number of simultaneously registered
|
||||
* events
|
||||
*
|
||||
* @param event_nums An array of event types that is to trigger the handler. The array must be terminated with a WLC_E_NONE event
|
||||
* See @ref whd_event_num_t for available events
|
||||
* @param handler_func A function pointer to the new handler callback,
|
||||
* or NULL if callbacks are to be disabled for the given event type
|
||||
* @param handler_user_data A pointer value which will be passed to the event handler function
|
||||
* at the time an event is triggered (NULL is allowed)
|
||||
* @param interface The interface to set the handler for.
|
||||
*
|
||||
* @return WHD result code
|
||||
*/
|
||||
whd_result_t whd_management_set_event_handler_locally(whd_interface_t ifp, const whd_event_num_t *event_nums,
|
||||
whd_event_handler_t handler_func,
|
||||
void *handler_user_data, uint16_t *event_index)
|
||||
{
|
||||
uint16_t entry = (uint16_t)0xFF;
|
||||
uint16_t i;
|
||||
whd_driver_t whd_driver = ifp->whd_driver;
|
||||
whd_cdc_bdc_info_t *cdc_bdc_info = &whd_driver->cdc_bdc_info;
|
||||
uint8_t num_of_events;
|
||||
num_of_events = whd_find_number_of_events(event_nums);
|
||||
|
||||
if (num_of_events <= 1)
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Exceeded the maximum event subscription/no event subscribed\n") );
|
||||
return WHD_UNFINISHED;
|
||||
}
|
||||
|
||||
/* Find an existing matching entry OR the next empty entry */
|
||||
for (i = 0; i < (uint16_t)WHD_EVENT_HANDLER_LIST_SIZE; i++)
|
||||
{
|
||||
/* Find a matching event list OR the first empty event entry */
|
||||
if (!(memcmp(cdc_bdc_info->whd_event_list[i].events, event_nums,
|
||||
num_of_events * (sizeof(whd_event_num_t) ) ) ) )
|
||||
{
|
||||
/* Check if all the data already matches */
|
||||
if ( (cdc_bdc_info->whd_event_list[i].handler == handler_func) &&
|
||||
(cdc_bdc_info->whd_event_list[i].handler_user_data == handler_user_data) &&
|
||||
(cdc_bdc_info->whd_event_list[i].ifidx == ifp->ifidx) )
|
||||
{
|
||||
/* send back the entry where the handler is added */
|
||||
*event_index = i;
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
}
|
||||
else if ( (entry == (uint16_t)0xFF) && (cdc_bdc_info->whd_event_list[i].event_set == WHD_FALSE) )
|
||||
{
|
||||
entry = i;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if handler function was provided */
|
||||
if (handler_func != NULL)
|
||||
{
|
||||
/* Check if an empty entry was not found */
|
||||
if (entry == (uint16_t)0xFF)
|
||||
{
|
||||
WPRINT_WHD_DEBUG( ("Out of space in event handlers table - try increasing WHD_EVENT_HANDLER_LIST_SIZE\n") );
|
||||
return WHD_OUT_OF_EVENT_HANDLER_SPACE;
|
||||
}
|
||||
|
||||
/* Add the new handler in at the free space */
|
||||
memcpy (cdc_bdc_info->whd_event_list[entry].events, event_nums, num_of_events * (sizeof(whd_event_num_t) ) );
|
||||
cdc_bdc_info->whd_event_list[entry].handler = handler_func;
|
||||
cdc_bdc_info->whd_event_list[entry].handler_user_data = handler_user_data;
|
||||
cdc_bdc_info->whd_event_list[entry].ifidx = ifp->ifidx;
|
||||
cdc_bdc_info->whd_event_list[entry].event_set = WHD_TRUE;
|
||||
|
||||
/* send back the entry where the handler is added */
|
||||
*event_index = entry;
|
||||
}
|
||||
else
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Event handler callback function is NULL/not provided to register\n") );
|
||||
return WHD_BADARG;
|
||||
}
|
||||
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
/* allocates memory for the needed iovar and returns a pointer to the event mask */
|
||||
static uint8_t *whd_management_alloc_event_msgs_buffer(whd_interface_t ifp, whd_buffer_t *buffer)
|
||||
{
|
||||
uint16_t i;
|
||||
uint16_t j;
|
||||
whd_bool_t use_extended_evt = WHD_FALSE;
|
||||
uint32_t max_event = 0;
|
||||
eventmsgs_ext_t *eventmsgs_ext_data = NULL;
|
||||
uint32_t *data = NULL;
|
||||
whd_driver_t whd_driver = ifp->whd_driver;
|
||||
whd_cdc_bdc_info_t *cdc_bdc_info = &whd_driver->cdc_bdc_info;
|
||||
|
||||
/* Check to see if event that's set requires more than 128 bit */
|
||||
for (i = 0; i < (uint16_t)WHD_EVENT_HANDLER_LIST_SIZE; i++)
|
||||
{
|
||||
if (cdc_bdc_info->whd_event_list[i].event_set)
|
||||
{
|
||||
for (j = 0; cdc_bdc_info->whd_event_list[i].events[j] != WLC_E_NONE; j++)
|
||||
{
|
||||
uint32_t event_value = cdc_bdc_info->whd_event_list[i].events[j];
|
||||
if (event_value > 127)
|
||||
{
|
||||
use_extended_evt = WHD_TRUE;
|
||||
if (event_value > max_event)
|
||||
{
|
||||
max_event = event_value;
|
||||
}
|
||||
/* keep going to get highest value */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (WHD_FALSE == use_extended_evt)
|
||||
{
|
||||
/* use old iovar for backwards compat */
|
||||
data = (uint32_t *)whd_cdc_get_iovar_buffer(whd_driver, buffer, (uint16_t)WL_EVENTING_MASK_LEN + 4,
|
||||
"bsscfg:" IOVAR_STR_EVENT_MSGS);
|
||||
|
||||
if (NULL == data)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data[0] = ifp->bsscfgidx;
|
||||
|
||||
return (uint8_t *)&data[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8_t mask_len = (uint8_t)( (max_event + 8) / 8 );
|
||||
data =
|
||||
(uint32_t *)whd_cdc_get_iovar_buffer(whd_driver, buffer,
|
||||
(uint16_t)(sizeof(eventmsgs_ext_t) + mask_len + 4),
|
||||
"bsscfg:" IOVAR_STR_EVENT_MSGS_EXT);
|
||||
|
||||
if (NULL == data)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data[0] = ifp->bsscfgidx;
|
||||
|
||||
eventmsgs_ext_data = (eventmsgs_ext_t *)&data[1];
|
||||
|
||||
memset(eventmsgs_ext_data, 0, sizeof(*eventmsgs_ext_data) );
|
||||
eventmsgs_ext_data->ver = EVENTMSGS_VER;
|
||||
eventmsgs_ext_data->command = EVENTMSGS_SET_MASK;
|
||||
eventmsgs_ext_data->len = mask_len;
|
||||
return eventmsgs_ext_data->mask;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a handler to receive event callbacks.
|
||||
* Subscribe locally and notify Wi-Fi about subscription.
|
||||
*
|
||||
* This function registers a callback handler to be notified when
|
||||
* a particular event is received.
|
||||
*
|
||||
* Alternately the function clears callbacks for given event type.
|
||||
*
|
||||
* @note : Currently each event may only be registered to one handler
|
||||
* and there is a limit to the number of simultaneously registered
|
||||
* events
|
||||
*
|
||||
* @param event_nums An array of event types that is to trigger the handler.
|
||||
* The array must be terminated with a WLC_E_NONE event
|
||||
* See @ref whd_event_num_t for available events
|
||||
* @param handler_func A function pointer to the new handler callback,
|
||||
* or NULL if callbacks are to be disabled for the given event type
|
||||
* @param handler_user_data A pointer value which will be passed to the event handler function
|
||||
* at the time an event is triggered (NULL is allowed)
|
||||
* @param interface The interface to set the handler for.
|
||||
*
|
||||
* @return WHD result code
|
||||
*/
|
||||
whd_result_t whd_management_set_event_handler(whd_interface_t ifp, const whd_event_num_t *event_nums,
|
||||
whd_event_handler_t handler_func,
|
||||
void *handler_user_data, uint16_t *event_index)
|
||||
{
|
||||
whd_buffer_t buffer;
|
||||
uint8_t *event_mask;
|
||||
uint16_t i;
|
||||
uint16_t j;
|
||||
whd_result_t res;
|
||||
whd_driver_t whd_driver;
|
||||
whd_cdc_bdc_info_t *cdc_bdc_info;
|
||||
whd_interface_t prim_ifp;
|
||||
|
||||
if (ifp == NULL)
|
||||
{
|
||||
return WHD_UNKNOWN_INTERFACE;
|
||||
}
|
||||
|
||||
if (!event_nums || !event_index)
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Event list to be registered is NULL/Event index is NULL") );
|
||||
return WHD_BADARG;
|
||||
}
|
||||
|
||||
whd_driver = ifp->whd_driver;
|
||||
cdc_bdc_info = &whd_driver->cdc_bdc_info;
|
||||
prim_ifp = whd_get_primary_interface(whd_driver);
|
||||
|
||||
if (prim_ifp == NULL)
|
||||
{
|
||||
return WHD_UNKNOWN_INTERFACE;
|
||||
}
|
||||
|
||||
/* Acquire mutex preventing multiple threads accessing the handler at the same time */
|
||||
res = cy_rtos_get_semaphore(&cdc_bdc_info->event_list_mutex, CY_RTOS_NEVER_TIMEOUT, WHD_FALSE);
|
||||
if (res != WHD_SUCCESS)
|
||||
{
|
||||
return res;
|
||||
}
|
||||
|
||||
/* Set event handler locally */
|
||||
res = whd_management_set_event_handler_locally(ifp, event_nums, handler_func, handler_user_data, event_index);
|
||||
if (res != WHD_SUCCESS)
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Error in setting event handler locally, %s failed at %d \n", __func__, __LINE__) );
|
||||
goto set_event_handler_exit;
|
||||
}
|
||||
|
||||
/* Send the new event mask value to the wifi chip */
|
||||
event_mask = whd_management_alloc_event_msgs_buffer(ifp, &buffer);
|
||||
|
||||
if (NULL == event_mask)
|
||||
{
|
||||
res = WHD_BUFFER_UNAVAILABLE_PERMANENT;
|
||||
WPRINT_WHD_ERROR( ("Buffer unavailable permanently, %s failed at %d \n", __func__, __LINE__) );
|
||||
goto set_event_handler_exit;
|
||||
}
|
||||
|
||||
/* Keep the wlan awake while we set the event_msgs */
|
||||
WHD_WLAN_KEEP_AWAKE(whd_driver);
|
||||
|
||||
/* Set the event bits for each event from every handler */
|
||||
memset(event_mask, 0, (size_t)WL_EVENTING_MASK_LEN);
|
||||
for (i = 0; i < (uint16_t)WHD_EVENT_HANDLER_LIST_SIZE; i++)
|
||||
{
|
||||
if (cdc_bdc_info->whd_event_list[i].event_set)
|
||||
{
|
||||
for (j = 0; cdc_bdc_info->whd_event_list[i].events[j] != WLC_E_NONE; j++)
|
||||
{
|
||||
setbit(event_mask, cdc_bdc_info->whd_event_list[i].events[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* set the event_list_mutex from calling thread before sending iovar
|
||||
* as the RX thread also waits on this Mutex when an ASYNC Event received
|
||||
* causing deadlock
|
||||
*/
|
||||
CHECK_RETURN(cy_rtos_set_semaphore(&cdc_bdc_info->event_list_mutex, WHD_FALSE) );
|
||||
|
||||
CHECK_RETURN(whd_cdc_send_iovar(prim_ifp, CDC_SET, buffer, 0) );
|
||||
|
||||
/* The wlan chip can sleep from now on */
|
||||
WHD_WLAN_LET_SLEEP(whd_driver);
|
||||
return WHD_SUCCESS;
|
||||
|
||||
set_event_handler_exit:
|
||||
CHECK_RETURN(cy_rtos_set_semaphore(&cdc_bdc_info->event_list_mutex, WHD_FALSE) );
|
||||
return res;
|
||||
}
|
||||
|
||||
whd_result_t whd_wifi_set_event_handler(whd_interface_t ifp, const uint32_t *event_type,
|
||||
whd_event_handler_t handler_func,
|
||||
void *handler_user_data, uint16_t *event_index)
|
||||
{
|
||||
whd_buffer_t buffer;
|
||||
uint8_t *event_mask;
|
||||
uint16_t i;
|
||||
uint16_t j;
|
||||
whd_result_t res;
|
||||
whd_driver_t whd_driver;
|
||||
whd_cdc_bdc_info_t *cdc_bdc_info;
|
||||
whd_interface_t prim_ifp;
|
||||
|
||||
if (ifp == NULL)
|
||||
{
|
||||
return WHD_UNKNOWN_INTERFACE;
|
||||
}
|
||||
|
||||
if (!event_type || !event_index)
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Event list to be registered is NULL/Event index is NULL") );
|
||||
return WHD_BADARG;
|
||||
}
|
||||
|
||||
whd_driver = ifp->whd_driver;
|
||||
cdc_bdc_info = &whd_driver->cdc_bdc_info;
|
||||
prim_ifp = whd_get_primary_interface(whd_driver);
|
||||
|
||||
if (prim_ifp == NULL)
|
||||
{
|
||||
return WHD_UNKNOWN_INTERFACE;
|
||||
}
|
||||
|
||||
/* Acquire mutex preventing multiple threads accessing the handler at the same time */
|
||||
res = cy_rtos_get_semaphore(&cdc_bdc_info->event_list_mutex, CY_RTOS_NEVER_TIMEOUT, WHD_FALSE);
|
||||
if (res != WHD_SUCCESS)
|
||||
{
|
||||
return res;
|
||||
}
|
||||
|
||||
/* Set event handler locally */
|
||||
res = whd_management_set_event_handler_locally(ifp, (whd_event_num_t *)event_type, handler_func, handler_user_data,
|
||||
event_index);
|
||||
if (res != WHD_SUCCESS)
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Error in setting event handler locally, %s failed at %d \n", __func__, __LINE__) );
|
||||
goto set_event_handler_exit;
|
||||
}
|
||||
|
||||
/* Send the new event mask value to the wifi chip */
|
||||
event_mask = whd_management_alloc_event_msgs_buffer(ifp, &buffer);
|
||||
|
||||
if (NULL == event_mask)
|
||||
{
|
||||
res = WHD_BUFFER_UNAVAILABLE_PERMANENT;
|
||||
WPRINT_WHD_ERROR( ("Buffer unavailable permanently, %s failed at %d \n", __func__, __LINE__) );
|
||||
goto set_event_handler_exit;
|
||||
}
|
||||
|
||||
/* Keep the wlan awake while we set the event_msgs */
|
||||
WHD_WLAN_KEEP_AWAKE(whd_driver);
|
||||
|
||||
/* Set the event bits for each event from every handler */
|
||||
memset(event_mask, 0, (size_t)WL_EVENTING_MASK_LEN);
|
||||
for (i = 0; i < (uint16_t)WHD_EVENT_HANDLER_LIST_SIZE; i++)
|
||||
{
|
||||
if (cdc_bdc_info->whd_event_list[i].event_set)
|
||||
{
|
||||
for (j = 0; cdc_bdc_info->whd_event_list[i].events[j] != WLC_E_NONE; j++)
|
||||
{
|
||||
setbit(event_mask, cdc_bdc_info->whd_event_list[i].events[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* set the event_list_mutex from calling thread before sending iovar
|
||||
* as the RX thread also waits on this Mutex when an ASYNC Event received
|
||||
* causing deadlock
|
||||
*/
|
||||
CHECK_RETURN(cy_rtos_set_semaphore(&cdc_bdc_info->event_list_mutex, WHD_FALSE) );
|
||||
|
||||
CHECK_RETURN(whd_cdc_send_iovar(prim_ifp, CDC_SET, buffer, 0) );
|
||||
|
||||
/* The wlan chip can sleep from now on */
|
||||
WHD_WLAN_LET_SLEEP(whd_driver);
|
||||
return WHD_SUCCESS;
|
||||
|
||||
set_event_handler_exit:
|
||||
CHECK_RETURN(cy_rtos_set_semaphore(&cdc_bdc_info->event_list_mutex, WHD_FALSE) );
|
||||
return res;
|
||||
}
|
||||
|
||||
uint32_t whd_wifi_deregister_event_handler(whd_interface_t ifp, uint16_t event_index)
|
||||
{
|
||||
whd_driver_t whd_driver;
|
||||
whd_cdc_bdc_info_t *cdc_bdc_info;
|
||||
|
||||
if (ifp == NULL)
|
||||
{
|
||||
return WHD_UNKNOWN_INTERFACE;
|
||||
}
|
||||
|
||||
whd_driver = ifp->whd_driver;
|
||||
cdc_bdc_info = &whd_driver->cdc_bdc_info;
|
||||
|
||||
if (event_index < WHD_EVENT_HANDLER_LIST_SIZE)
|
||||
{
|
||||
memset(cdc_bdc_info->whd_event_list[event_index].events, 0xFF,
|
||||
(sizeof(cdc_bdc_info->whd_event_list[event_index].events) ) );
|
||||
cdc_bdc_info->whd_event_list[event_index].handler = NULL;
|
||||
cdc_bdc_info->whd_event_list[event_index].handler_user_data = NULL;
|
||||
cdc_bdc_info->whd_event_list[event_index].event_set = WHD_FALSE;
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
if (event_index == 0xFF)
|
||||
{
|
||||
WPRINT_WHD_INFO( ("Event handler not registered \n") );
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
WPRINT_WHD_DEBUG( ("Invalid event index received to deregister the event handler \n") );
|
||||
return WHD_BADARG;
|
||||
}
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include "whd_debug.h"
|
||||
|
||||
#ifdef WHD_LOGGING_BUFFER_ENABLE
|
||||
|
||||
#ifndef LOGGING_BUFFER_SIZE
|
||||
#error LOGGING_BUFFER_SIZE is not defined
|
||||
#endif /* LOGGING_BUFFER_SIZE */
|
||||
whd_logging_t logbuf;
|
||||
|
||||
int whd_buffer_printf(const char *format, ...)
|
||||
{
|
||||
int potential_num_written = 0;
|
||||
va_list args;
|
||||
va_start (args, format);
|
||||
|
||||
potential_num_written = vsnprintf (&(logbuf.buffer[logbuf.buffer_write]),
|
||||
(size_t)(LOGGING_BUFFER_SIZE - (logbuf.buffer_write) ) + 1, format, args);
|
||||
|
||||
if (potential_num_written > (int)(LOGGING_BUFFER_SIZE - (logbuf.buffer_write) ) )
|
||||
{
|
||||
/* full print did not fit in buffer - wipe what was just written
|
||||
and reprint at start of buffer
|
||||
*/
|
||||
memset(&(logbuf.buffer[logbuf.buffer_write]), 0xf, (size_t)(LOGGING_BUFFER_SIZE - (logbuf.buffer_write) ) );
|
||||
|
||||
logbuf.buffer_write = 0;
|
||||
potential_num_written = vsnprintf (&(logbuf.buffer[logbuf.buffer_write]),
|
||||
(size_t)(LOGGING_BUFFER_SIZE - (logbuf.buffer_write) ) + 1, format, args);
|
||||
|
||||
logbuf.buffer_write += (unsigned)potential_num_written;
|
||||
logbuf.buffer_write %= LOGGING_BUFFER_SIZE;
|
||||
|
||||
if (logbuf.roll_over)
|
||||
logbuf.over_write = WHD_TRUE;
|
||||
|
||||
logbuf.roll_over = WHD_TRUE;
|
||||
|
||||
if ( (logbuf.roll_over) && (logbuf.buffer_read < (logbuf.buffer_write) ) )
|
||||
{
|
||||
logbuf.buffer_read = logbuf.buffer_write;
|
||||
}
|
||||
if (logbuf.over_write && (logbuf.buffer_read != (logbuf.buffer_write) ) )
|
||||
{
|
||||
logbuf.buffer_read = (logbuf.buffer_write);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logbuf.buffer_write += (unsigned)potential_num_written;
|
||||
|
||||
if ( (logbuf.buffer_write) >= LOGGING_BUFFER_SIZE )
|
||||
{
|
||||
logbuf.buffer_write %= LOGGING_BUFFER_SIZE;
|
||||
|
||||
if (logbuf.roll_over)
|
||||
logbuf.over_write = WHD_TRUE;
|
||||
|
||||
logbuf.roll_over = WHD_TRUE;
|
||||
}
|
||||
|
||||
if (logbuf.roll_over && (logbuf.buffer_read < logbuf.buffer_write) )
|
||||
{
|
||||
logbuf.buffer_read = logbuf.buffer_write;
|
||||
}
|
||||
if (logbuf.over_write && (logbuf.buffer_read != logbuf.buffer_write) )
|
||||
{
|
||||
logbuf.buffer_read = logbuf.buffer_write;
|
||||
}
|
||||
}
|
||||
|
||||
va_end (args);
|
||||
return potential_num_written;
|
||||
}
|
||||
|
||||
void whd_print_logbuffer(void)
|
||||
{
|
||||
while (logbuf.roll_over || logbuf.over_write || (logbuf.buffer_read != logbuf.buffer_write) )
|
||||
{
|
||||
logbuf.roll_over = logbuf.over_write = WHD_FALSE;
|
||||
|
||||
while (logbuf.buffer[logbuf.buffer_read] == 0xf)
|
||||
{
|
||||
logbuf.buffer_read = (logbuf.buffer_read + 1) % LOGGING_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
putchar(logbuf.buffer[logbuf.buffer_read]);
|
||||
logbuf.buffer_read = (logbuf.buffer_read + 1) % LOGGING_BUFFER_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* ifdef WHD_LOGGING_BUFFER_ENABLE */
|
||||
|
|
@ -0,0 +1,454 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* Implements initialisation and other management functions for WHD system
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "bus_protocols/whd_bus_common.h"
|
||||
#include "bus_protocols/whd_bus_protocol_interface.h"
|
||||
#include "whd_debug.h"
|
||||
#include "whd_events_int.h"
|
||||
#include "whd_int.h"
|
||||
#include "whd_chip.h"
|
||||
#include "whd_sdpcm.h"
|
||||
#include "whd_wifi_api.h"
|
||||
#include "whd_clm.h"
|
||||
#include "whd_wlioctl.h"
|
||||
#include "whd_types_int.h"
|
||||
|
||||
/******************************************************
|
||||
* Constants
|
||||
******************************************************/
|
||||
|
||||
#define MAX_POST_SET_COUNTRY_RETRY 3
|
||||
|
||||
#define MINIMUM_WHD_STACK_SIZE (1024 + 1200 + 2500)
|
||||
|
||||
/******************************************************
|
||||
* Static Variables
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Function definitions
|
||||
******************************************************/
|
||||
whd_result_t whd_management_wifi_platform_init(whd_driver_t whd_driver, whd_country_code_t country,
|
||||
whd_bool_t resume_after_deep_sleep);
|
||||
void whd_wifi_bus_irq_handle(void *handler_arg, uint32_t event);
|
||||
|
||||
whd_interface_t whd_get_primary_interface(whd_driver_t whd_driver)
|
||||
{
|
||||
if (whd_driver->iflist[0] != NULL)
|
||||
{
|
||||
return whd_driver->iflist[0];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
whd_result_t whd_add_interface(whd_driver_t whd_driver, uint8_t bsscfgidx, uint8_t ifidx,
|
||||
const char *name, whd_mac_t *mac_addr, whd_interface_t *ifpp)
|
||||
{
|
||||
whd_interface_t ifp;
|
||||
|
||||
if (bsscfgidx < WHD_INTERFACE_MAX)
|
||||
{
|
||||
if (whd_driver->iflist[bsscfgidx] != NULL)
|
||||
{
|
||||
*ifpp = whd_driver->iflist[bsscfgidx];
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
if ( (ifp = (whd_interface_t)malloc(sizeof(struct whd_interface) ) ) != NULL )
|
||||
{
|
||||
memset(ifp, 0, (sizeof(struct whd_interface) ) );
|
||||
*ifpp = ifp;
|
||||
ifp->whd_driver = whd_driver;
|
||||
|
||||
/* Add a interface name */
|
||||
/* strncpy doesn't terminate with null if the src string is long */
|
||||
ifp->if_name[WHD_MSG_IFNAME_MAX - 1] = '\0';
|
||||
strncpy(ifp->if_name, name, sizeof(ifp->if_name) - 1);
|
||||
memset(ifp->event_reg_list, WHD_EVENT_NOT_REGISTERED, sizeof(ifp->event_reg_list) );
|
||||
/* Primary interface takes 0 as default */
|
||||
ifp->ifidx = ifidx;
|
||||
ifp->bsscfgidx = bsscfgidx;
|
||||
|
||||
if (mac_addr != NULL)
|
||||
memcpy(ifp->mac_addr.octet, mac_addr->octet, sizeof(whd_mac_t) );
|
||||
else
|
||||
memset(ifp->mac_addr.octet, 0, sizeof(whd_mac_t) );
|
||||
|
||||
whd_driver->iflist[bsscfgidx] = ifp;
|
||||
whd_driver->if2ifp[ifidx] = bsscfgidx;
|
||||
}
|
||||
else
|
||||
{
|
||||
return WHD_MALLOC_FAILURE;
|
||||
}
|
||||
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
return WHD_INVALID_INTERFACE;
|
||||
}
|
||||
|
||||
whd_result_t whd_add_primary_interface(whd_driver_t whd_driver, whd_interface_t *ifpp)
|
||||
{
|
||||
return whd_add_interface(whd_driver, 0, 0, "wlan0", NULL, ifpp);
|
||||
}
|
||||
|
||||
uint32_t whd_add_secondary_interface(whd_driver_t whd_driver, whd_mac_t *mac_addr, whd_interface_t *ifpp)
|
||||
{
|
||||
return whd_add_interface(whd_driver, 1, 1, "wlan1", mac_addr, ifpp);
|
||||
}
|
||||
|
||||
uint32_t whd_init(whd_driver_t *whd_driver_ptr, whd_init_config_t *whd_init_config,
|
||||
whd_resource_source_t *resource_ops, whd_buffer_funcs_t *buffer_ops,
|
||||
whd_netif_funcs_t *network_ops)
|
||||
{
|
||||
whd_driver_t whd_drv;
|
||||
if (whd_init_config->thread_stack_size < MINIMUM_WHD_STACK_SIZE)
|
||||
{
|
||||
WPRINT_WHD_INFO( ("Stack size is less than minimum stack size required.\n") );
|
||||
return WHD_WLAN_BUFTOOSHORT;
|
||||
}
|
||||
if (!buffer_ops || !network_ops || !resource_ops)
|
||||
{
|
||||
WPRINT_WHD_INFO( ("Function pointers not provided .\n") );
|
||||
return WHD_WLAN_NOFUNCTION;
|
||||
}
|
||||
|
||||
if ( (whd_drv = (whd_driver_t)malloc(sizeof(struct whd_driver) ) ) != NULL )
|
||||
{
|
||||
memset(whd_drv, 0, sizeof(struct whd_driver) );
|
||||
*whd_driver_ptr = whd_drv;
|
||||
whd_drv->buffer_if = buffer_ops;
|
||||
whd_drv->network_if = network_ops;
|
||||
whd_drv->resource_if = resource_ops;
|
||||
whd_bus_common_info_init(whd_drv);
|
||||
whd_thread_info_init(whd_drv, whd_init_config);
|
||||
whd_cdc_bdc_info_init(whd_drv);
|
||||
whd_internal_info_init(whd_drv);
|
||||
whd_ap_info_init(whd_drv);
|
||||
//whd_wifi_sleep_info_init(whd_drv);
|
||||
whd_wifi_chip_info_init(whd_drv);
|
||||
|
||||
whd_drv->bus_gspi_32bit = WHD_FALSE;
|
||||
|
||||
if (whd_init_config->country == 0)
|
||||
whd_drv->country = WHD_COUNTRY_UNITED_STATES;
|
||||
else
|
||||
whd_drv->country = whd_init_config->country;
|
||||
}
|
||||
else
|
||||
{
|
||||
return WHD_MALLOC_FAILURE;
|
||||
}
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
uint32_t whd_deinit(whd_interface_t ifp)
|
||||
{
|
||||
uint8_t i;
|
||||
whd_driver_t whd_driver = ifp->whd_driver;
|
||||
|
||||
if (whd_driver->internal_info.whd_wlan_status.state != WLAN_UP)
|
||||
{
|
||||
WPRINT_WHD_INFO( ("wlan_status: already down.\n") );
|
||||
return WHD_INTERFACE_NOT_UP;
|
||||
}
|
||||
|
||||
/* Send DOWN command */
|
||||
CHECK_RETURN(whd_wifi_set_ioctl_buffer(ifp, WLC_DOWN, NULL, 0) );
|
||||
|
||||
/* Update wlan status */
|
||||
whd_driver->internal_info.whd_wlan_status.state = WLAN_DOWN;
|
||||
|
||||
for (i = 0; i < WHD_INTERFACE_MAX; i++)
|
||||
{
|
||||
if (whd_driver->iflist[i] != NULL)
|
||||
{
|
||||
free(whd_driver->iflist[i]);
|
||||
}
|
||||
}
|
||||
|
||||
free(whd_driver);
|
||||
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize Wi-Fi platform
|
||||
*
|
||||
* - Initializes the required parts of the hardware platform
|
||||
* i.e. pins for SDIO/SPI, interrupt, reset, power etc.
|
||||
*
|
||||
* - Initializes the WHD thread which arbitrates access
|
||||
* to the SDIO/SPI bus
|
||||
*
|
||||
* @return WHD_SUCCESS if initialization is successful, error code otherwise
|
||||
*/
|
||||
|
||||
whd_result_t whd_management_wifi_platform_init(whd_driver_t whd_driver, whd_country_code_t country,
|
||||
whd_bool_t resume_after_deep_sleep)
|
||||
{
|
||||
whd_result_t retval;
|
||||
|
||||
whd_driver->internal_info.whd_wlan_status.country_code = country;
|
||||
|
||||
if (resume_after_deep_sleep == WHD_TRUE)
|
||||
{
|
||||
retval = ( whd_result_t )whd_bus_resume_after_deep_sleep(whd_driver);
|
||||
}
|
||||
else
|
||||
{
|
||||
whd_bus_init_stats(whd_driver);
|
||||
retval = ( whd_result_t )whd_bus_init(whd_driver);
|
||||
}
|
||||
|
||||
if (retval != WHD_SUCCESS)
|
||||
{
|
||||
/* May have been due to user abort */
|
||||
WPRINT_WHD_INFO( ("Could not initialize bus\n") );
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* WLAN device is now powered up. Change state from OFF to DOWN */
|
||||
whd_driver->internal_info.whd_wlan_status.state = WLAN_DOWN;
|
||||
|
||||
|
||||
retval = whd_thread_init(whd_driver);
|
||||
if (retval != WHD_SUCCESS)
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Could not initialize WHD thread\n") );
|
||||
return retval;
|
||||
}
|
||||
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn on the Wi-Fi device
|
||||
*
|
||||
* - Initialize Wi-Fi device
|
||||
*
|
||||
* - Program various WiFi parameters and modes
|
||||
*
|
||||
* @return WHD_SUCCESS if initialization is successful, error code otherwise
|
||||
*/
|
||||
uint32_t whd_wifi_on(whd_driver_t whd_driver, whd_interface_t *ifpp)
|
||||
{
|
||||
wl_country_t *country_struct;
|
||||
uint32_t *ptr;
|
||||
whd_result_t retval;
|
||||
whd_buffer_t buffer;
|
||||
uint8_t *event_mask;
|
||||
uint32_t *data;
|
||||
uint32_t counter;
|
||||
whd_interface_t ifp;
|
||||
|
||||
if (whd_driver->internal_info.whd_wlan_status.state == WLAN_UP)
|
||||
{
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
whd_init_stats(whd_driver);
|
||||
|
||||
|
||||
retval = whd_management_wifi_platform_init(whd_driver, whd_driver->country, WHD_FALSE);
|
||||
if (retval != WHD_SUCCESS)
|
||||
{
|
||||
WPRINT_WHD_INFO( ("Could not initialize wifi platform\n") );
|
||||
return retval;
|
||||
}
|
||||
|
||||
whd_add_primary_interface(whd_driver, ifpp);
|
||||
ifp = *ifpp;
|
||||
|
||||
/* Download blob file if exists */
|
||||
retval = whd_process_clm_data(ifp);
|
||||
if (retval != WHD_SUCCESS)
|
||||
{
|
||||
WPRINT_MACRO( ("****************************************************\n"
|
||||
"** ERROR: WLAN: could not download clm_blob file\n"
|
||||
"** FATAL ERROR: system unusable, CLM blob file not found or corrupted.\n"
|
||||
"****************************************************\n") );
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Turn off SDPCM TX Glomming */
|
||||
/* Note: This is only required for later chips.
|
||||
* The 4319 has glomming off by default however the 43362 has it on by default.
|
||||
*/
|
||||
data = (uint32_t *)whd_cdc_get_iovar_buffer(whd_driver, &buffer, (uint16_t)4, IOVAR_STR_TX_GLOM);
|
||||
if (data == NULL)
|
||||
{
|
||||
whd_assert("Could not get buffer for IOVAR", 0 != 0);
|
||||
return WHD_BUFFER_ALLOC_FAIL;
|
||||
}
|
||||
*data = 0;
|
||||
retval = whd_cdc_send_iovar(ifp, CDC_SET, buffer, 0);
|
||||
if ( (retval != WHD_SUCCESS) && (retval != WHD_WLAN_UNSUPPORTED) )
|
||||
{
|
||||
/* Note: System may time out here if bus interrupts are not working properly */
|
||||
WPRINT_WHD_ERROR( ("Could not turn off TX glomming\n") );
|
||||
return retval;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Turn APSTA on */
|
||||
data = (uint32_t *)whd_cdc_get_iovar_buffer(whd_driver, &buffer, (uint16_t)sizeof(*data), IOVAR_STR_APSTA);
|
||||
if (data == NULL)
|
||||
{
|
||||
whd_assert("Could not get buffer for IOVAR", 0 != 0);
|
||||
return WHD_BUFFER_ALLOC_FAIL;
|
||||
}
|
||||
*data = htod32( (uint32_t)1 );
|
||||
/* This will fail on manufacturing test build since it does not have APSTA available */
|
||||
retval = whd_cdc_send_iovar(ifp, CDC_SET, buffer, 0);
|
||||
if ( (retval != WHD_SUCCESS) && (retval != WHD_WLAN_UNSUPPORTED) )
|
||||
{
|
||||
/* Could not turn on APSTA */
|
||||
WPRINT_WHD_DEBUG( ("Could not turn on APSTA\n") );
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Send set country command */
|
||||
/* This is the first time that the WLAN chip is required to respond
|
||||
* in it's normal run mode.
|
||||
* If you are porting a new system and it stalls here, it could
|
||||
* be one of the following problems:
|
||||
* - Bus interrupt not triggering properly - the WLAN chip is unable to signal the host that there is data available.
|
||||
* - Timing problems - if the timeouts on semaphores are not working correctly, then the
|
||||
* system might think that the IOCTL has timed out much faster than it should do.
|
||||
*
|
||||
*/
|
||||
|
||||
country_struct = (wl_country_t *)whd_cdc_get_iovar_buffer(whd_driver, &buffer, (uint16_t)sizeof(wl_country_t),
|
||||
IOVAR_STR_COUNTRY);
|
||||
if (country_struct == NULL)
|
||||
{
|
||||
whd_assert("Could not get buffer for IOCTL", 0 != 0);
|
||||
return WHD_BUFFER_ALLOC_FAIL;
|
||||
}
|
||||
memset(country_struct, 0, sizeof(wl_country_t) );
|
||||
|
||||
ptr = (uint32_t *)country_struct->ccode;
|
||||
*ptr = (uint32_t)whd_driver->internal_info.whd_wlan_status.country_code & 0x0000ffff;
|
||||
ptr = (uint32_t *)country_struct->country_abbrev;
|
||||
*ptr = (uint32_t)whd_driver->internal_info.whd_wlan_status.country_code & 0x0000ffff;
|
||||
country_struct->rev = (int32_t)( (whd_driver->internal_info.whd_wlan_status.country_code & 0xffff0000) >> 16 );
|
||||
|
||||
/* if regrev is 0 then set regrev to -1 so the FW will use any NVRAM/OTP configured aggregate
|
||||
* to choose the regrev. If there is no aggregate configured then the FW will try to use regrev 0.
|
||||
*/
|
||||
if (country_struct->rev == 0)
|
||||
{
|
||||
country_struct->rev = (int32_t)htod32(-1);
|
||||
}
|
||||
retval = whd_cdc_send_iovar(ifp, CDC_SET, buffer, 0);
|
||||
if (retval != WHD_SUCCESS)
|
||||
{
|
||||
/* Could not set wifi country */
|
||||
WPRINT_WHD_ERROR( ("Could not set Country code\n") );
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* NOTE: The set country command requires time to process on the WLAN firmware and
|
||||
* the following IOCTL may fail on initial attempts therefore we try a few times */
|
||||
|
||||
/* Set the event mask, indicating initially we do not want any asynchronous events */
|
||||
for (counter = 0, retval = WHD_PENDING; retval != WHD_SUCCESS && counter < (uint32_t)MAX_POST_SET_COUNTRY_RETRY;
|
||||
++counter)
|
||||
{
|
||||
event_mask = (uint8_t *)whd_cdc_get_iovar_buffer(whd_driver, &buffer, (uint16_t)WL_EVENTING_MASK_LEN,
|
||||
IOVAR_STR_EVENT_MSGS);
|
||||
if (event_mask == NULL)
|
||||
{
|
||||
whd_assert("Could not get buffer for IOVAR", 0 != 0);
|
||||
return WHD_BUFFER_ALLOC_FAIL;
|
||||
}
|
||||
memset(event_mask, 0, (size_t)WL_EVENTING_MASK_LEN);
|
||||
retval = whd_cdc_send_iovar(ifp, CDC_SET, buffer, 0);
|
||||
}
|
||||
if (retval != WHD_SUCCESS)
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Could not set Event mask\n") );
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Send UP command */
|
||||
CHECK_RETURN(whd_wifi_set_up(ifp) );
|
||||
|
||||
whd_wifi_enable_powersave_with_throughput(ifp, 0);
|
||||
/* Set the GMode */
|
||||
data = (uint32_t *)whd_cdc_get_ioctl_buffer(whd_driver, &buffer, (uint16_t)4);
|
||||
if (data == NULL)
|
||||
{
|
||||
whd_assert("Could not get buffer for IOCTL", 0 != 0);
|
||||
return WHD_BUFFER_ALLOC_FAIL;
|
||||
}
|
||||
*data = htod32( (uint32_t)GMODE_AUTO );
|
||||
retval = whd_cdc_send_ioctl(ifp, CDC_SET, WLC_SET_GMODE, buffer, 0);
|
||||
if (retval != WHD_SUCCESS)
|
||||
{
|
||||
/* Note: System may time out here if bus interrupts are not working properly */
|
||||
WPRINT_WHD_ERROR( ("Error setting gmode\n") );
|
||||
return retval;
|
||||
}
|
||||
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn off the Wi-Fi device
|
||||
*
|
||||
* - De-Initialises the required parts of the hardware platform
|
||||
* i.e. pins for SDIO/SPI, interrupt, reset, power etc.
|
||||
*
|
||||
* - De-Initialises the WHD thread which arbitrates access
|
||||
* to the SDIO/SPI bus
|
||||
*
|
||||
* @return WHD_SUCCESS if deinitialization is successful, error code otherwise
|
||||
*/
|
||||
uint32_t whd_wifi_off(whd_interface_t ifp)
|
||||
{
|
||||
whd_result_t retval;
|
||||
whd_driver_t whd_driver = ifp->whd_driver;
|
||||
|
||||
if (whd_driver->internal_info.whd_wlan_status.state == WLAN_OFF)
|
||||
{
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
/* Disable SDIO/SPI interrupt */
|
||||
whd_bus_irq_enable(whd_driver, WHD_FALSE);
|
||||
whd_thread_quit(whd_driver);
|
||||
|
||||
retval = whd_bus_deinit(whd_driver);
|
||||
if (retval != WHD_SUCCESS)
|
||||
{
|
||||
WPRINT_WHD_DEBUG( ("Error de-initializing bus\n") );
|
||||
return retval;
|
||||
}
|
||||
|
||||
whd_driver->internal_info.whd_wlan_status.state = WLAN_OFF;
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* Provides generic APSTA functionality that chip specific files use
|
||||
*/
|
||||
|
||||
#include "whd_debug.h"
|
||||
#include "whd_network_if.h"
|
||||
|
||||
/******************************************************
|
||||
* * @cond Constants
|
||||
* ******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* * Enumerations
|
||||
* ******************************************************/
|
||||
|
||||
/******************************************************
|
||||
** Function Declarations
|
||||
*******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Variables Definitions
|
||||
*****************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Function Definitions
|
||||
******************************************************/
|
||||
/** Called by WHD to pass received data to the network stack
|
||||
*
|
||||
*
|
||||
* Packets received from the Wi-Fi network by WHD are forwarded to by calling function ptr which
|
||||
* must be implemented in the network interface. Ethernet headers
|
||||
* are present at the start of these packet buffers.
|
||||
*
|
||||
* This function is called asynchronously in the context of the
|
||||
* WHD thread whenever new data has arrived.
|
||||
* Packet buffers are allocated within WHD, and ownership is transferred
|
||||
* to the network stack. The network stack or application is thus
|
||||
* responsible for releasing the packet buffers.
|
||||
* Most packet buffering systems have a pointer to the 'current point' within
|
||||
* the packet buffer. When this function is called, the pointer points
|
||||
* to the start of the Ethernet header. There is other inconsequential data
|
||||
* before the Ethernet header.
|
||||
*
|
||||
* It is preferable that the (whd_network_process_ethernet_data)() function simply puts
|
||||
* the received packet on a queue for processing by another thread. This avoids the
|
||||
* WHD thread being unnecessarily tied up which would delay other packets
|
||||
* being transmitted or received.
|
||||
*
|
||||
* @param interface : The interface on which the packet was received.
|
||||
* @param buffer : Handle of the packet which has just been received. Responsibility for
|
||||
* releasing this buffer is transferred from WHD at this point.
|
||||
*
|
||||
*/
|
||||
whd_result_t whd_network_process_ethernet_data(whd_interface_t ifp, whd_buffer_t buffer)
|
||||
{
|
||||
whd_driver_t whd_driver = ifp->whd_driver;
|
||||
if (whd_driver->network_if->whd_network_process_ethernet_data)
|
||||
{
|
||||
whd_driver->network_if->whd_network_process_ethernet_data(ifp, buffer);
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
WPRINT_WHD_INFO( ("Function pointers not provided .\n") );
|
||||
}
|
||||
return WHD_WLAN_NOFUNCTION;
|
||||
}
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* Provides generic APSTA functionality that chip specific files use
|
||||
*/
|
||||
|
||||
#include "whd_debug.h"
|
||||
#include "whd_int.h"
|
||||
#include "whd_resource_if.h"
|
||||
|
||||
/******************************************************
|
||||
* * @cond Constants
|
||||
* ******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* * Enumerations
|
||||
* ******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* * Function Declarations
|
||||
* ******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Variables Definitions
|
||||
*****************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Function Definitions
|
||||
******************************************************/
|
||||
uint32_t whd_resource_size(whd_driver_t whd_driver, whd_resource_type_t resource, uint32_t *size_out)
|
||||
{
|
||||
if (whd_driver->resource_if->whd_resource_size)
|
||||
{
|
||||
return whd_driver->resource_if->whd_resource_size(whd_driver, resource, size_out);
|
||||
}
|
||||
else
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Function pointers not provided .\n") );
|
||||
}
|
||||
|
||||
return WHD_WLAN_NOFUNCTION;
|
||||
}
|
||||
|
||||
uint32_t whd_get_resource_block_size(whd_driver_t whd_driver, whd_resource_type_t type, uint32_t *size_out)
|
||||
{
|
||||
|
||||
if (whd_driver->resource_if->whd_get_resource_block_size)
|
||||
{
|
||||
return whd_driver->resource_if->whd_get_resource_block_size(whd_driver, type, size_out);
|
||||
}
|
||||
else
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Function pointers not provided .\n") );
|
||||
}
|
||||
|
||||
return WHD_WLAN_NOFUNCTION;
|
||||
}
|
||||
|
||||
uint32_t whd_get_resource_no_of_blocks(whd_driver_t whd_driver, whd_resource_type_t type, uint32_t *block_count)
|
||||
{
|
||||
if (whd_driver->resource_if->whd_get_resource_no_of_blocks)
|
||||
{
|
||||
return whd_driver->resource_if->whd_get_resource_no_of_blocks(whd_driver, type, block_count);
|
||||
}
|
||||
else
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Function pointers not provided .\n") );
|
||||
}
|
||||
|
||||
return WHD_WLAN_NOFUNCTION;
|
||||
}
|
||||
|
||||
uint32_t whd_get_resource_block(whd_driver_t whd_driver, whd_resource_type_t type, const uint8_t **data,
|
||||
uint32_t *size_out)
|
||||
{
|
||||
|
||||
if (whd_driver->resource_if->whd_get_resource_block)
|
||||
{
|
||||
return whd_driver->resource_if->whd_get_resource_block(whd_driver, type, data, size_out);
|
||||
}
|
||||
else
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Function pointers not provided .\n") );
|
||||
}
|
||||
|
||||
return WHD_WLAN_NOFUNCTION;
|
||||
}
|
||||
|
|
@ -0,0 +1,628 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* Provides an implementation of the Broadcom SDPCM protocol.
|
||||
* The Broadcom SDPCM protocol provides multiplexing of Wireless Data frames,
|
||||
* I/O Control functions (IOCTL), and Asynchronous Event signalling.
|
||||
* It is required when communicating with Broadcom 802.11 devices.
|
||||
*
|
||||
*/
|
||||
#include "whd_sdpcm.h"
|
||||
#include "bus_protocols/whd_bus_protocol_interface.h"
|
||||
#include "whd_endian.h"
|
||||
#include "whd_chip_constants.h"
|
||||
#include "whd_chip.h"
|
||||
#include "whd_thread_internal.h"
|
||||
#include "whd_debug.h"
|
||||
#include "whd_events_int.h"
|
||||
#include "whd_wifi_api.h"
|
||||
#include "whd_buffer_api.h"
|
||||
#include "whd_network_if.h"
|
||||
#include "whd_wlioctl.h"
|
||||
#include "whd_types_int.h"
|
||||
#include "whd_endian.h"
|
||||
|
||||
/******************************************************
|
||||
* @cond Constants
|
||||
******************************************************/
|
||||
|
||||
#define ETHER_TYPE_BRCM (0x886C) /** Broadcom Ethertype for identifying event packets - Copied from DHD include/proto/ethernet.h */
|
||||
#define BRCM_OUI "\x00\x10\x18" /** Broadcom OUI (Organizationally Unique Identifier): Used in the proprietary(221) IE (Information Element) in all Broadcom devices */
|
||||
#define BCM_MSG_IFNAME_MAX (16) /** Maximum length of an interface name in a wl_event_msg_t structure*/
|
||||
|
||||
#define BDC_FLAG2_IF_MASK (0x0f)
|
||||
|
||||
#define SDPCM_HEADER_LEN (12)
|
||||
|
||||
/* Event flags */
|
||||
#define WLC_EVENT_MSG_LINK (0x01) /** link is up */
|
||||
#define WLC_EVENT_MSG_FLUSHTXQ (0x02) /** flush tx queue on MIC error */
|
||||
#define WLC_EVENT_MSG_GROUP (0x04) /** group MIC error */
|
||||
#define WLC_EVENT_MSG_UNKBSS (0x08) /** unknown source bsscfg */
|
||||
#define WLC_EVENT_MSG_UNKIF (0x10) /** unknown source OS i/f */
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* Local Structures
|
||||
******************************************************/
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
/*TODO: Keep this typedef? (in preference to the defines above */
|
||||
#if 0
|
||||
typedef struct
|
||||
{
|
||||
uint16_t control_id;
|
||||
uint8_t interface_index : 4;
|
||||
uint16_t reserved : 10;
|
||||
uint8_t set : 1;
|
||||
uint8_t error : 1;
|
||||
}sdpcm_cdc_flags_t;
|
||||
#endif /* if 0 */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t sequence;
|
||||
uint8_t channel_and_flags;
|
||||
uint8_t next_length;
|
||||
uint8_t header_length;
|
||||
uint8_t wireless_flow_control;
|
||||
uint8_t bus_data_credit;
|
||||
uint8_t _reserved[2];
|
||||
} sdpcm_sw_header_t;
|
||||
|
||||
/*
|
||||
* SDPCM header definitions
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint16_t frametag[2];
|
||||
sdpcm_sw_header_t sw_header;
|
||||
} sdpcm_header_t;
|
||||
|
||||
typedef struct bcmeth_hdr
|
||||
{
|
||||
uint16_t subtype; /** Vendor specific..32769 */
|
||||
uint16_t length;
|
||||
uint8_t version; /** Version is 0 */
|
||||
uint8_t oui[3]; /** Broadcom OUI */
|
||||
uint16_t usr_subtype; /** user specific Data */
|
||||
} sdpcm_bcmeth_header_t;
|
||||
|
||||
/* these fields are stored in network order */
|
||||
typedef struct
|
||||
{
|
||||
|
||||
uint16_t version; /** Version 1 has fields up to ifname.
|
||||
* Version 2 has all fields including ifidx and bss_cfg_idx */
|
||||
uint16_t flags; /** see flags */
|
||||
uint32_t event_type; /** Message */
|
||||
uint32_t status; /** Status code */
|
||||
uint32_t reason; /** Reason code (if applicable) */
|
||||
uint32_t auth_type; /** WLC_E_AUTH */
|
||||
uint32_t datalen; /** data buf */
|
||||
whd_mac_t addr; /** Station address (if applicable) */
|
||||
char ifname[BCM_MSG_IFNAME_MAX]; /** name of the packet incoming interface */
|
||||
uint8_t ifidx; /** destination OS i/f index */
|
||||
uint8_t bss_cfg_idx; /** source bsscfg index */
|
||||
} sdpcm_raw_event_header_t;
|
||||
|
||||
/* used by driver msgs */
|
||||
typedef struct bcm_event
|
||||
{
|
||||
ethernet_header_t ether;
|
||||
sdpcm_bcmeth_header_t bcmeth;
|
||||
union
|
||||
{
|
||||
whd_event_header_t whd;
|
||||
sdpcm_raw_event_header_t raw;
|
||||
} event;
|
||||
} sdpcm_bcm_event_t;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
/******************************************************
|
||||
* Static Variables
|
||||
******************************************************/
|
||||
|
||||
/******************************************************
|
||||
* SDPCM Logging
|
||||
*
|
||||
* Enable this section to allow logging of SDPCM packets
|
||||
* into a buffer for later perusal
|
||||
*
|
||||
* See sdpcm_log and next_sdpcm_log_pos
|
||||
*
|
||||
******************************************************/
|
||||
/** @cond */
|
||||
|
||||
#if 0
|
||||
|
||||
#define SDPCM_LOG_SIZE 30
|
||||
#define SDPCM_LOG_HEADER_SIZE (0x60)
|
||||
|
||||
typedef enum { UNUSED, LOG_TX, LOG_RX } sdpcm_log_direction_t;
|
||||
typedef enum { IOCTL, DATA, EVENT } sdpcm_log_type_t;
|
||||
|
||||
typedef struct SDPCM_log_entry_struct
|
||||
{
|
||||
sdpcm_log_direction_t direction;
|
||||
sdpcm_log_type_t type;
|
||||
unsigned long time;
|
||||
unsigned long length;
|
||||
unsigned char header[SDPCM_LOG_HEADER_SIZE];
|
||||
}sdpcm_log_entry_t;
|
||||
|
||||
static int next_sdpcm_log_pos = 0;
|
||||
static sdpcm_log_entry_t sdpcm_log[SDPCM_LOG_SIZE];
|
||||
|
||||
static void add_sdpcm_log_entry(sdpcm_log_direction_t dir, sdpcm_log_type_t type, unsigned long length, char *eth_data)
|
||||
{
|
||||
|
||||
sdpcm_log[next_sdpcm_log_pos].direction = dir;
|
||||
sdpcm_log[next_sdpcm_log_pos].type = type;
|
||||
cy_rtos_get_time(&sdpcm_log[next_sdpcm_log_pos].time);
|
||||
sdpcm_log[next_sdpcm_log_pos].length = length;
|
||||
memcpy(sdpcm_log[next_sdpcm_log_pos].header, eth_data, SDPCM_LOG_HEADER_SIZE);
|
||||
next_sdpcm_log_pos++;
|
||||
if (next_sdpcm_log_pos >= SDPCM_LOG_SIZE)
|
||||
{
|
||||
next_sdpcm_log_pos = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
#define add_sdpcm_log_entry(dir, type, length, eth_data)
|
||||
#endif
|
||||
|
||||
/** @endcond */
|
||||
|
||||
/******************************************************
|
||||
* Static Function Prototypes
|
||||
******************************************************/
|
||||
static whd_buffer_t whd_sdpcm_get_next_buffer_in_queue(whd_driver_t whd_driver, whd_buffer_t buffer);
|
||||
static void whd_sdpcm_set_next_buffer_in_queue(whd_driver_t whd_driver, whd_buffer_t buffer,
|
||||
whd_buffer_t prev_buffer);
|
||||
extern void whd_wifi_log_event(whd_driver_t whd_driver, const whd_event_header_t *event_header,
|
||||
const uint8_t *event_data);
|
||||
/******************************************************
|
||||
* Function definitions
|
||||
******************************************************/
|
||||
|
||||
/** Initialises the SDPCM protocol handler
|
||||
*
|
||||
* Initialises mutex and semaphore flags needed by the SDPCM handler.
|
||||
* Also initialises the list of event handlers. This function is called
|
||||
* from the @ref whd_thread_init function.
|
||||
*
|
||||
* @return WHD result code
|
||||
*/
|
||||
|
||||
whd_result_t whd_sdpcm_init(whd_driver_t whd_driver)
|
||||
{
|
||||
whd_sdpcm_info_t *sdpcm_info = &whd_driver->sdpcm_info;
|
||||
|
||||
/* Create the sdpcm packet queue semaphore */
|
||||
if (cy_rtos_init_semaphore(&sdpcm_info->send_queue_mutex, 1, 0) != WHD_SUCCESS)
|
||||
{
|
||||
return WHD_SEMAPHORE_ERROR;
|
||||
}
|
||||
if (cy_rtos_set_semaphore(&sdpcm_info->send_queue_mutex, WHD_FALSE) != WHD_SUCCESS)
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Error setting semaphore in %s at %d \n", __func__, __LINE__) );
|
||||
return WHD_SEMAPHORE_ERROR;
|
||||
}
|
||||
|
||||
/* Packet send queue variables */
|
||||
sdpcm_info->send_queue_head = (whd_buffer_t)NULL;
|
||||
sdpcm_info->send_queue_tail = (whd_buffer_t)NULL;
|
||||
|
||||
whd_sdpcm_bus_vars_init(whd_driver);
|
||||
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
/* Re-initialize the bus variables after deep sleep */
|
||||
void whd_sdpcm_bus_vars_init(whd_driver_t whd_driver)
|
||||
{
|
||||
whd_sdpcm_info_t *sdpcm_info = &whd_driver->sdpcm_info;
|
||||
|
||||
/* Bus data credit variables */
|
||||
sdpcm_info->credit_diff = 0;
|
||||
sdpcm_info->largest_credit_diff = 0;
|
||||
|
||||
sdpcm_info->packet_transmit_sequence_number = 0;
|
||||
sdpcm_info->last_bus_data_credit = (uint8_t)1;
|
||||
}
|
||||
|
||||
/** Initialises the SDPCM protocol handler
|
||||
*
|
||||
* De-initialises mutex and semaphore flags needed by the SDPCM handler.
|
||||
* This function is called from the @ref whd_thread_func function when it is exiting.
|
||||
*/
|
||||
void whd_sdpcm_quit(whd_driver_t whd_driver)
|
||||
{
|
||||
whd_sdpcm_info_t *sdpcm_info = &whd_driver->sdpcm_info;
|
||||
whd_cdc_bdc_info_t *cdc_bdc_info = &whd_driver->cdc_bdc_info;
|
||||
whd_result_t result;
|
||||
|
||||
/* Delete the sleep mutex */
|
||||
(void)cy_rtos_deinit_semaphore(&cdc_bdc_info->ioctl_sleep); /* Ignore return - not much can be done about failure */
|
||||
|
||||
/* Delete the queue mutex. */
|
||||
(void)cy_rtos_deinit_semaphore(&cdc_bdc_info->ioctl_mutex); /* Ignore return - not much can be done about failure */
|
||||
|
||||
/* Delete the SDPCM queue mutex */
|
||||
(void)cy_rtos_deinit_semaphore(&sdpcm_info->send_queue_mutex); /* Ignore return - not much can be done about failure */
|
||||
|
||||
/* Delete the event list management mutex */
|
||||
(void)cy_rtos_deinit_semaphore(&cdc_bdc_info->event_list_mutex); /* Ignore return - not much can be done about failure */
|
||||
|
||||
/* Free any left over packets in the queue */
|
||||
while (sdpcm_info->send_queue_head != NULL)
|
||||
{
|
||||
whd_buffer_t buf = whd_sdpcm_get_next_buffer_in_queue(whd_driver, sdpcm_info->send_queue_head);
|
||||
result = whd_buffer_release(whd_driver, sdpcm_info->send_queue_head, WHD_NETWORK_TX);
|
||||
if (result != WHD_SUCCESS)
|
||||
WPRINT_WHD_ERROR( ("buffer release failed in %s at %d \n", __func__, __LINE__) );
|
||||
sdpcm_info->send_queue_head = buf;
|
||||
}
|
||||
}
|
||||
|
||||
void whd_sdpcm_update_credit(whd_driver_t whd_driver, uint8_t *data)
|
||||
{
|
||||
sdpcm_sw_header_t *header = (sdpcm_sw_header_t *)(data + 4);
|
||||
whd_sdpcm_info_t *sdpcm_info = &whd_driver->sdpcm_info;
|
||||
|
||||
if ( (header->channel_and_flags & 0x0f) < (uint8_t)3 )
|
||||
{
|
||||
sdpcm_info->credit_diff = (uint8_t)(header->bus_data_credit - sdpcm_info->last_bus_data_credit);
|
||||
WPRINT_WHD_DATA_LOG( ("credit update =%d\n ", header->bus_data_credit) );
|
||||
if (sdpcm_info->credit_diff <= GET_C_VAR(whd_driver, BUS_CREDIT_DIFF) )
|
||||
{
|
||||
sdpcm_info->last_bus_data_credit = header->bus_data_credit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sdpcm_info->credit_diff > sdpcm_info->largest_credit_diff)
|
||||
{
|
||||
sdpcm_info->largest_credit_diff = sdpcm_info->credit_diff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
whd_bus_set_flow_control(whd_driver, header->wireless_flow_control);
|
||||
}
|
||||
|
||||
/** Processes and directs incoming SDPCM packets
|
||||
*
|
||||
* This function receives SDPCM packets from the Broadcom 802.11 device and decodes the SDPCM header
|
||||
* to determine where the packet should be directed.
|
||||
*
|
||||
* Control packets (IOCTL/IOVAR) / Data Packets/ Event Packets are passed to CDC/BDC layer
|
||||
* and the appropriate event handler is called.
|
||||
*
|
||||
* @param buffer : The SDPCM packet buffer received from the Broadcom 802.11 device
|
||||
*
|
||||
*/
|
||||
void whd_sdpcm_process_rx_packet(whd_driver_t whd_driver, whd_buffer_t buffer)
|
||||
{
|
||||
bus_common_header_t *packet;
|
||||
uint16_t size;
|
||||
uint16_t size_inv;
|
||||
sdpcm_header_t sdpcm_header;
|
||||
whd_result_t result;
|
||||
|
||||
packet = (bus_common_header_t *)whd_buffer_get_current_piece_data_pointer(whd_driver, buffer);
|
||||
|
||||
memcpy(&sdpcm_header, packet->bus_header, BUS_HEADER_LEN);
|
||||
|
||||
sdpcm_header.frametag[0] = dtoh16(sdpcm_header.frametag[0]);
|
||||
sdpcm_header.frametag[1] = dtoh16(sdpcm_header.frametag[1]);
|
||||
|
||||
/* Extract the total SDPCM packet size from the first two frametag bytes */
|
||||
size = sdpcm_header.frametag[0];
|
||||
|
||||
/* Check that the second two frametag bytes are the binary inverse of the size */
|
||||
size_inv = (uint16_t) ~size; /* Separate variable due to GCC Bug 38341 */
|
||||
if (sdpcm_header.frametag[1] != size_inv)
|
||||
{
|
||||
WPRINT_WHD_DEBUG( ("Received a packet with a frametag which is wrong\n") );
|
||||
result = whd_buffer_release(whd_driver, buffer, WHD_NETWORK_RX);
|
||||
if (result != WHD_SUCCESS)
|
||||
WPRINT_WHD_ERROR( ("buffer release failed in %s at %d \n", __func__, __LINE__) );
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check whether the packet is big enough to contain the SDPCM header (or) it's too big to handle */
|
||||
if ( (size < (uint16_t)SDPCM_HEADER_LEN) || (size > whd_buffer_get_current_piece_size(whd_driver, buffer) ) )
|
||||
{
|
||||
whd_minor_assert("Packet size invalid", 0 == 1);
|
||||
WPRINT_WHD_DEBUG( (
|
||||
"Received a packet that is too small to contain anything useful (or) too big. Packet Size = [%d]\n",
|
||||
size) );
|
||||
result = whd_buffer_release(whd_driver, buffer, WHD_NETWORK_RX);
|
||||
if (result != WHD_SUCCESS)
|
||||
WPRINT_WHD_ERROR( ("buffer release failed in %s at %d \n", __func__, __LINE__) );
|
||||
return;
|
||||
}
|
||||
|
||||
/* Get address of packet->sdpcm_header.frametag indirectly to avoid IAR's unaligned address warning */
|
||||
whd_sdpcm_update_credit(whd_driver,
|
||||
(uint8_t *)&sdpcm_header.sw_header - sizeof(sdpcm_header.frametag) );
|
||||
|
||||
if (size == (uint16_t)SDPCM_HEADER_LEN)
|
||||
{
|
||||
/* This is a flow control update packet with no data - release it. */
|
||||
result = whd_buffer_release(whd_driver, buffer, WHD_NETWORK_RX);
|
||||
if (result != WHD_SUCCESS)
|
||||
WPRINT_WHD_ERROR( ("buffer release failed in %s at %d \n", __func__, __LINE__) );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check the SDPCM channel to decide what to do with packet. */
|
||||
switch (sdpcm_header.sw_header.channel_and_flags & 0x0f)
|
||||
{
|
||||
case CONTROL_HEADER: /* IOCTL/IOVAR reply packet */
|
||||
{
|
||||
add_sdpcm_log_entry(LOG_RX, IOCTL, whd_buffer_get_current_piece_size(whd_driver, buffer),
|
||||
(char *)whd_buffer_get_current_piece_data_pointer(whd_driver, buffer) );
|
||||
|
||||
/* Check that packet size is big enough to contain the CDC header as well as the SDPCM header */
|
||||
if (sdpcm_header.frametag[0] <
|
||||
(sizeof(sdpcm_header.frametag) + sizeof(sdpcm_sw_header_t) + sizeof(cdc_header_t) ) )
|
||||
{
|
||||
/* Received a too-short SDPCM packet! */
|
||||
WPRINT_WHD_DEBUG( ("Received a too-short SDPCM packet!\n") );
|
||||
result = whd_buffer_release(whd_driver, buffer, WHD_NETWORK_RX);
|
||||
if (result != WHD_SUCCESS)
|
||||
WPRINT_WHD_ERROR( ("buffer release failed in %s at %d \n", __func__, __LINE__) );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/* Move SDPCM header and Buffer header to pass onto next layer */
|
||||
whd_buffer_add_remove_at_front(whd_driver, &buffer,
|
||||
(int32_t)(sizeof(whd_buffer_header_t) +
|
||||
sdpcm_header.sw_header.header_length) );
|
||||
|
||||
whd_process_cdc(whd_driver, buffer);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case DATA_HEADER:
|
||||
{
|
||||
/* Check that the packet is big enough to contain SDPCM & BDC headers */
|
||||
if (sdpcm_header.frametag[0] <=
|
||||
(sizeof(sdpcm_header.frametag) + sizeof(sdpcm_sw_header_t) + sizeof(bdc_header_t) ) )
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Packet too small to contain SDPCM + BDC headers\n") );
|
||||
result = whd_buffer_release(whd_driver, buffer, WHD_NETWORK_RX);
|
||||
if (result != WHD_SUCCESS)
|
||||
WPRINT_WHD_ERROR( ("buffer release failed in %s at %d \n", __func__, __LINE__) );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/* Move SDPCM header and Buffer header to pass onto next layer */
|
||||
whd_buffer_add_remove_at_front(whd_driver, &buffer,
|
||||
(int32_t)(sizeof(whd_buffer_header_t) +
|
||||
sdpcm_header.sw_header.header_length) );
|
||||
|
||||
whd_process_bdc(whd_driver, buffer);
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case ASYNCEVENT_HEADER:
|
||||
{
|
||||
|
||||
/* Move SDPCM header and Buffer header to pass onto next layer */
|
||||
whd_buffer_add_remove_at_front(whd_driver, &buffer,
|
||||
(int32_t)(sizeof(whd_buffer_header_t) +
|
||||
sdpcm_header.sw_header.header_length) );
|
||||
|
||||
whd_process_bdc_event(whd_driver, buffer, size);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
whd_minor_assert("SDPCM packet of unknown channel received - dropping packet", 0 != 0);
|
||||
result = whd_buffer_release(whd_driver, buffer, WHD_NETWORK_RX);
|
||||
if (result != WHD_SUCCESS)
|
||||
WPRINT_WHD_ERROR( ("buffer release failed in %s at %d \n", __func__, __LINE__) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
whd_bool_t whd_sdpcm_has_tx_packet(whd_driver_t whd_driver)
|
||||
{
|
||||
if (whd_driver->sdpcm_info.send_queue_head != NULL)
|
||||
{
|
||||
return WHD_TRUE;
|
||||
}
|
||||
|
||||
return WHD_FALSE;
|
||||
}
|
||||
|
||||
whd_result_t whd_sdpcm_get_packet_to_send(whd_driver_t whd_driver, whd_buffer_t *buffer)
|
||||
{
|
||||
bus_common_header_t *packet;
|
||||
sdpcm_header_t sdpcm_header;
|
||||
whd_sdpcm_info_t *sdpcm_info = &whd_driver->sdpcm_info;
|
||||
whd_result_t result;
|
||||
|
||||
if (sdpcm_info->send_queue_head != NULL)
|
||||
{
|
||||
/* Check if we're being flow controlled */
|
||||
if (whd_bus_is_flow_controlled(whd_driver) == WHD_TRUE)
|
||||
{
|
||||
WHD_STATS_INCREMENT_VARIABLE(whd_driver, flow_control);
|
||||
return WHD_FLOW_CONTROLLED;
|
||||
}
|
||||
|
||||
/* Check if we have enough bus data credits spare */
|
||||
if (sdpcm_info->packet_transmit_sequence_number == sdpcm_info->last_bus_data_credit)
|
||||
{
|
||||
WHD_STATS_INCREMENT_VARIABLE(whd_driver, no_credit);
|
||||
return WHD_NO_CREDITS;
|
||||
}
|
||||
|
||||
/* There is a packet waiting to be sent - send it then fix up queue and release packet */
|
||||
if (cy_rtos_get_semaphore(&sdpcm_info->send_queue_mutex, CY_RTOS_NEVER_TIMEOUT, WHD_FALSE) != WHD_SUCCESS)
|
||||
{
|
||||
/* Could not obtain mutex, push back the flow control semaphore */
|
||||
WPRINT_WHD_ERROR( ("Error manipulating a semaphore, %s failed at %d \n", __func__, __LINE__) );
|
||||
return WHD_SEMAPHORE_ERROR;
|
||||
}
|
||||
|
||||
/* Pop the head off and set the new send_queue head */
|
||||
*buffer = sdpcm_info->send_queue_head;
|
||||
sdpcm_info->send_queue_head = whd_sdpcm_get_next_buffer_in_queue(whd_driver, *buffer);
|
||||
if (sdpcm_info->send_queue_head == NULL)
|
||||
{
|
||||
sdpcm_info->send_queue_tail = NULL;
|
||||
}
|
||||
result = cy_rtos_set_semaphore(&sdpcm_info->send_queue_mutex, WHD_FALSE);
|
||||
if (result != WHD_SUCCESS)
|
||||
WPRINT_WHD_ERROR( ("Error setting semaphore in %s at %d \n", __func__, __LINE__) );
|
||||
|
||||
|
||||
/* Set the sequence number */
|
||||
packet = (bus_common_header_t *)whd_buffer_get_current_piece_data_pointer(whd_driver, *buffer);
|
||||
memcpy(&sdpcm_header, packet->bus_header, BUS_HEADER_LEN);
|
||||
sdpcm_header.sw_header.sequence = sdpcm_info->packet_transmit_sequence_number;
|
||||
memcpy(packet->bus_header, &sdpcm_header, BUS_HEADER_LEN);
|
||||
sdpcm_info->packet_transmit_sequence_number++;
|
||||
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
return WHD_NO_PACKET_TO_SEND;
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns the number of bus credits available
|
||||
*
|
||||
* @return The number of bus credits available
|
||||
*/
|
||||
uint8_t whd_sdpcm_get_available_credits(whd_driver_t whd_driver)
|
||||
{
|
||||
return (uint8_t)(whd_driver->sdpcm_info.last_bus_data_credit -
|
||||
whd_driver->sdpcm_info.packet_transmit_sequence_number);
|
||||
}
|
||||
|
||||
/** Writes SDPCM headers and sends packet to WHD Thread
|
||||
*
|
||||
* Prepends the given packet with a new SDPCM header,
|
||||
* then passes the packet to the WHD thread via a queue
|
||||
*
|
||||
* This function is called by @ref whd_network_send_ethernet_data and @ref whd_cdc_send_ioctl
|
||||
*
|
||||
* @param buffer : The handle of the packet buffer to send
|
||||
* @param header_type : DATA_HEADER, ASYNCEVENT_HEADER or CONTROL_HEADER - indicating what type of SDPCM packet this is.
|
||||
*/
|
||||
|
||||
void whd_send_to_bus(whd_driver_t whd_driver, whd_buffer_t buffer,
|
||||
sdpcm_header_type_t header_type)
|
||||
{
|
||||
uint16_t size;
|
||||
bus_common_header_t *packet =
|
||||
(bus_common_header_t *)whd_buffer_get_current_piece_data_pointer(whd_driver, buffer);
|
||||
sdpcm_header_t sdpcm_header;
|
||||
whd_sdpcm_info_t *sdpcm_info = &whd_driver->sdpcm_info;
|
||||
whd_result_t result;
|
||||
|
||||
size = whd_buffer_get_current_piece_size(whd_driver, buffer);
|
||||
|
||||
size = (uint16_t)(size - (uint16_t)sizeof(whd_buffer_header_t) );
|
||||
|
||||
/* Prepare the SDPCM header */
|
||||
memset( (uint8_t *)&sdpcm_header, 0, sizeof(sdpcm_header_t) );
|
||||
sdpcm_header.sw_header.channel_and_flags = (uint8_t)header_type;
|
||||
sdpcm_header.sw_header.header_length =
|
||||
(header_type == DATA_HEADER) ? sizeof(sdpcm_header_t) + 2 : sizeof(sdpcm_header_t);
|
||||
sdpcm_header.sw_header.sequence = 0; /* Note: The real sequence will be written later */
|
||||
sdpcm_header.frametag[0] = size;
|
||||
sdpcm_header.frametag[1] = (uint16_t) ~size;
|
||||
|
||||
memcpy(packet->bus_header, &sdpcm_header, BUS_HEADER_LEN);
|
||||
|
||||
add_sdpcm_log_entry(LOG_TX, (header_type == DATA_HEADER) ? DATA : (header_type == CONTROL_HEADER) ? IOCTL : EVENT,
|
||||
whd_buffer_get_current_piece_size(whd_driver, buffer),
|
||||
(char *)whd_buffer_get_current_piece_data_pointer(whd_driver, buffer) );
|
||||
|
||||
/* Add the length of the SDPCM header and pass "down" */
|
||||
if (cy_rtos_get_semaphore(&sdpcm_info->send_queue_mutex, CY_RTOS_NEVER_TIMEOUT, WHD_FALSE) != WHD_SUCCESS)
|
||||
{
|
||||
/* Could not obtain mutex */
|
||||
/* Fatal error */
|
||||
result = whd_buffer_release(whd_driver, buffer, WHD_NETWORK_TX);
|
||||
if (result != WHD_SUCCESS)
|
||||
WPRINT_WHD_ERROR( ("buffer release failed in %s at %d \n", __func__, __LINE__) )
|
||||
return;
|
||||
}
|
||||
|
||||
whd_sdpcm_set_next_buffer_in_queue(whd_driver, NULL, buffer);
|
||||
if (sdpcm_info->send_queue_tail != NULL)
|
||||
{
|
||||
whd_sdpcm_set_next_buffer_in_queue(whd_driver, buffer, sdpcm_info->send_queue_tail);
|
||||
}
|
||||
sdpcm_info->send_queue_tail = buffer;
|
||||
if (sdpcm_info->send_queue_head == NULL)
|
||||
{
|
||||
sdpcm_info->send_queue_head = buffer;
|
||||
}
|
||||
result = cy_rtos_set_semaphore(&sdpcm_info->send_queue_mutex, WHD_FALSE);
|
||||
if (result != WHD_SUCCESS)
|
||||
WPRINT_WHD_ERROR( ("Error setting semaphore in %s at %d \n", __func__, __LINE__) );
|
||||
|
||||
whd_thread_notify(whd_driver);
|
||||
}
|
||||
|
||||
/******************************************************
|
||||
* Static Functions
|
||||
******************************************************/
|
||||
|
||||
static whd_buffer_t whd_sdpcm_get_next_buffer_in_queue(whd_driver_t whd_driver, whd_buffer_t buffer)
|
||||
{
|
||||
whd_buffer_header_t *packet = (whd_buffer_header_t *)whd_buffer_get_current_piece_data_pointer(whd_driver, buffer);
|
||||
return packet->queue_next;
|
||||
}
|
||||
|
||||
/** Sets the next buffer in the send queue
|
||||
*
|
||||
* The send queue is a linked list of packet buffers where the 'next' pointer
|
||||
* is stored in the first 4 bytes of the buffer content.
|
||||
* This function sets that pointer.
|
||||
*
|
||||
* @param buffer : handle of packet in the send queue
|
||||
* prev_buffer : handle of new packet whose 'next' pointer will point to 'buffer'
|
||||
*/
|
||||
static void whd_sdpcm_set_next_buffer_in_queue(whd_driver_t whd_driver, whd_buffer_t buffer, whd_buffer_t prev_buffer)
|
||||
{
|
||||
whd_buffer_header_t *packet =
|
||||
(whd_buffer_header_t *)whd_buffer_get_current_piece_data_pointer(whd_driver, prev_buffer);
|
||||
packet->queue_next = buffer;
|
||||
}
|
||||
|
|
@ -0,0 +1,355 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* Allows thread safe access to the WHD WiFi Driver (WHD) hardware bus
|
||||
*
|
||||
* This file provides functions which allow multiple threads to use the WHD hardware bus (SDIO or SPI)
|
||||
* This is achieved by having a single thread (the "WHD Thread") which queues messages to be sent, sending
|
||||
* them sequentially, as well as receiving messages as they arrive.
|
||||
*
|
||||
* Messages to be sent come from the @ref whd_sdpcm_send_common function in whd_sdpcm.c . The messages already
|
||||
* contain SDPCM headers, but not any bus headers (GSPI), and are passed to the whd_thread_send_data function.
|
||||
* This function can be called from any thread.
|
||||
*
|
||||
* Messages are received by way of a callback supplied by in SDPCM.c - whd_sdpcm_process_rx_packet
|
||||
* Received messages are delivered in the context of the WHD Thread, so the callback function needs to avoid blocking.
|
||||
*
|
||||
* It is also possible to use these functions without any operating system, by periodically calling the whd_thread_send_one_packet,
|
||||
* @ref whd_thread_receive_one_packet or @ref whd_thread_poll_all functions
|
||||
*
|
||||
*/
|
||||
#include "stdlib.h"
|
||||
#include "whd_debug.h"
|
||||
#include "whd_thread.h"
|
||||
#include "bus_protocols/whd_bus_protocol_interface.h"
|
||||
#include "cyabs_rtos.h"
|
||||
#include "whd_int.h"
|
||||
#include "whd_chip.h"
|
||||
#include "whd_poll.h"
|
||||
#include "whd_sdpcm.h"
|
||||
#include "whd_buffer_api.h"
|
||||
|
||||
/******************************************************
|
||||
* Static Function Prototypes
|
||||
******************************************************/
|
||||
static void whd_thread_func(whd_thread_arg_t thread_input);
|
||||
|
||||
/******************************************************
|
||||
* Global Functions
|
||||
******************************************************/
|
||||
void whd_thread_info_init(whd_driver_t whd_driver, whd_init_config_t *whd_init_config)
|
||||
{
|
||||
memset(&whd_driver->thread_info, 0, sizeof(whd_driver->thread_info) );
|
||||
whd_driver->thread_info.thread_stack_start = whd_init_config->thread_stack_start;
|
||||
whd_driver->thread_info.thread_stack_size = whd_init_config->thread_stack_size;
|
||||
whd_driver->thread_info.thread_priority = (cy_thread_priority_t)whd_init_config->thread_priority;
|
||||
}
|
||||
|
||||
/** Initialises the WHD Thread
|
||||
*
|
||||
* Initialises the WHD thread, and its flags/semaphores,
|
||||
* then starts it running
|
||||
*
|
||||
* @return WHD_SUCCESS : if initialisation succeeds
|
||||
* otherwise, a result code
|
||||
*/
|
||||
whd_result_t whd_thread_init(whd_driver_t whd_driver)
|
||||
{
|
||||
whd_result_t retval;
|
||||
|
||||
retval = whd_sdpcm_init(whd_driver);
|
||||
|
||||
if (retval != WHD_SUCCESS)
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Could not initialize SDPCM codec\n") );
|
||||
/* Lint: Reachable after hitting assert & globals not defined due to error */
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Create the event flag which signals the WHD thread needs to wake up */
|
||||
retval = cy_rtos_init_semaphore(&whd_driver->thread_info.transceive_semaphore, 1, 0);
|
||||
if (retval != WHD_SUCCESS)
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Could not initialize WHD thread semaphore\n") );
|
||||
/* Lint: Reachable after hitting assert & globals not defined due to error */
|
||||
return retval;
|
||||
}
|
||||
|
||||
retval = cy_rtos_create_thread(&whd_driver->thread_info.whd_thread, whd_thread_func,
|
||||
"WHD", whd_driver->thread_info.thread_stack_start,
|
||||
whd_driver->thread_info.thread_stack_size,
|
||||
whd_driver->thread_info.thread_priority, (uint32_t)whd_driver);
|
||||
if (retval != WHD_SUCCESS)
|
||||
{
|
||||
/* Could not start WHD main thread */
|
||||
WPRINT_WHD_ERROR( ("Could not start WHD thread\n") );
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Ready now. Indicate it here and in thread, whatever be executed first. */
|
||||
whd_driver->thread_info.whd_inited = WHD_TRUE;
|
||||
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
||||
/** Sends the first queued packet
|
||||
*
|
||||
* Checks the queue to determine if there is any packets waiting
|
||||
* to be sent. If there are, then it sends the first one.
|
||||
*
|
||||
* This function is normally used by the WHD Thread, but can be
|
||||
* called periodically by systems which have no RTOS to ensure
|
||||
* packets get sent.
|
||||
*
|
||||
* @return 1 : packet was sent
|
||||
* 0 : no packet sent
|
||||
*/
|
||||
int8_t whd_thread_send_one_packet(whd_driver_t whd_driver)
|
||||
{
|
||||
whd_buffer_t tmp_buf_hnd = NULL;
|
||||
whd_result_t result;
|
||||
|
||||
if (whd_sdpcm_get_packet_to_send(whd_driver, &tmp_buf_hnd) != WHD_SUCCESS)
|
||||
{
|
||||
/* Failed to get a packet */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Ensure the wlan backplane bus is up */
|
||||
result = whd_ensure_wlan_bus_is_up(whd_driver);
|
||||
if (result != WHD_SUCCESS)
|
||||
{
|
||||
whd_assert("Could not bring bus back up", 0 != 0);
|
||||
CHECK_RETURN(whd_buffer_release(whd_driver, tmp_buf_hnd, WHD_NETWORK_TX) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
WPRINT_WHD_DATA_LOG( ("Wcd:> Sending pkt 0x%08lX\n", (unsigned long)tmp_buf_hnd) );
|
||||
if (whd_bus_send_buffer(whd_driver, tmp_buf_hnd) != WHD_SUCCESS)
|
||||
{
|
||||
WHD_STATS_INCREMENT_VARIABLE(whd_driver, tx_fail);
|
||||
return 0;
|
||||
}
|
||||
|
||||
WHD_STATS_INCREMENT_VARIABLE(whd_driver, tx_total);
|
||||
return (int8_t)1;
|
||||
}
|
||||
|
||||
/** Receives a packet if one is waiting
|
||||
*
|
||||
* Checks the wifi chip fifo to determine if there is any packets waiting
|
||||
* to be received. If there are, then it receives the first one, and calls
|
||||
* the callback @ref whd_sdpcm_process_rx_packet (in whd_sdpcm.c).
|
||||
*
|
||||
* This function is normally used by the WHD Thread, but can be
|
||||
* called periodically by systems which have no RTOS to ensure
|
||||
* packets get received properly.
|
||||
*
|
||||
* @return 1 : packet was received
|
||||
* 0 : no packet waiting
|
||||
*/
|
||||
int8_t whd_thread_receive_one_packet(whd_driver_t whd_driver)
|
||||
{
|
||||
/* Check if there is a packet ready to be received */
|
||||
whd_buffer_t recv_buffer;
|
||||
if (whd_bus_read_frame(whd_driver, &recv_buffer) != WHD_SUCCESS)
|
||||
{
|
||||
/* Failed to read a packet */
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (recv_buffer != NULL) /* Could be null if it was only a credit update */
|
||||
{
|
||||
|
||||
WPRINT_WHD_DATA_LOG( ("Wcd:< Rcvd pkt 0x%08lX\n", (unsigned long)recv_buffer) );
|
||||
WHD_STATS_INCREMENT_VARIABLE(whd_driver, rx_total);
|
||||
|
||||
/* Send received buffer up to SDPCM layer */
|
||||
whd_sdpcm_process_rx_packet(whd_driver, recv_buffer);
|
||||
}
|
||||
return (int8_t)1;
|
||||
}
|
||||
|
||||
/** Sends and Receives all waiting packets
|
||||
*
|
||||
* Calls whd_thread_send_one_packet and whd_thread_receive_one_packet
|
||||
* once to send and receive packets, until there are no more packets waiting to
|
||||
* be transferred.
|
||||
*
|
||||
* This function is normally used by the WHD Thread, but can be
|
||||
* called periodically by systems which have no RTOS to ensure
|
||||
* packets get send and received properly.
|
||||
*
|
||||
* Note: do not loop in here, to avoid overwriting previously rx-ed packets
|
||||
*/
|
||||
int8_t whd_thread_poll_all(whd_driver_t whd_driver)
|
||||
{
|
||||
int8_t result = 0;
|
||||
result |= whd_thread_send_one_packet(whd_driver);
|
||||
result |= whd_thread_receive_one_packet(whd_driver);
|
||||
return result;
|
||||
}
|
||||
|
||||
/** Terminates the WHD Thread
|
||||
*
|
||||
* Sets a flag then wakes the WHD Thread to force it to terminate.
|
||||
*
|
||||
*/
|
||||
void whd_thread_quit(whd_driver_t whd_driver)
|
||||
{
|
||||
whd_result_t result;
|
||||
|
||||
/* signal main thread and wake it */
|
||||
whd_driver->thread_info.thread_quit_flag = WHD_TRUE;
|
||||
result = cy_rtos_set_semaphore(&whd_driver->thread_info.transceive_semaphore, WHD_FALSE);
|
||||
if (result == WHD_SUCCESS)
|
||||
{
|
||||
/* Wait for the WHD thread to end */
|
||||
cy_rtos_join_thread(&whd_driver->thread_info.whd_thread);
|
||||
|
||||
/* Ignore return - not much can be done about failure */
|
||||
(void)cy_rtos_terminate_thread(&whd_driver->thread_info.whd_thread);
|
||||
}
|
||||
else
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Error setting semaphore in %s at %d \n", __func__, __LINE__) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Informs WHD of an interrupt
|
||||
*
|
||||
* This function should be called from the SDIO/SPI interrupt function
|
||||
* and usually indicates newly received data is available.
|
||||
* It wakes the WHD Thread, forcing it to check the send/receive
|
||||
*
|
||||
*/
|
||||
/* ignore failure since there is nothing that can be done about it in a ISR */
|
||||
void whd_thread_notify_irq(whd_driver_t whd_driver)
|
||||
{
|
||||
whd_driver->thread_info.bus_interrupt = WHD_TRUE;
|
||||
|
||||
/* just wake up the main thread and let it deal with the data */
|
||||
if (whd_driver->thread_info.whd_inited == WHD_TRUE)
|
||||
{
|
||||
(void)cy_rtos_set_semaphore(&whd_driver->thread_info.transceive_semaphore, WHD_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
void whd_thread_notify(whd_driver_t whd_driver)
|
||||
{
|
||||
/* just wake up the main thread and let it deal with the data */
|
||||
if (whd_driver->thread_info.whd_inited == WHD_TRUE)
|
||||
{
|
||||
/* Ignore return - not much can be done about failure */
|
||||
(void)cy_rtos_set_semaphore(&whd_driver->thread_info.transceive_semaphore, WHD_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************
|
||||
* Static Functions
|
||||
******************************************************/
|
||||
|
||||
/** The WHD Thread function
|
||||
*
|
||||
* This is the main loop of the WHD Thread.
|
||||
* It simply calls @ref whd_thread_poll_all to send/receive all waiting packets, then goes
|
||||
* to sleep. The sleep has a 100ms timeout, causing the send/receive queues to be
|
||||
* checked 10 times per second in case an interrupt is missed.
|
||||
* Once the quit flag has been set, flags/mutexes are cleaned up, and the function exits.
|
||||
*
|
||||
* @param thread_input : unused parameter needed to match thread prototype.
|
||||
*
|
||||
*/
|
||||
static void whd_thread_func(whd_thread_arg_t thread_input)
|
||||
{
|
||||
int8_t rx_status;
|
||||
int8_t tx_status;
|
||||
uint8_t rx_cnt;
|
||||
|
||||
whd_driver_t whd_driver = ( whd_driver_t )thread_input;
|
||||
whd_thread_info_t *thread_info = &whd_driver->thread_info;
|
||||
|
||||
WPRINT_WHD_DATA_LOG( ("Started whd Thread\n") );
|
||||
|
||||
/* Interrupts may be enabled inside thread. To make sure none lost set flag now. */
|
||||
thread_info->whd_inited = WHD_TRUE;
|
||||
|
||||
while (thread_info->thread_quit_flag != WHD_TRUE)
|
||||
{
|
||||
rx_cnt = 0;
|
||||
/* Check if we were woken by interrupt */
|
||||
if ( (thread_info->bus_interrupt == WHD_TRUE) ||
|
||||
(whd_bus_use_status_report_scheme(whd_driver) ) )
|
||||
{
|
||||
thread_info->bus_interrupt = WHD_FALSE;
|
||||
|
||||
/* Check if the interrupt indicated there is a packet to read */
|
||||
if (whd_bus_packet_available_to_read(whd_driver) != 0)
|
||||
{
|
||||
/* Receive all available packets */
|
||||
do
|
||||
{
|
||||
rx_status = whd_thread_receive_one_packet(whd_driver);
|
||||
rx_cnt++;
|
||||
} while (rx_status != 0 && rx_cnt < WHD_THREAD_RX_BOUND);
|
||||
}
|
||||
}
|
||||
|
||||
/* Send all queued packets */
|
||||
do
|
||||
{
|
||||
tx_status = whd_thread_send_one_packet(whd_driver);
|
||||
} while (tx_status != 0);
|
||||
|
||||
if (rx_cnt >= WHD_THREAD_RX_BOUND)
|
||||
{
|
||||
thread_info->bus_interrupt = WHD_TRUE;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Sleep till WLAN do something */
|
||||
whd_bus_wait_for_wlan_event(whd_driver, &thread_info->transceive_semaphore);
|
||||
WPRINT_WHD_DATA_LOG( ("whd Thread: Woke\n") );
|
||||
}
|
||||
|
||||
/* Set flag before releasing objects */
|
||||
thread_info->whd_inited = WHD_FALSE;
|
||||
|
||||
/* Reset the quit flag */
|
||||
thread_info->thread_quit_flag = WHD_FALSE;
|
||||
|
||||
/* Delete the semaphore */
|
||||
/* Ignore return - not much can be done about failure */
|
||||
(void)cy_rtos_deinit_semaphore(&thread_info->transceive_semaphore);
|
||||
|
||||
whd_sdpcm_quit(whd_driver);
|
||||
|
||||
WPRINT_WHD_DATA_LOG( ("Stopped whd Thread\n") );
|
||||
|
||||
if (WHD_SUCCESS != cy_rtos_join_thread(&thread_info->whd_thread) )
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Could not join WHD thread\n") );
|
||||
}
|
||||
|
||||
if (WHD_SUCCESS != cy_rtos_terminate_thread(&thread_info->whd_thread) )
|
||||
{
|
||||
WPRINT_WHD_ERROR( ("Could not close WHD thread\n") );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,773 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file WHD utilities
|
||||
*
|
||||
* Utilities to help do specialized (not general purpose) WHD specific things
|
||||
*/
|
||||
#include "whd_debug.h"
|
||||
#include "whd_utils.h"
|
||||
#include "whd_chip_constants.h"
|
||||
#include "whd_endian.h"
|
||||
#include "whd_int.h"
|
||||
|
||||
#define UNSIGNED_CHAR_TO_CHAR(uch) ( (uch)& 0x7f )
|
||||
|
||||
#define RSPEC_KBPS_MASK (0x7f)
|
||||
#define RSPEC_500KBPS(rate) ( (rate)& RSPEC_KBPS_MASK )
|
||||
#define RSPEC_TO_KBPS(rate) (RSPEC_500KBPS( (rate) ) * (unsigned int)500)
|
||||
|
||||
#define OTP_WORD_SIZE 16 /* Word size in bits */
|
||||
#define WPA_OUI_TYPE1 "\x00\x50\xF2\x01" /** WPA OUI */
|
||||
|
||||
/******************************************************
|
||||
* Static Variables
|
||||
******************************************************/
|
||||
whd_tlv8_data_t *whd_tlv_find_tlv8(const uint8_t *message, uint32_t message_length, uint8_t type);
|
||||
|
||||
whd_tlv8_data_t *whd_tlv_find_tlv8(const uint8_t *message, uint32_t message_length, uint8_t type)
|
||||
{
|
||||
while (message_length != 0)
|
||||
{
|
||||
uint8_t current_tlv_type = message[0];
|
||||
uint16_t current_tlv_length = (uint16_t)(message[1] + 2);
|
||||
|
||||
/* Check if we've overrun the buffer */
|
||||
if (current_tlv_length > message_length)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Check if we've found the type we are looking for */
|
||||
if (current_tlv_type == type)
|
||||
{
|
||||
return (whd_tlv8_data_t *)message;
|
||||
}
|
||||
|
||||
/* Skip current TLV */
|
||||
message += current_tlv_length;
|
||||
message_length -= current_tlv_length;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline whd_tlv8_header_t *whd_parse_tlvs(const whd_tlv8_header_t *tlv_buf, uint32_t buflen,
|
||||
dot11_ie_id_t key)
|
||||
{
|
||||
return (whd_tlv8_header_t *)whd_tlv_find_tlv8( (const uint8_t *)tlv_buf, buflen, key );
|
||||
}
|
||||
|
||||
whd_bool_t whd_is_wpa_ie(vendor_specific_ie_header_t *wpaie, whd_tlv8_header_t **tlvs, uint32_t *tlvs_len)
|
||||
{
|
||||
whd_tlv8_header_t *prev_tlvs = *tlvs;
|
||||
whd_tlv8_header_t *new_tlvs = *tlvs;
|
||||
vendor_specific_ie_header_t *ie = wpaie;
|
||||
|
||||
/* If the contents match the WPA_OUI and type=1 */
|
||||
if ( (ie->tlv_header.length >= (uint8_t)VENDOR_SPECIFIC_IE_MINIMUM_LENGTH) &&
|
||||
(memcmp(ie->oui, WPA_OUI_TYPE1, sizeof(ie->oui) ) == 0) )
|
||||
{
|
||||
/* Found the WPA IE */
|
||||
return WHD_TRUE;
|
||||
}
|
||||
|
||||
/* calculate the next ie address */
|
||||
new_tlvs = (whd_tlv8_header_t *)( ( (uint8_t *)ie ) + ie->tlv_header.length + sizeof(whd_tlv8_header_t) );
|
||||
|
||||
/* check the rest of length of buffer */
|
||||
if (*tlvs_len < (uint32_t)( ( (uint8_t *)new_tlvs ) - ( (uint8_t *)prev_tlvs ) ) )
|
||||
{
|
||||
/* set rest of length to zero to avoid buffer overflow */
|
||||
*tlvs_len = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* point to the next ie */
|
||||
*tlvs = new_tlvs;
|
||||
|
||||
/* tlvs now points to the beginning of next IE pointer, and *ie points to one or more TLV further
|
||||
* down from the *prev_tlvs. So the tlvs_len need to be adjusted by prev_tlvs instead of *ie */
|
||||
*tlvs_len -= (uint32_t)( ( (uint8_t *)*tlvs ) - ( (uint8_t *)prev_tlvs ) );
|
||||
}
|
||||
|
||||
return WHD_FALSE;
|
||||
}
|
||||
|
||||
whd_tlv8_header_t *whd_parse_dot11_tlvs(const whd_tlv8_header_t *tlv_buf, uint32_t buflen, dot11_ie_id_t key)
|
||||
{
|
||||
return (whd_tlv8_header_t *)whd_tlv_find_tlv8( (const uint8_t *)tlv_buf, buflen, key );
|
||||
}
|
||||
|
||||
#ifdef WPRINT_ENABLE_WHD_DEBUG
|
||||
char *whd_ssid_to_string(uint8_t *value, uint8_t length, char *ssid_buf, uint8_t ssid_buf_len)
|
||||
{
|
||||
memset(ssid_buf, 0, ssid_buf_len);
|
||||
|
||||
if (ssid_buf_len > 0)
|
||||
{
|
||||
memcpy(ssid_buf, value, ssid_buf_len < length ? ssid_buf_len : length);
|
||||
}
|
||||
|
||||
return ssid_buf;
|
||||
}
|
||||
|
||||
/* When adding new events, update this switch statement to print correct string */
|
||||
#define CASE_RETURN_STRING(value) case value: \
|
||||
return # value;
|
||||
|
||||
#define CASE_RETURN(value) case value: \
|
||||
break;
|
||||
|
||||
const char *whd_event_to_string(whd_event_num_t value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
CASE_RETURN_STRING(WLC_E_ULP)
|
||||
CASE_RETURN(WLC_E_BT_WIFI_HANDOVER_REQ)
|
||||
CASE_RETURN(WLC_E_SPW_TXINHIBIT)
|
||||
CASE_RETURN(WLC_E_FBT_AUTH_REQ_IND)
|
||||
CASE_RETURN(WLC_E_RSSI_LQM)
|
||||
CASE_RETURN(WLC_E_PFN_GSCAN_FULL_RESULT)
|
||||
CASE_RETURN(WLC_E_PFN_SWC)
|
||||
CASE_RETURN(WLC_E_AUTHORIZED)
|
||||
CASE_RETURN(WLC_E_PROBREQ_MSG_RX)
|
||||
CASE_RETURN(WLC_E_RMC_EVENT)
|
||||
CASE_RETURN(WLC_E_DPSTA_INTF_IND)
|
||||
CASE_RETURN_STRING(WLC_E_NONE)
|
||||
CASE_RETURN_STRING(WLC_E_SET_SSID)
|
||||
CASE_RETURN(WLC_E_PFN_BEST_BATCHING)
|
||||
CASE_RETURN(WLC_E_JOIN)
|
||||
CASE_RETURN(WLC_E_START)
|
||||
CASE_RETURN_STRING(WLC_E_AUTH)
|
||||
CASE_RETURN(WLC_E_AUTH_IND)
|
||||
CASE_RETURN(WLC_E_DEAUTH)
|
||||
CASE_RETURN_STRING(WLC_E_DEAUTH_IND)
|
||||
CASE_RETURN(WLC_E_ASSOC)
|
||||
CASE_RETURN(WLC_E_ASSOC_IND)
|
||||
CASE_RETURN(WLC_E_REASSOC)
|
||||
CASE_RETURN(WLC_E_REASSOC_IND)
|
||||
CASE_RETURN(WLC_E_DISASSOC)
|
||||
CASE_RETURN_STRING(WLC_E_DISASSOC_IND)
|
||||
CASE_RETURN(WLC_E_ROAM)
|
||||
CASE_RETURN(WLC_E_ROAM_PREP)
|
||||
CASE_RETURN(WLC_E_ROAM_START)
|
||||
CASE_RETURN(WLC_E_QUIET_START)
|
||||
CASE_RETURN(WLC_E_QUIET_END)
|
||||
CASE_RETURN(WLC_E_BEACON_RX)
|
||||
CASE_RETURN_STRING(WLC_E_LINK)
|
||||
CASE_RETURN_STRING(WLC_E_RRM)
|
||||
CASE_RETURN(WLC_E_MIC_ERROR)
|
||||
CASE_RETURN(WLC_E_NDIS_LINK)
|
||||
CASE_RETURN(WLC_E_TXFAIL)
|
||||
CASE_RETURN(WLC_E_PMKID_CACHE)
|
||||
CASE_RETURN(WLC_E_RETROGRADE_TSF)
|
||||
CASE_RETURN(WLC_E_PRUNE)
|
||||
CASE_RETURN(WLC_E_AUTOAUTH)
|
||||
CASE_RETURN(WLC_E_EAPOL_MSG)
|
||||
CASE_RETURN(WLC_E_SCAN_COMPLETE)
|
||||
CASE_RETURN(WLC_E_ADDTS_IND)
|
||||
CASE_RETURN(WLC_E_DELTS_IND)
|
||||
CASE_RETURN(WLC_E_BCNSENT_IND)
|
||||
CASE_RETURN(WLC_E_BCNRX_MSG)
|
||||
CASE_RETURN(WLC_E_BCNLOST_MSG)
|
||||
CASE_RETURN_STRING(WLC_E_PFN_NET_FOUND)
|
||||
CASE_RETURN(WLC_E_PFN_NET_LOST)
|
||||
CASE_RETURN(WLC_E_RESET_COMPLETE)
|
||||
CASE_RETURN(WLC_E_JOIN_START)
|
||||
CASE_RETURN(WLC_E_ASSOC_START)
|
||||
CASE_RETURN(WLC_E_IBSS_ASSOC)
|
||||
CASE_RETURN(WLC_E_RADIO)
|
||||
CASE_RETURN(WLC_E_PSM_WATCHDOG)
|
||||
CASE_RETURN(WLC_E_CCX_ASSOC_START)
|
||||
CASE_RETURN(WLC_E_CCX_ASSOC_ABORT)
|
||||
CASE_RETURN(WLC_E_PROBREQ_MSG)
|
||||
CASE_RETURN(WLC_E_SCAN_CONFIRM_IND)
|
||||
CASE_RETURN_STRING(WLC_E_PSK_SUP)
|
||||
CASE_RETURN(WLC_E_COUNTRY_CODE_CHANGED)
|
||||
CASE_RETURN(WLC_E_EXCEEDED_MEDIUM_TIME)
|
||||
CASE_RETURN(WLC_E_ICV_ERROR)
|
||||
CASE_RETURN(WLC_E_UNICAST_DECODE_ERROR)
|
||||
CASE_RETURN(WLC_E_MULTICAST_DECODE_ERROR)
|
||||
CASE_RETURN(WLC_E_TRACE)
|
||||
CASE_RETURN(WLC_E_BTA_HCI_EVENT)
|
||||
CASE_RETURN(WLC_E_IF)
|
||||
CASE_RETURN(WLC_E_P2P_DISC_LISTEN_COMPLETE)
|
||||
CASE_RETURN(WLC_E_RSSI)
|
||||
CASE_RETURN_STRING(WLC_E_PFN_SCAN_COMPLETE)
|
||||
CASE_RETURN(WLC_E_EXTLOG_MSG)
|
||||
CASE_RETURN(WLC_E_ACTION_FRAME)
|
||||
CASE_RETURN(WLC_E_ACTION_FRAME_COMPLETE)
|
||||
CASE_RETURN(WLC_E_PRE_ASSOC_IND)
|
||||
CASE_RETURN(WLC_E_PRE_REASSOC_IND)
|
||||
CASE_RETURN(WLC_E_CHANNEL_ADOPTED)
|
||||
CASE_RETURN(WLC_E_AP_STARTED)
|
||||
CASE_RETURN(WLC_E_DFS_AP_STOP)
|
||||
CASE_RETURN(WLC_E_DFS_AP_RESUME)
|
||||
CASE_RETURN(WLC_E_WAI_STA_EVENT)
|
||||
CASE_RETURN(WLC_E_WAI_MSG)
|
||||
CASE_RETURN_STRING(WLC_E_ESCAN_RESULT)
|
||||
CASE_RETURN(WLC_E_ACTION_FRAME_OFF_CHAN_COMPLETE)
|
||||
CASE_RETURN(WLC_E_PROBRESP_MSG)
|
||||
CASE_RETURN(WLC_E_P2P_PROBREQ_MSG)
|
||||
CASE_RETURN(WLC_E_DCS_REQUEST)
|
||||
CASE_RETURN(WLC_E_FIFO_CREDIT_MAP)
|
||||
CASE_RETURN(WLC_E_ACTION_FRAME_RX)
|
||||
CASE_RETURN(WLC_E_WAKE_EVENT)
|
||||
CASE_RETURN(WLC_E_RM_COMPLETE)
|
||||
CASE_RETURN(WLC_E_HTSFSYNC)
|
||||
CASE_RETURN(WLC_E_OVERLAY_REQ)
|
||||
CASE_RETURN_STRING(WLC_E_CSA_COMPLETE_IND)
|
||||
CASE_RETURN(WLC_E_EXCESS_PM_WAKE_EVENT)
|
||||
CASE_RETURN(WLC_E_PFN_SCAN_NONE)
|
||||
CASE_RETURN(WLC_E_PFN_SCAN_ALLGONE)
|
||||
CASE_RETURN(WLC_E_GTK_PLUMBED)
|
||||
CASE_RETURN(WLC_E_ASSOC_IND_NDIS)
|
||||
CASE_RETURN(WLC_E_REASSOC_IND_NDIS)
|
||||
CASE_RETURN(WLC_E_ASSOC_REQ_IE)
|
||||
CASE_RETURN(WLC_E_ASSOC_RESP_IE)
|
||||
CASE_RETURN(WLC_E_ASSOC_RECREATED)
|
||||
CASE_RETURN(WLC_E_ACTION_FRAME_RX_NDIS)
|
||||
CASE_RETURN(WLC_E_AUTH_REQ)
|
||||
CASE_RETURN(WLC_E_TDLS_PEER_EVENT)
|
||||
CASE_RETURN(WLC_E_SPEEDY_RECREATE_FAIL)
|
||||
CASE_RETURN(WLC_E_NATIVE)
|
||||
CASE_RETURN(WLC_E_PKTDELAY_IND)
|
||||
CASE_RETURN(WLC_E_AWDL_AW)
|
||||
CASE_RETURN(WLC_E_AWDL_ROLE)
|
||||
CASE_RETURN(WLC_E_AWDL_EVENT)
|
||||
CASE_RETURN(WLC_E_NIC_AF_TXS)
|
||||
CASE_RETURN(WLC_E_NAN)
|
||||
CASE_RETURN(WLC_E_BEACON_FRAME_RX)
|
||||
CASE_RETURN(WLC_E_SERVICE_FOUND)
|
||||
CASE_RETURN(WLC_E_GAS_FRAGMENT_RX)
|
||||
CASE_RETURN(WLC_E_GAS_COMPLETE)
|
||||
CASE_RETURN(WLC_E_P2PO_ADD_DEVICE)
|
||||
CASE_RETURN(WLC_E_P2PO_DEL_DEVICE)
|
||||
CASE_RETURN(WLC_E_WNM_STA_SLEEP)
|
||||
CASE_RETURN(WLC_E_TXFAIL_THRESH)
|
||||
CASE_RETURN(WLC_E_PROXD)
|
||||
CASE_RETURN(WLC_E_IBSS_COALESCE)
|
||||
CASE_RETURN(WLC_E_AWDL_RX_PRB_RESP)
|
||||
CASE_RETURN(WLC_E_AWDL_RX_ACT_FRAME)
|
||||
CASE_RETURN(WLC_E_AWDL_WOWL_NULLPKT)
|
||||
CASE_RETURN(WLC_E_AWDL_PHYCAL_STATUS)
|
||||
CASE_RETURN(WLC_E_AWDL_OOB_AF_STATUS)
|
||||
CASE_RETURN(WLC_E_AWDL_SCAN_STATUS)
|
||||
CASE_RETURN(WLC_E_AWDL_AW_START)
|
||||
CASE_RETURN(WLC_E_AWDL_AW_END)
|
||||
CASE_RETURN(WLC_E_AWDL_AW_EXT)
|
||||
CASE_RETURN(WLC_E_AWDL_PEER_CACHE_CONTROL)
|
||||
CASE_RETURN(WLC_E_CSA_START_IND)
|
||||
CASE_RETURN(WLC_E_CSA_DONE_IND)
|
||||
CASE_RETURN(WLC_E_CSA_FAILURE_IND)
|
||||
CASE_RETURN(WLC_E_CCA_CHAN_QUAL)
|
||||
CASE_RETURN(WLC_E_BSSID)
|
||||
CASE_RETURN(WLC_E_TX_STAT_ERROR)
|
||||
CASE_RETURN(WLC_E_BCMC_CREDIT_SUPPORT)
|
||||
CASE_RETURN(WLC_E_PSTA_PRIMARY_INTF_IND)
|
||||
case WLC_E_LAST:
|
||||
default:
|
||||
return "Unknown";
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
const char *whd_status_to_string(whd_event_status_t status)
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
CASE_RETURN_STRING(WLC_E_STATUS_SUCCESS)
|
||||
CASE_RETURN_STRING(WLC_E_STATUS_FAIL)
|
||||
CASE_RETURN_STRING(WLC_E_STATUS_TIMEOUT)
|
||||
CASE_RETURN_STRING(WLC_E_STATUS_NO_NETWORKS)
|
||||
CASE_RETURN_STRING(WLC_E_STATUS_ABORT)
|
||||
CASE_RETURN_STRING(WLC_E_STATUS_NO_ACK)
|
||||
CASE_RETURN_STRING(WLC_E_STATUS_UNSOLICITED)
|
||||
CASE_RETURN_STRING(WLC_E_STATUS_ATTEMPT)
|
||||
CASE_RETURN_STRING(WLC_E_STATUS_PARTIAL)
|
||||
CASE_RETURN_STRING(WLC_E_STATUS_NEWSCAN)
|
||||
CASE_RETURN_STRING(WLC_E_STATUS_NEWASSOC)
|
||||
CASE_RETURN_STRING(WLC_E_STATUS_11HQUIET)
|
||||
CASE_RETURN_STRING(WLC_E_STATUS_SUPPRESS)
|
||||
CASE_RETURN_STRING(WLC_E_STATUS_NOCHANS)
|
||||
CASE_RETURN_STRING(WLC_E_STATUS_CCXFASTRM)
|
||||
CASE_RETURN_STRING(WLC_E_STATUS_CS_ABORT)
|
||||
CASE_RETURN_STRING(WLC_SUP_DISCONNECTED)
|
||||
CASE_RETURN_STRING(WLC_SUP_CONNECTING)
|
||||
CASE_RETURN_STRING(WLC_SUP_IDREQUIRED)
|
||||
CASE_RETURN_STRING(WLC_SUP_AUTHENTICATING)
|
||||
CASE_RETURN_STRING(WLC_SUP_AUTHENTICATED)
|
||||
CASE_RETURN_STRING(WLC_SUP_KEYXCHANGE)
|
||||
CASE_RETURN_STRING(WLC_SUP_KEYED)
|
||||
CASE_RETURN_STRING(WLC_SUP_TIMEOUT)
|
||||
CASE_RETURN_STRING(WLC_SUP_LAST_BASIC_STATE)
|
||||
CASE_RETURN_STRING(WLC_SUP_KEYXCHANGE_PREP_M4)
|
||||
CASE_RETURN_STRING(WLC_SUP_KEYXCHANGE_WAIT_G1)
|
||||
CASE_RETURN_STRING(WLC_SUP_KEYXCHANGE_PREP_G2)
|
||||
CASE_RETURN_STRING(WLC_DOT11_SC_SUCCESS)
|
||||
CASE_RETURN_STRING(WLC_DOT11_SC_FAILURE)
|
||||
CASE_RETURN_STRING(WLC_DOT11_SC_CAP_MISMATCH)
|
||||
CASE_RETURN_STRING(WLC_DOT11_SC_REASSOC_FAIL)
|
||||
CASE_RETURN_STRING(WLC_DOT11_SC_ASSOC_FAIL)
|
||||
CASE_RETURN_STRING(WLC_DOT11_SC_AUTH_MISMATCH)
|
||||
CASE_RETURN_STRING(WLC_DOT11_SC_AUTH_SEQ)
|
||||
CASE_RETURN_STRING(WLC_DOT11_SC_AUTH_CHALLENGE_FAIL)
|
||||
CASE_RETURN_STRING(WLC_DOT11_SC_AUTH_TIMEOUT)
|
||||
CASE_RETURN_STRING(WLC_DOT11_SC_ASSOC_BUSY_FAIL)
|
||||
CASE_RETURN_STRING(WLC_DOT11_SC_ASSOC_RATE_MISMATCH)
|
||||
CASE_RETURN_STRING(WLC_DOT11_SC_ASSOC_SHORT_REQUIRED)
|
||||
CASE_RETURN_STRING(WLC_DOT11_SC_ASSOC_PBCC_REQUIRED)
|
||||
CASE_RETURN_STRING(WLC_DOT11_SC_ASSOC_AGILITY_REQUIRED)
|
||||
CASE_RETURN_STRING(WLC_DOT11_SC_ASSOC_SPECTRUM_REQUIRED)
|
||||
CASE_RETURN_STRING(WLC_DOT11_SC_ASSOC_BAD_POWER_CAP)
|
||||
CASE_RETURN_STRING(WLC_DOT11_SC_ASSOC_BAD_SUP_CHANNELS)
|
||||
CASE_RETURN_STRING(WLC_DOT11_SC_ASSOC_SHORTSLOT_REQUIRED)
|
||||
CASE_RETURN_STRING(WLC_DOT11_SC_ASSOC_ERPBCC_REQUIRED)
|
||||
CASE_RETURN_STRING(WLC_DOT11_SC_ASSOC_DSSOFDM_REQUIRED)
|
||||
CASE_RETURN_STRING(WLC_DOT11_SC_DECLINED)
|
||||
CASE_RETURN_STRING(WLC_DOT11_SC_INVALID_PARAMS)
|
||||
CASE_RETURN_STRING(WLC_DOT11_SC_INVALID_AKMP)
|
||||
CASE_RETURN_STRING(WLC_DOT11_SC_INVALID_MDID)
|
||||
CASE_RETURN_STRING(WLC_DOT11_SC_INVALID_FTIE)
|
||||
case WLC_E_STATUS_FORCE_32_BIT:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
const char *whd_reason_to_string(whd_event_reason_t reason)
|
||||
{
|
||||
switch (reason)
|
||||
{
|
||||
CASE_RETURN_STRING(WLC_E_REASON_INITIAL_ASSOC)
|
||||
CASE_RETURN_STRING(WLC_E_REASON_LOW_RSSI)
|
||||
CASE_RETURN_STRING(WLC_E_REASON_DEAUTH)
|
||||
CASE_RETURN_STRING(WLC_E_REASON_DISASSOC)
|
||||
CASE_RETURN_STRING(WLC_E_REASON_BCNS_LOST)
|
||||
CASE_RETURN_STRING(WLC_E_REASON_FAST_ROAM_FAILED)
|
||||
CASE_RETURN_STRING(WLC_E_REASON_DIRECTED_ROAM)
|
||||
CASE_RETURN_STRING(WLC_E_REASON_TSPEC_REJECTED)
|
||||
CASE_RETURN_STRING(WLC_E_REASON_BETTER_AP)
|
||||
CASE_RETURN_STRING(WLC_E_PRUNE_ENCR_MISMATCH)
|
||||
CASE_RETURN_STRING(WLC_E_PRUNE_BCAST_BSSID)
|
||||
CASE_RETURN_STRING(WLC_E_PRUNE_MAC_DENY)
|
||||
CASE_RETURN_STRING(WLC_E_PRUNE_MAC_NA)
|
||||
CASE_RETURN_STRING(WLC_E_PRUNE_REG_PASSV)
|
||||
CASE_RETURN_STRING(WLC_E_PRUNE_SPCT_MGMT)
|
||||
CASE_RETURN_STRING(WLC_E_PRUNE_RADAR)
|
||||
CASE_RETURN_STRING(WLC_E_RSN_MISMATCH)
|
||||
CASE_RETURN_STRING(WLC_E_PRUNE_NO_COMMON_RATES)
|
||||
CASE_RETURN_STRING(WLC_E_PRUNE_BASIC_RATES)
|
||||
CASE_RETURN_STRING(WLC_E_PRUNE_CCXFAST_PREVAP)
|
||||
CASE_RETURN_STRING(WLC_E_PRUNE_CIPHER_NA)
|
||||
CASE_RETURN_STRING(WLC_E_PRUNE_KNOWN_STA)
|
||||
CASE_RETURN_STRING(WLC_E_PRUNE_CCXFAST_DROAM)
|
||||
CASE_RETURN_STRING(WLC_E_PRUNE_WDS_PEER)
|
||||
CASE_RETURN_STRING(WLC_E_PRUNE_QBSS_LOAD)
|
||||
CASE_RETURN_STRING(WLC_E_PRUNE_HOME_AP)
|
||||
CASE_RETURN_STRING(WLC_E_PRUNE_AP_BLOCKED)
|
||||
CASE_RETURN_STRING(WLC_E_PRUNE_NO_DIAG_SUPPORT)
|
||||
CASE_RETURN_STRING(WLC_E_SUP_OTHER)
|
||||
CASE_RETURN_STRING(WLC_E_SUP_DECRYPT_KEY_DATA)
|
||||
CASE_RETURN_STRING(WLC_E_SUP_BAD_UCAST_WEP128)
|
||||
CASE_RETURN_STRING(WLC_E_SUP_BAD_UCAST_WEP40)
|
||||
CASE_RETURN_STRING(WLC_E_SUP_UNSUP_KEY_LEN)
|
||||
CASE_RETURN_STRING(WLC_E_SUP_PW_KEY_CIPHER)
|
||||
CASE_RETURN_STRING(WLC_E_SUP_MSG3_TOO_MANY_IE)
|
||||
CASE_RETURN_STRING(WLC_E_SUP_MSG3_IE_MISMATCH)
|
||||
CASE_RETURN_STRING(WLC_E_SUP_NO_INSTALL_FLAG)
|
||||
CASE_RETURN_STRING(WLC_E_SUP_MSG3_NO_GTK)
|
||||
CASE_RETURN_STRING(WLC_E_SUP_GRP_KEY_CIPHER)
|
||||
CASE_RETURN_STRING(WLC_E_SUP_GRP_MSG1_NO_GTK)
|
||||
CASE_RETURN_STRING(WLC_E_SUP_GTK_DECRYPT_FAIL)
|
||||
CASE_RETURN_STRING(WLC_E_SUP_SEND_FAIL)
|
||||
CASE_RETURN_STRING(WLC_E_SUP_DEAUTH)
|
||||
CASE_RETURN_STRING(WLC_E_SUP_WPA_PSK_TMO)
|
||||
CASE_RETURN_STRING(DOT11_RC_RESERVED)
|
||||
CASE_RETURN_STRING(DOT11_RC_UNSPECIFIED)
|
||||
CASE_RETURN_STRING(DOT11_RC_AUTH_INVAL)
|
||||
CASE_RETURN_STRING(DOT11_RC_DEAUTH_LEAVING)
|
||||
CASE_RETURN_STRING(DOT11_RC_INACTIVITY)
|
||||
CASE_RETURN_STRING(DOT11_RC_BUSY)
|
||||
CASE_RETURN_STRING(DOT11_RC_INVAL_CLASS_2)
|
||||
CASE_RETURN_STRING(DOT11_RC_INVAL_CLASS_3)
|
||||
CASE_RETURN_STRING(DOT11_RC_DISASSOC_LEAVING)
|
||||
CASE_RETURN_STRING(DOT11_RC_NOT_AUTH)
|
||||
CASE_RETURN_STRING(DOT11_RC_BAD_PC)
|
||||
CASE_RETURN_STRING(DOT11_RC_BAD_CHANNELS)
|
||||
CASE_RETURN_STRING(DOT11_RC_UNSPECIFIED_QOS)
|
||||
CASE_RETURN_STRING(DOT11_RC_INSUFFCIENT_BW)
|
||||
CASE_RETURN_STRING(DOT11_RC_EXCESSIVE_FRAMES)
|
||||
CASE_RETURN_STRING(DOT11_RC_TX_OUTSIDE_TXOP)
|
||||
CASE_RETURN_STRING(DOT11_RC_LEAVING_QBSS)
|
||||
CASE_RETURN_STRING(DOT11_RC_BAD_MECHANISM)
|
||||
CASE_RETURN_STRING(DOT11_RC_SETUP_NEEDED)
|
||||
CASE_RETURN_STRING(DOT11_RC_TIMEOUT)
|
||||
CASE_RETURN_STRING(WLC_E_NAN_EVENT_STATUS_CHG)
|
||||
CASE_RETURN_STRING(WLC_E_NAN_EVENT_MERGE)
|
||||
CASE_RETURN_STRING(WLC_E_NAN_EVENT_STOP)
|
||||
CASE_RETURN_STRING(WLC_E_NAN_EVENT_P2P)
|
||||
CASE_RETURN_STRING(WLC_E_NAN_EVENT_WINDOW_BEGIN_P2P)
|
||||
CASE_RETURN_STRING(WLC_E_NAN_EVENT_WINDOW_BEGIN_MESH)
|
||||
CASE_RETURN_STRING(WLC_E_NAN_EVENT_WINDOW_BEGIN_IBSS)
|
||||
CASE_RETURN_STRING(WLC_E_NAN_EVENT_WINDOW_BEGIN_RANGING)
|
||||
CASE_RETURN_STRING(WLC_E_NAN_EVENT_POST_DISC)
|
||||
CASE_RETURN_STRING(WLC_E_NAN_EVENT_DATA_IF_ADD)
|
||||
CASE_RETURN_STRING(WLC_E_NAN_EVENT_DATA_PEER_ADD)
|
||||
CASE_RETURN_STRING(WLC_E_NAN_EVENT_DATA_IND)
|
||||
CASE_RETURN_STRING(WLC_E_NAN_EVENT_DATA_CONF)
|
||||
CASE_RETURN_STRING(WLC_E_NAN_EVENT_SDF_RX)
|
||||
CASE_RETURN_STRING(WLC_E_NAN_EVENT_DATA_END)
|
||||
CASE_RETURN_STRING(WLC_E_NAN_EVENT_BCN_RX)
|
||||
case DOT11_RC_MAX:
|
||||
case WLC_E_REASON_FORCE_32_BIT:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
char *whd_ether_ntoa(const uint8_t *ea, char *buf, uint8_t buf_len)
|
||||
{
|
||||
const char hex[] =
|
||||
{
|
||||
'0', '1', '2', '3', '4', '5', '6', '7',
|
||||
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
|
||||
};
|
||||
char *output = buf;
|
||||
const uint8_t *octet = ea;
|
||||
|
||||
if (buf_len < WHD_ETHER_ADDR_STR_LEN)
|
||||
{
|
||||
if (buf_len > 0)
|
||||
{
|
||||
/* buffer too short */
|
||||
buf[0] = '\0';
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
for (; octet != &ea[WHD_ETHER_ADDR_LEN]; octet++)
|
||||
{
|
||||
*output++ = hex[(*octet >> 4) & 0xf];
|
||||
*output++ = hex[*octet & 0xf];
|
||||
*output++ = ':';
|
||||
}
|
||||
|
||||
*(output - 1) = '\0';
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
#endif /* WPRINT_ENABLE_WHD_DEBUG */
|
||||
|
||||
void whd_convert_security_type_to_string(whd_security_t security, char *out_str, uint16_t out_str_len)
|
||||
{
|
||||
if (security == WHD_SECURITY_OPEN)
|
||||
{
|
||||
strncat(out_str, " Open", out_str_len);
|
||||
}
|
||||
if (security & WEP_ENABLED)
|
||||
{
|
||||
strncat(out_str, " WEP", out_str_len);
|
||||
}
|
||||
if (security & WPA3_SECURITY)
|
||||
{
|
||||
strncat(out_str, " WPA3", out_str_len);
|
||||
}
|
||||
if (security & WPA2_SECURITY)
|
||||
{
|
||||
strncat(out_str, " WPA2", out_str_len);
|
||||
}
|
||||
if (security & WPA_SECURITY)
|
||||
{
|
||||
strncat(out_str, " WPA", out_str_len);
|
||||
}
|
||||
if (security & AES_ENABLED)
|
||||
{
|
||||
strncat(out_str, " AES", out_str_len);
|
||||
}
|
||||
if (security & TKIP_ENABLED)
|
||||
{
|
||||
strncat(out_str, " TKIP", out_str_len);
|
||||
}
|
||||
if (security & SHARED_ENABLED)
|
||||
{
|
||||
strncat(out_str, " SHARED", out_str_len);
|
||||
}
|
||||
if (security & ENTERPRISE_ENABLED)
|
||||
{
|
||||
strncat(out_str, " Enterprise", out_str_len);
|
||||
}
|
||||
if (security & WPS_ENABLED)
|
||||
{
|
||||
strncat(out_str, " WPS", out_str_len);
|
||||
}
|
||||
if (security & FBT_ENABLED)
|
||||
{
|
||||
strncat(out_str, " FBT", out_str_len);
|
||||
}
|
||||
if (security & IBSS_ENABLED)
|
||||
{
|
||||
strncat(out_str, " IBSS", out_str_len);
|
||||
}
|
||||
if (security == WHD_SECURITY_UNKNOWN)
|
||||
{
|
||||
strncat(out_str, " Unknown", out_str_len);
|
||||
}
|
||||
if (!(security & ENTERPRISE_ENABLED) && (security != WHD_SECURITY_OPEN) &&
|
||||
(security != WHD_SECURITY_UNKNOWN) )
|
||||
{
|
||||
strncat(out_str, " PSK", out_str_len);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
******************************************************************************
|
||||
* Prints partial details of a scan result on a single line
|
||||
*
|
||||
* @param[in] record A pointer to the whd_scan_result_t record
|
||||
*
|
||||
*/
|
||||
|
||||
void whd_print_scan_result(whd_scan_result_t *record)
|
||||
{
|
||||
const char *str = NULL;
|
||||
char sec_type_string[40] = { 0 };
|
||||
|
||||
switch (record->bss_type)
|
||||
{
|
||||
case WHD_BSS_TYPE_ADHOC:
|
||||
str = "Adhoc";
|
||||
break;
|
||||
|
||||
case WHD_BSS_TYPE_INFRASTRUCTURE:
|
||||
str = "Infra";
|
||||
break;
|
||||
|
||||
case WHD_BSS_TYPE_ANY:
|
||||
str = "Any";
|
||||
break;
|
||||
|
||||
case WHD_BSS_TYPE_MESH:
|
||||
case WHD_BSS_TYPE_UNKNOWN:
|
||||
str = "Unknown";
|
||||
break;
|
||||
|
||||
default:
|
||||
str = "?";
|
||||
break;
|
||||
}
|
||||
|
||||
UNUSED_PARAMETER(str);
|
||||
WPRINT_MACRO( ("%5s ", str) );
|
||||
WPRINT_MACRO( ("%02X:%02X:%02X:%02X:%02X:%02X ", record->BSSID.octet[0], record->BSSID.octet[1],
|
||||
record->BSSID.octet[2], record->BSSID.octet[3], record->BSSID.octet[4],
|
||||
record->BSSID.octet[5]) );
|
||||
|
||||
if (record->flags & WHD_SCAN_RESULT_FLAG_RSSI_OFF_CHANNEL)
|
||||
{
|
||||
WPRINT_MACRO( ("OFF ") );
|
||||
}
|
||||
else
|
||||
{
|
||||
WPRINT_MACRO( ("%d ", record->signal_strength) );
|
||||
}
|
||||
|
||||
if (record->max_data_rate < 100000)
|
||||
{
|
||||
WPRINT_MACRO( (" %.1f ", (double)(record->max_data_rate / 1000.0) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
WPRINT_MACRO( ("%.1f ", (double)(record->max_data_rate / 1000.0) ) );
|
||||
}
|
||||
WPRINT_MACRO( (" %3d ", record->channel) );
|
||||
|
||||
whd_convert_security_type_to_string(record->security, sec_type_string, (sizeof(sec_type_string) - 1) );
|
||||
|
||||
WPRINT_MACRO( ("%-20s ", sec_type_string) );
|
||||
WPRINT_MACRO( (" %-32s ", record->SSID.value) );
|
||||
|
||||
if (record->ccode[0] != '\0')
|
||||
{
|
||||
WPRINT_MACRO( ("%c%c ", record->ccode[0], record->ccode[1]) );
|
||||
}
|
||||
else
|
||||
{
|
||||
WPRINT_MACRO( (" ") );
|
||||
}
|
||||
|
||||
if (record->flags & WHD_SCAN_RESULT_FLAG_BEACON)
|
||||
{
|
||||
WPRINT_MACRO( (" %-15s", " BEACON") );
|
||||
}
|
||||
else
|
||||
{
|
||||
WPRINT_MACRO( (" %-15s", " PROBE ") );
|
||||
}
|
||||
WPRINT_MACRO( ("\n") );
|
||||
}
|
||||
|
||||
void whd_hexdump(uint8_t *data, uint32_t data_len)
|
||||
{
|
||||
uint32_t i;
|
||||
uint8_t buff[17] = {0};
|
||||
|
||||
UNUSED_PARAMETER(buff);
|
||||
for (i = 0; i < data_len; i++)
|
||||
{
|
||||
if ( (i % 16) == 0 )
|
||||
{
|
||||
if (i != 0)
|
||||
{
|
||||
WPRINT_MACRO( (" %s\n", buff) );
|
||||
}
|
||||
WPRINT_MACRO( ("%04" PRIx32 " ", i) );
|
||||
}
|
||||
WPRINT_MACRO( (" %02x", data[i]) );
|
||||
|
||||
if ( (data[i] < 0x20) || (data[i] > 0x7e) )
|
||||
{
|
||||
buff[i % 16] = '.';
|
||||
}
|
||||
else
|
||||
{
|
||||
buff[i % 16] = data[i];
|
||||
}
|
||||
buff[(i % 16) + 1] = '\0';
|
||||
}
|
||||
while ( (i % 16) != 0 )
|
||||
{
|
||||
WPRINT_MACRO( (" ") );
|
||||
i++;
|
||||
}
|
||||
WPRINT_MACRO( (" %s\n", buff) );
|
||||
}
|
||||
|
||||
void whd_ioctl_to_string(uint32_t cmd, char *ioctl_str, uint16_t ioctl_str_len)
|
||||
{
|
||||
if (cmd == 2)
|
||||
{
|
||||
strncpy(ioctl_str, "WLC_UP", ioctl_str_len);
|
||||
}
|
||||
else if (cmd == 20)
|
||||
{
|
||||
strncpy(ioctl_str, "WLC_SET_INFRA", ioctl_str_len);
|
||||
}
|
||||
else if (cmd == 22)
|
||||
{
|
||||
strncpy(ioctl_str, "WLC_SET_AUTH", ioctl_str_len);
|
||||
}
|
||||
else if (cmd == 26)
|
||||
{
|
||||
strncpy(ioctl_str, "WLC_SET_SSID", ioctl_str_len);
|
||||
}
|
||||
else if (cmd == 52)
|
||||
{
|
||||
strncpy(ioctl_str, "WLC_DISASSOC", ioctl_str_len);
|
||||
}
|
||||
else if (cmd == 55)
|
||||
{
|
||||
strncpy(ioctl_str, "WLC_SET_ROAM_TRIGGER", ioctl_str_len);
|
||||
}
|
||||
else if (cmd == 57)
|
||||
{
|
||||
strncpy(ioctl_str, "WLC_SET_ROAM_DELTA", ioctl_str_len);
|
||||
}
|
||||
else if (cmd == 59)
|
||||
{
|
||||
strncpy(ioctl_str, "WLC_SET_ROAM_SCAN_PERIOD", ioctl_str_len);
|
||||
}
|
||||
else if (cmd == 110)
|
||||
{
|
||||
strncpy(ioctl_str, "WLC_SET_GMODE", ioctl_str_len);
|
||||
}
|
||||
else if (cmd == 116)
|
||||
{
|
||||
strncpy(ioctl_str, "WLC_SET_SCANSUPPRESS", ioctl_str_len);
|
||||
}
|
||||
else if (cmd == 134)
|
||||
{
|
||||
strncpy(ioctl_str, "WLC_SET_WSEC", ioctl_str_len);
|
||||
}
|
||||
else if (cmd == 165)
|
||||
{
|
||||
strncpy(ioctl_str, "WLC_SET_WPA_AUTH", ioctl_str_len);
|
||||
}
|
||||
else if (cmd == 268)
|
||||
{
|
||||
strncpy(ioctl_str, "WLC_SET_WSEC_PMK", ioctl_str_len);
|
||||
}
|
||||
}
|
||||
|
||||
void whd_event_info_to_string(uint32_t cmd, uint16_t flag, uint32_t reason, char *ioctl_str, uint16_t ioctl_str_len)
|
||||
{
|
||||
if (cmd == 0)
|
||||
{
|
||||
strncpy(ioctl_str, "WLC_E_SET_SSID", ioctl_str_len);
|
||||
}
|
||||
else if (cmd == 3)
|
||||
{
|
||||
strncpy(ioctl_str, "WLC_E_AUTH ", ioctl_str_len);
|
||||
}
|
||||
else if (cmd == 16)
|
||||
{
|
||||
strncpy(ioctl_str, "WLC_E_LINK ", ioctl_str_len);
|
||||
}
|
||||
else if (cmd == 46)
|
||||
{
|
||||
strncpy(ioctl_str, "WLC_E_PSK_SUP ", ioctl_str_len);
|
||||
}
|
||||
else if (cmd == 54)
|
||||
{
|
||||
strncpy(ioctl_str, "WLC_E_IF ", ioctl_str_len);
|
||||
}
|
||||
else if (cmd == 69)
|
||||
{
|
||||
strncpy(ioctl_str, "WLC_E_ESCAN_RESULT", ioctl_str_len);
|
||||
}
|
||||
|
||||
if (flag == 0)
|
||||
{
|
||||
strncat(ioctl_str, " WLC_E_STATUS_SUCCESS", ioctl_str_len);
|
||||
}
|
||||
if (flag == 8)
|
||||
{
|
||||
strncat(ioctl_str, " WLC_E_STATUS_PARTIAL", ioctl_str_len);
|
||||
}
|
||||
else if (flag == 262)
|
||||
{
|
||||
strncat(ioctl_str, " WLC_SUP_KEYED ", ioctl_str_len);
|
||||
}
|
||||
|
||||
if (reason == 0)
|
||||
{
|
||||
strncat(ioctl_str, " WLC_E_REASON_INITIAL_ASSOC", ioctl_str_len);
|
||||
}
|
||||
else if (reason == 512)
|
||||
{
|
||||
strncat(ioctl_str, " WLC_E_SUP_OTHER", ioctl_str_len);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
*
|
||||
* Implements functions called by WHD user APIs, but not directly exposed to user
|
||||
*
|
||||
* This file provides functions which are not directly exposed to user but, called by end-user functions which allow actions such as
|
||||
* seting the MAC address, getting channel info, etc
|
||||
*/
|
||||
|
||||
#include "whd_ap.h"
|
||||
#include "whd_chip_constants.h"
|
||||
#include "whd_debug.h"
|
||||
#include "whd_events_int.h"
|
||||
#include "whd_cdc_bdc.h"
|
||||
#include "whd_thread_internal.h"
|
||||
#include "whd_utils.h"
|
||||
#include "whd_wifi_api.h"
|
||||
#include "whd_wlioctl.h"
|
||||
|
||||
/******************************************************
|
||||
* @cond Constants
|
||||
******************************************************/
|
||||
#define MAC_ADDRESS_LOCALLY_ADMINISTERED_BIT 0x02
|
||||
|
||||
/******************************************************
|
||||
* Local Structures
|
||||
******************************************************/
|
||||
|
||||
|
||||
|
||||
/******************************************************
|
||||
* Variables
|
||||
******************************************************/
|
||||
void (*whd_wifi_link_update_callback)(void) = NULL;
|
||||
|
||||
/******************************************************
|
||||
* Function definitions
|
||||
******************************************************/
|
||||
|
||||
uint32_t whd_wifi_set_mac_address(whd_interface_t ifp, whd_mac_t mac)
|
||||
{
|
||||
whd_buffer_t buffer;
|
||||
uint32_t *data;
|
||||
whd_driver_t whd_driver = ifp->whd_driver;
|
||||
|
||||
/* AP interface needs to come up with MAC different from STA */
|
||||
#ifdef APOLLO_AUDIO
|
||||
|
||||
/* Work around the issue of asking API to set one address and it sets a different address.
|
||||
* This will cause any comparison of set and get mac address to fail. TODO: move twiddling this
|
||||
* bit to a higher level.
|
||||
*/
|
||||
if (0)
|
||||
#else
|
||||
if (ifp->role == WHD_AP_ROLE)
|
||||
#endif
|
||||
{
|
||||
whd_mac_t ap_mac_address;
|
||||
|
||||
memcpy(&ap_mac_address, &mac, sizeof(whd_mac_t) );
|
||||
if (ap_mac_address.octet[0] & MAC_ADDRESS_LOCALLY_ADMINISTERED_BIT)
|
||||
{
|
||||
ap_mac_address.octet[0] &= (uint8_t) ~(MAC_ADDRESS_LOCALLY_ADMINISTERED_BIT);
|
||||
}
|
||||
else
|
||||
{
|
||||
ap_mac_address.octet[0] |= MAC_ADDRESS_LOCALLY_ADMINISTERED_BIT;
|
||||
}
|
||||
|
||||
data = (uint32_t *)whd_cdc_get_iovar_buffer(whd_driver, &buffer, sizeof(whd_mac_t), IOVAR_STR_CUR_ETHERADDR);
|
||||
CHECK_IOCTL_BUFFER(data);
|
||||
memcpy(data, &ap_mac_address, sizeof(whd_mac_t) );
|
||||
CHECK_RETURN(whd_cdc_send_iovar(ifp, CDC_SET, buffer, NULL) );
|
||||
|
||||
if (memcmp(&mac, &ap_mac_address, sizeof(whd_mac_t) ) != 0)
|
||||
{
|
||||
WPRINT_WHD_INFO( (" STA MAC address : %02x:%02x:%02x:%02x:%02x:%02x \n"
|
||||
" AP MAC address : %02x:%02x:%02x:%02x:%02x:%02x \n",
|
||||
mac.octet[0], mac.octet[1], mac.octet[2],
|
||||
mac.octet[3], mac.octet[4], mac.octet[3],
|
||||
ap_mac_address.octet[0], ap_mac_address.octet[1], ap_mac_address.octet[2],
|
||||
ap_mac_address.octet[3], ap_mac_address.octet[4], ap_mac_address.octet[3]) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
data = (uint32_t *)whd_cdc_get_iovar_buffer(whd_driver, &buffer, sizeof(whd_mac_t), IOVAR_STR_CUR_ETHERADDR);
|
||||
CHECK_IOCTL_BUFFER(data);
|
||||
memcpy(data, &mac, sizeof(whd_mac_t) );
|
||||
CHECK_RETURN(whd_cdc_send_iovar(ifp, CDC_SET, buffer, NULL) );
|
||||
}
|
||||
|
||||
return WHD_SUCCESS;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright 2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "whd_ap.h"
|
||||
#include "whd_chip_constants.h"
|
||||
#include "whd_debug.h"
|
||||
#include "whd_events_int.h"
|
||||
#include "whd_sdpcm.h"
|
||||
#include "whd_thread_internal.h"
|
||||
#include "whd_utils.h"
|
||||
#include "whd_wifi_api.h"
|
||||
#include "whd_wifi_p2p.h"
|
||||
|
||||
|
||||
/******************************************************
|
||||
* @cond Constants
|
||||
******************************************************/
|
||||
|
||||
whd_bool_t whd_wifi_p2p_is_go_up(whd_driver_t whd_driver)
|
||||
{
|
||||
return whd_driver->internal_info.whd_wifi_p2p_go_is_up;
|
||||
}
|
||||
|
||||
void whd_wifi_p2p_set_go_is_up(whd_driver_t whd_driver, whd_bool_t is_up)
|
||||
{
|
||||
if (whd_driver->internal_info.whd_wifi_p2p_go_is_up != is_up)
|
||||
{
|
||||
whd_driver->internal_info.whd_wifi_p2p_go_is_up = is_up;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue