VSF Documented
flash.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2022 by VSF Team *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * you may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
7 * *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
9 * *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the flashecific language governing permissions and *
14 * limitations under the License. *
15 * *
16 ****************************************************************************/
17
18#ifndef __HAL_DRIVER_ARTERY_AT32F402_405_FLASH_H__
19#define __HAL_DRIVER_ARTERY_AT32F402_405_FLASH_H__
20
21/*============================ INCLUDES ======================================*/
22
23#include "hal/vsf_hal_cfg.h"
24
25#if VSF_HAL_USE_FLASH == ENABLED
26
27// HW/IPCore
32// HW/IPCore end
33
34/*\note Refer to template/README.md for usage cases.
35 * For peripheral drivers, blackbox mode is recommended but not required, reimplementation part MUST be open.
36 * For IPCore drivers, class structure, MULTI_CLASS configuration, reimplementation and class APIs should be open to user.
37 * For emulated drivers, **** No reimplementation ****.
38 */
39
40/*\note Includes CAN ONLY be put here. */
41/*\note If current header is for a peripheral driver(hw driver), and inherit from an IPCore driver, include IPCore header here. */
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47/*============================ MACROS ========================================*/
48
49// HW
50/*\note hw FLASH driver can reimplement following types:
51 * To enable reimplementation, please enable macro below:
52 * VSF_FLASH_CFG_REIMPLEMENT_TYPE_STATUS for vsf_flash_status_t
53 * VSF_FLASH_CFG_REIMPLEMENT_TYPE_IRQ_MASK for vsf_flash_irq_mask_t
54 * VSF_FLASH_CFG_REIMPLEMENT_TYPE_CFG for vsf_flash_cfg_t
55 * VSF_FLASH_CFG_REIMPLEMENT_TYPE_CAPABILITY for vsf_flash_capability_t
56 * Reimplementation is used for optimization hw/IPCore drivers, reimplement the bit mask according to hw registers.
57 * *** DO NOT reimplement these in emulated drivers. ***
58 */
59
60#define VSF_FLASH_CFG_REIMPLEMENT_TYPE_STATUS ENABLED
61#define VSF_FLASH_CFG_REIMPLEMENT_TYPE_IRQ_MASK ENABLED
62
63// HW end
64
65/*============================ TYPES =========================================*/
66
67// HW/IPCore, not for emulated drivers
68#if VSF_FLASH_CFG_REIMPLEMENT_TYPE_IRQ_MASK == ENABLED
70 // 1: RESERVED in FLASH_STS
72 // 3: RESERVED in FLASH_STS
74 // 6: RESERVED in FLASH_STS
76 // 4: EPPERR(4) in FLASH_STS
78 // 2|4: PRGMERR(2)|EPPERR(4) in FLASH_STS
79 VSF_FLASH_IRQ_WRITE_ERROR_MASK = (1 << 2) | (1 << 4),
80 // 7: RESERVED in FLASH_STS
83#endif
84
85#if VSF_FLASH_CFG_REIMPLEMENT_TYPE_STATUS == ENABLED
86typedef struct vsf_flash_status_t {
87 union {
89 struct {
90 uint32_t is_busy : 1;
91 };
92 };
94#endif
95// HW/IPCore end
96
97/*============================ GLOBAL VARIABLES ==============================*/
98/*============================ PROTOTYPES ====================================*/
99
100#ifdef __cplusplus
101}
102#endif
103
104#endif // VSF_HAL_USE_FLASH
105#endif // __HAL_DRIVER_ARTERY_AT32F402_405_FLASH_H__
106/* EOF */
vsf_flash_irq_mask_t
Definition flash.h:69
@ VSF_FLASH_IRQ_ERASE_MASK
Definition flash.h:71
@ VSF_FLASH_IRQ_READ_MASK
Definition flash.h:75
@ VSF_FLASH_IRQ_WRITE_ERROR_MASK
Definition flash.h:79
@ VSF_FLASH_IRQ_WRITE_MASK
Definition flash.h:73
@ VSF_FLASH_IRQ_ERASE_ERROR_MASK
Definition flash.h:77
@ VSF_FLASH_IRQ_READ_ERROR_MASK
Definition flash.h:81
struct vsf_flash_status_t vsf_flash_status_t
unsigned uint32_t
Definition stdint.h:9
Flash status structure that can be reimplemented in specific HAL drivers.
Definition flash.h:86
Definition vsf_template_hal_driver.h:196
Generated from commit: vsfteam/vsf@368bfa6