From 74472ded3a27aa4dd3aa23ac3b7a1f65dad37b9c Mon Sep 17 00:00:00 2001 From: edolomb Date: Mon, 15 Jan 2018 20:15:31 +0000 Subject: Added derived constants and error checks git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11277 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/ports/SAMA/SAMA5D2x/hal_tc_lld.c | 6 ++++++ os/hal/ports/SAMA/SAMA5D2x/hal_tc_lld.h | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) (limited to 'os/hal/ports/SAMA/SAMA5D2x') 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. */ /*===========================================================================*/ -- cgit v1.2.3