microSDカードからWaveファイルを再生するサンプルです。

Dependencies:   mbed FATFileSystem

Committer:
jksoft
Date:
Mon May 12 14:45:42 2014 +0000
Revision:
0:e9f196d85a46
First edition

Who changed what in which revision?

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