1 /** @file sdio.h 2 * 3 * @brief SDIO Generic API related header file 4 * 5 * Copyright 2021-2024 NXP 6 * 7 * SPDX-License-Identifier: BSD-3-Clause 8 * 9 */ 10 #ifndef _SDIO_H_ 11 #define _SDIO_H_ 12 13 #include <wmerrno.h> 14 #include "type_decls.h" 15 #include <osa.h> 16 17 #include <wifi.h> 18 #include <zephyr/sd/sdio.h> 19 20 /*! @brief Data block count accessed in card */ 21 #define DATA_BLOCK_COUNT (4U) 22 /*! @brief Data buffer size. */ 23 #define DATA_BUFFER_SIZE (SDMMC_DEFAULT_BLOCK_SIZE * DATA_BLOCK_COUNT) 24 25 /** The number of times to try when polling for status bits */ 26 #if defined(SD8997) 27 #define MAX_POLL_TRIES 10000U 28 #else 29 #define MAX_POLL_TRIES 100U 30 #endif 31 32 #define sdio_io_e(...) wmlog_e("wifi_io", ##__VA_ARGS__) 33 #define sdio_io_w(...) wmlog_w("wifi_io", ##__VA_ARGS__) 34 35 #if CONFIG_SDIO_IO_DEBUG 36 #define sdio_io_d(...) wmlog("wifi_io", ##__VA_ARGS__) 37 #else 38 #define sdio_io_d(...) 39 #endif /* ! CONFIG_SDIO_IO_DEBUG */ 40 41 #if CONFIG_SDIO_MULTI_PORT_RX_AGGR 42 #define INBUF_SIZE (SDIO_MP_AGGR_DEF_PKT_LIMIT * 2 * DATA_BUFFER_SIZE) 43 #else 44 #define INBUF_SIZE (2 * DATA_BUFFER_SIZE) 45 #endif /*CONFIG_SDIO_MULTI_PORT_RX_AGGR*/ 46 47 extern uint8_t outbuf[]; 48 49 extern uint8_t inbuf[]; 50 51 /** Card Control Registers : Function 1 Block size 0 */ 52 #define FN1_BLOCK_SIZE_0 0x110 53 /** Card Control Registers : Function 1 Block size 1 */ 54 #define FN1_BLOCK_SIZE_1 0x111 55 56 int sdio_init(void); 57 int sdio_ioport_init(void); 58 void calculate_sdio_write_params(t_u32 txlen, t_u32 *tx_blocks, t_u32 *buflen); 59 bool wlan_card_status(t_u8 bits); 60 t_u16 wlan_card_read_f1_base_regs(void); 61 uint8_t *wifi_get_sdio_outbuf(uint32_t *outbuf_len); 62 unsigned int wifi_get_sdio_ioport(); 63 64 #endif //_SDIO_H_ 65