Patrick Georgi | ea063cb | 2020-05-08 19:28:13 +0200 | [diff] [blame] | 1 | /* bincfg - Compiler/Decompiler for data blobs with specs */ |
Patrick Georgi | 7333a11 | 2020-05-08 20:48:04 +0200 | [diff] [blame] | 2 | /* SPDX-License-Identifier: GPL-3.0-or-later */ |
Denis 'GNUtoo' Carikli | fa0bdfc | 2018-01-12 04:04:30 +0100 | [diff] [blame] | 3 | |
| 4 | #ifndef __BINCFG_H |
| 5 | #define __BINCFG_H |
| 6 | |
| 7 | #define VALID_BIT 0x80 |
| 8 | #define MAX_WIDTH 32 |
| 9 | #define CHECKSUM_SIZE 16 |
| 10 | |
| 11 | struct field { |
| 12 | char *name; |
| 13 | unsigned int width; |
| 14 | unsigned int value; |
| 15 | struct field *next; |
| 16 | }; |
| 17 | |
| 18 | /* Bit array intermediary representation */ |
| 19 | struct blob { |
| 20 | unsigned int bloblen; |
| 21 | unsigned char *blb; |
| 22 | unsigned short checksum; |
| 23 | unsigned char *actualblob; |
| 24 | unsigned int lenactualblob; |
| 25 | }; |
| 26 | |
Angel Pons | 175778f | 2019-01-26 10:09:13 +0000 | [diff] [blame] | 27 | static struct field *putsym (char const *, unsigned int); |
| 28 | static struct field *getsym (char const *); |
| 29 | static void yyerror (FILE* fp, char const *); |
| 30 | int yylex (void); |
Denis 'GNUtoo' Carikli | fa0bdfc | 2018-01-12 04:04:30 +0100 | [diff] [blame] | 31 | |
Denis 'GNUtoo' Carikli | fa0bdfc | 2018-01-12 04:04:30 +0100 | [diff] [blame] | 32 | static struct blob *binary; |
Angel Pons | 175778f | 2019-01-26 10:09:13 +0000 | [diff] [blame] | 33 | static struct field *sym_table; |
Denis 'GNUtoo' Carikli | fa0bdfc | 2018-01-12 04:04:30 +0100 | [diff] [blame] | 34 | static struct field *sym_table_tail; |
| 35 | |
| 36 | #endif /* __BINCFG_H */ |