static OMX_ERRORTYPE pausetoidle_trans_complete (const void *ap_obj, OMX_PTR ap_servant, OMX_STATETYPE a_new_state) { const tiz_state_t *p_base = (const tiz_state_t *) ap_obj; TIZ_TRACE (handleOf (ap_obj), "Trans complete to state [%s]...", tiz_fsm_state_to_str (a_new_state)); assert (OMX_StateIdle == a_new_state); assert (NULL != ap_obj); assert (NULL != ap_servant); assert (OMX_StateIdle == a_new_state); if (2 == p_base->servants_count_ + 1) { /* Reset the OMX_TIZONIA_PORTSTATUS_AWAITBUFFERSRETURN flag in all ports where this has been set */ tiz_krn_reset_tunneled_ports_status (tiz_get_krn (handleOf(ap_servant)), OMX_TIZONIA_PORTSTATUS_AWAITBUFFERSRETURN); } return tiz_state_super_trans_complete (typeOf (ap_obj, "tizpausetoidle"), ap_obj, ap_servant, a_new_state); }
static OMX_ERRORTYPE loadedtoidle_state_set (const void * ap_obj, OMX_HANDLETYPE ap_hdl, OMX_COMMANDTYPE a_cmd, OMX_U32 a_param1, OMX_PTR ap_cmd_data) { tiz_state_t * p_base = (tiz_state_t *) ap_obj; tiz_fsm_state_id_t new_state = EStateMax; assert (ap_obj); assert (ap_hdl); assert (a_cmd == OMX_CommandStateSet); TIZ_TRACE (ap_hdl, "Requested transition " "[ESubStateLoadedToIdle -> %s]...", tiz_fsm_state_to_str (a_param1)); /* Allowed transitions are OMX_StateLoaded only (a.k.a. transition * cancellation). */ switch (a_param1) { case OMX_StateLoaded: { new_state = ESubStateIdleToLoaded; } break; default: { TIZ_ERROR (ap_hdl, "[OMX_ErrorIncorrectStateTransition] : " "ESubStateLoadedToIdle -> [%s]", tiz_state_to_str (a_param1)); return OMX_ErrorIncorrectStateTransition; } }; /* reset here the servants count */ p_base->servants_count_ = 0; if (ESubStateIdleToLoaded == new_state) { OMX_ERRORTYPE rc = OMX_ErrorNone; if (OMX_ErrorNone != (rc = tiz_fsm_set_state (tiz_get_fsm (ap_hdl), new_state, ESubStateLoadedToIdle))) { return rc; } } /* IL resource deallocation should take place now */ /* NOTE: This will call the 'tiz_state_state_set' function and not * 'tizloaded_state_set' (we are passing 'tizloaded' as the 1st * parameter */ return tiz_state_super_state_set (typeOf (ap_obj, "tizloaded"), ap_obj, ap_hdl, a_cmd, a_param1, ap_cmd_data); }
static OMX_ERRORTYPE idletoloaded_trans_complete (const void * ap_obj, OMX_PTR ap_servant, OMX_STATETYPE a_new_state) { TIZ_TRACE (handleOf (ap_servant), "Trans complete to state [%s]...", tiz_fsm_state_to_str ((tiz_fsm_state_id_t) a_new_state)); assert (OMX_StateLoaded == a_new_state); return tiz_state_super_trans_complete (typeOf (ap_obj, "tizidletoloaded"), ap_obj, ap_servant, a_new_state); }
static OMX_ERRORTYPE waitforresources_trans_complete (const void *ap_obj, OMX_PTR ap_servant, OMX_STATETYPE a_new_state) { TIZ_TRACE (handleOf (ap_servant), "Trans complete to state [%s]...", tiz_fsm_state_to_str (a_new_state)); assert (OMX_StateWaitForResources == a_new_state || OMX_StateLoaded == a_new_state); return tiz_state_super_trans_complete (typeOf (ap_obj, "tizwaitforresources"), ap_obj, ap_servant, a_new_state); }
static OMX_ERRORTYPE pause_trans_complete (const void *ap_obj, OMX_PTR ap_servant, OMX_STATETYPE a_new_state) { TIZ_LOG_CNAME (TIZ_TRACE, TIZ_CNAME (tiz_srv_get_hdl (ap_servant)), TIZ_CBUF (tiz_srv_get_hdl (ap_servant)), "Trans complete to state [%s]...", tiz_fsm_state_to_str (a_new_state)); assert (OMX_StatePause == a_new_state || OMX_StateIdle == a_new_state || OMX_StateExecuting == a_new_state); return tiz_state_super_trans_complete (tizpause, ap_obj, ap_servant, a_new_state); }
static OMX_ERRORTYPE loadedtoidle_trans_complete (const void * ap_obj, OMX_PTR ap_servant, OMX_STATETYPE a_new_state) { const tiz_state_t * p_base = (const tiz_state_t *) ap_obj; TIZ_TRACE (handleOf (ap_servant), "Trans complete to state [%s]...", tiz_fsm_state_to_str ((tiz_fsm_state_id_t) a_new_state)); assert (ap_obj); assert (ap_servant); assert (OMX_StateIdle == a_new_state); if (2 == p_base->servants_count_ + 1) { /* Reset the OMX_PORTSTATUS_ACCEPTUSEBUFFER flag in all ports where this * has been set */ tiz_krn_reset_tunneled_ports_status (tiz_get_krn (handleOf (ap_servant)), OMX_PORTSTATUS_ACCEPTUSEBUFFER); } return tiz_state_super_trans_complete (typeOf (ap_obj, "tizloadedtoidle"), ap_obj, ap_servant, a_new_state); }
static OMX_ERRORTYPE waitforresources_state_set (const void *ap_obj, OMX_HANDLETYPE ap_hdl, OMX_COMMANDTYPE a_cmd, OMX_U32 a_param1, OMX_PTR ap_cmd_data) { const tiz_waitforresources_t *p_obj = ap_obj; tiz_fsm_state_id_t new_state = EStateMax; OMX_ERRORTYPE omx_error = OMX_ErrorNone; assert (p_obj); assert (a_cmd == OMX_CommandStateSet); TIZ_TRACE (ap_hdl, "Requested transition to state [%s]...", tiz_fsm_state_to_str (a_param1)); /* Only allowed transitions is OMX_StateLoaded. */ switch (a_param1) { case OMX_StateLoaded: { new_state = (tiz_fsm_state_id_t)OMX_StateLoaded; break; } case OMX_StateWaitForResources: { return OMX_ErrorSameState; } default: { TIZ_ERROR (ap_hdl, "[OMX_ErrorIncorrectStateTransition] : ..."); return OMX_ErrorIncorrectStateTransition; } }; /* TODO: make state transition effective here? */ (void) new_state; /* if (OMX_ErrorNone != */ /* (omx_error = tiz_fsm_set_state */ /* (tiz_get_fsm (ap_hdl), new_state))) */ /* { */ /* return omx_error; */ /* } */ { void *p_prc = tiz_get_prc (ap_hdl); void *p_krn = tiz_get_krn (ap_hdl); /* First notify the kernel servant */ if (OMX_ErrorNone != (omx_error = tiz_api_SendCommand (p_krn, ap_hdl, a_cmd, a_param1, ap_cmd_data))) { return omx_error; } /* Now notify the processor servant */ if (OMX_ErrorNone != (omx_error = tiz_api_SendCommand (p_prc, ap_hdl, a_cmd, a_param1, ap_cmd_data))) { return omx_error; } } return omx_error; }
static OMX_ERRORTYPE pause_state_set (const void *ap_obj, OMX_HANDLETYPE ap_hdl, OMX_COMMANDTYPE a_cmd, OMX_U32 a_param1, OMX_PTR ap_cmd_data) { const tiz_pause_t *p_obj = ap_obj; tiz_fsm_state_id_t new_state = EStateMax; OMX_ERRORTYPE rc = OMX_ErrorNone; assert (p_obj); assert (a_cmd == OMX_CommandStateSet); TIZ_LOG (TIZ_TRACE, "Requested transition to state [%s]...", tiz_fsm_state_to_str (a_param1)); /* Allowed transitions are OMX_StateIdle, and OMX_StateExecuting */ switch (a_param1) { case OMX_StateIdle: { new_state = ESubStatePauseToIdle; break; } case OMX_StateExecuting: { new_state = a_param1; break; } case OMX_StatePause: { return OMX_ErrorSameState; } default: { TIZ_LOG (TIZ_TRACE, "OMX_ErrorIncorrectStateTransition..."); return OMX_ErrorIncorrectStateTransition; } }; /* Move FSM to the transitional state */ if (ESubStatePauseToIdle == new_state) { if (OMX_ErrorNone != (rc = tiz_fsm_set_state (tiz_get_fsm (ap_hdl), new_state, EStateMax))) { return rc; } { if (!TIZ_KRN_MAY_INIT_EXE_TO_IDLE(tiz_get_krn (ap_hdl))) { TIZ_LOG_CNAME (TIZ_DEBUG, TIZ_CNAME (ap_hdl), TIZ_CBUF (ap_hdl), "wait until all the tunneled supplier neighbours have " "reported that they have stopped the buffer exchange..."); return rc; } } } return tiz_state_super_state_set (tizpause, ap_obj, ap_hdl, a_cmd, a_param1, ap_cmd_data); }