1 /*************************************************************************
3 * Used with ICCARM and AARM.
5 * (c) Copyright IAR Systems 2003
8 * Description : define MMC module
11 * 1. Data : July 1, 2005
12 * Author : Stanimir Bonev
13 * Description : Create
16 **************************************************************************/
25 // Hardware depends definitions
27 #define IdentificationModeClock 400000l
28 #define SystemPeripherialClock 48000000l
31 // Time out definition for SD Read Time out ~100msec, Write Time out ~250ms
33 #define SD_READ_TIME_OUT 7 // [Hz]
34 #define SD_WRITE_TIME_OUT 3 // [HZ]
40 #define MMC_IDLE_STATE 0x01
41 #define MMC_ERASE_RST 0x02
42 #define MMC_ILLEGAL_CMD 0x04
43 #define MMC_CRC_ERROR 0x08
44 #define MMC_ERASE_ERROR 0x10
45 #define MMC_ADD_ERROR 0x20
46 #define MMC_PARAM_ERROR 0x40
48 #define MMC_DATA_TOKEN 0xfe
49 #define MMC_DATA_ERR_TOKEN 0x1f
50 #define MMC_STOP_TRAN 0xfd
52 #define MMC_DLY_1MSEC 1000
69 CMD0 = 0, // Resets the MultiMediaCard
70 CMD1, // Activates the card initialization process
71 CMD9, // Asks the selected card to send its card-specific data (CSD)
72 CMD10, // Asks the selected card to send its card identification (CID)
73 CMD12, // Stop transmission on multiple block read
74 CMD13, // Asks the selected card to send its status register
75 CMD16, // Selects a block length (in bytes) for all following block commands (read and write)
76 CMD17, // Reads a block of the size selected by the SET_BLOCKLEN command
77 CMD18, // Continuously transfers data blocks from card to host until interrupted by a Stop command or the requested number of data blocks transmitted
78 CMD24, // Writes a block of the size selected by the SET_BLOCKLEN command
79 CMD25, // Continuously writes blocks of data until a "Stop Tran" token or the requested number of blocks received
80 CMD27, // Programming of the programmable bits of the CSD
81 CMD28, // If the card has write protection features, this command sets the write protection bit of the addressed group. The properties of write protection are coded in the card specific data (WP_GRP_SIZE).
82 CMD29, // If the card has write protection features, this command clears the write protection bit of the addressed group
83 CMD30, // If the card has write protection features, this command asks the card to send the status of the write protection bits
84 CMD32, // Sets the address of the first sector of the erase group
85 CMD33, // Sets the address of the last sector in a continuous range within the selected erase group, or the address of a single sector to be selected for erase
86 CMD34, // Removes one previously selected sector from the erase selection
87 CMD35, // Sets the address of the first erase group within a range to be selected for erase
88 CMD36, // Sets the address of the last erase group within a continuous range to be selected for erase
89 CMD37, // Removes one previously selected erase group from the erase selection.
90 CMD38, // Erases all previously selected sectors
91 CMD42, // Used to set/reset the password or lock/unlock the card. The size of the Data Block is defined by the SET_BLOCK_LEN command
92 CMD55, // Notifies the card that the next command is an application specific command rather than a standard command.
93 CMD56, // Used either to transfer a Data Block to the card or to get a Data Block from the card for general purpose/application specific commands. The size of the Data Block is defined with SET_BLOCK_LEN command
94 CMD58, // Reads the OCR register of a card
95 CMD59, // Turns the CRC option on or off. A
\911
\92 in the CRC option bit will turn the option on, a
\910
\92 will turn it off
96 ACMD41, // Activates the card
\92s initialization process (Only for SD)
97 CMD_END // End of commands index