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);
}
示例#2
0
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);
}