1974c85b1SJens Wiklander /* 2974c85b1SJens Wiklander * Copyright (c) 2016, Linaro Limited 3974c85b1SJens Wiklander * All rights reserved. 4974c85b1SJens Wiklander * 5974c85b1SJens Wiklander * Redistribution and use in source and binary forms, with or without 6974c85b1SJens Wiklander * modification, are permitted provided that the following conditions are met: 7974c85b1SJens Wiklander * 8974c85b1SJens Wiklander * 1. Redistributions of source code must retain the above copyright notice, 9974c85b1SJens Wiklander * this list of conditions and the following disclaimer. 10974c85b1SJens Wiklander * 11974c85b1SJens Wiklander * 2. Redistributions in binary form must reproduce the above copyright notice, 12974c85b1SJens Wiklander * this list of conditions and the following disclaimer in the documentation 13974c85b1SJens Wiklander * and/or other materials provided with the distribution. 14974c85b1SJens Wiklander * 15974c85b1SJens Wiklander * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16974c85b1SJens Wiklander * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17974c85b1SJens Wiklander * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18974c85b1SJens Wiklander * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19974c85b1SJens Wiklander * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20974c85b1SJens Wiklander * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21974c85b1SJens Wiklander * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22974c85b1SJens Wiklander * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23974c85b1SJens Wiklander * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24974c85b1SJens Wiklander * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25974c85b1SJens Wiklander * POSSIBILITY OF SUCH DAMAGE. 26974c85b1SJens Wiklander */ 27974c85b1SJens Wiklander #ifndef __DRIVERS_SERIAL_H 28974c85b1SJens Wiklander #define __DRIVERS_SERIAL_H 29974c85b1SJens Wiklander 30*ae8a86d9SJerome Forissier #include <stdbool.h> 31*ae8a86d9SJerome Forissier 32974c85b1SJens Wiklander struct serial_chip { 33974c85b1SJens Wiklander const struct serial_ops *ops; 34974c85b1SJens Wiklander }; 35974c85b1SJens Wiklander 36974c85b1SJens Wiklander struct serial_ops { 37974c85b1SJens Wiklander void (*putc)(struct serial_chip *chip, int ch); 38974c85b1SJens Wiklander void (*flush)(struct serial_chip *chip); 39974c85b1SJens Wiklander bool (*have_rx_data)(struct serial_chip *chip); 40974c85b1SJens Wiklander int (*getchar)(struct serial_chip *chip); 41974c85b1SJens Wiklander }; 42974c85b1SJens Wiklander 43974c85b1SJens Wiklander #endif /*__DRIVERS_SERIASERIAL_H*/ 44