1 /** @file wifi-imu.h 2 * 3 * @brief WLAN on IMU 4 * 5 * Copyright 2022-2024 NXP 6 * 7 * SPDX-License-Identifier: BSD-3-Clause 8 * 9 */ 10 11 #ifndef __WIFI_IMU_H__ 12 #define __WIFI_IMU_H__ 13 14 #include <wifi.h> 15 #include "fsl_power.h" 16 17 #ifndef RW610 18 #include "firmware_dnld.h" 19 #endif 20 21 #define wifi_io_e(...) wmlog_e("wifi_io", ##__VA_ARGS__) 22 #define wifi_io_w(...) wmlog_w("wifi_io", ##__VA_ARGS__) 23 24 #if CONFIG_WIFI_IO_DEBUG 25 #define wifi_io_d(...) wmlog("wifi_io", ##__VA_ARGS__) 26 #else 27 #define wifi_io_d(...) 28 #endif /* ! CONFIG_WIFI_IO_DEBUG */ 29 30 #define wifi_io_info_e(...) wmlog_e("wpkt", ##__VA_ARGS__) 31 #define wifi_io_info_w(...) wmlog_w("wpkt", ##__VA_ARGS__) 32 33 #if CONFIG_WIFI_IO_INFO_DUMP 34 #define wifi_io_info_d(...) wmlog("wpkt", ##__VA_ARGS__) 35 #else 36 #define wifi_io_info_d(...) 37 #endif 38 39 #define WLAN_MAGIC_NUM (('W' << 0) | ('L' << 8) | ('F' << 16) | ('W' << 24)) 40 41 #define WIFI_FW_CMDBUF_SIZE 3072U 42 43 #define WIFI_RESP_WAIT_TIME 10 44 45 #define WLAN_VALUE1 0x45001114 46 47 /*! @brief Data block count accessed in card */ 48 #define DATA_BLOCK_COUNT (4U) 49 /*! @brief Data buffer size. */ 50 #define DATA_BUFFER_SIZE (512 * DATA_BLOCK_COUNT) 51 52 /** Card Control Registers : Function 1 Block size 0 */ 53 #define FN1_BLOCK_SIZE_0 0x110 54 /** Card Control Registers : Function 1 Block size 1 */ 55 #define FN1_BLOCK_SIZE_1 0x111 56 57 /* Duplicated in wlan.c. keep in sync till we can be included directly */ 58 typedef struct __nvram_backup_struct 59 { 60 t_u32 ioport; 61 t_u32 curr_wr_port; 62 t_u32 curr_rd_port; 63 t_u32 mp_end_port; 64 t_u32 bss_num; 65 t_u32 sta_mac_addr1; 66 t_u32 sta_mac_addr2; 67 t_u32 wifi_state; 68 } nvram_backup_t; 69 #ifndef RW610 70 extern osa_task_handle_t wifi_core_thread; 71 #endif 72 extern bool g_txrx_flag; 73 #ifdef WLAN_LOW_POWER_ENABLE 74 extern bool low_power_mode; 75 #endif 76 extern bool cal_data_valid; 77 extern bool mac_addr_valid; 78 #if CONFIG_WIFI_TX_BUFF 79 extern uint16_t tx_buf_size; 80 #endif 81 extern bool txpwrlimit_data_valid; 82 extern uint8_t trpc_country; 83 extern bus_operations imu_ops; 84 85 mlan_status imu_wifi_init(enum wlan_type type, const uint8_t *fw_ram_start_addr, const size_t size); 86 void imu_wifi_deinit(void); 87 void imu_uninstall_callback(void); 88 89 /* 90 * @internal 91 * 92 * 93 */ 94 int wlan_send_imu_cmd(t_u8 *buf); 95 96 /* 97 * @internal 98 * 99 * 100 */ 101 int wifi_send_cmdbuffer(void); 102 103 /* 104 * @internal 105 * 106 * 107 */ 108 HostCmd_DS_COMMAND *wifi_get_command_buffer(void); 109 110 mlan_status wlan_xmit_pkt(t_u8 *buffer, t_u32 txlen, t_u8 interface, t_u32 tx_control); 111 int raw_process_pkt_hdrs(void *pbuf, t_u32 payloadlen, t_u8 interface); 112 uint32_t wifi_get_device_value1(); 113 114 uint8_t *wifi_get_imu_outbuf(uint32_t *outbuf_len); 115 116 void process_pkt_hdrs(void *pbuf, t_u32 payloadlen, t_u8 interface, t_u8 tid, t_u32 tx_control); 117 118 #if CONFIG_WIFI_FW_DEBUG 119 extern void wifi_dump_firmware_info(); 120 #endif /* CONFIG_WIFI_FW_DEBUG */ 121 122 #if CONFIG_WMM 123 mlan_status wlan_xmit_wmm_pkt(t_u8 interface, t_u32 txlen, t_u8 *tx_buf); 124 mlan_status wlan_flush_wmm_pkt(int pkt_cnt); 125 mlan_status wlan_xmit_bypass_pkt(t_u8 *buffer, t_u32 txlen, t_u8 interface); 126 #if CONFIG_AMSDU_IN_AMPDU 127 uint8_t *wifi_get_amsdu_outbuf(uint32_t offset); 128 mlan_status wlan_xmit_wmm_amsdu_pkt(mlan_wmm_ac_e ac, t_u8 interface, t_u32 txlen, t_u8 *tx_buf, t_u8 amsdu_cnt); 129 #endif 130 #endif 131 132 void imu_wakeup_card(); 133 #if CONFIG_WIFI_TX_BUFF 134 int _wlan_return_all_tx_buf(imu_link_t link); 135 #endif 136 137 int imu_create_task_lock(void); 138 void imu_delete_task_lock(void); 139 int imu_get_task_lock(void); 140 int imu_put_task_lock(void); 141 #endif /* __WIFI_SDIO_H__ */ 142