Lecture27W_F

Lecture27W_F - Serial Driver Design Serial port (SCI0)...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Serial Driver Design Serial port (SCI0) interrrupt · Number of conditions that generate serial port interrupt: two - Receive (Rx) interrupt—character received by SCI0 - Transmit (Tx) interrupt—SCI0 ready to transmit character · ISR pseudo-code Read interrupt status if (RxInterrupt) then Read character from SCI0 RDR Enqueue character in RxQueue ; Character lost if RxQueue full endif endif if (TxInterrupt) then Dequeue character from TxQueue if (dequeue successful) then Write character to SCI0 TDR else Disable TxInterrupt endif endif Page 1 of 3 Serial Driver Design Page 2 of 3 Receive (Rx) and Transmit (Tx) triggers · Rx interrupt—receive data register full (RDRF) SCI0 received character and is ready for character to be read. · Tx interrupt—transmit data register empty (TDRE) SCI0 is ready to accept a character to be transmitted. Software (assembly language program) interface · Needs to be able to send and receive characters over serial link · Must interface with serial driver - Program does not access SCI0 directly. - Instead, program accesses queues for receiving and transmitting. - Characters are sent/received from/to queues by ISR. · RxQueue—queue for receiving characters from serial port. · TxQueue—queue for transmitting characters over serial port. Receive software interface · From software perspective, receiving characters from serial port is dequeuing characters from RxQueue. · Psuedo-code to receive a character in program GetChar: repeat Dequeue character from RxQueue until (dequeue successful) Serial Driver Design Page 3 of 3 Transmit software interface · From software perspective, transmitting characters from serial port is enqueuing characters to TxQueue. · Psuedo-code to transmit a character in program PutChar: repeat Enqueue character until (enqueue successful) Enable TxInterrupt Queues and waiting · If queues are large enough, driver and program do not wait. · Conditions for waiting in assembly language program using serial driver - TxQueue full when PutChar subroutine called - RxQueue empty when GetChar subroutine called ...
View Full Document

This note was uploaded on 05/06/2010 for the course EECC 0306-250 taught by Professor Roymelton during the Fall '10 term at RIT.

Ask a homework question - tutors are online