aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/ATSAMA5D2
diff options
context:
space:
mode:
Diffstat (limited to 'testhal/ATSAMA5D2')
-rwxr-xr-xtesthal/ATSAMA5D2/MATRIX/chconf.h2
-rw-r--r--testhal/ATSAMA5D2/MATRIX/halconf.h2
-rw-r--r--testhal/ATSAMA5D2/MATRIX/mcuconf.h2
-rw-r--r--testhal/ATSAMA5D2/SDMMC/chconf.h2
-rw-r--r--testhal/ATSAMA5D2/SDMMC/halconf.h2
-rw-r--r--testhal/ATSAMA5D2/SDMMC/main.c346
-rw-r--r--testhal/ATSAMA5D2/SDMMC/mcuconf.h2
-rwxr-xr-xtesthal/ATSAMA5D2/SECUMOD/chconf.h2
-rw-r--r--testhal/ATSAMA5D2/SECUMOD/halconf.h2
-rwxr-xr-xtesthal/ATSAMA5D2/SECUMOD/main.c474
-rw-r--r--testhal/ATSAMA5D2/SECUMOD/mcuconf.h2
-rwxr-xr-xtesthal/ATSAMA5D2/SERIAL/chconf.h2
-rw-r--r--testhal/ATSAMA5D2/SERIAL/halconf.h2
-rwxr-xr-xtesthal/ATSAMA5D2/SERIAL/main.c2
-rw-r--r--testhal/ATSAMA5D2/SERIAL/mcuconf.h2
-rw-r--r--testhal/ATSAMA5D2/SPI/chconf.h2
-rw-r--r--testhal/ATSAMA5D2/SPI/halconf.h2
-rw-r--r--testhal/ATSAMA5D2/SPI/main.c2
-rw-r--r--testhal/ATSAMA5D2/SPI/mcuconf.h2
-rwxr-xr-xtesthal/ATSAMA5D2/TC/chconf.h2
-rw-r--r--testhal/ATSAMA5D2/TC/halconf.h2
-rwxr-xr-xtesthal/ATSAMA5D2/TC/main.c156
-rw-r--r--testhal/ATSAMA5D2/TC/mcuconf.h2
-rw-r--r--testhal/ATSAMA5D2/UART/chconf.h2
-rw-r--r--testhal/ATSAMA5D2/UART/halconf.h2
-rw-r--r--testhal/ATSAMA5D2/UART/main.c2
-rw-r--r--testhal/ATSAMA5D2/UART/mcuconf.h2
27 files changed, 512 insertions, 512 deletions
diff --git a/testhal/ATSAMA5D2/MATRIX/chconf.h b/testhal/ATSAMA5D2/MATRIX/chconf.h
index 005c281b3..98659e9c9 100755
--- a/testhal/ATSAMA5D2/MATRIX/chconf.h
+++ b/testhal/ATSAMA5D2/MATRIX/chconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/ATSAMA5D2/MATRIX/halconf.h b/testhal/ATSAMA5D2/MATRIX/halconf.h
index 06f68ba60..99256e3f4 100644
--- a/testhal/ATSAMA5D2/MATRIX/halconf.h
+++ b/testhal/ATSAMA5D2/MATRIX/halconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/ATSAMA5D2/MATRIX/mcuconf.h b/testhal/ATSAMA5D2/MATRIX/mcuconf.h
index b4639f65e..fcdb66611 100644
--- a/testhal/ATSAMA5D2/MATRIX/mcuconf.h
+++ b/testhal/ATSAMA5D2/MATRIX/mcuconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/ATSAMA5D2/SDMMC/chconf.h b/testhal/ATSAMA5D2/SDMMC/chconf.h
index f61dc3f3e..49b16647b 100644
--- a/testhal/ATSAMA5D2/SDMMC/chconf.h
+++ b/testhal/ATSAMA5D2/SDMMC/chconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/ATSAMA5D2/SDMMC/halconf.h b/testhal/ATSAMA5D2/SDMMC/halconf.h
index b534118ae..ffe70f76c 100644
--- a/testhal/ATSAMA5D2/SDMMC/halconf.h
+++ b/testhal/ATSAMA5D2/SDMMC/halconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/ATSAMA5D2/SDMMC/main.c b/testhal/ATSAMA5D2/SDMMC/main.c
index 978453d25..48cb01548 100644
--- a/testhal/ATSAMA5D2/SDMMC/main.c
+++ b/testhal/ATSAMA5D2/SDMMC/main.c
@@ -1,173 +1,173 @@
-/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-#include <string.h>
-#include "ch.h"
-#include "hal.h"
-#include "sama_sdmmc_lld.h"
-#include "chprintf.h"
-
-
-#define BLOCK_CNT_MAX 32u
-#define DMADL_CNT_MAX 64u
-#define BLOCK_CNT 3u
-
-
-CACHE_ALIGNED uint8_t data_buf[BLOCK_CNT_MAX * 512ul];
-
-CACHE_ALIGNED static uint32_t dma_table[DMADL_CNT_MAX * SDMMC_DMADL_SIZE];
-
-CACHE_ALIGNED uint8_t sdmmcbuffer[ROUND_UP_MULT(EXT_SIZE + SSR_SIZE + SCR_SIZE + SB1_SIZE + SB2_SIZE, L1_CACHE_BYTES)];
-
-static FATFS fs_header;
-//static FIL f_header;
-
-BaseSequentialStream * ts;
-
-static const SerialConfig sdcfg = { 115200, 0,UART_MR_PAR_NO };
-
-/*
- * LED blinker thread, times are in milliseconds.
- */
-static THD_WORKING_AREA(waThread1, 512);
-static THD_FUNCTION(Thread1, arg) {
-
- (void) arg;
- chRegSetThreadName("blinker");
-
- while (true) {
- palToggleLine(LINE_LED_BLUE);
- chThdSleepMilliseconds(500);
- }
-}
-
-
-
-static const SamaSDMMCConfig sdmmc_slot1_cfg = {
- SDMMC_SLOT1,
- sdmmcbuffer,
- data_buf,
- sizeof(data_buf),
- dma_table,
- DMADL_CNT_MAX
-};
-
-void getdir(SdmmcDriver *sdmmcp);
-/*
- * Application entry point.
- */
-int main(void) {
-
- /*
- * System initializations.
- * - HAL initialization, this also initializes the configured device drivers
- * and performs the board-specific initializations.
- * - Kernel initialization, the main() function becomes a thread and the
- * RTOS is active.
- */
- halInit();
- chSysInit();
-
- /*
- * Activates the serial driver 0 using the driver default configuration.
- */
- sdStart(&SD1, &sdcfg);
-
- /* Redirecting UART0 RX on PD2 and UART0 TX on PD3. */
- palSetGroupMode(PIOD, PAL_PORT_BIT(2) | PAL_PORT_BIT(3), 0U,
- PAL_SAMA_FUNC_PERIPH_A | PAL_MODE_SECURE);
-
- ts = (BaseSequentialStream *) &SD1;
-
- sdmmcInit();
-
- sdmmcStart(&SDMMCD1, &sdmmc_slot1_cfg);
-
- if (SDMMCD1.state != MCID_INIT_ERROR) {
-
- chprintf(ts,"starting MMC Demo\n\r");
-
- if (sdmmcOpenDevice(&SDMMCD1)) {
-
- //sdmmcShowDeviceInfo(&SDMMCD1);
- if ( sdmmcMountVolume(&SDMMCD1,&fs_header) ) {
- chprintf(ts,"reading files:\n\r");
- getdir(&SDMMCD1);
- }
- sdmmcCloseDevice(&SDMMCD1);
- }
-
-
- } else {
- chprintf(ts,"error,stopping MMC\n\r");
- sdmmcStop(&SDMMCD1);
- }
-
- /*
- * Creates the blinker thread.
- */
- chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
-
- /*
- * Normal main() thread activity, in this demo it does nothing except
- * sleeping in a loop and check the button state.
- */
- while (true) {
- chThdSleepMilliseconds(500);
- }
-}
-
-
-bool sdmmcGetInstance(uint8_t index, SdmmcDriver **sdmmcp)
-{
- if (index == SDMMCD1.config->slot_id) {
- *sdmmcp = &SDMMCD1;
- return true;
- }
- return false;
-}
-
-void getdir(SdmmcDriver *sdmmcp)
-{
- const TCHAR drive_path[] = { '0' + sdmmcp->config->slot_id, ':', '\0' };
- DIR dir = { .sect = 0 };
- FILINFO fno = { 0 };
- FRESULT res;
- bool is_dir;
-
- res = f_opendir(&dir, drive_path);
- if (res != FR_OK) {
- chprintf(ts,"Failed to open dir, error %d\n\r", res);
- return;
- }
- chprintf(ts,"files in the root directory:\n\r");
- for (;;) {
- res = f_readdir(&dir, &fno);
- if (res != FR_OK) {
- chprintf(ts,"cannot read dir, error (%d)\n\r", res);
- break;
- }
- if (fno.fname[0] == '\0')
- break;
- is_dir = fno.fattrib & AM_DIR ? true : false;
- chprintf(ts," %s%s%c\n\r", is_dir ? "[" : "", fno.fname,
- is_dir ? ']' : ' ');
- }
-
- res = f_closedir(&dir);
-}
-
-
-
+/*
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+#include <string.h>
+#include "ch.h"
+#include "hal.h"
+#include "sama_sdmmc_lld.h"
+#include "chprintf.h"
+
+
+#define BLOCK_CNT_MAX 32u
+#define DMADL_CNT_MAX 64u
+#define BLOCK_CNT 3u
+
+
+CACHE_ALIGNED uint8_t data_buf[BLOCK_CNT_MAX * 512ul];
+
+CACHE_ALIGNED static uint32_t dma_table[DMADL_CNT_MAX * SDMMC_DMADL_SIZE];
+
+CACHE_ALIGNED uint8_t sdmmcbuffer[ROUND_UP_MULT(EXT_SIZE + SSR_SIZE + SCR_SIZE + SB1_SIZE + SB2_SIZE, L1_CACHE_BYTES)];
+
+static FATFS fs_header;
+//static FIL f_header;
+
+BaseSequentialStream * ts;
+
+static const SerialConfig sdcfg = { 115200, 0,UART_MR_PAR_NO };
+
+/*
+ * LED blinker thread, times are in milliseconds.
+ */
+static THD_WORKING_AREA(waThread1, 512);
+static THD_FUNCTION(Thread1, arg) {
+
+ (void) arg;
+ chRegSetThreadName("blinker");
+
+ while (true) {
+ palToggleLine(LINE_LED_BLUE);
+ chThdSleepMilliseconds(500);
+ }
+}
+
+
+
+static const SamaSDMMCConfig sdmmc_slot1_cfg = {
+ SDMMC_SLOT1,
+ sdmmcbuffer,
+ data_buf,
+ sizeof(data_buf),
+ dma_table,
+ DMADL_CNT_MAX
+};
+
+void getdir(SdmmcDriver *sdmmcp);
+/*
+ * Application entry point.
+ */
+int main(void) {
+
+ /*
+ * System initializations.
+ * - HAL initialization, this also initializes the configured device drivers
+ * and performs the board-specific initializations.
+ * - Kernel initialization, the main() function becomes a thread and the
+ * RTOS is active.
+ */
+ halInit();
+ chSysInit();
+
+ /*
+ * Activates the serial driver 0 using the driver default configuration.
+ */
+ sdStart(&SD1, &sdcfg);
+
+ /* Redirecting UART0 RX on PD2 and UART0 TX on PD3. */
+ palSetGroupMode(PIOD, PAL_PORT_BIT(2) | PAL_PORT_BIT(3), 0U,
+ PAL_SAMA_FUNC_PERIPH_A | PAL_MODE_SECURE);
+
+ ts = (BaseSequentialStream *) &SD1;
+
+ sdmmcInit();
+
+ sdmmcStart(&SDMMCD1, &sdmmc_slot1_cfg);
+
+ if (SDMMCD1.state != MCID_INIT_ERROR) {
+
+ chprintf(ts,"starting MMC Demo\n\r");
+
+ if (sdmmcOpenDevice(&SDMMCD1)) {
+
+ //sdmmcShowDeviceInfo(&SDMMCD1);
+ if ( sdmmcMountVolume(&SDMMCD1,&fs_header) ) {
+ chprintf(ts,"reading files:\n\r");
+ getdir(&SDMMCD1);
+ }
+ sdmmcCloseDevice(&SDMMCD1);
+ }
+
+
+ } else {
+ chprintf(ts,"error,stopping MMC\n\r");
+ sdmmcStop(&SDMMCD1);
+ }
+
+ /*
+ * Creates the blinker thread.
+ */
+ chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
+
+ /*
+ * Normal main() thread activity, in this demo it does nothing except
+ * sleeping in a loop and check the button state.
+ */
+ while (true) {
+ chThdSleepMilliseconds(500);
+ }
+}
+
+
+bool sdmmcGetInstance(uint8_t index, SdmmcDriver **sdmmcp)
+{
+ if (index == SDMMCD1.config->slot_id) {
+ *sdmmcp = &SDMMCD1;
+ return true;
+ }
+ return false;
+}
+
+void getdir(SdmmcDriver *sdmmcp)
+{
+ const TCHAR drive_path[] = { '0' + sdmmcp->config->slot_id, ':', '\0' };
+ DIR dir = { .sect = 0 };
+ FILINFO fno = { 0 };
+ FRESULT res;
+ bool is_dir;
+
+ res = f_opendir(&dir, drive_path);
+ if (res != FR_OK) {
+ chprintf(ts,"Failed to open dir, error %d\n\r", res);
+ return;
+ }
+ chprintf(ts,"files in the root directory:\n\r");
+ for (;;) {
+ res = f_readdir(&dir, &fno);
+ if (res != FR_OK) {
+ chprintf(ts,"cannot read dir, error (%d)\n\r", res);
+ break;
+ }
+ if (fno.fname[0] == '\0')
+ break;
+ is_dir = fno.fattrib & AM_DIR ? true : false;
+ chprintf(ts," %s%s%c\n\r", is_dir ? "[" : "", fno.fname,
+ is_dir ? ']' : ' ');
+ }
+
+ res = f_closedir(&dir);
+}
+
+
+
diff --git a/testhal/ATSAMA5D2/SDMMC/mcuconf.h b/testhal/ATSAMA5D2/SDMMC/mcuconf.h
index 1d2651a62..b9173531f 100644
--- a/testhal/ATSAMA5D2/SDMMC/mcuconf.h
+++ b/testhal/ATSAMA5D2/SDMMC/mcuconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/ATSAMA5D2/SECUMOD/chconf.h b/testhal/ATSAMA5D2/SECUMOD/chconf.h
index f61dc3f3e..49b16647b 100755
--- a/testhal/ATSAMA5D2/SECUMOD/chconf.h
+++ b/testhal/ATSAMA5D2/SECUMOD/chconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/ATSAMA5D2/SECUMOD/halconf.h b/testhal/ATSAMA5D2/SECUMOD/halconf.h
index c11d8bc14..64b274d27 100644
--- a/testhal/ATSAMA5D2/SECUMOD/halconf.h
+++ b/testhal/ATSAMA5D2/SECUMOD/halconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/ATSAMA5D2/SECUMOD/main.c b/testhal/ATSAMA5D2/SECUMOD/main.c
index ea55ed51c..3b6cadf5a 100755
--- a/testhal/ATSAMA5D2/SECUMOD/main.c
+++ b/testhal/ATSAMA5D2/SECUMOD/main.c
@@ -1,237 +1,237 @@
-/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-#include "ch.h"
-#include "hal.h"
-
-/* PIOBU pin attribute */
-static PIOBUConfig piocfg[] = {
- {
- .pinIndex = 0, /* PIOBU0 */
- .afv = 5,
- .rfv = 5,
- .mode = 1,
- .outputLevel = 0,
- .pullUpState = 0,
- .scheduled = 0,
- .inputDefaultLevel = 0,
- .dynamic = 1,
- .filter3_5 = 0,
- },
- {
- .pinIndex = 1, /* PIOBU1 */
- .afv = 5,
- .rfv = 5,
- .mode = 0,
- .outputLevel = 0,
- .pullUpState = 0,
- .scheduled = 0,
- .inputDefaultLevel = 0,
- .dynamic = 1,
- .filter3_5 = 0,
- },
- {
- .pinIndex = 3, /* PIOBU3 */
- .afv = 6,
- .rfv = 6,
- .mode = 0,
- .outputLevel = 0,
- .pullUpState = 1,
- .scheduled = 0,
- .inputDefaultLevel = 1,
- .dynamic = 0,
- .filter3_5 = 0,
- },
- {
- .pinIndex = 4, /* PIOBU4 */
- .afv = 5,
- .rfv = 5,
- .mode = 1,
- .outputLevel = 0,
- .pullUpState = 0,
- .scheduled = 0,
- .inputDefaultLevel = 0,
- .dynamic = 1,
- .filter3_5 = 0,
- },
- {
- .pinIndex = 5, /* PIOBU5 */
- .afv = 5,
- .rfv = 5,
- .mode = 0,
- .outputLevel = 0,
- .pullUpState = 0,
- .scheduled = 0,
- .inputDefaultLevel = 0,
- .dynamic = 1,
- .filter3_5 = 0,
- },
- {
- .pinIndex = 7, /* PIOBU7 */
- .afv = 8,
- .rfv = 8,
- .mode = 0,
- .outputLevel = 0,
- .pullUpState = 2,
- .scheduled = 0,
- .inputDefaultLevel = 0,
- .dynamic = 0,
- .filter3_5 = 0,
- },
-};
-
-static void secram_callback(SECDriver *secp) {
- (void)secp;
- palToggleLine(LINE_LED_RED);
-}
-
-static void erase_callback(SECDriver *secp) {
- (void)secp;
- palToggleLine(LINE_LED_GREEN);
-}
-
-static void secmod_callback(SECDriver *secp, secevent_t event) {
- (void)secp;
- chSysLockFromISR();
- switch (event) {
- case SEC_EVENT_PIOBU:
- /* Erasing memories on intrusion */
- secumodSoftwareProtection();
- break;
- case SEC_EVENT_SHLDM:
- ;
- break;
- case SEC_EVENT_DBLFM:
- ;
- break;
- case SEC_EVENT_TST:
- ;
- break;
- case SEC_EVENT_JTAG:
- ;
- break;
- case SEC_EVENT_MCKM:
- ;
- break;
- case SEC_EVENT_TPML:
- ;
- break;
- case SEC_EVENT_TPMH:
- ;
- break;
- case SEC_EVENT_VDDBUL:
- ;
- break;
- case SEC_EVENT_VDDBUH:
- ;
- break;
- case SEC_EVENT_VDDCOREL:
- ;
- break;
- case SEC_EVENT_VDDCOREH:
- ;
- break;
- }
- chSysUnlockFromISR();
-}
-
-static SECConfig secumod_cfg = {
- secram_callback, /* securam callback */
- erase_callback, /* erased callback */
- 6, /* Pads to configure */
- piocfg, /* PIOBU config */
- {
- {RAMACC_RD_ACCESS}, /* RAM region 0 permission */
- {RAMACC_WR_RD_ACCESS}, /* RAM region 1 permission */
- {RAMACC_WR_RD_ACCESS}, /* RAM region 2 permission */
- {RAMACC_WR_RD_ACCESS}, /* RAM region 3 permission */
- {RAMACC_WR_RD_ACCESS}, /* RAM region 4 permission */
- {RAMACC_WR_RD_ACCESS} /* RAM region 5 permission */
- },
- SECUMOD_CR_NORMAL | /* CR register */
- SECUMOD_CR_SCRAMB(SCRAMB_DISABLE),
- SECUMOD_JTAGCR_CA5_DEBUG_MODE_FULL_DEBUG /* JTAGCR register */
-};
-
-/*
- * LED blinker thread, times are in milliseconds.
- */
-static THD_WORKING_AREA(waThread1, 512);
-static THD_FUNCTION(Thread1, arg) {
-
- (void)arg;
- chRegSetThreadName("blinker");
-
- while (true) {
- palToggleLine(LINE_LED_BLUE);
- chThdSleepMilliseconds(80);
- palToggleLine(LINE_LED_BLUE);
- chThdSleepMilliseconds(120);
- palToggleLine(LINE_LED_BLUE);
- chThdSleepMilliseconds(120);
- palToggleLine(LINE_LED_BLUE);
- chThdSleepMilliseconds(120);
- palToggleLine(LINE_LED_BLUE);
- chThdSleepMilliseconds(160);
- palToggleLine(LINE_LED_BLUE);
- chThdSleepMilliseconds(600);
- }
-}
-
-/*
- * Application entry point.
- */
-int main(void) {
-
- /*
- * System initializations.
- * - HAL initialization, this also initializes the configured device drivers
- * and performs the board-specific initializations.
- * - Kernel initialization, the main() function becomes a thread and the
- * RTOS is active.
- */
- halInit();
- chSysInit();
- secInit();
-
- /* REGION_0 location */
- uint32_t *region0 = (uint32_t *) 0xF8044000;
-
- /*
- * Starts SECUMOD Driver
- */
- secStart(&SECD0, &secumod_cfg);
-
- /*
- * Creates the blinker thread.
- */
- chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
-
- /* Intrusion on PIOBU pad 0 causes interrupt but not automating erase */
- secSetCallback(&SECD0, SECUMOD_DET0, &secmod_callback);
-
- /*
- * Normal main() thread activity, in this demo it does nothing except
- * sleeping in a loop and check the button state.
- */
- while (true) {
- if(!palReadPad(PIOB, PIOB_USER_PB)) {
- /* Write access in REGION_0 causes SECURAM interrupt */
- *region0 = 0xAA55AA55;
- }
- chThdSleepMilliseconds(500);
- }
-}
+/*
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+#include "ch.h"
+#include "hal.h"
+
+/* PIOBU pin attribute */
+static PIOBUConfig piocfg[] = {
+ {
+ .pinIndex = 0, /* PIOBU0 */
+ .afv = 5,
+ .rfv = 5,
+ .mode = 1,
+ .outputLevel = 0,
+ .pullUpState = 0,
+ .scheduled = 0,
+ .inputDefaultLevel = 0,
+ .dynamic = 1,
+ .filter3_5 = 0,
+ },
+ {
+ .pinIndex = 1, /* PIOBU1 */
+ .afv = 5,
+ .rfv = 5,
+ .mode = 0,
+ .outputLevel = 0,
+ .pullUpState = 0,
+ .scheduled = 0,
+ .inputDefaultLevel = 0,
+ .dynamic = 1,
+ .filter3_5 = 0,
+ },
+ {
+ .pinIndex = 3, /* PIOBU3 */
+ .afv = 6,
+ .rfv = 6,
+ .mode = 0,
+ .outputLevel = 0,
+ .pullUpState = 1,
+ .scheduled = 0,
+ .inputDefaultLevel = 1,
+ .dynamic = 0,
+ .filter3_5 = 0,
+ },
+ {
+ .pinIndex = 4, /* PIOBU4 */
+ .afv = 5,
+ .rfv = 5,
+ .mode = 1,
+ .outputLevel = 0,
+ .pullUpState = 0,
+ .scheduled = 0,
+ .inputDefaultLevel = 0,
+ .dynamic = 1,
+ .filter3_5 = 0,
+ },
+ {
+ .pinIndex = 5, /* PIOBU5 */
+ .afv = 5,
+ .rfv = 5,
+ .mode = 0,
+ .outputLevel = 0,
+ .pullUpState = 0,
+ .scheduled = 0,
+ .inputDefaultLevel = 0,
+ .dynamic = 1,
+ .filter3_5 = 0,
+ },
+ {
+ .pinIndex = 7, /* PIOBU7 */
+ .afv = 8,
+ .rfv = 8,
+ .mode = 0,
+ .outputLevel = 0,
+ .pullUpState = 2,
+ .scheduled = 0,
+ .inputDefaultLevel = 0,
+ .dynamic = 0,
+ .filter3_5 = 0,
+ },
+};
+
+static void secram_callback(SECDriver *secp) {
+ (void)secp;
+ palToggleLine(LINE_LED_RED);
+}
+
+static void erase_callback(SECDriver *secp) {
+ (void)secp;
+ palToggleLine(LINE_LED_GREEN);
+}
+
+static void secmod_callback(SECDriver *secp, secevent_t event) {
+ (void)secp;
+ chSysLockFromISR();
+ switch (event) {
+ case SEC_EVENT_PIOBU:
+ /* Erasing memories on intrusion */
+ secumodSoftwareProtection();
+ break;
+ case SEC_EVENT_SHLDM:
+ ;
+ break;
+ case SEC_EVENT_DBLFM:
+ ;
+ break;
+ case SEC_EVENT_TST:
+ ;
+ break;
+ case SEC_EVENT_JTAG:
+ ;
+ break;
+ case SEC_EVENT_MCKM:
+ ;
+ break;
+ case SEC_EVENT_TPML:
+ ;
+ break;
+ case SEC_EVENT_TPMH:
+ ;
+ break;
+ case SEC_EVENT_VDDBUL:
+ ;
+ break;
+ case SEC_EVENT_VDDBUH:
+ ;
+ break;
+ case SEC_EVENT_VDDCOREL:
+ ;
+ break;
+ case SEC_EVENT_VDDCOREH:
+ ;
+ break;
+ }
+ chSysUnlockFromISR();
+}
+
+static SECConfig secumod_cfg = {
+ secram_callback, /* securam callback */
+ erase_callback, /* erased callback */
+ 6, /* Pads to configure */
+ piocfg, /* PIOBU config */
+ {
+ {RAMACC_RD_ACCESS}, /* RAM region 0 permission */
+ {RAMACC_WR_RD_ACCESS}, /* RAM region 1 permission */
+ {RAMACC_WR_RD_ACCESS}, /* RAM region 2 permission */
+ {RAMACC_WR_RD_ACCESS}, /* RAM region 3 permission */
+ {RAMACC_WR_RD_ACCESS}, /* RAM region 4 permission */
+ {RAMACC_WR_RD_ACCESS} /* RAM region 5 permission */
+ },
+ SECUMOD_CR_NORMAL | /* CR register */
+ SECUMOD_CR_SCRAMB(SCRAMB_DISABLE),
+ SECUMOD_JTAGCR_CA5_DEBUG_MODE_FULL_DEBUG /* JTAGCR register */
+};
+
+/*
+ * LED blinker thread, times are in milliseconds.
+ */
+static THD_WORKING_AREA(waThread1, 512);
+static THD_FUNCTION(Thread1, arg) {
+
+ (void)arg;
+ chRegSetThreadName("blinker");
+
+ while (true) {
+ palToggleLine(LINE_LED_BLUE);
+ chThdSleepMilliseconds(80);
+ palToggleLine(LINE_LED_BLUE);
+ chThdSleepMilliseconds(120);
+ palToggleLine(LINE_LED_BLUE);
+ chThdSleepMilliseconds(120);
+ palToggleLine(LINE_LED_BLUE);
+ chThdSleepMilliseconds(120);
+ palToggleLine(LINE_LED_BLUE);
+ chThdSleepMilliseconds(160);
+ palToggleLine(LINE_LED_BLUE);
+ chThdSleepMilliseconds(600);
+ }
+}
+
+/*
+ * Application entry point.
+ */
+int main(void) {
+
+ /*
+ * System initializations.
+ * - HAL initialization, this also initializes the configured device drivers
+ * and performs the board-specific initializations.
+ * - Kernel initialization, the main() function becomes a thread and the
+ * RTOS is active.
+ */
+ halInit();
+ chSysInit();
+ secInit();
+
+ /* REGION_0 location */
+ uint32_t *region0 = (uint32_t *) 0xF8044000;
+
+ /*
+ * Starts SECUMOD Driver
+ */
+ secStart(&SECD0, &secumod_cfg);
+
+ /*
+ * Creates the blinker thread.
+ */
+ chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
+
+ /* Intrusion on PIOBU pad 0 causes interrupt but not automating erase */
+ secSetCallback(&SECD0, SECUMOD_DET0, &secmod_callback);
+
+ /*
+ * Normal main() thread activity, in this demo it does nothing except
+ * sleeping in a loop and check the button state.
+ */
+ while (true) {
+ if(!palReadPad(PIOB, PIOB_USER_PB)) {
+ /* Write access in REGION_0 causes SECURAM interrupt */
+ *region0 = 0xAA55AA55;
+ }
+ chThdSleepMilliseconds(500);
+ }
+}
diff --git a/testhal/ATSAMA5D2/SECUMOD/mcuconf.h b/testhal/ATSAMA5D2/SECUMOD/mcuconf.h
index c62329ba3..f01ff9daa 100644
--- a/testhal/ATSAMA5D2/SECUMOD/mcuconf.h
+++ b/testhal/ATSAMA5D2/SECUMOD/mcuconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/ATSAMA5D2/SERIAL/chconf.h b/testhal/ATSAMA5D2/SERIAL/chconf.h
index f61dc3f3e..49b16647b 100755
--- a/testhal/ATSAMA5D2/SERIAL/chconf.h
+++ b/testhal/ATSAMA5D2/SERIAL/chconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/ATSAMA5D2/SERIAL/halconf.h b/testhal/ATSAMA5D2/SERIAL/halconf.h
index b534118ae..ffe70f76c 100644
--- a/testhal/ATSAMA5D2/SERIAL/halconf.h
+++ b/testhal/ATSAMA5D2/SERIAL/halconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/ATSAMA5D2/SERIAL/main.c b/testhal/ATSAMA5D2/SERIAL/main.c
index a2caa2ffa..cd1a382f7 100755
--- a/testhal/ATSAMA5D2/SERIAL/main.c
+++ b/testhal/ATSAMA5D2/SERIAL/main.c
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/ATSAMA5D2/SERIAL/mcuconf.h b/testhal/ATSAMA5D2/SERIAL/mcuconf.h
index 751850458..f084e22cd 100644
--- a/testhal/ATSAMA5D2/SERIAL/mcuconf.h
+++ b/testhal/ATSAMA5D2/SERIAL/mcuconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/ATSAMA5D2/SPI/chconf.h b/testhal/ATSAMA5D2/SPI/chconf.h
index 005c281b3..98659e9c9 100644
--- a/testhal/ATSAMA5D2/SPI/chconf.h
+++ b/testhal/ATSAMA5D2/SPI/chconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/ATSAMA5D2/SPI/halconf.h b/testhal/ATSAMA5D2/SPI/halconf.h
index b4447f1d8..84532f497 100644
--- a/testhal/ATSAMA5D2/SPI/halconf.h
+++ b/testhal/ATSAMA5D2/SPI/halconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/ATSAMA5D2/SPI/main.c b/testhal/ATSAMA5D2/SPI/main.c
index c88f2a8d4..5807109fb 100644
--- a/testhal/ATSAMA5D2/SPI/main.c
+++ b/testhal/ATSAMA5D2/SPI/main.c
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/ATSAMA5D2/SPI/mcuconf.h b/testhal/ATSAMA5D2/SPI/mcuconf.h
index 80c78dbfd..13d62e19f 100644
--- a/testhal/ATSAMA5D2/SPI/mcuconf.h
+++ b/testhal/ATSAMA5D2/SPI/mcuconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/ATSAMA5D2/TC/chconf.h b/testhal/ATSAMA5D2/TC/chconf.h
index 005c281b3..98659e9c9 100755
--- a/testhal/ATSAMA5D2/TC/chconf.h
+++ b/testhal/ATSAMA5D2/TC/chconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/ATSAMA5D2/TC/halconf.h b/testhal/ATSAMA5D2/TC/halconf.h
index 06f68ba60..99256e3f4 100644
--- a/testhal/ATSAMA5D2/TC/halconf.h
+++ b/testhal/ATSAMA5D2/TC/halconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/ATSAMA5D2/TC/main.c b/testhal/ATSAMA5D2/TC/main.c
index 3751ab12f..f681a06c9 100755
--- a/testhal/ATSAMA5D2/TC/main.c
+++ b/testhal/ATSAMA5D2/TC/main.c
@@ -1,78 +1,78 @@
-/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-#include "ch.h"
-#include "hal.h"
-
-static TCConfig tccfg = {
- {
- {TC_OUTPUT_ACTIVE, 440 , NULL}, /* 440 hz clock frequency. */
- {TC_OUTPUT_DISABLED, 0, NULL},
- {TC_OUTPUT_DISABLED, 0, NULL}
- }
-};
-
-/*
- * Buzzer thread, times are in milliseconds.
- */
-static THD_WORKING_AREA(waThread1, 512);
-static THD_FUNCTION(Thread1, arg) {
-
- (void)arg;
- chRegSetThreadName("buzzer");
-
- while (true) {
- tcEnableChannel(&TCD0, 0, 50);
- palClearLine(LINE_LED_RED);
- chThdSleepMilliseconds(500);
- tcDisableChannel(&TCD0, 0);
- palSetLine(LINE_LED_RED);
- chThdSleepMilliseconds(500);
- }
-}
-
-/*
- * Application entry point.
- */
-int main(void) {
-
- /*
- * System initializations.
- * - HAL initialization, this also initializes the configured device drivers
- * and performs the board-specific initializations.
- * - Kernel initialization, the main() function becomes a thread and the
- * RTOS is active.
- */
- halInit();
- tcInit();
- chSysInit();
-
- /*
- * Initializes the TC0 driver.
- * GPIOA19 is the TC0 channel 0 output.
- */
- palSetGroupMode(PIOA, PAL_PORT_BIT(19), 0U,
- PAL_SAMA_FUNC_PERIPH_D | PAL_MODE_SECURE);
- tcStart(&TCD0, &tccfg);
- chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
-
- /*
- * Normal main() thread activity, in this demo it does nothing.
- */
- while (true) {
- chThdSleepMilliseconds(500);
- }
-}
+/*
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+#include "ch.h"
+#include "hal.h"
+
+static TCConfig tccfg = {
+ {
+ {TC_OUTPUT_ACTIVE, 440 , NULL}, /* 440 hz clock frequency. */
+ {TC_OUTPUT_DISABLED, 0, NULL},
+ {TC_OUTPUT_DISABLED, 0, NULL}
+ }
+};
+
+/*
+ * Buzzer thread, times are in milliseconds.
+ */
+static THD_WORKING_AREA(waThread1, 512);
+static THD_FUNCTION(Thread1, arg) {
+
+ (void)arg;
+ chRegSetThreadName("buzzer");
+
+ while (true) {
+ tcEnableChannel(&TCD0, 0, 50);
+ palClearLine(LINE_LED_RED);
+ chThdSleepMilliseconds(500);
+ tcDisableChannel(&TCD0, 0);
+ palSetLine(LINE_LED_RED);
+ chThdSleepMilliseconds(500);
+ }
+}
+
+/*
+ * Application entry point.
+ */
+int main(void) {
+
+ /*
+ * System initializations.
+ * - HAL initialization, this also initializes the configured device drivers
+ * and performs the board-specific initializations.
+ * - Kernel initialization, the main() function becomes a thread and the
+ * RTOS is active.
+ */
+ halInit();
+ tcInit();
+ chSysInit();
+
+ /*
+ * Initializes the TC0 driver.
+ * GPIOA19 is the TC0 channel 0 output.
+ */
+ palSetGroupMode(PIOA, PAL_PORT_BIT(19), 0U,
+ PAL_SAMA_FUNC_PERIPH_D | PAL_MODE_SECURE);
+ tcStart(&TCD0, &tccfg);
+ chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
+
+ /*
+ * Normal main() thread activity, in this demo it does nothing.
+ */
+ while (true) {
+ chThdSleepMilliseconds(500);
+ }
+}
diff --git a/testhal/ATSAMA5D2/TC/mcuconf.h b/testhal/ATSAMA5D2/TC/mcuconf.h
index a1fa9b72c..3b4b068a5 100644
--- a/testhal/ATSAMA5D2/TC/mcuconf.h
+++ b/testhal/ATSAMA5D2/TC/mcuconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/ATSAMA5D2/UART/chconf.h b/testhal/ATSAMA5D2/UART/chconf.h
index 005c281b3..98659e9c9 100644
--- a/testhal/ATSAMA5D2/UART/chconf.h
+++ b/testhal/ATSAMA5D2/UART/chconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/ATSAMA5D2/UART/halconf.h b/testhal/ATSAMA5D2/UART/halconf.h
index 5004a3d67..ff3532571 100644
--- a/testhal/ATSAMA5D2/UART/halconf.h
+++ b/testhal/ATSAMA5D2/UART/halconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/ATSAMA5D2/UART/main.c b/testhal/ATSAMA5D2/UART/main.c
index 3381bc6b2..2f57ac0ad 100644
--- a/testhal/ATSAMA5D2/UART/main.c
+++ b/testhal/ATSAMA5D2/UART/main.c
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/testhal/ATSAMA5D2/UART/mcuconf.h b/testhal/ATSAMA5D2/UART/mcuconf.h
index 3324bccd9..4466ef90b 100644
--- a/testhal/ATSAMA5D2/UART/mcuconf.h
+++ b/testhal/ATSAMA5D2/UART/mcuconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.