From: Erik M. <er...@us...> - 2002-01-03 16:07:21
|
Update of /cvsroot/blob/blob/include/blob In directory usw-pr-cvs1:/tmp/cvs-serv2589/include/blob Modified Files: init.h main.h serial.h Log Message: The serial port driver rewrite, part two. This looks quite intrusive, but it's not that large: - rewrite src/lib/serial.c to use the low level serial driver - change semantics for SerialInputByte() and SerialOutputByte(), so rename them to serial_read() and serial_write(). this makes the patch huge - add new INIT_LEVEL for driver selection (has to be done before hardware initialisation) - add machine specific files for all architectures in diag - clean up odds and ends. Index: init.h =================================================================== RCS file: /cvsroot/blob/blob/include/blob/init.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- init.h 2001/10/07 15:27:35 1.2 +++ init.h 2002/01/03 16:07:17 1.3 @@ -63,10 +63,11 @@ #define INIT_LEVEL_MAX (99) /* define some useful levels */ -#define INIT_LEVEL_INITIAL_HARDWARE (0) -#define INIT_LEVEL_PARAM_LIST (10) -#define INIT_LEVEL_OTHER_HARDWARE (20) -#define INIT_LEVEL_OTHER_STUFF (30) +#define INIT_LEVEL_DRIVER_SELECTION (0) +#define INIT_LEVEL_INITIAL_HARDWARE (10) +#define INIT_LEVEL_PARAM_LIST (20) +#define INIT_LEVEL_OTHER_HARDWARE (30) +#define INIT_LEVEL_OTHER_STUFF (40) void init_subsystems(void); Index: main.h =================================================================== RCS file: /cvsroot/blob/blob/include/blob/main.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- main.h 2001/10/31 16:38:52 1.4 +++ main.h 2002/01/03 16:07:17 1.5 @@ -58,8 +58,8 @@ int blobSize; block_source_t blobType; - eBauds downloadSpeed; - eBauds terminalSpeed; + serial_baud_t downloadSpeed; + serial_baud_t terminalSpeed; int load_ramdisk; int boot_delay; Index: serial.h =================================================================== RCS file: /cvsroot/blob/blob/include/blob/serial.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- serial.h 2002/01/02 01:18:57 1.3 +++ serial.h 2002/01/03 16:07:17 1.4 @@ -55,8 +55,8 @@ typedef int (*serial_read_func_t)(void); typedef int (*serial_write_func_t)(int); typedef int (*serial_poll_func_t)(void); -typedef int (*serial_flush_in_func_t)(void); -typedef int (*serial_flush_out_func_t)(void); +typedef int (*serial_flush_input_func_t)(void); +typedef int (*serial_flush_output_func_t)(void); typedef struct { @@ -67,8 +67,8 @@ serial_poll_func_t poll; - serial_flush_in_func_t flush_in; - serial_flush_out_func_t flush_out; + serial_flush_input_func_t flush_input; + serial_flush_output_func_t flush_output; } serial_driver_t; @@ -80,29 +80,18 @@ extern serial_driver_t *serial_driver; -/* ---- OLD STUFF BELOW ----------------------------------- */ - -typedef enum { /* Some useful SA-1100 baud rates */ - baud1k2 = 191, - baud9k6 = 23, - baud19k2 = 11, - baud38k4 = 5, - baud57k6 = 3, - baud115k2 = 1, - baud230k4 = 0 -} eBauds; - +/* exported functions */ +int serial_init(serial_baud_t baudrate); +int serial_read(void); +int serial_write(int c); +int serial_poll(void); -/* Function protos */ -void SerialInit(eBauds baudrate); -void SerialOutputByte(const char c); void SerialOutputString(const char *s); void SerialOutputHex(const u32 h); void SerialOutputDec(const u32 d); void SerialOutputBlock(const char *buf, int bufsize); -int SerialInputByte(char *c); int SerialInputString(char *s, const int len, const int timeout); int SerialInputBlock(char *buf, int bufsize, const int timeout); |