eLooM for STM32 application
v3.3.0
A framework for multitasking low power embedded applications powerd by STM32
|
This class implements a map between a driver Instance and it's parameters. More...
Go to the source code of this file.
Data Structures | |
struct | _HWDriverMapValue |
struct | _HWDriverMapElement |
struct | _HWDriverMap |
Macros | |
#define | HDM_NULL_KEY (0U) |
#define | HDME_IS_EMPTY(p_element) (((p_element)->value.p_driver_obj == NULL) && ((p_element)->key == HDM_NULL_KEY)) |
Typedefs | |
typedef struct _HWDriverMapValue | HWDriverMapValue_t |
typedef struct _HWDriverMapElement | HWDriverMapElement_t |
typedef struct _HWDriverMap | HWDriverMap_t |
Functions | |
static sys_error_code_t | HWDriverMap_Init (HWDriverMap_t *_this, HWDriverMapElement_t *p_elements, uint16_t size) |
static HWDriverMapValue_t * | HWDriverMap_FindByKey (HWDriverMap_t *_this, uint32_t key) |
static HWDriverMapElement_t * | HWDriverMap_AddElement (HWDriverMap_t *_this, uint32_t key, IDriver *p_instance) |
static bool | HWDriverMap_RemoveElement (HWDriverMap_t *_this, uint32_t key) |
static bool | HWDriverMap_IsInitialized (HWDriverMap_t *_this) |
static bool | HWDriverMap_GetElementCount (const HWDriverMap_t *const _this) |
This class implements a map between a driver Instance and it's parameters.
The map is a collection of pairs (key, value) named element, where:
Copyright (c) 2023 STMicroelectronics. All rights reserved.
This software is licensed under terms that can be found in the LICENSE file in the root directory of this software component. If no LICENSE file comes with this software, it is provided AS-IS.
#define HDM_NULL_KEY (0U) |
reserved key value to specify an invalid key.
#define HDME_IS_EMPTY | ( | p_element | ) | (((p_element)->value.p_driver_obj == NULL) && ((p_element)->key == HDM_NULL_KEY)) |
Check if an HWDriverMapElement_t is empty. The element in the map are not allocated and released dynamically, but rather the element are marked as empty.
typedef struct _HWDriverMap HWDriverMap_t |
This map is implemented as an array of size
elements.
typedef struct _HWDriverMapElement HWDriverMapElement_t |
Specifies the element of the map. It is the pair (key, value)
typedef struct _HWDriverMapValue HWDriverMapValue_t |
Specifies the value of the elements stored in the map.
|
inlinestatic |
Add a new pair (key, IDriver) to the map. The pair (key, IDriver) is namebd element. If the key is already present to the map then the element is not added and the method return NULL. If the element is already present in the map then the method return the element.
_this | [IN] pointer to a valid HWDriverMap_t object. |
key | [IN] unique ID for the element. |
[IN] | p_instance specifies the IDriver instance of the element's value. |
|
inlinestatic |
Searches the map for an element with a the corresponding key
_this | [IN] pointer to a valid HWDriverMap_t object. |
key | [IN] key to be searched. |
|
inlinestatic |
Get the number of element (key, value) present in the map.
_this | [IN] pointer to a valid HWDriverMap_t object. |
|
inlinestatic |
Initialize the Driver map.
_this | [IN] pointer to a valid HWDriverMap_t object. |
p_elements | [IN] pointer to a valid HWDriverMapElement_t array. |
size | [IN] number of elements in the array |
|
inlinestatic |
Check if the map has been initialized. If a map is not initialized, any call to the map API has unknown effect. To initialize a map use the method HWDriverMap_Init().
_this | [IN] pointer to a valid HWDriverMap_t object. |
|
inlinestatic |
Remove the element with the specific key from the map. The element is marked as removed, and no memory de-allocation is done.
_this | [IN] pointer to a valid HWDriverMap_t object. |
key | [IN] unique ID for the element. |