Generic FreeRTOS peripheral control functions.
Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.
Data Structures | |
struct | freertos_dma_tx_control |
struct | freertos_pdc_rx_control |
struct | freertos_peripheral_parameters |
Macros | |
#define | freertos_start_pdc_rx(dma_event_control, data, len, pdc_base_address, notification_semaphore) freertos_start_pdc_transfer(dma_event_control, data, len, pdc_base_address, notification_semaphore, false) |
#define | freertos_start_pdc_tx(dma_event_control, data, len, pdc_base_address, notification_semaphore) freertos_start_pdc_transfer(dma_event_control, data, len, pdc_base_address, notification_semaphore, true) |
Typedefs | |
typedef struct freertos_dma_tx_control | freertos_dma_event_control_t |
typedef struct freertos_peripheral_parameters | freertos_pdc_peripheral_parameters_t |
typedef struct freertos_pdc_rx_control | freertos_pdc_rx_control_t |
Functions | |
bool | check_requested_operating_mode (const enum peripheral_operation_mode requested_operation_mode, const enum peripheral_operation_mode valid_operating_modes[], portBASE_TYPE num_valid_operating_modes) |
void | configure_interrupt_controller (const enum IRQn peripheral_irq, uint32_t interrupt_priority) |
void | create_peripheral_control_semaphores (const uint8_t options_flags, freertos_dma_event_control_t *tx_dma_control, freertos_dma_event_control_t *rx_dma_control) |
uint32_t | freertos_copy_bytes_from_pdc_circular_buffer (freertos_pdc_rx_control_t *p_rx_buffer_details, uint32_t next_byte_to_be_written, uint8_t *buf, uint32_t bytes_to_read) |
status_code_t | freertos_obtain_peripheral_access_semphore (freertos_dma_event_control_t *dma_event_control, portTickType *max_block_time_ticks) |
status_code_t | freertos_optionally_wait_transfer_completion (freertos_dma_event_control_t *dma_event_control, xSemaphoreHandle notification_semaphore, portTickType max_block_time_ticks) |
void | freertos_start_pdc_transfer (freertos_dma_event_control_t *dma_event_control, const uint8_t *data, size_t len, void *pdc_base_address, xSemaphoreHandle notification_semaphore, bool is_transmitting) |
portBASE_TYPE | get_pdc_peripheral_details (const freertos_pdc_peripheral_parameters_t peripheral_array[], size_t array_size, void *peripheral_to_find) |
#define freertos_start_pdc_rx | ( | dma_event_control, | |
data, | |||
len, | |||
pdc_base_address, | |||
notification_semaphore | |||
) | freertos_start_pdc_transfer(dma_event_control, data, len, pdc_base_address, notification_semaphore, false) |
Referenced by freertos_twi_read_packet_async().
#define freertos_start_pdc_tx | ( | dma_event_control, | |
data, | |||
len, | |||
pdc_base_address, | |||
notification_semaphore | |||
) | freertos_start_pdc_transfer(dma_event_control, data, len, pdc_base_address, notification_semaphore, true) |
typedef struct freertos_dma_tx_control freertos_dma_event_control_t |
typedef struct freertos_pdc_rx_control freertos_pdc_rx_control_t |
bool check_requested_operating_mode | ( | const enum peripheral_operation_mode | requested_operation_mode, |
const enum peripheral_operation_mode | valid_operating_modes[], | ||
portBASE_TYPE | num_valid_operating_modes | ||
) |
Referenced by freertos_twi_master_init(), freertos_uart_serial_init(), and freertos_usart_serial_init().
void configure_interrupt_controller | ( | const enum IRQn | peripheral_irq, |
uint32_t | interrupt_priority | ||
) |
References configASSERT, configLIBRARY_LOWEST_INTERRUPT_PRIORITY, and configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY.
Referenced by freertos_twi_master_init(), freertos_uart_serial_init(), and freertos_usart_serial_init().
void create_peripheral_control_semaphores | ( | const uint8_t | options_flags, |
freertos_dma_event_control_t * | tx_dma_control, | ||
freertos_dma_event_control_t * | rx_dma_control | ||
) |
References configASSERT, NULL, freertos_dma_tx_control::peripheral_access_sem, freertos_dma_tx_control::transaction_complete_notification_semaphore, USE_TX_ACCESS_SEM, vSemaphoreCreateBinary, WAIT_RX_COMPLETE, WAIT_TX_COMPLETE, xSemaphoreGive, and xSemaphoreTake.
Referenced by freertos_twi_master_init(), freertos_uart_serial_init(), and freertos_usart_serial_init().
uint32_t freertos_copy_bytes_from_pdc_circular_buffer | ( | freertos_pdc_rx_control_t * | p_rx_buffer_details, |
uint32_t | next_byte_to_be_written, | ||
uint8_t * | buf, | ||
uint32_t | bytes_to_read | ||
) |
References if(), freertos_pdc_rx_control::next_byte_to_read, freertos_pdc_rx_control::past_rx_buffer_end_address, freertos_pdc_rx_control::rx_buffer_start_address, freertos_pdc_rx_control::rx_event_semaphore, freertos_pdc_rx_control::rx_pdc_parameters, taskENTER_CRITICAL, taskEXIT_CRITICAL, pdc_packet::ul_size, and xSemaphoreGive.
Referenced by freertos_uart_serial_read_packet(), and freertos_usart_serial_read_packet().
status_code_t freertos_obtain_peripheral_access_semphore | ( | freertos_dma_event_control_t * | dma_event_control, |
portTickType * | max_block_time_ticks | ||
) |
References ERR_TIMEOUT, NULL, pdFAIL, pdTRUE, freertos_dma_tx_control::peripheral_access_sem, STATUS_OK, vTaskSetTimeOutState(), xSemaphoreTake, and xTaskCheckForTimeOut().
Referenced by freertos_twi_read_packet_async(), freertos_twi_write_packet_async(), freertos_uart_write_packet_async(), and freertos_usart_write_packet_async().
status_code_t freertos_optionally_wait_transfer_completion | ( | freertos_dma_event_control_t * | dma_event_control, |
xSemaphoreHandle | notification_semaphore, | ||
portTickType | max_block_time_ticks | ||
) |
void freertos_start_pdc_transfer | ( | freertos_dma_event_control_t * | dma_event_control, |
const uint8_t * | data, | ||
size_t | len, | ||
void * | pdc_base_address, | ||
xSemaphoreHandle | notification_semaphore, | ||
bool | is_transmitting | ||
) |
portBASE_TYPE get_pdc_peripheral_details | ( | const freertos_pdc_peripheral_parameters_t | peripheral_array[], |
size_t | array_size, | ||
void * | peripheral_to_find | ||
) |
Referenced by freertos_twi_master_init(), freertos_twi_read_packet_async(), freertos_twi_write_packet_async(), freertos_uart_serial_init(), freertos_uart_serial_read_packet(), freertos_uart_write_packet_async(), freertos_usart_serial_init(), freertos_usart_serial_read_packet(), and freertos_usart_write_packet_async().