Go to the documentation of this file.00001 #ifndef DEV_BLOCKDEV_H_
00002 #define DEV_BLOCKDEV_H_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00060 #include <sys/types.h>
00061 #include <stdint.h>
00062 #include <sys/device.h>
00063 #include <sys/file.h>
00064
00069
00074
00076 #define NUTBLKDEV_MEDIAAVAIL 0x1200
00077
00078 #define NUTBLKDEV_MEDIACHANGE 0x1201
00079
00080 #define NUTBLKDEV_INFO 0x1202
00081
00082 #define NUTBLKDEV_SEEK 0x1203
00083
00091 typedef struct _BLKPAR_SEEK {
00092 NUTFILE *par_nfp;
00093 uint32_t par_blknum;
00094 } BLKPAR_SEEK;
00095
00101 typedef struct _BLKPAR_INFO {
00102 NUTFILE *par_nfp;
00103 uint32_t par_nblks;
00104 uint32_t par_blksz;
00105 uint8_t *par_blkbp;
00106 } BLKPAR_INFO;
00107
00109 typedef struct _NUTBLOCKIO NUTBLOCKIO;
00110
00119 struct _NUTBLOCKIO {
00123 void *blkio_info;
00124
00128 uint32_t blkio_blk_cnt;
00129
00133 uint32_t blkio_blk_siz;
00134
00138 uint32_t blkio_vol_bot;
00139
00143 uint32_t blkio_vol_top;
00144
00148 int (*blkio_read) (NUTDEVICE *, uint32_t, void *, int);
00149
00153 int (*blkio_write) (NUTDEVICE *, uint32_t, const void *, int);
00154
00155 #ifdef __HARVARD_ARCH__
00156
00159 int (*blkio_write_P) (NUTDEVICE *, uint32_t, PGM_P, int);
00160 #endif
00161
00165 int (*blkio_ioctl)(NUTDEVICE *, int, void *);
00166 };
00167
00170 extern int NutBlockDeviceInit(NUTDEVICE * dev);
00171 extern NUTFILE *NutBlockDeviceOpen(NUTDEVICE * dev, const char *name, int mode, int acc);
00172 extern int NutBlockDeviceClose(NUTFILE * nfp);
00173 extern int NutBlockDeviceIOCtl(NUTDEVICE * dev, int req, void *conf);
00174 extern int NutBlockDeviceRead(NUTFILE * nfp, void *buffer, int num);
00175 extern int NutBlockDeviceWrite(NUTFILE *nfp, const void *buffer, int num);
00176 extern long NutBlockDeviceSize(NUTFILE *nfp);
00177 #ifdef __HARVARD_ARCH__
00178 extern int NutBlockDeviceWrite_P(NUTFILE * nfp, PGM_P buffer, int num);
00179 #endif
00180
00181 #endif