summaryrefslogtreecommitdiff
path: root/drivers/staging/nmf-cm/cm
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/nmf-cm/cm')
-rw-r--r--drivers/staging/nmf-cm/cm/engine/component/inc/initializer.h1
-rw-r--r--drivers/staging/nmf-cm/cm/engine/component/src/binder_check.c8
-rw-r--r--drivers/staging/nmf-cm/cm/engine/component/src/initializer.c32
-rw-r--r--drivers/staging/nmf-cm/cm/engine/component/src/instantiater.c4
4 files changed, 41 insertions, 4 deletions
diff --git a/drivers/staging/nmf-cm/cm/engine/component/inc/initializer.h b/drivers/staging/nmf-cm/cm/engine/component/inc/initializer.h
index b4416f3ce20..5ac9ec453b7 100644
--- a/drivers/staging/nmf-cm/cm/engine/component/inc/initializer.h
+++ b/drivers/staging/nmf-cm/cm/engine/component/inc/initializer.h
@@ -15,6 +15,7 @@
PUBLIC t_cm_error cm_COMP_INIT_Init(t_nmf_core_id coreId);
PUBLIC t_cm_error cm_COMP_CallService(int serviceIndex, t_component_instance *pComp, t_uint32 methodAddress);
+PUBLIC void cm_COMP_Flush(t_nmf_core_id coreId);
PUBLIC void cm_COMP_INIT_Close(t_nmf_core_id coreId);
PUBLIC t_cm_error cm_COMP_UpdateStack(t_nmf_core_id coreId, t_uint32 stackSize);
PUBLIC t_cm_error cm_COMP_ULPForceWakeup(t_nmf_core_id coreId);
diff --git a/drivers/staging/nmf-cm/cm/engine/component/src/binder_check.c b/drivers/staging/nmf-cm/cm/engine/component/src/binder_check.c
index 8a3c3c33de8..373fea0cd47 100644
--- a/drivers/staging/nmf-cm/cm/engine/component/src/binder_check.c
+++ b/drivers/staging/nmf-cm/cm/engine/component/src/binder_check.c
@@ -40,10 +40,10 @@ t_cm_error cm_checkValidClient(
t_interface_reference* itfRef = &client->interfaceReferences[itfRequire->requireIndex][itfRequire->collectionIndex];
if(itfRef->instance == (const t_component_instance*)NMF_VOID_COMPONENT)
- ERROR("CM_INTERFACE_ALREADY_BINDED(): Component (%s<%s>.s) already bound to VOID\n",
+ ERROR("CM_INTERFACE_ALREADY_BINDED(): Component (%s<%s>.%s) already bound to VOID\n",
client->pathname, client->Template->name, requiredItfClientName, 0, 0, 0);
else
- ERROR("CM_INTERFACE_ALREADY_BINDED(): Component (%s<%s>.s) already bound to another server (%s<%s>.%s)\n",
+ ERROR("CM_INTERFACE_ALREADY_BINDED(): Component (%s<%s>.%s) already bound to another server (%s<%s>.%s)\n",
client->pathname, client->Template->name, requiredItfClientName,
itfRef->instance->pathname, itfRef->instance->Template->name, itfRef->instance->Template->provides[itfRef->provideIndex].name);
return CM_INTERFACE_ALREADY_BINDED;
@@ -116,7 +116,7 @@ t_cm_error cm_checkValidBinding(
{
if(itfRef->instance == (const t_component_instance*)NMF_VOID_COMPONENT)
{
- ERROR("CM_INTERFACE_ALREADY_BINDED(): Singleton (%s<%s>.s) already bound to VOID\n",
+ ERROR("CM_INTERFACE_ALREADY_BINDED(): Singleton (%s<%s>.%s) already bound to VOID\n",
client->pathname, client->Template->name, requiredItfClientName, 0, 0, 0);
return CM_INTERFACE_ALREADY_BINDED;
}
@@ -130,7 +130,7 @@ t_cm_error cm_checkValidBinding(
}
else
{
- ERROR("CM_INTERFACE_ALREADY_BINDED(): Singleton (%s<%s>.s) already bound to different server (%s<%s>.%s)\n",
+ ERROR("CM_INTERFACE_ALREADY_BINDED(): Singleton (%s<%s>.%s) already bound to different server (%s<%s>.%s)\n",
client->pathname, client->Template->name, requiredItfClientName,
itfRef->instance->pathname, itfRef->instance->Template->name, itfRef->instance->Template->provides[itfRef->provideIndex].name);
return CM_INTERFACE_ALREADY_BINDED;
diff --git a/drivers/staging/nmf-cm/cm/engine/component/src/initializer.c b/drivers/staging/nmf-cm/cm/engine/component/src/initializer.c
index 6950efb76b6..011dfa18398 100644
--- a/drivers/staging/nmf-cm/cm/engine/component/src/initializer.c
+++ b/drivers/staging/nmf-cm/cm/engine/component/src/initializer.c
@@ -33,6 +33,7 @@ static struct {
t_nmf_fifo_arm_desc* uplinkFifo;
t_memory_handle dspfifoHandle;
t_nmf_osal_sem_handle fifoSemHandle;
+ t_uint32 servicePending; // TODO : Use sem counter instead of defining such variable (need to create new OSAL)
} initializerDesc[NB_CORE_IDS];
PUBLIC t_cm_error cm_COMP_INIT_Init(t_nmf_core_id coreId)
@@ -63,6 +64,7 @@ PUBLIC t_cm_error cm_COMP_INIT_Init(t_nmf_core_id coreId)
return error;
/* create fifo semaphore */
+ initializerDesc[coreId].servicePending = 0;
initializerDesc[coreId].fifoSemHandle = OSAL_CreateSemaphore(DEFAULT_INITIALIZER_FIFO_SIZE);
if (initializerDesc[coreId].fifoSemHandle == 0) {
dspevent_destroyDspEventFifo(initializerDesc[coreId].dspfifoHandle);
@@ -158,6 +160,31 @@ PUBLIC t_cm_error cm_COMP_CallService(
return error;
}
+PUBLIC void cm_COMP_Flush(t_nmf_core_id coreId) {
+
+ if(initializerDesc[coreId].servicePending > 0)
+ {
+ t_uint16 params[INIT_COMPONENT_CMD_SIZE];
+ t_uint32 methodAddress = cm_EEM_getExecutiveEngine(coreId)->voidAddr;
+
+ // If service still pending on MMDSP side, send a flush command (today, we reuse Destroy to not create new empty service)
+ // When we receive the result, this mean that we have flushed all previous request.
+
+ params[INIT_COMPONENT_CMD_HANDLE_INDEX] = (t_uint16)(0x0 & 0xFFFF);
+ params[INIT_COMPONENT_CMD_HANDLE_INDEX+1] = (t_uint16)(0x0 >> 16);
+ params[INIT_COMPONENT_CMD_THIS_INDEX] = (t_uint16)(0x0 & 0xFFFF);
+ params[INIT_COMPONENT_CMD_THIS_INDEX+1] = (t_uint16)(0x0 >> 16);
+ params[INIT_COMPONENT_CMD_METHOD_INDEX] = (t_uint16)(methodAddress & 0xFFFF);
+ params[INIT_COMPONENT_CMD_METHOD_INDEX+1] = (t_uint16)(methodAddress >> 16);
+
+ if (cm_COMP_generic(coreId, params, sizeof(params) / sizeof(t_uint16), NMF_DESTROY_INDEX) != CM_OK ||
+ OSAL_SEMAPHORE_WAIT_TIMEOUT(semHandle) != SYNC_OK)
+ {
+ ERROR("CM_MPC_NOT_RESPONDING: can't call flush service\n", 0, 0, 0, 0, 0, 0);
+ }
+ }
+}
+
PUBLIC void cm_COMP_INIT_Close(t_nmf_core_id coreId)
{
unsigned int i;
@@ -187,6 +214,7 @@ PUBLIC void processAsyncAcknowledge(t_nmf_core_id coreId, t_event_params_handle
{
cm_AcknowledgeEvent(initializerDesc[coreId].uplinkFifo);
+ initializerDesc[coreId].servicePending--;
OSAL_SemaphorePost(initializerDesc[coreId].fifoSemHandle,1);
}
@@ -194,6 +222,7 @@ PUBLIC void processSyncAcknowledge(t_nmf_core_id coreId, t_event_params_handle p
{
cm_AcknowledgeEvent(initializerDesc[coreId].uplinkFifo);
+ initializerDesc[coreId].servicePending--;
OSAL_SemaphorePost(initializerDesc[coreId].fifoSemHandle,1);
OSAL_SemaphorePost(semHandle,1);
}
@@ -309,6 +338,7 @@ PRIVATE t_cm_error cm_COMP_generic(
if (OSAL_SEMAPHORE_WAIT_TIMEOUT(initializerDesc[coreId].fifoSemHandle) != SYNC_OK)
return CM_MPC_NOT_RESPONDING;
+
// AllocEvent
if((_xyuv_data = cm_AllocEvent(initializerDesc[coreId].downlinkFifo)) == NULL)
{
@@ -325,6 +355,8 @@ PRIVATE t_cm_error cm_COMP_generic(
// Send Command
error = cm_PushEventTrace(initializerDesc[coreId].downlinkFifo, _xyuv_data, serviceIndex,0);
+ if(error == CM_OK)
+ initializerDesc[coreId].servicePending++;
unlock:
OSAL_UNLOCK_COM();
diff --git a/drivers/staging/nmf-cm/cm/engine/component/src/instantiater.c b/drivers/staging/nmf-cm/cm/engine/component/src/instantiater.c
index b7b42802cea..bd410c9acd9 100644
--- a/drivers/staging/nmf-cm/cm/engine/component/src/instantiater.c
+++ b/drivers/staging/nmf-cm/cm/engine/component/src/instantiater.c
@@ -745,6 +745,10 @@ t_cm_error cm_destroyInstance(t_component_instance* component, t_destroy_state f
ERROR("CM_MPC_NOT_RESPONDING: can't call destroy '%s'\n", component->pathname, 0, 0, 0, 0, 0);
}
}
+ else
+ {
+ cm_COMP_Flush(component->Template->dspId);
+ }
}
cm_delayedDestroyComponent(component);