Added derived constants and error checks

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11276 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
edolomb 2018-01-15 20:14:58 +00:00
parent 6b9476b133
commit a455550093
2 changed files with 51 additions and 0 deletions

View File

@ -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();

View File

@ -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. */
/*===========================================================================*/