SAMA5D4 Xplained Ultra Board BSP
guowenxue
2019-08-19 2e7235d10c6dbff81960282e1a1e2e798f9b8db8
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/******************************************************************************
 *
 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of version 2 of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
 *
 *
 ******************************************************************************/
#ifndef __DRV_TYPES_SDIO_H__
#define __DRV_TYPES_SDIO_H__
 
/* SDIO Header Files */
#ifdef PLATFORM_LINUX
    #include <linux/mmc/sdio_func.h>
    #include <linux/mmc/sdio_ids.h>
 
    #if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) || defined(CONFIG_PLATFORM_SPRD)
        #include <linux/mmc/host.h>
        #include <linux/mmc/card.h>
    #endif
 
    #ifdef CONFIG_PLATFORM_SPRD
        #include <linux/gpio.h>
        #include <custom_gpio.h>
    #endif /* CONFIG_PLATFORM_SPRD */
#endif
 
#ifdef PLATFORM_OS_XP
    #include <wdm.h>
    #include <ntddsd.h>
#endif
 
#ifdef PLATFORM_OS_CE
    #include <sdcardddk.h>
#endif
 
 
typedef struct sdio_data {
    u8  func_number;
 
    u8  tx_block_mode;
    u8  rx_block_mode;
    u32 block_transfer_len;
 
#ifdef PLATFORM_LINUX
    struct sdio_func    *func;
    _thread_hdl_ sys_sdio_irq_thd;
#endif
 
#ifdef PLATFORM_OS_XP
    PDEVICE_OBJECT                pphysdevobj;
    PDEVICE_OBJECT                pfuncdevobj;
    PDEVICE_OBJECT                pnextdevobj;
    SDBUS_INTERFACE_STANDARD    sdbusinft;
    u8                            nextdevstacksz;
#endif
 
#ifdef PLATFORM_OS_CE
    SD_DEVICE_HANDLE            hDevice;
    SD_CARD_RCA                    sd_rca;
    SD_CARD_INTERFACE            card_intf;
    BOOLEAN                        enableIsarWithStatus;
    WCHAR                        active_path[MAX_ACTIVE_REG_PATH];
    SD_HOST_BLOCK_CAPABILITY    sd_host_blk_cap;
#endif
} SDIO_DATA, *PSDIO_DATA;
 
#define dvobj_to_sdio_func(d)    ((d)->intf_data.func)
 
#define RTW_SDIO_ADDR_CMD52_BIT        (1<<17)
#define RTW_SDIO_ADDR_CMD52_GEN(a)    (a | RTW_SDIO_ADDR_CMD52_BIT)
#define RTW_SDIO_ADDR_CMD52_CLR(a)    (a&~RTW_SDIO_ADDR_CMD52_BIT)
#define RTW_SDIO_ADDR_CMD52_CHK(a)    (a&RTW_SDIO_ADDR_CMD52_BIT ? 1 : 0)
 
#define RTW_SDIO_ADDR_F0_BIT        (1<<18)
#define RTW_SDIO_ADDR_F0_GEN(a)        (a | RTW_SDIO_ADDR_F0_BIT)
#define RTW_SDIO_ADDR_F0_CLR(a)        (a&~RTW_SDIO_ADDR_F0_BIT)
#define RTW_SDIO_ADDR_F0_CHK(a)        (a&RTW_SDIO_ADDR_F0_BIT ? 1 : 0)
 
#endif