Skip to content

Commit 551bbcb

Browse files
authored
Merge branch 'raspberrypi:develop' into develop
2 parents f7e2250 + b1676c1 commit 551bbcb

File tree

5 files changed

+200
-4
lines changed

5 files changed

+200
-4
lines changed
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
/*
2+
* Copyright (c) 2024 Raspberry Pi (Trading) Ltd.
3+
*
4+
* SPDX-License-Identifier: BSD-3-Clause
5+
*/
6+
7+
// -----------------------------------------------------
8+
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
9+
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
10+
// -----------------------------------------------------
11+
// Board definition for the SparkFun IoT RedBoard - RP2350
12+
//
13+
// This header may be included by other board headers as "boards/sparkfun_iotredboard_rp2350.h"
14+
15+
// pico_cmake_set PICO_PLATFORM=rp2350
16+
// pico_cmake_set PICO_CYW43_SUPPORTED = 1
17+
18+
#ifndef _BOARDS_SPARKFUN_IOTREDBOARD_RP2350_H
19+
#define _BOARDS_SPARKFUN_IOTREDBOARD_RP2350_H
20+
21+
// For board detection
22+
#define SPARKFUN_IOTREDBOARD_RP2350
23+
24+
// --- RP2350 VARIANT ---
25+
#define PICO_RP2350A 0 // 1 for RP2350A, 0 for RP2350B
26+
27+
// --- BOARD SPECIFIC ---
28+
#define SPARKFUN_IOTREDBOARD_RP2350_USER_SW_PIN 39
29+
#define SPARKFUN_IOTREDBOARD_RP2350_PSRAM_CS_PIN 47
30+
31+
32+
// --- UART ---
33+
#ifndef PICO_DEFAULT_UART
34+
#define PICO_DEFAULT_UART 0
35+
#endif
36+
#ifndef PICO_DEFAULT_UART_TX_PIN
37+
#define PICO_DEFAULT_UART_TX_PIN 0
38+
#endif
39+
#ifndef PICO_DEFAULT_UART_RX_PIN
40+
#define PICO_DEFAULT_UART_RX_PIN 1
41+
#endif
42+
43+
// --- LED ---
44+
#ifndef PICO_DEFAULT_LED_PIN
45+
#define PICO_DEFAULT_LED_PIN 25
46+
#endif
47+
48+
#ifndef PICO_DEFAULT_WS2812_PIN
49+
#define PICO_DEFAULT_WS2812_PIN 3
50+
#endif
51+
52+
// --- I2C --- Qwiic connector is on these pins
53+
#ifndef PICO_DEFAULT_I2C
54+
#define PICO_DEFAULT_I2C 0
55+
#endif
56+
#ifndef PICO_DEFAULT_I2C_SDA_PIN
57+
#define PICO_DEFAULT_I2C_SDA_PIN 4
58+
#endif
59+
#ifndef PICO_DEFAULT_I2C_SCL_PIN
60+
#define PICO_DEFAULT_I2C_SCL_PIN 5
61+
#endif
62+
63+
// --- SPI ---
64+
#ifndef PICO_DEFAULT_SPI
65+
#define PICO_DEFAULT_SPI 0
66+
#endif
67+
#ifndef PICO_DEFAULT_SPI_SCK_PIN
68+
#define PICO_DEFAULT_SPI_SCK_PIN 22
69+
#endif
70+
#ifndef PICO_DEFAULT_SPI_TX_PIN
71+
#define PICO_DEFAULT_SPI_TX_PIN 23
72+
#endif
73+
#ifndef PICO_DEFAULT_SPI_RX_PIN
74+
#define PICO_DEFAULT_SPI_RX_PIN 20
75+
#endif
76+
#ifndef PICO_DEFAULT_SPI_CSN_PIN
77+
#define PICO_DEFAULT_SPI_CSN_PIN 21
78+
#endif
79+
80+
// --- FLASH ---
81+
82+
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
83+
84+
#ifndef PICO_FLASH_SPI_CLKDIV
85+
#define PICO_FLASH_SPI_CLKDIV 2
86+
#endif
87+
88+
// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (16 * 1024 * 1024)
89+
#ifndef PICO_FLASH_SIZE_BYTES
90+
#define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024)
91+
#endif
92+
93+
// The IoT RedBoard has an SD Card.
94+
#ifndef PICO_SD_CLK_PIN
95+
#define PICO_SD_CLK_PIN 10
96+
#endif
97+
#ifndef PICO_SD_CMD_PIN
98+
#define PICO_SD_CMD_PIN 11
99+
#endif
100+
#ifndef PICO_SD_DAT0_PIN
101+
#define PICO_SD_DAT0_PIN 8
102+
#endif
103+
#ifndef PICO_SD_DAT3_PIN
104+
#define PICO_SD_DAT3_PIN 9 // DAT3 of the SD card is the chip select pin
105+
#endif
106+
#ifndef PICO_SD_DAT_PIN_COUNT
107+
#define PICO_SD_DAT_PIN_COUNT 1
108+
#endif
109+
110+
// The GPIO Pin used to monitor VSYS. Typically you would use this with ADC.
111+
// There is an example in adc/read_vsys in pico-examples.
112+
#ifndef PICO_VSYS_PIN
113+
#define PICO_VSYS_PIN 46
114+
#endif
115+
116+
// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1
117+
#ifndef PICO_RP2350_A2_SUPPORTED
118+
#define PICO_RP2350_A2_SUPPORTED 1
119+
#endif
120+
121+
// Bootloader activity LED in double reset mode.
122+
#ifndef PICO_BOOTSEL_VIA_DOUBLE_RESET_ACTIVITY_LED
123+
#define PICO_BOOTSEL_VIA_DOUBLE_RESET_ACTIVITY_LED PICO_DEFAULT_LED_PIN
124+
#endif
125+
126+
// Bootloader activity LED in USB reset mode.
127+
#ifndef PICO_STDIO_USB_RESET_BOOTSEL_ACTIVITY_LED
128+
#define PICO_STDIO_USB_RESET_BOOTSEL_ACTIVITY_LED PICO_DEFAULT_LED_PIN
129+
#endif
130+
131+
// --- CYW43 ---
132+
133+
#ifndef CYW43_WL_GPIO_COUNT
134+
#define CYW43_WL_GPIO_COUNT 3
135+
#endif
136+
137+
#ifndef CYW43_WL_GPIO_LED_PIN
138+
#define CYW43_WL_GPIO_LED_PIN 0
139+
#endif
140+
141+
// If CYW43_WL_GPIO_VBUS_PIN is defined then a CYW43 GPIO has to be used to read VBUS.
142+
// This can be passed to cyw43_arch_gpio_get to determine if the device is battery powered.
143+
// PICO_VBUS_PIN and CYW43_WL_GPIO_VBUS_PIN should not both be defined.
144+
#ifndef CYW43_WL_GPIO_VBUS_PIN
145+
#define CYW43_WL_GPIO_VBUS_PIN 2
146+
#endif
147+
148+
// cyw43 SPI pins can't be changed at runtime
149+
#ifndef CYW43_PIN_WL_DYNAMIC
150+
#define CYW43_PIN_WL_DYNAMIC 0
151+
#endif
152+
153+
// gpio pin to power up the cyw43 chip
154+
#ifndef CYW43_DEFAULT_PIN_WL_REG_ON
155+
#define CYW43_DEFAULT_PIN_WL_REG_ON 24u
156+
#endif
157+
158+
// gpio pin for spi data out to the cyw43 chip
159+
#ifndef CYW43_DEFAULT_PIN_WL_DATA_OUT
160+
#define CYW43_DEFAULT_PIN_WL_DATA_OUT 38u
161+
#endif
162+
163+
// gpio pin for spi data in from the cyw43 chip
164+
#ifndef CYW43_DEFAULT_PIN_WL_DATA_IN
165+
#define CYW43_DEFAULT_PIN_WL_DATA_IN 38u
166+
#endif
167+
168+
// gpio (irq) pin for the irq line from the cyw43 chip
169+
#ifndef CYW43_DEFAULT_PIN_WL_HOST_WAKE
170+
#define CYW43_DEFAULT_PIN_WL_HOST_WAKE 38u
171+
#endif
172+
173+
// gpio pin for the spi clock line to the cyw43 chip
174+
#ifndef CYW43_DEFAULT_PIN_WL_CLOCK
175+
#define CYW43_DEFAULT_PIN_WL_CLOCK 37u
176+
#endif
177+
178+
// gpio pin for the spi chip select to the cyw43 chip
179+
#ifndef CYW43_DEFAULT_PIN_WL_CS
180+
#define CYW43_DEFAULT_PIN_WL_CS 36u
181+
#endif
182+
183+
#endif // _BOARDS_SPARKFUN_IOTREDBOARD_RP2350_H

