373a8c32b2
git-svn-id: file:///srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/repositories/svn/Diplomarbeit@55 9fe90eed-be63-e94b-8204-d34ff4c2ff93
173 lines
6.9 KiB
C
173 lines
6.9 KiB
C
/* ---------------------------------------------------------------------------
|
|
* diskio.h (C)ChaN, 2007
|
|
* ---------------------------------------------------------------------------
|
|
* Micro-key bv
|
|
* Industrieweg 28, 9804 TG Noordhorn
|
|
* Postbus 92, 9800 AB Zuidhorn
|
|
* The Netherlands
|
|
* Tel: +31 594 503020
|
|
* Fax: +31 594 505825
|
|
* Email: support@microkey.nl
|
|
* Web: www.microkey.nl
|
|
* ---------------------------------------------------------------------------
|
|
* Description: Low level disk interface modlue include file R0.06
|
|
* ---------------------------------------------------------------------------
|
|
* Version(s): 0.2, Aug 11, 2008, MMi
|
|
* Edited to fit into LAN_2636 Project
|
|
* Change disk_write and disk_read functions to work with MMC
|
|
*
|
|
* 0.1, 2007 ChanN
|
|
* Creation
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
#ifndef DISKIO_H_
|
|
#define DISKIO_H_
|
|
/* ---------------------------------------------------------------------------
|
|
* System include files.
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
#include "LPC23xx.h"
|
|
#include "types.h"
|
|
/* ---------------------------------------------------------------------------
|
|
* Application include files.
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Constant and macro definitions.
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
#define _READONLY 0 /* 1: Read-only mode */
|
|
#define _USE_IOCTL 1
|
|
|
|
/* 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 */
|
|
|
|
/* Generic command */
|
|
#define CTRL_SYNC 0 /* Mandatory for read/write */
|
|
#define GET_SECTOR_COUNT 1 /* Mandatory for only f_mkfs() */
|
|
#define GET_SECTOR_SIZE 2
|
|
#define GET_BLOCK_SIZE 3 /* Mandatory for only f_mkfs() */
|
|
#define CTRL_POWER 4
|
|
#define CTRL_LOCK 5
|
|
#define CTRL_EJECT 6
|
|
/* MMC/SDC command */
|
|
#define MMC_GET_TYPE 10
|
|
#define MMC_GET_CSD 11
|
|
#define MMC_GET_CID 12
|
|
#define MMC_GET_OCR 13
|
|
#define MMC_GET_SDSTAT 14
|
|
/* ATA/CF command */
|
|
#define ATA_GET_REV 20
|
|
#define ATA_GET_MODEL 21
|
|
#define ATA_GET_SN 22
|
|
/* ---------------------------------------------------------------------------
|
|
* Type definitions.
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
/* Status of Disk Functions */
|
|
typedef UINT8 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;
|
|
/* ---------------------------------------------------------------------------
|
|
* Variable declarations.
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Function declarations.
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Function: disk_initialize
|
|
*
|
|
* Function to call initialisations for different devices. This function is
|
|
* needed by the filesystem but is deactivated because for this project, no
|
|
* multible devices are used. Function always returns "Operation suceeded"
|
|
*
|
|
* Parameters: UINT8 drive - Device number
|
|
*
|
|
* Return : DSTATUS - Initialisation status of desired device
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
DSTATUS disk_initialize(UINT8 drive);
|
|
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Function: disk_status
|
|
*
|
|
* Function to call status calls for different devices. This function is
|
|
* needed by the filesystem but is deactivated because for this project, no
|
|
* multible devices are used. Function always returns "Operation suceeded"
|
|
*
|
|
* Parameters: UINT8 drive - Device number
|
|
*
|
|
* Return : DSTATUS - Status of desired device
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
DSTATUS disk_status(UINT8 drive);
|
|
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Function: disk_ioctrl
|
|
*
|
|
* Function to call controllings for different devices. This function is
|
|
* needed by the filesystem but is deactivated because for this project, no
|
|
* multible devices are used. Function always returns "Operation suceeded"
|
|
*
|
|
* Parameters: UINT8 drive - Device number
|
|
* UINT8 ctrl - A certain command
|
|
* void *buff - A function pointer
|
|
*
|
|
* Return : DRESULT - Initialisation status of desired device
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
DRESULT disk_ioctl(UINT8 drive, UINT8 ctrl, void *buff);
|
|
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Function: disk_read
|
|
*
|
|
* Function to read from the memory card.
|
|
*
|
|
* Parameters: UINT8 drive - Device number
|
|
* pUINT8 buffer - Pointer to position to storage read data
|
|
* UINT32 sector - Sector an that reading should be started
|
|
* UINT8 count - Number of following sectors to read
|
|
*
|
|
* Return : DSTATUS - Initialisation status of desired device
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
DRESULT disk_read(UINT8 drive, pUINT8 buffer, UINT32 sector, UINT8 count);
|
|
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Function: disk_write
|
|
*
|
|
* Function to write to the memory card.
|
|
*
|
|
* Parameters: UINT8 drive - Device number
|
|
* pUINT8 buffer - Pointer to position where data is stored
|
|
* UINT32 sector - Sector an that writing should be started
|
|
* UINT8 count - Number of following sectors to write on
|
|
*
|
|
* Return : DSTATUS - Initialisation status of desired device
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
#if _READONLY == 0
|
|
DRESULT disk_write(UINT8 drive, pUINT8 buffer, UINT32 sector, UINT8 count);
|
|
#endif
|
|
|
|
#endif /*FAT_TIME_H_*/
|