#include "asf.h"
#include "hal_uart_dma.h"
#include "conf_board.h"
#include "stdio_serial.h"
#include "ioport.h"
#include "hal_tick.h"
#include "btstack_debug.h"
#include "btstack_config.h"
Macros | |
#define | ALL_INTERRUPT_MASK 0xffffffff |
All interrupt mask. More... | |
#define | DEBUG_PIN_1 PIO_PD16_IDX |
#define | DEBUG_PIN_2 PIO_PD15_IDX |
Functions | |
void | delay_check (uint32_t value) |
static void | dummy_handler (void) |
void | hal_uart_dma_init (void) |
Init and open device. More... | |
void | hal_uart_dma_receive_block (uint8_t *data, uint16_t size) |
Receive block. More... | |
void | hal_uart_dma_send_block (const uint8_t *data, uint16_t size) |
Send block. More... | |
int | hal_uart_dma_set_baud (uint32_t baud) |
Set baud rate. More... | |
void | hal_uart_dma_set_block_received (void(*the_block_handler)(void)) |
Set callback for block received - can be called from ISR context. More... | |
void | hal_uart_dma_set_block_sent (void(*the_block_handler)(void)) |
Set callback for block sent - can be called from ISR context. More... | |
void | hal_uart_dma_set_csr_irq_handler (void(*the_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... | |
static void | hal_uart_rts_high (void) |
static void | hal_uart_rts_low (void) |
void | USART_Handler (void) |
Variables | |
static volatile uint16_t | bytes_to_read = 0 |
static volatile uint16_t | bytes_to_write = 0 |
static void(* | cts_irq_handler )(void) = dummy_handler |
static int | hal_uart_dma_initialized = 0 |
static volatile uint8_t * | rx_buffer_ptr = 0 |
static void(* | rx_done_handler )(void) = dummy_handler |
static volatile int | rx_notify |
static int | simulate_flowcontrol |
static volatile uint8_t * | tx_buffer_ptr = 0 |
static void(* | tx_done_handler )(void) = dummy_handler |
static volatile int | tx_notify |
#define ALL_INTERRUPT_MASK 0xffffffff |
All interrupt mask.
Referenced by hal_uart_dma_init().
#define DEBUG_PIN_1 PIO_PD16_IDX |
Referenced by hal_uart_dma_init().
#define DEBUG_PIN_2 PIO_PD15_IDX |
Referenced by hal_uart_dma_init().
void delay_check | ( | uint32_t | value | ) |
References vTaskDelay().
|
static |
void hal_uart_dma_init | ( | void | ) |
Init and open device.
References ALL_INTERRUPT_MASK, DEBUG_PIN_1, DEBUG_PIN_2, hal_uart_dma_initialized, IOPORT_DIR_OUTPUT, IOPORT_PIN_LEVEL_HIGH, IOPORT_PIN_LEVEL_LOW, ioport_set_pin_dir(), ioport_set_pin_level(), log_info, simulate_flowcontrol, sysclk_enable_peripheral_clock(), sysclk_get_peripheral_hz(), usart_disable_interrupt(), usart_enable_rx(), usart_enable_tx(), usart_init_rs232(), and vTaskDelay().
Referenced by btstack_uart_block_freertos_open().
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
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
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.
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.
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.
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.
csr_irq_handler | or NULL to disable IRQ handler |
References cts_irq_handler.
void hal_uart_dma_set_sleep | ( | uint8_t | sleep | ) |
Set sleep mode.
block_received | callback |
|
inlinestatic |
References simulate_flowcontrol.
Referenced by USART_Handler().
|
inlinestatic |
References simulate_flowcontrol.
Referenced by hal_uart_dma_receive_block().
void USART_Handler | ( | void | ) |
|
static |
Referenced by hal_uart_dma_receive_block(), and USART_Handler().
|
static |
Referenced by atwilc3000_write_firmware(), atwilc3000_write_memory(), hal_uart_dma_send_block(), and USART_Handler().
|
static |
Referenced by hal_uart_dma_set_csr_irq_handler().
|
static |
Referenced by hal_uart_dma_init().
|
static |
Referenced by hal_uart_dma_receive_block(), and USART_Handler().
|
static |
Referenced by hal_uart_dma_set_block_received(), and USART_Handler().
|
static |
Referenced by hal_uart_dma_receive_block(), and USART_Handler().
|
static |
Referenced by hal_uart_dma_init(), hal_uart_rts_high(), and hal_uart_rts_low().
|
static |
Referenced by hal_uart_dma_send_block(), and USART_Handler().
|
static |
Referenced by hal_uart_dma_set_block_sent(), and USART_Handler().
|
static |
Referenced by hal_uart_dma_send_block(), and USART_Handler().