ACE I/O function prototypes. More...
#include <sys/device.h>
Go to the source code of this file.
Defines | |
#define | ACE_SETSPEED 0x0101 |
ACE _ioctl() command code to set the line speed. | |
#define | ACE_GETSPEED 0x0102 |
ACE _ioctl() command code to query the line speed. | |
#define | ACE_SETDATABITS 0x0103 |
ACE _ioctl() command code to set the number of data bits. | |
#define | ACE_GETDATABITS 0x0104 |
ACE _ioctl() command code to query the number of data bits. | |
#define | ACE_SETPARITY 0x0105 |
ACE _ioctl() command code to set the parity mode. | |
#define | ACE_GETPARITY 0x0106 |
ACE _ioctl() command code to query the parity mode. | |
#define | ACE_SETSTOPBITS 0x0107 |
ACE _ioctl() command code to set the number of stop bits. | |
#define | ACE_GETSTOPBITS 0x0108 |
ACE _ioctl() command code to query the number of stop bits. | |
#define | ACE_SETSTATUS 0x0109 |
ACE _ioctl() command code to set the status. | |
#define | ACE_GETSTATUS 0x010a |
ACE _ioctl() command code to query the status. | |
#define | ACE_SETREADTIMEOUT 0x010b |
ACE _ioctl() command code to set the read timeout. | |
#define | ACE_GETREADTIMEOUT 0x010c |
ACE _ioctl() command code to query the read timeout. | |
#define | ACE_SETWRITETIMEOUT 0x010d |
ACE _ioctl() command code to set the write timeout. | |
#define | ACE_GETWRITETIMEOUT 0x010e |
ACE _ioctl() command code to query the write timeout. | |
#define | ACE_SETLOCALECHO 0x010f |
ACE _ioctl() command code to set the local echo mode. | |
#define | ACE_GETLOCALECHO 0x0110 |
ACE _ioctl() command code to query the local echo mode. | |
#define | ACE_SETFLOWCONTROL 0x0111 |
ACE _ioctl() command code to set the flow control mode. | |
#define | ACE_GETFLOWCONTROL 0x0112 |
ACE _ioctl() command code to query the flow control mode. | |
#define | ACE_SETCOOKEDMODE 0x0113 |
ACE _ioctl() command code to set the cooking mode. | |
#define | ACE_GETCOOKEDMODE 0x0114 |
ACE _ioctl() command code to query the cooking mode. | |
#define | ACE_SETBUFFERMODE 0x0115 |
ACE _ioctl() command code to set the buffering mode. | |
#define | ACE_GETBUFFERMODE 0x0116 |
ACE _ioctl() command code to query the buffering mode. | |
#define | ACE_SETTXBUFSIZ 0x011b |
ACE _ioctl() command code to set the transmit buffer size. | |
#define | ACE_GETTXBUFSIZ 0x011c |
ACE _ioctl() command code to query the transmit buffer size. | |
#define | ACE_SETRXBUFSIZ 0x011d |
ACE _ioctl() command code to set the receive buffer size. | |
#define | ACE_GETRXBUFSIZ 0x011e |
ACE _ioctl() command code to query the receive buffer size. | |
#define | ACE_SETTXBUFLWMARK 0x0120 |
ACE _ioctl() command code to set the transmit buffer low watermark. | |
#define | ACE_GETTXBUFLWMARK 0x0121 |
ACE _ioctl() command code to query the transmit buffer low watermark. | |
#define | ACE_SETTXBUFHWMARK 0x0122 |
ACE _ioctl() command code to set the transmit buffer high watermark. | |
#define | ACE_GETTXBUFHWMARK 0x0123 |
ACE _ioctl() command code to query the transmit buffer high watermark. | |
#define | ACE_SETRXBUFLWMARK 0x0124 |
ACE _ioctl() command code to set the receive buffer low watermark. | |
#define | ACE_GETRXBUFLWMARK 0x0125 |
ACE _ioctl() command code to query the receive buffer low watermark. | |
#define | ACE_SETRXBUFHWMARK 0x0126 |
ACE _ioctl() command code to set the receive buffer high watermark. | |
#define | ACE_GETRXBUFHWMARK 0x0127 |
ACE _ioctl() command code to query the receive buffer high watermark. | |
#define | ACE_SETBLOCKREAD 0x0128 |
ACE _ioctl() command code to set the block read mode. | |
#define | ACE_GETBLOCKREAD 0x0129 |
ACE _ioctl() command code to query the receive buffer high watermark. | |
#define | ACE_SETFIFO 0x012a |
ACE _ioctl() command code to set the fifo mode and receive fifo trigger level. | |
#define | ACE_GETFIFO 0x012b |
ACE _ioctl() command code to query the fifo mode and receive fifo trigger level. | |
#define | ACE_FRAMINGERROR 0x00000001UL |
Framing error. | |
#define | ACE_OVERRUNERROR 0x00000002UL |
Overrun error. | |
#define | ACE_PARITYERROR 0x00000004UL |
Parity error. | |
#define | ACE_ERRORS (ACE_FRAMINGERROR | ACE_OVERRUNERROR | ACE_PARITYERROR) |
ACE errors. | |
#define | ACE_RXBUFFEREMPTY 0x00000040UL |
Receiver buffer empty. | |
#define | ACE_TXBUFFEREMPTY 0x00000080UL |
Transmitter buffer empty. | |
#define | ACE_RTSENABLED 0x00000100UL |
RTS handshake output enabled. | |
#define | ACE_RTSDISABLED 0x00000200UL |
RTS handshake output disabled. | |
#define | ACE_CTSENABLED 0x00000400UL |
CTS handshake input enabled. | |
#define | ACE_CTSDISABLED 0x00000800UL |
CTS handshake input disabled. | |
#define | ACE_DTRENABLED 0x00001000UL |
DTR handshake output enabled. | |
#define | ACE_DTRDISABLED 0x00002000UL |
DTR handshake output disabled. | |
#define | ACE_RXENABLED 0x00010000UL |
Receiver enabled. | |
#define | ACE_RXDISABLED 0x00020000UL |
Receiver enabled. | |
#define | ACE_TXENABLED 0x00040000UL |
Transmitter enabled. | |
#define | ACE_TXDISABLED 0x00080000UL |
Transmitter enabled. | |
#define | ACE_HS_RTSCTS 0x0003 |
RTS / CTS hardware handshake. | |
#define | ACE_HS_MODEM 0x001F |
Full modem hardware handshake. | |
#define | ACE_HS_SOFT 0x0020 |
XON / XOFF software handshake. | |
Functions | |
int | AceInit (NUTDEVICE *dev) |
Initialize on chip ACE device. | |
int | AceIOCtl (NUTDEVICE *dev, int req, void *conf) |
Perform ACE control functions. | |
int | AceInput (NUTDEVICE *dev) |
Wait for input. | |
int | AceOutput (NUTDEVICE *dev) |
Initiate output. | |
int | AceFlush (NUTDEVICE *dev) |
Wait for output buffer empty. | |
int | AceGetRaw (uint8_t *cp) |
int | AcePutRaw (uint8_t ch) |
int | AceRead (NUTFILE *fp, void *buffer, int size) |
Read from device. | |
int | AceWrite (NUTFILE *fp, CONST void *buffer, int len) |
int | AceWrite_P (NUTFILE *fp, PGM_P buffer, int len) |
NUTFILE * | AceOpen (NUTDEVICE *dev, CONST char *name, int mode, int acc) |
Open a device or file. | |
long | AceSize (NUTFILE *fp) |
Request file size. | |
int | AceClose (NUTFILE *fp) |
Close a device or file. |
ACE I/O function prototypes.
Definition in file ace.h.
int AceInit | ( | NUTDEVICE * | dev | ) |
Initialize on chip ACE device.
Prepares the device for subsequent reading or writing. Enables ACE transmitter and receiver interrupts.
dev | Identifies the device to initialize. |
Definition at line 743 of file tlc16c550.c.
References ACE_MF_NOBUFFER, ACE_SETDATABITS, ACE_SETFLOWCONTROL, ACE_SETPARITY, ACE_SETSPEED, ACE_SETSTOPBITS, AceFlush(), AceInput(), AceIOCtl(), AceOutput(), _ACEDCB::dcb_modeflags, _ACEDCB::dcb_rfifo, _ACEDCB::dcb_wfifo, _NUTDEVICE::dev_base, _NUTDEVICE::dev_dcb, _NUTDEVICE::dev_icb, _NUTDEVICE::dev_irq, _ACEDCB::dev_next, _NUTDEVICE::dev_type, _IFSTREAM::if_flush, _IFSTREAM::if_input, _IFSTREAM::if_output, IFTYP_STREAM, memset(), tagIRQDEFS::nMask, NutRegisterIrqHandler(), tagIRQDEFS::pnIrqMskPort, tagIRQDEFS::pvIrq, sbi, and sig_OUTPUT_COMPARE3A.
int AceIOCtl | ( | NUTDEVICE * | dev, |
int | req, | ||
void * | conf | ||
) |
Perform ACE control functions.
dev | Identifies the device that receives the device-control function. |
req | Requested control function. May be set to one of the following constants:
|
conf | Points to a buffer that contains any data required for the given control function or receives data from that function. |
Definition at line 484 of file tlc16c550.c.
References ACE_CLOCK, ACE_DLL_OFS, ACE_DLM_OFS, ACE_FCR_OFS, ACE_FIFO_SIZE, ACE_GETCOOKEDMODE, ACE_GETDATABITS, ACE_GETFIFO, ACE_GETFLOWCONTROL, ACE_GETLOCALECHO, ACE_GETPARITY, ACE_GETREADTIMEOUT, ACE_GETSPEED, ACE_GETSTATUS, ACE_GETSTOPBITS, ACE_GETWRITETIMEOUT, ACE_LCR_OFS, ACE_MF_COOKEDMODE, ACE_MF_HALFDUPLEX, ACE_MF_LOCALECHO, ACE_SETCOOKEDMODE, ACE_SETDATABITS, ACE_SETFIFO, ACE_SETFLOWCONTROL, ACE_SETLOCALECHO, ACE_SETPARITY, ACE_SETREADTIMEOUT, ACE_SETSPEED, ACE_SETSTATUS, ACE_SETSTOPBITS, ACE_SETWRITETIMEOUT, _ACEDCB::dcb_modeflags, _ACEDCB::dcb_rfifo, _ACEDCB::dcb_rtimeout, _ACEDCB::dcb_tx_rdy, _ACEDCB::dcb_wfifo, _ACEDCB::dcb_wtimeout, _NUTDEVICE::dev_base, _NUTDEVICE::dev_dcb, _NUTDEVICE::dev_icb, FCR_ENABLE, FCR_LEVEL_1, FCR_LEVEL_14, FCR_LEVEL_4, FCR_LEVEL_8, FCR_PURGE_I, FCR_PURGE_O, _IFSTREAM::if_tx_act, _IFSTREAM::if_tx_idx, _IFSTREAM::if_wr_idx, LCR_ENB_MSK, LCR_PEN_MSK, LCR_PRE_MSK, LCR_PRS_MSK, LCR_STB_MSK, LCR_WS0_MSK, LCR_WS1_MSK, and NutEventPostAsync().
Referenced by AceInit().
int AceInput | ( | NUTDEVICE * | dev | ) |
Wait for input.
This function checks the input buffer for any data. If the buffer is empty, the calling thread will be blocked until at least one new character is received or a timeout occurs.
dev | Indicates the ACE device. |
Definition at line 305 of file tlc16c550.c.
References _ACEDCB::dcb_rtimeout, _ACEDCB::dcb_rx_rdy, _NUTDEVICE::dev_dcb, _NUTDEVICE::dev_icb, _IFSTREAM::if_rd_idx, _IFSTREAM::if_rx_idx, and NutEventWaitNext().
Referenced by AceInit(), and AceRead().
int AceOutput | ( | NUTDEVICE * | dev | ) |
Initiate output.
This function checks the output buffer for any data. If the buffer contains at least one character, the transmitter is started, if not already running. The function returns immediately, without waiting for the character being completely transmitted. Any remaining characters in the output buffer are transmitted in the background.
dev | Indicates the ACE device. |
Definition at line 331 of file tlc16c550.c.
References ACE_MF_HALFDUPLEX, ACE_THR_OFS, _ACEDCB::dcb_modeflags, _ACEDCB::dcb_wfifo, _NUTDEVICE::dev_base, _NUTDEVICE::dev_dcb, _NUTDEVICE::dev_icb, _IFSTREAM::if_tx_act, _IFSTREAM::if_tx_buf, _IFSTREAM::if_tx_idx, and _IFSTREAM::if_wr_idx.
Referenced by AceFlush(), and AceInit().
int AceFlush | ( | NUTDEVICE * | dev | ) |
Wait for output buffer empty.
If the output buffer contains any data, the calling thread is suspended until all data has been transmitted.
dev | Indicates the ACE device. |
Definition at line 365 of file tlc16c550.c.
References AceOutput(), _ACEDCB::dcb_tx_rdy, _NUTDEVICE::dev_dcb, _NUTDEVICE::dev_icb, _IFSTREAM::if_tx_idx, _IFSTREAM::if_wr_idx, and NutEventWaitNext().
Referenced by AceInit(), and AcePut().
int AceGetRaw | ( | uint8_t * | cp | ) |
int AcePutRaw | ( | uint8_t | ch | ) |
int AceRead | ( | NUTFILE * | fp, |
void * | buffer, | ||
int | size | ||
) |
Read from device.
Definition at line 843 of file tlc16c550.c.
References ACE_MF_COOKEDMODE, AceInput(), _ACEDCB::dcb_modeflags, _NUTDEVICE::dev_dcb, _NUTDEVICE::dev_icb, _IFSTREAM::if_last_eol, _IFSTREAM::if_rd_idx, _IFSTREAM::if_rx_buf, _IFSTREAM::if_rx_idx, and _NUTFILE::nf_dev.
int AceWrite | ( | NUTFILE * | fp, |
CONST void * | buffer, | ||
int | len | ||
) |
Definition at line 967 of file tlc16c550.c.
References AcePut(), and _NUTFILE::nf_dev.
int AceWrite_P | ( | NUTFILE * | fp, |
PGM_P | buffer, | ||
int | len | ||
) |
Definition at line 972 of file tlc16c550.c.
References AcePut(), CONST, and _NUTFILE::nf_dev.
Open a device or file.
Definition at line 981 of file tlc16c550.c.
References _O_BINARY, ACE_MF_COOKEDMODE, _ACEDCB::dcb_modeflags, _NUTDEVICE::dev_dcb, _NUTFILE::nf_dev, _NUTFILE::nf_fcb, _NUTFILE::nf_next, NUTFILE_EOF, and NutHeapAlloc.
long AceSize | ( | NUTFILE * | fp | ) |
Request file size.
Definition at line 1015 of file tlc16c550.c.
References _NUTDEVICE::dev_icb, _IFSTREAM::if_rd_idx, _IFSTREAM::if_rx_idx, and _NUTFILE::nf_dev.
int AceClose | ( | NUTFILE * | fp | ) |