...
A single SD/MMC volume is opened as shown in 238485603. The file system initialization (FS_Init()
) function must have previously been called.
ROM/RAM characteristics and performance benchmarks of the SD/MMC driver can be found in section Driver Characterization. The SD/MMC driver also provides interface functions to get low-level card information and read the Card ID and Card-Specific Data registers (see section FAT System Driver Functions).
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
FS_ERR App_FS_AddSD_SPI (void)
{
FS_ERR err;
FS_DevDrvAdd((FS_DEV_API *)&FSDev_SD_SPI, (1)
(FS_ERR *)&err);
if ((err != FS_ERR_NONE) && (err != FS_ERR_DEV_DRV_ALREADY_ADDED)) {
return (DEF_FAIL);
}
(2)
FSDev_Open((CPU_CHAR *)"sd:0:", (a)
(void *) 0, (b)
(FS_ERR *)&err);
switch (err) {
case FS_ERR_NONE:
break;
case FS_ERR_DEV:
case FS_ERR_DEV_IO:
case FS_ERR_DEV_TIMEOUT:
case FS_ERR_DEV_NOT_PRESENT:
return (DEF_FAIL);
default:
return (DEF_FAIL);
}
(3)
FSVol_Open((CPU_CHAR *)"sd:0:", (a)
(CPU_CHAR *)"sd:0:", (b)
(FS_PARTITION_NBR ) 0, (c)
(FS_ERR *)&err);
switch (err) {
case FS_ERR_NONE:
APP_TRACE_DBG((" ...opened volume (mounted).\r\n"));
break;
case FS_ERR_DEV:
case FS_ERR_DEV_IO:
case FS_ERR_DEV_TIMEOUT:
case FS_ERR_DEV_NOT_PRESENT:
case FS_ERR_PARTITION_NOT_FOUND:
APP_TRACE_DBG((" ...opened device (unmounted).\r\n"));
return (DEF_FAIL);
default:
APP_TRACE_DBG((" ...opening volume failed w/err = %d.\r\n\r\n", err));
return (DEF_FAIL);
}
return (DEF_OK);
} |
Panel |
---|
(1) Register the SD/MMC SPI device driver (2) Since SD/MMC are often removable media, it is possible for the device to not be present when (3) |
If the SD/MMC initialization succeeds, the file system will produce the trace output as shown in Figure 14-10 238485603 (if a sufficiently high trace level is configured). See section E-9 “Trace Configuration” See Trace Configuration about configuring the trace level.
Panel | ||||
---|---|---|---|---|
| ||||