1 // Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 #include "sdkconfig.h"
15 #include "esp32h2/rom/spi_flash.h"
16 #include "soc/spi_periph.h"
17 #include "spi_flash_defs.h"
18 
19 #define SPI_IDX   1
20 
esp_rom_spiflash_write_disable(void)21 esp_rom_spiflash_result_t esp_rom_spiflash_write_disable(void)
22 {
23     REG_WRITE(SPI_MEM_CMD_REG(SPI_IDX), SPI_MEM_FLASH_WRDI);
24     while (READ_PERI_REG(PERIPHS_SPI_FLASH_CMD) != 0);
25     return ESP_ROM_SPIFLASH_RESULT_OK;
26 }
27