]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Omap35xxPkg/MMCHSDxe/MMCHS.h
ARM Packages: Fixed line endings
[mirror_edk2.git] / Omap35xxPkg / MMCHSDxe / MMCHS.h
index 9baac74931f66e7638721b296aca2fc9b98427bd..e19607bae0d77db7f8c86b090ab591360cc93fe0 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
 \r
-  Copyright (c) 2008-2009 Apple Inc. All rights reserved.<BR>\r
+  Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
 \r
-  All rights reserved. This program and the accompanying materials\r
+  This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
   http://opensource.org/licenses/bsd-license.php\r
 #ifndef _MMCHS_H_\r
 #define _MMCHS_H_\r
 \r
-#include <Library/BaseLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/DebugLib.h>
-#include <Library/IoLib.h>
-#include <Library/PcdLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-
+#include <Uefi.h>\r
+\r
+#include <Library/BaseLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/IoLib.h>\r
+#include <Library/PcdLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/OmapLib.h>\r
+#include <Library/OmapDmaLib.h>\r
+#include <Library/DmaLib.h>\r
+\r
 #include <Protocol/EmbeddedExternalDevice.h>\r
-#include <Protocol/BlockIo.h>
-#include <Protocol/Cpu.h>
-#include <Protocol/DevicePath.h>
-
+#include <Protocol/BlockIo.h>\r
+#include <Protocol/DevicePath.h>\r
+\r
 #include <Omap3530/Omap3530.h>\r
 #include <TPS65950.h>\r
 \r
-#define MAX_RETRY_COUNT  100
-
-#define HCS               (0x1UL << 30) //Host capacity support/1 = Supporting high capacity\r
-#define CCS               (0x1UL << 30) //Card capacity status/1 = High capacity card\r
+#define MAX_RETRY_COUNT  (100*5)\r
+\r
+#define HCS               BIT30 //Host capacity support/1 = Supporting high capacity\r
+#define CCS               BIT30 //Card capacity status/1 = High capacity card\r
 typedef struct {\r
   UINT32  Reserved0:   7; // 0 \r
   UINT32  V170_V195:   1; // 1.70V - 1.95V\r
@@ -59,18 +64,21 @@ typedef struct {
 typedef struct {\r
   UINT8   NOT_USED:           1; // Not used, always 1 [0:0]\r
   UINT8   CRC:                7; // CRC [7:1]\r
+\r
   UINT8   RESERVED_1:         2; // Reserved [9:8]\r
   UINT8   FILE_FORMAT:        2; // File format [11:10]\r
   UINT8   TMP_WRITE_PROTECT:  1; // Temporary write protection [12:12]\r
   UINT8   PERM_WRITE_PROTECT: 1; // Permanent write protection [13:13]\r
   UINT8   COPY:               1; // Copy flag (OTP) [14:14]\r
   UINT8   FILE_FORMAT_GRP:    1; // File format group [15:15]\r
+  \r
   UINT16  RESERVED_2:         5; // Reserved [20:16]\r
   UINT16  WRITE_BL_PARTIAL:   1; // Partial blocks for write allowed [21:21]\r
   UINT16  WRITE_BL_LEN:       4; // Max. write data block length [25:22]\r
   UINT16  R2W_FACTOR:         3; // Write speed factor [28:26]\r
   UINT16  RESERVED_3:         2; // Reserved [30:29]\r
   UINT16  WP_GRP_ENABLE:      1; // Write protect group enable [31:31]\r
+  \r
   UINT32  WP_GRP_SIZE:        7; // Write protect group size [38:32]\r
   UINT32  SECTOR_SIZE:        7; // Erase sector size [45:39]\r
   UINT32  ERASE_BLK_EN:       1; // Erase single block enable [46:46]\r
@@ -79,8 +87,9 @@ typedef struct {
   UINT32  VDD_W_CURR_MIN:     3; // Max. write current @ VDD min [55:53]\r
   UINT32  VDD_R_CURR_MAX:     3; // Max. read current @ VDD max [58:56]\r
   UINT32  VDD_R_CURR_MIN:     3; // Max. read current @ VDD min [61:59]\r
-  UINT32  C_SIZELow2:         2; // Device size [73:62]\r
-  UINT32  C_SIZEHigh10:       10;// Device size [73:62]\r
+  UINT32  C_SIZELow2:         2; // Device size [63:62]\r
+  \r
+  UINT32  C_SIZEHigh10:       10;// Device size [73:64]\r
   UINT32  RESERVED_4:         2; // Reserved [75:74]\r
   UINT32  DSR_IMP:            1; // DSR implemented [76:76]\r
   UINT32  READ_BLK_MISALIGN:  1; // Read block misalignment [77:77]\r
@@ -88,9 +97,11 @@ typedef struct {
   UINT32  READ_BL_PARTIAL:    1; // Partial blocks for read allowed [79:79]\r
   UINT32  READ_BL_LEN:        4; // Max. read data block length [83:80]\r
   UINT32  CCC:                12;// Card command classes [95:84]\r
+\r
   UINT8   TRAN_SPEED          ;  // Max. bus clock frequency [103:96]\r
   UINT8   NSAC                ;  // Data read access-time 2 in CLK cycles (NSAC*100) [111:104]\r
   UINT8   TAAC                ;  // Data read access-time 1 [119:112]\r
+  \r
   UINT8   RESERVED_5:         6; // Reserved [125:120]\r
   UINT8   CSD_STRUCTURE:      2; // CSD structure [127:126]\r
 }CSD;\r
@@ -130,12 +141,12 @@ typedef struct {
   UINT8   CSD_STRUCTURE:      2; // CSD structure [127:126]\r
 }CSD_SDV2;\r
 \r
-typedef enum {
-  UNKNOWN_CARD,
-  MMC_CARD,              //MMC card
-  SD_CARD,               //SD 1.1 card
-  SD_CARD_2,             //SD 2.0 or above standard card
-  SD_CARD_2_HIGH         //SD 2.0 or above high capacity card
+typedef enum {\r
+  UNKNOWN_CARD,\r
+  MMC_CARD,              //MMC card\r
+  SD_CARD,               //SD 1.1 card\r
+  SD_CARD_2,             //SD 2.0 or above standard card\r
+  SD_CARD_2_HIGH         //SD 2.0 or above high capacity card\r
 } CARD_TYPE;\r
 \r
 typedef enum {\r
@@ -143,8 +154,7 @@ typedef enum {
   WRITE\r
 } OPERATION_TYPE;\r
 \r
-typedef struct \r
-{\r
+typedef struct  {\r
   UINT16    RCA;\r
   UINTN     BlockSize;\r
   UINTN     NumBlocks;\r
@@ -155,4 +165,11 @@ typedef struct
   CSD       CSDData;\r
 } CARD_INFO;\r
 \r
+EFI_STATUS\r
+DetectCard (\r
+  VOID\r
+  );\r
+\r
+extern EFI_BLOCK_IO_PROTOCOL gBlockIo;\r
+\r
 #endif\r