From 7f552300815ccadd45ebb3e7f0ae72a3b2e0c4e5 Mon Sep 17 00:00:00 2001 From: Leo C Date: Sat, 22 Nov 2014 13:07:04 +0100 Subject: Integrate fatfs. Add some sd card test commands. --- fatfs/src/diskio.h | 80 ----------------------------------------------------- fatfs/src/ffconf.h | 13 ++++----- fatfs/src/integer.h | 33 ---------------------- 3 files changed, 6 insertions(+), 120 deletions(-) delete mode 100644 fatfs/src/diskio.h delete mode 100644 fatfs/src/integer.h (limited to 'fatfs/src') diff --git a/fatfs/src/diskio.h b/fatfs/src/diskio.h deleted file mode 100644 index 9650f68..0000000 --- a/fatfs/src/diskio.h +++ /dev/null @@ -1,80 +0,0 @@ -/*-----------------------------------------------------------------------/ -/ Low level disk interface modlue include file (C)ChaN, 2014 / -/-----------------------------------------------------------------------*/ - -#ifndef _DISKIO_DEFINED -#define _DISKIO_DEFINED - -#ifdef __cplusplus -extern "C" { -#endif - -#define _USE_WRITE 1 /* 1: Enable disk_write function */ -#define _USE_IOCTL 1 /* 1: Enable disk_ioctl fucntion */ - -#include "integer.h" - - -/* Status of Disk Functions */ -typedef BYTE DSTATUS; - -/* Results of Disk Functions */ -typedef enum { - RES_OK = 0, /* 0: Successful */ - RES_ERROR, /* 1: R/W Error */ - RES_WRPRT, /* 2: Write Protected */ - RES_NOTRDY, /* 3: Not Ready */ - RES_PARERR /* 4: Invalid Parameter */ -} DRESULT; - - -/*---------------------------------------*/ -/* Prototypes for disk control functions */ - - -DSTATUS disk_initialize (BYTE pdrv); -DSTATUS disk_status (BYTE pdrv); -DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count); -DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count); -DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff); - - -/* Disk Status Bits (DSTATUS) */ - -#define STA_NOINIT 0x01 /* Drive not initialized */ -#define STA_NODISK 0x02 /* No medium in the drive */ -#define STA_PROTECT 0x04 /* Write protected */ - - -/* Command code for disk_ioctrl fucntion */ - -/* Generic command (Used by FatFs) */ -#define CTRL_SYNC 0 /* Complete pending write process (needed at _FS_READONLY == 0) */ -#define GET_SECTOR_COUNT 1 /* Get media size (needed at _USE_MKFS == 1) */ -#define GET_SECTOR_SIZE 2 /* Get sector size (needed at _MAX_SS != _MIN_SS) */ -#define GET_BLOCK_SIZE 3 /* Get erase block size (needed at _USE_MKFS == 1) */ -#define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at _USE_TRIM == 1) */ - -/* Generic command (Not used by FatFs) */ -#define CTRL_POWER 5 /* Get/Set power status */ -#define CTRL_LOCK 6 /* Lock/Unlock media removal */ -#define CTRL_EJECT 7 /* Eject media */ -#define CTRL_FORMAT 8 /* Create physical format on the media */ - -/* MMC/SDC specific ioctl command */ -#define MMC_GET_TYPE 10 /* Get card type */ -#define MMC_GET_CSD 11 /* Get CSD */ -#define MMC_GET_CID 12 /* Get CID */ -#define MMC_GET_OCR 13 /* Get OCR */ -#define MMC_GET_SDSTAT 14 /* Get SD status */ - -/* ATA/CF specific ioctl command */ -#define ATA_GET_REV 20 /* Get F/W revision */ -#define ATA_GET_MODEL 21 /* Get model name */ -#define ATA_GET_SN 22 /* Get serial number */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/fatfs/src/ffconf.h b/fatfs/src/ffconf.h index 0442945..adc4b87 100644 --- a/fatfs/src/ffconf.h +++ b/fatfs/src/ffconf.h @@ -51,7 +51,7 @@ /* This option switches fast seek feature. (0:Disable or 1:Enable) */ -#define _USE_LABEL 0 +#define _USE_LABEL 1 /* This option switches volume label functions, f_getlabel() and f_setlabel(). / (0:Disable or 1:Enable) */ @@ -65,7 +65,7 @@ / Locale and Namespace Configurations /---------------------------------------------------------------------------*/ -#define _CODE_PAGE 932 +#define _CODE_PAGE 858 /* This option specifies the OEM code page to be used on the target system. / Incorrect setting of the code page can cause a file open failure. / @@ -97,8 +97,8 @@ / 1 - ASCII (No extended character. Valid for only non-LFN configuration.) */ -#define _USE_LFN 0 -#define _MAX_LFN 255 +#define _USE_LFN 1 +#define _MAX_LFN 128 /* The _USE_LFN option switches the LFN feature. / / 0: Disable LFN feature. _MAX_LFN has no effect. @@ -131,7 +131,7 @@ / When _LFN_UNICODE is 0, this option has no effect. */ -#define _FS_RPATH 0 +#define _FS_RPATH 2 /* This option configures relative path feature. / / 0: Disable relative path feature and remove related functions. @@ -209,7 +209,7 @@ / defined by _NORTC_MON, _NORTC_MDAY and _NORTC_YEAR. / When timestamp feature is enabled (_FS_NORTC == 0), get_fattime() function need / to be added to the project to read current time form RTC. _NORTC_MON, -/ _NORTC_MDAY and _NORTC_YEAR have no effect. +/ _NORTC_MDAY and _NORTC_YEAR have no effect. / These options have no effect at read-only configuration (_FS_READONLY == 1). */ @@ -267,4 +267,3 @@ / PIC24 0 H8S 0 MSP430 0 / PIC32 0 H8/300H 0 8051 0/1 */ - diff --git a/fatfs/src/integer.h b/fatfs/src/integer.h deleted file mode 100644 index 074a46b..0000000 --- a/fatfs/src/integer.h +++ /dev/null @@ -1,33 +0,0 @@ -/*-------------------------------------------*/ -/* Integer type definitions for FatFs module */ -/*-------------------------------------------*/ - -#ifndef _FF_INTEGER -#define _FF_INTEGER - -#ifdef _WIN32 /* FatFs development platform */ - -#include -#include - -#else /* Embedded platform */ - -/* This type MUST be 8 bit */ -typedef unsigned char BYTE; - -/* These types MUST be 16 bit */ -typedef short SHORT; -typedef unsigned short WORD; -typedef unsigned short WCHAR; - -/* These types MUST be 16 bit or 32 bit */ -typedef int INT; -typedef unsigned int UINT; - -/* These types MUST be 32 bit */ -typedef long LONG; -typedef unsigned long DWORD; - -#endif - -#endif -- cgit v1.2.3