ChibiOS/HAL 9.0.0
hal_efl.h
Go to the documentation of this file.
1/*
2 ChibiOS - Copyright (C) 2006..2021 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 eflAcquireUse() and @p eflReleaseUse() APIs.
40 * @note Disabling this option saves both code and data space.
41 */
42#if !defined(EFL_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
43#define EFL_USE_MUTUAL_EXCLUSION TRUE
44#endif
45
46/*===========================================================================*/
47/* Derived constants and error checks. */
48/*===========================================================================*/
49
50/*===========================================================================*/
51/* Driver data structures and types. */
52/*===========================================================================*/
53
54/**
55 * @extends BaseFlash
56 *
57 * @brief Type of external flash driver class.
58 */
60
61#include "hal_efl_lld.h"
62
63/**
64 * @brief @p EFlashDriver specific methods.
65 */
66#define _efl_flash_methods_alone
67
68/**
69 * @brief @p EFlashDriver specific methods with inherited ones.
70 */
71#define _efl_flash_methods \
72 _base_flash_methods \
73 _efl_flash_methods_alone
74
75/**
76 * @brief @p EFlashDriver specific data.
77 */
78#define _efl_driver_data \
79 _base_flash_data \
80 /* Current configuration data.*/ \
81 const EFlashConfig *config;
82
83/**
84 * @extends BaseFlashVMT
85 *
86 * @brief @p EFlash virtual methods table.
87 */
91
92/**
93 * @brief Type of a structure representing a flash driver configuration.
94 */
95typedef struct hal_efl_config {
96 /* End of the mandatory fields.*/
99
100/**
101 * @extends BaseFlash
102 *
103 * @brief Structure representing an embedded flash driver.
104 */
106 /**
107 * @brief EFlashDriver Virtual Methods Table.
108 */
109 const struct EFlashDriverVMT *vmt;
111#if (EFL_USE_MUTUAL_EXCLUSION == TRUE) || defined(__DOXYGEN__)
112 /**
113 * @brief Mutex protecting EFL.
114 */
116#endif /* EFL_USE_MUTUAL_EXCLUSION == TRUE */
117 /* End of the mandatory fields.*/
119};
120
121/*===========================================================================*/
122/* Driver macros. */
123/*===========================================================================*/
124
125/*===========================================================================*/
126/* External declarations. */
127/*===========================================================================*/
128
129#ifdef __cplusplus
130extern "C" {
131#endif
132 void eflInit(void);
133 void eflObjectInit(EFlashDriver *eflp);
134 msg_t eflStart(EFlashDriver *eflp, const EFlashConfig *config);
135 void eflStop(EFlashDriver *eflp);
136#ifdef __cplusplus
137}
138#endif
139
140#endif /* HAL_USE_EFL == TRUE */
141
142#endif /* HAL_EFL_H */
143
144/** @} */
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:71
struct hal_efl_driver EFlashDriver
Type of external flash driver class.
Definition hal_efl.h:59
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:127
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:165
#define _efl_driver_data
EFlashDriver specific data.
Definition hal_efl.h:78
#define efl_lld_config_fields
Low level fields of the embedded flash configuration structure.
Definition hal_efl_lld.h:74
int32_t msg_t
Type of a message.
Definition osal.h:159
uint32_t mutex_t
Type of a mutex.
Definition osal.h:229
PLATFORM Embedded Flash subsystem low level driver header.
EFlash virtual methods table.
Definition hal_efl.h:88
Type of a structure representing a flash driver configuration.
Definition hal_efl.h:95
Structure representing an embedded flash driver.
Definition hal_efl.h:105
const struct EFlashDriverVMT * vmt
EFlashDriver Virtual Methods Table.
Definition hal_efl.h:109
_efl_driver_data mutex_t mutex
Mutex protecting EFL.
Definition hal_efl.h:115