Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
FreeRTOS Peripheral Control

ASF specific FreeRTOS functionality that integrates ASF driver libraries with FreeRTOS services to provide a set of highly efficient peripheral interface functions.

The FreeRTOS ASF functions use the peripheral DMA controller (PDC) to send and receive data with practically no processing overhead, and use the FreeRTOS multi-tasking services to ensure the microcontroller can continue executing application code at all times, even when one thread of execution has to wait for a transmit or receive to complete.

Peripherals can be initialized to execute is standard mode or fully asynchronous mode. In standard mode, the API functions used to transmit to or receive from a peripheral do not return until the entire transmit or receive operation has completed. Other FreeRTOS tasks exeucte while the data transfer is in progress. In fully asynchronous mode, the API functions used to transmit to or receive from a peripheral return immediately, which may be while the data transfer is still in progress - the task calling the transmit or receive function is then notified by FreeRTOS when the data transfer has completed.

The FreeRTOS ASF drivers are supported by an application note, executable examples within the ASF distribution, and example use cases in this documentation set.

The following functions are provided for the USART peripheral

See Quick start guide for

The following functions are provided for the UART peripheral

See Quick start guide for

The following functions are provided for the TWI peripheral

See Quick start guide for

The following functions are provided for the TWIHS peripheral

See freertos_twihs_peripheral_control_quick_start

The following functions are provided for the SPI peripheral

See Quick start guide for

Modules

 
 FreeRTOS TWI peripheral
 control
 
 FreeRTOS SPI peripheral
 control
 
 FreeRTOS UART peripheral
 control
 
 FreeRTOS USART peripheral
 control
 

Data Structures

struct  freertos_peripheral_options
 Define the behaviour of FreeRTOS ASF read and write functions for a peripheral. More...
 

Macros

#define USE_RX_ACCESS_MUTEX   0x02
 Bit definition used in the options_flags member of a freertos_peripheral_options_t structure passed as a parameter to an initialization function to indicate that reads from the peripheral being initialized must be thread aware. More...
 
#define USE_TX_ACCESS_SEM   0x01
 Bit definition used in the options_flags member of a freertos_peripheral_options_t structure passed as a parameter to an initialization function to indicate that writes to the peripheral being initialized must be thread aware. More...
 
#define WAIT_RX_COMPLETE   0x08
 Bit definition used in the options_flags member of a freertos_peripheral_options_t structure passed as a parameter to an initialization function to indicate that a task reading from the peripheral must be held in the FreeRTOS Blocked state until the read has completed. More...
 
#define WAIT_TX_COMPLETE   0x04
 Bit definition used in the options_flags member of a freertos_peripheral_options_t structure passed as a parameter to an initialization function to indicate that a task writing to the peripheral must be held in the FreeRTOS Blocked state until the write has completed. More...
 

Typedefs

typedef struct
freertos_peripheral_options 
freertos_peripheral_options_t
 Define the behaviour of FreeRTOS ASF read and write functions for a peripheral. More...
 

Enumerations

enum  peripheral_operation_mode {
  USART_RS232 = 0,
  UART_RS232,
  SPI_MASTER,
  TWI_I2C_MASTER,
  TWIHS_I2C_MASTER,
  NOT_SUPPORTED
}
 Defines the operating modes that can be specified in a freertos_peripheral_options_t structure. More...
 

#define USE_RX_ACCESS_MUTEX   0x02

Bit definition used in the options_flags member of a freertos_peripheral_options_t structure passed as a parameter to an initialization function to indicate that reads from the peripheral being initialized must be thread aware.

When this bit is set the FreeRTOS peripheral driver will use a mutex (internally within the driver) to ensure only one FreeRTOS task can perform a read from the peripheral at any one time. Examples use cases are provided in the FreeRTOS peripheral control examples that are included in the Atmel ASF distribution, in the application not that accompanies the FreeRTOS peripheral control drivers, and in the quick start references for the FreeRTOS peripheral control initialization functions in this online documentation.

Referenced by create_usart_tasks(), freertos_uart_serial_init(), and freertos_usart_serial_init().

#define USE_TX_ACCESS_SEM   0x01

Bit definition used in the options_flags member of a freertos_peripheral_options_t structure passed as a parameter to an initialization function to indicate that writes to the peripheral being initialized must be thread aware.

When this bit is set the FreeRTOS peripheral driver will use a binary semphore (internally within the driver) to ensure only one FreeRTOS task can perform a write to the peripheral at any one time. Examples use cases are provided in the FreeRTOS peripheral control examples that are included in the Atmel ASF distribution, in the application not that accompanies the FreeRTOS peripheral control drivers, and in the quick start references for the FreeRTOS peripheral control initialization functions in this online documentation.

Referenced by create_peripheral_control_semaphores(), and create_usart_tasks().

#define WAIT_RX_COMPLETE   0x08

Bit definition used in the options_flags member of a freertos_peripheral_options_t structure passed as a parameter to an initialization function to indicate that a task reading from the peripheral must be held in the FreeRTOS Blocked state until the read has completed.

FreeRTOS peripheral read functions often have two version, one where the function name ends with '_async', and one where the '_async' is omitted. This bit must be clear to use the _async version, and set to use the version where _async omitted. See the documentation for the FreeRTOS peripheral read functions for more information. Examples use cases are provided in the FreeRTOS peripheral control examples that are included in the Atmel ASF distribution, in the application not that accompanies the FreeRTOS peripheral control drivers, and in the quick start references for the FreeRTOS peripheral control initialization functions in this online documentation.

Referenced by create_peripheral_control_semaphores().

#define WAIT_TX_COMPLETE   0x04

Bit definition used in the options_flags member of a freertos_peripheral_options_t structure passed as a parameter to an initialization function to indicate that a task writing to the peripheral must be held in the FreeRTOS Blocked state until the write has completed.

FreeRTOS peripheral write functions often have two version, one where the function name ends with '_async', and one where the '_async' is omitted. This bit must be clear to use the _async version, and set to use the version where _async omitted. See the documentation for the FreeRTOS peripheral write functions for more information. Examples use cases are provided in the FreeRTOS peripheral control examples that are included in the Atmel ASF distribution, in the application not that accompanies the FreeRTOS peripheral control drivers, and in the quick start references for the FreeRTOS peripheral control initialization functions in this online documentation.

Referenced by create_peripheral_control_semaphores().

Define the behaviour of FreeRTOS ASF read and write functions for a peripheral.

Defines the operating modes that can be specified in a freertos_peripheral_options_t structure.

Enumerator
USART_RS232 

Valid only for USART peripheral.

UART_RS232 

Valid only for UART peripheral.

SPI_MASTER 

Valid only for the SPI peripheral.

TWI_I2C_MASTER 

Valid only for the TWI peripheral.

TWIHS_I2C_MASTER 

Valid only for the TWIHS peripheral.

NOT_SUPPORTED 

No other values can be used.