⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 datapath.c

📁 IT projecotr reference design.
💻 C
📖 第 1 页 / 共 4 页
字号:
        case DPMSG_STATE_TOGGLEBLANK:
            datapath_StopCurrentOperation();
            datapath_GotoState( SUSPENDED );
            
            blankScreenEnabled = TRUE;
            break;
        
        case DPMSG_STATE_SUSPENDSCAN:
            datapath_StopCurrentOperation();
            datapath_GotoState( SUSPENDED );
            break;
        
        default:
            if( datapath_TimeElapsedInState() >= 1000 )
            {
                /* if flush msg is not found after 1 second, assume the msg was lost */
                dbmsg_ftrace( DBM_DPATH, "Error: Datapath flush message lost (mailbox full?)\r\n" );

                /* try brute force recovery */
                RTA_MbxFlush( datapathMbxID );
                datapath_StopCurrentOperation();
                datapath_GotoState( BEGIN_SCAN );
            }
            break;
        }
        break;

    case LOOK_FOR_SYNCS:
        switch( msgID )
        {
        case DPMSG_STATE_SYNCSDETECTED:
            datapath_GotoState( ATTEMPT_LOCK );
            break;
        
        case DPMSG_STATE_TOGGLEBLANK:
            datapath_StopCurrentOperation();
            datapath_GotoState( SUSPENDED );
            
            blankScreenEnabled = TRUE;
            break;
        
        case DPMSG_STATE_SUSPENDSCAN:
            datapath_StopCurrentOperation();
            datapath_GotoState( SUSPENDED );
            break;
        
        default:
            if( datapath_TimeElapsedInState() >= 1000 && autoSourceSelect )
            {
                /* if we are searching all connectors, give up after 1 second */
                /* cannot find syncs on the current connector, so cycle to next connector */
                datapath_StopCurrentOperation();
                datapath_CycleConnector( FALSE );
                datapath_GotoState( BEGIN_SCAN );
            }
            break;
        }
        break;
        
    case ATTEMPT_LOCK:
        switch( msgID )
        {
        case DPMSG_STATE_LOCKED:
            datapath_GotoState( MONITOR_SOURCE );
            break;
        
        case DPMSG_STATE_LOSTLOCK:
        case DPMSG_STATE_REACQUIRE:
            /* cannot find source on the current connector, so cycle to next connector */
            datapath_StopCurrentOperation();
            datapath_CycleConnector( FALSE );       
            datapath_GotoState( BEGIN_SCAN );
            break;

        case DPMSG_ALC_PHASESTART:
            /* display intermediate result */
            datapath_ConfigureForExternalSource();
            DISP_SetFreeze(TRUE);
            break;
            
        case DPMSG_ALC_PHASEEND:
            DISP_SetFreeze(FALSE);
            break;
        
        case DPMSG_STATE_TOGGLEBLANK:
            datapath_StopCurrentOperation();
            datapath_GotoState( SUSPENDED );
            
            blankScreenEnabled = TRUE;
            break;
        
        case DPMSG_STATE_SUSPENDSCAN:
            datapath_StopCurrentOperation();
            datapath_GotoState( SUSPENDED );
            break;
        
        default:
            if( datapath_TimeElapsedInState() >= 15000 )
            {
                /* give up after 15 seconds */
                /* cannot find source on the current connector, so cycle to next connector */
                datapath_StopCurrentOperation();
                datapath_CycleConnector( FALSE );
                datapath_GotoState( BEGIN_SCAN );
            }
            break;
        }
        break;

    case MONITOR_SOURCE:
        switch( msgID )
        {
        case DPMSG_STATE_LOSTLOCK:
            sourceDesc.sourceActive = FALSE;

            if( !blankScreenEnabled )
            {
                source_DisplaySFG( &sourceDesc );
                dispfmt_ConfigureForSource( FALSE );
                datapath_StopCurrentOperation();
                guiSourceStatusMessage( GUI_SOURCE_LOST );
        
                datapath_GotoState( BEGIN_SCAN );
            }
            else
            {
                datapath_StopCurrentOperation();
                datapath_GotoState( SUSPENDED );
            }
            break;
            
        case DPMSG_STATE_REACQUIRE:
            sourceDesc.sourceActive = FALSE;

            if( !blankScreenEnabled )
            {
                source_DisplaySFG( &sourceDesc );
                dispfmt_ConfigureForSource( FALSE );
                guiSourceStatusMessage( GUI_SOURCE_LOST );
            
                datapath_GotoState( ATTEMPT_LOCK );
            }
            else
            {
                datapath_StopCurrentOperation();
                datapath_GotoState( SUSPENDED );
            }
            break;
        
        case DPMSG_STATE_TOGGLEBLANK:
            if( !blankScreenEnabled )
            {
                sourceDesc.sourceActive = FALSE;
                blankScreenEnabled = TRUE;
          
                datapath_StoreSourceDesc();
                source_DisplaySFG( &sourceDesc );
                dispfmt_ConfigureForSource( FALSE );
            }
            else
            {
                              /* remove SFG/splash, display external source */
                DISP_SetChannelSource( SRC_PRIMARY, DISP_EXTERNAL_SOURCE );

                sourceDesc.sourceActive = TRUE;
                blankScreenEnabled = FALSE;
                    /* don't change state, just restore settings for source */
                sourceDesc.activeDisplay = DP_EXTERNAL;
                datapath_RetrieveSourceDesc();
                dispfmt_ConfigureForSource( FALSE );
            }
            break;
            
        case DPMSG_STATE_RESYNC:
            sourceDesc.sourceActive = FALSE;
            datapath_StopCurrentOperation();
            source_DisplaySFG( &sourceDesc );
            dispfmt_ConfigureForSource( FALSE );
            guiSourceStatusMessage( GUI_SOURCE_LOST );

            datapath_GotoState( BEGIN_SCAN );
            break;
        }
    default:
        break;    
    }
}

