Configurations for the WILC3000 Serial Bridge Application.
Copyright (c) 2018 Microchip Technology Inc. and its subsidiaries.
#include "asf.h"
#include "uart_stream.h"
#include "FreeRTOS.h"
#include "osprintf.h"
#include "os/include/net_init.h"
#include "os/include/m2m_wifi_ex.h"
#include "bsp/include/nm_bsp.h"
#include "driver/source/nmbus.h"
#include "lwip/def.h"
#include "conf_wilc.h"
#include "bt_uart.h"
#include <string.h>
#include <stdio.h>
Data Structures | |
struct | uart_cmd_hdr |
struct | usart_frame |
Macros | |
#define | HANDLER_SIZE sizeof(usart_handler) / sizeof(struct usart_frame) |
#define | MIN(x, y) (x > y) ? y : x |
#define | MODE_STA_PRIORITY (tskIDLE_PRIORITY + 1) |
#define | MODE_STA_STACK_SIZE (1024 / sizeof(portSTACK_TYPE)) |
#define | STRING_EOL "\r\n" |
#define | STRING_HEADER |
Enumerations | |
enum | cmd_err_code { CMD_ERR_NO_ERROR = 0, CMD_ERR_INTERNAL_ERROR, CMD_ERR_INVALID_FRAME, CMD_ERR_NO_ERROR = 0, CMD_ERR_INTERNAL_ERROR, CMD_ERR_INVALID_FRAME, CMD_ERR_NO_ERROR = 0, CMD_ERR_INTERNAL_ERROR, CMD_ERR_INVALID_FRAME } |
Functions | |
static int | bt_hci_reset_handler (uint8_t *buffer, uint8_t size) |
static int | bt_hci_start_rx_handler (uint8_t *buffer, uint8_t size) |
static int | bt_hci_start_tx_handler (uint8_t *buffer, uint8_t size) |
static int | bt_hci_stop_txrx_handler (uint8_t *buffer, uint8_t size) |
void | bt_serial_bridge () |
static void | buffer_to_cmd_hdr (uint8_t *buffer, struct uart_cmd_hdr *cmd_hdr) |
static uint8_t | checksum_check (uint8_t *buffer, uint8_t size) |
void | fatal (int code, const char *msg) |
void | hard_fault (uint32_t *args, uint32_t lr) |
void | HardFault_Handler (void) |
int | main (void) |
Main application function. More... | |
static sint8 | serial_bridge (void) |
Process input UART command and forward to SPI. More... | |
static void | usart_frame_parse (uint8_t *buffer, uint8_t size) |
Parse incoming frame and find the handler to process the request. More... | |
static int | usart_read_block_handler (uint8_t *buffer, uint8_t size) |
static int | usart_read_reg_with_ret_handler (uint8_t *buffer, uint8_t size) |
static int | usart_reconfigure_handler (uint8_t *buffer, uint8_t size) |
static int | usart_sync_cmd_handler (uint8_t *buffer, uint8_t size) |
static int | usart_write_block_handler (uint8_t *buffer, uint8_t size) |
static int | usart_write_reg_handler (uint8_t *buffer, uint8_t size) |
Variables | |
static uint32_t | fault_addr |
uint8_t | hci_recv_buffer [13] |
uint32_t | ms_ticks = 0 |
SysTick counter to avoid busy wait delay. More... | |
uint8_t | reset_buffer [13] = {0xA5,0x01,0x10,0x00,0x00,0x00,0x14,0x00,0x00,005,0x00,0x00,0x00} |
uint8_t | reset_sdio_buffer [13] = {0xA5,0x01,0x10,0x00,0x00,0x00,0x14,0x00,0x00,0xFF,0xFB,0xFF,0xFF} |
struct usart_frame | usart_handler [] |
#define HANDLER_SIZE sizeof(usart_handler) / sizeof(struct usart_frame) |
Referenced by usart_frame_parse().
#define MIN | ( | x, | |
y | |||
) | (x > y) ? y : x |
#define MODE_STA_PRIORITY (tskIDLE_PRIORITY + 1) |
Referenced by main().
#define MODE_STA_STACK_SIZE (1024 / sizeof(portSTACK_TYPE)) |
Referenced by main().
#define STRING_EOL "\r\n" |
#define STRING_HEADER |
enum cmd_err_code |
|
static |
References bt_usart_receive(), bt_usart_stream_write_buffer(), CMD_ERR_NO_ERROR, and usart_stream_reset().
|
static |
References bt_usart_receive(), bt_usart_stream_write_buffer(), CMD_ERR_NO_ERROR, and usart_stream_reset().
|
static |
References bt_usart_receive(), bt_usart_stream_write_buffer(), CMD_ERR_NO_ERROR, and usart_stream_reset().
|
static |
References bt_usart_receive(), bt_usart_stream_write_buffer(), CMD_ERR_NO_ERROR, and usart_stream_reset().
void bt_serial_bridge | ( | ) |
Referenced by serial_bridge().
|
static |
References uart_cmd_hdr::addr, uart_cmd_hdr::cmd, and uart_cmd_hdr::val.
Referenced by usart_read_block_handler(), usart_read_reg_with_ret_handler(), usart_reconfigure_handler(), usart_write_block_handler(), and usart_write_reg_handler().
|
static |
void fatal | ( | int | code, |
const char * | msg | ||
) |
void hard_fault | ( | uint32_t * | args, |
uint32_t | lr | ||
) |
void HardFault_Handler | ( | void | ) |
int main | ( | void | ) |
Main application function.
Application entry point.
References board_init(), bt_configure_usart(), configure_usart(), MODE_STA_PRIORITY, MODE_STA_STACK_SIZE, serial_bridge(), sysclk_init(), vTaskStartScheduler(), and xTaskCreate.
|
static |
Process input UART command and forward to SPI.
References bt_serial_bridge(), bt_usart_receive(), M2M_ERR_INIT, M2M_SUCCESS, nm_bsp_init(), NULL, os_m2m_wifi_init(), tstrWifiInitParam::pfAppWifiCb, usart_frame_parse(), usart_stream_read(), and usart_stream_reset().
Referenced by main().
|
static |
Parse incoming frame and find the handler to process the request.
References HANDLER_SIZE, reset_buffer, reset_sdio_buffer, usart_stream_reset(), and usart_stream_write().
Referenced by serial_bridge().
|
static |
|
static |
|
static |
|
static |
References CMD_ERR_NO_ERROR, usart_stream_move(), and usart_stream_write().
|
static |
|
static |
|
static |
uint8_t hci_recv_buffer[13] |
Referenced by USART1_Handler().
uint32_t ms_ticks = 0 |
SysTick counter to avoid busy wait delay.
uint8_t reset_buffer[13] = {0xA5,0x01,0x10,0x00,0x00,0x00,0x14,0x00,0x00,005,0x00,0x00,0x00} |
Referenced by usart_frame_parse().
uint8_t reset_sdio_buffer[13] = {0xA5,0x01,0x10,0x00,0x00,0x00,0x14,0x00,0x00,0xFF,0xFB,0xFF,0xFF} |
Referenced by usart_frame_parse().
struct usart_frame usart_handler[] |