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:
Sun Jan 16 09:20:30 2011 +0000
Revision:
6:ddf09d859ed7
Parent:
3:210eb67b260c
gave access to Initialization function to FAT module.
added disk formatting functionality.

Who changed what in which revision?

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