From 97434194a718529c9b637d4f8fae71f725824fb3 Mon Sep 17 00:00:00 2001 From: will-v-pi <108662275+will-v-pi@users.noreply.github.com> Date: Wed, 10 Sep 2025 14:40:47 +0100 Subject: [PATCH 1/4] Throw error when not using software spinlocks on RP2350 --- src/common/pico_audio/include/pico/audio.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/common/pico_audio/include/pico/audio.h b/src/common/pico_audio/include/pico/audio.h index 2059bcc..206d216 100644 --- a/src/common/pico_audio/include/pico/audio.h +++ b/src/common/pico_audio/include/pico/audio.h @@ -24,13 +24,21 @@ extern "C" { // PICO_CONFIG: SPINLOCK_ID_AUDIO_FREE_LIST_LOCK, Spinlock number for the audio free list, min=0, max=31, default=6, group=audio #ifndef SPINLOCK_ID_AUDIO_FREE_LIST_LOCK +#if PICO_RP2350 && !PICO_USE_SW_SPIN_LOCKS +#error "When not using software spin locks on RP2350, you must define SPINLOCK_ID_AUDIO_FREE_LIST_LOCK, accounting for Errata E2 and the SDK spin lock IDs" +#else #define SPINLOCK_ID_AUDIO_FREE_LIST_LOCK 6 #endif +#endif // PICO_CONFIG: SPINLOCK_ID_AUDIO_PREPARED_LISTS_LOCK, Spinlock number for the audio prepared list, min=0, max=31, default=7, group=audio #ifndef SPINLOCK_ID_AUDIO_PREPARED_LISTS_LOCK +#if PICO_RP2350 && !PICO_USE_SW_SPIN_LOCKS +#error "When not using software spin locks on RP2350, you must define SPINLOCK_ID_AUDIO_PREPARED_LISTS_LOCK, accounting for Errata E2 and the SDK spin lock IDs" +#else #define SPINLOCK_ID_AUDIO_PREPARED_LISTS_LOCK 7 #endif +#endif // PICO_CONFIG: PICO_AUDIO_NOOP, Enable/disable audio by forcing NOOPS, type=bool, default=0, group=audio #ifndef PICO_AUDIO_NOOP From 2c6e8f4bbba66ede75f09da8e0a750c2985c33f9 Mon Sep 17 00:00:00 2001 From: will-v-pi <108662275+will-v-pi@users.noreply.github.com> Date: Wed, 10 Sep 2025 14:44:32 +0100 Subject: [PATCH 2/4] scanvideo too --- .../include/pico/scanvideo/scanvideo_base.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/common/pico_scanvideo/include/pico/scanvideo/scanvideo_base.h b/src/common/pico_scanvideo/include/pico/scanvideo/scanvideo_base.h index 645d0fd..343a9d5 100644 --- a/src/common/pico_scanvideo/include/pico/scanvideo/scanvideo_base.h +++ b/src/common/pico_scanvideo/include/pico/scanvideo/scanvideo_base.h @@ -319,20 +319,36 @@ extern void scanvideo_default_configure_pio(pio_hw_t *pio, uint sm, uint offset, #endif #ifndef PICO_SPINLOCK_ID_VIDEO_SCANLINE_LOCK +#if PICO_RP2350 && !PICO_USE_SW_SPIN_LOCKS +#error "When not using software spin locks on RP2350, you must explicitly define the pico-extras spinlock IDs, accounting for Errata E2 and the SDK spin lock IDs" +#else #define PICO_SPINLOCK_ID_VIDEO_SCANLINE_LOCK 2 #endif +#endif #ifndef PICO_SPINLOCK_ID_VIDEO_FREE_LIST_LOCK +#if PICO_RP2350 && !PICO_USE_SW_SPIN_LOCKS +#error "When not using software spin locks on RP2350, you must explicitly define the pico-extras spinlock IDs, accounting for Errata E2 and the SDK spin lock IDs" +#else #define PICO_SPINLOCK_ID_VIDEO_FREE_LIST_LOCK 3 #endif +#endif #ifndef PICO_SPINLOCK_ID_VIDEO_DMA_LOCK +#if PICO_RP2350 && !PICO_USE_SW_SPIN_LOCKS +#error "When not using software spin locks on RP2350, you must explicitly define the pico-extras spinlock IDs, accounting for Errata E2 and the SDK spin lock IDs" +#else #define PICO_SPINLOCK_ID_VIDEO_DMA_LOCK 4 #endif +#endif #ifndef PICO_SPINLOCK_ID_VIDEO_IN_USE_LOCK +#if PICO_RP2350 && !PICO_USE_SW_SPIN_LOCKS +#error "When not using software spin locks on RP2350, you must explicitly define the pico-extras spinlock IDs, accounting for Errata E2 and the SDK spin lock IDs" +#else #define PICO_SPINLOCK_ID_VIDEO_IN_USE_LOCK 5 #endif +#endif // note this is not necessarily an absolute gpio pin mask, it is still shifted by PICO_SCANVIDEO_COLOR_PIN_BASE #define PICO_SCANVIDEO_ALPHA_MASK (1u << PICO_SCANVIDEO_ALPHA_PIN) From de5b8c6870ecf756bbcee6a431215384f4a8f7f0 Mon Sep 17 00:00:00 2001 From: will-v-pi <108662275+will-v-pi@users.noreply.github.com> Date: Wed, 10 Sep 2025 14:45:05 +0100 Subject: [PATCH 3/4] Update error message --- src/common/pico_audio/include/pico/audio.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/pico_audio/include/pico/audio.h b/src/common/pico_audio/include/pico/audio.h index 206d216..612bbc0 100644 --- a/src/common/pico_audio/include/pico/audio.h +++ b/src/common/pico_audio/include/pico/audio.h @@ -25,7 +25,7 @@ extern "C" { // PICO_CONFIG: SPINLOCK_ID_AUDIO_FREE_LIST_LOCK, Spinlock number for the audio free list, min=0, max=31, default=6, group=audio #ifndef SPINLOCK_ID_AUDIO_FREE_LIST_LOCK #if PICO_RP2350 && !PICO_USE_SW_SPIN_LOCKS -#error "When not using software spin locks on RP2350, you must define SPINLOCK_ID_AUDIO_FREE_LIST_LOCK, accounting for Errata E2 and the SDK spin lock IDs" +#error "When not using software spin locks on RP2350, you must explicitly define the pico-extras spinlock IDs, accounting for Errata E2 and the SDK spin lock IDs" #else #define SPINLOCK_ID_AUDIO_FREE_LIST_LOCK 6 #endif @@ -34,7 +34,7 @@ extern "C" { // PICO_CONFIG: SPINLOCK_ID_AUDIO_PREPARED_LISTS_LOCK, Spinlock number for the audio prepared list, min=0, max=31, default=7, group=audio #ifndef SPINLOCK_ID_AUDIO_PREPARED_LISTS_LOCK #if PICO_RP2350 && !PICO_USE_SW_SPIN_LOCKS -#error "When not using software spin locks on RP2350, you must define SPINLOCK_ID_AUDIO_PREPARED_LISTS_LOCK, accounting for Errata E2 and the SDK spin lock IDs" +#error "When not using software spin locks on RP2350, you must explicitly define the pico-extras spinlock IDs, accounting for Errata E2 and the SDK spin lock IDs" #else #define SPINLOCK_ID_AUDIO_PREPARED_LISTS_LOCK 7 #endif From 3c1fc67a1db5c51d8d6cb070f6c1b45377e0e636 Mon Sep 17 00:00:00 2001 From: will-v-pi <108662275+will-v-pi@users.noreply.github.com> Date: Thu, 11 Sep 2025 18:40:26 +0100 Subject: [PATCH 4/4] Apply suggestions from code review --- src/common/pico_audio/include/pico/audio.h | 4 ++-- .../include/pico/scanvideo/scanvideo_base.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/common/pico_audio/include/pico/audio.h b/src/common/pico_audio/include/pico/audio.h index 612bbc0..ffb9e33 100644 --- a/src/common/pico_audio/include/pico/audio.h +++ b/src/common/pico_audio/include/pico/audio.h @@ -25,7 +25,7 @@ extern "C" { // PICO_CONFIG: SPINLOCK_ID_AUDIO_FREE_LIST_LOCK, Spinlock number for the audio free list, min=0, max=31, default=6, group=audio #ifndef SPINLOCK_ID_AUDIO_FREE_LIST_LOCK #if PICO_RP2350 && !PICO_USE_SW_SPIN_LOCKS -#error "When not using software spin locks on RP2350, you must explicitly define the pico-extras spinlock IDs, accounting for Errata E2 and the SDK spin lock IDs" +#error "When not using software spin locks on RP2350, you must explicitly define SPINLOCK_ID_AUDIO_FREE_LIST_LOCK, taking Errata RP2350-E2 and the SDK spin lock IDs into account" #else #define SPINLOCK_ID_AUDIO_FREE_LIST_LOCK 6 #endif @@ -34,7 +34,7 @@ extern "C" { // PICO_CONFIG: SPINLOCK_ID_AUDIO_PREPARED_LISTS_LOCK, Spinlock number for the audio prepared list, min=0, max=31, default=7, group=audio #ifndef SPINLOCK_ID_AUDIO_PREPARED_LISTS_LOCK #if PICO_RP2350 && !PICO_USE_SW_SPIN_LOCKS -#error "When not using software spin locks on RP2350, you must explicitly define the pico-extras spinlock IDs, accounting for Errata E2 and the SDK spin lock IDs" +#error "When not using software spin locks on RP2350, you must explicitly define SPINLOCK_ID_AUDIO_PREPARED_LISTS_LOCK, taking Errata RP2350-E2 and the SDK spin lock IDs into account" #else #define SPINLOCK_ID_AUDIO_PREPARED_LISTS_LOCK 7 #endif diff --git a/src/common/pico_scanvideo/include/pico/scanvideo/scanvideo_base.h b/src/common/pico_scanvideo/include/pico/scanvideo/scanvideo_base.h index 343a9d5..4e7a25d 100644 --- a/src/common/pico_scanvideo/include/pico/scanvideo/scanvideo_base.h +++ b/src/common/pico_scanvideo/include/pico/scanvideo/scanvideo_base.h @@ -320,7 +320,7 @@ extern void scanvideo_default_configure_pio(pio_hw_t *pio, uint sm, uint offset, #ifndef PICO_SPINLOCK_ID_VIDEO_SCANLINE_LOCK #if PICO_RP2350 && !PICO_USE_SW_SPIN_LOCKS -#error "When not using software spin locks on RP2350, you must explicitly define the pico-extras spinlock IDs, accounting for Errata E2 and the SDK spin lock IDs" +#error "When not using software spin locks on RP2350, you must explicitly define PICO_SPINLOCK_ID_VIDEO_SCANLINE_LOCK, taking Errata RP2350-E2 and the SDK spin lock IDs into account" #else #define PICO_SPINLOCK_ID_VIDEO_SCANLINE_LOCK 2 #endif @@ -328,7 +328,7 @@ extern void scanvideo_default_configure_pio(pio_hw_t *pio, uint sm, uint offset, #ifndef PICO_SPINLOCK_ID_VIDEO_FREE_LIST_LOCK #if PICO_RP2350 && !PICO_USE_SW_SPIN_LOCKS -#error "When not using software spin locks on RP2350, you must explicitly define the pico-extras spinlock IDs, accounting for Errata E2 and the SDK spin lock IDs" +#error "When not using software spin locks on RP2350, you must explicitly define PICO_SPINLOCK_ID_VIDEO_FREE_LIST_LOCK, taking Errata RP2350-E2 and the SDK spin lock IDs into account" #else #define PICO_SPINLOCK_ID_VIDEO_FREE_LIST_LOCK 3 #endif @@ -336,7 +336,7 @@ extern void scanvideo_default_configure_pio(pio_hw_t *pio, uint sm, uint offset, #ifndef PICO_SPINLOCK_ID_VIDEO_DMA_LOCK #if PICO_RP2350 && !PICO_USE_SW_SPIN_LOCKS -#error "When not using software spin locks on RP2350, you must explicitly define the pico-extras spinlock IDs, accounting for Errata E2 and the SDK spin lock IDs" +#error "When not using software spin locks on RP2350, you must explicitly define PICO_SPINLOCK_ID_VIDEO_DMA_LOCK, taking Errata RP2350-E2 and the SDK spin lock IDs into account" #else #define PICO_SPINLOCK_ID_VIDEO_DMA_LOCK 4 #endif @@ -344,7 +344,7 @@ extern void scanvideo_default_configure_pio(pio_hw_t *pio, uint sm, uint offset, #ifndef PICO_SPINLOCK_ID_VIDEO_IN_USE_LOCK #if PICO_RP2350 && !PICO_USE_SW_SPIN_LOCKS -#error "When not using software spin locks on RP2350, you must explicitly define the pico-extras spinlock IDs, accounting for Errata E2 and the SDK spin lock IDs" +#error "When not using software spin locks on RP2350, you must explicitly define PICO_SPINLOCK_ID_VIDEO_IN_USE_LOCK, taking Errata RP2350-E2 and the SDK spin lock IDs into account" #else #define PICO_SPINLOCK_ID_VIDEO_IN_USE_LOCK 5 #endif