The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
mbed 2
This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.
hal/serial_api.h@128:9bcdf88f62b0, 2016-10-27 (annotated)
- Committer:
- <>
- Date:
- Thu Oct 27 16:45:56 2016 +0100
- Revision:
- 128:9bcdf88f62b0
- Child:
- 172:65be27845400
Release 128 of the mbed library
Ports for Upcoming Targets
Fixes and Changes
2966: Add kw24 support https://github.com/ARMmbed/mbed-os/pull/2966
3068: MultiTech mDot - clean up PeripheralPins.c and add new pin names https://github.com/ARMmbed/mbed-os/pull/3068
3089: Kinetis HAL: Remove clock initialization code from serial and ticker https://github.com/ARMmbed/mbed-os/pull/3089
2943: [NRF5] NVIC_SetVector functionality https://github.com/ARMmbed/mbed-os/pull/2943
2938: InterruptIn changes in NCS36510 HAL. https://github.com/ARMmbed/mbed-os/pull/2938
3108: Fix sleep function for NRF52. https://github.com/ARMmbed/mbed-os/pull/3108
3076: STM32F1: Correct timer master value reading https://github.com/ARMmbed/mbed-os/pull/3076
3085: Add LOWPOWERTIMER capability for NUCLEO_F303ZE https://github.com/ARMmbed/mbed-os/pull/3085
3046: [BEETLE] Update BLE stack on Beetle board https://github.com/ARMmbed/mbed-os/pull/3046
3122: [Silicon Labs] Update of Silicon Labs HAL https://github.com/ARMmbed/mbed-os/pull/3122
3022: OnSemi RAM usage fix https://github.com/ARMmbed/mbed-os/pull/3022
3121: STM32F3: Correct UART4 and UART5 defines when using DEVICE_SERIAL_ASYNCH https://github.com/ARMmbed/mbed-os/pull/3121
3142: Targets- NUMAKER_PFM_NUC47216 remove mbed 2 https://github.com/ARMmbed/mbed-os/pull/3142
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 128:9bcdf88f62b0 | 1 | |
<> | 128:9bcdf88f62b0 | 2 | /** \addtogroup hal */ |
<> | 128:9bcdf88f62b0 | 3 | /** @{*/ |
<> | 128:9bcdf88f62b0 | 4 | /* mbed Microcontroller Library |
<> | 128:9bcdf88f62b0 | 5 | * Copyright (c) 2006-2013 ARM Limited |
<> | 128:9bcdf88f62b0 | 6 | * |
<> | 128:9bcdf88f62b0 | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
<> | 128:9bcdf88f62b0 | 8 | * you may not use this file except in compliance with the License. |
<> | 128:9bcdf88f62b0 | 9 | * You may obtain a copy of the License at |
<> | 128:9bcdf88f62b0 | 10 | * |
<> | 128:9bcdf88f62b0 | 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
<> | 128:9bcdf88f62b0 | 12 | * |
<> | 128:9bcdf88f62b0 | 13 | * Unless required by applicable law or agreed to in writing, software |
<> | 128:9bcdf88f62b0 | 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
<> | 128:9bcdf88f62b0 | 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
<> | 128:9bcdf88f62b0 | 16 | * See the License for the specific language governing permissions and |
<> | 128:9bcdf88f62b0 | 17 | * limitations under the License. |
<> | 128:9bcdf88f62b0 | 18 | */ |
<> | 128:9bcdf88f62b0 | 19 | #ifndef MBED_SERIAL_API_H |
<> | 128:9bcdf88f62b0 | 20 | #define MBED_SERIAL_API_H |
<> | 128:9bcdf88f62b0 | 21 | |
<> | 128:9bcdf88f62b0 | 22 | #include "device.h" |
<> | 128:9bcdf88f62b0 | 23 | #include "hal/buffer.h" |
<> | 128:9bcdf88f62b0 | 24 | #include "hal/dma_api.h" |
<> | 128:9bcdf88f62b0 | 25 | |
<> | 128:9bcdf88f62b0 | 26 | #if DEVICE_SERIAL |
<> | 128:9bcdf88f62b0 | 27 | |
<> | 128:9bcdf88f62b0 | 28 | #define SERIAL_EVENT_TX_SHIFT (2) |
<> | 128:9bcdf88f62b0 | 29 | #define SERIAL_EVENT_RX_SHIFT (8) |
<> | 128:9bcdf88f62b0 | 30 | |
<> | 128:9bcdf88f62b0 | 31 | #define SERIAL_EVENT_TX_MASK (0x00FC) |
<> | 128:9bcdf88f62b0 | 32 | #define SERIAL_EVENT_RX_MASK (0x3F00) |
<> | 128:9bcdf88f62b0 | 33 | |
<> | 128:9bcdf88f62b0 | 34 | #define SERIAL_EVENT_ERROR (1 << 1) |
<> | 128:9bcdf88f62b0 | 35 | |
<> | 128:9bcdf88f62b0 | 36 | /** |
<> | 128:9bcdf88f62b0 | 37 | * @defgroup SerialTXEvents Serial TX Events Macros |
<> | 128:9bcdf88f62b0 | 38 | * |
<> | 128:9bcdf88f62b0 | 39 | * @{ |
<> | 128:9bcdf88f62b0 | 40 | */ |
<> | 128:9bcdf88f62b0 | 41 | #define SERIAL_EVENT_TX_COMPLETE (1 << (SERIAL_EVENT_TX_SHIFT + 0)) |
<> | 128:9bcdf88f62b0 | 42 | #define SERIAL_EVENT_TX_ALL (SERIAL_EVENT_TX_COMPLETE) |
<> | 128:9bcdf88f62b0 | 43 | /**@}*/ |
<> | 128:9bcdf88f62b0 | 44 | |
<> | 128:9bcdf88f62b0 | 45 | /** |
<> | 128:9bcdf88f62b0 | 46 | * @defgroup SerialRXEvents Serial RX Events Macros |
<> | 128:9bcdf88f62b0 | 47 | * |
<> | 128:9bcdf88f62b0 | 48 | * @{ |
<> | 128:9bcdf88f62b0 | 49 | */ |
<> | 128:9bcdf88f62b0 | 50 | #define SERIAL_EVENT_RX_COMPLETE (1 << (SERIAL_EVENT_RX_SHIFT + 0)) |
<> | 128:9bcdf88f62b0 | 51 | #define SERIAL_EVENT_RX_OVERRUN_ERROR (1 << (SERIAL_EVENT_RX_SHIFT + 1)) |
<> | 128:9bcdf88f62b0 | 52 | #define SERIAL_EVENT_RX_FRAMING_ERROR (1 << (SERIAL_EVENT_RX_SHIFT + 2)) |
<> | 128:9bcdf88f62b0 | 53 | #define SERIAL_EVENT_RX_PARITY_ERROR (1 << (SERIAL_EVENT_RX_SHIFT + 3)) |
<> | 128:9bcdf88f62b0 | 54 | #define SERIAL_EVENT_RX_OVERFLOW (1 << (SERIAL_EVENT_RX_SHIFT + 4)) |
<> | 128:9bcdf88f62b0 | 55 | #define SERIAL_EVENT_RX_CHARACTER_MATCH (1 << (SERIAL_EVENT_RX_SHIFT + 5)) |
<> | 128:9bcdf88f62b0 | 56 | #define SERIAL_EVENT_RX_ALL (SERIAL_EVENT_RX_OVERFLOW | SERIAL_EVENT_RX_PARITY_ERROR | \ |
<> | 128:9bcdf88f62b0 | 57 | SERIAL_EVENT_RX_FRAMING_ERROR | SERIAL_EVENT_RX_OVERRUN_ERROR | \ |
<> | 128:9bcdf88f62b0 | 58 | SERIAL_EVENT_RX_COMPLETE | SERIAL_EVENT_RX_CHARACTER_MATCH) |
<> | 128:9bcdf88f62b0 | 59 | /**@}*/ |
<> | 128:9bcdf88f62b0 | 60 | |
<> | 128:9bcdf88f62b0 | 61 | #define SERIAL_RESERVED_CHAR_MATCH (255) |
<> | 128:9bcdf88f62b0 | 62 | |
<> | 128:9bcdf88f62b0 | 63 | typedef enum { |
<> | 128:9bcdf88f62b0 | 64 | ParityNone = 0, |
<> | 128:9bcdf88f62b0 | 65 | ParityOdd = 1, |
<> | 128:9bcdf88f62b0 | 66 | ParityEven = 2, |
<> | 128:9bcdf88f62b0 | 67 | ParityForced1 = 3, |
<> | 128:9bcdf88f62b0 | 68 | ParityForced0 = 4 |
<> | 128:9bcdf88f62b0 | 69 | } SerialParity; |
<> | 128:9bcdf88f62b0 | 70 | |
<> | 128:9bcdf88f62b0 | 71 | typedef enum { |
<> | 128:9bcdf88f62b0 | 72 | RxIrq, |
<> | 128:9bcdf88f62b0 | 73 | TxIrq |
<> | 128:9bcdf88f62b0 | 74 | } SerialIrq; |
<> | 128:9bcdf88f62b0 | 75 | |
<> | 128:9bcdf88f62b0 | 76 | typedef enum { |
<> | 128:9bcdf88f62b0 | 77 | FlowControlNone, |
<> | 128:9bcdf88f62b0 | 78 | FlowControlRTS, |
<> | 128:9bcdf88f62b0 | 79 | FlowControlCTS, |
<> | 128:9bcdf88f62b0 | 80 | FlowControlRTSCTS |
<> | 128:9bcdf88f62b0 | 81 | } FlowControl; |
<> | 128:9bcdf88f62b0 | 82 | |
<> | 128:9bcdf88f62b0 | 83 | typedef void (*uart_irq_handler)(uint32_t id, SerialIrq event); |
<> | 128:9bcdf88f62b0 | 84 | |
<> | 128:9bcdf88f62b0 | 85 | #if DEVICE_SERIAL_ASYNCH |
<> | 128:9bcdf88f62b0 | 86 | /** Asynch serial HAL structure |
<> | 128:9bcdf88f62b0 | 87 | */ |
<> | 128:9bcdf88f62b0 | 88 | typedef struct { |
<> | 128:9bcdf88f62b0 | 89 | struct serial_s serial; /**< Target specific serial structure */ |
<> | 128:9bcdf88f62b0 | 90 | struct buffer_s tx_buff; /**< TX buffer */ |
<> | 128:9bcdf88f62b0 | 91 | struct buffer_s rx_buff; /**< RX buffer */ |
<> | 128:9bcdf88f62b0 | 92 | uint8_t char_match; /**< Character to be matched */ |
<> | 128:9bcdf88f62b0 | 93 | uint8_t char_found; /**< State of the matched character */ |
<> | 128:9bcdf88f62b0 | 94 | } serial_t; |
<> | 128:9bcdf88f62b0 | 95 | |
<> | 128:9bcdf88f62b0 | 96 | #else |
<> | 128:9bcdf88f62b0 | 97 | /** Non-asynch serial HAL structure |
<> | 128:9bcdf88f62b0 | 98 | */ |
<> | 128:9bcdf88f62b0 | 99 | typedef struct serial_s serial_t; |
<> | 128:9bcdf88f62b0 | 100 | |
<> | 128:9bcdf88f62b0 | 101 | #endif |
<> | 128:9bcdf88f62b0 | 102 | |
<> | 128:9bcdf88f62b0 | 103 | #ifdef __cplusplus |
<> | 128:9bcdf88f62b0 | 104 | extern "C" { |
<> | 128:9bcdf88f62b0 | 105 | #endif |
<> | 128:9bcdf88f62b0 | 106 | |
<> | 128:9bcdf88f62b0 | 107 | /** |
<> | 128:9bcdf88f62b0 | 108 | * \defgroup hal_GeneralSerial Serial Configuration Functions |
<> | 128:9bcdf88f62b0 | 109 | * @{ |
<> | 128:9bcdf88f62b0 | 110 | */ |
<> | 128:9bcdf88f62b0 | 111 | |
<> | 128:9bcdf88f62b0 | 112 | /** Initialize the serial peripheral. It sets the default parameters for serial |
<> | 128:9bcdf88f62b0 | 113 | * peripheral, and configures its specifieds pins. |
<> | 128:9bcdf88f62b0 | 114 | * |
<> | 128:9bcdf88f62b0 | 115 | * @param obj The serial object |
<> | 128:9bcdf88f62b0 | 116 | * @param tx The TX pin name |
<> | 128:9bcdf88f62b0 | 117 | * @param rx The RX pin name |
<> | 128:9bcdf88f62b0 | 118 | */ |
<> | 128:9bcdf88f62b0 | 119 | void serial_init(serial_t *obj, PinName tx, PinName rx); |
<> | 128:9bcdf88f62b0 | 120 | |
<> | 128:9bcdf88f62b0 | 121 | /** Release the serial peripheral, not currently invoked. It requires further |
<> | 128:9bcdf88f62b0 | 122 | * resource management. |
<> | 128:9bcdf88f62b0 | 123 | * |
<> | 128:9bcdf88f62b0 | 124 | * @param obj The serial object |
<> | 128:9bcdf88f62b0 | 125 | */ |
<> | 128:9bcdf88f62b0 | 126 | void serial_free(serial_t *obj); |
<> | 128:9bcdf88f62b0 | 127 | |
<> | 128:9bcdf88f62b0 | 128 | /** Configure the baud rate |
<> | 128:9bcdf88f62b0 | 129 | * |
<> | 128:9bcdf88f62b0 | 130 | * @param obj The serial object |
<> | 128:9bcdf88f62b0 | 131 | * @param baudrate The baud rate to be configured |
<> | 128:9bcdf88f62b0 | 132 | */ |
<> | 128:9bcdf88f62b0 | 133 | void serial_baud(serial_t *obj, int baudrate); |
<> | 128:9bcdf88f62b0 | 134 | |
<> | 128:9bcdf88f62b0 | 135 | /** Configure the format. Set the number of bits, parity and the number of stop bits |
<> | 128:9bcdf88f62b0 | 136 | * |
<> | 128:9bcdf88f62b0 | 137 | * @param obj The serial object |
<> | 128:9bcdf88f62b0 | 138 | * @param data_bits The number of data bits |
<> | 128:9bcdf88f62b0 | 139 | * @param parity The parity |
<> | 128:9bcdf88f62b0 | 140 | * @param stop_bits The number of stop bits |
<> | 128:9bcdf88f62b0 | 141 | */ |
<> | 128:9bcdf88f62b0 | 142 | void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_bits); |
<> | 128:9bcdf88f62b0 | 143 | |
<> | 128:9bcdf88f62b0 | 144 | /** The serial interrupt handler registration |
<> | 128:9bcdf88f62b0 | 145 | * |
<> | 128:9bcdf88f62b0 | 146 | * @param obj The serial object |
<> | 128:9bcdf88f62b0 | 147 | * @param handler The interrupt handler which will be invoked when the interrupt fires |
<> | 128:9bcdf88f62b0 | 148 | * @param id The SerialBase object |
<> | 128:9bcdf88f62b0 | 149 | */ |
<> | 128:9bcdf88f62b0 | 150 | void serial_irq_handler(serial_t *obj, uart_irq_handler handler, uint32_t id); |
<> | 128:9bcdf88f62b0 | 151 | |
<> | 128:9bcdf88f62b0 | 152 | /** Configure serial interrupt. This function is used for word-approach |
<> | 128:9bcdf88f62b0 | 153 | * |
<> | 128:9bcdf88f62b0 | 154 | * @param obj The serial object |
<> | 128:9bcdf88f62b0 | 155 | * @param irq The serial IRQ type (RX or TX) |
<> | 128:9bcdf88f62b0 | 156 | * @param enable Set to non-zero to enable events, or zero to disable them |
<> | 128:9bcdf88f62b0 | 157 | */ |
<> | 128:9bcdf88f62b0 | 158 | void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable); |
<> | 128:9bcdf88f62b0 | 159 | |
<> | 128:9bcdf88f62b0 | 160 | /** Get character. This is a blocking call, waiting for a character |
<> | 128:9bcdf88f62b0 | 161 | * |
<> | 128:9bcdf88f62b0 | 162 | * @param obj The serial object |
<> | 128:9bcdf88f62b0 | 163 | */ |
<> | 128:9bcdf88f62b0 | 164 | int serial_getc(serial_t *obj); |
<> | 128:9bcdf88f62b0 | 165 | |
<> | 128:9bcdf88f62b0 | 166 | /** Send a character. This is a blocking call, waiting for a peripheral to be available |
<> | 128:9bcdf88f62b0 | 167 | * for writing |
<> | 128:9bcdf88f62b0 | 168 | * |
<> | 128:9bcdf88f62b0 | 169 | * @param obj The serial object |
<> | 128:9bcdf88f62b0 | 170 | * @param c The character to be sent |
<> | 128:9bcdf88f62b0 | 171 | */ |
<> | 128:9bcdf88f62b0 | 172 | void serial_putc(serial_t *obj, int c); |
<> | 128:9bcdf88f62b0 | 173 | |
<> | 128:9bcdf88f62b0 | 174 | /** Check if the serial peripheral is readable |
<> | 128:9bcdf88f62b0 | 175 | * |
<> | 128:9bcdf88f62b0 | 176 | * @param obj The serial object |
<> | 128:9bcdf88f62b0 | 177 | * @return Non-zero value if a character can be read, 0 if nothing to read |
<> | 128:9bcdf88f62b0 | 178 | */ |
<> | 128:9bcdf88f62b0 | 179 | int serial_readable(serial_t *obj); |
<> | 128:9bcdf88f62b0 | 180 | |
<> | 128:9bcdf88f62b0 | 181 | /** Check if the serial peripheral is writable |
<> | 128:9bcdf88f62b0 | 182 | * |
<> | 128:9bcdf88f62b0 | 183 | * @param obj The serial object |
<> | 128:9bcdf88f62b0 | 184 | * @return Non-zero value if a character can be written, 0 otherwise. |
<> | 128:9bcdf88f62b0 | 185 | */ |
<> | 128:9bcdf88f62b0 | 186 | int serial_writable(serial_t *obj); |
<> | 128:9bcdf88f62b0 | 187 | |
<> | 128:9bcdf88f62b0 | 188 | /** Clear the serial peripheral |
<> | 128:9bcdf88f62b0 | 189 | * |
<> | 128:9bcdf88f62b0 | 190 | * @param obj The serial object |
<> | 128:9bcdf88f62b0 | 191 | */ |
<> | 128:9bcdf88f62b0 | 192 | void serial_clear(serial_t *obj); |
<> | 128:9bcdf88f62b0 | 193 | |
<> | 128:9bcdf88f62b0 | 194 | /** Set the break |
<> | 128:9bcdf88f62b0 | 195 | * |
<> | 128:9bcdf88f62b0 | 196 | * @param obj The serial object |
<> | 128:9bcdf88f62b0 | 197 | */ |
<> | 128:9bcdf88f62b0 | 198 | void serial_break_set(serial_t *obj); |
<> | 128:9bcdf88f62b0 | 199 | |
<> | 128:9bcdf88f62b0 | 200 | /** Clear the break |
<> | 128:9bcdf88f62b0 | 201 | * |
<> | 128:9bcdf88f62b0 | 202 | * @param obj The serial object |
<> | 128:9bcdf88f62b0 | 203 | */ |
<> | 128:9bcdf88f62b0 | 204 | void serial_break_clear(serial_t *obj); |
<> | 128:9bcdf88f62b0 | 205 | |
<> | 128:9bcdf88f62b0 | 206 | /** Configure the TX pin for UART function. |
<> | 128:9bcdf88f62b0 | 207 | * |
<> | 128:9bcdf88f62b0 | 208 | * @param tx The pin name used for TX |
<> | 128:9bcdf88f62b0 | 209 | */ |
<> | 128:9bcdf88f62b0 | 210 | void serial_pinout_tx(PinName tx); |
<> | 128:9bcdf88f62b0 | 211 | |
<> | 128:9bcdf88f62b0 | 212 | /** Configure the serial for the flow control. It sets flow control in the hardware |
<> | 128:9bcdf88f62b0 | 213 | * if a serial peripheral supports it, otherwise software emulation is used. |
<> | 128:9bcdf88f62b0 | 214 | * |
<> | 128:9bcdf88f62b0 | 215 | * @param obj The serial object |
<> | 128:9bcdf88f62b0 | 216 | * @param type The type of the flow control. Look at the available FlowControl types. |
<> | 128:9bcdf88f62b0 | 217 | * @param rxflow The TX pin name |
<> | 128:9bcdf88f62b0 | 218 | * @param txflow The RX pin name |
<> | 128:9bcdf88f62b0 | 219 | */ |
<> | 128:9bcdf88f62b0 | 220 | void serial_set_flow_control(serial_t *obj, FlowControl type, PinName rxflow, PinName txflow); |
<> | 128:9bcdf88f62b0 | 221 | |
<> | 128:9bcdf88f62b0 | 222 | #if DEVICE_SERIAL_ASYNCH |
<> | 128:9bcdf88f62b0 | 223 | |
<> | 128:9bcdf88f62b0 | 224 | /**@}*/ |
<> | 128:9bcdf88f62b0 | 225 | |
<> | 128:9bcdf88f62b0 | 226 | /** |
<> | 128:9bcdf88f62b0 | 227 | * \defgroup hal_AsynchSerial Asynchronous Serial Hardware Abstraction Layer |
<> | 128:9bcdf88f62b0 | 228 | * @{ |
<> | 128:9bcdf88f62b0 | 229 | */ |
<> | 128:9bcdf88f62b0 | 230 | |
<> | 128:9bcdf88f62b0 | 231 | /** Begin asynchronous TX transfer. The used buffer is specified in the serial object, |
<> | 128:9bcdf88f62b0 | 232 | * tx_buff |
<> | 128:9bcdf88f62b0 | 233 | * |
<> | 128:9bcdf88f62b0 | 234 | * @param obj The serial object |
<> | 128:9bcdf88f62b0 | 235 | * @param tx The transmit buffer |
<> | 128:9bcdf88f62b0 | 236 | * @param tx_length The number of bytes to transmit |
<> | 128:9bcdf88f62b0 | 237 | * @param tx_width Deprecated argument |
<> | 128:9bcdf88f62b0 | 238 | * @param handler The serial handler |
<> | 128:9bcdf88f62b0 | 239 | * @param event The logical OR of events to be registered |
<> | 128:9bcdf88f62b0 | 240 | * @param hint A suggestion for how to use DMA with this transfer |
<> | 128:9bcdf88f62b0 | 241 | * @return Returns number of data transfered, otherwise returns 0 |
<> | 128:9bcdf88f62b0 | 242 | */ |
<> | 128:9bcdf88f62b0 | 243 | int serial_tx_asynch(serial_t *obj, const void *tx, size_t tx_length, uint8_t tx_width, uint32_t handler, uint32_t event, DMAUsage hint); |
<> | 128:9bcdf88f62b0 | 244 | |
<> | 128:9bcdf88f62b0 | 245 | /** Begin asynchronous RX transfer (enable interrupt for data collecting) |
<> | 128:9bcdf88f62b0 | 246 | * The used buffer is specified in the serial object - rx_buff |
<> | 128:9bcdf88f62b0 | 247 | * |
<> | 128:9bcdf88f62b0 | 248 | * @param obj The serial object |
<> | 128:9bcdf88f62b0 | 249 | * @param rx The receive buffer |
<> | 128:9bcdf88f62b0 | 250 | * @param rx_length The number of bytes to receive |
<> | 128:9bcdf88f62b0 | 251 | * @param rx_width Deprecated argument |
<> | 128:9bcdf88f62b0 | 252 | * @param handler The serial handler |
<> | 128:9bcdf88f62b0 | 253 | * @param event The logical OR of events to be registered |
<> | 128:9bcdf88f62b0 | 254 | * @param handler The serial handler |
<> | 128:9bcdf88f62b0 | 255 | * @param char_match A character in range 0-254 to be matched |
<> | 128:9bcdf88f62b0 | 256 | * @param hint A suggestion for how to use DMA with this transfer |
<> | 128:9bcdf88f62b0 | 257 | */ |
<> | 128:9bcdf88f62b0 | 258 | void serial_rx_asynch(serial_t *obj, void *rx, size_t rx_length, uint8_t rx_width, uint32_t handler, uint32_t event, uint8_t char_match, DMAUsage hint); |
<> | 128:9bcdf88f62b0 | 259 | |
<> | 128:9bcdf88f62b0 | 260 | /** Attempts to determine if the serial peripheral is already in use for TX |
<> | 128:9bcdf88f62b0 | 261 | * |
<> | 128:9bcdf88f62b0 | 262 | * @param obj The serial object |
<> | 128:9bcdf88f62b0 | 263 | * @return Non-zero if the RX transaction is ongoing, 0 otherwise |
<> | 128:9bcdf88f62b0 | 264 | */ |
<> | 128:9bcdf88f62b0 | 265 | uint8_t serial_tx_active(serial_t *obj); |
<> | 128:9bcdf88f62b0 | 266 | |
<> | 128:9bcdf88f62b0 | 267 | /** Attempts to determine if the serial peripheral is already in use for RX |
<> | 128:9bcdf88f62b0 | 268 | * |
<> | 128:9bcdf88f62b0 | 269 | * @param obj The serial object |
<> | 128:9bcdf88f62b0 | 270 | * @return Non-zero if the RX transaction is ongoing, 0 otherwise |
<> | 128:9bcdf88f62b0 | 271 | */ |
<> | 128:9bcdf88f62b0 | 272 | uint8_t serial_rx_active(serial_t *obj); |
<> | 128:9bcdf88f62b0 | 273 | |
<> | 128:9bcdf88f62b0 | 274 | /** The asynchronous TX and RX handler. |
<> | 128:9bcdf88f62b0 | 275 | * |
<> | 128:9bcdf88f62b0 | 276 | * @param obj The serial object |
<> | 128:9bcdf88f62b0 | 277 | * @return Returns event flags if an RX transfer termination condition was met; otherwise returns 0 |
<> | 128:9bcdf88f62b0 | 278 | */ |
<> | 128:9bcdf88f62b0 | 279 | int serial_irq_handler_asynch(serial_t *obj); |
<> | 128:9bcdf88f62b0 | 280 | |
<> | 128:9bcdf88f62b0 | 281 | /** Abort the ongoing TX transaction. It disables the enabled interupt for TX and |
<> | 128:9bcdf88f62b0 | 282 | * flushes the TX hardware buffer if TX FIFO is used |
<> | 128:9bcdf88f62b0 | 283 | * |
<> | 128:9bcdf88f62b0 | 284 | * @param obj The serial object |
<> | 128:9bcdf88f62b0 | 285 | */ |
<> | 128:9bcdf88f62b0 | 286 | void serial_tx_abort_asynch(serial_t *obj); |
<> | 128:9bcdf88f62b0 | 287 | |
<> | 128:9bcdf88f62b0 | 288 | /** Abort the ongoing RX transaction. It disables the enabled interrupt for RX and |
<> | 128:9bcdf88f62b0 | 289 | * flushes the RX hardware buffer if RX FIFO is used |
<> | 128:9bcdf88f62b0 | 290 | * |
<> | 128:9bcdf88f62b0 | 291 | * @param obj The serial object |
<> | 128:9bcdf88f62b0 | 292 | */ |
<> | 128:9bcdf88f62b0 | 293 | void serial_rx_abort_asynch(serial_t *obj); |
<> | 128:9bcdf88f62b0 | 294 | |
<> | 128:9bcdf88f62b0 | 295 | /**@}*/ |
<> | 128:9bcdf88f62b0 | 296 | |
<> | 128:9bcdf88f62b0 | 297 | #endif |
<> | 128:9bcdf88f62b0 | 298 | |
<> | 128:9bcdf88f62b0 | 299 | #ifdef __cplusplus |
<> | 128:9bcdf88f62b0 | 300 | } |
<> | 128:9bcdf88f62b0 | 301 | #endif |
<> | 128:9bcdf88f62b0 | 302 | |
<> | 128:9bcdf88f62b0 | 303 | #endif |
<> | 128:9bcdf88f62b0 | 304 | |
<> | 128:9bcdf88f62b0 | 305 | #endif |
<> | 128:9bcdf88f62b0 | 306 | |
<> | 128:9bcdf88f62b0 | 307 | /** @}*/ |