• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_include.h>
18 #include <driver/hal/hal_flash_types.h>
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 #define BK_ERR_FLASH_NOT_INIT             (BK_ERR_FLASH_BASE - 1) /**< FLASH driver not init */
25 #define BK_ERR_FLASH_ADDR_OUT_OF_RANGE    (BK_ERR_FLASH_BASE - 2) /**< FLASH address is out of range */
26 #define BK_ERR_FLASH_PARTITION_NOT_FOUND  (BK_ERR_FLASH_BASE - 3) /**< FLASH partition not found */
27 
28 typedef enum
29 {
30 	FLASH_LINE_MODE_TWO = 2,  /**< flash line mode 2 */
31 	FLASH_LINE_MODE_FOUR = 4, /**< flash line mode 4 */
32 } flash_line_mode_t;
33 
34 typedef enum
35 {
36 	FLASH_PROTECT_NONE = 0,     /**< flash protect type none */
37 	FLASH_PROTECT_ALL,          /**< flash protect type all */
38 	FLASH_PROTECT_HALF,         /**< flash protect type half */
39 	FLASH_UNPROTECT_LAST_BLOCK, /**< flash protect type unprotect last block */
40 } flash_protect_type_t;
41 
42 typedef enum {
43     FLASH_SPEED_HIGH = 0,
44     FLASH_SPEED_LOW,
45 } flash_speed_type_t;
46 
47 typedef enum {
48     FLASH_ATE = 0,
49     FLASH_MAC,
50 } flash_ctrl_module_t;
51 
52 #define FLASH_ATE_BIT            (1UL<<(FLASH_ATE))
53 #define FLASH_MAC_BIT            (1UL<<(FLASH_MAC))
54 
55 typedef void (*flash_ps_callback_t)(void);
56 
57 #ifdef __cplusplus
58 }
59 #endif
60 
61