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.
serial_api9bit.h@11:2679ddcf8c96, 2019-09-06 (annotated)
- Committer:
- mark.chen@ebn.com.tw
- Date:
- Fri Sep 06 13:36:45 2019 +0800
- Revision:
- 11:2679ddcf8c96
- Parent:
- 9:bd6af3d4c651
- Child:
- 12:f0c99768aba2
Update code 20190906
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mark.chen@ebn.com.tw | 2:bcc987331b8a | 1 | /* mbed Microcontroller Library |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 2 | * Copyright (c) 2015-2016 Nuvoton |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 3 | * |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 5 | * you may not use this file except in compliance with the License. |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 6 | * You may obtain a copy of the License at |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 7 | * |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 9 | * |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 10 | * Unless required by applicable law or agreed to in writing, software |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 13 | * See the License for the specific language governing permissions and |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 14 | * limitations under the License. |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 15 | */ |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 16 | |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 17 | |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 18 | #include "serial_api.h" |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 19 | |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 20 | |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 21 | #include "cmsis.h" |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 22 | #include "mbed_error.h" |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 23 | #include "mbed_assert.h" |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 24 | #include "PeripheralPins.h" |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 25 | #include "nu_modutil.h" |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 26 | #include "nu_bitutil.h" |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 27 | #include <string.h> |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 28 | #include <stdbool.h> |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 29 | |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 30 | #if DEVICE_SERIAL_ASYNCH |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 31 | #include "dma_api.h" |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 32 | #include "dma.h" |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 33 | |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 34 | #define UART_PARITY_BY_UART_DATTBIT9 (0x11ul << UART_LINE_PBE_Pos) /*!< UART_LINE setting to keep parity bit as '0' \hideinitializer */ |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 35 | |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 36 | |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 37 | #ifdef __cplusplus |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 38 | extern "C" { |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 39 | #endif |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 40 | |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 41 | void serial_format_9bit(serial_t *obj, int data_bits, SerialParity parity, int stop_bits); |
mark.chen@ebn.com.tw | 6:64f5dad70ee2 | 42 | int serial_tx_asynch9bit(serial_t *obj, const void *tx, size_t tx_length, uint8_t tx_width, uint32_t handler, uint32_t event, DMAUsage hint); |
mark.chen@ebn.com.tw | 6:64f5dad70ee2 | 43 | void serial_rx_asynch9bit(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); |
mark.chen@ebn.com.tw | 7:af4ceb878eee | 44 | int serial_irq_handler_asynch9bit(serial_t *obj); |
mark.chen@ebn.com.tw | 8:716d4274f7b7 | 45 | uint16_t serial_getc_9bit(serial_t *obj); |
mark.chen@ebn.com.tw | 11:2679ddcf8c96 | 46 | int serial_readable_9bit(serial_t *obj); |
mark.chen@ebn.com.tw | 9:bd6af3d4c651 | 47 | void serial_putc_9bit(serial_t *obj, uint16_t c); |
mark.chen@ebn.com.tw | 7:af4ceb878eee | 48 | extern char uart9debug[100]; |
mark.chen@ebn.com.tw | 7:af4ceb878eee | 49 | extern bool uartdebug; |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 50 | |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 51 | |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 52 | |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 53 | |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 54 | #ifdef __cplusplus |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 55 | } |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 56 | #endif |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 57 | |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 58 | |
mark.chen@ebn.com.tw | 2:bcc987331b8a | 59 | #endif |