xiaoxiang781216 commented on code in PR #16244: URL: https://github.com/apache/nuttx/pull/16244#discussion_r2053426125
########## arch/arm/src/rp23xx/rp23xx_start.c: ########## @@ -130,11 +130,23 @@ void __start(void) rp23xx_clockconfig(); rp23xx_boardearlyinitialize(); - /* Initialize all spinlock states */ + /* Initialize all spinlock states + * RP2350-E2 SIO SPINLOCK writes are mirrored at +0x80 offset + * Use only safe SPINLOCKS + * The following SIO spinlocks can be used normally as they do not alias + * with writable registers: 5, 6, 7, 10, 11, and 18 through 31. + */ + + static const uint8_t safe_spinlocks[] = { Review Comment: add g_ prefix and move to the beginning of function or private data section ########## arch/arm/src/rp23xx/rp23xx_start.c: ########## @@ -130,11 +130,23 @@ void __start(void) rp23xx_clockconfig(); rp23xx_boardearlyinitialize(); - /* Initialize all spinlock states */ + /* Initialize all spinlock states + * RP2350-E2 SIO SPINLOCK writes are mirrored at +0x80 offset + * Use only safe SPINLOCKS + * The following SIO spinlocks can be used normally as they do not alias + * with writable registers: 5, 6, 7, 10, 11, and 18 through 31. + */ + + static const uint8_t safe_spinlocks[] = { + 5, 6, 7, 10, 11, + 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31 + }; - for (i = 0; i < 32; i++) + size_t count = sizeof(safe_spinlocks) / sizeof(safe_spinlocks[0]); Review Comment: ```suggestion nitems(safe_spinlocks); ``` and merge into line 147 ########## arch/arm/src/rp23xx/rp23xx_testset.c: ########## @@ -36,7 +36,13 @@ * Pre-processor Definitions ****************************************************************************/ -#define RP23XX_TESTSET_SPINLOCK 0 /* Spinlock used for test and set */ +/* Errata RP2350-E2 SIO SPINLOCK writes are mirrored at +0x80 offset + * Use only safe SPINLOCKS + * The following SIO spinlocks can be used normally as they do not alias + * with writable registers: 5, 6, 7, 10,11, and 18 through 31. + */ + +#define RP23XX_TESTSET_SPINLOCK 7 /* Spinlock used for test and set */ Review Comment: where we use this new macro -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org