28#ifndef INCLUDE_HWDRIVERMAP_H_
29#define INCLUDE_HWDRIVERMAP_H_
33#include "drivers/IDriver_vtbl.h"
39#define HDM_NULL_KEY (0U)
45#define HDME_IS_EMPTY(p_element) (((p_element)->value.p_driver_obj == NULL) && ((p_element)->key == HDM_NULL_KEY))
113 assert_param(_this != NULL);
114 assert_param(p_elements != NULL);
122 for(i = 0; i < size; i++)
129 return SYS_NO_ERROR_CODE;
142 assert_param(_this != NULL);
169 assert_param(_this != NULL);
173 while((_this->
p_elements[i].
key != key) && (i < _this->size))
195 p_free_element = NULL;
201 if (p_free_element != NULL)
204 p_free_element->
key = key;
210 return p_free_element;
224 assert_param(_this != NULL);
230 if(++i >= _this->
size)
257 assert_param(_this != NULL);
259 return _this->
size != 0;
271 assert_param(_this != NULL);
283 assert_param(_this != NULL);
291 assert_param(_this != NULL);
301uint32_t HWDriverMap_GetKeyForGPIO(GPIO_TypeDef *p_port, uint32_t pin)
303 uint32_t port = (uint32_t)p_port;
304 uint32_t position = 0U;
308 uint32_t iocurrent = 0U;
309 while ((iocurrent == 0U) && (position < 16))
311 iocurrent = (pin) & (1UL << position++);
316 key = port + position;
static sys_error_code_t HWDriverMap_Init(HWDriverMap_t *_this, HWDriverMapElement_t *p_elements, uint16_t size)
Definition HWDriverMap.h:111
struct _HWDriverMapElement HWDriverMapElement_t
static HWDriverMapValue_t * HWDriverMap_FindByKey(HWDriverMap_t *_this, uint32_t key)
Definition HWDriverMap.h:140
#define HDM_NULL_KEY
Definition HWDriverMap.h:39
static HWDriverMapElement_t * HWDriverMap_AddElement(HWDriverMap_t *_this, uint32_t key, IDriver *p_instance)
Definition HWDriverMap.h:167
struct _HWDriverMapValue HWDriverMapValue_t
static bool HWDriverMap_RemoveElement(HWDriverMap_t *_this, uint32_t key)
Definition HWDriverMap.h:222
#define HDME_IS_EMPTY(p_element)
Definition HWDriverMap.h:45
static bool HWDriverMap_IsInitialized(HWDriverMap_t *_this)
Definition HWDriverMap.h:255
struct _HWDriverMap HWDriverMap_t
static bool HWDriverMap_GetElementCount(const HWDriverMap_t *const _this)
Definition HWDriverMap.h:269
Public API for the Driver Interface.
Definition HWDriverMap.h:68
HWDriverMapValue_t value
Definition HWDriverMap.h:77
uint32_t key
Definition HWDriverMap.h:72
Definition HWDriverMap.h:85
HWDriverMapElement_t * p_elements
Definition HWDriverMap.h:89
uint16_t element_count
Definition HWDriverMap.h:99
uint16_t size
Definition HWDriverMap.h:94
Definition HWDriverMap.h:52
void * p_static_param
Definition HWDriverMap.h:61
IDriver * p_driver_obj
Definition HWDriverMap.h:56
Definition IDriver_vtbl.h:49
uint16_t sys_error_code_t
Definition syserror.h:41