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