mirror of
https://review.coreboot.org/flashrom.git
synced 2025-10-27 11:22:10 +01:00
This patch moves all the declarations relevant to serial into their own header in include/serial.h. The corresponding functions implementations are already in serial.c, so the declarations naturally can be in serial.h Currently, most of the declarations reside in flash.h making it difficult to really understand file dependency. Change-Id: Id0b4d188e2a94dbc4d90747c05eabca39c6b3f26 Signed-off-by: Antonio Vázquez <antoniovazquezblanco@gmail.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/89650 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
56 lines
1.2 KiB
C
56 lines
1.2 KiB
C
/*
|
|
* This file is part of the flashrom project.
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#ifndef __SERIAL_H__
|
|
#define __SERIAL_H__ 1
|
|
|
|
#if IS_WINDOWS
|
|
typedef HANDLE fdtype;
|
|
#define SER_INV_FD INVALID_HANDLE_VALUE
|
|
#else
|
|
typedef int fdtype;
|
|
#define SER_INV_FD -1
|
|
#endif
|
|
|
|
void sp_flush_incoming(void);
|
|
fdtype sp_openserport(char *dev, int baud);
|
|
extern fdtype sp_fd;
|
|
int serialport_config(fdtype fd, int baud);
|
|
int serialport_shutdown(void *data);
|
|
int serialport_write(const unsigned char *buf, unsigned int writecnt);
|
|
int serialport_write_nonblock(const unsigned char *buf, unsigned int writecnt, unsigned int timeout, unsigned int *really_wrote);
|
|
int serialport_read(unsigned char *buf, unsigned int readcnt);
|
|
int serialport_read_nonblock(unsigned char *c, unsigned int readcnt, unsigned int timeout, unsigned int *really_read);
|
|
|
|
/* Serial port/pin mapping:
|
|
|
|
1 CD <-
|
|
2 RXD <-
|
|
3 TXD ->
|
|
4 DTR ->
|
|
5 GND --
|
|
6 DSR <-
|
|
7 RTS ->
|
|
8 CTS <-
|
|
9 RI <-
|
|
*/
|
|
enum SP_PIN {
|
|
PIN_CD = 1,
|
|
PIN_RXD,
|
|
PIN_TXD,
|
|
PIN_DTR,
|
|
PIN_GND,
|
|
PIN_DSR,
|
|
PIN_RTS,
|
|
PIN_CTS,
|
|
PIN_RI,
|
|
};
|
|
|
|
void sp_set_pin(enum SP_PIN pin, int val);
|
|
int sp_get_pin(enum SP_PIN pin);
|
|
|
|
#endif /* !__SERIAL_H__ */
|