Imported Upstream version 2.10
[debian/cpmtools] / device.h
1 #ifndef DEVICE_H
2 #define DEVICE_H
3
4 #ifdef _WIN32
5 /* The type of device the file system is on: */
6 #define CPMDRV_FILE  0 /* Regular file or Unix block device */
7 #define CPMDRV_WIN95 1 /* Windows 95 floppy drive accessed via VWIN32 */
8 #define CPMDRV_WINNT 2 /* Windows NT floppy drive accessed via CreateFile */
9 #endif
10
11 struct Device
12 {
13   int opened;
14
15   int secLength;
16   int tracks;
17   int sectrk;
18 #if HAVE_LIBDSK_H
19   DSK_PDRIVER   dev;
20   DSK_GEOMETRY geom; 
21 #endif
22 #if HAVE_WINDOWS_H
23   int drvtype;
24   HANDLE hdisk;
25 #endif
26   int fd;
27 };
28
29 const char *Device_open(struct Device *self, const char *filename, int mode, const char *deviceOpts);
30 void Device_setGeometry(struct Device *self, int secLength, int sectrk, int tracks);
31 const char *Device_close(struct Device *self);
32 const char *Device_readSector(const struct Device *self, int track, int sector, char *buf);
33 const char *Device_writeSector(const struct Device *self, int track, int sector, const char *buf);
34
35 #endif