src/host/hardware_sync/include/hardware/sync.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ void restore_interrupts(uint32_t status);
121121

122122
void restore_interrupts_from_disabled(uint32_t status);
123123

124+
void disable_interrupts(void);
125+
126+
void enable_interrupts(void);
127+
124128
uint spin_lock_get_num(spin_lock_t *lock);
125129

126130
spin_lock_t *spin_lock_instance(uint lock_num);

src/host/hardware_sync/sync_core0_only.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ PICO_WEAK_FUNCTION_DEF(restore_interrupts_from_disabled)
3131
void PICO_WEAK_FUNCTION_IMPL_NAME(restore_interrupts_from_disabled)(uint32_t status) {
3232
}
3333

34+
PICO_WEAK_FUNCTION_DEF(disable_interrupts)
35+
36+
void PICO_WEAK_FUNCTION_IMPL_NAME(disable_interrupts)(void) {
37+
}
38+
39+
PICO_WEAK_FUNCTION_DEF(enable_interrupts)
40+
41+
void PICO_WEAK_FUNCTION_IMPL_NAME(enable_interrupts)(void) {
42+
}
3443

3544
PICO_WEAK_FUNCTION_DEF(spin_lock_instance)
3645

src/rp2_common/hardware_sync/include/hardware/sync.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ __force_inline static void __mem_fence_release(void) {
201201
/*! \brief Explicitly disable interrupts on the calling core
202202
* \ingroup hardware_sync
203203
*/
204-
__force_inline static uint32_t disable_interrupts(void) {
204+
__force_inline static void disable_interrupts(void) {
205205
#ifdef __riscv
206206
__compiler_memory_barrier();
207207
riscv_clear_csr(mstatus, 8);
@@ -214,7 +214,7 @@ __force_inline static uint32_t disable_interrupts(void) {
214214
/*! \brief Explicitly enable interrupts on the calling core
215215
* \ingroup hardware_sync
216216
*/
217-
__force_inline static uint32_t enable_interrupts(void) {
217+
__force_inline static void enable_interrupts(void) {
218218
#ifdef __riscv
219219
__compiler_memory_barrier();
220220
riscv_set_csr(mstatus, 8);

src/rp2_common/hardware_sync_spin_lock/include/hardware/sync/spin_lock.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ typedef SW_SPIN_LOCK_TYPE spin_lock_t;
149149
__mem_fence_acquire(); \
150150
})
151151
#else
152-
#error no SW_SPIN_TRY_LOCK available for PICO_USE_SW_SPIN_LOCK on this platform
152+
#error no SW_SPIN_LOCK_LOCK available for PICO_USE_SW_SPIN_LOCK on this platform
153153
#endif
154154
#endif
155155

@@ -210,7 +210,7 @@ typedef SW_SPIN_LOCK_TYPE spin_lock_t;
210210
*(lock) = 0; /* write to spinlock register (release lock) */ \
211211
})
212212
#else
213-
#error no SW_SPIN_TRY_LOCK available for PICO_USE_SW_SPIN_LOCK on this platform
213+
#error no SW_SPIN_LOCK_UNLOCK available for PICO_USE_SW_SPIN_LOCK on this platform
214214
#endif
215215
#endif
216216

0 commit comments

Comments
 (0)