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_${SERIES/FLASH_IP}_FLASH_H__
19#define __HAL_DRIVER_${SERIES/FLASH_IP}_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/*\note Includes CAN ONLY be put here. */
36/*\note If current header is for a peripheral driver(hw driver), and inherit from an IPCore driver, include IPCore header here. */
37
38// IPCore
39#if defined(__VSF_HAL_${FLASH_IP}_FLASH_CLASS_IMPLEMENT)
40# define __VSF_CLASS_IMPLEMENT__
41#elif defined(__VSF_HAL_${FLASH_IP}_FLASH_CLASS_INHERIT__)
42# define __VSF_CLASS_INHERIT__
43#endif
44
45#include "utilities/ooc_class.h"
46// IPCore end
47
48#ifdef __cplusplus
49extern "C" {
50#endif
51
52/*============================ MACROS ========================================*/
53
54/*\note VSF_${FLASH_IP}_FLASH_CFG_MULTI_CLASS should be implemented for IP drives and open to user,
55 * while VSF_HW_FLASH_CFG_MULTI_CLASS should be in flash.c.
56 */
57
58// IPCore
59#ifndef VSF_${FLASH_IP}_FLASH_CFG_MULTI_CLASS
60# define VSF_${FLASH_IP}_FLASH_CFG_MULTI_CLASS VSF_FLASH_CFG_MULTI_CLASS
61#endif
62// IPCore end
63
64/*============================ TYPES =========================================*/
65
66// IPCore
67vsf_class(vsf_${flash_ip}_flash_t) {
68#if VSF_${FLASH_IP}_CFG_MULTI_CLASS == ENABLED
69 public_member(
70 vsf_flash_t vsf_flash;
71 )
72#endif
73
74/*\note You can add more member in vsf_${flash_ip}_flash_t instance.
75 * For members accessible from child, put in protected_member.
76 * Else, put in private_member.
77 */
78
79 protected_member(
80 vsf_${flash_ip}_flash_reg_t *reg;
82 )
83};
84// IPCore end
85
86/*============================ GLOBAL VARIABLES ==============================*/
87/*============================ PROTOTYPES ====================================*/
88
89// IPCore
90/*\note Extern APIs for ip core diriver.
91 * There is no requirement about how APIs of IPCore drivers should be implemented.
92 * Just consider the simplicity for actual peripheral drivers.
93 */
94// IPCore end
95
96#ifdef __cplusplus
97}
98#endif
99
100// IPCore
101#undef __VSF_HAL_${FLASH_IP}_FLASH_CLASS_IMPLEMENT
102#undef __VSF_HAL_${FLASH_IP}_FLASH_CLASS_INHERIT__
103// IPCore end
104
105#endif // VSF_HAL_USE_FLASH
106#endif // __HAL_DRIVER_${SERIES/FLASH_IP}_FLASH_H__
107/* EOF */
Definition adc.h:68
#define vsf_class(__name)
Definition ooc_class.h:48
Definition vsf_template_flash.h:142
Definition vsf_template_flash.h:190
vsf_flash_isr_t isr
Definition flash.h:82
class vsf_$ * reg