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

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

Moved the bulk of the serial code to the assembly library, for inclusion in other utilities. Fixed a bug in int13h.asm when floppy support was not enabled that was preventing foreign drives from working properly.

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