tlc16c550.c File Reference

Go to the source code of this file.
#define ACE_RBR_OFS   0
#define ACE_THR_OFS   0
#define ACE_DLL_OFS   0
#define ACE_DLM_OFS   1
#define ACE_IER_OFS   1
#define ACE_FCR_OFS   2
#define ACE_IIR_OFS   2
#define ACE_LCR_OFS   3
#define ACE_MCR_OFS   4
#define ACE_LSR_OFS   5
#define ACE_MSR_OFS   6
#define ACE_SRC_OFS   7
#define IER_RDA_MSK   0x01
#define IER_THE_MSK   0x02
#define IER_LST_MSK   0x04
#define IER_MST_MSK   0x08
#define FCR_ENABLE   0x01
#define FCR_PURGE_I   0x02
#define FCR_PURGE_O   0x04
#define FCR_LEVEL_1   0x00
#define FCR_LEVEL_4   0x40
#define FCR_LEVEL_8   0x80
#define FCR_LEVEL_14   0xc0
#define IIR_MST_MSK   0x00
#define IIR_TXE_MSK   0x02
#define IIR_RDA_MSK   0x04
#define IIR_TDA_MSK   0x0c
#define IIR_LST_MSK   0x06
#define IIR_NON_MSK   0x01
#define IIR_FIFO_MSK   0xc0
#define LCR_WS0_MSK   0x01
#define LCR_WS1_MSK   0x02
#define LCR_STB_MSK   0x04
#define LCR_PEN_MSK   0x08
#define LCR_PRE_MSK   0x10
#define LCR_PRS_MSK   0x20
#define LCR_BRK_MSK   0x40
#define LCR_ENB_MSK   0x80
#define MCR_DTR_MSK   0x01
#define MCR_RTS_MSK   0x02
#define MCR_GP1_MSK   0x04
#define MCR_GP2_MSK   0x08
#define MCR_LOP_MSK   0x10
#define LSR_RDR_MSK   0x01
#define LSR_OVR_MSK   0x02
#define LSR_PER_MSK   0x04
#define LSR_FER_MSK   0x08
#define LSR_BDT_MSK   0x10
#define LSR_THE_MSK   0x20
#define LSR_TXE_MSK   0x40
#define LSR_EIF_MSK   0x80
#define MSR_DCTS_MSK   0x01
#define MSR_DDSR_MSK   0x02
#define MSR_DRI_MSK   0x04
#define MSR_DDCD_MSK   0x08
#define MSR_CTS_MSK   0x10
#define MSR_DSR_MSK   0x20
#define MSR_RI_MSK   0x40
#define MSR_DCD_MSK   0x80
typedef tagIRQDEFS IRQDEFS
int AceInput (NUTDEVICE *dev)
 Wait for input.
int AceOutput (NUTDEVICE *dev)
 Initiate output.
int AceFlush (NUTDEVICE *dev)
 Wait for output buffer empty.
int AceIOCtl (NUTDEVICE *dev, int req, void *conf)
 Perform ACE control functions.
int AceInit (NUTDEVICE *dev)
 Initialize on chip ACE device.
int AceRead (NUTFILE *fp, void *buffer, int size)
 Read from device.
int AcePut (NUTDEVICE *dev, CONST void *buffer, int len, int pflg)
 Write to device.
int AceWrite (NUTFILE *fp, CONST void *buffer, int len)
int AceWrite_P (NUTFILE *fp, PGM_P buffer, int len)
NUTFILEAceOpen (NUTDEVICE *dev, CONST char *name, int mode, int acc)
 Open a device or file.
int AceClose (NUTFILE *fp)
 Close a device or file.
long AceSize (NUTFILE *fp)
 Request file size.

Defines

#define _IOFBF   0x00
#define _IOLBF   0x01
#define _IONBF   0x02


Define Documentation

#define _IOFBF   0x00

Definition at line 62 of file tlc16c550.c.

#define _IOLBF   0x01

Definition at line 63 of file tlc16c550.c.

