From e8356afa26dc4d04361b3b66c728ae1ecd17b4e3 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Thu, 29 Jun 2017 18:14:39 -0400 Subject: pru: Rework command processing so that most of it is done on pru0 Change the command dispatch and response generation so that most of the work is done on pru0 instead of pru1. This allows more code to fit into the limited space on pru1. Signed-off-by: Kevin O'Connor --- src/command.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'src/command.c') diff --git a/src/command.c b/src/command.c index af84539f..53263a8f 100644 --- a/src/command.c +++ b/src/command.c @@ -13,19 +13,6 @@ #include "command.h" // output_P #include "sched.h" // DECL_TASK -#define MESSAGE_MIN 5 -#define MESSAGE_MAX 64 -#define MESSAGE_HEADER_SIZE 2 -#define MESSAGE_TRAILER_SIZE 3 -#define MESSAGE_POS_LEN 0 -#define MESSAGE_POS_SEQ 1 -#define MESSAGE_TRAILER_CRC 3 -#define MESSAGE_TRAILER_SYNC 1 -#define MESSAGE_PAYLOAD_MAX (MESSAGE_MAX - MESSAGE_MIN) -#define MESSAGE_SEQ_MASK 0x0f -#define MESSAGE_DEST 0x10 -#define MESSAGE_SYNC 0x7E - static uint8_t next_sequence = MESSAGE_DEST; @@ -68,8 +55,9 @@ parse_int(char **pp) } // Parse an incoming command into 'args' -static char * -parsef(char *p, char *maxend, const struct command_parser *cp, uint32_t *args) +char * +command_parsef(char *p, char *maxend + , const struct command_parser *cp, uint32_t *args) { uint8_t num_params = READP(cp->num_params); const uint8_t *param_types = READP(cp->param_types); @@ -301,7 +289,7 @@ command_dispatch(char *buf, uint8_t msglen) uint8_t cmdid = *p++; const struct command_parser *cp = command_lookup_parser(cmdid); uint32_t args[READP(cp->num_args)]; - p = parsef(p, msgend, cp, args); + p = command_parsef(p, msgend, cp, args); if (sched_is_shutdown() && !(READP(cp->flags) & HF_IN_SHUTDOWN)) { sched_report_shutdown(); continue; -- cgit v1.2.3-70-g09d2