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_N32H76X_N32H78X_FLASH_H__
19#define __HAL_DRIVER_N32H76X_N32H78X_FLASH_H__
20
21/*============================ INCLUDES ======================================*/
22
23#include "hal/vsf_hal_cfg.h"
24
25#if VSF_HAL_USE_FLASH == ENABLED
26
27#include "../../__device.h"
28
29/*\note Refer to template/README.md for usage cases.
30 * For peripheral drivers, blackbox mode is recommended but not required, reimplementation part MUST be open.
31 * For IPCore drivers, class structure, MULTI_CLASS configuration, reimplementation and class APIs should be open to user.
32 * For emulated drivers, **** No reimplementation ****.
33 */
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39/*============================ MACROS ========================================*/
40
41// HW
42/*\note hw FLASH driver can reimplement following types:
43 * To enable reimplementation, please enable macro below:
44 * VSF_FLASH_CFG_REIMPLEMENT_TYPE_MODE for vsf_flash_mode_t
45 * VSF_FLASH_CFG_REIMPLEMENT_TYPE_STATUS for vsf_flash_status_t
46 * VSF_FLASH_CFG_REIMPLEMENT_TYPE_IRQ_MASK for vsf_flash_irq_mask_t
47 * VSF_FLASH_CFG_REIMPLEMENT_TYPE_CTRL for vsf_flash_ctrl_t
48 * VSF_FLASH_CFG_REIMPLEMENT_TYPE_CFG for vsf_flash_cfg_t
49 * VSF_FLASH_CFG_REIMPLEMENT_TYPE_CAPABILITY for vsf_flash_capability_t
50 * Reimplementation is used for optimization hw/IPCore drivers, reimplement the bit mask according to hw registers.
51 * *** DO NOT reimplement these in emulated drivers. ***
52 */
53
54#define VSF_FLASH_CFG_REIMPLEMENT_TYPE_MODE DISABLED
55#define VSF_FLASH_CFG_REIMPLEMENT_TYPE_STATUS DISABLED
56#define VSF_FLASH_CFG_REIMPLEMENT_TYPE_IRQ_MASK DISABLED
57#define VSF_FLASH_CFG_REIMPLEMENT_TYPE_CTRL DISABLED
58#define VSF_FLASH_CFG_REIMPLEMENT_TYPE_CFG DISABLED
59#define VSF_FLASH_CFG_REIMPLEMENT_TYPE_CAPABILITY DISABLED
60// HW end
61
62/*============================ TYPES =========================================*/
63
64// HW/IPCore, not for emulated drivers
65#if VSF_FLASH_CFG_REIMPLEMENT_TYPE_IRQ_MASK == ENABLED
74#endif
75
76#if VSF_FLASH_CFG_REIMPLEMENT_TYPE_FLASH_SIZE == ENABLED
78#endif
79
80#if VSF_FLASH_CFG_REIMPLEMENT_TYPE_CFG == ENABLED
81typedef struct vsf_flash_t vsf_flash_t;
82typedef void vsf_flash_isr_handler_t(void *target_ptr, vsf_flash_t *flash_ptr, vsf_flash_irq_mask_t mask);
83typedef struct vsf_flash_isr_t {
85 void *target_ptr;
88typedef struct vsf_flash_cfg_t {
91#endif
92
93#if VSF_FLASH_CFG_REIMPLEMENT_TYPE_STATUS == ENABLED
94typedef struct vsf_flash_status_t {
95 union {
97 struct {
98 uint32_t is_busy : 1;
99 };
100 };
102#endif
103
104#if VSF_FLASH_CFG_REIMPLEMENT_TYPE_CAPABILITY == ENABLED
105typedef struct vsf_flash_capability_t {
106#if VSF_FLASH_CFG_INHERIT_HAL_CAPABILITY == ENABLED
108#endif
114 struct {
117 };
119#endif
120// HW/IPCore end
121
122/*============================ GLOBAL VARIABLES ==============================*/
123/*============================ PROTOTYPES ====================================*/
124
125#ifdef __cplusplus
126}
127#endif
128
129#endif // VSF_HAL_USE_FLASH
130#endif // __HAL_DRIVER_N32H76X_N32H78X_FLASH_H__
131/* EOF */
@ 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
vsf_flash_irq_mask_t
Definition flash.h:66
void vsf_flash_isr_handler_t(void *target_ptr, vsf_flash_t *flash_ptr, vsf_flash_irq_mask_t mask)
Definition flash.h:82
struct vsf_flash_capability_t vsf_flash_capability_t
struct vsf_flash_cfg_t vsf_flash_cfg_t
struct vsf_flash_isr_t vsf_flash_isr_t
struct vsf_flash_status_t vsf_flash_status_t
uint_fast32_t vsf_flash_size_t
Definition flash.h:77
vsf_arch_prio_t
Definition cortex_a_generic.h:88
const i_spi_t vsf_spi_irq_mask_t irq_mask
Definition spi_interface.h:38
unsigned uint32_t
Definition stdint.h:9
unsigned int uint_fast32_t
Definition stdint.h:27
unsigned char uint8_t
Definition stdint.h:5
Definition vsf_template_flash.h:262
vsf_flash_size_t max_size
Definition vsf_template_flash.h:269
uint8_t none_sector_aligned_read
Definition vsf_template_flash.h:275
vsf_flash_size_t write_sector_size
Definition vsf_template_flash.h:271
inherit(vsf_peripheral_capability_t) vsf_flash_irq_mask_t irq_mask
vsf_flash_size_t base_address
Definition vsf_template_flash.h:268
vsf_flash_size_t erase_sector_size
Definition vsf_template_flash.h:270
uint8_t none_sector_aligned_write
Definition vsf_template_flash.h:274
Definition vsf_template_flash.h:238
vsf_flash_isr_t isr
Interrupt configuration.
Definition vsf_template_flash.h:239
Definition vsf_template_flash.h:233
vsf_flash_isr_handler_t * handler_fn
Interrupt handler function.
Definition vsf_template_flash.h:234
vsf_arch_prio_t prio
Interrupt priority.
Definition vsf_template_flash.h:236
void * target_ptr
User target pointer.
Definition vsf_template_flash.h:235
Flash status structure that can be reimplemented in specific HAL drivers.
Definition vsf_template_flash.h:251
Definition vsf_template_flash.h:290
Definition vsf_template_hal_driver.h:203
Definition vsf_template_hal_driver.h:196
vsf_flash_irq_mask_t
Definition flash.h:116
void vsf_flash_isr_handler_t(void *target_ptr, vsf_flash_t *flash_ptr, vsf_flash_irq_mask_t mask)
Definition flash.h:132
uint_fast32_t vsf_flash_size_t
Definition flash.h:127
vsf_flash_irq_mask_t
Predefined VSF Flash interrupts that can be reimplemented in specific HAL drivers.
Definition vsf_template_flash.h:197
Generated from commit: vsfteam/vsf@cfd571b