SD Card Interface class. Log raw data bytes to memory addresses of your choice, or format the card and use the FAT file system to write files.

Dependencies:   mbed

Committer:
Blaze513
Date:
Sat Aug 07 18:32:30 2010 +0000
Revision:
1:94c648931f84
Child:
3:210eb67b260c

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Blaze513 1:94c648931f84 1 /*-----------------------------------------------------------------------
Blaze513 1:94c648931f84 2 / Low level disk interface modlue include file R0.06 (C)ChaN, 2007
Blaze513 1:94c648931f84 3 /-----------------------------------------------------------------------*/
Blaze513 1:94c648931f84 4
Blaze513 1:94c648931f84 5 #ifndef _DISKIO
Blaze513 1:94c648931f84 6 #define _DISKIO
Blaze513 1:94c648931f84 7
Blaze513 1:94c648931f84 8 #define _READONLY 0
Blaze513 1:94c648931f84 9 #define _USE_IOCTL 1
Blaze513 1:94c648931f84 10
Blaze513 1:94c648931f84 11 #include "integer.h"
Blaze513 1:94c648931f84 12 #include "FATFileSystem.h"
Blaze513 1:94c648931f84 13 #include <stdio.h>
Blaze513 1:94c648931f84 14
Blaze513 1:94c648931f84 15 /* Status of Disk Functions */
Blaze513 1:94c648931f84 16 typedef BYTE DSTATUS;
Blaze513 1:94c648931f84 17 #define STA_NOINIT 0x01 /* Drive not initialized */
Blaze513 1:94c648931f84 18 #define STA_NODISK 0x02 /* No medium in the drive */
Blaze513 1:94c648931f84 19 #define STA_PROTECT 0x04 /* Write protected */
Blaze513 1:94c648931f84 20 /* Results of Disk Functions */
Blaze513 1:94c648931f84 21 typedef enum
Blaze513 1:94c648931f84 22 {
Blaze513 1:94c648931f84 23 RES_OK = 0, /* 0: Successful */
Blaze513 1:94c648931f84 24 RES_ERROR, /* 1: R/W Error */
Blaze513 1:94c648931f84 25 RES_WRPRT, /* 2: Write Protected */
Blaze513 1:94c648931f84 26 RES_NOTRDY, /* 3: Not Ready */
Blaze513 1:94c648931f84 27 RES_PARERR /* 4: Invalid Parameter */
Blaze513 1:94c648931f84 28 } DRESULT;
Blaze513 1:94c648931f84 29
Blaze513 1:94c648931f84 30 /* Prototypes for disk control functions */
Blaze513 1:94c648931f84 31 DSTATUS disk_initialize (BYTE);
Blaze513 1:94c648931f84 32 DSTATUS disk_status (BYTE);
Blaze513 1:94c648931f84 33 DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE);
Blaze513 1:94c648931f84 34 #if _READONLY == 0
Blaze513 1:94c648931f84 35 DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE);
Blaze513 1:94c648931f84 36 #endif
Blaze513 1:94c648931f84 37 DRESULT disk_ioctl (BYTE, BYTE, void*);
Blaze513 1:94c648931f84 38 /* Command code for disk_ioctrl() */
Blaze513 1:94c648931f84 39 #define CTRL_SYNC 0 /* Mandatory for read/write configuration */
Blaze513 1:94c648931f84 40 #define GET_SECTOR_COUNT 1 /* Mandatory for only f_mkfs() */
Blaze513 1:94c648931f84 41 #define GET_SECTOR_SIZE 2
Blaze513 1:94c648931f84 42 #define GET_BLOCK_SIZE 3 /* Mandatory for only f_mkfs() */
Blaze513 1:94c648931f84 43 #define CTRL_POWER 4
Blaze513 1:94c648931f84 44 #define CTRL_LOCK 5
Blaze513 1:94c648931f84 45 #define CTRL_EJECT 6
Blaze513 1:94c648931f84 46 #define MMC_GET_TYPE 10 /* MMC/SDC command */
Blaze513 1:94c648931f84 47 #define MMC_GET_CSD 11
Blaze513 1:94c648931f84 48 #define MMC_GET_CID 12
Blaze513 1:94c648931f84 49 #define MMC_GET_OCR 13
Blaze513 1:94c648931f84 50 #define MMC_GET_SDSTAT 14
Blaze513 1:94c648931f84 51 #define ATA_GET_REV 20 /* ATA/CF command */
Blaze513 1:94c648931f84 52 #define ATA_GET_MODEL 21
Blaze513 1:94c648931f84 53 #define ATA_GET_SN 22
Blaze513 1:94c648931f84 54
Blaze513 1:94c648931f84 55 #endif