📄 psl_interface.cpp
字号:
m_hPsl->ProcessUserInput[PSL_USER_INPUT_PLAY] = PslProcessUserInputPlay;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_STOP] = PslProcessUserInputStop;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_PAUSE] = PslProcessUserInputPause;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_EJECT] = PslProcessUserInputEject;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_DIGIT] = PslProcessUserInputDigit;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_UP] = PslProcessUserInputUp;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_DOWN] = PslProcessUserInputDown;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_LEFT] = PslProcessUserInputLeft;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_RIGHT] = PslProcessUserInputRight;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_SELECT] = PslProcessUserInputSelect;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_SKIP_FWD] = PslProcessUserInputSkipFwd;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_SKIP_BWD] = PslProcessUserInputSkipBwd;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_FAST_FWD] = PslProcessUserInputFastFwd;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_FAST_RWD] = PslProcessUserInputFastRwd;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_SLOW_FWD] = PslProcessUserInputSlowFwd;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_SLOW_RWD] = PslProcessUserInputSlowRwd;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_STEP_FWD] = PslProcessUserInputStepFwd;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_STEP_BWD] = PslProcessUserInputStepBwd;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_VOL_UP] = PslProcessUserInputVolumeUp;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_VOL_DOWN] = PslProcessUserInputVolumeDown;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_VOL_MUTE] = PslProcessUserInputVolumeMute;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_REPEAT] = PslProcessUserInputRepeat;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_REPEAT_AB] = PslProcessUserInputRepeatAB;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_SEARCH] = PslProcessUserInputSearch;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_ANGLE] = PslProcessUserInputAngle;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_SETUP] = PslProcessUserInputSetup;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_MENU] = PslProcessUserInputMenu;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_TITLE] = PslProcessUserInputTitle;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_SUBTITLE] = PslProcessUserInputSubtitle;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_WIDE_SCREEN] = PslProcessUserInputWideScreen;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_EXIT] = PslProcessUserInputExit;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_PROG_GUIDE] = PslProcessUserInputProgGuide;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_INFO] = PslProcessUserInputInfo;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_AUDIO] = PslProcessUserInputAudio;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_DISPLAY] = PslProcessUserInputDisplay;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_ZOOM] = PslProcessUserInputZoom;
m_hPsl->ProcessUserInput[PSL_USER_INPUT_RETURN] = PslProcessUserInputReturn;
}
/**
* InitStatusEvents -- Map status events to status functions
*
* @param
* none
*
* @retval
* none
*/
static void InitStatusEvents(void)
{
m_hPsl->ProcessStatus[PSL_STATUS_PROHIBITED] = PslProcessStatusProhibited;
m_hPsl->ProcessStatus[PSL_STATUS_PAUSE] = PslProcessStatusPause;
m_hPsl->ProcessStatus[PSL_STATUS_PLAY] = PslProcessStatusPlay;
m_hPsl->ProcessStatus[PSL_STATUS_STOP] = PslProcessStatusStop;
m_hPsl->ProcessStatus[PSL_STATUS_FULLSTOP] = PslProcessStatusFullStop;
m_hPsl->ProcessStatus[PSL_STATUS_NO_RESUME] = PslProcessStatusNoResume;
m_hPsl->ProcessStatus[PSL_STATUS_OPEN] = PslProcessStatusOpen;
m_hPsl->ProcessStatus[PSL_STATUS_CLOSE] = PslProcessStatusClose;
m_hPsl->ProcessStatus[PSL_STATUS_SLOW_FWD] = PslProcessStatusSlowFwd;
m_hPsl->ProcessStatus[PSL_STATUS_SLOW_RWD] = PslProcessStatusSlowRwd;
m_hPsl->ProcessStatus[PSL_STATUS_FAST_FWD] = PslProcessStatusFastFwd;
m_hPsl->ProcessStatus[PSL_STATUS_FAST_RWD] = PslProcessStatusFastRwd;
m_hPsl->ProcessStatus[PSL_STATUS_CHAPTER_SKIP] = PslProcessStatusChapterSkip;
m_hPsl->ProcessStatus[PSL_STATUS_STEP_FWD] = PslProcessStatusStepFwd;
m_hPsl->ProcessStatus[PSL_STATUS_STEP_BWD] = PslProcessStatusStepBwd;
m_hPsl->ProcessStatus[PSL_STATUS_REPEAT] = PslProcessStatusRepeat;
m_hPsl->ProcessStatus[PSL_STATUS_NO_DISC] = PslProcessStatusNoDisc;
m_hPsl->ProcessStatus[PSL_STATUS_DISC_TYPE] = PslProcessStatusDiscType;
m_hPsl->ProcessStatus[PSL_STATUS_LOADING] = PslProcessStatusLoading;
m_hPsl->ProcessStatus[PSL_STATUS_LOAD_COMPLETE] = PslProcessStatusLoadComplete;
m_hPsl->ProcessStatus[PSL_STATUS_ANGLE_CHANGE] = PslProcessStatusAngleChange;
m_hPsl->ProcessStatus[PSL_STATUS_AUDIO_CHANGE] = PslProcessStatusAudioChange;
m_hPsl->ProcessStatus[PSL_STATUS_AUDIO_NOT_SUPPORTED] = PslProcessStatusAudioNotSupported;
m_hPsl->ProcessStatus[PSL_STATUS_INVALID_REGION] = PslProcessStatusInvalidRegion;
m_hPsl->ProcessStatus[PSL_STATUS_STANDBY] = PslProcessStatusStandby;
m_hPsl->ProcessStatus[PSL_STATUS_SETTMPPML] = PslProcessStatusSetTmpParental;
m_hPsl->ProcessStatus[PSL_STATUS_PARENTAL_PROHIBIT] = PslProcessStatusParentalProhibit;
m_hPsl->ProcessStatus[PSL_STATUS_TIMER] = PslProcessStatusTimer;
m_hPsl->ProcessStatus[PSL_STATUS_ICON_TIMEOUT] = PslProcessStatusIconTimeout;
m_hPsl->ProcessStatus[PSL_STATUS_MENU_TIMEOUT] = PslProcessStatusMenuTimeout;
m_hPsl->ProcessStatus[PSL_STATUS_GENERIC_TIMEOUT] = PslProcessStatusGenericTimeout;
}
/**
* PslTask -- Task where all PSL input must enter
*
* @param
* pvParam -- Parameter initialized when task is spawned
*
* @retval
* OS_STATUS
*/
static ULONG PslTask(PVOID pvParam)
{
PSL_MESSAGE PslMsg;
BOOLEAN fTaskExit = FALSE;
while (fTaskExit == FALSE)
{
/* Wait for a message */
if (OS_MsgQReceive(m_hPsl->msg_queue, (char *)&PslMsg, sizeof(PSL_MESSAGE), OS_WAIT_FOREVER) != OS_OK)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PslTask: Failure receiving message!\n"));
goto errout;
}
else
{
/* Look at the message type to determine what to do */
switch (PslMsg.tMsgType)
{
case PSL_MSG_INITIALIZE:
DBGPRINT(DBG_ON(DBG_TRACE), ("PslTask: Got Initialize message\n"));
/* Set the sem ID */
m_hPsl->pPsl->sem_synch = PslMsg.ulData0;
/* Initialize data bank */
if (PslDataInitialize(m_hPsl->pPsl) != PSL_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PslTask: Failure initializing data bank!\n"));
goto errout;
}
/* Load the user config settings */
if (PslDataLoadConfigSettings(m_hPsl->pPsl) != PSL_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PslTask: Failure loading user config settings!\n"));
goto errout;
}
/* Map user input commands and status events to functions */
InitUserInputCommands();
InitStatusEvents();
/* Initialize external modules to the PSL */
if (PslExternalInitialize(m_hPsl->pPsl) != PSL_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PslTask: Failure initializing external modules!\n"));
goto errout;
}
/* Initialize screen layout */
if (PslScreenLayoutInitialize(m_hPsl->pPsl) != PSL_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PslTask: Failure initializing screen layout!\n"));
goto errout;
}
/* Set initialize flag */
m_hPsl->fInit = TRUE;
DbgPrint(("\nPSL: UNIT IN STANDBY\n\n"));
// auto-start
// PslProcessUserInputPower(m_hPsl->pPsl, 0 );
break;
case PSL_MSG_PROCESS_USER_INPUT:
DBGPRINT(DBG_ON(DBG_TRACE), ("PslTask: Got Process User Input message\n"));
/* Dispatch user input to the Process User Input Module */
if (PslMsg.ulData0 >= PSL_USER_INPUT_MAX)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PslTask: Invalid user input!\n"));
}
else if (m_hPsl->ProcessUserInput[PslMsg.ulData0] != NULL)
{
/* Follow function pointer to process user input function */
if (m_hPsl->ProcessUserInput[PslMsg.ulData0](m_hPsl->pPsl, PslMsg.ulData1) != PSL_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PslTask: Process user input function failed!\n"));
}
}
/* Give command processing sem */
OS_SemGive(m_hPsl->cmd_processing_sem);
break;
case PSL_MSG_PROCESS_STATUS:
DBGPRINT(DBG_ON(DBG_TRACE), ("PslTask: Got Process Status message\n"));
DbgPrint(("PSL: status: %s\n",PslStatusName( (PSL_STATUS_TYPE)PslMsg.ulData0)));
/* Dispatch status event to the Process Status Input Module */
if (PslMsg.ulData0 >= PSL_STATUS_MAX)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PslTask: Invalid status event!\n"));
}
else if (m_hPsl->ProcessStatus[PslMsg.ulData0] != NULL)
{
/* Follow function pointer to process status function */
if (m_hPsl->ProcessStatus[PslMsg.ulData0](m_hPsl->pPsl, PslMsg.ulData1, PslMsg.ulData2,
PslMsg.pvBuffer, PslMsg.ulBufferLength) != PSL_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PslTask: Process status function failed!\n"));
}
}
/* If a buffer was specified, and this is an asynchronous message, then free buffer */
if ( (PslMsg.pvBuffer != NULL) && (PslMsg.ulSemID == 0) )
{
/* de-allocate the buffer */
OS_MemFree(PslMsg.pvBuffer);
PslMsg.pvBuffer = NULL;
}
break;
case PSL_MSG_ABORT:
DBGPRINT(DBG_ON(DBG_TRACE), ("PslTask: Got Abort message\n"));
if (m_hPsl->fInit == TRUE)
{
USHORT i;
/* Unset initialize flag */
m_hPsl->fInit = FALSE;
/* Uninitialize screen layout */
PslScreenLayoutUninitialize(m_hPsl->pPsl);
/* Uninitialize external modules */
PslExternalUninitialize();
/* Free process user input pointers */
for (i = 0; i < PSL_USER_INPUT_MAX; i++)
{
m_hPsl->ProcessUserInput[i] = NULL;
}
/* Free process status pointers */
for (i = 0; i < PSL_STATUS_MAX; i++)
{
m_hPsl->ProcessStatus[i] = NULL;
}
/* Store the user config settings */
if (PslDataStoreConfigSettings(m_hPsl->pPsl) != PSL_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PslTask: Failure storing user config settings!\n"));
}
/* Reset synch semaphore */
m_hPsl->pPsl->sem_synch = 0;
/* Uninit the data bank */
PslDataUninitialize(m_hPsl->pPsl);
}
fTaskExit = TRUE;
break;
default:
DBGPRINT(DBG_ON(DBG_ERROR), ("PslTask: Invalid message type!\n"));
break;
}
/* If synch sem id is valid, give semaphore */
if (PslMsg.ulSemID != 0)
{
OS_SemGive(PslMsg.ulSemID);
}
}
}
/* exit task */
OS_TaskExit();
return (OS_OK);
errout:
/* Give semaphore so application can exit */
if (m_hPsl->pPsl->sem_synch != 0)
{
/* give semaphore */
OS_SemGive(m_hPsl->pPsl->sem_synch);
}
/* exit task */
OS_TaskExit();
return ( (ULONG)OS_FAILURE);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -