Omap35xxPkg/MmcHostDxe: Clean code to respect EDK2 coding convention
[mirror_edk2.git] / EmbeddedPkg / Include / Protocol / MmcHost.h
CommitLineData
1bfda055 1/** @file\r
2 Definition of the MMC Host Protocol\r
3\r
4 Copyright (c) 2011, ARM Limited. All rights reserved.\r
5 \r
6 This program and the accompanying materials \r
7 are licensed and made available under the terms and conditions of the BSD License \r
8 which accompanies this distribution. The full text of the license may be found at \r
9 http://opensource.org/licenses/bsd-license.php \r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
13\r
14**/\r
15\r
16#ifndef __MMC_HOST_H__\r
17#define __MMC_HOST_H__\r
18\r
19///\r
20/// Global ID for the MMC Host Protocol\r
21///\r
22#define EFI_MMC_HOST_PROTOCOL_GUID \\r
23 { 0x3e591c00, 0x9e4a, 0x11df, {0x92, 0x44, 0x00, 0x02, 0xA5, 0xD5, 0xC5, 0x1B } }\r
24\r
25#define MMC_RESPONSE_TYPE_R1 0\r
26#define MMC_RESPONSE_TYPE_R1b 0\r
27#define MMC_RESPONSE_TYPE_R2 1\r
28#define MMC_RESPONSE_TYPE_R3 0\r
29#define MMC_RESPONSE_TYPE_R6 0\r
30#define MMC_RESPONSE_TYPE_R7 0\r
31#define MMC_RESPONSE_TYPE_OCR 0\r
32#define MMC_RESPONSE_TYPE_CID 1\r
33#define MMC_RESPONSE_TYPE_CSD 1\r
34#define MMC_RESPONSE_TYPE_RCA 0\r
35\r
36typedef UINT32 MMC_RESPONSE_TYPE;\r
37\r
38typedef UINT32 MMC_CMD;\r
39\r
40#define MMC_CMD_WAIT_RESPONSE (1 << 16)\r
41#define MMC_CMD_LONG_RESPONSE (1 << 17)\r
2b826e73 42#define MMC_CMD_NO_CRC_RESPONSE (1 << 18)\r
1bfda055 43\r
2b826e73 44#define MMC_INDX(Index) ((Index) & 0xFFFF)\r
45#define MMC_GET_INDX(MmcCmd) ((MmcCmd) & 0xFFFF)\r
1bfda055 46\r
2b826e73 47#define MMC_CMD0 (MMC_INDX(0) | MMC_CMD_NO_CRC_RESPONSE)\r
48#define MMC_CMD1 (MMC_INDX(1) | MMC_CMD_WAIT_RESPONSE | MMC_CMD_NO_CRC_RESPONSE)\r
1bfda055 49#define MMC_CMD2 (MMC_INDX(2) | MMC_CMD_WAIT_RESPONSE | MMC_CMD_LONG_RESPONSE)\r
50#define MMC_CMD3 (MMC_INDX(3) | MMC_CMD_WAIT_RESPONSE)\r
2b826e73 51#define MMC_CMD5 (MMC_INDX(5) | MMC_CMD_WAIT_RESPONSE | MMC_CMD_NO_CRC_RESPONSE)\r
1bfda055 52#define MMC_CMD7 (MMC_INDX(7) | MMC_CMD_WAIT_RESPONSE)\r
53#define MMC_CMD8 (MMC_INDX(8) | MMC_CMD_WAIT_RESPONSE)\r
54#define MMC_CMD9 (MMC_INDX(9) | MMC_CMD_WAIT_RESPONSE | MMC_CMD_LONG_RESPONSE)\r
55#define MMC_CMD11 (MMC_INDX(11) | MMC_CMD_WAIT_RESPONSE)\r
56#define MMC_CMD12 (MMC_INDX(12) | MMC_CMD_WAIT_RESPONSE)\r
57#define MMC_CMD13 (MMC_INDX(13) | MMC_CMD_WAIT_RESPONSE)\r
58#define MMC_CMD16 (MMC_INDX(16) | MMC_CMD_WAIT_RESPONSE)\r
59#define MMC_CMD17 (MMC_INDX(17) | MMC_CMD_WAIT_RESPONSE)\r
60#define MMC_CMD18 (MMC_INDX(18) | MMC_CMD_WAIT_RESPONSE)\r
61#define MMC_CMD20 (MMC_INDX(20) | MMC_CMD_WAIT_RESPONSE)\r
62#define MMC_CMD23 (MMC_INDX(23) | MMC_CMD_WAIT_RESPONSE)\r
63#define MMC_CMD24 (MMC_INDX(24) | MMC_CMD_WAIT_RESPONSE)\r
64#define MMC_CMD55 (MMC_INDX(55) | MMC_CMD_WAIT_RESPONSE)\r
2b826e73 65#define MMC_ACMD41 (MMC_INDX(41) | MMC_CMD_WAIT_RESPONSE | MMC_CMD_NO_CRC_RESPONSE)\r
1bfda055 66\r
67typedef enum _MMC_STATE {\r
68 MmcInvalidState = 0,\r
69 MmcHwInitializationState,\r
70 MmcIdleState,\r
71 MmcReadyState,\r
72 MmcIdentificationState,\r
73 MmcStandByState,\r
74 MmcTransferState,\r
75 MmcSendingDataState,\r
76 MmcReceiveDataState,\r
77 MmcProgrammingState,\r
78 MmcDisconnectState,\r
79} MMC_STATE;\r
80\r
81typedef BOOLEAN (*MMC_ISCARDPRESENT)();\r
82\r
83typedef BOOLEAN (*MMC_ISREADONLY)();\r
84\r
85typedef EFI_STATUS (*MMC_BUILDDEVICEPATH)(EFI_DEVICE_PATH_PROTOCOL **DevicePath);\r
86\r
87typedef EFI_STATUS (*MMC_NOTIFYSTATE)(MMC_STATE State);\r
88\r
89typedef EFI_STATUS (*MMC_SENDCOMMAND)(MMC_CMD Cmd, UINT32 Argument);\r
90\r
91typedef EFI_STATUS (*MMC_RECEIVERESPONSE)(MMC_RESPONSE_TYPE Type, UINT32* Buffer);\r
92\r
93typedef EFI_STATUS (*MMC_READBLOCKDATA)(EFI_LBA Lba, UINTN Length, UINT32* Buffer);\r
94\r
95typedef EFI_STATUS (*MMC_WRITEBLOCKDATA)(EFI_LBA Lba, UINTN Length, UINT32* Buffer);\r
96\r
97typedef struct _EFI_MMC_HOST_PROTOCOL {\r
98 MMC_ISCARDPRESENT IsCardPresent;\r
99 MMC_ISREADONLY IsReadOnly;\r
100 MMC_BUILDDEVICEPATH BuildDevicePath;\r
101\r
102 MMC_NOTIFYSTATE NotifyState;\r
103\r
104 MMC_SENDCOMMAND SendCommand;\r
105 MMC_RECEIVERESPONSE ReceiveResponse;\r
106\r
107 MMC_READBLOCKDATA ReadBlockData;\r
108 MMC_WRITEBLOCKDATA WriteBlockData;\r
109} EFI_MMC_HOST_PROTOCOL;\r
110\r
111extern EFI_GUID gEfiMmcHostProtocolGuid;\r
112\r
113#endif\r
114\r