blob: c3eec105df002b38adb53e7fdbe73713183c6120 [file] [log] [blame]
Patrick Georgiea063cb2020-05-08 19:28:13 +02001/* bincfg - Compiler/Decompiler for data blobs with specs */
Patrick Georgi7333a112020-05-08 20:48:04 +02002/* SPDX-License-Identifier: GPL-3.0-or-later */
Denis 'GNUtoo' Cariklifa0bdfc2018-01-12 04:04:30 +01003
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
11struct field {
12 char *name;
13 unsigned int width;
14 unsigned int value;
15 struct field *next;
16};
17
18/* Bit array intermediary representation */
19struct blob {
20 unsigned int bloblen;
21 unsigned char *blb;
22 unsigned short checksum;
23 unsigned char *actualblob;
24 unsigned int lenactualblob;
25};
26
Angel Pons175778f2019-01-26 10:09:13 +000027static struct field *putsym (char const *, unsigned int);
28static struct field *getsym (char const *);
29static void yyerror (FILE* fp, char const *);
30int yylex (void);
Denis 'GNUtoo' Cariklifa0bdfc2018-01-12 04:04:30 +010031
Denis 'GNUtoo' Cariklifa0bdfc2018-01-12 04:04:30 +010032static struct blob *binary;
Angel Pons175778f2019-01-26 10:09:13 +000033static struct field *sym_table;
Denis 'GNUtoo' Cariklifa0bdfc2018-01-12 04:04:30 +010034static struct field *sym_table_tail;
35
36#endif /* __BINCFG_H */