📄 guiapp.c
字号:
/*****************************************************************************
** TEXAS INSTRUMENTS PROPRIETARY INFORMATION
**
** (c) Copyright, Texas Instruments Incorporated, 2006.
** All Rights Reserved.
**
** Property of Texas Instruments Incorporated. Restricted Rights -
** Use, duplication, or disclosure is subject to restrictions set
** forth in TI's program license agreement and associated documentation.
******************************************************************************/
/****************************************************************************/
/* guiApp.c */
/* */
/* GUI Main task. */
/****************************************************************************/
#include <string.h>
#include "common.h"
#include "ddp2230_rtos_include.h"
#include "osd.h"
#include "tmr.h"
#include "sysmon.h"
#include "global.h"
#include "mailbox.h"
#include "taskParm.h"
#include "dbmessage.h"
#include "guiApp.h"
#include "keycode.h"
#include "guiStyle.h"
#include "guiApp_action.h"
#include "keypad.h"
#include "irRemote.h"
#include "irRemotePoint.h"
#include "datapath.h"
#include "usbIO.h"
#include "eeprom.h"
#define GUI_MODE_LAMPOFF 0
#define GUI_MODE_LAMPON 1
/****************************************************/
/*Local data. */
/****************************************************/
static const char guiTaskName[] = "guiTask";
extern uint32 gID_MemPool;
static uint32 guiTaskID; /* gui task ID */
static uint32 guiMbxID; /* mailbox ID */
static BOOL powerKeyPassthrough; /* indicates system in standby */
static uint08 guiMode = GUI_MODE_LAMPOFF;
static uint32 osdTimeout = 0;
static BOOL guiBusy = FALSE;
static BOOL guiDisplayedFlag = FALSE;
static BOOL DDCCISettingsChanged = FALSE;
static BOOL menuMode = FALSE;
/****************************************************/
/* Local functions. */
/****************************************************/
static void guiTask( void );
static void _guiCallback( uint16 msgID, uint32 parm, uint32 parm2 );
static void _guiKeycode( UIREP *pRep );
static void guiApp_Handler( KCODE_ENUM key );
static void guiApp_SourceHandler( GUI_SOURCEENUM sourcemsg );
static void guiApp_WarningHandler( GUI_WARNINGENUM warningmsg );
static void guiApp_ScreenCaptureMessageHandler( GUISCREENCAPTUREENUM screenCaptureMsg );
static void guiApp_OnOsdStart( void );
static void guiApp_OnOsdClose( void );
/****************************************************************************/
/* Module reset function. */
/****************************************************************************/
EXEC_CC_ENUM guiTask_init( void )
{
/****************************************************/
/* Create task mailbox. */
/****************************************************/
if( RTA_SUCCESS != RTA_MbxCreate( &guiMbxID, "guim", 0, 32, 0, 0 )) //fcw
return EXEC_CC_RTOSERR;
dbmsg_ftrace( DBM_SYSTEM, "Gui mailbox ID = %02d\r\n", guiMbxID );
/****************************************************/
/* Create task. */
/****************************************************/
if( RTA_SUCCESS != RTA_TaskCreate( guiTask, &guiTaskID,
PRIORITY_GUITASK, STACK_GUITASK, "GUIT", 0 ))
{
dbmsg_trace( DBM_ALWAYS, "Can't create GUI task...\r\n" );
return EXEC_CC_FATAL;
}
powerKeyPassthrough = TRUE;
guiDisplayedFlag = FALSE;
return EXEC_CC_PASS;
}
/****************************************************************************/
/* GUI task. Receive mailbox messages */
/****************************************************************************/
static void guiTask( void )
{
MBM_CC cc; /* completion code */
for(;;)
{
if( MBM_PASS != ( cc = mbRecv( guiMbxID, osdTimeout, _guiCallback )))
{
dbmsg_ftrace( DBM_ALWAYS, "ccode %d receiving GUI message\r\n", cc );
guiStyle_Exit();
osdTimeout = 0;
}
}
}
/****************************************************************************/
/* Return task information. */
/****************************************************************************/
void guiTask_info( TASKINFO_STRUCT *info )
{
info -> taskID = guiTaskID;
info -> stackSize = STACK_GUITASK;
info -> taskName = guiTaskName;
}
/****************************************************************************/
/* Key-pressed indication from keypad or IR remote. Send message to handle */
/* keypress later */
/****************************************************************************/
void guiKeycode( UIREP *puiRep, BOOL keyEvent )
{
UIREP *mp; /* pointer to UI report */
MBM_CC cc; /* mailbox completion code */
/* send a keycode mailbox message if a new key code has been detected */
/* in passthrough mode or if we are not already busy with processing */
/* the last keypress */
if(( keyEvent && !menuMode ) || !guiBusy )
{
if( RTA_SUCCESS == RTA_MemRequest( gID_MemPool, sizeof( UIREP ), (void**)&mp ))
{
memcpy( mp, puiRep, sizeof( UIREP ));
guiBusy = TRUE;
if( MBM_PASS != ( cc = mbSend( guiMbxID, GUI_KEYCODE, -1, (uint32)mp, TRUE, 0 )))
{
dbmsg_ftrace( DBM_ALWAYS, "gui: Can't send mailbox message. cc=%d\r\n", cc );
RTA_MemRelease( mp );
}
}
else
{
dbmsg_trace( DBM_ALWAYS, "gui: Can't allocate message buffer\r\n" );
}
}
else
dbmsg_trace( DBM_GUI, "Too fast...dropped keycode\r\n" );
}
/****************************************************************************/
/* Warning condition message */
/****************************************************************************/
void guiWarningMessage( GUI_WARNINGENUM guiWarning )
{
MBM_CC cc; /* mailbox completion code */
if( MBM_PASS != ( cc = mbSend( guiMbxID, GUI_WARNINGMSG, -1, guiWarning, FALSE, 0 )))
{
dbmsg_ftrace( DBM_ALWAYS, "gui: Can't send mailbox message. cc=%d\r\n", cc );
}
}
/****************************************************************************/
/* Source status message */
/****************************************************************************/
void guiSourceStatusMessage( GUI_SOURCEENUM guiSourceStatus )
{
MBM_CC cc; /* mailbox completion code */
if( MBM_PASS != ( cc = mbSend( guiMbxID, GUI_SOURCEMSG, -1, guiSourceStatus, FALSE, 0 )))
{
dbmsg_ftrace( DBM_ALWAYS, "gui: Can't send mailbox message. cc=%d\r\n", cc );
}
}
/****************************************************************************/
/* Splash Capture status message */
/****************************************************************************/
void guiScreenCaptureStatusMessage( GUISCREENCAPTUREENUM guiScreenCaptureStatus )
{
MBM_CC cc; /* mailbox completion code */
if( MBM_PASS != ( cc = mbSend( guiMbxID, GUI_SCREENCAPTUREMSG, -1, guiScreenCaptureStatus, FALSE, 0 )))
{
dbmsg_ftrace( DBM_ALWAYS, "gui: Can't send mailbox message. cc=%d\r\n", cc );
}
}
/****************************************************************************/
/* GUI to standby mode. */
/* */
/* Assertion of powerKeyPassthrough indicates that a power keypress causes */
/* a power-up indication to be sent to the system monitor. */
/****************************************************************************/
EXEC_CC_ENUM guiTask_powerStandby( void )
{
powerKeyPassthrough = TRUE;
guiMode = GUI_MODE_LAMPOFF;
return EXEC_CC_PASS;
}
/****************************************************************************/
/* GUI to normal mode. */
/* */
/* Negation of powerKeyPassthrough indicates that the GUI will validate a */
/* power-down keypress via a user dialog before sending a power-down indi- */
/* cation to the system monitor. */
/****************************************************************************/
EXEC_CC_ENUM guiTask_powerNormal( void )
{
powerKeyPassthrough = FALSE;
guiMode = GUI_MODE_LAMPON;
guiStyle_Init( gID_MemPool, guiApp_OnOsdStart, guiApp_OnOsdClose, guiApp_action_OnStart, guiApp_action_OnClose, guiApp_action_GuiMsg, guiApp_action_Redraw, guiApp_action_GetHighlightWindow );
return EXEC_CC_PASS;
}
/****************************************************************************/
/* GUI message callback. */
/****************************************************************************/
static void _guiCallback( uint16 msgID, uint32 parm, uint32 parm2 )
{
UIREP *pRep;
pRep = (UIREP*)parm;
dbmsg_ftrace( DBM_GUI, "GUI event %d\r\n", msgID );
switch( msgID )
{
case GUI_KEYCODE:
_guiKeycode( pRep );
/* handle all usb pass through functions (usb mouse, page up, page down) */
if( pRep->mouse == TRUE || pRep->key == KCODE_IR_LEFT_ARROW || pRep->key == KCODE_IR_RIGHT_ARROW )
{
usbIO_IRReport( pRep );
}
/* call all GUI menu functions with key pressed */
else
{
guiApp_Handler( pRep->key );
}
guiBusy = FALSE;
break;
case GUI_WARNINGMSG:
guiApp_WarningHandler( (GUI_WARNINGENUM)parm );
break;
case GUI_SOURCEMSG:
guiApp_SourceHandler( (GUI_SOURCEENUM)parm );
break;
case GUI_SCREENCAPTUREMSG:
guiApp_ScreenCaptureMessageHandler( (GUISCREENCAPTUREENUM)parm );
break;
default:
dbmsg_ftrace( DBM_GUI, "gui: Unknown mailbox messageID= %04x\r\n", msgID );
break;
}
}
/****************************************************************************/
/* GUI keycode dictionary */
/****************************************************************************/
static const struct dictEntryStruct
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -