From 47fed25ec96feebc4ad3b9bef85db6e82b1c0e51 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 7 Dec 2024 18:56:37 +0900 Subject: [PATCH 1/2] manifest: update hal_rpi_pico to 2.1.0 release This version of the HAL is based on the 2.1.0 release of the Raspberry Pi Pico SDK. Update `modules/hal_rpi_pico/CMakeLists.txt` to add the new include directories to the build. See https://github.com/raspberrypi/pico-sdk/releases/tag/2.1.0 for more information. Signed-off-by: TOKITA Hiroshi Signed-off-by: Andrew Featherstone --- modules/hal_rpi_pico/CMakeLists.txt | 2 ++ west.yml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/hal_rpi_pico/CMakeLists.txt b/modules/hal_rpi_pico/CMakeLists.txt index 0898795a86d6..0244a324f5e9 100644 --- a/modules/hal_rpi_pico/CMakeLists.txt +++ b/modules/hal_rpi_pico/CMakeLists.txt @@ -69,6 +69,7 @@ if(CONFIG_HAS_RPI_PICO) zephyr_include_directories( ${common_dir}/pico_base_headers/include + ${rp2_common_dir}/boot_bootrom_headers/include ${rp2_common_dir}/hardware_base/include ${rp2_common_dir}/hardware_clocks/include ${rp2_common_dir}/hardware_watchdog/include @@ -82,6 +83,7 @@ if(CONFIG_HAS_RPI_PICO) ${rp2_common_dir}/hardware_ticks/include ${rp2_common_dir}/hardware_sync_spin_lock/include ${rp2_common_dir}/pico_bootrom/include + ${rp2_common_dir}/pico_flash/include ${rp2_common_dir}/pico_platform_compiler/include ${rp2_common_dir}/pico_platform_sections/include ${rp2_common_dir}/pico_platform_panic/include diff --git a/west.yml b/west.yml index 3f1264d187d4..ac5f33c5a20f 100644 --- a/west.yml +++ b/west.yml @@ -224,7 +224,7 @@ manifest: - hal - name: hal_rpi_pico path: modules/hal/rpi_pico - revision: 79ee0f9e058a6327fc943d2f2a19cf3ade107cec + revision: 7b57b24588797e6e7bf18b6bda168e6b96374264 groups: - hal - name: hal_silabs From 7a89fd7c71f7f1f9b45dc07d1663a5968ad21c92 Mon Sep 17 00:00:00 2001 From: Andrew Featherstone Date: Thu, 9 Jan 2025 21:34:21 +0000 Subject: [PATCH 2/2] drivers: counter: rpi_pico_timer: Correct support for RP2350 Changes introduced in 293b9a16cad261f8683da895b4478cfd0e8b8d86 didn't verify correct behaviour when running `TIMER1` with `TIMER0` is paused, and was reporting the wrong tick counter being incremented. Correct this and extend the testing to verify correct behaviour. Signed-off-by: Andrew Featherstone --- drivers/counter/counter_rpi_pico_timer.c | 7 +++++-- .../counter/counter_basic_api/socs/rp2350a_m33.overlay | 7 +++++++ 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 tests/drivers/counter/counter_basic_api/socs/rp2350a_m33.overlay diff --git a/drivers/counter/counter_rpi_pico_timer.c b/drivers/counter/counter_rpi_pico_timer.c index 81dd5672c500..ae07dc678a1c 100644 --- a/drivers/counter/counter_rpi_pico_timer.c +++ b/drivers/counter/counter_rpi_pico_timer.c @@ -68,7 +68,9 @@ static uint32_t counter_rpi_pico_timer_get_top_value(const struct device *dev) static int counter_rpi_pico_timer_get_value(const struct device *dev, uint32_t *ticks) { - *ticks = time_us_32(); + const struct counter_rpi_pico_timer_config *config = dev->config; + + *ticks = timer_time_us_32(config->timer); return 0; } @@ -158,6 +160,7 @@ static int counter_rpi_pico_timer_set_guard_period(const struct device *dev, uin static void counter_rpi_pico_irq_handle(uint32_t ch, void *arg) { struct device *dev = arg; + const struct counter_rpi_pico_timer_config *config = dev->config; struct counter_rpi_pico_timer_data *data = dev->data; counter_alarm_callback_t cb = data->ch_data[ch].callback; void *user_data = data->ch_data[ch].user_data; @@ -165,7 +168,7 @@ static void counter_rpi_pico_irq_handle(uint32_t ch, void *arg) if (cb) { data->ch_data[ch].callback = NULL; data->ch_data[ch].user_data = NULL; - cb(dev, ch, time_us_32(), user_data); + cb(dev, ch, timer_time_us_32(config->timer), user_data); } } diff --git a/tests/drivers/counter/counter_basic_api/socs/rp2350a_m33.overlay b/tests/drivers/counter/counter_basic_api/socs/rp2350a_m33.overlay new file mode 100644 index 000000000000..a8cb086263c0 --- /dev/null +++ b/tests/drivers/counter/counter_basic_api/socs/rp2350a_m33.overlay @@ -0,0 +1,7 @@ +&timer0 { + status = "okay"; +}; + +&timer1 { + status = "okay"; +};