1 /*
2  * Copyright (c) 2006-2021, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  */
9 
10 #ifndef __SDCARD_H
11 #define __SDCARD_H
12 
13 #include <rtthread.h>
14 
15 #ifdef RT_USING_DFS
16 
17 #include  <sep4020.h>
18 
19 #define INICLK  300000
20 #define SDCLK   24000000    //PCLK=49.392MHz
21 #define MMCCLK  15000000    //PCLK=49.392MHz
22 
23 /*struct of the SDC*/
24 struct  sd_c
25 {
26     __IO rt_uint32_t    clk_ctl;
27     __IO rt_uint32_t    soft_rst;
28     __IO rt_uint32_t    arg;
29     __IO rt_uint32_t    cmd;
30     __IO rt_uint32_t    blk_sz;
31     __IO rt_uint32_t    blk_cnt;
32     __IO rt_uint32_t    trans_mode;
33     __O  rt_uint32_t    response0;
34     __O  rt_uint32_t    response1;
35     __O  rt_uint32_t    response2;
36     __O  rt_uint32_t    response3;
37     __IO rt_uint32_t    rd_to_ctl;
38     __IO rt_uint32_t    int_stat;
39     __IO rt_uint32_t    int_stat_mask;
40     __O  rt_uint32_t    rx_fifo;
41     __I  rt_uint32_t    tx_fifo;
42 };
43 
44 /*sdcard driver structure*/
45 struct  sd_device
46 {
47     struct rt_device        *device;    /*rt_device*/
48     struct sd_c         *sdc;       /*SDCARD register*/
49     struct dfs_partition    *part;      /*dfs partitions*/
50     rt_uint8_t      *sec_buf;   /*sdcard buffer*/
51     rt_uint32_t     part_num;   /*partiont numbers*/
52     rt_uint32_t     buf_size;   /*buffer size*/
53 };
54 
55 #endif
56 #endif
57 
58