summaryrefslogtreecommitdiffstats
path: root/4a-hal/4a-hal-manager
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2018-06-09 17:45:32 +0200
committerJonathan Aillet <jonathan.aillet@iot.bzh>2018-10-08 15:52:51 +0200
commit14412fb98e96921c710407a1c336b628a449ebc5 (patch)
tree3e57c18304f554338c55d3edfd077a5ef6b8abde /4a-hal/4a-hal-manager
parentce6c73e669a84f07bc85326514775130077585fc (diff)
Use a local strucuture to store hal manager data
Use a local strucuture to store hal manager global data. Also declare a function that allows to get the first hal data structure in the list managed by hal manager. Change-Id: I4b36030435bca506b5ba3a08dfbca039eb02e43e Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to '4a-hal/4a-hal-manager')
-rw-r--r--4a-hal/4a-hal-manager/4a-hal-manager.c22
-rw-r--r--4a-hal/4a-hal-manager/4a-hal-manager.h3
2 files changed, 18 insertions, 7 deletions
diff --git a/4a-hal/4a-hal-manager/4a-hal-manager.c b/4a-hal/4a-hal-manager/4a-hal-manager.c
index df35d12..f3ebe14 100644
--- a/4a-hal/4a-hal-manager/4a-hal-manager.c
+++ b/4a-hal/4a-hal-manager/4a-hal-manager.c
@@ -31,6 +31,9 @@
// Default api to print log when apihandle not available
AFB_ApiT AFB_default;
+// Local (static) Hal manager data structure
+static struct HalMgrData localHalMgrGlobalData;
+
/*******************************************************************************
* HAL Manager verbs table *
******************************************************************************/
@@ -49,6 +52,16 @@ struct HalUtlApiVerb HalManagerApiStaticVerbs[] =
};
/*******************************************************************************
+ * HAL Manager get first 'SpecificHalData' structure *
+ from HAL list function *
+ ******************************************************************************/
+
+struct SpecificHalData **HalMngGetFirstHalData(void)
+{
+ return &localHalMgrGlobalData.first;
+}
+
+/*******************************************************************************
* Dynamic API functions for hal manager *
* TBD JAI : Use API-V3 instead of API-PRE-V3 *
******************************************************************************/
@@ -120,27 +133,22 @@ int HalMgrCreateApi(AFB_ApiT apiHandle, struct HalMgrData *HalMgrGlobalData)
int afbBindingVdyn(AFB_ApiT apiHandle)
{
int status = 0, rc;
- struct HalMgrData *HalMgrGlobalData;
if(! apiHandle)
return -1;
- HalMgrGlobalData = (struct HalMgrData *) calloc(1, sizeof(struct HalMgrData));
- if(! HalMgrGlobalData)
- return -2;
-
// Hugely hack to make all V2 AFB_DEBUG to work in fileutils
AFB_default = apiHandle;
AFB_ApiNotice(apiHandle, "In %s", __func__);
// Load Hal-Manager using DynApi
- rc = HalMgrCreateApi(apiHandle, HalMgrGlobalData);
+ rc = HalMgrCreateApi(apiHandle, &localHalMgrGlobalData);
if(rc < 0)
status--;
// Load Hal-Ctls using DynApi
- rc = HalCtlsCreateAllApi(apiHandle, HalMgrGlobalData);
+ rc = HalCtlsCreateAllApi(apiHandle, &localHalMgrGlobalData);
if(rc < 0)
status -= rc;
diff --git a/4a-hal/4a-hal-manager/4a-hal-manager.h b/4a-hal/4a-hal-manager/4a-hal-manager.h
index d5f11e5..9749edc 100644
--- a/4a-hal/4a-hal-manager/4a-hal-manager.h
+++ b/4a-hal/4a-hal-manager/4a-hal-manager.h
@@ -23,4 +23,7 @@
#define HAL_MANAGER_API_NAME "4a-hal-manager"
#define HAL_MANAGER_API_INFO "Manager for 4A HAL APIs"
+// HAL Manager get first 'SpecificHalData' structure from HAL list function
+struct SpecificHalData **HalMngGetFirstHalData(void);
+
#endif /* _HALMGR_BINDING_INCLUDE_ */ \ No newline at end of file