📄 datapath.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.
******************************************************************************/
/****************************************************************************/
/* datapath.c */
/* */
/* Datapath: Performs connector scan and configures DDP2230 hardware */
/* to display sources */
/****************************************************************************/
#include "common.h"
#include "i2c.h"
#include "adc.h"
#include "src.h"
#include "al_alc.h"
#include "src.h"
#include "dei.h"
#include "disp.h"
#include "ddp2230_rtos_include.h"
#include "tmr.h"
#include "seq.h"
#include "al_alc.h"
#include "dmd.h"
#include "sysmon.h"
#include "mailbox.h"
#include "taskParm.h"
#include "dbmessage.h"
#include "datapath.h"
#include "source.h"
#include "adccontrol.h"
#include "dvicontrol.h"
#include "deccontrol.h"
#include "pictcont.h"
#include "dispfmt.h"
#include "global.h"
#include "guiApp.h"
#include "eeprom.h"
/****************************************************************************/
/* Local constants and declarations. */
/****************************************************************************/
/****************************************************/
/* Local variables. */
/****************************************************/
static uint32 datapathMbxID; /* mailbox ID */
static uint32 datapathTaskID; /* task ID */
static int32 datapathTaskPollPeriod; /* controls state machine poll rate */
static DP_STATE datapathState; /* current state of state machine */
static uint32 stateStartTicks; /* keeps track of time in state */
/* stores information about the currently displayed source */
static DP_SOURCEDESC sourceDesc; /* and the current connector for search */
/* stores information about current external source */
static DP_SAVEDDESC savedDesc; /* while blank screen is displayed */
static BOOL blankScreenEnabled; /* user controlled blank screen */
static uint08 flushIndex = 0; /* synchronizes flush messages */
static uint08 datapathReady = FALSE; /* stores if datapath is initialized */
static BOOL autoSourceSelect = TRUE;
/****************************************************/
/* Local functions. */
/****************************************************/
static void datapath_StartDisplay( void );
static void datapath_Task( void );
static void datapath_Callback( uint16 msgID, uint32 parm, uint32 parm2 );
static void datapath_StateMachineProc( uint08 msg );
static void datapath_GotoState( uint08 newState );
void datapath_CycleConnector( BOOL force );
static void datapath_ResetTimeInState( void );
static void datapath_StopCurrentOperation( void );
static int08 datapath_ConfigureForExternalSource( void );
static void datapath_StoreSourceDesc( void );
static void datapath_RetrieveSourceDesc( void );
static int08 datapath_SetTestPattern( uint08 pattern );
static const char* datapathTaskName = "datapath";
static const char* datapathStateStringTable[] =
{
"SPLASH_AT_STARTUP",
"TPG_DISPLAYED",
"SUSPENDED",
"BEGIN_SCAN",
"LOOK_FOR_SYNCS",
"ATTEMPT_LOCK",
"MONITOR_SOURCE"
};
static const char* datapathConnectorStringTable[] =
{
"VGA",
"DVI",
"COMPONENT",
"COMPOSITE",
"S-VIDEO"
};
/****************************************************************************/
/*Data path initialization. */
/****************************************************************************/
EXEC_CC_ENUM datapath_init( void )
{
if( RTA_SUCCESS != RTA_MbxCreate( &datapathMbxID, "datm", 0, 32, 0, 0 ))
return EXEC_CC_RTOSERR;
/* initialize the state machine into an idle state */
datapath_powerStandby();
if( RTA_SUCCESS != RTA_TaskCreate( (void(*)(void))datapath_Task, &datapathTaskID,
PRIORITY_DATAPATH, STACK_DATAPATH, "datt", 0 ))
return EXEC_CC_RTOSERR;
return EXEC_CC_PASS; /* no-op */
}
/****************************************************************************/
/* Set datapath to operational mode. */
/* Note that this function does not block. This allows the datapath */
/* to initialize while the illumination module attempts to start the */
/* colorwheel and strike the lamp. */
/****************************************************************************/
EXEC_CC_ENUM datapath_powerNormal( void )
{
datapathReady = FALSE;
mbSend( datapathMbxID, DPMSG_INIT, -1, 0, FALSE, 0 );
return EXEC_CC_PASS;
}
/****************************************************************************/
/* Block illumination module until image is ready. */
/****************************************************************************/
EXEC_CC_ENUM datapath_okToUnpark( void )
{
uint32 ready;
/* Wait up to 10 seconds for the datapath to finish processing init */
/* message and then this message */
if( mbSend( datapathMbxID, DPMSG_GETREADY, 10000, (uint32)(&ready), FALSE, 0 ) != MBM_PASS )
return EXEC_CC_FAIL;
if( ready )
return EXEC_CC_PASS;
else
return EXEC_CC_FAIL;
}
/****************************************************************************/
/* Set datapath to standby mode. */
/****************************************************************************/
EXEC_CC_ENUM datapath_powerStandby( void )
{
/* set the state machine to suspended */
mbSend( datapathMbxID, DPMSG_GOTOSTATE, -1, SUSPENDED, FALSE, 0 );
adccontrol_powerStandby();
dvicontrol_powerStandby();
deccontrol_powerStandby();
return EXEC_CC_PASS; /* no-op */
}
/****************************************************************************/
/* Retrieve datapath task information. */
/****************************************************************************/
void datapath_info( TASKINFO_STRUCT *info )
{
info -> taskID = datapathTaskID;
info -> stackSize = STACK_DATAPATH;
info -> taskName = datapathTaskName;
}
/****************************************************************************/
/* Retrieve the source descriptor structure (for dispfmt, pictcont) */
/****************************************************************************/
void datapath_GetSourceDesc( DP_SOURCEDESC **srcDesc )
{
*srcDesc = &sourceDesc;
}
/****************************************************************************/
/* User control to switch connectors/sources and switch execution context */
/****************************************************************************/
void datapath_UserSetConnector( DP_CONNECTOR connector )
{
mbSend( datapathMbxID, DPMSG_SETCONNECTOR, -1, connector, FALSE, 0 );
}
/****************************************************************************/
/* User control to display test pattern and switch execution context */
/****************************************************************************/
void datapath_UserSetTestPattern( DP_TPG pattern )
{
mbSend( datapathMbxID, DPMSG_SETTPG, -1, pattern, FALSE, 0 );
}
/****************************************************************************/
/* User control to toggle blank screen and switch execution context */
/****************************************************************************/
void datapath_UserBlankScreenToggle( void )
{
mbSend( datapathMbxID, DPMSG_STATE_TOGGLEBLANK, -1, 0, FALSE, 0 );
}
/****************************************************************************/
/* User control to resynchronize to a source and switch execution context */
/****************************************************************************/
void datapath_UserResync( void )
{
mbSend( datapathMbxID, DPMSG_STATE_RESYNC, -1, 0, FALSE, 0 );
}
/****************************************************************************/
/* Control for GUI to stop connector scan and switch execution context */
/****************************************************************************/
void datapath_UserStopConnectorScan( uint08 enable )
{
if( enable )
{
mbSend( datapathMbxID, DPMSG_STATE_SUSPENDSCAN, 1000, 0, FALSE, 0 );
}
else
{
mbSend( datapathMbxID, DPMSG_STATE_RESUMESCAN, 1000, 0, FALSE, 0 );
}
}
/****************************************************************************/
/* User control to set blank screen color/splash, switch execution context */
/****************************************************************************/
void datapath_UserSetBlankScreenColor( uint08 color )
{
mbSend( datapathMbxID, DPMSG_BLANKCOLOR, -1, color, FALSE, 0 );
}
/****************************************************************************/
/* User control to enable automatic connector cycle */
/****************************************************************************/
void datapath_UserSetAutoSourceSelect( BOOL enable )
{
autoSourceSelect = enable;
EE_PUTVAR( UserMachine.Projector.AutoSourceSelect, autoSourceSelect );
}
/****************************************************************************/
/* User control to enable overscan and switch execution context */
/****************************************************************************/
int08 datapath_UserSetOverscan( uint08 enable )
{
int08 retval;
if( mbSend( datapathMbxID, DPMSG_OVERSCAN, 1500, (uint32)enable, FALSE, (uint32)(&retval) ) != MBM_PASS )
{
dbmsg_ftrace( DBM_DPATH, "mb send failed\r\n", retval );
return FAIL;
}
return retval;
}
/****************************************************************************/
/* User control to set magnify and switch execution context */
/****************************************************************************/
int08 datapath_UserSetMagnify( int16 value )
{
int08 retval;
if( mbSend( datapathMbxID, DPMSG_MAGNIFY, 1500, (uint32)value, FALSE, (uint32)(&retval) ) != MBM_PASS )
{
dbmsg_ftrace( DBM_DPATH, "mb send failed\r\n", retval );
return FAIL;
}
return retval;
}
/****************************************************************************/
/* User control to set pan and switch execution context */
/****************************************************************************/
int08 datapath_UserSetPan( int16 value )
{
int08 retval;
if( mbSend( datapathMbxID, DPMSG_PAN, 1500, (uint32)value, FALSE, (uint32)(&retval) ) != MBM_PASS )
{
dbmsg_ftrace( DBM_DPATH, "mb send failed\r\n", retval );
return FAIL;
}
return retval;
}
/****************************************************************************/
/* User control to set scan and switch execution context */
/****************************************************************************/
int08 datapath_UserSetScan( int16 value )
{
int08 retval;
if( mbSend( datapathMbxID, DPMSG_SCAN, 1500, (uint32)value, FALSE, (uint32)(&retval) ) != MBM_PASS )
{
dbmsg_ftrace( DBM_DPATH, "mb send failed\r\n", retval );
return FAIL;
}
return retval;
}
/****************************************************************************/
/* User control to set image size and switch execution context */
/****************************************************************************/
int08 datapath_UserSetImageSize( uint08 value, int16 size )
{
int08 retval;
if( mbSend( datapathMbxID, DPMSG_IMAGESIZE, 1500, (uint32)(value<<16 | size), FALSE, (uint32)(&retval) ) != MBM_PASS )
{
dbmsg_ftrace( DBM_DPATH, "mb send failed\r\n", retval );
return FAIL;
}
return retval;
}
/****************************************************************************/
/* User control to set aspect ratio and switch execution context */
/****************************************************************************/
int08 datapath_UserSetAspectRatio( uint08 value )
{
int08 retval;
if( mbSend( datapathMbxID, DPMSG_ASPECTRATIO, 1500, (uint32)value, FALSE, (uint32)(&retval) ) != MBM_PASS )
{
dbmsg_ftrace( DBM_DPATH, "mb send failed\r\n", retval );
return FAIL;
}
return retval;
}
/****************************************************************************/
/* User control to set pan and switch execution context */
/****************************************************************************/
int08 datapath_UserSetImagePosition( int16 value )
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -