diff options
author | edolomb <none@example.com> | 2018-01-15 20:14:58 +0000 |
---|---|---|
committer | edolomb <none@example.com> | 2018-01-15 20:14:58 +0000 |
commit | a455550093323d5a3365dcd17f288da1e19f4df6 (patch) | |
tree | b71c4a3fd3de8df186e878559282d27c79c3debe /os/hal/ports/SAMA | |
parent | 6b9476b13377be06cc90b2d670ab2d3b12f70ada (diff) | |
download | ChibiOS-a455550093323d5a3365dcd17f288da1e19f4df6.tar.gz ChibiOS-a455550093323d5a3365dcd17f288da1e19f4df6.tar.bz2 ChibiOS-a455550093323d5a3365dcd17f288da1e19f4df6.zip |
Added derived constants and error checks
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11276 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/ports/SAMA')
-rw-r--r-- | os/hal/ports/SAMA/SAMA5D2x/hal_st_lld.c | 9 | ||||
-rw-r--r-- | os/hal/ports/SAMA/SAMA5D2x/hal_st_lld.h | 42 |
2 files changed, 51 insertions, 0 deletions
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. */
/*===========================================================================*/
|