Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sdp: egpio: Temporary nrf54l15 PDK support #17408

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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: 1 addition & 1 deletion .github/test-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@
- "tests/subsys/suit/**/*"

"CI-test-low-level":
- "applications/sw_io_devices/**/*"
- "applications/sdp/**/*"
- "drivers/gpio/**/*"
- "dts/bindings/gpio/**/*"
- "include/drivers/gpio/**/*"
Expand Down
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ CMakeLists* @nrfconnect/ncs-co-build-system
/applications/matter_weather_station/ @nrfconnect/ncs-matter
/applications/nrf5340_audio/ @nrfconnect/ncs-audio
/applications/nrf_desktop/ @nrfconnect/ncs-si-bluebagel
/applications/sdp/ @masz-nordic
/applications/serial_lte_modem/ @nrfconnect/ncs-co-networking @nrfconnect/ncs-iot-oulu
/applications/serial_lte_modem/src/lwm2m_carrier/ @nrfconnect/ncs-carrier
/applications/sw_io_devices/ @masz-nordic
/applications/zigbee_weather_station/ @milewr
/applications/**/*.rst @nrfconnect/ncs-doc-owners

Expand Down
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";
};
};
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 16>, <&cpuflpr_vevif_tx 15>;
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 16>, <&cpuflpr_vevif_tx 15>;
mbox-names = "rx", "tx";
};
};
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__ */
1 change: 1 addition & 0 deletions applications/sdp/gpio/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_MBOX=y
37 changes: 37 additions & 0 deletions applications/sdp/gpio/sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
sample:
name: eGPIO application
description: SW-defined GPIO application
common:
integration_platforms:
- nrf54l15dk/nrf54l15/cpuflpr
tests:
applications.sdp.egpio_mbox:
build_only: true
platform_allow: nrf54l15dk/nrf54l15/cpuflpr
tags: ci_build 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
tags: ci_build 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

applications.sdp.egpio_icmsg_pdk:
build_only: true
platform_allow: nrf54l15pdk/nrf54l15/cpuflpr
tags: ci_build gpio
extra_args:
EXTRA_DTC_OVERLAY_FILE="./boards/nrf54l15pdk_nrf54l15_cpuflpr_icmsg.overlay"
extra_configs:
- CONFIG_GPIO_NRFE_EGPIO_BACKEND_ICMSG=y
- CONFIG_IPC_SERVICE=y
- CONFIG_IPC_SERVICE_BACKEND_ICMSG=y

Check warning on line 37 in applications/sdp/gpio/sample.yaml

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

YAMLLint (new-line-at-end-of-file)

applications/sdp/gpio/sample.yaml:37 no new line character at the end of file
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
Loading