1 // Copyright (C) 2022 Beken Corporation 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 15 #pragma once 16 17 #include <common/bk_err.h> 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif 22 23 typedef uint8_t flash_unit_t; /**< flash uint id */ 24 25 typedef enum { 26 FLASH_OP_CMD_WREN = 1, /**< flash command write enable */ 27 FLASH_OP_CMD_WRDI = 2, /**< flash command write disable */ 28 FLASH_OP_CMD_RDSR = 3, /**< flash command read status register */ 29 FLASH_OP_CMD_WRSR = 4, /**< flash command write status register */ 30 FLASH_OP_CMD_READ = 5, /**< flash command read data */ 31 FLASH_OP_CMD_RDSR2 = 6, /**< flash command read status register-2 */ 32 FLASH_OP_CMD_WRSR2 = 7, /**< flash command write status register-2 */ 33 FLASH_OP_CMD_PP = 12, /**< flash command page program */ 34 FLASH_OP_CMD_SE = 13, /**< flash command sector erase */ 35 FLASH_OP_CMD_BE1 = 14, /**< flash command block erase-1 */ 36 FLASH_OP_CMD_BE2 = 15, /**< flash command block erase-2 */ 37 FLASH_OP_CMD_CE = 16, /**< flash command chip erase */ 38 FLASH_OP_CMD_DP = 17, 39 FLASH_OP_CMD_RFDP = 18, 40 FLASH_OP_CMD_RDID = 20, /**< flash command read device id */ 41 FLASH_OP_CMD_HPM = 21, /**< flash command high performance mode */ 42 FLASH_OP_CMD_CRMR = 22, 43 FLASH_OP_CMD_CRMR2 = 23, 44 } flash_op_cmd_t; 45 46 typedef enum 47 { 48 FLASH_MODE_STANDARD = 0, /**< flash standard mode */ 49 FLASH_MODE_DUAL, /**< flash dual mode */ 50 FLASH_MODE_QUAD, /**< flash quad mode */ 51 } flash_mode_t; 52 53 #ifdef __cplusplus 54 } 55 #endif 56 57