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 @@ -82,10 +82,6 @@ int main(int argc, char **argv) {
82
82
SCB -> SCR |= SCB_SCR_SEVONPEND_Msk ;
83
83
#endif
84
84
85
- #if defined(MICROPY_HW_PSRAM_CS_PIN ) && MICROPY_HW_ENABLE_PSRAM
86
- size_t psram_size = psram_init (MICROPY_HW_PSRAM_CS_PIN );
87
- #endif
88
-
89
85
pendsv_init ();
90
86
soft_timer_init ();
91
87
@@ -98,6 +94,10 @@ int main(int argc, char **argv) {
98
94
// Set the flash divisor to an appropriate value
99
95
rp2_flash_set_timing ();
100
96
97
+ #if defined(MICROPY_HW_PSRAM_CS_PIN ) && MICROPY_HW_ENABLE_PSRAM
98
+ size_t psram_size = psram_init (MICROPY_HW_PSRAM_CS_PIN );
99
+ #endif
100
+
101
101
#if MICROPY_HW_ENABLE_UART_REPL
102
102
bi_decl (bi_program_feature ("UART REPL" ))
103
103
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