git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11167 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
58883bb41b
commit
9f73c0dbf6
|
@ -77,6 +77,31 @@
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Driver exported functions. */
|
/* Driver exported functions. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
/**
|
||||||
|
* @brief Configures peripheral security
|
||||||
|
*
|
||||||
|
* @param[in] mtxp pointer to a MATRIX register block.
|
||||||
|
* @param[in] id PERIPHERAL_ID.
|
||||||
|
* @param[in] mode SECURE_PER or NOT_SECURE_PER.
|
||||||
|
*
|
||||||
|
* @retval true Peripheral is not secured.
|
||||||
|
* @retval false Peripheral is secured.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
bool mtxConfigPeriphSecurity(Matrix *mtxp, uint8_t id, bool mode) {
|
||||||
|
|
||||||
|
mtxDisableWP(mtxp);
|
||||||
|
if (mode) {
|
||||||
|
mtxp->MATRIX_SPSELR[id / 32] |= (MATRIX_SPSELR_NSECP0 << id);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mtxp->MATRIX_SPSELR[id / 32] &= ~(MATRIX_SPSELR_NSECP0 << id);
|
||||||
|
}
|
||||||
|
mtxEnableWP(mtxp);
|
||||||
|
|
||||||
|
return (MATRIX0->MATRIX_SPSELR[id / 32] & (MATRIX_SPSELR_NSECP0 << id)) &
|
||||||
|
(MATRIX1->MATRIX_SPSELR[id / 32] & (MATRIX_SPSELR_NSECP0 << id));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Associates slave with a kind of master
|
* @brief Associates slave with a kind of master
|
||||||
|
|
|
@ -37,6 +37,9 @@
|
||||||
#define NOT_SECURE_READ 0x1u
|
#define NOT_SECURE_READ 0x1u
|
||||||
#define NOT_SECURE_WRITE 0x1u
|
#define NOT_SECURE_WRITE 0x1u
|
||||||
|
|
||||||
|
#define SECURE_PER FALSE
|
||||||
|
#define NOT_SECURE_PER TRUE
|
||||||
|
|
||||||
#define NO_DEFAULT_MASTER 0x0u
|
#define NO_DEFAULT_MASTER 0x0u
|
||||||
#define LAST_DEFAULT_MASTER 0x1u
|
#define LAST_DEFAULT_MASTER 0x1u
|
||||||
#define FIXED_DEFAULT_MASTER 0x2u
|
#define FIXED_DEFAULT_MASTER 0x2u
|
||||||
|
@ -90,6 +93,7 @@
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
bool mtxConfigPeriphSecurity(Matrix *mtxp, uint8_t id, bool mode);
|
||||||
void mtxConfigDefaultMaster(Matrix *mtxp, uint8_t slaveID,
|
void mtxConfigDefaultMaster(Matrix *mtxp, uint8_t slaveID,
|
||||||
uint8_t type, uint8_t masterID);
|
uint8_t type, uint8_t masterID);
|
||||||
void mtxConfigSlaveSec(Matrix *mtxp, uint8_t slaveID,
|
void mtxConfigSlaveSec(Matrix *mtxp, uint8_t slaveID,
|
||||||
|
|
Loading…
Reference in New Issue