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
RevLine 
[209]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
[277]11#define SERIAL_SERVER_MAJORVERSION 1
12#define SERIAL_SERVER_MINORVERSION 0
13
[219]14void log( int level, char *message, ... );
[209]15
16unsigned long GetTime(void);
17unsigned long GetTime_Timeout(void);
18
19unsigned short checksum( unsigned short *wbuff, int wlen );
20
[259]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
[209]32class Image
33{
34public:
[219]35    virtual void seekSector( unsigned long lba ) = 0;
[209]36
[219]37    virtual void writeSector( void *buff ) = 0;
[223]38
[219]39    virtual void readSector( void *buff ) = 0;
[209]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 );
[217]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 );
[209]44
45    virtual ~Image() {};
46
47    unsigned long cyl, sect, head;
[258]48    unsigned char floppy, floppyType;
[217]49    int useCHS;
[209]50
51    unsigned long totallba;
[223]52
[209]53    char *shortFileName;
54    int readOnly;
55    int drive;
56
[217]57    static int parseGeometry( char *str, unsigned long *p_cyl, unsigned long *p_head, unsigned long *p_sect );
[209]58
[277]59    void respondInquire( unsigned short *buff, unsigned short originalPortAndBaud, struct baudRate *baudRate, unsigned short port, unsigned char scan );
[209]60
[217]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 );
[209]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
[219]72#ifdef WIN32
73#include "../win32/win32serial.h"
74#else
[223]75// there is no standard way to read/write and configure the serial port, OS specific only
[219]76#endif
[209]77
[219]78#ifdef WIN32
79#include "../win32/win32file.h"
80#else
81#include "file.h"
82#endif
[209]83
[219]84void processRequests( SerialAccess *serial, Image *image0, Image *image1, int timeoutEnabled, int verboseLevel );
[209]85
86#endif
Note: See TracBrowser for help on using the repository browser.