/****************************************************************************/
/* Datapath state transition                                                */
/*   !!! NOTE: This function should only be called within the context       */
/*             of the datapath task                                         */
/****************************************************************************/

void datapath_GotoState( uint08 newState )
{
                              /* ensure that this function is non-reentrant */
    if( RTA_TaskGetCurrentTaskID() != datapathTaskID )
    {
        dbmsg_ftrace( DBM_DPATH, "Datapath Error: Attempted to call datapath_GotoState() from external task\r\n" );
        return;
    }

                                               /* initialize for next state */
    switch( newState )
    {
    case SPLASH_AT_STARTUP:
                                                             /* load splash */
        source_DisplaySplash( &sourceDesc );
        dispfmt_ConfigureForSource( TRUE );
        pictcont_ConfigureForInternalSource();

                              /* poll every 0.5 seconds if time has elasped */
        datapathTaskPollPeriod = 500;
        break;

    case SUSPENDED:
    default:
        /* suspend the task indefinitely */
        datapathTaskPollPeriod = 0;
        break;
    case TPG_DISPLAYED:
        /* suspend the task indefinitely, alert GUI */
        datapathTaskPollPeriod = 0;
        guiSourceStatusMessage( GUI_SOURCE_TPG );
        break;
    
    case BEGIN_SCAN:
        /* manually flush mailbox to clean out old AutoLock status messages */
        /* without losing user messages                                     */
        flushIndex++;
        mbSend( datapathMbxID, DPMSG_STATE_FLUSHED, -1, flushIndex, FALSE, 0 );
    
        guiSourceStatusMessage( (GUI_SOURCEENUM) sourceDesc.connector );
        guiSourceStatusMessage( GUI_SOURCE_SEARCHING );
        
                            /* poll every 0.5 seconds if flush msg was lost */
        datapathTaskPollPeriod = 500;
        break;
    
    case LOOK_FOR_SYNCS:
        /* connector scan started -- initialize device and APIs to detect syncs */               
        switch( sourceDesc.connector )
        {
        case DVI:
            dvicontrol_ConfigureForSearch( sourceDesc.connector );
            break;
            
        case VGA:
            adccontrol_ConfigureForSearch( sourceDesc.connector );
            break;
            
        case COMPOSITE:
        case SVIDEO:
        case COMPONENT:
            deccontrol_ConfigureForSearch( sourceDesc.connector );
            break;
        }
        
                       /* poll every 100 milliseconds if syncs are detected */
        datapathTaskPollPeriod = 100;
        break;
    
    case ATTEMPT_LOCK:
                                   /* syncs found -- wait to lock to source */
                   /* poll every 100 milliseconds if the source is detected */
        datapathTaskPollPeriod = 100;
        break;
        
    case MONITOR_SOURCE:
                          /* source locked -- configure datapath for source */
        if( datapath_ConfigureForExternalSource() != PASS )
        {
                           /* if FillSourceConfig failed, redisplay SFG and */
                           /*   output OOR msg to GUI                       */
            sourceDesc.sourceActive = FALSE;
            source_DisplaySFG( &sourceDesc );
            dispfmt_ConfigureForSource( FALSE );
            
            guiSourceStatusMessage( GUI_SOURCE_OOR );
        }
        else
        {
            guiSourceStatusMessage( GUI_SOURCE_FOUND );
        }
        
                                /* poll every 0.5 seconds to monitor source */
        datapathTaskPollPeriod = 500;        
        break;
    }
    
    datapath_ResetTimeInState();
    datapathState = newState;
    dbmsg_ftrace( DBM_DPATH, "Datapath: Transition to %s on %s\r\n", datapathStateStringTable[datapathState], datapathConnectorStringTable[sourceDesc.connector] );
}


