aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/SAMA/SAMA5D2x
diff options
context:
space:
mode:
authoredolomb <none@example.com>2018-01-15 20:15:31 +0000
committeredolomb <none@example.com>2018-01-15 20:15:31 +0000
commit74472ded3a27aa4dd3aa23ac3b7a1f65dad37b9c (patch)
tree0860612d14253c5c1aa5e15b96d57769a6095835 /os/hal/ports/SAMA/SAMA5D2x
parenta455550093323d5a3365dcd17f288da1e19f4df6 (diff)
downloadChibiOS-74472ded3a27aa4dd3aa23ac3b7a1f65dad37b9c.tar.gz
ChibiOS-74472ded3a27aa4dd3aa23ac3b7a1f65dad37b9c.tar.bz2
ChibiOS-74472ded3a27aa4dd3aa23ac3b7a1f65dad37b9c.zip
Added derived constants and error checks
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11277 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/ports/SAMA/SAMA5D2x')
-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. */
/*===========================================================================*/