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