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

Last change on this file since 266 was 259, checked in by gregli@…, 13 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
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
[219]11void log( int level, char *message, ... );
[209]12
13unsigned long GetTime(void);
14unsigned long GetTime_Timeout(void);
15
16unsigned short checksum( unsigned short *wbuff, int wlen );
17
[259]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
[209]29class Image
30{
31public:
[219]32 virtual void seekSector( unsigned long lba ) = 0;
[209]33
[219]34 virtual void writeSector( void *buff ) = 0;
[223]35
[219]36 virtual void readSector( void *buff ) = 0;
[209]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 );
[217]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 );
[209]41
42 virtual ~Image() {};
43
44 unsigned long cyl, sect, head;
[258]45 unsigned char floppy, floppyType;
[217]46 int useCHS;
[209]47
48 unsigned long totallba;
[223]49
[209]50 char *shortFileName;
51 int readOnly;
52 int drive;
53
[217]54 static int parseGeometry( char *str, unsigned long *p_cyl, unsigned long *p_head, unsigned long *p_sect );
[209]55
[233]56 void respondInquire( unsigned short *buff, struct baudRate *baudRate, unsigned short port, unsigned char scan );
[209]57
[217]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 );
[209]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
[219]69#ifdef WIN32
70#include "../win32/win32serial.h"
71#else
[223]72// there is no standard way to read/write and configure the serial port, OS specific only
[219]73#endif
[209]74
[219]75#ifdef WIN32
76#include "../win32/win32file.h"
77#else
78#include "file.h"
79#endif
[209]80
[219]81void processRequests( SerialAccess *serial, Image *image0, Image *image1, int timeoutEnabled, int verboseLevel );
[209]82
83#endif
Note: See TracBrowser for help on using the repository browser.