Add shared waveform processing, generation and firmware image support
This commit is contained in:
24
c/set-protocol/include/firmware_image.h
Normal file
24
c/set-protocol/include/firmware_image.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef SET_FIRMWARE_IMAGE_H
|
||||
#define SET_FIRMWARE_IMAGE_H
|
||||
#include "pcan_abi.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/* Caller-owned workspace; the parser never allocates memory or accesses files. */
|
||||
typedef struct { uint32_t address; uint8_t value; } firmware_hex_cell_t;
|
||||
enum { FW_HEX_OK, FW_HEX_FORMAT, FW_HEX_CHECKSUM, FW_HEX_RECORD,
|
||||
FW_HEX_EOF, FW_HEX_OVERLAP, FW_HEX_RANGE, FW_HEX_CAPACITY,
|
||||
FW_HEX_PREFIX, FW_HEX_DIGITS, FW_HEX_LENGTH };
|
||||
/* Strict HEX: reject any overlap and any non-whitespace after EOF. On failure
|
||||
* count is zero. Cells are sorted by address only on successful completion. */
|
||||
PCAN_ABI_API int firmware_hex_parse(const char *text, size_t length,
|
||||
firmware_hex_cell_t *cells, size_t capacity, size_t max_records,
|
||||
size_t *count, size_t *error_line);
|
||||
/* Return one contiguous segment starting at offset in a successfully parsed
|
||||
* workspace; the caller uses its address and copies its values into its model. */
|
||||
PCAN_ABI_API size_t firmware_hex_segment_size(const firmware_hex_cell_t *cells,
|
||||
size_t count, size_t offset);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
Reference in New Issue
Block a user