1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2011 Amaury Pouly
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
25 * Command file parsing
30 enum cmd_source_type_t
51 struct cmd_source_t
*next
;
53 enum cmd_source_type_t type
;
55 struct elf_params_t elf
;
56 struct bin_param_t bin
;
61 CMD_LOAD
, /* load image */
62 CMD_JUMP
, /* jump at image */
63 CMD_CALL
, /* call image */
64 CMD_LOAD_AT
, /* load binary at */
65 CMD_CALL_AT
, /* call at address */
66 CMD_JUMP_AT
, /* jump at address */
67 CMD_MODE
, /* change boot mode */
72 enum cmd_inst_type_t type
;
74 uint32_t argument
; // for jump, call, mode
75 uint32_t addr
; // for 'at'
76 struct cmd_inst_t
*next
;
87 struct cmd_option_t
*next
;
95 struct cmd_inst_t
*inst_list
;
98 struct cmd_section_t
*next
;
99 struct cmd_option_t
*opt_list
;
104 struct cmd_option_t
*opt_list
;
105 struct cmd_option_t
*constant_list
; /* constant are always integers */
106 struct cmd_source_t
*source_list
;
107 struct cmd_section_t
*section_list
;
110 struct cmd_source_t
*db_find_source_by_id(struct cmd_file_t
*cmd_file
, const char *id
);
111 struct cmd_option_t
*db_find_option_by_id(struct cmd_option_t
*opt
, const char *name
);
112 bool db_parse_sb_version(struct sb_version_t
*ver
, char *str
);
113 void db_generate_default_sb_version(struct sb_version_t
*ver
);
114 struct cmd_file_t
*db_parse_file(const char *file
);
115 void db_free_option_list(struct cmd_option_t
*opt_list
);
116 void db_free(struct cmd_file_t
*file
);
118 #endif /* __DBPARSER__ */