diff options
Diffstat (limited to 'os')
-rw-r--r-- | os/hal/ports/SAMA/SAMA5D2x/sama_matrix.c | 8 | ||||
-rw-r--r-- | os/hal/ports/SAMA/SAMA5D2x/sama_pmc.h | 8 | ||||
-rw-r--r-- | os/hal/ports/SAMA/SAMA5D2x/sama_secumod.c | 26 | ||||
-rw-r--r-- | os/hal/ports/SAMA/SAMA5D2x/sama_secumod.h | 9 |
4 files changed, 39 insertions, 12 deletions
diff --git a/os/hal/ports/SAMA/SAMA5D2x/sama_matrix.c b/os/hal/ports/SAMA/SAMA5D2x/sama_matrix.c index c24f8a703..61d0fa1c8 100644 --- a/os/hal/ports/SAMA/SAMA5D2x/sama_matrix.c +++ b/os/hal/ports/SAMA/SAMA5D2x/sama_matrix.c @@ -91,12 +91,8 @@ bool mtxConfigPeriphSecurity(Matrix *mtxp, uint32_t id, bool mode) {
uint32_t mask;
- if (id < 74) {
- mask = id & 0x1F;
- }
- else {
- mask = (id & 0x1F) - 1;
- }
+ mask = id & 0x1F;
+
mtxDisableWP(mtxp);
if (mode) {
mtxp->MATRIX_SPSELR[id / 32] |= (MATRIX_SPSELR_NSECP0 << mask);
diff --git a/os/hal/ports/SAMA/SAMA5D2x/sama_pmc.h b/os/hal/ports/SAMA/SAMA5D2x/sama_pmc.h index 9b4a580c2..38ac3d069 100644 --- a/os/hal/ports/SAMA/SAMA5D2x/sama_pmc.h +++ b/os/hal/ports/SAMA/SAMA5D2x/sama_pmc.h @@ -77,7 +77,7 @@ */
#define pmcEnablePidLow(mask) { \
pmcDisableWP(); \
- PMC->PMC_PCER0 |= (mask); \
+ PMC->PMC_PCER0 = (mask); \
pmcEnableWP(); \
}
@@ -91,7 +91,7 @@ */
#define pmcDisablePidLow(mask) { \
pmcDisableWP(); \
- PMC->PMC_PCDR0 |= (mask); \
+ PMC->PMC_PCDR0 = (mask); \
pmcEnableWP(); \
}
@@ -105,7 +105,7 @@ */
#define pmcEnablePidHigh(mask) { \
pmcDisableWP(); \
- PMC->PMC_PCER1 |= (mask); \
+ PMC->PMC_PCER1 = (mask); \
pmcEnableWP(); \
}
@@ -119,7 +119,7 @@ */
#define pmcDisablePidHigh(mask) { \
pmcDisableWP(); \
- PMC->PMC_PCDR1 |= (mask); \
+ PMC->PMC_PCDR1 = (mask); \
pmcEnableWP(); \
}
/** @} */
diff --git a/os/hal/ports/SAMA/SAMA5D2x/sama_secumod.c b/os/hal/ports/SAMA/SAMA5D2x/sama_secumod.c index 7c1039076..4cf1d527a 100644 --- a/os/hal/ports/SAMA/SAMA5D2x/sama_secumod.c +++ b/os/hal/ports/SAMA/SAMA5D2x/sama_secumod.c @@ -148,8 +148,32 @@ OSAL_IRQ_HANDLER(SAMA_SECUMOD_HANDLER) { else if ((sr & SECUMOD_SR_VDDCOREH) && (nimpr & SECUMOD_NIMPR_VDDCOREH)) {
SECD0.secumod_callback(&SECD0, SEC_EVENT_VDDCOREH);
}
+ else if ((sr & SECUMOD_SR_DET0) && (nimpr & SECUMOD_NIMPR_DET0)) {
+ SECD0.secumod_callback(&SECD0, SEC_EVENT_PIOBU0);
+ }
+ else if ((sr & SECUMOD_SR_DET1) && (nimpr & SECUMOD_NIMPR_DET1)) {
+ SECD0.secumod_callback(&SECD0, SEC_EVENT_PIOBU1);
+ }
+ else if ((sr & SECUMOD_SR_DET2) && (nimpr & SECUMOD_NIMPR_DET2)) {
+ SECD0.secumod_callback(&SECD0, SEC_EVENT_PIOBU2);
+ }
+ else if ((sr & SECUMOD_SR_DET3) && (nimpr & SECUMOD_NIMPR_DET3)) {
+ SECD0.secumod_callback(&SECD0, SEC_EVENT_PIOBU3);
+ }
+ else if ((sr & SECUMOD_SR_DET4) && (nimpr & SECUMOD_NIMPR_DET4)) {
+ SECD0.secumod_callback(&SECD0, SEC_EVENT_PIOBU4);
+ }
+ else if ((sr & SECUMOD_SR_DET5) && (nimpr & SECUMOD_NIMPR_DET5)) {
+ SECD0.secumod_callback(&SECD0, SEC_EVENT_PIOBU5);
+ }
+ else if ((sr & SECUMOD_SR_DET6) && (nimpr & SECUMOD_NIMPR_DET6)) {
+ SECD0.secumod_callback(&SECD0, SEC_EVENT_PIOBU6);
+ }
+ else if ((sr & SECUMOD_SR_DET7) && (nimpr & SECUMOD_NIMPR_DET7)) {
+ SECD0.secumod_callback(&SECD0, SEC_EVENT_PIOBU7);
+ }
else {
- SECD0.secumod_callback(&SECD0, SEC_EVENT_PIOBU);
+ (void) 0;
}
/* wait at least one slow clock */
diff --git a/os/hal/ports/SAMA/SAMA5D2x/sama_secumod.h b/os/hal/ports/SAMA/SAMA5D2x/sama_secumod.h index c96a69c18..5ac8c3c11 100644 --- a/os/hal/ports/SAMA/SAMA5D2x/sama_secumod.h +++ b/os/hal/ports/SAMA/SAMA5D2x/sama_secumod.h @@ -226,7 +226,14 @@ typedef enum { SEC_EVENT_VDDBUH = 8, /* Triggered on High VDDBU Voltage Monitor. */
SEC_EVENT_VDDCOREL = 9, /* Triggered on Low VDDCORE Voltage Monitor. */
SEC_EVENT_VDDCOREH = 10, /* Triggered on High VDDCORE Voltage Monitor. */
- SEC_EVENT_PIOBU = 11 /* Triggered on PIOBU intrusion. */
+ SEC_EVENT_PIOBU0 = 11, /* Triggered on PIOBUx intrusion. */
+ SEC_EVENT_PIOBU1 = 12, /* Triggered on PIOBUx intrusion. */
+ SEC_EVENT_PIOBU2 = 13, /* Triggered on PIOBUx intrusion. */
+ SEC_EVENT_PIOBU3 = 14, /* Triggered on PIOBUx intrusion. */
+ SEC_EVENT_PIOBU4 = 15, /* Triggered on PIOBUx intrusion. */
+ SEC_EVENT_PIOBU5 = 16, /* Triggered on PIOBUx intrusion. */
+ SEC_EVENT_PIOBU6 = 17, /* Triggered on PIOBUx intrusion. */
+ SEC_EVENT_PIOBU7 = 18 /* Triggered on PIOBUx intrusion. */
} secevent_t;
/**
|