#define _IONBF   0x02

Definition at line 64 of file tlc16c550.c.

#define ACE_RBR_OFS   0

\

Definition at line 75 of file tlc16c550.c.

#define ACE_THR_OFS   0

Definition at line 76 of file tlc16c550.c.

Referenced by AceOutput().

#define ACE_DLL_OFS   0

Definition at line 77 of file tlc16c550.c.

Referenced by AceIOCtl().

#define ACE_DLM_OFS   1

Definition at line 78 of file tlc16c550.c.

Referenced by AceIOCtl().

#define ACE_IER_OFS   1

Definition at line 79 of file tlc16c550.c.

#define ACE_FCR_OFS   2

Definition at line 80 of file tlc16c550.c.

Referenced by AceIOCtl().

#define ACE_IIR_OFS   2

Definition at line 81 of file tlc16c550.c.

#define ACE_LCR_OFS   3

Definition at line 82 of file tlc16c550.c.

Referenced by AceIOCtl().

#define ACE_MCR_OFS   4

Definition at line 83 of file tlc16c550.c.

#define ACE_LSR_OFS   5

Definition at line 84 of file tlc16c550.c.

#define ACE_MSR_OFS   6

Definition at line 85 of file tlc16c550.c.

#define ACE_SRC_OFS   7

Definition at line 86 of file tlc16c550.c.

#define IER_RDA_MSK   0x01

Definition at line 89 of file tlc16c550.c.

#define IER_THE_MSK   0x02

Definition at line 90 of file tlc16c550.c.

#define IER_LST_MSK   0x04

Definition at line 91 of file tlc16c550.c.

#define IER_MST_MSK   0x08

Definition at line 92 of file tlc16c550.c.

#define FCR_ENABLE   0x01

Definition at line 95 of file tlc16c550.c.

Referenced by AceIOCtl().

#define FCR_PURGE_I   0x02

Definition at line 96 of file tlc16c550.c.

Referenced by AceIOCtl().

#define FCR_PURGE_O   0x04

Definition at line 97 of file tlc16c550.c.

Referenced by AceIOCtl().

#define FCR_LEVEL_1   0x00

Definition at line 98 of file tlc16c550.c.

Referenced by AceIOCtl().

#define FCR_LEVEL_4   0x40

Definition at line 99 of file tlc16c550.c.

Referenced by AceIOCtl().

#define FCR_LEVEL_8   0x80

Definition at line 100 of file tlc16c550.c.

Referenced by AceIOCtl().

#define FCR_LEVEL_14   0xc0

Definition at line 101 of file tlc16c550.c.

Referenced by AceIOCtl().

#define IIR_MST_MSK   0x00

Definition at line 104 of file tlc16c550.c.

#define IIR_TXE_MSK   0x02

Definition at line 105 of file tlc16c550.c.

#define IIR_RDA_MSK   0x04

Definition at line 106 of file tlc16c550.c.

#define IIR_TDA_MSK   0x0c

Definition at line 107 of file tlc16c550.c.

#define IIR_LST_MSK   0x06

Definition at line 108 of file tlc16c550.c.

#define IIR_NON_MSK   0x01

Definition at line 109 of file tlc16c550.c.

#define IIR_FIFO_MSK   0xc0

Definition at line 110 of file tlc16c550.c.

#define LCR_WS0_MSK   0x01

Definition at line 113 of file tlc16c550.c.

Referenced by AceIOCtl().

#define LCR_WS1_MSK   0x02

Definition at line 114 of file tlc16c550.c.

Referenced by AceIOCtl().

#define LCR_STB_MSK   0x04

Definition at line 115 of file tlc16c550.c.

#define LCR_PEN_MSK   0x08

Definition at line 116 of file tlc16c550.c.

Referenced by AceIOCtl().

#define LCR_PRE_MSK   0x10

Definition at line 117 of file tlc16c550.c.

Referenced by AceIOCtl().

#define LCR_PRS_MSK   0x20