/****************************************************************************/
/* This function initializes the datapath statemachine during lamp strike   */
/****************************************************************************/

void datapath_StartDisplay( void )
{
    uint16 DMD_Width, DMD_Height;
    
    DMD_GetResolution( &DMD_Width, &DMD_Height );

    sourceDesc.sourceActive = FALSE;
    sourceDesc.port = SRC_PORT1;
    sourceDesc.inputHeight = DMD_Height;
    sourceDesc.inputWidth = DMD_Width;
    sourceDesc.nativeHeight = DMD_Height;
    sourceDesc.nativeWidth = DMD_Width;
    sourceDesc.okToDeinterlace = FALSE;
    sourceDesc.isVideo = FALSE;
    sourceDesc.isHighDefinitionVideo = FALSE;
    sourceDesc.inputFrameRate = 60.0f;
    
    savedDesc.inputHeight = DMD_Height;
    savedDesc.inputWidth = DMD_Width;
    savedDesc.nativeHeight = DMD_Height;
    savedDesc.nativeWidth = DMD_Width;
    savedDesc.inputFrameRate = 60.0f;

    EE_GETVAR( UserMachine.Projector.LastSource, sourceDesc.connector );
    EE_GETVAR( UserMachine.Projector.AutoSourceSelect, autoSourceSelect );

    blankScreenEnabled = FALSE;

                                          /**********************************/
                                          /* Datapath API init              */
                                          /**********************************/
    source_InitializeOnce( &sourceDesc );
    dispfmt_InitializeOnce();
    pictcont_InitializeOnce();
    
                                          /**********************************/
                                          /* One time AutoLock init         */
                                          /**********************************/
    if (ALC_AutoLockInit() == PASS)
    {
                                         /* Install Autolock event callback */
        ALC_InstallEventCallback(datapath_AlockEventHandler);

                /* Install the handler for autolock debug messages          */
                /* Note: the dbMessage mask in EEPROM must also set the     */
                /*       AutoLock bit to display ALC debug messages         */
        ALC_InstallDebugMessageCallback(datapath_AlockDebugTrace);
        ALC_SetEnableDebugMessages(TRUE);
    }
    
                                          /**********************************/
                                          /* Device dependent init          */
                                          /**********************************/
    adccontrol_powerNormal();
    dvicontrol_powerNormal();
    deccontrol_powerNormal();
    
                                          /**********************************/
                                          /* Select startup state           */
                                          /**********************************/
    if( gpConfiguration->Datapath.SplashAtStartupEnable )
    {
                         /* initialize the state machine to startup splash */
        datapath_GotoState( SPLASH_AT_STARTUP );
    }
    else
    {
                            /* start connector scan immediately on startup */
        source_DisplaySFG( &sourceDesc );
        dispfmt_ConfigureForSource( TRUE );
        pictcont_ConfigureForInternalSource();
        datapath_GotoState( BEGIN_SCAN );
    }
}

/****************************************************************************/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -