42 lines
1.1 KiB
C
42 lines
1.1 KiB
C
|
|
||
|
#include <stdint.h>
|
||
|
|
||
|
typedef enum
|
||
|
{
|
||
|
SHELLMATTA_OK = 0u
|
||
|
, SHELLMATTA_ERROR
|
||
|
, SHELLMATTA_CONTINUE
|
||
|
, SHELLMATTA_USE_FAULT
|
||
|
} shellmatta_retCode_t;
|
||
|
|
||
|
typedef shellmatta_retCode_t (*shellmatta_cmdFct_t)(int argc, char *argv[]);
|
||
|
|
||
|
typedef struct shellmatta_cmd
|
||
|
{
|
||
|
char *cmd;
|
||
|
char *cmdAlias;
|
||
|
char *helpText;
|
||
|
char *usageText;
|
||
|
shellmatta_cmdFct_t cmdFct;
|
||
|
struct shellmatta_cmd *next;
|
||
|
} shellmatta_cmd_t;
|
||
|
|
||
|
typedef struct
|
||
|
{
|
||
|
uint8_t *buffer;
|
||
|
uint32_t bufferSize;
|
||
|
uint32_t bufferWritePointer;
|
||
|
uint32_t bufferReadPointer;
|
||
|
uint8_t *historyBuffer;
|
||
|
uint32_t historyBufferSize;
|
||
|
shellmatta_cmd_t *cmdList;
|
||
|
} shellmatta_instance_t;
|
||
|
|
||
|
extern void shellmatta_doInit(shellmatta_instance_t *inst, uint8_t *buffer, uint32_t bufferSize, uint8_t *historyBuffer, uint32_t historyBufferSize);
|
||
|
extern void shellmatta_addCmd(shellmatta_instance_t *inst, shellmatta_cmd_t *cmd);
|
||
|
extern void shellmatta_doTask(shellmatta_instance_t *inst, uint32_t time);
|
||
|
extern void shellmatta_processData(shellmatta_instance_t *inst, char *data, uint32_t size);
|
||
|
extern void shellmatta_printf(shellmatta_instance_t *inst, const char *fmt, ...);
|
||
|
extern void shellmatta_getArg(uint32_t cnt, uint8_t *arg);
|
||
|
|