Definition at line 118 of file tlc16c550.c.

Referenced by AceIOCtl().

#define LCR_BRK_MSK   0x40

Definition at line 119 of file tlc16c550.c.

#define LCR_ENB_MSK   0x80

Definition at line 120 of file tlc16c550.c.

Referenced by AceIOCtl().

#define MCR_DTR_MSK   0x01

Definition at line 123 of file tlc16c550.c.

#define MCR_RTS_MSK   0x02

Definition at line 124 of file tlc16c550.c.

#define MCR_GP1_MSK   0x04

Definition at line 125 of file tlc16c550.c.

#define MCR_GP2_MSK   0x08

Definition at line 126 of file tlc16c550.c.

#define MCR_LOP_MSK   0x10

Definition at line 127 of file tlc16c550.c.

#define LSR_RDR_MSK   0x01

Definition at line 130 of file tlc16c550.c.

#define LSR_OVR_MSK   0x02

Definition at line 131 of file tlc16c550.c.

#define LSR_PER_MSK   0x04

Definition at line 132 of file tlc16c550.c.

#define LSR_FER_MSK   0x08

Definition at line 133 of file tlc16c550.c.

#define LSR_BDT_MSK   0x10

Definition at line 134 of file tlc16c550.c.

#define LSR_THE_MSK   0x20

Definition at line 135 of file tlc16c550.c.

#define LSR_TXE_MSK   0x40

Definition at line 136 of file tlc16c550.c.

#define LSR_EIF_MSK   0x80

Definition at line 137 of file tlc16c550.c.

#define MSR_DCTS_MSK   0x01

Definition at line 140 of file tlc16c550.c.

#define MSR_DDSR_MSK   0x02

Definition at line 141 of file tlc16c550.c.

#define MSR_DRI_MSK   0x04

Definition at line 142 of file tlc16c550.c.

#define MSR_DDCD_MSK   0x08

Definition at line 143 of file tlc16c550.c.

#define MSR_CTS_MSK   0x10

Definition at line 144 of file tlc16c550.c.

#define MSR_DSR_MSK   0x20

Definition at line 145 of file tlc16c550.c.

#define MSR_RI_MSK   0x40

Definition at line 146 of file tlc16c550.c.

#define MSR_DCD_MSK   0x80

Definition at line 147 of file tlc16c550.c.


Typedef Documentation

typedef struct tagIRQDEFS IRQDEFS


Function Documentation

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.

Parameters:
dev Indicates the ACE device.
Returns:
0 on success, -1 on timeout.

Definition at line 298 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.

Parameters:
dev Indicates the ACE device.
Returns:
0 on success, -1 otherwise.

Definition at line 324 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.

Parameters:
dev Indicates the ACE device.
Returns:
0 on success, -1 otherwise.

Definition at line 358 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 AceIOCtl ( NUTDEVICE dev,
int  req,
void *  conf 
)

Perform ACE control functions.

Parameters:
dev Identifies the device that receives the device-control function.
req Requested control function. May be set to one of the following constants:
  • ACE_SETSPEED, conf points to an u_long value containing the baudrate.
  • ACE_GETSPEED, conf points to an u_long value receiving the current baudrate.
  • ACE_SETDATABITS, conf points to an u_long value containing the number of data bits, 5, 6, 7 or 8.
  • ACE_GETDATABITS, conf points to an u_long value receiving the number of data bits, 5, 6, 7 or 8.
  • ACE_SETPARITY, conf points to an u_long value containing the parity, 0 (no), 1 (odd) or 2 (even).
  • ACE_GETPARITY, conf points to an u_long value receiving the parity, 0 (no), 1 (odd) or 2 (even).
  • ACE_SETSTOPBITS, conf points to an u_long value containing the number of stop bits 1 or 2.
  • ACE_GETSTOPBITS, conf points to an u_long value receiving the number of stop bits 1 or 2.
  • ACE_SETSTATUS
  • ACE_GETSTATUS
  • ACE_SETREADTIMEOUT, conf points to an u_long value containing the read timeout.
  • ACE_GETREADTIMEOUT, conf points to an u_long value receiving the read timeout.
  • ACE_SETWRITETIMEOUT, conf points to an u_long value containing the write timeout.
  • ACE_GETWRITETIMEOUT, conf points to an u_long value receiving the write timeout.
  • ACE_SETLOCALECHO, conf points to an u_long value containing 0 (off) or 1 (on).
  • ACE_GETLOCALECHO, conf points to an u_long value receiving 0 (off) or 1 (on).
  • ACE_SETFLOWCONTROL, conf points to an u_long value containing combined ACE_FCR_ values.
  • ACE_GETFLOWCONTROL, conf points to an u_long value containing receiving ACE_FCR_ values.
  • ACE_SETCOOKEDMODE, conf points to an u_long value containing 0 (off) or 1 (on).
  • ACE_GETCOOKEDMODE, conf points to an u_long value receiving 0 (off) or 1 (on).
