Skip to content

Commit 70cb0b0

Browse files
committed
softperipheral: rev cf28ddf86b89fb647ee876546770c2676b3bc63c
softperipheral/CHANGELOG.rst contains the list of changes. Signed-off-by: Luis David Lopez <[email protected]>
1 parent f847c69 commit 70cb0b0

File tree

16 files changed

+7261
-0
lines changed

16 files changed

+7261
-0
lines changed

.checkpatch.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@
3131
--exclude gzll
3232
--exclude nfc
3333
--exclude nrf_modem/include
34+
--exclude softperipheral

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,4 @@ doc/* @b-gent
4747
/lc3/ @koffes @alexsven
4848
/nrf_fuel_gauge/ @nordic-auko
4949
/nrf_wifi/ @udaynordic @rajb9 @srkanordic
50+
/softperipheral/ @lopeztel

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ Refer to their respective documentation for more information.
2525
openthread/README
2626
nrf_rpc/README
2727
softdevice_controller/README
28+
softperipheral/README

doc/links.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
.. _`nrfx`: https://github.com/NordicSemiconductor/nrfx/
99

10+
.. _`sdk-nrfxlib`: https://github.com/nrfconnect/sdk-nrfxlib
11+
1012
.. _`TinyCBOR`: https://github.com/zephyrproject-rtos/tinycbor
1113

1214
.. _`zcbor`: https://github.com/NordicSemiconductor/zcbor

softperipheral/README.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.. _soft_peripherals:
2+
3+
Soft peripherals
4+
################
5+
6+
.. contents::
7+
:local:
8+
:depth: 2
9+
10+
This documentation outlines the concept of soft peripherals, designed to emulate hardware peripherals using the Fast Lightweight Peripheral Processor (FLPR).
11+
It covers setup, integration, and operational guidelines for using each soft peripheral through the nrfx driver API, alongside detailed descriptions of limitations and performance considerations.
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
#ifndef SOFTPERIPHERAL_META_H__
8+
#define SOFTPERIPHERAL_META_H__
9+
10+
#include <stdint.h>
11+
12+
#define SOFTPERIPHERAL_META_HEADER_VERSION (1)
13+
14+
#define SOFTPERIPHERAL_META_SOFTPERIPHERAL_ID_SQSPI 0x45b1
15+
16+
#if (SOFTPERIPHERAL_META_HEADER_VERSION == 1)
17+
18+
#define SOFTPERIPHERAL_META_COMM_ID_REGIF (1)
19+
#define SOFTPERIPHERAL_META_COMM_ID_JOBLIST (2)
20+
21+
#define SOFTPERIPHERAL_META_PLATFORM_DEVICE_15 (15)
22+
#define SOFTPERIPHERAL_META_PLATFORM_DEVICE_20 (20)
23+
24+
#define SOFTPERIPHERAL_META_PLATFORM_PLATFORM_L (0)
25+
#define SOFTPERIPHERAL_META_PLATFORM_PLATFORM_H (1)
26+
27+
#define SOFTPERIPHERAL_META_PLATFORM_SERIES_54 (54)
28+
29+
#ifndef SOFTPERIPHERAL_META_SELF_BOOTING
30+
#define SOFTPERIPHERAL_META_SELF_BOOTING (0)
31+
#endif
32+
33+
typedef struct
34+
{
35+
union
36+
{
37+
struct
38+
{
39+
uint32_t magic : 16;
40+
uint32_t header_version : 4;
41+
uint32_t comm_id : 8;
42+
uint32_t reserved0 : 3;
43+
uint32_t self_boot : 1; // If True, set INITPC to NVM address.
44+
// If False, copy fw_code_size bytes from NVM to fw_ram_base_addr
45+
};
46+
47+
uint32_t w0_raw;
48+
};
49+
50+
union
51+
{
52+
struct
53+
{
54+
uint16_t softperiph_id;
55+
56+
union
57+
{
58+
struct
59+
{
60+
uint16_t device : 7;
61+
uint16_t platform : 2;
62+
uint16_t series : 7;
63+
};
64+
65+
uint16_t raw;
66+
} platform;
67+
};
68+
69+
uint32_t w1_raw;
70+
};
71+
72+
union
73+
{
74+
struct
75+
{
76+
uint32_t patch : 16;
77+
uint32_t minor : 8;
78+
uint32_t major : 8;
79+
} version;
80+
81+
uint32_t w2_raw;
82+
};
83+
84+
union
85+
{
86+
struct
87+
{
88+
uint16_t fw_code_size; // size / 16
89+
uint16_t
90+
fw_ram_total_size; // size / 16. Must also include code (RAM CODE region), code RAM (.data/.bss/.stack/.heap), shared and/or allocatable RAM from the FW.
91+
};
92+
93+
uint32_t w3_raw;
94+
};
95+
96+
union
97+
{
98+
uint32_t fw_code_addr; // Address of where the code is compiled to run from.
99+
uint32_t w4_raw;
100+
};
101+
102+
union
103+
{
104+
uint32_t
105+
fw_ram_base_addr; // Dest address for code in case self_boot = False. Also, the RAM start address set by the FW in case of any RAM it needs.
106+
uint32_t w5_raw;
107+
};
108+
109+
union
110+
{
111+
struct
112+
{
113+
uint16_t fw_shared_ram_size; // size / 16
114+
uint16_t fw_shared_ram_addr_offset;
115+
};
116+
117+
uint32_t w6_raw;
118+
};
119+
120+
union
121+
{
122+
uint32_t fw_vpr_save_ctx_addr;
123+
uint32_t w7_raw;
124+
};
125+
} softperipheral_metadata_t;
126+
127+
#endif // (SOFTPERIPHERAL_META_HEADER_VERSION == 1)
128+
129+
#endif // SOFTPERIPHEREAL_META_H__
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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

Comments
 (0)