ChibiOS  21.6.0
hal_efl_lld.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_lld.h
19  * @brief PLATFORM Embedded Flash subsystem low level driver header.
20  *
21  * @addtogroup HAL_EFL
22  * @{
23  */
24 
25 #ifndef HAL_EFL_LLD_H
26 #define HAL_EFL_LLD_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  * @name PLATFORM configuration options
40  * @{
41  */
42 /**
43  * @brief EFL1 driver enable switch.
44  * @details If set to @p TRUE the support for EFL1 is included.
45  * @note The default is @p FALSE.
46  */
47 #if !defined(PLATFORM_EFL_USE_EFL1) || defined(__DOXYGEN__)
48 #define PLATFORM_EFL_USE_EFL1 FALSE
49 #endif
50 /** @} */
51 
52 /*===========================================================================*/
53 /* Derived constants and error checks. */
54 /*===========================================================================*/
55 
56 /*===========================================================================*/
57 /* Driver data structures and types. */
58 /*===========================================================================*/
59 
60 /*===========================================================================*/
61 /* Driver macros. */
62 /*===========================================================================*/
63 
64 /**
65  * @brief Low level fields of the embedded flash driver structure.
66  */
67 #define efl_lld_driver_fields \
68  /* Dummy field, it is not needed.*/ \
69  uint32_t dummy
70 
71 /**
72  * @brief Low level fields of the embedded flash configuration structure.
73  */
74 #define efl_lld_config_fields \
75  /* Dummy configuration, it is not needed.*/ \
76  uint32_t dummy
77 
78 /*===========================================================================*/
79 /* External declarations. */
80 /*===========================================================================*/
81 
82 #if (PLATFORM_EFL_USE_EFL1 == TRUE) && !defined(__DOXYGEN__)
83 extern EFlashDriver EFLD1;
84 #endif
85 
86 #ifdef __cplusplus
87 extern "C" {
88 #endif
89  void efl_lld_init(void);
90  void efl_lld_start(EFlashDriver *eflp);
91  void efl_lld_stop(EFlashDriver *eflp);
92  const flash_descriptor_t *efl_lld_get_descriptor(void *instance);
93  flash_error_t efl_lld_read(void *instance, flash_offset_t offset,
94  size_t n, uint8_t *rp);
95  flash_error_t efl_lld_program(void *instance, flash_offset_t offset,
96  size_t n, const uint8_t *pp);
97  flash_error_t efl_lld_start_erase_all(void *instance);
99  flash_sector_t sector);
100  flash_error_t efl_lld_query_erase(void *instance, uint32_t *msec);
101  flash_error_t efl_lld_verify_erase(void *instance, flash_sector_t sector);
102 #ifdef __cplusplus
103 }
104 #endif
105 
106 #endif /* HAL_USE_EFL == TRUE */
107 
108 #endif /* HAL_EFL_LLD_H */
109 
110 /** @} */
efl_lld_query_erase
flash_error_t efl_lld_query_erase(void *instance, uint32_t *msec)
Queries the driver for erase operation progress.
Definition: hal_efl_lld.c:312
efl_lld_verify_erase
flash_error_t efl_lld_verify_erase(void *instance, flash_sector_t sector)
Returns the erase state of a sector.
Definition: hal_efl_lld.c:341
hal_efl_driver
Structure representing an embedded flash driver.
Definition: hal_efl.h:97
flash_descriptor_t
Type of a flash device descriptor.
Definition: hal_flash.h:137
efl_lld_init
void efl_lld_init(void)
Low level Embedded Flash driver initialization.
Definition: hal_efl_lld.c:78
efl_lld_start_erase_sector
flash_error_t efl_lld_start_erase_sector(void *instance, flash_sector_t sector)
Starts an sector erase operation.
Definition: hal_efl_lld.c:275
efl_lld_stop
void efl_lld_stop(EFlashDriver *eflp)
Deactivates the Embedded Flash peripheral.
Definition: hal_efl_lld.c:114
EFLD1
EFlashDriver EFLD1
EFL1 driver identifier.
Definition: hal_efl_lld.c:41
flash_sector_t
uint32_t flash_sector_t
Type of a flash sector number.
Definition: hal_flash.h:118
efl_lld_program
flash_error_t efl_lld_program(void *instance, flash_offset_t offset, size_t n, const uint8_t *pp)
Program operation.
Definition: hal_efl_lld.c:202
efl_lld_read
flash_error_t efl_lld_read(void *instance, flash_offset_t offset, size_t n, uint8_t *rp)
Read operation.
Definition: hal_efl_lld.c:158
efl_lld_start
void efl_lld_start(EFlashDriver *eflp)
Configures and activates the Embedded Flash peripheral.
Definition: hal_efl_lld.c:93
flash_error_t
flash_error_t
Type of a flash error code.
Definition: hal_flash.h:99
flash_offset_t
uint32_t flash_offset_t
Type of a flash offset.
Definition: hal_flash.h:113
efl_lld_get_descriptor
const flash_descriptor_t * efl_lld_get_descriptor(void *instance)
Gets the flash descriptor structure.
Definition: hal_efl_lld.c:136
efl_lld_start_erase_all
flash_error_t efl_lld_start_erase_all(void *instance)
Starts a whole-device erase operation.
Definition: hal_efl_lld.c:243