Go to index, previous page, next page

devices.cc

This module exports:

void InitIntTable( void ) explained below
void DeviceHandler( int cause ) explained below


Look at the header file: devices.e


Module functions:

void InitIntTable( void ) This function initialise the interrupt table of the kernel: it's used to keep track of unhandled device interrupts, so that a thread won't skip them if they arrive before the corresponding WAITFORIO message is processed by the SSI.

The table entries are filled with 0xFF if the corresponding device exists, with 0x00 otherwise.

Note that terminal devices have 2 subdevices each, so an extra row is used to map the second of them.

void DeviceHandler( int cause ) This function is called by the main trap handler (see trap.cc) when an interrupt from a device arrives.

It checks all the pending interrupts, storing the status of the devices or awaking blocked thread if necessary and sends the ACK code to the device to clear the interrupt line.

void HandleTerminal( devreg *reg, unsigned char *storage ) Checks whether reg has raised the interrupt line: if so process the interrupt.
void HandleOtherDevice( devreg *reg, unsigned char *storage ) Process the interrupt from the reg device.
void WakeUpThread( devreg *vba, int status ) Search for the device which is waiting an interrupt from the device whose virtual base address matches vba and if it finds it, it moves it into the ready queue, setting the return code of the MsgRecv() which blocked it to the device status.


Look at the code: devices.cc


Go to index, previous page, next page