Skip to content

Commit 491afbe

Browse files
SebastianBoetomi-font
authored andcommitted
Platform: Nordic: Port spu_peripheral_config
Port spu_peripheral_config to also support the new API. Signed-off-by: Sebastian Bøe <[email protected]> Change-Id: I1763874ce74ad39cbf0ef256ef8edc669038d226 (cherry picked from commit 3f49abf)
1 parent abba8e0 commit 491afbe

File tree

1 file changed

+28
-0
lines changed
  • platform/ext/target/nordic_nrf/common/core/native_drivers

1 file changed

+28
-0
lines changed

platform/ext/target/nordic_nrf/common/core/native_drivers/spu.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,13 @@ uint32_t spu_regions_sram_get_region_size(void) {
283283
return SRAM_SECURE_ATTRIBUTION_REGION_SIZE;
284284
}
285285

286+
#endif /* NRF_SPU_HAS_MEMORY */
287+
286288
void spu_peripheral_config_secure(const uint32_t periph_base_address, bool periph_lock)
287289
{
288290
uint8_t periph_id = NRFX_PERIPHERAL_ID_GET(periph_base_address);
289291

292+
#if NRF_SPU_HAS_MEMORY
290293
/* ASSERT checking that this is not an explicit Non-Secure peripheral */
291294
NRFX_ASSERT((NRF_SPU->PERIPHID[periph_id].PERM &
292295
SPU_PERIPHID_PERM_SECUREMAPPING_Msk) !=
@@ -297,12 +300,26 @@ void spu_peripheral_config_secure(const uint32_t periph_base_address, bool perip
297300
1 /* Secure */,
298301
1 /* Secure DMA */,
299302
periph_lock);
303+
304+
#else
305+
306+
NRF_SPU_Type * nrf_spu = spu_instance_from_peripheral_addr(periph_base_address);
307+
308+
uint8_t spu_id = NRFX_PERIPHERAL_ID_GET(nrf_spu);
309+
310+
uint8_t index = periph_id - spu_id;
311+
312+
nrf_spu_periph_perm_secattr_set(nrf_spu, index, true /* Secure */);
313+
nrf_spu_periph_perm_dmasec_set(nrf_spu, index, true /* Secure */);
314+
nrf_spu_periph_perm_lock_enable(nrf_spu, index);
315+
#endif
300316
}
301317

302318
void spu_peripheral_config_non_secure(const uint32_t periph_base_address, bool periph_lock)
303319
{
304320
uint8_t periph_id = NRFX_PERIPHERAL_ID_GET(periph_base_address);
305321

322+
#if NRF_SPU_HAS_MEMORY
306323
/* ASSERT checking that this is not an explicit Secure peripheral */
307324
NRFX_ASSERT((NRF_SPU->PERIPHID[periph_id].PERM &
308325
SPU_PERIPHID_PERM_SECUREMAPPING_Msk) !=
@@ -313,4 +330,15 @@ void spu_peripheral_config_non_secure(const uint32_t periph_base_address, bool p
313330
0 /* Non-Secure */,
314331
0 /* Non-Secure DMA */,
315332
periph_lock);
333+
#else
334+
NRF_SPU_Type * nrf_spu = spu_instance_from_peripheral_addr(periph_base_address);
335+
336+
uint8_t spu_id = NRFX_PERIPHERAL_ID_GET(nrf_spu);
337+
338+
uint8_t index = periph_id - spu_id;
339+
340+
nrf_spu_periph_perm_secattr_set(nrf_spu, index, false /* Non-Secure */);
341+
nrf_spu_periph_perm_dmasec_set(nrf_spu, index, false /* Non-Secure */);
342+
nrf_spu_periph_perm_lock_enable(nrf_spu, index);
343+
#endif
316344
}

0 commit comments

Comments
 (0)