xref: /optee_os/core/include/drivers/serial.h (revision 974c85b19ae5260c2332e4bb4a14bb17b42564d5)
1*974c85b1SJens Wiklander /*
2*974c85b1SJens Wiklander  * Copyright (c) 2016, Linaro Limited
3*974c85b1SJens Wiklander  * All rights reserved.
4*974c85b1SJens Wiklander  *
5*974c85b1SJens Wiklander  * Redistribution and use in source and binary forms, with or without
6*974c85b1SJens Wiklander  * modification, are permitted provided that the following conditions are met:
7*974c85b1SJens Wiklander  *
8*974c85b1SJens Wiklander  * 1. Redistributions of source code must retain the above copyright notice,
9*974c85b1SJens Wiklander  * this list of conditions and the following disclaimer.
10*974c85b1SJens Wiklander  *
11*974c85b1SJens Wiklander  * 2. Redistributions in binary form must reproduce the above copyright notice,
12*974c85b1SJens Wiklander  * this list of conditions and the following disclaimer in the documentation
13*974c85b1SJens Wiklander  * and/or other materials provided with the distribution.
14*974c85b1SJens Wiklander  *
15*974c85b1SJens Wiklander  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16*974c85b1SJens Wiklander  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17*974c85b1SJens Wiklander  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18*974c85b1SJens Wiklander  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19*974c85b1SJens Wiklander  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20*974c85b1SJens Wiklander  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21*974c85b1SJens Wiklander  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22*974c85b1SJens Wiklander  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23*974c85b1SJens Wiklander  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24*974c85b1SJens Wiklander  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25*974c85b1SJens Wiklander  * POSSIBILITY OF SUCH DAMAGE.
26*974c85b1SJens Wiklander  */
27*974c85b1SJens Wiklander #ifndef __DRIVERS_SERIAL_H
28*974c85b1SJens Wiklander #define __DRIVERS_SERIAL_H
29*974c85b1SJens Wiklander 
30*974c85b1SJens Wiklander struct serial_chip {
31*974c85b1SJens Wiklander 	const struct serial_ops *ops;
32*974c85b1SJens Wiklander };
33*974c85b1SJens Wiklander 
34*974c85b1SJens Wiklander struct serial_ops {
35*974c85b1SJens Wiklander 	void (*putc)(struct serial_chip *chip, int ch);
36*974c85b1SJens Wiklander 	void (*flush)(struct serial_chip *chip);
37*974c85b1SJens Wiklander 	bool (*have_rx_data)(struct serial_chip *chip);
38*974c85b1SJens Wiklander 	int (*getchar)(struct serial_chip *chip);
39*974c85b1SJens Wiklander };
40*974c85b1SJens Wiklander 
41*974c85b1SJens Wiklander #endif /*__DRIVERS_SERIASERIAL_H*/
42