1 /** 2 ****************************************************************************** 3 * @file bl702_sflah_ext.h 4 * @version V1.0 5 * @date 6 * @brief This file is the standard driver header file 7 ****************************************************************************** 8 * @attention 9 * 10 * <h2><center>© COPYRIGHT(c) 2019 Bouffalo Lab</center></h2> 11 * 12 * Redistribution and use in source and binary forms, with or without modification, 13 * are permitted provided that the following conditions are met: 14 * 1. Redistributions of source code must retain the above copyright notice, 15 * this list of conditions and the following disclaimer. 16 * 2. Redistributions in binary form must reproduce the above copyright notice, 17 * this list of conditions and the following disclaimer in the documentation 18 * and/or other materials provided with the distribution. 19 * 3. Neither the name of Bouffalo Lab nor the names of its contributors 20 * may be used to endorse or promote products derived from this software 21 * without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 29 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 30 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 31 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 * 34 ****************************************************************************** 35 */ 36 #ifndef __BL702_SFLAH_EXT_H__ 37 #define __BL702_SFLAH_EXT_H__ 38 39 #include "bflb_sflash.h" 40 #include "bl702_common.h" 41 42 /** @addtogroup BL702_Peripheral_Driver 43 * @{ 44 */ 45 46 /** @addtogroup SFLAH_EXT 47 * @{ 48 */ 49 50 /** @defgroup SFLAH_EXT_Public_Types 51 * @{ 52 */ 53 54 /** 55 * @brief Serail flash protect KH25V40 type definition 56 */ 57 #define SFLASH_KH25V40_PROTECT_NONE 0 /*!< SFlash no protect KH25V40 */ 58 #define SFLASH_KH25V40_PROTECT_448KTO512K 1 /*!< SFlash protect KH25V40 448K to 512K */ 59 #define SFLASH_KH25V40_PROTECT_384KTO512K 2 /*!< SFlash protect KH25V40 384K to 512K */ 60 #define SFLASH_KH25V40_PROTECT_256KTO512K 3 /*!< SFlash protect KH25V40 256K to 512K */ 61 #define SFLASH_KH25V40_PROTECT_ALL 4 /*!< SFlash protect KH25V40 0K to 512K */ 62 63 /*@} end of group SFLAH_EXT_Public_Types */ 64 65 /** @defgroup SFLAH_EXT_Public_Constants 66 * @{ 67 */ 68 69 /*@} end of group SFLAH_EXT_Public_Constants */ 70 71 /** @defgroup SFLAH_EXT_Public_Macros 72 * @{ 73 */ 74 75 /*@} end of group SFLAH_EXT_Public_Macros */ 76 77 /** @defgroup SFLAH_EXT_Public_Functions 78 * @{ 79 */ 80 int bflb_sflash_kh25v40_write_protect(spi_flash_cfg_type *flash_cfg, uint8_t protect); 81 int bflb_sflash_read_reg_with_cmd(spi_flash_cfg_type *flash_cfg, uint8_t read_reg_cmd, uint8_t *reg_value, 82 uint8_t reg_len); 83 int bflb_sflash_write_reg_with_cmd(spi_flash_cfg_type *flash_cfg, uint8_t read_reg_cmd, uint8_t *reg_value, 84 uint8_t reg_len); 85 int bflb_sflash_clear_status_register(spi_flash_cfg_type *p_flash_cfg); 86 87 /*@} end of group SFLAH_EXT_Public_Functions */ 88 89 /*@} end of group SFLAH_EXT */ 90 91 /*@} end of group BL702_Peripheral_Driver */ 92 93 #endif /* __BL702_SFLAH_EXT_H__ */ 94