summaryrefslogtreecommitdiff
path: root/bsp/ht32/libraries/ht32_drivers/drv_sdio.h
blob: a66c96ef23595c4f0449a7736dab53b3fa510266 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 * Copyright (c) 2006-2024, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2024-11-06     QT-one       first version
 */

#ifndef __DRV_SDIO_H__
#define __DRV_SDIO_H__

#include <rtthread.h>
#include <rtdevice.h>

#include <string.h>
#include "drv_common.h"

#ifdef __cplusplus
extern "C" {
#endif

#ifndef SDIO_BASE_ADDRESS
#define SDIO_BASE_ADDRESS                      HT_SDIO
#endif

#ifndef SDIO_CLOCK_FREQ
#define SDIO_CLOCK_FREQ                        (48U * 1000 * 1000)
#endif

#ifndef SDIO_BUFF_SIZE
#define SDIO_BUFF_SIZE                         (4096)
#endif

#ifndef SDIO_ALIGN_LEN
#define SDIO_ALIGN_LEN                         (32)
#endif

#ifndef SDIO_MAX_FREQ
#define SDIO_MAX_FREQ                          (24 * 1000 * 1000)
#endif

#define HW_SDIO_CMD_FLAG \
    (SDIO_INT_CMD_SEND | SDIO_FLAG_CMD_TIMEOUT | SDIO_FLAG_CMD_CRCERR | SDIO_FLAG_CMD_IDXERR)

#define HW_SDIO_DATA_FLAG \
    (SDIO_FLAG_BUF_OVERFLOW | SDIO_FLAG_BUF_UNDERFLOW | SDIO_FLAG_DATA_CRCERR | SDIO_FLAG_DATA_TIMEOUT | SDIO_FLAG_TRANS_END)

#define HW_SDIO_DATATIMEOUT                    (0x000FFFFF)

void ht32_mmcsd_change(void);

#ifdef __cplusplus
}
#endif

#endif /* __DRV_SDIO_H__ */