Serial Bridge.
Copyright (c) 2016-2018 Microchip Technology Inc. and its subsidiaries.
#include <asf.h>
#include "common/include/nm_common.h"
#include "bus_wrapper/include/nm_bus_wrapper.h"
#include "driver/source/nmbus.h"
#include "driver/include/m2m_wifi.h"
#include "usart_stream.h"
#include <string.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 |
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 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) |
static sint8 | enter_wifi_firmware_download (void) |
Process input UART command and forward to SPI. More... | |
int | main (void) |
Main application function. 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 | |
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 |
enum cmd_err_code |
|
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 |
|
static |
Process input UART command and forward to SPI.
References M2M_ERR_INIT, M2M_SUCCESS, m2m_wifi_download_mode(), usart_frame_parse(), usart_stream_read(), and usart_stream_reset().
Referenced by main().
int main | ( | void | ) |
Main application function.
Application entry point.
References board_init(), configure_usart(), enter_wifi_firmware_download(), nm_bsp_init(), and sysclk_init().
|
static |
Parse incoming frame and find the handler to process the request.
References HANDLER_SIZE, usart_stream_reset(), and usart_stream_write().
Referenced by enter_wifi_firmware_download().
|
static |
|
static |
|
static |
|
static |
References CMD_ERR_NO_ERROR, usart_stream_move(), and usart_stream_write().
|
static |
|
static |
struct usart_frame usart_handler[] |
Referenced by ISR().