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_CTRL for vsf_flash_ctrl_t
55 * VSF_FLASH_CFG_REIMPLEMENT_TYPE_CFG for vsf_flash_cfg_t
56 * VSF_FLASH_CFG_REIMPLEMENT_TYPE_CAPABILITY for vsf_flash_capability_t
57 * Reimplementation is used for optimization hw/IPCore drivers, reimplement the bit mask according to hw registers.
58 * *** DO NOT reimplement these in emulated drivers. ***
59 */
60
61#define VSF_FLASH_CFG_REIMPLEMENT_TYPE_STATUS ENABLED
62#define VSF_FLASH_CFG_REIMPLEMENT_TYPE_IRQ_MASK ENABLED
63
64// HW end
65
66/*============================ TYPES =========================================*/
67
68// HW/IPCore, not for emulated drivers
69#if VSF_FLASH_CFG_REIMPLEMENT_TYPE_IRQ_MASK == ENABLED
71 // 1: RESERVED in FLASH_STS
73 // 3: RESERVED in FLASH_STS
75 // 6: RESERVED in FLASH_STS
77 // 4: EPPERR(4) in FLASH_STS
79 // 2|4: PRGMERR(2)|EPPERR(4) in FLASH_STS
80 VSF_FLASH_IRQ_WRITE_ERROR_MASK = (1 << 2) | (1 << 4),
81 // 7: RESERVED in FLASH_STS
84#endif
85
86#if VSF_FLASH_CFG_REIMPLEMENT_TYPE_STATUS == ENABLED
87typedef struct vsf_flash_status_t {
88 union {
90 struct {
91 uint32_t is_busy : 1;
92 };
93 };
95#endif
96// HW/IPCore end
97
98/*============================ GLOBAL VARIABLES ==============================*/
99/*============================ PROTOTYPES ====================================*/
100
101#ifdef __cplusplus
102}
103#endif
104
105#endif // VSF_HAL_USE_FLASH
106#endif // __HAL_DRIVER_ARTERY_AT32F402_405_FLASH_H__
107/* EOF */
vsf_flash_irq_mask_t
Definition flash.h:70
struct vsf_flash_status_t vsf_flash_status_t
@ VSF_FLASH_IRQ_ERASE_MASK
Definition flash.h:49
@ VSF_FLASH_IRQ_READ_MASK
Definition flash.h:53
@ VSF_FLASH_IRQ_WRITE_ERROR_MASK
Definition flash.h:58
@ VSF_FLASH_IRQ_WRITE_MASK
Definition flash.h:51
@ VSF_FLASH_IRQ_ERASE_ERROR_MASK
Definition flash.h:56
@ VSF_FLASH_IRQ_READ_ERROR_MASK
Definition flash.h:60
unsigned uint32_t
Definition stdint.h:9
Flash status structure that can be reimplemented in specific HAL drivers.
Definition flash.h:87
Definition vsf_template_hal_driver.h:196
Generated from commit: vsfteam/vsf@84ca6d3