29 lines
654 B
C
29 lines
654 B
C
#ifndef _HEX_PARSER_H_
|
|
#define _HEX_PARSER_H_
|
|
|
|
#include <stdint.h>
|
|
#include <fatfs/ff.h>
|
|
#include <stddef.h>
|
|
|
|
enum hex_parser_ret {
|
|
HEX_PARSER_OK = 0,
|
|
HEX_PARSER_DATA_OK,
|
|
HEX_PARSER_ERROR,
|
|
HEX_PARSER_FILE_END,
|
|
HEX_PARSER_EOF_RECORD,
|
|
};
|
|
|
|
struct hex_parser {
|
|
FIL file;
|
|
uint32_t current_address_offset;
|
|
};
|
|
|
|
enum hex_parser_ret hex_parser_open(struct hex_parser *parser, const char *file_name);
|
|
|
|
enum hex_parser_ret hex_parser_parse(struct hex_parser *parser, uint32_t *address, char *data, size_t data_len,
|
|
size_t *len_out);
|
|
|
|
enum hex_parser_ret hex_parser_close(struct hex_parser *parser);
|
|
|
|
#endif /* _HEX_PARSER_H_ */
|