ChibiOS  21.6.0
hal_efl.h
Go to the documentation of this file.
1 /*
2  ChibiOS - Copyright (C) 2006..2018 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 /* Derived constants and error checks. */
40 /*===========================================================================*/
41 
42 /*===========================================================================*/
43 /* Driver data structures and types. */
44 /*===========================================================================*/
45 
46 /**
47  * @extends BaseFlash
48  *
49  * @brief Type of external flash driver class.
50  */
52 
53 #include "hal_efl_lld.h"
54 
55 /**
56  * @brief @p EFlashDriver specific methods.
57  */
58 #define _efl_flash_methods_alone
59 
60 /**
61  * @brief @p EFlashDriver specific methods with inherited ones.
62  */
63 #define _efl_flash_methods \
64  _base_flash_methods \
65  _efl_flash_methods_alone
66 
67 /**
68  * @brief @p EFlashDriver specific data.
69  */
70 #define _efl_driver_data \
71  _base_flash_data \
72  /* Current configuration data.*/ \
73  const EFlashConfig *config;
74 
75 /**
76  * @extends BaseFlashVMT
77  *
78  * @brief @p EFlash virtual methods table.
79  */
82 };
83 
84 /**
85  * @brief Type of a structure representing a flash driver configuration.
86  */
87 typedef struct hal_efl_config {
88  /* End of the mandatory fields.*/
89  efl_lld_config_fields;
90 } EFlashConfig;
91 
92 /**
93  * @extends BaseFlash
94  *
95  * @brief Structure representing an embedded flash driver.
96  */
98  /**
99  * @brief SNORDriver Virtual Methods Table.
100  */
101  const struct EFlashDriverVMT *vmt;
103  /* End of the mandatory fields.*/
105 };
106 
107 /*===========================================================================*/
108 /* Driver macros. */
109 /*===========================================================================*/
110 
111 /*===========================================================================*/
112 /* External declarations. */
113 /*===========================================================================*/
114 
115 #ifdef __cplusplus
116 extern "C" {
117 #endif
118  void eflInit(void);
119  void eflObjectInit(EFlashDriver *eflp);
120  void eflStart(EFlashDriver *eflp, const EFlashConfig *config);
121  void eflStop(EFlashDriver *eflp);
122 #ifdef __cplusplus
123 }
124 #endif
125 
126 #endif /* HAL_USE_EFL == TRUE */
127 
128 #endif /* HAL_EFL_H */
129 
130 /** @} */
hal_efl_config
Type of a structure representing a flash driver configuration.
Definition: hal_efl.h:87
efl_lld_driver_fields
#define efl_lld_driver_fields
Low level fields of the embedded flash driver structure.
Definition: hal_efl_lld.h:67
eflInit
void eflInit(void)
Embedded Flash Driver initialization.
Definition: hal_efl.c:67
hal_efl_driver
Structure representing an embedded flash driver.
Definition: hal_efl.h:97
hal_efl_driver::vmt
const struct EFlashDriverVMT * vmt
SNORDriver Virtual Methods Table.
Definition: hal_efl.h:101
hal_efl_lld.h
PLATFORM Embedded Flash subsystem low level driver header.
EFlashConfig
struct hal_efl_config EFlashConfig
Type of a structure representing a flash driver configuration.
EFlashDriverVMT
EFlash virtual methods table.
Definition: hal_efl.h:80
eflStop
void eflStop(EFlashDriver *eflp)
Stops the driver.
Definition: hal_efl.c:117
eflStart
void eflStart(EFlashDriver *eflp, const EFlashConfig *config)
Configures and starts the driver.
Definition: hal_efl.c:95
_efl_flash_methods
#define _efl_flash_methods
EFlashDriver specific methods with inherited ones.
Definition: hal_efl.h:63
_efl_driver_data
#define _efl_driver_data
EFlashDriver specific data.
Definition: hal_efl.h:70
eflObjectInit
void eflObjectInit(EFlashDriver *eflp)
Initializes a generic EFlashDriver object.
Definition: hal_efl.c:79