1 | //======================================================================
|
---|
2 | //
|
---|
3 | // Project: XTIDE Universal BIOS, Serial Port Server
|
---|
4 | //
|
---|
5 | // File: library.h - Include file for users of the library
|
---|
6 | //
|
---|
7 |
|
---|
8 | #ifndef LIBRARY_H_INCLUDED
|
---|
9 | #define LIBRARY_H_INCLUDED
|
---|
10 |
|
---|
11 | void log( int level, char *message, ... );
|
---|
12 |
|
---|
13 | unsigned long GetTime(void);
|
---|
14 | unsigned long GetTime_Timeout(void);
|
---|
15 |
|
---|
16 | unsigned short checksum( unsigned short *wbuff, int wlen );
|
---|
17 |
|
---|
18 | struct floppyInfo {
|
---|
19 | unsigned char real;
|
---|
20 | unsigned long size;
|
---|
21 | unsigned char type;
|
---|
22 | unsigned char cylinders;
|
---|
23 | unsigned char heads;
|
---|
24 | unsigned char sectors;
|
---|
25 | };
|
---|
26 |
|
---|
27 | struct floppyInfo *FindFloppyInfoBySize( double size );
|
---|
28 |
|
---|
29 | class Image
|
---|
30 | {
|
---|
31 | public:
|
---|
32 | virtual void seekSector( unsigned long lba ) = 0;
|
---|
33 |
|
---|
34 | virtual void writeSector( void *buff ) = 0;
|
---|
35 |
|
---|
36 | virtual void readSector( void *buff ) = 0;
|
---|
37 |
|
---|
38 | Image( char *name, int p_readOnly, int p_drive );
|
---|
39 | Image( char *name, int p_readOnly, int p_drive, int p_create, unsigned long p_lba );
|
---|
40 | Image( char *name, int p_readOnly, int p_drive, int p_create, unsigned long p_cyl, unsigned long p_head, unsigned long p_sect, int p_useCHS );
|
---|
41 |
|
---|
42 | virtual ~Image() {};
|
---|
43 |
|
---|
44 | unsigned long cyl, sect, head;
|
---|
45 | unsigned char floppy, floppyType;
|
---|
46 | int useCHS;
|
---|
47 |
|
---|
48 | unsigned long totallba;
|
---|
49 |
|
---|
50 | char *shortFileName;
|
---|
51 | int readOnly;
|
---|
52 | int drive;
|
---|
53 |
|
---|
54 | static int parseGeometry( char *str, unsigned long *p_cyl, unsigned long *p_head, unsigned long *p_sect );
|
---|
55 |
|
---|
56 | void respondInquire( unsigned short *buff, struct baudRate *baudRate, unsigned short port, unsigned char scan );
|
---|
57 |
|
---|
58 | void init( char *name, int p_readOnly, int p_drive, unsigned long p_cyl, unsigned long p_head, unsigned long p_sect, int p_useCHS );
|
---|
59 | };
|
---|
60 |
|
---|
61 | struct baudRate {
|
---|
62 | unsigned long rate;
|
---|
63 | unsigned char divisor;
|
---|
64 | char *display;
|
---|
65 | };
|
---|
66 | struct baudRate *baudRateMatchString( char *str );
|
---|
67 | struct baudRate *baudRateMatchDivisor( unsigned char divisor );
|
---|
68 |
|
---|
69 | #ifdef WIN32
|
---|
70 | #include "../win32/win32serial.h"
|
---|
71 | #else
|
---|
72 | // there is no standard way to read/write and configure the serial port, OS specific only
|
---|
73 | #endif
|
---|
74 |
|
---|
75 | #ifdef WIN32
|
---|
76 | #include "../win32/win32file.h"
|
---|
77 | #else
|
---|
78 | #include "file.h"
|
---|
79 | #endif
|
---|
80 |
|
---|
81 | void processRequests( SerialAccess *serial, Image *image0, Image *image1, int timeoutEnabled, int verboseLevel );
|
---|
82 |
|
---|
83 | #endif
|
---|