From a455550093323d5a3365dcd17f288da1e19f4df6 Mon Sep 17 00:00:00 2001 From: edolomb Date: Mon, 15 Jan 2018 20:14:58 +0000 Subject: Added derived constants and error checks git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11276 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/ports/SAMA/SAMA5D2x/hal_st_lld.c | 9 +++++++ os/hal/ports/SAMA/SAMA5D2x/hal_st_lld.h | 42 +++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) (limited to 'os/hal/ports') diff --git a/os/hal/ports/SAMA/SAMA5D2x/hal_st_lld.c b/os/hal/ports/SAMA/SAMA5D2x/hal_st_lld.c index 981ebca11..adc174363 100644 --- a/os/hal/ports/SAMA/SAMA5D2x/hal_st_lld.c +++ b/os/hal/ports/SAMA/SAMA5D2x/hal_st_lld.c @@ -147,6 +147,9 @@ void st_lld_init(void) { #if (OSAL_ST_MODE == OSAL_ST_MODE_PERIODIC) #if (SAMA_ST_USE_TC0 == TRUE) +#if SAMA_HAL_IS_SECURE + mtxConfigPeriphSecurity(MATRIX1, ID_TC0, SECURE_PER); +#endif /* SAMA_HAL_IS_SECURE */ pmcEnableTC0(); aicSetSourcePriority(ID_TC0, SAMA_TC0_IRQ_PRIORITY); aicSetSourceHandler(ID_TC0, SAMA_ST_TC0_HANDLER); @@ -167,6 +170,9 @@ void st_lld_init(void) { #endif /* SAMA_ST_USE_TC0 == TRUE */ #if (SAMA_ST_USE_TC1 == TRUE) +#if SAMA_HAL_IS_SECURE + mtxConfigPeriphSecurity(MATRIX1, ID_TC1, SECURE_PER); +#endif /* SAMA_HAL_IS_SECURE */ pmcEnableTC1(); aicSetSourcePriority(ID_TC1, SAMA_TC1_IRQ_PRIORITY); aicSetSourceHandler(ID_TC1, SAMA_ST_TC1_HANDLER); @@ -187,6 +193,9 @@ void st_lld_init(void) { #endif /* SAMA_ST_USE_TC1 == TRUE */ #if (SAMA_ST_USE_PIT == TRUE) +#if SAMA_HAL_IS_SECURE + mtxConfigPeriphSecurity(MATRIX1, ID_PIT, SECURE_PER); +#endif /* SAMA_HAL_IS_SECURE */ /* Enabling PIT.*/ pmcEnablePIT(); diff --git a/os/hal/ports/SAMA/SAMA5D2x/hal_st_lld.h b/os/hal/ports/SAMA/SAMA5D2x/hal_st_lld.h index 9a87d373d..24a656841 100644 --- a/os/hal/ports/SAMA/SAMA5D2x/hal_st_lld.h +++ b/os/hal/ports/SAMA/SAMA5D2x/hal_st_lld.h @@ -52,7 +52,49 @@ /*===========================================================================*/ /* Derived constants and error checks. */ /*===========================================================================*/ +/* Only one source for st */ +#if SAMA_ST_USE_TC0 +#if defined(ST_ASSIGNED) +#error "ST already assigned" +#else +#define ST_ASSIGNED +#endif +#endif +/* Only one source for st */ +#if SAMA_ST_USE_TC1 +#if defined(ST_ASSIGNED) +#error "ST already assigned" +#else +#define ST_ASSIGNED +#endif +#endif + +/* Only one source for st */ +#if SAMA_ST_USE_PIT +#if defined(ST_ASSIGNED) +#error "ST already assigned" +#else +#define ST_ASSIGNED +#endif +#endif + +/* Checks on allocation of TCx units.*/ +#if SAMA_ST_USE_TC0 +#if defined(SAMA_TC0_IS_USED) +#error "ST requires TC0 but the peripheral is already used" +#else +#define SAMA_TC0_IS_USED +#endif +#endif + +#if SAMA_ST_USE_TC1 +#if defined(SAMA_TC1_IS_USED) +#error "ST requires TC1 but the peripheral is already used" +#else +#define SAMA_TC1_IS_USED +#endif +#endif /*===========================================================================*/ /* Driver data structures and types. */ /*===========================================================================*/ -- cgit v1.2.3