File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -86,10 +86,6 @@ int main(int argc, char **argv) {
8686 SCB -> SCR |= SCB_SCR_SEVONPEND_Msk ;
8787 #endif
8888
89- #if defined(MICROPY_HW_PSRAM_CS_PIN ) && MICROPY_HW_ENABLE_PSRAM
90- size_t psram_size = psram_init (MICROPY_HW_PSRAM_CS_PIN );
91- #endif
92-
9389 pendsv_init ();
9490 soft_timer_init ();
9591
@@ -102,6 +98,10 @@ int main(int argc, char **argv) {
10298 // Set the flash divisor to an appropriate value
10399 rp2_flash_set_timing ();
104100
101+ #if defined(MICROPY_HW_PSRAM_CS_PIN ) && MICROPY_HW_ENABLE_PSRAM
102+ size_t psram_size = psram_init (MICROPY_HW_PSRAM_CS_PIN );
103+ #endif
104+
105105 #if MICROPY_HW_ENABLE_UART_REPL
106106 bi_decl (bi_program_feature ("UART REPL" ))
107107 setup_default_uart ();
Original file line number Diff line number Diff line change 99size_t __no_inline_not_in_flash_func (psram_detect )() {
1010 int psram_size = 0 ;
1111
12- uint32_t intr_stash = save_and_disable_interrupts ();
13-
1412 // Try and read the PSRAM ID via direct_csr.
1513 qmi_hw -> direct_csr = 30 << QMI_DIRECT_CSR_CLKDIV_LSB | QMI_DIRECT_CSR_EN_BITS ;
1614
@@ -76,13 +74,14 @@ size_t __no_inline_not_in_flash_func(psram_detect)() {
7674 }
7775 }
7876
79- restore_interrupts (intr_stash );
8077 return psram_size ;
8178}
8279
8380size_t __no_inline_not_in_flash_func (psram_init )(uint cs_pin ) {
8481 gpio_set_function (cs_pin , GPIO_FUNC_XIP_CS1 );
8582
83+ uint32_t intr_stash = save_and_disable_interrupts ();
84+
8685 size_t psram_size = psram_detect ();
8786
8887 if (!psram_size ) {
@@ -162,5 +161,7 @@ size_t __no_inline_not_in_flash_func(psram_init)(uint cs_pin) {
162161 // Enable writes to PSRAM
163162 hw_set_bits (& xip_ctrl_hw -> ctrl , XIP_CTRL_WRITABLE_M1_BITS );
164163
164+ restore_interrupts (intr_stash );
165+
165166 return psram_size ;
166167}
You can’t perform that action at this time.
0 commit comments