1 /* 2 * Copyright 2022, Cypress Semiconductor Corporation (an Infineon company) 3 * SPDX-License-Identifier: Apache-2.0 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 /** @file 19 * Header for whd_driver structure 20 */ 21 22 #ifndef INCLUDED_WHD_INT_H 23 #define INCLUDED_WHD_INT_H 24 25 #include "whd_thread.h" 26 #include "whd_sdpcm.h" 27 #include "whd_cdc_bdc.h" 28 #include "whd_chip.h" 29 #include "whd_ap.h" 30 #include "whd_debug.h" 31 32 #ifdef __cplusplus 33 extern "C" 34 { 35 #endif 36 37 typedef struct 38 { 39 uint32_t tx_total; /* Total number of TX packets sent from WHD */ 40 uint32_t rx_total; /* Total number of RX packets received at WHD */ 41 uint32_t tx_no_mem; /* Number of times WHD could not send due to no buffer */ 42 uint32_t rx_no_mem; /* Number of times WHD could not receive due to no buffer */ 43 uint32_t tx_fail; /* Number of times TX packet failed */ 44 uint32_t no_credit; /* Number of times WHD could not send due to no credit */ 45 uint32_t flow_control; /* Number of times WHD Flow control is enabled */ 46 uint32_t internal_host_buffer_fail_with_timeout; /* Internal host buffer get failed after timeout */ 47 } whd_stats_t; 48 49 #define WHD_INTERFACE_MAX 3 50 typedef enum 51 { 52 WHD_INVALID_ROLE = 0, 53 WHD_STA_ROLE = 1, /**< STA or Client Interface */ 54 WHD_AP_ROLE = 2, /**< softAP Interface */ 55 WHD_P2P_ROLE = 3, /**< P2P Interface */ 56 } whd_interface_role_t; 57 58 59 struct whd_interface 60 { 61 whd_driver_t whd_driver; 62 uint8_t ifidx; 63 uint8_t bsscfgidx; 64 65 char if_name[WHD_MSG_IFNAME_MAX]; 66 whd_interface_role_t role; 67 whd_mac_t mac_addr; 68 uint8_t event_reg_list[WHD_EVENT_ENTRY_MAX]; 69 whd_bool_t state; 70 }; 71 struct whd_bt_dev 72 { 73 void *bt_data; 74 void (*bt_int_cb)(void *data); 75 uint32_t bt_use_count; 76 whd_bool_t intr; 77 }; 78 79 struct whd_bt_info 80 { 81 uint32_t bt_buf_reg_addr; 82 uint32_t host_ctrl_reg_addr; 83 uint32_t bt_ctrl_reg_addr; 84 uint32_t wlan_buf_addr; 85 }; 86 87 struct whd_driver 88 { 89 whd_interface_t iflist[WHD_INTERFACE_MAX]; 90 uint8_t if2ifp[WHD_INTERFACE_MAX]; 91 92 /* Bus variables */ 93 struct whd_bus_info *bus_if; 94 struct whd_bus_priv *bus_priv; 95 struct whd_bus_common_info *bus_common_info; 96 whd_bt_dev_t bt_dev; 97 98 whd_buffer_funcs_t *buffer_if; 99 whd_netif_funcs_t *network_if; 100 whd_resource_source_t *resource_if; 101 uint8_t *aligned_addr; 102 103 whd_bool_t bus_gspi_32bit; 104 105 whd_thread_info_t thread_info; 106 whd_cdc_bdc_info_t cdc_bdc_info; 107 whd_error_info_t error_info; 108 whd_sdpcm_info_t sdpcm_info; 109 whd_internal_info_t internal_info; 110 whd_ap_int_info_t ap_info; 111 whd_chip_info_t chip_info; 112 113 whd_stats_t whd_stats; 114 whd_country_code_t country; 115 116 whd_ioctl_log_t whd_ioctl_log[WHD_IOCTL_LOG_SIZE]; 117 int whd_ioctl_log_index; 118 cy_semaphore_t whd_log_mutex; 119 }; 120 121 whd_result_t whd_add_interface(whd_driver_t whd_driver, uint8_t bsscfgidx, uint8_t ifidx, 122 const char *name, whd_mac_t *mac_addr, whd_interface_t *ifpp); 123 124 whd_result_t whd_add_primary_interface(whd_driver_t whd_driver, whd_interface_t *ifpp); 125 126 whd_interface_t whd_get_primary_interface(whd_driver_t whd_driver); 127 128 129 #ifdef __cplusplus 130 } /* extern "C" */ 131 #endif 132 #endif /* INCLUDED_WHD_INT_H */ 133