1 // Copyright (C) 2022 Beken Corporation 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #pragma once 16 17 #ifdef __cplusplus 18 extern "C" { 19 #endif 20 21 #include "bk_list.h" 22 23 #define SDIO_DEV_NAME "sdio" 24 25 #define SDIO_FAILURE ((UINT32)-1) 26 #define SDIO_SUCCESS (0) 27 28 #define BLOCK_LEN 512 29 30 #define H2S_RD_SYNC (1) 31 #define H2S_WR_SYNC (2) 32 #define H2S_RD_SPECIAL (5) 33 34 #define S2H_WR_SPECIAL (6) 35 #define S2H_RD_SYNC (3) 36 #define S2H_WR_SYNC (4) 37 38 #define SDIO_DUMMY_BUFF_ADDR (0x100) 39 #define SDIO_DUMMY_LENGTH (0x100) 40 41 #define SDIO_CMD_GET_FREE_NODE (0xBB) 42 #define SDIO_CMD_REG_RX_CALLBACK (0xBC) 43 #define SDIO_CMD_PUSH_FREE_NODE (0xBD) 44 #define SDIO_CMD_GET_CNT_FREE_NODE (0xBE) 45 #define SDIO_CMD_CLEAR_TX_VALID (0xC0) 46 #define SDIO_CMD_SET_TX_VALID (0xC1) 47 #define SDIO_CMD_PEEK_H2S_COUNT (0xC2) 48 #define SDIO_CMD_PEEK_S2H_COUNT (0xC3) 49 #define SDIO_CMD_SET_TX_LEN (0xC4) 50 51 typedef void (*SDIO_FUNC)(void *Lparam, void *Rparam); 52 53 typedef struct _sdio_mem_node_ 54 { 55 LIST_HEADER_T node_list; 56 57 UINT8 *orig_addr; 58 59 UINT8 *addr; 60 UINT32 length; 61 62 SDIO_FUNC callback; 63 void *Lparam; 64 void *Rparam; 65 int ac; 66 } SDIO_NODE_T, *SDIO_NODE_PTR; 67 68 struct get_free_node_param { 69 UINT32 size; 70 UINT8 tid; 71 }; 72 73 extern int sdio_debug_level; 74 75 /******************************************************************************* 76 * Function Declarations 77 *******************************************************************************/ 78 void sdio_init(void); 79 void sdio_exit(void); 80 81 #ifdef __cplusplus 82 } 83 #endif 84