The serial library provides a very simple device driver for the
serial port chipset found in the U4600 machine.
struct serial * serial_init(bs_seq spaces)
serial_init initalises the state of the serial
driver and returns a handle that must be passed to other serial
spaces parameter defines where in
physical memory the serial chips have been mapped. The provided
hardware.c provides an example of how this
int serial_interrupt_handler(struct serial
serial_interrupt_handler should be called when
ever and interrupt for the serial device occurs. The
serial parameter should be a variable previously
hardware.c provides an example of how this function
int serial_send(struct serial *serial, char *data, int
serial_send will write
len bytes of
data to the serial line. This function returns the
number of bytes written, which may be less than
len. This occurs if the serial driver's internal
buffer fills faster than it can actually output data. In this
case it is up to the calling code to handle the situation,
either by retrying or returning an error to the user.
It should be noted that the serial driver performs conversion
int serial_register_handler(struct serial *serial,
void (*handler) (char c));
To receive input from the serial line you must register a
handler function, which will be called by the
serial driver when input is available. The provided function
simply takes the inputted character as it's only argument. This
function will be called during the interrupt context so it
should be reasonably light-weight.
23 Aug 2004.