1 /*
2  * Copyright (c) 2006-2024, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2024-11-06     QT-one       first version
9  */
10 
11 #ifndef __DRV_SDIO_H__
12 #define __DRV_SDIO_H__
13 
14 #include <rtthread.h>
15 #include <rtdevice.h>
16 
17 #include <string.h>
18 #include "drv_common.h"
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 #ifndef SDIO_BASE_ADDRESS
25 #define SDIO_BASE_ADDRESS                      HT_SDIO
26 #endif
27 
28 #ifndef SDIO_CLOCK_FREQ
29 #define SDIO_CLOCK_FREQ                        (48U * 1000 * 1000)
30 #endif
31 
32 #ifndef SDIO_BUFF_SIZE
33 #define SDIO_BUFF_SIZE                         (4096)
34 #endif
35 
36 #ifndef SDIO_ALIGN_LEN
37 #define SDIO_ALIGN_LEN                         (32)
38 #endif
39 
40 #ifndef SDIO_MAX_FREQ
41 #define SDIO_MAX_FREQ                          (24 * 1000 * 1000)
42 #endif
43 
44 #define HW_SDIO_CMD_FLAG \
45     (SDIO_INT_CMD_SEND | SDIO_FLAG_CMD_TIMEOUT | SDIO_FLAG_CMD_CRCERR | SDIO_FLAG_CMD_IDXERR)
46 
47 #define HW_SDIO_DATA_FLAG \
48     (SDIO_FLAG_BUF_OVERFLOW | SDIO_FLAG_BUF_UNDERFLOW | SDIO_FLAG_DATA_CRCERR | SDIO_FLAG_DATA_TIMEOUT | SDIO_FLAG_TRANS_END)
49 
50 #define HW_SDIO_DATATIMEOUT                    (0x000FFFFF)
51 
52 void ht32_mmcsd_change(void);
53 
54 #ifdef __cplusplus
55 }
56 #endif
57 
58 #endif /* __DRV_SDIO_H__ */
59