This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 44bcab6  hw/mcu/nordic: Fix invalid cast for data length
     new ae77e25  Merge pull request #1690 from andrzej-kaczmarek/halspifix
44bcab6 is described below

commit 44bcab68ffb5fa354cc8ff8e21e77cb2fa230a89
Author: Andrzej Kaczmarek <andrzej.kaczma...@codecoup.pl>
AuthorDate: Fri Mar 15 09:33:03 2019 +0100

    hw/mcu/nordic: Fix invalid cast for data length
    
    Cast when writing data length to register is redundant on nRF52832 but
    also can cause truncation on nRF52840 since that register is 16-bit
    long.
---
 hw/mcu/nordic/nrf52xxx/src/hal_spi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/mcu/nordic/nrf52xxx/src/hal_spi.c 
b/hw/mcu/nordic/nrf52xxx/src/hal_spi.c
index f43014f..17d985f 100644
--- a/hw/mcu/nordic/nrf52xxx/src/hal_spi.c
+++ b/hw/mcu/nordic/nrf52xxx/src/hal_spi.c
@@ -156,13 +156,13 @@ nrf52_irqm_handler(struct nrf52_hal_spi *spi)
             len = spi->nhs_buflen - spi->nhs_bytes_txd;
             len = min(SPIM_TXD_MAXCNT_MAX, len);
             spim->TXD.PTR = (uint32_t)spi->nhs_txbuf;
-            spim->TXD.MAXCNT = (uint8_t)len;
+            spim->TXD.MAXCNT = len;
 
             /* If no rxbuf, we need to set rxbuf and maxcnt to 1 */
             if (spi->nhs_rxbuf) {
                 spi->nhs_rxbuf += xfr_bytes;
                 spim->RXD.PTR    = (uint32_t)spi->nhs_rxbuf;
-                spim->RXD.MAXCNT = (uint8_t)len;
+                spim->RXD.MAXCNT = len;
             }
             spim->TASKS_START = 1;
         } else {

Reply via email to