| /****************************************************************************** |
| * @file flash_mid11325e.h |
| * |
| * @brief for TLSR chips |
| * |
| * @author public@telink-semi.com; |
| * @date Sep. 30, 2010 |
| * |
| * @attention |
| * |
| * Copyright (C) 2019-2020 Telink Semiconductor (Shanghai) Co., Ltd. |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| * |
| *****************************************************************************/ |
| #ifndef __MID11325E_H__ |
| #define __MID11325E_H__ |
| |
| /* |
| * @brief MID = 0x11325e Flash include ZB25WD10A. |
| */ |
| |
| |
| /** |
| * @brief define the section of the protected memory area which is read-only and unalterable. |
| */ |
| typedef enum{ |
| FLASH_LOCK_NONE_MID11325E = 0x00, |
| FLASH_LOCK_LOW_120K_MID11325E = 0x04, //000000h-01DFFFh |
| FLASH_LOCK_LOW_112K_MID11325E = 0x08, //000000h-01BFFFh |
| FLASH_LOCK_LOW_96K_MID11325E = 0x0c, //000000h-017FFFh |
| FLASH_LOCK_LOW_64K_MID11325E = 0x10, //000000h-00FFFFh |
| FLASH_LOCK_ALL_128K_MID11325E = 0x1c, //000000h-01FFFFh |
| }mid11325e_lock_block_e; |
| |
| /** |
| * @brief the range of bits to be modified when writing status. |
| */ |
| typedef enum{ |
| FLASH_WRITE_STATUS_BP_MID11325E = 0x1c, |
| }mid11325e_write_status_bit_e; |
| |
| |
| /** |
| * @brief This function reads the status of flash. |
| * @return the value of status. |
| * @note Attention: Before calling the FLASH function, please check the power supply voltage of the chip. |
| * Only if the detected voltage is greater than the safe voltage value, the FLASH function can be called. |
| * Taking into account the factors such as power supply fluctuations, the safe voltage value needs to be greater |
| * than the minimum chip operating voltage. For the specific value, please make a reasonable setting according |
| * to the specific application and hardware circuit. |
| * |
| * Risk description: When the chip power supply voltage is relatively low, due to the unstable power supply, |
| * there may be a risk of error in the operation of the flash (especially for the write and erase operations. |
| * If an abnormality occurs, the firmware and user data may be rewritten, resulting in the final Product failure) |
| */ |
| unsigned char flash_read_status_mid11325e(void); |
| |
| /** |
| * @brief This function write the status of flash. |
| * @param[in] data - the value of status. |
| * @param[in] bit - the range of bits to be modified when writing status. |
| * @return none. |
| * @note Attention: Before calling the FLASH function, please check the power supply voltage of the chip. |
| * Only if the detected voltage is greater than the safe voltage value, the FLASH function can be called. |
| * Taking into account the factors such as power supply fluctuations, the safe voltage value needs to be greater |
| * than the minimum chip operating voltage. For the specific value, please make a reasonable setting according |
| * to the specific application and hardware circuit. |
| * |
| * Risk description: When the chip power supply voltage is relatively low, due to the unstable power supply, |
| * there may be a risk of error in the operation of the flash (especially for the write and erase operations. |
| * If an abnormality occurs, the firmware and user data may be rewritten, resulting in the final Product failure) |
| */ |
| void flash_write_status_mid11325e(unsigned char data, mid11325e_write_status_bit_e bit); |
| |
| /** |
| * @brief This function serves to set the protection area of the flash. |
| * @param[in] data - refer to the protection area definition in the .h file. |
| * @return none. |
| * @note Attention: Before calling the FLASH function, please check the power supply voltage of the chip. |
| * Only if the detected voltage is greater than the safe voltage value, the FLASH function can be called. |
| * Taking into account the factors such as power supply fluctuations, the safe voltage value needs to be greater |
| * than the minimum chip operating voltage. For the specific value, please make a reasonable setting according |
| * to the specific application and hardware circuit. |
| * |
| * Risk description: When the chip power supply voltage is relatively low, due to the unstable power supply, |
| * there may be a risk of error in the operation of the flash (especially for the write and erase operations. |
| * If an abnormality occurs, the firmware and user data may be rewritten, resulting in the final Product failure) |
| */ |
| void flash_lock_mid11325e(mid11325e_lock_block_e data); |
| |
| /** |
| * @brief This function serves to flash release protection. |
| * @return none. |
| * @note Attention: Before calling the FLASH function, please check the power supply voltage of the chip. |
| * Only if the detected voltage is greater than the safe voltage value, the FLASH function can be called. |
| * Taking into account the factors such as power supply fluctuations, the safe voltage value needs to be greater |
| * than the minimum chip operating voltage. For the specific value, please make a reasonable setting according |
| * to the specific application and hardware circuit. |
| * |
| * Risk description: When the chip power supply voltage is relatively low, due to the unstable power supply, |
| * there may be a risk of error in the operation of the flash (especially for the write and erase operations. |
| * If an abnormality occurs, the firmware and user data may be rewritten, resulting in the final Product failure) |
| */ |
| void flash_unlock_mid11325e(void); |
| |
| |
| #endif |
| |