rtos sd encoder systems

Dependencies:   mbed

Committer:
eembed
Date:
Fri Aug 30 11:55:47 2019 +0000
Revision:
3:a921792d9913
Parent:
0:5459cdde6298
commit before edit; ~JKD;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
eembed 0:5459cdde6298 1 //-----------------------------------------------------------------------
eembed 0:5459cdde6298 2 // Low level disk interface modlue include file
eembed 0:5459cdde6298 3 //-----------------------------------------------------------------------
eembed 0:5459cdde6298 4
eembed 0:5459cdde6298 5 #ifndef _DISKIO
eembed 0:5459cdde6298 6
eembed 0:5459cdde6298 7 #define _READONLY 0 // 1: Remove write functions
eembed 0:5459cdde6298 8 #define _USE_IOCTL 1 // 1: Use disk_ioctl fucntion
eembed 0:5459cdde6298 9
eembed 0:5459cdde6298 10 #include "integer.h"
eembed 0:5459cdde6298 11
eembed 0:5459cdde6298 12
eembed 0:5459cdde6298 13 // Status of Disk Functions
eembed 0:5459cdde6298 14 typedef BYTE DSTATUS;
eembed 0:5459cdde6298 15
eembed 0:5459cdde6298 16 // Results of Disk Functions
eembed 0:5459cdde6298 17 typedef enum {
eembed 0:5459cdde6298 18 RES_OK = 0, // 0: Successful
eembed 0:5459cdde6298 19 RES_ERROR, // 1: R/W Error
eembed 0:5459cdde6298 20 RES_WRPRT, // 2: Write Protected
eembed 0:5459cdde6298 21 RES_NOTRDY, // 3: Not Ready
eembed 0:5459cdde6298 22 RES_PARERR // 4: Invalid Parameter
eembed 0:5459cdde6298 23 } DRESULT;
eembed 0:5459cdde6298 24
eembed 0:5459cdde6298 25
eembed 0:5459cdde6298 26 // Prototypes for disk control functions
eembed 0:5459cdde6298 27
eembed 0:5459cdde6298 28 int assign_drives (int, int);
eembed 0:5459cdde6298 29 DSTATUS disk_initialize (BYTE);
eembed 0:5459cdde6298 30 DSTATUS disk_status (BYTE);
eembed 0:5459cdde6298 31 DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE);
eembed 0:5459cdde6298 32 #if _READONLY == 0
eembed 0:5459cdde6298 33 DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE);
eembed 0:5459cdde6298 34 #endif
eembed 0:5459cdde6298 35 DRESULT disk_ioctl (BYTE, BYTE, void*);
eembed 0:5459cdde6298 36
eembed 0:5459cdde6298 37
eembed 0:5459cdde6298 38
eembed 0:5459cdde6298 39 // Disk Status Bits (DSTATUS)
eembed 0:5459cdde6298 40 #define STA_NOINIT 0x01 // Drive not initialized
eembed 0:5459cdde6298 41 #define STA_NODISK 0x02 // No medium in the drive
eembed 0:5459cdde6298 42 #define STA_PROTECT 0x04 // Write protected
eembed 0:5459cdde6298 43
eembed 0:5459cdde6298 44
eembed 0:5459cdde6298 45 // Command code for disk_ioctrl fucntion
eembed 0:5459cdde6298 46
eembed 0:5459cdde6298 47 // Generic command (defined for FatFs)
eembed 0:5459cdde6298 48 #define CTRL_SYNC 0 // Flush disk cache (for write functions)
eembed 0:5459cdde6298 49 #define GET_SECTOR_COUNT 1 // Get media size (for only f_mkfs())
eembed 0:5459cdde6298 50 #define GET_SECTOR_SIZE 2 // Get sector size (for multiple sector size (_MAX_SS >= 1024))
eembed 0:5459cdde6298 51 #define GET_BLOCK_SIZE 3 // Get erase block size (for only f_mkfs())
eembed 0:5459cdde6298 52 #define CTRL_ERASE_SECTOR 4 // Force erased a block of sectors (for only _USE_ERASE)
eembed 0:5459cdde6298 53
eembed 0:5459cdde6298 54 // Generic command
eembed 0:5459cdde6298 55 #define CTRL_POWER 5 // Get/Set power status
eembed 0:5459cdde6298 56 #define CTRL_LOCK 6 // Lock/Unlock media removal
eembed 0:5459cdde6298 57 #define CTRL_EJECT 7 // Eject media
eembed 0:5459cdde6298 58
eembed 0:5459cdde6298 59 // MMC/SDC specific ioctl command
eembed 0:5459cdde6298 60 #define MMC_GET_TYPE 10 // Get card type
eembed 0:5459cdde6298 61 #define MMC_GET_CSD 11 // Get CSD
eembed 0:5459cdde6298 62 #define MMC_GET_CID 12 // Get CID
eembed 0:5459cdde6298 63 #define MMC_GET_OCR 13 // Get OCR
eembed 0:5459cdde6298 64 #define MMC_GET_SDSTAT 14 // Get SD status
eembed 0:5459cdde6298 65
eembed 0:5459cdde6298 66 // ATA/CF specific ioctl command
eembed 0:5459cdde6298 67 #define ATA_GET_REV 20 // Get F/W revision
eembed 0:5459cdde6298 68 #define ATA_GET_MODEL 21 // Get model name
eembed 0:5459cdde6298 69 #define ATA_GET_SN 22 // Get serial number
eembed 0:5459cdde6298 70
eembed 0:5459cdde6298 71 // NAND specific ioctl command
eembed 0:5459cdde6298 72 #define NAND_FORMAT 30 // Create physical format
eembed 0:5459cdde6298 73
eembed 0:5459cdde6298 74
eembed 0:5459cdde6298 75 #define _DISKIO
eembed 0:5459cdde6298 76 #endif