blob: e92adeefb3a222bf102bfd7072b2ccf8d3f1060c [file] [log] [blame]
Uwe Hermann7eb845e2008-11-02 17:01:06 +00001/*
2 * This file is part of the bayou project.
3 *
4 * Copyright (C) 2008 Advanced Micro Devices, Inc.
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 version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
Uwe Hermann7eb845e2008-11-02 17:01:06 +000014 */
15
16#include <stdio.h>
17
18#ifndef PBUILDER_H_
19#define PBUILDER_H_
20
21#include <stdint.h>
22#include <stdio.h>
23
24#define warn(fmt, args...) fprintf(stderr, fmt, ##args)
25#define die(fmt, args...) \
26 do { fprintf(stderr, fmt, ##args); exit(-1); } \
27 while(0)
28
29struct pentry {
30 uint8_t index;
31 uint8_t parent;
32 uint8_t type;
33 uint8_t flags;
34 uint8_t title[64];
35 char *file;
36 char *larname;
37};
38
39struct config {
40 int timeout;
41 int n_entries;
42 struct pentry **entries;
43};
44
45struct bpt_config {
46 uint32_t id;
47 uint8_t timeout;
48 uint8_t entries;
49 uint8_t padding[10];
50};
51
52struct bpt_pentry {
53 uint8_t index;
54 uint8_t parent;
55 uint8_t type;
56 uint8_t flags;
57 uint8_t title[64];
58 uint8_t nlen;
59};
60
61#define BPT_ID 0x30545042
62#define BPT_TYPE_CHOOSER 0x01
63#define BPT_TYPE_CHAIN 0x02
64#define BPT_TYPE_SUBCHAIN 0x03
65
66#define BPT_FLAG_DEFAULT 0x01
67#define BPT_FLAG_NOSHOW 0x02
68
69int pbuilder_show_lar(const char *input);
70int create_lar_from_config(const char *input, const char *output);
71void parseconfig(FILE * stream, struct config *config);
72
73#endif