blob: b8c668889e13d02b201464d045e5000fa8dd1375 [file] [log] [blame]
Denis 'GNUtoo' Cariklifa0bdfc2018-01-12 04:04:30 +01001/*
2 * bincfg - Compiler/Decompiler for data blobs with specs
3 * Copyright (C) 2017 Damien Zammit <damien@zamaudio.com>
4 * Copyright (C) 2018 Denis 'GNUtoo' Carikli <GNUtoo@no-log.org>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef __BINCFG_H
18#define __BINCFG_H
19
20#define VALID_BIT 0x80
21#define MAX_WIDTH 32
22#define CHECKSUM_SIZE 16
23
24struct field {
25 char *name;
26 unsigned int width;
27 unsigned int value;
28 struct field *next;
29};
30
31/* Bit array intermediary representation */
32struct blob {
33 unsigned int bloblen;
34 unsigned char *blb;
35 unsigned short checksum;
36 unsigned char *actualblob;
37 unsigned int lenactualblob;
38};
39
40static struct field *putsym (char const *, unsigned int);
41static struct field *getsym (char const *);
Denis 'GNUtoo' Cariklid5dee1e2018-01-12 04:21:14 +010042static void yyerror (FILE* fp, char const *);
Denis 'GNUtoo' Cariklifa0bdfc2018-01-12 04:04:30 +010043int yylex (void);
44
Denis 'GNUtoo' Cariklifa0bdfc2018-01-12 04:04:30 +010045static struct blob *binary;
46static struct field *sym_table;
47static struct field *sym_table_tail;
48
49#endif /* __BINCFG_H */