ChibiOS 21.11.5
hal_efl.h
Go to the documentation of this file.
1/*
2 ChibiOS - Copyright (C) 2006-2026 Giovanni Di Sirio.
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 specific language governing permissions and
14 limitations under the License.
15*/
16
17/**
18 * @file hal_efl.h
19 * @brief Embedded Flash Driver macros and structures.
20 *
21 * @addtogroup HAL_EFL
22 * @{
23 */
24
25#ifndef HAL_EFL_H
26#define HAL_EFL_H
27
28#if (HAL_USE_EFL == TRUE) || defined(__DOXYGEN__)
29
30/*===========================================================================*/
31/* Driver constants. */
32/*===========================================================================*/
33
34/*===========================================================================*/
35/* Driver pre-compile time settings. */
36/*===========================================================================*/
37
38/**
39 * @brief Enables the @p flashAcquireExclusive() and
40 * @p flashReleaseExclusive() APIs.
41 * @note Disabling this option saves both code and data space.
42 */
43#if !defined(EFL_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
44#define EFL_USE_MUTUAL_EXCLUSION TRUE
45#endif
46
47/*===========================================================================*/
48/* Derived constants and error checks. */
49/*===========================================================================*/
50
51/*===========================================================================*/
52/* Driver data structures and types. */
53/*===========================================================================*/
54
55/**
56 * @extends BaseFlash
57 *
58 * @brief Type of embedded flash driver class.
59 */
61
62#include "hal_efl_lld.h"
63
64/**
65 * @brief @p EFlashDriver specific methods.
66 */
67#define _efl_flash_methods_alone
68
69/**
70 * @brief @p EFlashDriver specific methods with inherited ones.
71 */
72#define _efl_flash_methods \
73 _base_flash_methods \
74 _efl_flash_methods_alone
75
76/**
77 * @brief @p EFlashDriver specific data.
78 */
79#define _efl_driver_data \
80 _base_flash_data \
81 /* Current configuration data.*/ \
82 const EFlashConfig *config;
83
84/**
85 * @extends BaseFlashVMT
86 *
87 * @brief @p EFlash virtual methods table.
88 */
92
93/**
94 * @brief Type of a structure representing a flash driver configuration.
95 */
96typedef struct hal_efl_config {
97 /* End of the mandatory fields.*/
100
101/**
102 * @extends BaseFlash
103 *
104 * @brief Structure representing an embedded flash driver.
105 */
107 /**
108 * @brief EFlashDriver Virtual Methods Table.
109 */
110 const struct EFlashDriverVMT *vmt;
112#if (EFL_USE_MUTUAL_EXCLUSION == TRUE) || defined(__DOXYGEN__)
113 /**
114 * @brief Mutex protecting EFL.
115 */
117#endif /* EFL_USE_MUTUAL_EXCLUSION == TRUE */
118 /* End of the mandatory fields.*/
120};
121
122/*===========================================================================*/
123/* Driver macros. */
124/*===========================================================================*/
125
126/*===========================================================================*/
127/* External declarations. */
128/*===========================================================================*/
129
130#ifdef __cplusplus
131extern "C" {
132#endif
133 void eflInit(void);
134 void eflObjectInit(EFlashDriver *eflp);
135 msg_t eflStart(EFlashDriver *eflp, const EFlashConfig *config);
136 void eflStop(EFlashDriver *eflp);
137#ifdef __cplusplus
138}
139#endif
140
141#endif /* HAL_USE_EFL == TRUE */
142
143#endif /* HAL_EFL_H */
144
145/** @} */
struct hal_efl_config EFlashConfig
Type of a structure representing a flash driver configuration.
#define _efl_flash_methods
EFlashDriver specific methods with inherited ones.
Definition hal_efl.h:72
struct hal_efl_driver EFlashDriver
Type of embedded flash driver class.
Definition hal_efl.h:60
void eflInit(void)
Embedded Flash Driver initialization.
Definition hal_efl.c:95
#define efl_lld_driver_fields
Low level fields of the embedded flash driver structure.
Definition hal_efl_lld.h:67
msg_t eflStart(EFlashDriver *eflp, const EFlashConfig *config)
Configures and starts the driver.
Definition hal_efl.c:128
void eflObjectInit(EFlashDriver *eflp)
Initializes a generic EFlashDriver object.
Definition hal_efl.c:107
void eflStop(EFlashDriver *eflp)
Stops the driver.
Definition hal_efl.c:166
#define _efl_driver_data
EFlashDriver specific data.
Definition hal_efl.h:79
#define efl_lld_config_fields
Low level fields of the embedded flash configuration structure.
Definition hal_efl_lld.h:74
struct ch_mutex mutex_t
Type of a mutex structure.
Definition chmtx.h:51
int32_t msg_t
Definition chearly.h:87
PLATFORM Embedded Flash subsystem low level driver header.
EFlash virtual methods table.
Definition hal_efl.h:89
Type of a structure representing a flash driver configuration.
Definition hal_efl.h:96
Structure representing an embedded flash driver.
Definition hal_efl.h:106
const struct EFlashDriverVMT * vmt
EFlashDriver Virtual Methods Table.
Definition hal_efl.h:110
_efl_driver_data mutex_t mutex
Mutex protecting EFL.
Definition hal_efl.h:116