source: xtideuniversalbios/trunk/Serial_Server/library/Library.h @ 259

Last change on this file since 259 was 259, checked in by gregli@…, 12 years ago

For function int13/0h, restored the code to only reset the floppy drives if a floppy drive was passed in for reset. Other minor optimizations. Better create new floppy support in Serial Server.

File size: 2.2 KB
Line 
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
11void log( int level, char *message, ... );
12
13unsigned long GetTime(void);
14unsigned long GetTime_Timeout(void);
15
16unsigned short checksum( unsigned short *wbuff, int wlen );
17
18struct 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
27struct floppyInfo *FindFloppyInfoBySize( double size );
28
29class Image
30{
31public:
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
61struct baudRate {
62    unsigned long rate;
63    unsigned char divisor;
64    char *display;
65};
66struct baudRate *baudRateMatchString( char *str );
67struct 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
81void processRequests( SerialAccess *serial, Image *image0, Image *image1, int timeoutEnabled, int verboseLevel );
82
83#endif
Note: See TracBrowser for help on using the repository browser.