Platform drivers for Mbed.
Dependents: EVAL-CN0535-FMCZ EVAL-CN0535-FMCZ EVAL-AD568x-AD569x EVAL-AD7606 ... more
uart_extra.h@17:af1f2416dd26, 2021-07-13 (annotated)
- Committer:
- mahphalke
- Date:
- Tue Jul 13 13:58:07 2021 +0530
- Revision:
- 17:af1f2416dd26
Restructured the directory- Removed inc/ and src/ folders and moved all source/header files at root
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mahphalke |
17:af1f2416dd26 | 1 | /***************************************************************************//** |
mahphalke |
17:af1f2416dd26 | 2 | * @file uart_extra.h |
mahphalke |
17:af1f2416dd26 | 3 | * @brief: Header containing extra types required for UART interface |
mahphalke |
17:af1f2416dd26 | 4 | ******************************************************************************** |
mahphalke |
17:af1f2416dd26 | 5 | * Copyright (c) 2021 Analog Devices, Inc. |
mahphalke |
17:af1f2416dd26 | 6 | * All rights reserved. |
mahphalke |
17:af1f2416dd26 | 7 | * |
mahphalke |
17:af1f2416dd26 | 8 | * This software is proprietary to Analog Devices, Inc. and its licensors. |
mahphalke |
17:af1f2416dd26 | 9 | * By using this software you agree to the terms of the associated |
mahphalke |
17:af1f2416dd26 | 10 | * Analog Devices Software License Agreement. |
mahphalke |
17:af1f2416dd26 | 11 | *******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 12 | |
mahphalke |
17:af1f2416dd26 | 13 | #ifndef UART_EXTRA_H |
mahphalke |
17:af1f2416dd26 | 14 | #define UART_EXTRA_H |
mahphalke |
17:af1f2416dd26 | 15 | |
mahphalke |
17:af1f2416dd26 | 16 | // Platform support needs to be C-compatible to work with other drivers |
mahphalke |
17:af1f2416dd26 | 17 | #ifdef __cplusplus |
mahphalke |
17:af1f2416dd26 | 18 | extern "C" |
mahphalke |
17:af1f2416dd26 | 19 | { |
mahphalke |
17:af1f2416dd26 | 20 | #endif |
mahphalke |
17:af1f2416dd26 | 21 | |
mahphalke |
17:af1f2416dd26 | 22 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 23 | /***************************** Include Files **********************************/ |
mahphalke |
17:af1f2416dd26 | 24 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 25 | #include <stdio.h> |
mahphalke |
17:af1f2416dd26 | 26 | #include <stdbool.h> |
mahphalke |
17:af1f2416dd26 | 27 | |
mahphalke |
17:af1f2416dd26 | 28 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 29 | /********************** Macros and Constants Definitions **********************/ |
mahphalke |
17:af1f2416dd26 | 30 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 31 | |
mahphalke |
17:af1f2416dd26 | 32 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 33 | /********************** Variables and User defined data types *****************/ |
mahphalke |
17:af1f2416dd26 | 34 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 35 | |
mahphalke |
17:af1f2416dd26 | 36 | /* |
mahphalke |
17:af1f2416dd26 | 37 | * Note: The structure members are not strongly typed, as this file is included |
mahphalke |
17:af1f2416dd26 | 38 | * in application specific '.c' files. The mbed code structure does not |
mahphalke |
17:af1f2416dd26 | 39 | * allow inclusion of mbed driver files (e.g. mbed.h) into '.c' files. |
mahphalke |
17:af1f2416dd26 | 40 | * All the members are hence typecasted to mbed specific type during |
mahphalke |
17:af1f2416dd26 | 41 | * uart init and read/write operations. |
mahphalke |
17:af1f2416dd26 | 42 | **/ |
mahphalke |
17:af1f2416dd26 | 43 | |
mahphalke |
17:af1f2416dd26 | 44 | /** |
mahphalke |
17:af1f2416dd26 | 45 | * @struct mbed_uart_init_param |
mahphalke |
17:af1f2416dd26 | 46 | * @brief Structure holding the UART init parameters for mbed platform. |
mahphalke |
17:af1f2416dd26 | 47 | */ |
mahphalke |
17:af1f2416dd26 | 48 | typedef struct { |
mahphalke |
17:af1f2416dd26 | 49 | bool virtual_com_enable; /* Flag that enables the selection between |
mahphalke |
17:af1f2416dd26 | 50 | * Virtual COM Port Or standard UART link */ |
mahphalke |
17:af1f2416dd26 | 51 | uint8_t uart_tx_pin; /* UART Transmit Pin (only for UART comm) */ |
mahphalke |
17:af1f2416dd26 | 52 | uint8_t uart_rx_pin; /* UART Receive Pin (only for UART comm) */ |
mahphalke |
17:af1f2416dd26 | 53 | uint16_t vendor_id; /* USB VCOM Vendor ID (only for USB Virtual comm) */ |
mahphalke |
17:af1f2416dd26 | 54 | uint16_t product_id; /* USB VCOM Product ID (only for USB Virtual comm) */ |
mahphalke |
17:af1f2416dd26 | 55 | char *serial_number; /* USB VCOM serial number (only for USB Virtual comm) */ |
mahphalke |
17:af1f2416dd26 | 56 | } mbed_uart_init_param; |
mahphalke |
17:af1f2416dd26 | 57 | |
mahphalke |
17:af1f2416dd26 | 58 | /** |
mahphalke |
17:af1f2416dd26 | 59 | * @struct mbed_uart_desc |
mahphalke |
17:af1f2416dd26 | 60 | * @brief UART specific descriptor for the mbed platform. |
mahphalke |
17:af1f2416dd26 | 61 | */ |
mahphalke |
17:af1f2416dd26 | 62 | typedef struct { |
mahphalke |
17:af1f2416dd26 | 63 | void *uart_port; /* UART port instance */ |
mahphalke |
17:af1f2416dd26 | 64 | bool virtual_com_enable; /* Flag that enables the selection between |
mahphalke |
17:af1f2416dd26 | 65 | * Virtual COM Port Or standard UART link */ |
mahphalke |
17:af1f2416dd26 | 66 | } mbed_uart_desc; |
mahphalke |
17:af1f2416dd26 | 67 | |
mahphalke |
17:af1f2416dd26 | 68 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 69 | /************************ Functions Declarations ******************************/ |
mahphalke |
17:af1f2416dd26 | 70 | /******************************************************************************/ |
mahphalke |
17:af1f2416dd26 | 71 | |
mahphalke |
17:af1f2416dd26 | 72 | |
mahphalke |
17:af1f2416dd26 | 73 | #ifdef __cplusplus // Closing extern c |
mahphalke |
17:af1f2416dd26 | 74 | } |
mahphalke |
17:af1f2416dd26 | 75 | #endif |
mahphalke |
17:af1f2416dd26 | 76 | |
mahphalke |
17:af1f2416dd26 | 77 | #endif /* UART_EXTRA_H */ |