Microchip® Advanced Software Framework

usart_interrupt.c File Reference

SAM SERCOM USART Asynchronous Driver.

Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.

#include "usart_interrupt.h"

Functions

void _usart_interrupt_handler (uint8_t instance)
 
enum status_code _usart_read_buffer (struct usart_module *const module, uint8_t *rx_data, uint16_t length)
 
enum status_code _usart_write_buffer (struct usart_module *const module, uint8_t *tx_data, uint16_t length)
 
void usart_abort_job (struct usart_module *const module, enum usart_transceiver_type transceiver_type)
 Cancels ongoing read/write operation. More...
 
enum status_code usart_get_job_status (struct usart_module *const module, enum usart_transceiver_type transceiver_type)
 Get status from the ongoing or last asynchronous transfer operation. More...
 
enum status_code usart_read_buffer_job (struct usart_module *const module, uint8_t *rx_data, uint16_t length)
 Asynchronous buffer read. More...
 
enum status_code usart_read_job (struct usart_module *const module, uint16_t *const rx_data)
 Asynchronous read a single char. More...
 
void usart_register_callback (struct usart_module *const module, usart_callback_t callback_func, enum usart_callback callback_type)
 Registers a callback. More...
 
void usart_unregister_callback (struct usart_module *const module, enum usart_callback callback_type)
 Unregisters a callback. More...
 
enum status_code usart_write_buffer_job (struct usart_module *const module, uint8_t *tx_data, uint16_t length)
 Asynchronous buffer write. More...
 
enum status_code usart_write_job (struct usart_module *const module, const uint16_t *tx_data)
 Asynchronous write a single char. More...
 

void _usart_interrupt_handler ( uint8_t  instance)

Handles interrupts as they occur, and it will run callback functions which are registered and enabled.

Parameters
[in]instanceID of the SERCOM instance calling the interrupt handler.

References _sercom_instances, callback_status, STATUS_ERR_BAD_DATA, STATUS_ERR_BAD_FORMAT, STATUS_ERR_OVERFLOW, STATUS_ERR_PACKET_COLLISION, STATUS_ERR_PROTOCOL, STATUS_OK, USART_CALLBACK_BREAK_RECEIVED, USART_CALLBACK_BUFFER_RECEIVED, USART_CALLBACK_BUFFER_TRANSMITTED, USART_CALLBACK_CTS_INPUT_CHANGE, USART_CALLBACK_ERROR, USART_CALLBACK_START_RECEIVED, and USART_CHARACTER_SIZE_9BIT.

Referenced by usart_init().

enum status_code _usart_read_buffer ( struct usart_module *const  module,
uint8_t *  rx_data,
uint16_t  length 
)

Asynchronous read of a buffer with a given length

Parameters
[in]modulePointer to USART software instance struct
[in]rx_dataPointer to data to be received
[in]lengthLength of data buffer

References Assert, length, rx_data, STATUS_BUSY, STATUS_OK, system_interrupt_enter_critical_section(), and system_interrupt_leave_critical_section().

Referenced by usart_read_buffer_job(), and usart_read_job().

enum status_code _usart_write_buffer ( struct usart_module *const  module,
uint8_t *  tx_data,
uint16_t  length 
)

Asynchronous write of a buffer with a given length

Parameters
[in]modulePointer to USART software instance struct
[in]tx_dataPointer to data to be transmitted
[in]lengthLength of data buffer

References Assert, length, STATUS_BUSY, STATUS_OK, system_interrupt_enter_critical_section(), system_interrupt_leave_critical_section(), and tx_data.

Referenced by usart_write_buffer_job(), and usart_write_job().