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

Last change on this file since 256 was 233, checked in by gregli@…, 13 years ago

Serial Port: split single byte port and baud into two bytes, taking advantage of the two bytes in DPT_SERIAL, which supports more serial baud rates and in particular fixed a bug where a 4x client machine couldn't talk to a 115.2K server machine. This is a wide change, touching lots of files, but most are shallow changes. DetectPrint.asm took the most significant changes, now it calculates the baud rate to display instead of using characters provided by the Configurator. The Configurator now has a new menu flag, FLG_MENUITEM_CHOICESTRINGS, for specifying that values are not linear and they should be lookedup rather than indexed. Finally, another important bug fixed here is that in some error cases, the serial port code could get into an infinite loop waiting ont the hardware; now it has a timeout.

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