Atmel Software Framework

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SIO2NCP - UART

This module performs serial input/output functionalities via UART from and to the HOST.

Macros

#define SERIAL_RX_BUF_SIZE_NCP   156
 

Functions

uint8_t sio2ncp_getchar (void)
 This function performs a blocking character receive functionality. More...
 
int sio2ncp_getchar_nowait (void)
 This function performs a non-blocking character receive functionality. More...
 
void sio2ncp_init (void)
 Initializes the Serial IO Module of the NCP Device. More...
 
uint8_t sio2ncp_rx (uint8_t *data, uint8_t max_length)
 Receives data from UART. More...
 
uint8_t sio2ncp_tx (uint8_t *data, uint8_t length)
 Transmits data via UART. More...
 

#define SERIAL_RX_BUF_SIZE_NCP   156

Referenced by sio2ncp_rx().

uint8_t sio2ncp_getchar ( void  )

This function performs a blocking character receive functionality.

Returns
returns the data which is received

References c, and sio2ncp_rx().

int sio2ncp_getchar_nowait ( void  )

This function performs a non-blocking character receive functionality.

Returns
'-1' if no data is recieved or returns the data if a character is received

References c, and sio2ncp_rx().

void sio2ncp_init ( void  )

Initializes the Serial IO Module of the NCP Device.

Returns
STATUS_OK for successful initialization and FAILURE incase the IO is not initialized

References IOPORT_DIR_OUTPUT, IOPORT_PIN_LEVEL_HIGH, ioport_set_pin_dir(), ioport_set_pin_level(), stdio_serial_init(), and usart_serial_init().

uint8_t sio2ncp_rx ( uint8_t *  data,
uint8_t  max_length 
)

Receives data from UART.

Parameters
datapointer to the buffer where the received data is to be stored
max_lengthmaximum length of data to be received
Returns
actual number of bytes received

References serial_rx_buf, serial_rx_buf_head, SERIAL_RX_BUF_SIZE_NCP, serial_rx_buf_tail, and serial_rx_count.

Referenced by sio2ncp_getchar(), and sio2ncp_getchar_nowait().

uint8_t sio2ncp_tx ( uint8_t *  data,
uint8_t  length 
)

Transmits data via UART.

Parameters
dataPointer to the buffer where the data to be transmitted is present
lengthNumber of bytes to be transmitted
Returns
Number of bytes actually transmitted

References length, status, STATUS_OK, and usart_serial_write_packet().