Serial I/O

Functions

int16_t serial_buffered_input_nbytes (FILE *fp)
int8_t serial_buffered_input_waiting (FILE *fp)
int16_t serial_buffered_output_free (FILE *fp)
FILE * serial_init_buffered (uint8_t port, unsigned long baud_rate, uint8_t buf_size_in, uint8_t buf_size_out)
void serial0_receive_enable (void)
void serial0_receive_disable (void)
void serial0_transmit_enable (void)
void serial0_transmit_disable (void)
void serial1_receive_enable (void)
void serial1_receive_disable (void)
void serial1_transmit_enable (void)
void serial1_transmit_disable (void)
void serial2_transmit_enable (void)
void serial2_transmit_disable (void)
void serial3_transmit_enable (void)
void serial3_transmit_disable (void)
void serial2_receive_enable (void)
void serial2_receive_disable (void)
void serial3_receive_enable (void)
void serial3_receive_disable (void)

Function Documentation

void serial0_receive_disable ( void   )  [inline]

Disable the receive interrupt for serial port 0.

Author:
Andrew H. Fagg
void serial0_receive_enable ( void   )  [inline]

Enable the receive interrupt for serial port 0.

Author:
Andrew H. Fagg

Referenced by serial_init_buffered().

void serial0_transmit_disable ( void   )  [inline]

Disable the transmit interrupt for serial port 0.

Author:
Andrew H. Fagg

Referenced by serial_transmit_isr().

void serial0_transmit_enable ( void   )  [inline]

Enable the transmit interrupt for serial port 0.

Author:
Andrew H. Fagg

Referenced by uart_send_general_buffered().

void serial1_receive_disable ( void   )  [inline]

Disable the receive interrupt for serial port 1.

Note: only available for chips with two or more serial ports.

Author:
Andrew H. Fagg
void serial1_receive_enable ( void   )  [inline]

Enable the receive interrupt for serial port 1.

Note: only available for chips with two or more serial ports.

Author:
Andrew H. Fagg

Referenced by serial_init_buffered().

void serial1_transmit_disable ( void   )  [inline]

Disable the transmit interrupt for serial port 1.

Note: only available for chips with two or more serial ports.

Author:
Andrew H. Fagg

Referenced by serial_transmit_isr().

void serial1_transmit_enable ( void   )  [inline]

Enable the transmit interrupt for serial port 1.

Note: only available for chips with two or more serial ports.

Author:
Andrew H. Fagg

Referenced by uart_send_general_buffered().

void serial2_receive_disable ( void   )  [inline]

Disable the receive interrupt for serial port 2.

Note: only available for chips with four or more serial ports.

Author:
Andrew H. Fagg
void serial2_receive_enable ( void   )  [inline]

Enable the receive interrupt for serial port 2.

Note: only available for chips with four or more serial ports.

Author:
Andrew H. Fagg

Referenced by serial_init_buffered().

void serial2_transmit_disable ( void   )  [inline]

Disable the transmit interrupt for serial port 2.

Note: only available for chips with four or more serial ports.

Author:
Andrew H. Fagg

Referenced by serial_transmit_isr().

void serial2_transmit_enable ( void   )  [inline]

Enable the transmit interrupt for serial port 2.

Note: only available for chips with four or more serial ports.

Author:
Andrew H. Fagg

Referenced by uart_send_general_buffered().

void serial3_receive_disable ( void   )  [inline]

Disable the receive interrupt for serial port 3.

Note: only available for chips with four or more serial ports.

Author:
Andrew H. Fagg
void serial3_receive_enable ( void   )  [inline]

Enable the receive interrupt for serial port 3.

Note: only available for chips with four or more serial ports.

Author:
Andrew H. Fagg

Referenced by serial_init_buffered().

void serial3_transmit_disable ( void   )  [inline]

Disable the transmit interrupt for serial port 3.

Note: only available for chips with four or more serial ports.

Author:
Andrew H. Fagg

Referenced by serial_transmit_isr().

void serial3_transmit_enable ( void   )  [inline]

Enable the transmit interrupt for serial port 3.

Note: only available for chips with four or more serial ports.

Author:
Andrew H. Fagg

Referenced by uart_send_general_buffered().

int16_t serial_buffered_input_nbytes ( FILE *  fp  ) 

Returns the number of bytes that are in the input buffer

Parameters:
fp A valid file pointer for the port of interest.
Returns:
Number of bytes
Author:
Andrew H. Fagg

References OU_FILE_BUF::buf_in_back, OU_FILE_BUF::buf_in_front, and OU_FILE_BUF::buf_size_in.

int8_t serial_buffered_input_waiting ( FILE *  fp  ) 

Indicates whether at least one character is waiting in the serial input buffer.

Parameters:
fp A valid file pointer for the port of interest.
Returns:
1 if at least one character is waiting
0 if no characters are waiting
Author:
Andrew H. Fagg

References OU_FILE_BUF::buf_in_back, and OU_FILE_BUF::buf_in_front.

int16_t serial_buffered_output_free ( FILE *  fp  ) 

Returns the number of bytes that are unused in the output buffer

Parameters:
fp A valid file pointer for the port of interest.
Returns:
Number of free bytes.
Author:
Andrew H. Fagg

References OU_FILE_BUF::buf_out_back, OU_FILE_BUF::buf_out_front, and OU_FILE_BUF::buf_size_out.

FILE* serial_init_buffered ( uint8_t  port,
unsigned long  baud_rate,
uint8_t  buf_size_in,
uint8_t  buf_size_out 
)

Initialize RS232 buffered serial support for standard I/O. This will allow you to use the standard I/O facilities (getchar(), printf(), scanf(), etc) - see the libc documentation for more information.

Assumptions: the calling function will enable global interrupts, and each port is only initialized once.

Note: characters received that do not fit in the input buffer will be dropped on the floor. Outgoing characters that do not fit into the buffer will wait until there is room in the buffer.

Parameters:
port The serial port to initialize. Port 0 is supported on all chips. Port 1 is supported only on multi-port chips.
baud_rate The transceiver clock rate.
buf_size_in The number of bytes allocated to the input buffer. Must be 2 or more.
buf_size_out The number of bytes allocate to the output buffer. Must not be 1 (0 indicates that no buffer is used).
Returns:
A pointer to the newly created FILE structure (a valid file pointer). This file pointer will only be needed for certain operations (functions such as printf() and getchar() default to the port 0 file pointer).
NULL is returned if an error occurred.
Author:
Andrew H. Fagg

References OU_FILE_BUF::buf_in_back, OU_FILE_BUF::buf_in_front, OU_FILE_BUF::buf_out_back, OU_FILE_BUF::buf_out_front, OU_FILE_BUF::buf_size_in, OU_FILE_BUF::buf_size_out, OU_FILE_BUF::buffer, OU_FILE_BUF::port, serial0_receive_enable(), serial1_receive_enable(), serial2_receive_enable(), serial3_receive_enable(), uart_recv_general_buffered(), and uart_send_general_buffered().

Generated on Tue Feb 14 00:23:58 2012 for OU Atmel Utilities Library by  doxygen 1.6.3