xref: /openbmc/obmc-console/config.h (revision 1e04f449)
1 /**
2  * Copyright © 2016 IBM
3  * Copyright © 2024 9elements
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #pragma once
19 
20 #include <stdint.h>
21 #include <termios.h>
22 
23 struct config;
24 
25 const char *config_get_value(struct config *config, const char *name);
26 struct config *config_init(const char *filename);
27 const char *config_resolve_console_id(struct config *config,
28 				      const char *id_arg);
29 void config_fini(struct config *config);
30 
31 int config_parse_baud(speed_t *speed, const char *baud_string);
32 uint32_t parse_baud_to_int(speed_t speed);
33 speed_t parse_int_to_baud(uint32_t baud);
34 int config_parse_bytesize(const char *size_str, size_t *size);
35