blob: 38e6cfc4034c840a5cdac6f1b07f9cb3b5baa043 [file] [log] [blame]
Urja Rannikko615ba182017-06-15 15:28:27 +03001/*
2 * This file is part of the flashrom project.
3 *
4 * Copyright (C) 2017 Urja Rannikko <urjaman@gmail.com>
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 2 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.
Urja Rannikko615ba182017-06-15 15:28:27 +030015 */
16
17#ifndef __CUSTOM_BAUD_H__
18#define __CUSTOM_BAUD_H__ 1
19
20struct baudentry {
21 int flag;
22 unsigned int baud;
23};
24
Peter Stugeb078ec62022-12-11 04:02:10 +010025enum custom_baud_stage {
26 BEFORE_FLAGS = 0,
27 WITH_FLAGS,
28 AFTER_FLAGS
29};
30
31int set_custom_baudrate(int fd, unsigned int baud, const enum custom_baud_stage stage, void *tio_wanted);
Urja Rannikko615ba182017-06-15 15:28:27 +030032
33/* Returns 1 if non-exact rate would be used, and setting a custom rate is supported.
34 The baudtable must be in ascending order and terminated with a 0-baud entry. */
35int use_custom_baud(unsigned int baud, const struct baudentry *baudtable);
36
37#endif