Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions applications/sdp/gpio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(emulated_gpio)

target_sources_ifdef(CONFIG_GPIO_NRFE_EGPIO_BACKEND_ICMSG app PRIVATE src/nrfe_icmsg.c)
target_sources_ifdef(CONFIG_GPIO_NRFE_EGPIO_BACKEND_MBOX app PRIVATE src/nrfe_mbox.c)
target_sources(app PRIVATE src/main.c)
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,6 @@
};
};
};

ipc {
ipc0: ipc0 {
compatible = "zephyr,ipc-icmsg";
tx-region = <&sram_tx>;
rx-region = <&sram_rx>;
mboxes = <&cpuflpr_vevif_rx 16>, <&cpuflpr_vevif_tx 15>;
mbox-names = "rx", "tx";
status = "okay";
};
};
};

&cpuflpr_vevif_rx {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright (c) 2024 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

/ {
ipc {
ipc0: ipc0 {
compatible = "zephyr,ipc-icmsg";
tx-region = <&sram_tx>;
rx-region = <&sram_rx>;
mboxes = <&cpuflpr_vevif_rx 21>, <&cpuflpr_vevif_tx 20>;
mbox-names = "rx", "tx";
status = "okay";
};
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright (c) 2024 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

/ {
mbox_consumer: mbox_consumer {
compatible = "vnd,mbox-consumer";
mboxes = <&cpuflpr_vevif_rx 21>, <&cpuflpr_vevif_tx 20>;
mbox-names = "rx", "tx";
};
};
44 changes: 0 additions & 44 deletions applications/sdp/gpio/boards/nrf54l15pdk_nrf54l15_cpuflpr.conf

This file was deleted.

77 changes: 0 additions & 77 deletions applications/sdp/gpio/boards/nrf54l15pdk_nrf54l15_cpuflpr.overlay

This file was deleted.

20 changes: 20 additions & 0 deletions applications/sdp/gpio/include/main.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright (c) 2024 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

#ifndef MAIN_H__
#define MAIN_H__

#include <zephyr/kernel.h>
#include <drivers/gpio/nrfe_gpio.h>

#if !defined(CONFIG_GPIO_NRFE_EGPIO_BACKEND_ICMSG) && !defined(CONFIG_GPIO_NRFE_EGPIO_BACKEND_MBOX)
#error "Define communication backend type"
#endif

void process_packet(nrfe_gpio_data_packet_t *packet);
int backend_init(void);

#endif /* MAIN_H__ */
2 changes: 0 additions & 2 deletions applications/sdp/gpio/prj.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
CONFIG_IPC_SERVICE=y
CONFIG_IPC_SERVICE_BACKEND_ICMSG=y
CONFIG_MBOX=y
23 changes: 19 additions & 4 deletions applications/sdp/gpio/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,25 @@ sample:
common:
integration_platforms:
- nrf54l15dk/nrf54l15/cpuflpr
- nrf54l15pdk/nrf54l15/cpuflpr
tests:
applications.sdp.egpio:
applications.sdp.egpio_mbox:
build_only: true
sysbuild: true
platform_allow: nrf54l15dk/nrf54l15/cpuflpr
tags: ci_build sysbuild gpio
extra_args:
EXTRA_DTC_OVERLAY_FILE="./boards/nrf54l15dk_nrf54l15_cpuflpr_mbox.overlay"
extra_configs:
- CONFIG_GPIO_NRFE_EGPIO_BACKEND_MBOX=y

applications.sdp.egpio_icmsg:
build_only: true
platform_allow: nrf54l15dk/nrf54l15/cpuflpr nrf54l15pdk/nrf54l15/cpuflpr
tags: ci_build sysbuild
sysbuild: true
platform_allow: nrf54l15dk/nrf54l15/cpuflpr
tags: ci_build sysbuild gpio
extra_args:
EXTRA_DTC_OVERLAY_FILE="./boards/nrf54l15dk_nrf54l15_cpuflpr_icmsg.overlay"
extra_configs:
- CONFIG_GPIO_NRFE_EGPIO_BACKEND_ICMSG=y
- CONFIG_IPC_SERVICE=y
- CONFIG_IPC_SERVICE_BACKEND_ICMSG=y
52 changes: 6 additions & 46 deletions applications/sdp/gpio/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,14 @@
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

#include "../include/main.h"

#include <zephyr/drivers/gpio.h>
#include <zephyr/dt-bindings/gpio/nordic-nrf-gpio.h>
#include <zephyr/ipc/ipc_service.h>

#include <drivers/gpio/nrfe_gpio.h>

#include <hal/nrf_vpr_csr.h>
#include <hal/nrf_vpr_csr_vio.h>
#include <haly/nrfy_gpio.h>

static struct ipc_ept ep;

volatile uint32_t bound_sem = 1;

static void ep_bound(void *priv)
{
bound_sem = 0;
}

static nrf_gpio_pin_pull_t get_pull(gpio_flags_t flags)
{
if (flags & GPIO_PULL_UP) {
Expand Down Expand Up @@ -122,10 +111,8 @@ static void gpio_nrfe_port_toggle_bits(uint16_t toggle_mask)
nrf_vpr_csr_vio_out_toggle_set(toggle_mask);
}

static void ep_recv(const void *data, size_t len, void *priv)
void process_packet(nrfe_gpio_data_packet_t *packet)
{
nrfe_gpio_data_packet_t *packet = (nrfe_gpio_data_packet_t *)data;

if (packet->port != 2) {
return;
}
Expand Down Expand Up @@ -153,42 +140,15 @@ static void ep_recv(const void *data, size_t len, void *priv)
}
}

static struct ipc_ept_cfg ep_cfg = {
.cb = {
.bound = ep_bound,
.received = ep_recv,
},
};

int main(void)
{
int ret;
const struct device *ipc0_instance;
volatile uint32_t delay = 0;

#if !defined(CONFIG_SYS_CLOCK_EXISTS)
/* Wait a little bit for IPC service to be ready on APP side */
while (delay < 1000) {
delay++;
}
#endif

ipc0_instance = DEVICE_DT_GET(DT_NODELABEL(ipc0));
int ret = 0;

ret = ipc_service_open_instance(ipc0_instance);
if ((ret < 0) && (ret != -EALREADY)) {
return ret;
}

ret = ipc_service_register_endpoint(ipc0_instance, &ep, &ep_cfg);
ret = backend_init();
if (ret < 0) {
return ret;
return 0;
}

/* Wait for endpoint to be bound */
while (bound_sem != 0) {
};

if (!nrf_vpr_csr_rtperiph_enable_check()) {
nrf_vpr_csr_rtperiph_enable_set(true);
}
Expand Down
64 changes: 64 additions & 0 deletions applications/sdp/gpio/src/nrfe_icmsg.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Copyright (c) 2024 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

#include "../include/main.h"
#include <zephyr/ipc/ipc_service.h>

static struct ipc_ept ep;

volatile uint32_t bound_sem = 1;

static void ep_bound(void *priv)
{
bound_sem = 0;
}

static void ep_recv(const void *data, size_t len, void *priv)
{
(void)len;
(void)priv;

process_packet((nrfe_gpio_data_packet_t *)data);
}

static struct ipc_ept_cfg ep_cfg = {
.cb = {
.bound = ep_bound,
.received = ep_recv,
},
};

int backend_init(void)
{
int ret = 0;
const struct device *ipc0_instance;
volatile uint32_t delay = 0;

#if !defined(CONFIG_SYS_CLOCK_EXISTS)
/* Wait a little bit for IPC service to be ready on APP side */
while (delay < 1000) {
delay++;
}
#endif

ipc0_instance = DEVICE_DT_GET(DT_NODELABEL(ipc0));

ret = ipc_service_open_instance(ipc0_instance);
if ((ret < 0) && (ret != -EALREADY)) {
return ret;
}

ret = ipc_service_register_endpoint(ipc0_instance, &ep, &ep_cfg);
if (ret < 0) {
return ret;
}

/* Wait for endpoint to be bound */
while (bound_sem != 0) {
};

return 0;
}
Loading