Microchip® Advanced Software Framework

hal_uart_dma.h File Reference
#include <stdint.h>
#include "btstack_config.h"

Functions

void delay_check (uint32_t value)
 
void hal_uart_dma_init (void)
 Init and open device. More...
 
void hal_uart_dma_receive_block (uint8_t *buffer, uint16_t len)
 Receive block. More...
 
void hal_uart_dma_send_block (const uint8_t *buffer, uint16_t length)
 Send block. More...
 
int hal_uart_dma_set_baud (uint32_t baud)
 Set baud rate. More...
 
void hal_uart_dma_set_block_received (void(*callback)(void))
 Set callback for block received - can be called from ISR context. More...
 
void hal_uart_dma_set_block_sent (void(*callback)(void))
 Set callback for block sent - can be called from ISR context. More...
 
void hal_uart_dma_set_csr_irq_handler (void(*csr_irq_handler)(void))
 Set or clear callback for CSR pulse - can be called from ISR context. More...
 
void hal_uart_dma_set_sleep (uint8_t sleep)
 Set sleep mode. More...
 

void delay_check ( uint32_t  value)

References vTaskDelay().

void hal_uart_dma_receive_block ( uint8_t *  buffer,
uint16_t  len 
)

Receive block.

When done, callback set by hal_uart_dma_set_block_received must be called

Parameters
buffer
lengh

References bytes_to_read, hal_uart_rts_low(), rx_buffer_ptr, rx_notify, and usart_enable_interrupt().

void hal_uart_dma_send_block ( const uint8_t *  buffer,
uint16_t  length 
)

Send block.

When done, callback set by hal_uart_set_block_sent must be called

Parameters
buffer
lengh

References bytes_to_write, log_error, tx_buffer_ptr, tx_notify, and usart_enable_interrupt().

int hal_uart_dma_set_baud ( uint32_t  baud)

Set baud rate.

Note
During baud change, TX line should stay high and no data should be received on RX accidentally
Parameters
baudrate

References log_error, sysclk_get_peripheral_hz(), usart_disable_rx(), usart_disable_tx(), usart_enable_rx(), usart_enable_tx(), and usart_set_async_baudrate().

Referenced by btstack_uart_block_freertos_open().

void hal_uart_dma_set_block_received ( void(*)(void)  callback)

Set callback for block received - can be called from ISR context.

Parameters
callback

References rx_done_handler.

Referenced by btstack_uart_block_freertos_init().

void hal_uart_dma_set_block_sent ( void(*)(void)  callback)

Set callback for block sent - can be called from ISR context.

Parameters
callback

References tx_done_handler.

Referenced by btstack_uart_block_freertos_init().

void hal_uart_dma_set_csr_irq_handler ( void(*)(void)  csr_irq_handler)

Set or clear callback for CSR pulse - can be called from ISR context.

Parameters
csr_irq_handleror NULL to disable IRQ handler

References cts_irq_handler.

void hal_uart_dma_set_sleep ( uint8_t  sleep)

Set sleep mode.

Parameters
block_receivedcallback