Serial Bridge.
Copyright (c) 2021 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 "buffered_uart_ultra.h"
#include <string.h>
Data Structures | |
struct | nm_command |
struct | serial_bridge_frame |
struct | serial_bridge_frame_buffer |
struct | serial_bridge_frame_lookup |
Macros | |
#define | PACKET_QUEUE_BUFFER_SIZE 2048 |
#define | SERIAL_BRIDGE_LOOKUP_TABLE_ENTRIES sizeof(serial_bridge_lookup_table) / sizeof(struct serial_bridge_frame_lookup) |
Functions | |
sint8 | enter_wifi_firmware_download (void) |
uint32 | get_systicks (void) |
int | main (void) |
Main application function. More... | |
static void | serial_bridge_frame_buffer_pop (struct serial_bridge_frame_buffer *frame, int size) |
static int | serial_bridge_frame_get_nm_command (struct serial_bridge_frame *frame, struct nm_command *cmd) |
Read out the first 13bytes and copy into cmd buffer after checking the frame. More... | |
static int | serial_bridge_frame_receive (struct serial_bridge_frame_buffer *frame, uint16_t len) |
static void | serial_bridge_process_frame (void) |
static int | serial_bridge_process_read_block (struct serial_bridge_frame *frame) |
Handles the UART frame from nm_read_block() in nmuart.c. More... | |
static int | serial_bridge_process_read_reg_with_ret (struct serial_bridge_frame *frame) |
Handles the UART frame from nm_read_reg_with_ret() in nmuart.c. More... | |
static int | serial_bridge_process_reboot_cmd (struct serial_bridge_frame *frame) |
static int | serial_bridge_process_reconfigure (struct serial_bridge_frame *frame) |
Handles the UART frame from nm_reconfigure() in nmuart.c. More... | |
static int | serial_bridge_process_sync_cmd (struct serial_bridge_frame *frame) |
Handles the UART frame from nm_sync_cmd() in nmuart.c. More... | |
static int | serial_bridge_process_write_block (struct serial_bridge_frame *frame) |
Handles frame from nm_uart_write_block() in nmuart.c. More... | |
static int | serial_bridge_process_write_reg (struct serial_bridge_frame *frame) |
Handles the UART frame from nm_write_reg() in nmuart.c. More... | |
void | SysTick_Handler (void) |
Variables | |
static struct serial_bridge_frame_buffer | frame_buffer |
tstrWifiInitParam | gstrWifiParam |
static volatile uint32 | ms_systicks |
struct serial_bridge_frame_lookup | serial_bridge_lookup_table [] |
#define PACKET_QUEUE_BUFFER_SIZE 2048 |
Referenced by serial_bridge_process_read_block().
#define SERIAL_BRIDGE_LOOKUP_TABLE_ENTRIES sizeof(serial_bridge_lookup_table) / sizeof(struct serial_bridge_frame_lookup) |
Referenced by serial_bridge_process_frame().
sint8 enter_wifi_firmware_download | ( | void | ) |
uint32 get_systicks | ( | void | ) |
References ms_systicks.
int main | ( | void | ) |
Main application function.
Application entry point.
References buffered_uart_init(), enter_wifi_firmware_download(), M2M_ERR, M2M_SUCCESS, m2m_wifi_download_mode(), nm_bsp_init(), ret, system_cpu_clock_get_hz(), and system_init().
|
static |
|
static |
Read out the first 13bytes and copy into cmd buffer after checking the frame.
frame buffer pointer is pop'ed by this function.
References nm_command::addr, c, nm_command::cmd, serial_bridge_frame::cmd, i, serial_bridge_frame_buffer_pop(), nm_command::size, and nm_command::val.
Referenced by serial_bridge_process_read_block(), serial_bridge_process_read_reg_with_ret(), serial_bridge_process_reconfigure(), serial_bridge_process_write_block(), and serial_bridge_process_write_reg().
|
static |
References serial_bridge_frame_buffer::buffer, buffered_uart_rx(), and serial_bridge_frame_buffer::size.
Referenced by serial_bridge_process_write_block().
|
static |
References serial_bridge_frame_buffer::buffer, buffered_uart_putchar(), frame_buffer, header, serial_bridge_frame_lookup::header_size, i, serial_bridge_frame_lookup::min_size, serial_bridge_frame_buffer_pop(), SERIAL_BRIDGE_LOOKUP_TABLE_ENTRIES, and serial_bridge_frame_buffer::size.
Referenced by enter_wifi_firmware_download().
|
static |
Handles the UART frame from nm_read_block() in nmuart.c.
References nm_command::addr, buffered_uart_putchar(), buffered_uart_tx(), nm_read_block(), PACKET_QUEUE_BUFFER_SIZE, serial_bridge_frame_get_nm_command(), and nm_command::size.
|
static |
Handles the UART frame from nm_read_reg_with_ret() in nmuart.c.
References nm_command::addr, buffered_uart_putchar(), nm_read_reg(), serial_bridge_frame_get_nm_command(), and nm_command::val.
|
static |
|
static |
Handles the UART frame from nm_reconfigure() in nmuart.c.
References buffered_uart_init(), buffered_uart_putchar(), buffered_uart_term(), delay_ms, serial_bridge_frame_get_nm_command(), and nm_command::val.
|
static |
Handles the UART frame from nm_sync_cmd() in nmuart.c.
References buffered_uart_putchar(), and serial_bridge_frame_buffer_pop().
Referenced by enter_wifi_firmware_download().
|
static |
Handles frame from nm_uart_write_block() in nmuart.c.
References nm_command::addr, buffered_uart_putchar(), nm_write_block(), serial_bridge_frame_buffer_pop(), serial_bridge_frame_get_nm_command(), serial_bridge_frame_receive(), and nm_command::size.
|
static |
Handles the UART frame from nm_write_reg() in nmuart.c.
References nm_command::addr, buffered_uart_putchar(), nm_write_reg(), serial_bridge_frame_get_nm_command(), and nm_command::val.
void SysTick_Handler | ( | void | ) |
|
static |
Referenced by enter_wifi_firmware_download(), and serial_bridge_process_frame().
tstrWifiInitParam gstrWifiParam |
|
static |
Referenced by get_systicks().
struct serial_bridge_frame_lookup serial_bridge_lookup_table[] |