|
| 1 | +/* |
| 2 | + * Copyright (c) 2025 Nordic Semiconductor ASA |
| 3 | + * |
| 4 | + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause |
| 5 | + */ |
| 6 | + |
| 7 | +#ifndef SOFTPERIPHERAL_REGIF_H__ |
| 8 | +#define SOFTPERIPHERAL_REGIF_H__ |
| 9 | + |
| 10 | +/* Shared between Host and Service, varies between platforms. */ |
| 11 | +#if defined(NRF54L15_XXAA) |
| 12 | +#define SP_VPR_EVENT_IDX 20 |
| 13 | +#define NRF_VPR NRF_VPR00 |
| 14 | +#define SP_VPR_TASK_DPPI_0_IDX 16 // Channel 0 |
| 15 | +#define SP_VPR_TASK_CONFIG_IDX 18 |
| 16 | +#define SP_VPR_TASK_ACTION_IDX 19 |
| 17 | +#define SP_VPR_TASK_STOP_IDX 21 |
| 18 | +#define SP_VPR_TASK_PROTOCOL_SPECIFIC_IDX 22 |
| 19 | +#define SP_VPR_IRQHandler VPR00_IRQHandler |
| 20 | +#define SP_VPR_IRQn VPR00_IRQn |
| 21 | +#define SP_VPR_BASE_FREQ_HZ 128000000 |
| 22 | +#elif defined(NRF54H20_XXAA) |
| 23 | +#define SP_VPR_EVENT_IDX 28 |
| 24 | +#define NRF_VPR NRF_VPR121 |
| 25 | +#define SP_VPR_TASK_DPPI_0_IDX 24 // Channel 0 |
| 26 | +#define SP_VPR_TASK_CONFIG_IDX 16 |
| 27 | +#define SP_VPR_TASK_ACTION_IDX 17 |
| 28 | +#define SP_VPR_TASK_STOP_IDX 22 |
| 29 | +#define SP_VPR_TASK_PROTOCOL_SPECIFIC_IDX 23 |
| 30 | +#define SP_VPR_IRQHandler VPR121_IRQHandler |
| 31 | +#define SP_VPR_IRQn VPR121_IRQn |
| 32 | +#define SP_VPR_BASE_FREQ_HZ 320000000 |
| 33 | +#else |
| 34 | +#pragma warning "Processor not defined." |
| 35 | +#endif |
| 36 | + |
| 37 | +#if defined(NRF_APPLICATION) |
| 38 | + |
| 39 | +#ifndef SP_VPR_FIRMWARE_ADDRESS |
| 40 | +#define SP_VPR_FIRMWARE_ADDRESS 0x00040000 |
| 41 | +#endif |
| 42 | + |
| 43 | +/* Config Synchronization Barrier (ASB). */ |
| 44 | +#if 1 |
| 45 | +#define __XSBx(R, P, T) \ |
| 46 | + do { \ |
| 47 | + nrf_qspi2_core_dr_x(R, m_task_count, 20); \ |
| 48 | + nrf_vpr_task_trigger(P, (nrf_vpr_task_t)offsetof(NRF_VPR_Type, TASKS_TRIGGER[T])); \ |
| 49 | + while (m_task_count != nrf_qspi2_core_dr_x_get(R, 21)) { \ |
| 50 | + __NOP(); \ |
| 51 | + __NOP(); \ |
| 52 | + __NOP(); \ |
| 53 | + } \ |
| 54 | + m_task_count++; \ |
| 55 | + } while (0); |
| 56 | +#else |
| 57 | +#define __XSBx(R, P, T) \ |
| 58 | + do { \ |
| 59 | + nrf_vpr_task_trigger(P, (nrf_vpr_task_t)offsetof(NRF_VPR_Type, TASKS_TRIGGER[T])); \ |
| 60 | + } while (0); |
| 61 | +#endif |
| 62 | + |
| 63 | +#define __CSB(R) __XSBx(R, NRF_VPR, SP_VPR_TASK_CONFIG_IDX); |
| 64 | +#define __ASB(R) __XSBx(R, NRF_VPR, SP_VPR_TASK_ACTION_IDX); |
| 65 | +#define __SSB(R) __XSBx(R, NRF_VPR, SP_VPR_TASK_STOP_IDX); |
| 66 | +#define __PSB(R) __XSBx(R, NRF_VPR, SP_VPR_TASK_PROTOCOL_SPECIFIC_IDX); |
| 67 | +#endif |
| 68 | + |
| 69 | +#endif // SOFTPERIPHERAL_REGIF_H__ |
0 commit comments