[riot-notifications] [RIOT-OS/RIOT] cpu/nrf52840: fix UART DMA when data is in ROM (#11170)

Juan I Carrano notifications at github.com
Wed Mar 13 14:30:09 CET 2019


jcarrano approved this pull request.

Solves the bug.

> @@ -229,6 +235,30 @@ void uart_write(uart_t uart, const uint8_t *data, size_t len)
     while (dev(uart)->EVENTS_ENDTX == 0) {}
 }
 
+void uart_write(uart_t uart, const uint8_t *data, size_t len)
+{
+    assert(uart < UART_NUMOF);
+
+    /* EasyDMA can only transfer data from RAM (see ref. manual, sec. 6.34.1).
+     * So if the given `data` buffer resides in ROM, we need to copy it to RAM
+     * before being able to transfer it. To make sure the stack does not
+     * overflow, we do this chunk-wise. */
+    if (!((uint32_t)data & RAM_MASK)) {

```suggestion
    if (!((intptr_t)data & RAM_MASK)) {
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11170#pullrequestreview-213946955
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190313/a5e47195/attachment.html>


More information about the notifications mailing list