Project 1
|
||
|
||
Handler Tasks and Interrupt Hadlers
|
||
When a character arrives at the serial port of the 68332EVS board an interrupt occurs. You must write an interrupt handler (i.e. notifier) that takes the received character and passes it on to the Handler. The notifier does this by placing the character on a 'handler queue'. If no user task has opened the device for reading, characters received should be sent to the null device (i.e. discarded) and not be echoed at the terminal. If however, at least one user task has opened the device for reading then in the case of an alphanumeric character the Handler simply echoes the character to the screen; i.e. the character is placed on a 'notifier queue'. The character must be sent back out the serial channel. A transmit interrupt occurs just after the USART finishes transmitting a character; i.e. the USART is 'telling you' (by causing an interrupt) that it is ready to transmit another character. The Handler task should be able to perform some simple line editing. That is it should interpret special command characters appearing in the input sequence (such as ^H: erase character, ^W: erase previous word, ^U erase line) and implement these commands by deleting the appropriate entity from the input stream to be delivered to the waiting tasks, and by erasing the echoed characters on the terminal window. The termcap entry for the VT100 is given in Table P1.1
Termcap is a database that contains the capabilities of specific terminal devices. Information about termcap can be found on Unix man pages using the command man 5 termcap. Some pseudo code for the Handler task is shown below. Initialize system Once the first part of the project is completed (i.e. the Handler task and interrupt handlers are written and working correctly) you are required to write some functions that will allow user tasks to access the serial channel. |