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 | class Image
|
---|
19 | {
|
---|
20 | public:
|
---|
21 | virtual void seekSector( unsigned long lba ) = 0;
|
---|
22 |
|
---|
23 | virtual void writeSector( void *buff ) = 0;
|
---|
24 |
|
---|
25 | virtual void readSector( void *buff ) = 0;
|
---|
26 |
|
---|
27 | Image( char *name, int p_readOnly, int p_drive );
|
---|
28 | Image( char *name, int p_readOnly, int p_drive, int p_create, unsigned long p_lba );
|
---|
29 | 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 );
|
---|
30 |
|
---|
31 | virtual ~Image() {};
|
---|
32 |
|
---|
33 | unsigned long cyl, sect, head;
|
---|
34 | unsigned char floppy, floppyType;
|
---|
35 | int useCHS;
|
---|
36 |
|
---|
37 | unsigned long totallba;
|
---|
38 |
|
---|
39 | char *shortFileName;
|
---|
40 | int readOnly;
|
---|
41 | int drive;
|
---|
42 |
|
---|
43 | static int parseGeometry( char *str, unsigned long *p_cyl, unsigned long *p_head, unsigned long *p_sect );
|
---|
44 |
|
---|
45 | void respondInquire( unsigned short *buff, struct baudRate *baudRate, unsigned short port, unsigned char scan );
|
---|
46 |
|
---|
47 | 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 );
|
---|
48 | };
|
---|
49 |
|
---|
50 | struct baudRate {
|
---|
51 | unsigned long rate;
|
---|
52 | unsigned char divisor;
|
---|
53 | char *display;
|
---|
54 | };
|
---|
55 | struct baudRate *baudRateMatchString( char *str );
|
---|
56 | struct baudRate *baudRateMatchDivisor( unsigned char divisor );
|
---|
57 |
|
---|
58 | #ifdef WIN32
|
---|
59 | #include "../win32/win32serial.h"
|
---|
60 | #else
|
---|
61 | // there is no standard way to read/write and configure the serial port, OS specific only
|
---|
62 | #endif
|
---|
63 |
|
---|
64 | #ifdef WIN32
|
---|
65 | #include "../win32/win32file.h"
|
---|
66 | #else
|
---|
67 | #include "file.h"
|
---|
68 | #endif
|
---|
69 |
|
---|
70 | void processRequests( SerialAccess *serial, Image *image0, Image *image1, int timeoutEnabled, int verboseLevel );
|
---|
71 |
|
---|
72 | #endif
|
---|