123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- #ifndef NRF_ACL_H__
- #define NRF_ACL_H__
- #include <nrfx.h>
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define NRF_ACL_REGION_SIZE_MAX (512 * 1024UL)
- typedef enum
- {
- NRF_ACL_PERM_READ_NO_WRITE = ACL_ACL_PERM_WRITE_Msk,
- NRF_ACL_PERM_NO_READ_WRITE = ACL_ACL_PERM_READ_Msk,
- NRF_ACL_PERM_NO_READ_NO_WRITE = ACL_ACL_PERM_READ_Msk | ACL_ACL_PERM_WRITE_Msk
- } nrf_acl_perm_t;
- __STATIC_INLINE void nrf_acl_region_set(NRF_ACL_Type * p_reg,
- uint32_t region_id,
- uint32_t address,
- size_t size,
- nrf_acl_perm_t perm);
- __STATIC_INLINE uint32_t nrf_acl_region_address_get(NRF_ACL_Type * p_reg, uint32_t region_id);
- __STATIC_INLINE size_t nrf_acl_region_size_get(NRF_ACL_Type * p_reg, uint32_t region_id);
- __STATIC_INLINE nrf_acl_perm_t nrf_acl_region_perm_get(NRF_ACL_Type * p_reg, uint32_t region_id);
- #ifndef SUPPRESS_INLINE_IMPLEMENTATION
- __STATIC_INLINE void nrf_acl_region_set(NRF_ACL_Type * p_reg,
- uint32_t region_id,
- uint32_t address,
- size_t size,
- nrf_acl_perm_t perm)
- {
- NRFX_ASSERT(region_id < ACL_REGIONS_COUNT);
- NRFX_ASSERT(address % NRF_FICR->CODEPAGESIZE == 0);
- NRFX_ASSERT(size <= NRF_ACL_REGION_SIZE_MAX);
- NRFX_ASSERT(size != 0);
- p_reg->ACL[region_id].ADDR = address;
- p_reg->ACL[region_id].SIZE = size;
- p_reg->ACL[region_id].PERM = perm;
- }
- __STATIC_INLINE uint32_t nrf_acl_region_address_get(NRF_ACL_Type * p_reg, uint32_t region_id)
- {
- return (uint32_t)p_reg->ACL[region_id].ADDR;
- }
- __STATIC_INLINE size_t nrf_acl_region_size_get(NRF_ACL_Type * p_reg, uint32_t region_id)
- {
- return (size_t)p_reg->ACL[region_id].SIZE;
- }
- __STATIC_INLINE nrf_acl_perm_t nrf_acl_region_perm_get(NRF_ACL_Type * p_reg, uint32_t region_id)
- {
- return (nrf_acl_perm_t)p_reg->ACL[region_id].PERM;
- }
- #endif
- #ifdef __cplusplus
- }
- #endif
- #endif
|