aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/ports')
-rw-r--r--os/hal/ports/SAMA/SAMA5D2x/hal_tc_lld.c6
-rw-r--r--os/hal/ports/SAMA/SAMA5D2x/hal_tc_lld.h17
2 files changed, 23 insertions, 0 deletions
diff --git a/os/hal/ports/SAMA/SAMA5D2x/hal_tc_lld.c b/os/hal/ports/SAMA/SAMA5D2x/hal_tc_lld.c
index 4c3ecd9e1..5cfa90968 100644
--- a/os/hal/ports/SAMA/SAMA5D2x/hal_tc_lld.c
+++ b/os/hal/ports/SAMA/SAMA5D2x/hal_tc_lld.c
@@ -156,6 +156,9 @@ OSAL_IRQ_HANDLER(SAMA_TC1_HANDLER) {
void tc_lld_init(void) {
#if SAMA_USE_TC0
+#if SAMA_HAL_IS_SECURE
+ mtxConfigPeriphSecurity(MATRIX1, ID_TC0, SECURE_PER);
+#endif /* SAMA_HAL_IS_SECURE */
/* Driver initialization.*/
tcObjectInit(&TCD0);
TCD0.channels = TC_CHANNELS;
@@ -164,6 +167,9 @@ void tc_lld_init(void) {
#endif
#if SAMA_USE_TC1
+#if SAMA_HAL_IS_SECURE
+ mtxConfigPeriphSecurity(MATRIX1, ID_TC1, SECURE_PER);
+#endif /* SAMA_HAL_IS_SECURE */
/* Driver initialization.*/
tcObjectInit(&TCD1);
TCD1.channels = TC_CHANNELS;
diff --git a/os/hal/ports/SAMA/SAMA5D2x/hal_tc_lld.h b/os/hal/ports/SAMA/SAMA5D2x/hal_tc_lld.h
index 908ed173b..b58d6e1cb 100644
--- a/os/hal/ports/SAMA/SAMA5D2x/hal_tc_lld.h
+++ b/os/hal/ports/SAMA/SAMA5D2x/hal_tc_lld.h
@@ -133,6 +133,23 @@ typedef void (*tccallback_t)(TCDriver *tcp);
#error "TC driver activated but no TC peripheral assigned"
#endif
+/* Checks on allocation of TCx units.*/
+#if SAMA_USE_TC0
+#if defined(SAMA_TC0_IS_USED)
+#error "TC0 is already used"
+#else
+#define SAMA_TC0_IS_USED
+#endif
+#endif
+
+/* Checks on allocation of TCx units.*/
+#if SAMA_USE_TC1
+#if defined(SAMA_TC1_IS_USED)
+#error "TC1 is already used"
+#else
+#define SAMA_TC1_IS_USED
+#endif
+#endif
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/