aboutsummaryrefslogtreecommitdiffstats
path: root/4a-hal-utilities/4a-hal-utilities-data.c
diff options
context:
space:
mode:
Diffstat (limited to '4a-hal-utilities/4a-hal-utilities-data.c')
-rw-r--r--4a-hal-utilities/4a-hal-utilities-data.c183
1 files changed, 91 insertions, 92 deletions
diff --git a/4a-hal-utilities/4a-hal-utilities-data.c b/4a-hal-utilities/4a-hal-utilities-data.c
index 0790ed3..314190f 100644
--- a/4a-hal-utilities/4a-hal-utilities-data.c
+++ b/4a-hal-utilities/4a-hal-utilities-data.c
@@ -28,19 +28,19 @@
#include "4a-hal-utilities-alsa-data.h"
/*******************************************************************************
- * Specfic Hal controller streams data handling functions *
+ * Internal Hal - Streams data handling functions *
******************************************************************************/
-struct CtlHalMixerData *HalUtlAddMixerDataToMixerDataList(struct CtlHalMixerData **mixerDataList)
+struct InternalHalMixerData *HalUtlAddMixerDataToMixerDataList(struct InternalHalMixerData **mixerDataList)
{
- struct CtlHalMixerData *currentMixerData;
+ struct InternalHalMixerData *currentMixerData;
if(! mixerDataList)
return NULL;
currentMixerData = *mixerDataList;
if(! currentMixerData) {
- currentMixerData = (struct CtlHalMixerData *) calloc(1, sizeof(struct CtlHalMixerData));
+ currentMixerData = (struct InternalHalMixerData *) calloc(1, sizeof(struct InternalHalMixerData));
if(! currentMixerData)
return NULL;
@@ -50,7 +50,7 @@ struct CtlHalMixerData *HalUtlAddMixerDataToMixerDataList(struct CtlHalMixerData
while(currentMixerData->next)
currentMixerData = currentMixerData->next;
- currentMixerData->next = calloc(1, sizeof(struct CtlHalMixerData));
+ currentMixerData->next = calloc(1, sizeof(struct InternalHalMixerData));
if(! currentMixerData->next)
return NULL;
@@ -60,9 +60,9 @@ struct CtlHalMixerData *HalUtlAddMixerDataToMixerDataList(struct CtlHalMixerData
return currentMixerData;
}
-int8_t HalUtlRemoveSelectedMixerData(struct CtlHalMixerData **mixerDataList, struct CtlHalMixerData *mixerDataToRemove)
+int8_t HalUtlRemoveSelectedMixerData(struct InternalHalMixerData **mixerDataList, struct InternalHalMixerData *mixerDataToRemove)
{
- struct CtlHalMixerData *currentMixerData, *matchingMixerData;
+ struct InternalHalMixerData *currentMixerData, *matchingMixerData;
if(! mixerDataList || ! *mixerDataList || ! mixerDataToRemove)
return -1;
@@ -94,7 +94,7 @@ int8_t HalUtlRemoveSelectedMixerData(struct CtlHalMixerData **mixerDataList, str
return 0;
}
-int64_t HalUtlRemoveAllMixerData(struct CtlHalMixerData **mixerDataList)
+int64_t HalUtlRemoveAllMixerData(struct InternalHalMixerData **mixerDataList)
{
int8_t ret;
int64_t mixerDataRemoved = 0;
@@ -113,16 +113,15 @@ int64_t HalUtlRemoveAllMixerData(struct CtlHalMixerData **mixerDataList)
return mixerDataRemoved;
}
-int64_t HalUtlGetNumberOfMixerDataInList(struct CtlHalMixerData **mixerDataList)
+int64_t HalUtlGetNumberOfMixerDataInList(struct InternalHalMixerData **mixerDataList)
{
int64_t numberOfMixerData = 0;
- struct CtlHalMixerData *currentMixerData;
+ struct InternalHalMixerData *currentMixerData;
if(! mixerDataList)
return -1;
currentMixerData = *mixerDataList;
-
while(currentMixerData) {
currentMixerData = currentMixerData->next;
numberOfMixerData++;
@@ -131,9 +130,9 @@ int64_t HalUtlGetNumberOfMixerDataInList(struct CtlHalMixerData **mixerDataList)
return numberOfMixerData;
}
-struct CtlHalMixerData *HalUtlSearchMixerDataByProperties(struct CtlHalMixerData **mixerDataList, char *verb, char *verbToCall, char *streamCardId)
+struct InternalHalMixerData *HalUtlSearchMixerDataByProperties(struct InternalHalMixerData **mixerDataList, char *verb, char *verbToCall, char *streamCardId)
{
- struct CtlHalMixerData *currentMixerData;
+ struct InternalHalMixerData *currentMixerData;
if(! mixerDataList || ! verb)
return NULL;
@@ -153,89 +152,89 @@ struct CtlHalMixerData *HalUtlSearchMixerDataByProperties(struct CtlHalMixerData
}
/*******************************************************************************
- * Specfic Hal data handling functions *
+ * Hal data handling functions *
******************************************************************************/
-struct SpecificHalData *HalUtlAddHalApiToHalList(struct SpecificHalData **halDataList)
+struct HalData *HalUtlAddHalToHalList(struct HalData **halDataList)
{
- struct SpecificHalData *currentApi;
+ struct HalData *currentHalData;
if(! halDataList)
return NULL;
- currentApi = *halDataList;
- if(! currentApi) {
- currentApi = (struct SpecificHalData *) calloc(1, sizeof(struct SpecificHalData));
- if(! currentApi)
+ currentHalData = *halDataList;
+ if(! currentHalData) {
+ currentHalData = (struct HalData *) calloc(1, sizeof(struct HalData));
+ if(! currentHalData)
return NULL;
- *halDataList = currentApi;
+ *halDataList = currentHalData;
}
else {
- while(currentApi->next)
- currentApi = currentApi->next;
+ while(currentHalData->next)
+ currentHalData = currentHalData->next;
- currentApi->next = calloc(1, sizeof(struct SpecificHalData));
- if(! currentApi->next)
+ currentHalData->next = calloc(1, sizeof(struct HalData));
+ if(! currentHalData->next)
return NULL;
- currentApi = currentApi->next;
+ currentHalData = currentHalData->next;
}
- return currentApi;
+ return currentHalData;
}
-int8_t HalUtlRemoveSelectedHalFromList(struct SpecificHalData **halDataList, struct SpecificHalData *apiToRemove)
+int8_t HalUtlRemoveSelectedHalFromList(struct HalData **halDataList, struct HalData *halToRemove)
{
- struct SpecificHalData *currentApi, *matchingApi;
+ struct HalData *currentHalData, *matchingHal;
- if(! halDataList || ! *halDataList || ! apiToRemove)
+ if(! halDataList || ! *halDataList || ! halToRemove)
return -1;
- currentApi = *halDataList;
- if(currentApi == apiToRemove) {
- *halDataList = currentApi->next;
- matchingApi = currentApi;
+ currentHalData = *halDataList;
+ if(currentHalData == halToRemove) {
+ *halDataList = currentHalData->next;
+ matchingHal = currentHalData;
}
else {
- while(currentApi && currentApi->next != apiToRemove)
- currentApi = currentApi->next;
+ while(currentHalData && currentHalData->next != halToRemove)
+ currentHalData = currentHalData->next;
- if(currentApi) {
- matchingApi = currentApi->next;
- currentApi->next = currentApi->next->next;
+ if(currentHalData) {
+ matchingHal = currentHalData->next;
+ currentHalData->next = currentHalData->next->next;
}
else {
return -2;
}
}
- free(matchingApi->apiName);
- free(matchingApi->sndCardPath);
- free(matchingApi->info);
- free(matchingApi->author);
- free(matchingApi->version);
- free(matchingApi->date);
+ free(matchingHal->apiName);
+ free(matchingHal->sndCardPath);
+ free(matchingHal->info);
+ free(matchingHal->author);
+ free(matchingHal->version);
+ free(matchingHal->date);
- if(matchingApi->internal) {
- HalUtlRemoveAllMixerData(&matchingApi->ctlHalSpecificData->ctlHalStreamsData);
- HalUtlRemoveAllMixerData(&matchingApi->ctlHalSpecificData->ctlHalPlaybacksData);
- HalUtlRemoveAllMixerData(&matchingApi->ctlHalSpecificData->ctlHalCapturesData);
+ if(matchingHal->internal) {
+ HalUtlRemoveAllMixerData(&matchingHal->internalHalData->streamsData);
+ HalUtlRemoveAllMixerData(&matchingHal->internalHalData->playbacksData);
+ HalUtlRemoveAllMixerData(&matchingHal->internalHalData->capturesData);
- HalUtlFreeAlsaCtlsMap(matchingApi->ctlHalSpecificData->ctlHalAlsaMapT);
+ HalUtlFreeAlsaCtlsMap(matchingHal->internalHalData->alsaMapT);
- free(matchingApi->ctlHalSpecificData);
+ free(matchingHal->internalHalData);
}
- free(matchingApi);
+ free(matchingHal);
return 0;
}
-int64_t HalUtlRemoveAllHalFromList(struct SpecificHalData **halDataList)
+int64_t HalUtlRemoveAllHalFromList(struct HalData **halDataList)
{
int8_t ret;
- int64_t CtlHalApiRemoved = 0;
+ int64_t halRemoved = 0;
if(! halDataList)
return -1;
@@ -245,63 +244,63 @@ int64_t HalUtlRemoveAllHalFromList(struct SpecificHalData **halDataList)
if(ret)
return (int64_t) ret;
- CtlHalApiRemoved++;
+ halRemoved++;
}
- return CtlHalApiRemoved;
+ return halRemoved;
}
-int64_t HalUtlGetNumberOfHalInList(struct SpecificHalData **halDataList)
+int64_t HalUtlGetNumberOfHalInList(struct HalData **halDataList)
{
- int64_t numberOfCtlHal = 0;
- struct SpecificHalData *currentApi;
+ int64_t numberOfHal = 0;
+ struct HalData *currentHalData;
if(! halDataList)
return -1;
- currentApi = *halDataList;
+ currentHalData = *halDataList;
- while(currentApi) {
- currentApi = currentApi->next;
- numberOfCtlHal++;
+ while(currentHalData) {
+ currentHalData = currentHalData->next;
+ numberOfHal++;
}
- return numberOfCtlHal;
+ return numberOfHal;
}
-struct SpecificHalData *HalUtlSearchHalDataByApiName(struct SpecificHalData **halDataList, char *apiName)
+struct HalData *HalUtlSearchHalDataByApiName(struct HalData **halDataList, char *apiName)
{
- struct SpecificHalData *currentApi;
+ struct HalData *currentHalData;
if(! halDataList || ! *halDataList || ! apiName)
return NULL;
- currentApi = *halDataList;
+ currentHalData = *halDataList;
- while(currentApi) {
- if(! strcmp(apiName, currentApi->apiName))
- return currentApi;
+ while(currentHalData) {
+ if(! strcmp(apiName, currentHalData->apiName))
+ return currentHalData;
- currentApi = currentApi->next;
+ currentHalData = currentHalData->next;
}
return NULL;
}
-struct SpecificHalData *HalUtlSearchReadyHalDataByCardId(struct SpecificHalData **halDataList, int cardId)
+struct HalData *HalUtlSearchReadyHalDataByCardId(struct HalData **halDataList, int cardId)
{
- struct SpecificHalData *currentApi;
+ struct HalData *currentHalData;
if(! halDataList || ! *halDataList)
return NULL;
- currentApi = *halDataList;
+ currentHalData = *halDataList;
- while(currentApi) {
- if(currentApi->status == HAL_STATUS_READY && currentApi->sndCardId == cardId)
- return currentApi;
+ while(currentHalData) {
+ if(currentHalData->status == HAL_STATUS_READY && currentHalData->sndCardId == cardId)
+ return currentHalData;
- currentApi = currentApi->next;
+ currentHalData = currentHalData->next;
}
return NULL;
@@ -311,35 +310,35 @@ struct SpecificHalData *HalUtlSearchReadyHalDataByCardId(struct SpecificHalData
* Hal Manager data handling functions *
******************************************************************************/
-uint8_t HalUtlInitializeHalMgrData(afb_api_t apiHandle, struct HalMgrData *HalMgrGlobalData, char *apiName, char *info)
+uint8_t HalUtlInitializeHalMgrData(afb_api_t apiHandle, struct HalMgrData *halMgrData, char *apiName, char *info)
{
- if(! apiHandle || ! HalMgrGlobalData || ! apiName || ! info)
+ if(! apiHandle || ! halMgrData || ! apiName || ! info)
return -1;
// Allocate and fill apiName and info strings
- HalMgrGlobalData->apiName = strdup(apiName);
- if(! HalMgrGlobalData->apiName)
+ halMgrData->apiName = strdup(apiName);
+ if(! halMgrData->apiName)
return -2;
- HalMgrGlobalData->info = strdup(info);
- if(! HalMgrGlobalData->info)
+ halMgrData->info = strdup(info);
+ if(! halMgrData->info)
return -3;
- HalMgrGlobalData->apiHandle = apiHandle;
+ halMgrData->apiHandle = apiHandle;
return 0;
}
-void HalUtlRemoveHalMgrData(struct HalMgrData *HalMgrGlobalData)
+void HalUtlRemoveHalMgrData(struct HalMgrData *halMgrData)
{
- if(! HalMgrGlobalData)
+ if(! halMgrData)
return;
- if(HalMgrGlobalData->halDataList)
- HalUtlRemoveAllHalFromList(&HalMgrGlobalData->halDataList);
+ if(halMgrData->halDataList)
+ HalUtlRemoveAllHalFromList(&halMgrData->halDataList);
- free(HalMgrGlobalData->apiName);
- free(HalMgrGlobalData->info);
+ free(halMgrData->apiName);
+ free(halMgrData->info);
- free(HalMgrGlobalData);
+ free(halMgrData);
} \ No newline at end of file