aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/SAMA/SAMA5D2x
diff options
context:
space:
mode:
authorisiora <none@example.com>2017-10-22 21:52:19 +0000
committerisiora <none@example.com>2017-10-22 21:52:19 +0000
commitfd2b5f1738bb568dc8de1ee01e33d2ce39b4eab3 (patch)
treec0bc60642af5805b15935a1be164034f003a68c4 /os/hal/ports/SAMA/SAMA5D2x
parent211dcdd26d5b6355ac217832746b2c2b27a48522 (diff)
downloadChibiOS-fd2b5f1738bb568dc8de1ee01e33d2ce39b4eab3.tar.gz
ChibiOS-fd2b5f1738bb568dc8de1ee01e33d2ce39b4eab3.tar.bz2
ChibiOS-fd2b5f1738bb568dc8de1ee01e33d2ce39b4eab3.zip
Reintegrate sama5d2_dev branch
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10879 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/ports/SAMA/SAMA5D2x')
-rw-r--r--os/hal/ports/SAMA/SAMA5D2x/aic.c47
-rw-r--r--os/hal/ports/SAMA/SAMA5D2x/aic.h12
-rw-r--r--os/hal/ports/SAMA/SAMA5D2x/hal_lld.h16
-rw-r--r--os/hal/ports/SAMA/SAMA5D2x/platform.mk8
-rw-r--r--os/hal/ports/SAMA/SAMA5D2x/sama_cache.c65
-rw-r--r--os/hal/ports/SAMA/SAMA5D2x/sama_cache.h43
-rw-r--r--os/hal/ports/SAMA/SAMA5D2x/sama_matrix.c207
-rw-r--r--os/hal/ports/SAMA/SAMA5D2x/sama_matrix.h110
8 files changed, 481 insertions, 27 deletions
diff --git a/os/hal/ports/SAMA/SAMA5D2x/aic.c b/os/hal/ports/SAMA/SAMA5D2x/aic.c
index 22dc8cbc4..6def5c51a 100644
--- a/os/hal/ports/SAMA/SAMA5D2x/aic.c
+++ b/os/hal/ports/SAMA/SAMA5D2x/aic.c
@@ -18,7 +18,7 @@
* @file SAMA5D2x/aic.c
* @brief SAMA AIC support code.
*
- * @addtogroup COMMON_SAMA5D2x_AIC
+ * @addtogroup SAMA5D2x_AIC
* @{
*/
@@ -70,6 +70,16 @@
aicp->AIC_WPMR = AIC_WPMR_WPKEY_PASSWD; \
}
+/**
+ * @brief Checks if a IRQ priority is within the valid range.
+ * @param[in] prio IRQ priority
+ *
+ * @retval The check result.
+ * @retval FALSE invalid IRQ priority.
+ * @retval TRUE correct IRQ priority.
+ */
+#define SAMA_IRQ_IS_VALID_PRIORITY(prio) ((prio) <= 7U)
+
/*===========================================================================*/
/* Driver exported functions. */
/*===========================================================================*/
@@ -94,11 +104,6 @@ void aicInit(void) {
aic->AIC_SSR = i;
aic->AIC_IDCR = AIC_IDCR_INTD;
}
- /* Clear All pending interrupts flags */
- for (i = 0; i < ID_PERIPH_COUNT; i++) {
- aic->AIC_SSR = i;
- aic->AIC_ICCR = AIC_ICCR_INTCLR;
- }
}
/**
@@ -110,10 +115,14 @@ void aicInit(void) {
*/
void aicSetSourcePriority(uint32_t source, uint8_t priority) {
+#if SAMA_HAL_IS_SECURE
Aic *aic = SAIC;
+#else
+ Aic *aic = AIC;
+#endif
osalDbgCheck(source != ID_SAIC_FIQ);
-
+ osalDbgAssert(SAMA_IRQ_IS_VALID_PRIORITY(priority), "invalid irq priority");
/* Disable write protection */
aicDisableWP(aic);
/* Set source id */
@@ -136,7 +145,11 @@ void aicSetSourcePriority(uint32_t source, uint8_t priority) {
*/
void aicSetSourceHandler(uint32_t source, bool (*handler)(void)) {
+#if SAMA_HAL_IS_SECURE
Aic *aic = SAIC;
+#else
+ Aic *aic = AIC;
+#endif
/* Disable write protection */
aicDisableWP(aic);
@@ -154,7 +167,11 @@ void aicSetSourceHandler(uint32_t source, bool (*handler)(void)) {
*/
void aicSetSpuriousHandler(bool (*handler)(void)) {
+#if SAMA_HAL_IS_SECURE
Aic *aic = SAIC;
+#else
+ Aic *aic = AIC;
+#endif
/* Disable write protection */
aicDisableWP(aic);
@@ -171,7 +188,11 @@ void aicSetSpuriousHandler(bool (*handler)(void)) {
*/
void aicEnableInt(uint32_t source) {
+#if SAMA_HAL_IS_SECURE
Aic *aic = SAIC;
+#else
+ Aic *aic = AIC;
+#endif
aic->AIC_SSR = AIC_SSR_INTSEL(source);
aic->AIC_IECR = AIC_IECR_INTEN;
@@ -184,7 +205,11 @@ void aicEnableInt(uint32_t source) {
*/
void aicDisableInt(uint32_t source) {
+#if SAMA_HAL_IS_SECURE
Aic *aic = SAIC;
+#else
+ Aic *aic = AIC;
+#endif
aic->AIC_SSR = AIC_SSR_INTSEL(source);
aic->AIC_IDCR = AIC_IDCR_INTD;
@@ -197,7 +222,11 @@ void aicDisableInt(uint32_t source) {
*/
void aicClearInt(uint32_t source) {
+#if SAMA_HAL_IS_SECURE
Aic *aic = SAIC;
+#else
+ Aic *aic = AIC;
+#endif
aic->AIC_SSR = AIC_SSR_INTSEL(source);
aic->AIC_ICCR = AIC_ICCR_INTCLR;
@@ -210,7 +239,11 @@ void aicClearInt(uint32_t source) {
*/
void aicSetInt(uint32_t source) {
+#if SAMA_HAL_IS_SECURE
Aic *aic = SAIC;
+#else
+ Aic *aic = AIC;
+#endif
aic->AIC_SSR = AIC_SSR_INTSEL(source);
aic->AIC_ISCR = AIC_ISCR_INTSET;
diff --git a/os/hal/ports/SAMA/SAMA5D2x/aic.h b/os/hal/ports/SAMA/SAMA5D2x/aic.h
index defee9d30..47b8ec173 100644
--- a/os/hal/ports/SAMA/SAMA5D2x/aic.h
+++ b/os/hal/ports/SAMA/SAMA5D2x/aic.h
@@ -18,7 +18,7 @@
* @file SAMA5D2x/aic.h
* @brief SAMA AIC support macros and structures.
*
- * @addtogroup COMMON_SAMA5D2x_AIC
+ * @addtogroup SAMA5D2x_AIC
* @{
*/
@@ -53,9 +53,15 @@
/**
* @brief Acknowledge the current interrupt.
*/
-#define aicAckInt() { \
- SAIC->AIC_EOICR = AIC_EOICR_ENDIT; \
+#if SAMA_HAL_IS_SECURE
+#define aicAckInt() { \
+ SAIC->AIC_EOICR = AIC_EOICR_ENDIT; \
}
+#else
+#define aicAckInt() { \
+ AIC->AIC_EOICR = AIC_EOICR_ENDIT; \
+}
+#endif
/*===========================================================================*/
/* External declarations. */
diff --git a/os/hal/ports/SAMA/SAMA5D2x/hal_lld.h b/os/hal/ports/SAMA/SAMA5D2x/hal_lld.h
index f4dc3839f..13235c724 100644
--- a/os/hal/ports/SAMA/SAMA5D2x/hal_lld.h
+++ b/os/hal/ports/SAMA/SAMA5D2x/hal_lld.h
@@ -35,20 +35,6 @@
#include "sama_registry.h"
-/* If the device type is not externally defined, for example from the Makefile,
- then a file named board.h is included. This file must contain a device
- definition compatible with the vendor include file.*/
-#if !defined (SAMA5D21) && !defined (SAMA5D22) && !defined (SAMA5D23) && \
- !defined (SAMA5D24) && !defined (SAMA5D25) && !defined (SAMA5D26) && \
- !defined (SAMA5D27) && !defined (SAMA5D28)
-#include "board.h"
-#endif
-
-/* Including the device CMSIS header. Note, we are not using the definitions
- from this header because we need this file to be usable also from
- assembler source files. We verify that the info matches instead.*/
-#include "sama5d2x.h"
-
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
@@ -496,7 +482,9 @@
/* Various helpers.*/
#include "sama_pmc.h"
#include "aic.h"
+#include "sama_matrix.h"
#include "sama_xdmac.h"
+#include "sama_cache.h"
#ifdef __cplusplus
extern "C" {
diff --git a/os/hal/ports/SAMA/SAMA5D2x/platform.mk b/os/hal/ports/SAMA/SAMA5D2x/platform.mk
index 8cc24582d..87727c325 100644
--- a/os/hal/ports/SAMA/SAMA5D2x/platform.mk
+++ b/os/hal/ports/SAMA/SAMA5D2x/platform.mk
@@ -1,8 +1,10 @@
# Required platform files.
-PLATFORMSRC := $(CHIBIOS)/os/hal/ports/SAMA/SAMA5D2x/hal_lld.c \
- $(CHIBIOS)/os/hal/ports/SAMA/SAMA5D2x/hal_st_lld.c \
- $(CHIBIOS)/os/hal/ports/SAMA/SAMA5D2x/aic.c
+PLATFORMSRC := $(CHIBIOS)/os/hal/ports/SAMA/SAMA5D2x/hal_lld.c \
+ $(CHIBIOS)/os/hal/ports/SAMA/SAMA5D2x/hal_st_lld.c \
+ $(CHIBIOS)/os/hal/ports/SAMA/SAMA5D2x/aic.c \
+ $(CHIBIOS)/os/hal/ports/SAMA/SAMA5D2x/sama_matrix.c \
+ $(CHIBIOS)/os/hal/ports/SAMA/SAMA5D2x/sama_cache.c
# Required include directories.
PLATFORMINC := $(CHIBIOS)/os/hal/ports/SAMA/SAMA5D2x
diff --git a/os/hal/ports/SAMA/SAMA5D2x/sama_cache.c b/os/hal/ports/SAMA/SAMA5D2x/sama_cache.c
new file mode 100644
index 000000000..f20e9e3db
--- /dev/null
+++ b/os/hal/ports/SAMA/SAMA5D2x/sama_cache.c
@@ -0,0 +1,65 @@
+/*
+ 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.
+*/
+
+/**
+ * @file SAMA5D2x/sama_cache.c
+ * @brief SAMA CACHE support code.
+ *
+ * @addtogroup SAMA5D2x_CACHE
+ * @{
+ */
+
+#include "hal.h"
+
+/**
+ * @brief Invalidate D-Cache Region
+ * @TODO: Extend to L2C
+ *
+ * @param[in] start Pointer to beginning of memory region.
+ * @param[in] length Length of the memory location.
+ */
+void cacheInvalidateRegion(void *start, uint32_t length) {
+
+ uint32_t start_addr = (uint32_t)start;
+ uint32_t end_addr = start_addr + length;
+ uint32_t mva;
+
+ /* Invalidate L1 D-Cache */
+ for (mva = start_addr & ~L1_CACHE_BYTES; mva < end_addr; mva += L1_CACHE_BYTES) {
+ L1C_InvalidateDCacheMVA((uint32_t *)mva);
+ }
+}
+
+/**
+ * @brief Clean D-Cache Region
+ * @TODO: Extend to L2C
+ *
+ * @param[in] start Pointer to beginning of memory region.
+ * @param[in] length Length of the memory location.
+ */
+void cacheCleanRegion(void *start, uint32_t length) {
+
+ uint32_t start_addr = (uint32_t)start;
+ uint32_t end_addr = start_addr + length;
+ uint32_t mva;
+
+ /* Clean L1 D-Cache */
+ for (mva = start_addr & ~L1_CACHE_BYTES; mva < end_addr; mva += L1_CACHE_BYTES) {
+ L1C_CleanDCacheMVA((uint32_t *)mva);
+ }
+}
+
+/** @} */
diff --git a/os/hal/ports/SAMA/SAMA5D2x/sama_cache.h b/os/hal/ports/SAMA/SAMA5D2x/sama_cache.h
new file mode 100644
index 000000000..fe8201438
--- /dev/null
+++ b/os/hal/ports/SAMA/SAMA5D2x/sama_cache.h
@@ -0,0 +1,43 @@
+/*
+ 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.
+*/
+
+/**
+ * @file SAMA5D2x/sama_cache.h
+ * @brief SAMA CACHE support macros and structures.
+ *
+ * @addtogroup SAMA5D2x_CACHE
+ * @{
+ */
+#ifndef SAMA_CACHE_H_
+#define SAMA_CACHE_H_
+
+/*===========================================================================*/
+/* Driver constants. */
+/*===========================================================================*/
+#define L1_CACHE_BYTES 32u
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ extern void cacheInvalidateRegion(void *start, uint32_t length);
+ extern void cacheCleanRegion(void *start, uint32_t length);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SAMA_CACHE_H_ */
+
+/** @} */
diff --git a/os/hal/ports/SAMA/SAMA5D2x/sama_matrix.c b/os/hal/ports/SAMA/SAMA5D2x/sama_matrix.c
new file mode 100644
index 000000000..c8624ea40
--- /dev/null
+++ b/os/hal/ports/SAMA/SAMA5D2x/sama_matrix.c
@@ -0,0 +1,207 @@
+/*
+ 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.
+*/
+
+/**
+ * @file SAMA5D2x/sama_matrix.c
+ * @brief SAMA MATRIX support code.
+ *
+ * @addtogroup SAMA5D2x_MATRIX
+ * @{
+ */
+
+#include "hal.h"
+
+/*===========================================================================*/
+/* Driver local definitions. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver exported variables. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver local types. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver local variables. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver constant */
+/*===========================================================================*/
+#define SCFG_OFFSET 0x40u
+
+/*===========================================================================*/
+/* Driver local macros. */
+/*===========================================================================*/
+#define MATRIX_SCFG(value) (MATRIX_SCFG0 + (value * 4u))
+#define MATRIX_SCFG_FIXED_DEFMSTR(value) MATRIX_SCFG0_FIXED_DEFMSTR(value)
+#define MATRIX_SCFG_DEFMSTR_TYPE(value) MATRIX_SCFG0_DEFMSTR_TYPE(value)
+
+/**
+ * @brief Enable write protection on MATRIX registers block.
+ *
+ * @param[in] mtxp pointer to a MATRIX register block.
+ *
+ * @notapi
+ */
+#define mtxEnableWP(mtxp) { \
+ mtxp->MATRIX_WPMR = MATRIX_WPMR_WPKEY_PASSWD | MATRIX_WPMR_WPEN; \
+}
+
+/**
+ * @brief Disable write protection on MATRIX registers block.
+ *
+ * @param[in] matxp pointer to a MATRIX register block.
+ *
+ * @notapi
+ */
+#define mtxDisableWP(mtxp) { \
+ mtxp->MATRIX_WPMR = MATRIX_WPMR_WPKEY_PASSWD; \
+}
+
+/*===========================================================================*/
+/* Driver exported functions. */
+/*===========================================================================*/
+
+/**
+ * @brief Associates slave with a kind of master
+ * @note masterID is set only if type is fixed default master.
+ * Specifying the number of a master which is not connected
+ * to the selected slave is equivalent to clearing DEFMSTR_TYPE.
+ *
+ * @param[in] mtxp pointer to a MATRIX register block.
+ * @param[in] slaveID Slave MATRIX ID.
+ * @param[in] type Select from
+ * No default master,
+ * Last access master,
+ * Fixed default master.
+ * @param[in] masterID Master MATRIX ID.
+ */
+void mtxConfigDefaultMaster(Matrix *mtxp, uint8_t slaveID,
+ uint8_t type, uint8_t masterID) {
+
+ mtxDisableWP(mtxp);
+
+ volatile uint32_t *scfgAddress = (uint32_t *) ((uint32_t) mtxp + SCFG_OFFSET + (4u * slaveID));
+ *scfgAddress = MATRIX_SCFG_DEFMSTR_TYPE(type);
+
+ if (type == FIXED_DEFAULT_MASTER) {
+ *scfgAddress = MATRIX_SCFG_FIXED_DEFMSTR(masterID);
+ }
+ mtxEnableWP(mtxp);
+}
+
+/**
+ * @brief Configures slave security region
+ *
+ * @param[in] mtxp pointer to a MATRIX register block.
+ * @param[in] slaveID Slave MATRIX ID.
+ * @param[in] selMask Securable area.
+ * @param[in] readMask Secure for read.
+ * @param[in] writeMask Secure for write.
+ */
+void mtxConfigSlaveSec(Matrix *mtxp, uint8_t slaveID,
+ uint8_t selMask, uint8_t readMask,
+ uint8_t writeMask) {
+
+ mtxDisableWP(mtxp);
+ mtxp->MATRIX_SSR[slaveID] = selMask | (readMask << 8) |
+ (writeMask << 16);
+ mtxEnableWP(mtxp);
+}
+
+/**
+ * @brief Configures split area of region
+ *
+ * @param[in] mtxp pointer to a MATRIX register block.
+ * @param[in] slaveID Slave MATRIX ID.
+ * @param[in] areaSize Split size area.
+ * @param[in] mask Region securable area.
+ */
+void mtxSetSlaveSplitAddr(Matrix *mtxp, uint8_t slaveID,
+ uint8_t areaSize, uint8_t mask) {
+
+ mtxDisableWP(mtxp);
+ uint8_t i = mask, j = 0;
+ uint32_t value = 0;
+ for (i = 1; (i <= mask) && (j < 32); i <<= 1, j += 4) {
+ if (i & mask)
+ value |= areaSize << j;
+ }
+ mtxp->MATRIX_SASSR[slaveID] = value;
+ mtxEnableWP(mtxp);
+}
+
+/**
+ * @brief Configures size area of region
+ * @note Not applicable to internal security type
+ *
+ * @param[in] mtxp pointer to a MATRIX register block.
+ * @param[in] slaveID Slave MATRIX ID.
+ * @param[in] areaSize Size of total area.
+ * @param[in] mask Region securable area.
+ */
+void mtxSetSlaveRegionSize(Matrix *mtxp, uint8_t slaveID,
+ uint8_t areaSize, uint8_t mask) {
+
+ osalDbgCheck(slaveID != 0);
+
+ mtxDisableWP(mtxp);
+ uint8_t i = mask, j = 0;
+ uint32_t value = 0;
+ for (i = 1; (i <= mask) && (j < 32 ); i <<= 1, j += 4) {
+ if (i & mask)
+ value |= areaSize << j;
+ }
+ mtxp->MATRIX_SRTSR[slaveID] = value;
+ mtxEnableWP(mtxp);
+}
+
+/**
+ * @brief Changes the mapping of the chip so that the remap area
+ * mirrors the internal ROM or the EBI CS0.
+ */
+void mtxRemapRom(void) {
+
+ AXIMX->AXIMX_REMAP = 0;
+
+ /* Invalidate I-Cache*/
+ L1C_InvalidateICacheAll();
+
+ /* Ivalidate Region */
+ cacheInvalidateRegion((void*)0, IRAM_SIZE);
+}
+
+/**
+ * @brief Changes the mapping of the chip so that the remap area
+ * mirrors the internal ROM or the EBI CS0.
+ */
+void mtxRemapRam(void) {
+
+ AXIMX->AXIMX_REMAP = AXIMX_REMAP_REMAP0;
+
+ /* Invalidate I-Cache*/
+ L1C_InvalidateICacheAll();
+
+ /* Ivalidate Region */
+ cacheCleanRegion((void*)IRAM_ADDR, IRAM_SIZE);
+ /* Ivalidate Region */
+ cacheInvalidateRegion((void*)0, IRAM_SIZE);
+}
+
+/** @} */
diff --git a/os/hal/ports/SAMA/SAMA5D2x/sama_matrix.h b/os/hal/ports/SAMA/SAMA5D2x/sama_matrix.h
new file mode 100644
index 000000000..52a3bb3f1
--- /dev/null
+++ b/os/hal/ports/SAMA/SAMA5D2x/sama_matrix.h
@@ -0,0 +1,110 @@
+/*
+ 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.
+*/
+
+/**
+ * @file SAMA5D2x/sama_matrix.h
+ * @brief SAMA MATRIX support macros and structures.
+ *
+ * @addtogroup SAMA5D2x_MATRIX
+ * @{
+ */
+
+#ifndef SAMA_MATRIX_H
+#define SAMA_MATRIX_H
+
+/*===========================================================================*/
+/* Driver constants. */
+/*===========================================================================*/
+
+#define LOWER_AREA_SECURABLE 0x0u
+#define UPPER_AREA_SECURABLE 0x1u
+
+#define SECURE_READ 0x0u
+#define SECURE_WRITE 0x0u
+#define NOT_SECURE_READ 0x1u
+#define NOT_SECURE_WRITE 0x1u
+
+#define NO_DEFAULT_MASTER 0x0u
+#define LAST_DEFAULT_MASTER 0x1u
+#define FIXED_DEFAULT_MASTER 0x2u
+
+#define REGION_0 (0x1u << 0)
+#define REGION_1 (0x1u << 1)
+#define REGION_2 (0x1u << 2)
+#define REGION_3 (0x1u << 3)
+#define REGION_4 (0x1u << 4)
+#define REGION_5 (0x1u << 5)
+#define REGION_6 (0x1u << 6)
+#define REGION_7 (0x1u << 7)
+
+#define MATRIX_AREA_SIZE_4K 0x0u
+#define MATRIX_AREA_SIZE_8K 0x1u
+#define MATRIX_AREA_SIZE_16K 0x2u
+#define MATRIX_AREA_SIZE_32K 0x3u
+#define MATRIX_AREA_SIZE_64K 0x4u
+#define MATRIX_AREA_SIZE_128K 0x5u
+#define MATRIX_AREA_SIZE_256K 0x6u
+#define MATRIX_AREA_SIZE_512K 0x7u
+#define MATRIX_AREA_SIZE_1M 0x8u
+#define MATRIX_AREA_SIZE_2M 0x9u
+#define MATRIX_AREA_SIZE_4M 0xAu
+#define MATRIX_AREA_SIZE_8M 0xBu
+#define MATRIX_AREA_SIZE_16M 0xCu
+#define MATRIX_AREA_SIZE_32M 0xDu
+#define MATRIX_AREA_SIZE_64M 0xEu
+#define MATRIX_AREA_SIZE_128M 0xFu
+
+/*===========================================================================*/
+/* Driver pre-compile time settings. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver data structures and types. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver macros. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void mtxConfigDefaultMaster(Matrix *mtxp, uint8_t slaveID,
+ uint8_t type, uint8_t masterID);
+ void mtxConfigSlaveSec(Matrix *mtxp, uint8_t slaveID,
+ uint8_t selMask, uint8_t readMask,
+ uint8_t writeMask);
+ void mtxSetSlaveSplitAddr(Matrix *mtxp, uint8_t slaveID,
+ uint8_t area, uint8_t mask);
+ void mtxSetSlaveRegionSize(Matrix *mtxp, uint8_t slaveID,
+ uint8_t areaSize, uint8_t mask);
+ void mtxRemapRom(void);
+ void mtxRemapRam(void);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SAMA_MATRIX_H */
+
+/** @} */