aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--os/common/ports/ARMCAx-TZ/chtssi.c3
-rw-r--r--os/common/ports/ARMCAx-TZ/chtssi.h11
-rw-r--r--os/hal/ports/SAMA/LLD/DMAv1/sama_xdmac.c7
3 files changed, 17 insertions, 4 deletions
diff --git a/os/common/ports/ARMCAx-TZ/chtssi.c b/os/common/ports/ARMCAx-TZ/chtssi.c
index 580a4ebd5..a9332f226 100644
--- a/os/common/ports/ARMCAx-TZ/chtssi.c
+++ b/os/common/ports/ARMCAx-TZ/chtssi.c
@@ -24,6 +24,7 @@
#include "ch.h"
#include "hal.h"
+#include "tsconf.h"
#include "chtssi.h"
#include <string.h>
@@ -345,7 +346,7 @@ CC_NO_RETURN void tssiInit(void)
/* Jump in the NON SECURE world.
* This thread becomes the non secure environment as view by
* the secure world.*/
- _ns_trampoline(NSEC_MEMORY_START_ADDR);
+ _ns_trampoline(NSEC_MEMORY_START_ADDR + NSEC_MEMORY_EXE_OFFSET);
/* It never goes here.*/
}
diff --git a/os/common/ports/ARMCAx-TZ/chtssi.h b/os/common/ports/ARMCAx-TZ/chtssi.h
index d0be2460a..ae9cec7af 100644
--- a/os/common/ports/ARMCAx-TZ/chtssi.h
+++ b/os/common/ports/ARMCAx-TZ/chtssi.h
@@ -82,10 +82,21 @@
/**
* @brief Secure and non secure memory address spaces.
*/
+#if !defined(NSEC_MEMORY_START_ADDR)
#define NSEC_MEMORY_START_ADDR ((uint8_t *)0x20000000)
+#endif
+#if !defined(NSEC_MEMORY_EXE_OFFSET)
+#define NSEC_MEMORY_EXE_OFFSET ((uint32_t) 0x00000000)
+#endif
+#if !defined(NSEC_MEMORY_END_ADDR)
#define NSEC_MEMORY_END_ADDR ((uint8_t *)0x27000000)
+#endif
+#if !defined(SEC_MEMORY_START_ADDR)
#define SEC_MEMORY_START_ADDR ((uint8_t *)0x27000000)
+#endif
+#if !defined(SEC_MEMORY_SIZE)
#define SEC_MEMORY_SIZE ((size_t)0x1000000)
+#endif
/** @} */
diff --git a/os/hal/ports/SAMA/LLD/DMAv1/sama_xdmac.c b/os/hal/ports/SAMA/LLD/DMAv1/sama_xdmac.c
index af90acbb1..4867b91e9 100644
--- a/os/hal/ports/SAMA/LLD/DMAv1/sama_xdmac.c
+++ b/os/hal/ports/SAMA/LLD/DMAv1/sama_xdmac.c
@@ -177,6 +177,7 @@ void dmaInit(void) {
* @param[in] size value to be written in the XDMAC_CUBC register
*
* @special
+ *
*/
void dmaChannelSetTransactionSize(sama_dma_channel_t *dmachp, size_t n) {
@@ -191,16 +192,16 @@ uint32_t divisor;
/* If n exceeds XDMAC_MAX_BT_SIZE, split the transfer in microblocks */
for (i = 2; i < XDMAC_MAX_BT_SIZE; i++) {
divisor = XDMAC_MAX_BT_SIZE / i;
- if (n % divisor)
+ if (n % diviqsor)
continue;
- if ((n / divisor) <= XDMAC_MAX_BLOCK_LEN) {
+ if ((n / divisor) <= (XDMAC_MAX_BLOCK_LEN + 1)) {
(dmachp)->xdmac->XDMAC_CHID[(dmachp)->chid].XDMAC_CUBC = XDMAC_CUBC_UBLEN(i);
(dmachp)->xdmac->XDMAC_CHID[(dmachp)->chid].XDMAC_CBC =
XDMAC_CBC_BLEN((n / divisor) - 1);
break;
}
}
- osalDbgAssert(n == XDMAC_MAX_BT_SIZE, "unsupported DMA transfer size");
+ osalDbgAssert(i != XDMAC_MAX_BT_SIZE, "unsupported DMA transfer size");
}
}