USB Serial application

Fork of USBSerial_HelloWorld by Samuel Mokrani

Committer:
Zaitsev
Date:
Tue Jan 10 20:42:26 2017 +0000
Revision:
10:41552d038a69
USB Serial bi-directional bridge

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Zaitsev 10:41552d038a69 1 /**
Zaitsev 10:41552d038a69 2 ******************************************************************************
Zaitsev 10:41552d038a69 3 * @file uart.h
Zaitsev 10:41552d038a69 4 * @brief Defines common properties of any UART driver.
Zaitsev 10:41552d038a69 5 * @internal
Zaitsev 10:41552d038a69 6 * @author ON Semiconductor
Zaitsev 10:41552d038a69 7 * $Rev: 2074 $
Zaitsev 10:41552d038a69 8 * $Date: 2013-07-10 18:06:15 +0530 (Wed, 10 Jul 2013) $
Zaitsev 10:41552d038a69 9 ******************************************************************************
Zaitsev 10:41552d038a69 10 * Copyright 2016 Semiconductor Components Industries LLC (d/b/a “ON Semiconductor”).
Zaitsev 10:41552d038a69 11 * All rights reserved. This software and/or documentation is licensed by ON Semiconductor
Zaitsev 10:41552d038a69 12 * under limited terms and conditions. The terms and conditions pertaining to the software
Zaitsev 10:41552d038a69 13 * and/or documentation are available at http://www.onsemi.com/site/pdf/ONSEMI_T&C.pdf
Zaitsev 10:41552d038a69 14 * (“ON Semiconductor Standard Terms and Conditions of Sale, Section 8 Software”) and
Zaitsev 10:41552d038a69 15 * if applicable the software license agreement. Do not use this software and/or
Zaitsev 10:41552d038a69 16 * documentation unless you have carefully read and you agree to the limited terms and
Zaitsev 10:41552d038a69 17 * conditions. By using this software and/or documentation, you agree to the limited
Zaitsev 10:41552d038a69 18 * terms and conditions.
Zaitsev 10:41552d038a69 19 *
Zaitsev 10:41552d038a69 20 * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
Zaitsev 10:41552d038a69 21 * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
Zaitsev 10:41552d038a69 22 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
Zaitsev 10:41552d038a69 23 * ON SEMICONDUCTOR SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL,
Zaitsev 10:41552d038a69 24 * INCIDENTAL, OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
Zaitsev 10:41552d038a69 25 * @endinternal
Zaitsev 10:41552d038a69 26 *
Zaitsev 10:41552d038a69 27 * @details
Zaitsev 10:41552d038a69 28 * A UART driver must comply to the generic driver template (see driver.h), and
Zaitsev 10:41552d038a69 29 * more specifically to the character driver template (see char_driver.h). All
Zaitsev 10:41552d038a69 30 * UART drivers share some properties; defining these is the purpose of this file.
Zaitsev 10:41552d038a69 31 *
Zaitsev 10:41552d038a69 32 * The options passed when opening a UART device should at least include the
Zaitsev 10:41552d038a69 33 * flow control type and the baud rate. These are included in the uart_options_t
Zaitsev 10:41552d038a69 34 * data type. The type can be extended by a UART driver implementation.
Zaitsev 10:41552d038a69 35 *
Zaitsev 10:41552d038a69 36 * The UART driver implementation must make its driver publicly available with
Zaitsev 10:41552d038a69 37 * an external global variable.
Zaitsev 10:41552d038a69 38 *
Zaitsev 10:41552d038a69 39 * @ingroup uart
Zaitsev 10:41552d038a69 40 */
Zaitsev 10:41552d038a69 41
Zaitsev 10:41552d038a69 42 #ifndef UART_H_
Zaitsev 10:41552d038a69 43 #define UART_H_
Zaitsev 10:41552d038a69 44
Zaitsev 10:41552d038a69 45 //#include "char_driver.h"
Zaitsev 10:41552d038a69 46
Zaitsev 10:41552d038a69 47 /** Type listing the supported kinds of flow control. */
Zaitsev 10:41552d038a69 48 typedef enum {
Zaitsev 10:41552d038a69 49 /** No flow control */
Zaitsev 10:41552d038a69 50 none,
Zaitsev 10:41552d038a69 51 /** use hardware CTS (External CPU indicates it is ok for the modem to transmit)
Zaitsev 10:41552d038a69 52 * and RTS (modem requests to sent to external CPU) flow control.
Zaitsev 10:41552d038a69 53 */
Zaitsev 10:41552d038a69 54 rtscts,
Zaitsev 10:41552d038a69 55 /** use hardware CTS/RTS flow control, but CTS is no response to RTS,
Zaitsev 10:41552d038a69 56 * RTS and CTS are used to indicate intent to transmit.
Zaitsev 10:41552d038a69 57 */
Zaitsev 10:41552d038a69 58 rtscts_e
Zaitsev 10:41552d038a69 59 } flow_control_t;
Zaitsev 10:41552d038a69 60
Zaitsev 10:41552d038a69 61 /** A set of options to be passed when creating a uart device instance. */
Zaitsev 10:41552d038a69 62 typedef struct uart_options {
Zaitsev 10:41552d038a69 63 uint32_t baudrate; /**< The expected baud rate. */
Zaitsev 10:41552d038a69 64 flow_control_t control;/**< Defines type of flow control, none or rtscts */
Zaitsev 10:41552d038a69 65 } uart_options_t, *uart_options_pt;
Zaitsev 10:41552d038a69 66
Zaitsev 10:41552d038a69 67 #endif /* UART_H_ */