|
Page date Sat Mar 5 00:22:16 2011 . | Improve this page |
The OSDeviceCharacter class may or may not derive from streambuf, based on configuration variables.
The OSDeviceCharacterBuffered class implements circular receive/transmit buffers. It is the parent class for devices like USART.
OSDeviceCharacterBuffered is an abstract class, requiring children classes to implement the actual read/write code.
Description
Initialize the buffered character device with the given circular buffers and with custom water mark values.
Parameters
:* pRxBuf - pointer to receive buffer
:* rxBufSize - size of receive buffer
:* rxHWM - receive high water mark
:* rxLWM - receive low water mark
:* tRxBuf - pointer to transmit buffer
:* txBufSize - size of transmit buffer
:* txHWM - transmit high water mark
:* txLWM - transmit low water mark
Return value
:* none
Description
Initialize the buffered character device with the given circular buffers and default 1/4 low and 3/4 high water mark values.
Parameters
:* pRxBuf - pointer to receive buffer
:* rxBufSize - size of receive buffer
:* tRxBuf - pointer to transmit buffer
:* txBufSize - size of transmit buffer
Return value
:* none
Description
Call implPortInit() to open the device.
Parameters
:* none
Return value
:* status
Description
Call implPortDisable() to close the device.
Parameters
:* none
Return value
:* status
Description
Check if the device is connected. Not yet fully implemented, currently just returns returns true.
Parameters
:* none
Return value
:* true if the device is connected
Description
Check if the receive buffer is not empty.
Parameters
:* none
Return value
:* true if characters are available for read
Description
Return the number of available characters in the receive buffer.
Parameters
:* none
Return value
:* number of available characters
Description
Return the next byte available in the receive buffer.
Parameters
:* none
Return value
:* return byte or negative if an error occur
Description
Check if the transmit buffer is not full.
Parameters
:* none
Return value
:* true if transmit queue not full
Description
Add one byte to the transmit buffer. If above high water mark, start transmission by enabling transmit interrupts.
Parameters
:* none
Return value
:* status
Description
If the transmit buffer is above high water mark, start transmission by enabling transmit interrupts.
Parameters
:* none
Return value
:* status of the operation
Description
Implement the receive interrupt service routine. Read from the device and if the receive buffer is not full, insert in it.
Parameters
:* none
Return value
:* none
Description
Implement the transmit interrupt service routine. If the transmit buffer is empty, disable transmit interrupts. Get one byte from the transmit buffer and write it to the device. If the buffer is below the low water mark, notify writer to send more bytes.
Parameters
:* none
Return value
:* none
== virtual int implPortInit(void) = 0 ==
== virtual void implInterruptTxEnable(void) = 0 ==
== virtual void implInterruptTxDisable(void) = 0 ==
== virtual unsigned char implPortRead(void) = 0 ==
== virtual void implPortWrite(unsigned char b) = 0 ==