conf Points to a buffer that contains any data required for the given control function or receives data from that function.
Returns:
0 on success, -1 otherwise.
Warning:
Timeout values are given in milliseconds and are limited to the granularity of the system timer. To disable timeout, set the parameter to NUT_WAIT_INFINITE.

Definition at line 477 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_WS0_MSK, LCR_WS1_MSK, and NutEventPostAsync().

Referenced by AceInit().

int AceInit ( NUTDEVICE dev  ) 

Initialize on chip ACE device.

Prepares the device for subsequent reading or writing. Enables ACE transmitter and receiver interrupts.

Parameters:
dev Identifies the device to initialize.
Returns:
0 on success, -1 otherwise.

Definition at line 736 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(), NutRegisterIrqHandler(), sbi, and sig_OUTPUT_COMPARE3A.

int AceRead ( NUTFILE fp,
void *  buffer,
int  size 
)

Read from device.

Definition at line 836 of file tlc16c550.c.

References ACE_MF_COOKEDMODE, AceInput(), _ACEDCB::dcb_modeflags, _NUTDEVICE::dev_dcb, _NUTDEVICE::dev_icb, _IFSTREAM::if_rd_idx, _IFSTREAM::if_rx_idx, and _NUTFILE::nf_dev.

int AcePut ( NUTDEVICE dev,
CONST void *  buffer,
int  len,
int  pflg 
)

Write to device.

Definition at line 897 of file tlc16c550.c.

References ACE_MF_COOKEDMODE, ACE_MF_LINEBUFFER, AceFlush(), CONST, _ACEDCB::dcb_modeflags, _NUTDEVICE::dev_dcb, _NUTDEVICE::dev_icb, _IFSTREAM::if_tx_buf, _IFSTREAM::if_tx_idx, _IFSTREAM::if_wr_idx, and PRG_RDB.

Referenced by AceWrite(), and AceWrite_P().

int AceWrite ( NUTFILE fp,
CONST void *  buffer,
int  len 
)

Definition at line 960 of file tlc16c550.c.

References AcePut(), and _NUTFILE::nf_dev.

int AceWrite_P ( NUTFILE fp,
PGM_P  buffer,
int  len 
)

Definition at line 965 of file tlc16c550.c.

References AcePut(), CONST, and _NUTFILE::nf_dev.

NUTFILE* AceOpen ( NUTDEVICE dev,
CONST char *  name,
int  mode,
int  acc 
)

Open a device or file.

Definition at line 974 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().

int AceClose ( NUTFILE fp  ) 

Close a device or file.

Definition at line 998 of file tlc16c550.c.

References NutHeapFree().

long AceSize ( NUTFILE fp  ) 

Request file size.

Definition at line 1008 of file tlc16c550.c.

References _NUTDEVICE::dev_icb, _IFSTREAM::if_rd_idx, _IFSTREAM::if_rx_idx, and _NUTFILE::nf_dev.


© 2000-2007 by egnite Software GmbH - visit http://www.ethernut.de/