Code for autonomous ground vehicle, Data Bus, 3rd place winner in 2012 Sparkfun AVC.
Dependencies: Watchdog mbed Schedule SimpleFilter LSM303DLM PinDetect DebounceIn Servo
SDFileSystem/FATFileSystem/Core/diskio.h@0:826c6171fc1b, 2012-06-20 (annotated)
- Committer:
- shimniok
- Date:
- Wed Jun 20 14:57:48 2012 +0000
- Revision:
- 0:826c6171fc1b
Updated documentation
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shimniok | 0:826c6171fc1b | 1 | /*----------------------------------------------------------------------- |
shimniok | 0:826c6171fc1b | 2 | / Low level disk interface module include file R0.06 (C)ChaN, 2007 |
shimniok | 0:826c6171fc1b | 3 | /-----------------------------------------------------------------------*/ |
shimniok | 0:826c6171fc1b | 4 | |
shimniok | 0:826c6171fc1b | 5 | //Modified by Thomas Hamilton, Copyright 2010 |
shimniok | 0:826c6171fc1b | 6 | |
shimniok | 0:826c6171fc1b | 7 | #ifndef _DISKIO |
shimniok | 0:826c6171fc1b | 8 | #define _DISKIO |
shimniok | 0:826c6171fc1b | 9 | |
shimniok | 0:826c6171fc1b | 10 | #define _READONLY 0 |
shimniok | 0:826c6171fc1b | 11 | #define _USE_IOCTL 1 |
shimniok | 0:826c6171fc1b | 12 | |
shimniok | 0:826c6171fc1b | 13 | #include "integer.h" |
shimniok | 0:826c6171fc1b | 14 | #include "FATFileSystem.h" |
shimniok | 0:826c6171fc1b | 15 | #include <stdio.h> |
shimniok | 0:826c6171fc1b | 16 | |
shimniok | 0:826c6171fc1b | 17 | /* Status of Disk Functions */ |
shimniok | 0:826c6171fc1b | 18 | typedef BYTE DSTATUS; |
shimniok | 0:826c6171fc1b | 19 | #define STA_NOINIT 0x01 /* Drive not initialized */ |
shimniok | 0:826c6171fc1b | 20 | #define STA_NODISK 0x02 /* No medium in the drive */ |
shimniok | 0:826c6171fc1b | 21 | #define STA_PROTECT 0x04 /* Write protected */ |
shimniok | 0:826c6171fc1b | 22 | /* Results of Disk Functions */ |
shimniok | 0:826c6171fc1b | 23 | typedef enum |
shimniok | 0:826c6171fc1b | 24 | { |
shimniok | 0:826c6171fc1b | 25 | RES_OK = 0, /* 0: Successful */ |
shimniok | 0:826c6171fc1b | 26 | RES_ERROR, /* 1: R/W Error */ |
shimniok | 0:826c6171fc1b | 27 | RES_WRPRT, /* 2: Write Protected */ |
shimniok | 0:826c6171fc1b | 28 | RES_NOTRDY, /* 3: Not Ready */ |
shimniok | 0:826c6171fc1b | 29 | RES_PARERR /* 4: Invalid Parameter */ |
shimniok | 0:826c6171fc1b | 30 | } DRESULT; |
shimniok | 0:826c6171fc1b | 31 | |
shimniok | 0:826c6171fc1b | 32 | /* Prototypes for disk control functions */ |
shimniok | 0:826c6171fc1b | 33 | DSTATUS disk_initialize (BYTE); |
shimniok | 0:826c6171fc1b | 34 | DSTATUS disk_status (BYTE); |
shimniok | 0:826c6171fc1b | 35 | DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE); |
shimniok | 0:826c6171fc1b | 36 | #if _READONLY == 0 |
shimniok | 0:826c6171fc1b | 37 | DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE); |
shimniok | 0:826c6171fc1b | 38 | #endif |
shimniok | 0:826c6171fc1b | 39 | DRESULT disk_ioctl (BYTE, BYTE, void*); |
shimniok | 0:826c6171fc1b | 40 | /* Command code for disk_ioctrl() */ |
shimniok | 0:826c6171fc1b | 41 | #define CTRL_SYNC 0 /* Mandatory for read/write configuration */ |
shimniok | 0:826c6171fc1b | 42 | #define GET_SECTOR_COUNT 1 /* Mandatory for only f_mkfs() */ |
shimniok | 0:826c6171fc1b | 43 | #define GET_SECTOR_SIZE 2 |
shimniok | 0:826c6171fc1b | 44 | #define GET_BLOCK_SIZE 3 /* Mandatory for only f_mkfs() */ |
shimniok | 0:826c6171fc1b | 45 | #define CTRL_POWER 4 |
shimniok | 0:826c6171fc1b | 46 | #define CTRL_LOCK 5 |
shimniok | 0:826c6171fc1b | 47 | #define CTRL_EJECT 6 |
shimniok | 0:826c6171fc1b | 48 | #define MMC_GET_TYPE 10 /* MMC/SDC command */ |
shimniok | 0:826c6171fc1b | 49 | #define MMC_GET_CSD 11 |
shimniok | 0:826c6171fc1b | 50 | #define MMC_GET_CID 12 |
shimniok | 0:826c6171fc1b | 51 | #define MMC_GET_OCR 13 |
shimniok | 0:826c6171fc1b | 52 | #define MMC_GET_SDSTAT 14 |
shimniok | 0:826c6171fc1b | 53 | #define ATA_GET_REV 20 /* ATA/CF command */ |
shimniok | 0:826c6171fc1b | 54 | #define ATA_GET_MODEL 21 |
shimniok | 0:826c6171fc1b | 55 | #define ATA_GET_SN 22 |
shimniok | 0:826c6171fc1b | 56 | |
shimniok | 0:826c6171fc1b | 57 | #endif |