Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
uart.h
00001 /** 00002 * @file uart.h 00003 * @brief 00004 * 00005 * DAPLink Interface Firmware 00006 * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved 00007 * SPDX-License-Identifier: Apache-2.0 00008 * 00009 * Licensed under the Apache License, Version 2.0 (the "License"); you may 00010 * not use this file except in compliance with the License. 00011 * You may obtain a copy of the License at 00012 * 00013 * http://www.apache.org/licenses/LICENSE-2.0 00014 * 00015 * Unless required by applicable law or agreed to in writing, software 00016 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 00017 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00018 * See the License for the specific language governing permissions and 00019 * limitations under the License. 00020 */ 00021 00022 #ifndef UART_H 00023 #define UART_H 00024 00025 #include <stdint.h> 00026 #include <stdbool.h> 00027 00028 #ifdef __cplusplus 00029 extern "C" { 00030 #endif 00031 00032 /* Parity enumerator */ 00033 typedef enum { 00034 UART_PARITY_NONE = 0, 00035 UART_PARITY_ODD = 1, 00036 UART_PARITY_EVEN = 2, 00037 UART_PARITY_MARK = 3, 00038 UART_PARITY_SPACE = 4 00039 } UART_Parity; 00040 00041 /* Stop Bits enumerator */ 00042 typedef enum { 00043 UART_STOP_BITS_1 = 0, 00044 UART_STOP_BITS_1_5 = 1, 00045 UART_STOP_BITS_2 = 2 00046 } UART_StopBits; 00047 00048 /* Data Bits enumerator */ 00049 typedef enum { 00050 UART_DATA_BITS_5 = 5, 00051 UART_DATA_BITS_6 = 6, 00052 UART_DATA_BITS_7 = 7, 00053 UART_DATA_BITS_8 = 8, 00054 UART_DATA_BITS_16 = 16 00055 } UART_DataBits; 00056 00057 /* Flow control enumerator */ 00058 typedef enum { 00059 UART_FLOW_CONTROL_NONE = 0, 00060 UART_FLOW_CONTROL_RTS_CTS = 1, 00061 UART_FLOW_CONTROL_XON_XOFF = 2 00062 } UART_FlowControl; 00063 00064 /* UART Port Properties structure */ 00065 typedef struct { 00066 uint32_t Baudrate; 00067 UART_DataBits DataBits; 00068 UART_Parity Parity; 00069 UART_StopBits StopBits; 00070 UART_FlowControl FlowControl; 00071 } UART_Configuration; 00072 00073 /*----------------------------------------------------------------------------- 00074 * FUNCTION PROTOTYPES 00075 *----------------------------------------------------------------------------*/ 00076 00077 /* UART driver function prototypes */ 00078 extern int32_t uart_initialize(void); 00079 extern int32_t uart_uninitialize(void); 00080 extern int32_t uart_reset(void); 00081 extern int32_t uart_set_configuration(UART_Configuration *config); 00082 extern int32_t uart_get_configuration(UART_Configuration *config); 00083 extern int32_t uart_write_free(void); 00084 extern int32_t uart_write_data(uint8_t *data, uint16_t size); 00085 extern int32_t uart_read_data(uint8_t *data, uint16_t size); 00086 extern void uart_set_control_line_state(uint16_t ctrl_bmp); 00087 extern void uart_software_flow_control(void); 00088 extern void uart_enable_flow_control(bool enabled); 00089 00090 #ifdef __cplusplus 00091 } 00092 #endif 00093 00094 #endif
Generated on Tue Jul 12 2022 15:37:26 by
