initial commit

This commit is contained in:
jhChun
2026-04-08 16:58:54 +09:00
commit 82e33d8bf9
2578 changed files with 1590432 additions and 0 deletions

40
lib/pc_firm/parser.h Normal file
View File

@@ -0,0 +1,40 @@
/* parser.h */
#ifndef PARSER_H
#define PARSER_H
#include <stdint.h>
#include <stdbool.h>
/* Platform-dependent function pointer set */
typedef struct {
void (*log)(const char *fmt, ...);
void (*tx_bin)(const uint8_t *buf, uint16_t len);
bool crc_check;
} dr_platform_if_t;
#define DR_MAX_DATA 128 /* Max data length after TAG */
typedef struct {
char tag[5]; /* "sta?" etc 4 chars + '\0' */
uint8_t data[DR_MAX_DATA]; /* Raw data after TAG */
uint8_t data_len; /* Length of data[] */
} ParsedCmd;
typedef int (*cmd_handler_t)(const ParsedCmd *cmd);
typedef struct {
char tag[5]; /* "sta?" */
bool enabled; /* false = handler won't be called */
cmd_handler_t handler; /* 1=success, 0=fail */
} CmdEntry;
/* Global interface & log flag */
extern dr_platform_if_t g_plat;
extern bool g_log_enable;
/* Main parser entry point */
int dr_cmd_parser(const uint8_t *buf, uint8_t len);
#endif /* PARSER_H */