Final tidy of code following installation of new sensor, more comments added prior to submission

Dependencies:   mbed

Committer:
legstar85
Date:
Fri Feb 04 09:20:18 2022 +0000
Revision:
18:fc63b51a0302
Parent:
14:3e9991fe64e5
Final tidy of code following installation of new sensor, more comments added prior to submission

Who changed what in which revision?

UserRevisionLine numberNew contents of line
legstar85 14:3e9991fe64e5 1 /*-----------------------------------------------------------------------/
legstar85 14:3e9991fe64e5 2 / Low level disk interface modlue include file (C)ChaN, 2014 /
legstar85 14:3e9991fe64e5 3 /-----------------------------------------------------------------------*/
legstar85 14:3e9991fe64e5 4
legstar85 14:3e9991fe64e5 5 #ifndef _DISKIO_DEFINED
legstar85 14:3e9991fe64e5 6 #define _DISKIO_DEFINED
legstar85 14:3e9991fe64e5 7
legstar85 14:3e9991fe64e5 8 #ifdef __cplusplus
legstar85 14:3e9991fe64e5 9 extern "C" {
legstar85 14:3e9991fe64e5 10 #endif
legstar85 14:3e9991fe64e5 11
legstar85 14:3e9991fe64e5 12 #define _USE_WRITE 1 /* 1: Enable disk_write function */
legstar85 14:3e9991fe64e5 13 #define _USE_IOCTL 1 /* 1: Enable disk_ioctl fucntion */
legstar85 14:3e9991fe64e5 14
legstar85 14:3e9991fe64e5 15 #include "integer.h"
legstar85 14:3e9991fe64e5 16
legstar85 14:3e9991fe64e5 17
legstar85 14:3e9991fe64e5 18 /* Status of Disk Functions */
legstar85 14:3e9991fe64e5 19 typedef BYTE DSTATUS;
legstar85 14:3e9991fe64e5 20
legstar85 14:3e9991fe64e5 21 /* Results of Disk Functions */
legstar85 14:3e9991fe64e5 22 typedef enum {
legstar85 14:3e9991fe64e5 23 RES_OK = 0, /* 0: Successful */
legstar85 14:3e9991fe64e5 24 RES_ERROR, /* 1: R/W Error */
legstar85 14:3e9991fe64e5 25 RES_WRPRT, /* 2: Write Protected */
legstar85 14:3e9991fe64e5 26 RES_NOTRDY, /* 3: Not Ready */
legstar85 14:3e9991fe64e5 27 RES_PARERR /* 4: Invalid Parameter */
legstar85 14:3e9991fe64e5 28 } DRESULT;
legstar85 14:3e9991fe64e5 29
legstar85 14:3e9991fe64e5 30
legstar85 14:3e9991fe64e5 31 /*---------------------------------------*/
legstar85 14:3e9991fe64e5 32 /* Prototypes for disk control functions */
legstar85 14:3e9991fe64e5 33
legstar85 14:3e9991fe64e5 34
legstar85 14:3e9991fe64e5 35 DSTATUS disk_initialize (BYTE pdrv);
legstar85 14:3e9991fe64e5 36 DSTATUS disk_status (BYTE pdrv);
legstar85 14:3e9991fe64e5 37 DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count);
legstar85 14:3e9991fe64e5 38 DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count);
legstar85 14:3e9991fe64e5 39 DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
legstar85 14:3e9991fe64e5 40
legstar85 14:3e9991fe64e5 41
legstar85 14:3e9991fe64e5 42 /* Disk Status Bits (DSTATUS) */
legstar85 14:3e9991fe64e5 43
legstar85 14:3e9991fe64e5 44 #define STA_NOINIT 0x01 /* Drive not initialized */
legstar85 14:3e9991fe64e5 45 #define STA_NODISK 0x02 /* No medium in the drive */
legstar85 14:3e9991fe64e5 46 #define STA_PROTECT 0x04 /* Write protected */
legstar85 14:3e9991fe64e5 47
legstar85 14:3e9991fe64e5 48
legstar85 14:3e9991fe64e5 49 /* Command code for disk_ioctrl fucntion */
legstar85 14:3e9991fe64e5 50
legstar85 14:3e9991fe64e5 51 /* Generic command (Used by FatFs) */
legstar85 14:3e9991fe64e5 52 #define CTRL_SYNC 0 /* Complete pending write process (needed at _FS_READONLY == 0) */
legstar85 14:3e9991fe64e5 53 #define GET_SECTOR_COUNT 1 /* Get media size (needed at _USE_MKFS == 1) */
legstar85 14:3e9991fe64e5 54 #define GET_SECTOR_SIZE 2 /* Get sector size (needed at _MAX_SS != _MIN_SS) */
legstar85 14:3e9991fe64e5 55 #define GET_BLOCK_SIZE 3 /* Get erase block size (needed at _USE_MKFS == 1) */
legstar85 14:3e9991fe64e5 56 #define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at _USE_TRIM == 1) */
legstar85 14:3e9991fe64e5 57
legstar85 14:3e9991fe64e5 58 /* Generic command (Not used by FatFs) */
legstar85 14:3e9991fe64e5 59 #define CTRL_POWER 5 /* Get/Set power status */
legstar85 14:3e9991fe64e5 60 #define CTRL_LOCK 6 /* Lock/Unlock media removal */
legstar85 14:3e9991fe64e5 61 #define CTRL_EJECT 7 /* Eject media */
legstar85 14:3e9991fe64e5 62 #define CTRL_FORMAT 8 /* Create physical format on the media */
legstar85 14:3e9991fe64e5 63
legstar85 14:3e9991fe64e5 64 /* MMC/SDC specific ioctl command */
legstar85 14:3e9991fe64e5 65 #define MMC_GET_TYPE 10 /* Get card type */
legstar85 14:3e9991fe64e5 66 #define MMC_GET_CSD 11 /* Get CSD */
legstar85 14:3e9991fe64e5 67 #define MMC_GET_CID 12 /* Get CID */
legstar85 14:3e9991fe64e5 68 #define MMC_GET_OCR 13 /* Get OCR */
legstar85 14:3e9991fe64e5 69 #define MMC_GET_SDSTAT 14 /* Get SD status */
legstar85 14:3e9991fe64e5 70
legstar85 14:3e9991fe64e5 71 /* ATA/CF specific ioctl command */
legstar85 14:3e9991fe64e5 72 #define ATA_GET_REV 20 /* Get F/W revision */
legstar85 14:3e9991fe64e5 73 #define ATA_GET_MODEL 21 /* Get model name */
legstar85 14:3e9991fe64e5 74 #define ATA_GET_SN 22 /* Get serial number */
legstar85 14:3e9991fe64e5 75
legstar85 14:3e9991fe64e5 76 #ifdef __cplusplus
legstar85 14:3e9991fe64e5 77 }
legstar85 14:3e9991fe64e5 78 #endif
legstar85 14:3e9991fe64e5 79
legstar85 14:3e9991fe64e5 80 #endif
legstar85 14:3e9991fe64e5 81