Description |
The function CheckMedia checks the SD/MMC Memory Card
status. It reads the Card Detect (CD) and Write Protect
(WP) digital inputs. If CD and WP digital inputs from SD Card socket
are not connected, this function can be omitted. In this case, enter
NULL for CheckMedia into the MCI
Driver control block.
The function is part of the MCI
Driver. The prototype is defined in the file
File_Config.h. Developers must customize the function.
|
Example |
/* MCI Device Driver Control Block */
MCI_DRV mci0_drv = {
Init,
UnInit,
Delay,
BusMode,
BusWidth,
BusSpeed,
Command,
ReadBlock,
WriteBlock,
NULL,
CheckMedia /* Can be NULL if not existing */
};
/* Read CardDetect and WriteProtect SD card socket pins. */
static U32 CheckMedia (void) {
U32 stat = 0;
if (!(IOPIN0 & 0x04)) {
stat |= M_INSERTED; /* Card is inserted (CD=0). */
}
if ((IOPIN0 & 0x20)) {
stat |= M_PROTECTED; /* Write Protect switch is active (WP=1). */
}
return (stat);
}
/* MCI Device Driver Control Block with omitted CheckMedia */
MCI_DRV mci0_drv = {
Init,
UnInit,
Delay,
BusMode,
BusWidth,
BusSpeed,
Command,
ReadBlock,
WriteBlock,
NULL,
NULL
};
|