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) {
86
86
SCB -> SCR |= SCB_SCR_SEVONPEND_Msk ;
87
87
#endif
88
88
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
-
93
89
pendsv_init ();
94
90
soft_timer_init ();
95
91
@@ -102,6 +98,10 @@ int main(int argc, char **argv) {
102
98
// Set the flash divisor to an appropriate value
103
99
rp2_flash_set_timing ();
104
100
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
+
105
105
#if MICROPY_HW_ENABLE_UART_REPL
106
106
bi_decl (bi_program_feature ("UART REPL" ))
107
107
setup_default_uart ();
Original file line number Diff line number Diff line change 9
9
size_t __no_inline_not_in_flash_func (psram_detect )() {
10
10
int psram_size = 0 ;
11
11
12
- uint32_t intr_stash = save_and_disable_interrupts ();
13
-
14
12
// Try and read the PSRAM ID via direct_csr.
15
13
qmi_hw -> direct_csr = 30 << QMI_DIRECT_CSR_CLKDIV_LSB | QMI_DIRECT_CSR_EN_BITS ;
16
14
@@ -76,13 +74,14 @@ size_t __no_inline_not_in_flash_func(psram_detect)() {
76
74
}
77
75
}
78
76
79
- restore_interrupts (intr_stash );
80
77
return psram_size ;
81
78
}
82
79
83
80
size_t __no_inline_not_in_flash_func (psram_init )(uint cs_pin ) {
84
81
gpio_set_function (cs_pin , GPIO_FUNC_XIP_CS1 );
85
82
83
+ uint32_t intr_stash = save_and_disable_interrupts ();
84
+
86
85
size_t psram_size = psram_detect ();
87
86
88
87
if (!psram_size ) {
@@ -162,5 +161,7 @@ size_t __no_inline_not_in_flash_func(psram_init)(uint cs_pin) {
162
161
// Enable writes to PSRAM
163
162
hw_set_bits (& xip_ctrl_hw -> ctrl , XIP_CTRL_WRITABLE_M1_BITS );
164
163
164
+ restore_interrupts (intr_stash );
165
+
165
166
return psram_size ;
166
167
}
You can’t perform that action at this time.
0 commit comments