@@ -685,7 +685,7 @@ pub(crate) mod utils {
685
685
#[ ram]
686
686
fn psram_set_cs_timing ( ) {
687
687
unsafe {
688
- let spi = & * crate :: peripherals:: SPI0 :: PTR ;
688
+ let spi = crate :: peripherals:: SPI0 :: steal ( ) ;
689
689
// SPI0/1 share the cs_hold / cs_setup, cd_hold_time / cd_setup_time registers
690
690
// for PSRAM, so we only need to set SPI0 related registers here
691
691
spi. spi_smem_ac ( )
@@ -705,17 +705,15 @@ pub(crate) mod utils {
705
705
let cs1_io: u8 = PSRAM_CS_IO ;
706
706
if cs1_io == SPI_CS1_GPIO_NUM {
707
707
unsafe {
708
- let iomux = & * esp32s3:: IO_MUX :: PTR ;
709
- iomux
708
+ esp32s3:: IO_MUX :: steal ( )
710
709
. gpio ( cs1_io as usize )
711
710
. modify ( |_, w| w. mcu_sel ( ) . bits ( FUNC_SPICS1_SPICS1 ) ) ;
712
711
}
713
712
} else {
714
713
unsafe {
715
714
esp_rom_gpio_connect_out_signal ( cs1_io, SPICS1_OUT_IDX , false , false ) ;
716
715
717
- let iomux = & * esp32s3:: IO_MUX :: PTR ;
718
- iomux
716
+ esp32s3:: IO_MUX :: steal ( )
719
717
. gpio ( cs1_io as usize )
720
718
. modify ( |_, w| w. mcu_sel ( ) . bits ( PIN_FUNC_GPIO ) ) ;
721
719
}
@@ -1105,7 +1103,7 @@ pub(crate) mod utils {
1105
1103
// requirement
1106
1104
fn config_psram_spi_phases ( ) {
1107
1105
unsafe {
1108
- let spi = & * crate :: peripherals:: SPI0 :: PTR ;
1106
+ let spi = crate :: peripherals:: SPI0 :: steal ( ) ;
1109
1107
// Config Write CMD phase for SPI0 to access PSRAM
1110
1108
spi. cache_sctrl ( )
1111
1109
. modify ( |_, w| w. cache_sram_usr_wcmd ( ) . set_bit ( ) ) ;
@@ -1163,7 +1161,7 @@ pub(crate) mod utils {
1163
1161
#[ ram]
1164
1162
fn spi_flash_set_rom_required_regs ( ) {
1165
1163
// Disable the variable dummy mode when doing timing tuning
1166
- let spi = unsafe { & * crate :: peripherals:: SPI1 :: PTR } ;
1164
+ let spi = unsafe { crate :: peripherals:: SPI1 :: steal ( ) } ;
1167
1165
spi. ddr ( ) . modify ( |_, w| w. spi_fmem_var_dummy ( ) . clear_bit ( ) ) ;
1168
1166
// STR /DTR mode setting is done every time when
1169
1167
// `esp_rom_opiflash_exec_cmd` is called
@@ -1174,9 +1172,7 @@ pub(crate) mod utils {
1174
1172
1175
1173
#[ ram]
1176
1174
fn mspi_pin_init ( ) {
1177
- unsafe {
1178
- esp_rom_opiflash_pin_config ( ) ;
1179
- }
1175
+ unsafe { esp_rom_opiflash_pin_config ( ) } ;
1180
1176
spi_timing_set_pin_drive_strength ( ) ;
1181
1177
// Set F4R4 board pin drive strength. TODO: IDF-3663
1182
1178
}
@@ -1186,7 +1182,7 @@ pub(crate) mod utils {
1186
1182
// For now, set them all to 3. Need to check after QVL test results are out.
1187
1183
// TODO: IDF-3663 Set default clk
1188
1184
unsafe {
1189
- let spi = & * crate :: peripherals:: SPI0 :: PTR ;
1185
+ let spi = crate :: peripherals:: SPI0 :: steal ( ) ;
1190
1186
1191
1187
spi. date ( )
1192
1188
. modify ( |_, w| w. spi_spiclk_pad_drv_ctl_en ( ) . set_bit ( ) ) ;
@@ -1196,10 +1192,11 @@ pub(crate) mod utils {
1196
1192
. modify ( |_, w| w. spi_fmem_spiclk_fun_drv ( ) . bits ( 3 ) ) ;
1197
1193
1198
1194
// Set default mspi d0 ~ d7, dqs pin drive strength
1199
- let pins = & [ 27usize , 28 , 31 , 32 , 33 , 34 , 35 , 36 , 37 ] ;
1195
+ let pins = [ 27usize , 28 , 31 , 32 , 33 , 34 , 35 , 36 , 37 ] ;
1200
1196
for pin in pins {
1201
- let iomux = & * esp32s3:: IO_MUX :: PTR ;
1202
- iomux. gpio ( * pin) . modify ( |_, w| w. fun_drv ( ) . bits ( 3 ) ) ;
1197
+ esp32s3:: IO_MUX :: steal ( )
1198
+ . gpio ( pin)
1199
+ . modify ( |_, w| w. fun_drv ( ) . bits ( 3 ) ) ;
1203
1200
}
1204
1201
}
1205
1202
}
@@ -1284,16 +1281,14 @@ pub(crate) mod utils {
1284
1281
fn init_psram_pins ( ) {
1285
1282
// Set cs1 pin function
1286
1283
unsafe {
1287
- let iomux = & * esp32s3:: IO_MUX :: PTR ;
1288
- iomux
1284
+ esp32s3:: IO_MUX :: steal ( )
1289
1285
. gpio ( OCT_PSRAM_CS1_IO as usize )
1290
1286
. modify ( |_, w| w. mcu_sel ( ) . bits ( FUNC_SPICS1_SPICS1 ) ) ;
1291
1287
}
1292
1288
1293
1289
// Set mspi cs1 drive strength
1294
1290
unsafe {
1295
- let iomux = & * esp32s3:: IO_MUX :: PTR ;
1296
- iomux
1291
+ esp32s3:: IO_MUX :: steal ( )
1297
1292
. gpio ( OCT_PSRAM_CS1_IO as usize )
1298
1293
. modify ( |_, w| w. fun_drv ( ) . bits ( 3 ) ) ;
1299
1294
}
0 commit comments