PHiLIP
app_shell_if.c File Reference

Protocol for application communication. More...

#include <errno.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include "stm32f1xx_hal.h"
#include "PHiLIP_typedef.h"
#include "PHiLIP_map.h"
#include "app_access.h"
#include "app_common.h"
#include "app_reg.h"
#include "map_if.h"
#include "app_shell_if.h"

Macros

#define READ_REG_CMD   "rr "
 The command to read application registers.
 
#define WRITE_REG_CMD   "wr "
 The command to write application registers.
 
#define EXECUTE_CMD   "ex\n"
 The command to execute and commit changes in the registers.
 
#define RESET_CMD   "mcu_rst\n"
 The command to provide a software reset to the applications.
 
#define VERSION_CMD   "-v\n"
 Prints the version of the interface.
 
#define VERSION_CMD2   "version\n"
 Prints the version of the interface.
 
#define VERSION_CMD3   "ver\n"
 Prints the version of the interface.
 
#define VERSION_CMD4   "--v\n"
 Prints the version of the interface.
 
#define HELP_CMD   "help\n"
 Prints a help menu.
 
#define MEMORY_MAP_CMD   "mm "
 Gives properties of the memory map for a given index.
 
#define MM_SIZE_CMD   "mm_size\n"
 Gives the amount of records in the memory map.
 
#define READ_KEY_CMD   "r "
 Reads values given a record name.
 
#define WRITE_KEY_CMD   "w "
 Writes a value to a record name.
 
#define ATOU_MAX_CHAR   10
 Maximum characters for parsing strings to numbers.
 
#define ATOU_ERROR   0xFFFFFFFF
 Error code for parsing strings to numbers.
 
#define BYTE_MAX   ((uint8_t)0xFF)
 Macro for max values of a byte.
 
#define IS_NUM(x)   (x >= '0' && x <= '9')
 Is a ascii number.
 
#define IS_COMMAND(x)   (memcmp(str, x, strlen(x)) == 0)
 Macro to check if command string matches.
 

Functions

error_t parse_command (char *str, uint16_t buf_size, uint8_t access)
 Parses a string and executes commands. More...
 

Detailed Description

Protocol for application communication.

Author
Kevin Weiss
Date
13.02.2019

This initializes and runs the serial communication protocol for interfacing to registers. It used the STM HAL and a UART for the IO. It also uses DMA.