diff options
author | Christopher Collins <ccollins@apache.org> | 2016-08-23 17:35:28 -0700 |
---|---|---|
committer | Christopher Collins <ccollins@apache.org> | 2016-08-23 17:35:28 -0700 |
commit | 70987f7d2e3c791132509f08566fe77de34142ac (patch) | |
tree | 269ca9b857f65c22b8f2b93560466984f96091e5 /hw/mcu/nordic/nrf52xxx/src/hal_uart.c | |
parent | 0d9c8f30efbe2dba00b21d9185e9db8e36cd579e (diff) | |
parent | 665e22f5722d6348c1b260192e27f69d855b58fd (diff) |
Merge branch 'develop' - in preparation for
backwards-compatibility-breaking changes to develop.
* develop: (290 commits)
sim compiler - replace objsize with size
Fix warnings reported by clang.
MYNEWT-329
MYNEWT-354
STM32f407 discovery board BSP
mbedtls; use smaller version of SHA256.
boot; boot loader does not need to call os_init() anymore, as bsp_init() has been exported.
boot; app does not need the dependency to mbedtls
slinky; time-based waits must use OS_TICKS_PER_SEC.
bootutil; adjust unit tests to work with status upkeep outside sys/config.
bootutil; was returning wrong image header in response when swithing images. Add boot_set_req() routine for unit test use.
boot/bootutil; remove debug console use from bootloader.
bootutil/imgmgr; output of boot now shows the fallback image.
imgmgr; automatically confirm image as good for now.
bootutil; add 'confirm' step, telling that image was confirmed as good. Otherwise next restart we'll go back to old image.
bootutil; make status element size depend on flash alignment restrictions.
boot, imgmgr; return the slot number for test image.
bootutil; move routines reading boot-copy-status from loader.c to bootutil_misc.c.
boot; return full flash location of status bytes, instead of just offset.
boot; don't use NFFS or FCB for keeping status. Interim commit.
...
Diffstat (limited to 'hw/mcu/nordic/nrf52xxx/src/hal_uart.c')
-rw-r--r-- | hw/mcu/nordic/nrf52xxx/src/hal_uart.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/hw/mcu/nordic/nrf52xxx/src/hal_uart.c b/hw/mcu/nordic/nrf52xxx/src/hal_uart.c index 49861003..eb9cc32b 100644 --- a/hw/mcu/nordic/nrf52xxx/src/hal_uart.c +++ b/hw/mcu/nordic/nrf52xxx/src/hal_uart.c @@ -6,7 +6,7 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, @@ -31,6 +31,7 @@ #define UARTE_CONFIG_PARITY UARTE_CONFIG_PARITY_Msk #define UARTE_CONFIG_HWFC UARTE_CONFIG_HWFC_Msk #define UARTE_ENABLE UARTE_ENABLE_ENABLE_Enabled +#define UARTE_DISABLE UARTE_ENABLE_ENABLE_Disabled /* * Only one UART on NRF 52832. @@ -91,6 +92,9 @@ hal_uart_start_tx(int port) int sr; int rc; + if (port != 0) { + return; + } u = &uart; __HAL_DISABLE_INTERRUPTS(sr); if (u->u_tx_started == 0) { @@ -113,6 +117,9 @@ hal_uart_start_rx(int port) int sr; int rc; + if (port != 0) { + return; + } u = &uart; if (u->u_rx_stall) { __HAL_DISABLE_INTERRUPTS(sr); @@ -131,6 +138,10 @@ hal_uart_blocking_tx(int port, uint8_t data) { struct hal_uart *u; + if (port != 0) { + return; + } + u = &uart; if (!u->u_open) { return; @@ -202,6 +213,8 @@ hal_uart_baudrate(int baudrate) return UARTE_BAUDRATE_BAUDRATE_Baud38400; case 57600: return UARTE_BAUDRATE_BAUDRATE_Baud57600; + case 76800: + return UARTE_BAUDRATE_BAUDRATE_Baud76800; case 115200: return UARTE_BAUDRATE_BAUDRATE_Baud115200; case 230400: @@ -303,7 +316,25 @@ hal_uart_config(int port, int32_t baudrate, uint8_t databits, uint8_t stopbits, NRF_UARTE0->RXD.MAXCNT = sizeof(u->u_rx_buf); NRF_UARTE0->TASKS_STARTRX = 1; + u->u_rx_stall = 0; + u->u_tx_started = 0; u->u_open = 1; return 0; } + +int +hal_uart_close(int port) +{ + struct hal_uart *u; + + u = &uart; + + if (port == 0) { + u->u_open = 0; + NRF_UARTE0->ENABLE = 0; + NRF_UARTE0->INTENCLR = 0xffffffff; + return 0; + } + return -1; +} |