?login_element?

Subversion Repositories NedoOS

Rev

Rev 119 | Blame | Compare with Previous | Last modification | View Log | Download

  1. /*-----------------------------------------------------------------------
  2. /  Low level disk interface modlue include file
  3. /-----------------------------------------------------------------------*/
  4.  
  5. #ifndef _DISKIO
  6.  
  7. #define _READONLY       0       /* 1: Remove write functions */
  8. #define _USE_IOCTL      1       /* 1: Use disk_ioctl fucntion */
  9.  
  10. #include "integer.h"
  11.  
  12.  
  13.  
  14. /* Status of Disk Functions */
  15. typedef BYTE    DSTATUS;
  16.  
  17. /* Results of Disk Functions */
  18. typedef enum {
  19.         RES_OK = 0,             /* 0: Successful */
  20.         RES_ERROR,              /* 1: R/W Error */
  21.         RES_WRPRT,              /* 2: Write Protected */
  22.         RES_NOTRDY,             /* 3: Not Ready */
  23.         RES_PARERR              /* 4: Invalid Parameter */
  24. } DRESULT;
  25.  
  26. //Parameters for disk_read and disk_write
  27. typedef struct {
  28.         DRESULT (*init)(BYTE,BYTE*);
  29.         unsigned char (*status)(BYTE);
  30.         DRESULT (*read_to_uspace)(void);
  31.         DRESULT (*read_to_buf)(void);
  32.         DRESULT (*write_from_uspace)(void);
  33.         DRESULT (*write_from_buf)(void);
  34.         void (*RTC)(DWORD*);
  35.         void (*strcpy_lib2usp)(void *, const void *);
  36.         void (*strcpy_usp2lib)(void *, const void *);
  37.         void (*memcpy_lib2usp)(void *, const void *, unsigned int);
  38.         void (*memcpy_usp2lib)(void *, const void *, unsigned int);
  39.         void (*memcpy_buf2usp)(void *, const void *, unsigned int);
  40.         void (*memcpy_usp2buf)(void *, const void *, unsigned int);
  41.         BYTE  drv;
  42.         const   BYTE*   buf;
  43.         DWORD*                  sec;
  44.         BYTE                    num;
  45.         FATFS *                 curr_fatfs;
  46.         DWORD                   curr_dir;
  47. } DIO_PAR;
  48. extern DIO_PAR drv_calls;
  49. #define SET_DIO_PAR(dr_drv,dr_buf,dr_sec,dr_num) {\
  50.   drv_calls.drv=dr_drv; \
  51.   drv_calls.buf=dr_buf; \
  52.   drv_calls.sec=&dr_sec; \
  53.   drv_calls.num=dr_num;}
  54.  
  55.  
  56. /*---------------------------------------*/
  57. /* Prototypes for disk control functions */
  58.  
  59. int assign_drives (int, int);
  60.  
  61. #define disk_initialize drv_calls.init
  62. //DSTATUS disk_initialize (BYTE,BYTE*);
  63.  
  64. //#define disk_read drv_calls.read
  65. //DRESULT disk_read (void);
  66.  
  67. #if     _READONLY == 0
  68. //#define disk_write drv_calls.write
  69. //DRESULT disk_write (void);
  70. #endif
  71. #define disk_ioctl(_ab,_ac,_ad) ((DRESULT)0)
  72. //extern BYTE ds_m[3];
  73. /* Disk Status Bits (DSTATUS) */
  74.  
  75. #define STA_NOINIT              0x01    /* Drive not initialized */
  76. #define STA_NODISK              0x02    /* No medium in the drive */
  77. #define STA_PROTECT             0x04    /* Write protected */
  78. #define disk_status drv_calls.status
  79.  
  80. /* Command code for disk_ioctrl fucntion */
  81.  
  82. /* Generic command (defined for FatFs) */
  83. #define CTRL_SYNC                       0       /* Flush disk cache (for write functions) */
  84. #define GET_SECTOR_COUNT        1       /* Get media size (for only f_mkfs()) */
  85. #define GET_SECTOR_SIZE         2       /* Get sector size (for multiple sector size (_MAX_SS >= 1024)) */
  86. #define GET_BLOCK_SIZE          3       /* Get erase block size (for only f_mkfs()) */
  87. #define CTRL_ERASE_SECTOR       4       /* Force erased a block of sectors (for only _USE_ERASE) */
  88.  
  89. /* Generic command */
  90. #define CTRL_POWER                      5       /* Get/Set power status */
  91. #define CTRL_LOCK                       6       /* Lock/Unlock media removal */
  92. #define CTRL_EJECT                      7       /* Eject media */
  93.  
  94. /* MMC/SDC specific ioctl command */
  95. #define MMC_GET_TYPE            10      /* Get card type */
  96. #define MMC_GET_CSD                     11      /* Get CSD */
  97. #define MMC_GET_CID                     12      /* Get CID */
  98. #define MMC_GET_OCR                     13      /* Get OCR */
  99. #define MMC_GET_SDSTAT          14      /* Get SD status */
  100.  
  101. /* ATA/CF specific ioctl command */
  102. #define ATA_GET_REV                     20      /* Get F/W revision */
  103. #define ATA_GET_MODEL           21      /* Get model name */
  104. #define ATA_GET_SN                      22      /* Get serial number */
  105.  
  106. /* NAND specific ioctl command */
  107. #define NAND_FORMAT                     30      /* Create physical format */
  108.  
  109.  
  110. #define _DISKIO
  111. #endif
  112.