Eric Kunze | e5e2676 | 2020-10-13 16:11:07 -0700 | [diff] [blame^] | 1 | |
| 2 | // Copyright (c) 2020, ARM Limited. |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | |
| 16 | #ifndef FUNC_CONFIG_H_ |
| 17 | #define FUNC_CONFIG_H_ |
| 18 | |
| 19 | // Parameter value structure |
| 20 | #define DEF_UNIT_START(UNIT) \ |
| 21 | struct UNIT##_t \ |
| 22 | { |
| 23 | #define DEF_UNIT_END(UNIT) \ |
| 24 | } \ |
| 25 | UNIT; |
| 26 | #define DEF_OPTION(NAME, DESC, TYPE, FMT, DEFAULT) TYPE NAME; |
| 27 | #define DEF_OPTION_STR(NAME, DESC, LEN, DEFAULT) char NAME[LEN]; |
| 28 | #define DEF_UNIT_OPTION(UNIT, NAME, DESC, TYPE, FMT, DEFAULT) TYPE NAME; |
| 29 | #define DEF_UNIT_OPTION_STR(UNIT, NAME, DESC, LEN, DEFAULT) char NAME[LEN]; |
| 30 | struct func_config_t |
| 31 | { |
| 32 | #include "func_config.def" |
| 33 | #undef DEF_UNIT_START |
| 34 | #undef DEF_UNIT_END |
| 35 | #undef DEF_OPTION |
| 36 | #undef DEF_OPTION_STR |
| 37 | #undef DEF_UNIT_OPTION |
| 38 | #undef DEF_UNIT_OPTION_STR |
| 39 | }; |
| 40 | |
| 41 | // Forward declaration |
| 42 | struct func_debug_t; |
| 43 | |
| 44 | int func_model_init_config(); |
| 45 | int func_model_set_default_config(func_config_t*); |
| 46 | int func_model_config_set_option(func_config_t*, const char* name, const char* value); |
| 47 | int func_model_print_config(func_config_t*, FILE* out); |
| 48 | int func_model_parse_cmd_line(func_config_t*, func_debug_t* func_debug, const int argc, const char** argv); |
| 49 | int func_model_parse_flat_config_file(func_config_t*, const char* filename); |
| 50 | int func_model_config_cleanup(); |
| 51 | int func_model_config_get_str_option_by_name(func_config_t*, const char* name, char* value, const uint32_t len); |
| 52 | int func_model_config_get_option_by_name(func_config_t*, const char* name, uint64_t* val); |
| 53 | int func_model_print_help(FILE* out); |
| 54 | |
| 55 | #endif |