Пример #1
0
void dtvd_tuner_main_inevt_send_msg
(
    signed int evtcode,                 
    unsigned short toid,                
    unsigned short fromid,              
    void* body,                         
    unsigned int length                 
)
{
    DTVD_TUNER_RCVMSG_t* send = tdtvd_tuner_main.inevt;
    signed int i;

    if( body == D_DTVD_TUNER_NULL )
    {

        DTVD_TUNER_SYSERR_RANK_A( D_DTVD_TUNER_SYSERR_DRV_PARAM,
                                  DTVD_TUNER_MAIN,
                                  0, 0, 0, 0, 0, 0 );
        return;
    }

    for( i = 0; i < D_DTVD_TUNER_INEVT_CUE_NUM; i++ )
    {

        if( send->available == D_DTVD_TUNER_FALSE )
        {
            break;
        }
        send++;
    }
    if( i == D_DTVD_TUNER_INEVT_CUE_NUM )
    {

        DTVD_TUNER_SYSERR_RANK_A( D_DTVD_TUNER_SYSERR_DRV_ETC,
                                  DTVD_TUNER_MAIN,
                                  0, 0, 0, 0, 0, 0 );
        return;
    }

    dtvd_tuner_memset( send, 0x00,
                       sizeof(DTVD_TUNER_RCVMSG_t),
                       sizeof(DTVD_TUNER_RCVMSG_t) );
    send->available = D_DTVD_TUNER_TRUE;
    send->toid      = toid;
    send->fromid    = fromid;
    send->command   = evtcode;
    dtvd_tuner_memmove( &send->buff, body, length, sizeof(DTVD_TUNER_MSG_u) );

    return;
}
Пример #2
0
void dtvd_tuner_cn_com_symcount_chg_timer
(
    unsigned char symcount  
)
{
    unsigned int count;
    unsigned int symcount_max;

    DTVD_DEBUG_MSG_ENTER( 0, 0, 0 );

    symcount_max = ( sizeof( c_symcount ) / sizeof( c_symcount[0]) );

    for( count = 0; count < symcount_max; count++ )
    {
        if( c_symcount[count].symcount == symcount )
        {

            tdtvd_tuner_cn.measure_time = c_symcount[count].timer;
            break;
        }
    }

    if ( count >= symcount_max )
    {

        DTVD_TUNER_SYSERR_RANK_A( D_DTVD_TUNER_SYSERR_DRV_PARAM,
                                  DTVD_TUNER_CN_COM,
                                  0, 0, 0, 0, 0, 0 );
        return;
    }

    DTVD_DEBUG_MSG_EXIT();
    return;
}
Пример #3
0
void dtvd_tuner_timer_stop
(
    unsigned long funcid               
)
{
    signed int ret;

    DTVD_TUNER_TIMER_t *timer_info = &tdtvd_tuner_main.timer;

    DTVD_DEBUG_MSG_ENTER( (int)funcid, 0, 0 );

    if( funcid >= D_DTVD_TUNER_TIMER_MAX )
    {

        DTVD_TUNER_SYSERR_RANK_A( D_DTVD_TUNER_SYSERR_DRV_PARAM,
                                  DTVD_TUNER_TIMER,
                                  funcid, 0, 0, 0, 0, 0 );
        return;
    }

    if( timer_info->list[funcid].state == D_DTVD_TUNER_TIMER_STOP )
    {
        DTVD_DEBUG_MSG_EXIT();
        return;
    }

#ifdef DTVD_NO_HRTIMER
    ret = del_timer( &timer_info->list[funcid].info );
#else
	ret = hrtimer_cancel( &timer_info->list[funcid].info );
#endif 

    if( ret < 0 )
    {

        DTVD_TUNER_SYSERR_RANK_A( D_DTVD_TUNER_SYSERR_DRV_SYSTEM,
                                  DTVD_TUNER_TIMER,
                                  0, 0, 0, 0, 0, 0 );
        return;
    }

    timer_info->list[funcid].state = D_DTVD_TUNER_TIMER_STOP;

    DTVD_DEBUG_MSG_EXIT();
    return;
}
Пример #4
0
static void dtvd_tuner_timer_handler_callfunc
(
    unsigned long   funcid,         
    unsigned char   *need_toevt     
)
{
    unsigned long   mask;

    if( need_toevt == NULL )
    {

        DTVD_TUNER_SYSERR_RANK_A( D_DTVD_TUNER_SYSERR_DRV_PARAM,
                                  DTVD_TUNER_TIMER,
                                  0, 0, 0, 0, 0, 0 );
        return;
    }

    *need_toevt = D_DTVD_TUNER_TRUE;

    mask = 0;
    set_bit( D_DTVD_TUNER_TIMER_PWRON_HALFWAY, (void *)&mask );

    if( ( funcid & mask ) == mask )
    {

            {
                DTVD_TUNER_MSG_u    body;
                unsigned int        len;

                len = sizeof(DTVD_TUNER_EXEVT_TIMEOUT_t);
                dtvd_tuner_memset( &body, 0x00,
                                   len,
                                   sizeof(DTVD_TUNER_MSG_u) );

                dtvd_tuner_msg_send( D_DTVD_TUNER_BLK_TIMER,
                                     D_DTVD_TUNER_CMD_TIMER_PWR_HALFTIMEOUT,
                                     &body, len );
            }

        *need_toevt = D_DTVD_TUNER_FALSE;

    }

    mask = 0;
    set_bit( D_DTVD_TUNER_TIMER_PWRON, (void *)&mask );

    if( ( funcid & mask ) == mask )
    {

        dtvd_tuner_timer_pwron();

        *need_toevt = D_DTVD_TUNER_TRUE;

    }

    return ;
}
Пример #5
0
void dtvd_tuner_timer_mdelay
(
    unsigned long   count        
)
{
    DTVD_DEBUG_MSG_ENTER( (int)count, 0, 0 );

    if( count > 10 )
    {

        DTVD_TUNER_SYSERR_RANK_A( D_DTVD_TUNER_SYSERR_DRV_PARAM,
                                  DTVD_TUNER_TIMER,
                                  count, 0, 0, 0, 0, 0 );
        return;
    }

    if( count != 0 )
    {
        mdelay( count );
    }

    DTVD_DEBUG_MSG_EXIT();
    return;
}
Пример #6
0
int dtvd_tuner_main
(
    void* param                         
)
{
    signed int              evtcode;
    DTVD_TUNER_FUNC_t       procp;
    DTVD_TUNER_CONTROL_t    *info = &tdtvd_tuner_info;

    dtvd_tuner_main_init();

    for(;;)
    {

        if( atomic_read( &info->event_flg ) == 0 )
        {

            wait_event_interruptible( tdtvd_tuner_info.wait_queue,
                                      atomic_read(&info->event_flg) );

        }

        if( atomic_read( &info->event_flg ) == 0 )
        {
            DTVD_DEBUG_MSG_INFO("missing signal\n");
            continue;
        }

        dtvd_tuner_main_exevt_rcv();

        DTVD_DEBUG_MSG_INFO("dtvd recv event from_id(%d) command(%d)\n", tdtvd_tuner_msg.fromid, tdtvd_tuner_msg.command);

        if( (tdtvd_tuner_msg.fromid  == D_DTVD_TUNER_BLK_TIMER) && 
            (tdtvd_tuner_msg.command == D_DTVD_TUNER_CMD_TIMER_PWR_HALFTIMEOUT) )
        {

            dtvd_tuner_timer_pwron_halfway();
            continue;
        }

        evtcode = dtvd_tuner_main_exevt_analyze();

        do
        {
            DTVD_DEBUG_MSG_INFO( "evtcode=%d\n", evtcode );

            procp = dtvd_tuner_main_matrix( evtcode );
            if( procp != D_DTVD_TUNER_NULL )
            {

                (*procp)();
            }
            else
            {

                DTVD_TUNER_SYSERR_RANK_A( D_DTVD_TUNER_SYSERR_DRV_STATE,
                                          DTVD_TUNER_MAIN,
                                          (unsigned long)evtcode,
                                          ((unsigned long)tdtvd_tuner_core.status << 16 )  | (unsigned long)tdtvd_tuner_ant.status ,
                                          ((unsigned long)tdtvd_tuner_tuner.status << 16 ) | (unsigned long)tdtvd_tuner_agc.status ,
                                          ((unsigned long)tdtvd_tuner_tmcc.status << 16 )  | (unsigned long)tdtvd_tuner_cn.status ,
                                          ((unsigned long)tdtvd_tuner_ber.status << 16 )   | (unsigned long)tdtvd_tuner_state.status ,

                                          (unsigned long)tdtvd_tuner_autoeco.status << 16 );
	      printk("******procp == D_DTVD_TUNER_NULL\n");
                dtvd_tuner_core_wakeup(0xFFFFFFFF);
            }

            dtvd_tuner_main_inevt_rcv();

            evtcode = dtvd_tuner_main_inevt_analyze();
        }
        while( evtcode != D_DTVD_TUNER_NOEVENT );
    }

    return 0;
}
Пример #7
0
void dtvd_tuner_state_com_action
(
    unsigned char   kind            
)
{
    const DTVD_TUNER_STATE_ACT_REQUEST_t* actp;

    if( kind >= D_DTVD_TUNER_STATE_TBL_MAX )
    {

        DTVD_TUNER_SYSERR_RANK_A( D_DTVD_TUNER_SYSERR_DRV_PARAM,
                                  DTVD_TUNER_STATE_COM,
                                  (unsigned long)kind, 0, 0, 0, 0, 0 );
        return;
    }

    actp = dtvd_tuner_state_com_get_action( kind,
                                            tdtvd_tuner_state.state_old,
                                            tdtvd_tuner_state.state_new );
    if( actp == D_DTVD_TUNER_NULL )
    {

        DTVD_TUNER_SYSERR_RANK_A( D_DTVD_TUNER_SYSERR_DRV_PARAM,
                                  DTVD_TUNER_STATE_COM,
                                  0, 0, 0, 0, 0, 0 );
        return;
    }

    if( (actp->event & D_DTVD_TUNER_STATE_ACT_ERR) != 0 )
    {

        DTVD_TUNER_SYSERR_RANK_A( D_DTVD_TUNER_SYSERR_DRV_STATE,
                                  DTVD_TUNER_STATE_COM,
                                  tdtvd_tuner_state.state_old,
                                  tdtvd_tuner_state.state_new, 0, 0, 0, 0 );
        return;
    }

    if( (actp->event & D_DTVD_TUNER_STATE_ACT_MODE) != 0 )
    {

        dtvd_tuner_state_trans_msg_mode_ok();
    }

    if( (actp->event & D_DTVD_TUNER_STATE_ACT_SYNC) != 0 )
    {

        dtvd_tuner_state_trans_msg_sync();
    }

    if( (actp->event & D_DTVD_TUNER_STATE_ACT_TMCC) != 0 )
    {

        dtvd_tuner_state_trans_msg_tmcc();
    }

    if( (actp->event & D_DTVD_TUNER_STATE_ACT_TSOUT) != 0 )
    {

        dtvd_tuner_state_trans_msg_tsout();
    }

    if( (actp->event & D_DTVD_TUNER_STATE_ACT_ASYNC) != 0 )
    {

        dtvd_tuner_state_trans_msg_async();
    }

    tdtvd_tuner_state.state_old = actp->next_state;

    return;
}
Пример #8
0
static const DTVD_TUNER_STATE_ACT_REQUEST_t* dtvd_tuner_state_com_get_action
(
    unsigned char   kind,           
    unsigned int    old_state,      
    unsigned int    new_state       
)
{

    static const DTVD_TUNER_STATE_ACT_REQUEST_MTX_t tbl_watch =
    {

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S1, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S2, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S3, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S4, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S5, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S6, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S7, D_DTVD_TUNER_STATE_ACT_MODE | D_DTVD_TUNER_STATE_ACT_SYNC },
        { D_DTVD_TUNER_STATE_S8, D_DTVD_TUNER_STATE_ACT_MODE | D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_MODE | D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC | D_DTVD_TUNER_STATE_ACT_TSOUT } 
        },

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S1, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S2, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S3, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S4, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S5, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S6, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S7, D_DTVD_TUNER_STATE_ACT_MODE | D_DTVD_TUNER_STATE_ACT_SYNC },
        { D_DTVD_TUNER_STATE_S8, D_DTVD_TUNER_STATE_ACT_MODE | D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_MODE | D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC | D_DTVD_TUNER_STATE_ACT_TSOUT } 
        },

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S1, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S2, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S3, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S4, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S5, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S6, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S7, D_DTVD_TUNER_STATE_ACT_MODE | D_DTVD_TUNER_STATE_ACT_SYNC },
        { D_DTVD_TUNER_STATE_S8, D_DTVD_TUNER_STATE_ACT_MODE | D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_MODE | D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC | D_DTVD_TUNER_STATE_ACT_TSOUT } 
        },

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S3, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S4, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S5, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S6, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S7, D_DTVD_TUNER_STATE_ACT_SYNC },
        { D_DTVD_TUNER_STATE_S8, D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC | D_DTVD_TUNER_STATE_ACT_TSOUT } 
        },

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S4, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S5, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S6, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S7, D_DTVD_TUNER_STATE_ACT_SYNC },
        { D_DTVD_TUNER_STATE_S8, D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC | D_DTVD_TUNER_STATE_ACT_TSOUT } 
        },

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S5, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S6, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S7, D_DTVD_TUNER_STATE_ACT_SYNC },
        { D_DTVD_TUNER_STATE_S8, D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC | D_DTVD_TUNER_STATE_ACT_TSOUT } 
        },

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S6, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S7, D_DTVD_TUNER_STATE_ACT_SYNC },
        { D_DTVD_TUNER_STATE_S8, D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC | D_DTVD_TUNER_STATE_ACT_TSOUT } 
        },

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S7, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S8, D_DTVD_TUNER_STATE_ACT_TMCC },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_TMCC | D_DTVD_TUNER_STATE_ACT_TSOUT } 
        },

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S8, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_TSOUT } 
        },

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_NONE } 
        }
    };

    static const DTVD_TUNER_STATE_ACT_REQUEST_MTX_t tbl_sync =
    {

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S1, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S2, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S3, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S4, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S5, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S6, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S7, D_DTVD_TUNER_STATE_ACT_MODE | D_DTVD_TUNER_STATE_ACT_SYNC },
        { D_DTVD_TUNER_STATE_S8, D_DTVD_TUNER_STATE_ACT_MODE | D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_MODE | D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC | D_DTVD_TUNER_STATE_ACT_TSOUT } 
        },

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S1, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S2, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S3, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S4, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S5, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S6, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S7, D_DTVD_TUNER_STATE_ACT_MODE | D_DTVD_TUNER_STATE_ACT_SYNC },
        { D_DTVD_TUNER_STATE_S8, D_DTVD_TUNER_STATE_ACT_MODE | D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_MODE | D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC | D_DTVD_TUNER_STATE_ACT_TSOUT } 
        },

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S1, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S2, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S3, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S4, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S5, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S6, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S7, D_DTVD_TUNER_STATE_ACT_MODE | D_DTVD_TUNER_STATE_ACT_SYNC },
        { D_DTVD_TUNER_STATE_S8, D_DTVD_TUNER_STATE_ACT_MODE | D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_MODE | D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC | D_DTVD_TUNER_STATE_ACT_TSOUT } 
        },

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S3, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S4, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S5, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S6, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S7, D_DTVD_TUNER_STATE_ACT_SYNC },
        { D_DTVD_TUNER_STATE_S8, D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC | D_DTVD_TUNER_STATE_ACT_TSOUT } 
        },

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S4, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S5, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S6, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S7, D_DTVD_TUNER_STATE_ACT_SYNC },
        { D_DTVD_TUNER_STATE_S8, D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC | D_DTVD_TUNER_STATE_ACT_TSOUT } 
        },

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S5, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S6, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S7, D_DTVD_TUNER_STATE_ACT_SYNC },
        { D_DTVD_TUNER_STATE_S8, D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC | D_DTVD_TUNER_STATE_ACT_TSOUT } 
        },

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S6, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S7, D_DTVD_TUNER_STATE_ACT_SYNC },
        { D_DTVD_TUNER_STATE_S8, D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC | D_DTVD_TUNER_STATE_ACT_TSOUT } 
        },

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S7, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S8, D_DTVD_TUNER_STATE_ACT_TMCC },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_TMCC | D_DTVD_TUNER_STATE_ACT_TSOUT } 
        },

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S8, D_DTVD_TUNER_STATE_ACT_NONE  },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_TSOUT } 
        },

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_NONE  } 
        }

    };

    static const DTVD_TUNER_STATE_ACT_REQUEST_MTX_t tbl_tsout =
    {

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S1, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S2, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S3, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S4, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S5, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S6, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S7, D_DTVD_TUNER_STATE_ACT_MODE | D_DTVD_TUNER_STATE_ACT_SYNC },
        { D_DTVD_TUNER_STATE_S8, D_DTVD_TUNER_STATE_ACT_MODE | D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_MODE | D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC | D_DTVD_TUNER_STATE_ACT_TSOUT } 
        },

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S1, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S2, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S3, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S4, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S5, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S6, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S7, D_DTVD_TUNER_STATE_ACT_MODE | D_DTVD_TUNER_STATE_ACT_SYNC },
        { D_DTVD_TUNER_STATE_S8, D_DTVD_TUNER_STATE_ACT_MODE | D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_MODE | D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC | D_DTVD_TUNER_STATE_ACT_TSOUT } 
        },

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S1, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S2, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S3, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S4, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S5, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S6, D_DTVD_TUNER_STATE_ACT_MODE },
        { D_DTVD_TUNER_STATE_S7, D_DTVD_TUNER_STATE_ACT_MODE | D_DTVD_TUNER_STATE_ACT_SYNC },
        { D_DTVD_TUNER_STATE_S8, D_DTVD_TUNER_STATE_ACT_MODE | D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_MODE | D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC | D_DTVD_TUNER_STATE_ACT_TSOUT } 
        },

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S3, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S4, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S5, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S6, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S7, D_DTVD_TUNER_STATE_ACT_SYNC },
        { D_DTVD_TUNER_STATE_S8, D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC | D_DTVD_TUNER_STATE_ACT_TSOUT } 
        },

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S4, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S5, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S6, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S7, D_DTVD_TUNER_STATE_ACT_SYNC },
        { D_DTVD_TUNER_STATE_S8, D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC | D_DTVD_TUNER_STATE_ACT_TSOUT } 
        },

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S5, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S6, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S7, D_DTVD_TUNER_STATE_ACT_SYNC },
        { D_DTVD_TUNER_STATE_S8, D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC | D_DTVD_TUNER_STATE_ACT_TSOUT } 
        },

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S6, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S7, D_DTVD_TUNER_STATE_ACT_SYNC },
        { D_DTVD_TUNER_STATE_S8, D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_SYNC | D_DTVD_TUNER_STATE_ACT_TMCC | D_DTVD_TUNER_STATE_ACT_TSOUT } 
        },

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S7, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S8, D_DTVD_TUNER_STATE_ACT_TMCC },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_TMCC | D_DTVD_TUNER_STATE_ACT_TSOUT } 
        },

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S8, D_DTVD_TUNER_STATE_ACT_NONE },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_TSOUT } 
        },

        { 
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S0, D_DTVD_TUNER_STATE_ACT_ASYNC },
        { D_DTVD_TUNER_STATE_S9, D_DTVD_TUNER_STATE_ACT_TSOUT } 
        }
    };

    static const DTVD_TUNER_STATE_ACT_REQUEST_MTX_t * const tbl[] =
    {
        &tbl_watch,         
        &tbl_sync,          
        &tbl_tsout          
    };

    const DTVD_TUNER_STATE_ACT_REQUEST_MTX_t * actp;

    if( kind >= D_DTVD_TUNER_STATE_TBL_MAX )
    {

        DTVD_TUNER_SYSERR_RANK_A( D_DTVD_TUNER_SYSERR_DRV_PARAM,
                                  DTVD_TUNER_STATE_COM,
                                  0, 0, 0, 0, 0, 0 );
        return D_DTVD_TUNER_NULL;
    }

    if( (old_state >= D_DTVD_TUNER_STATE_S_MAX) || (new_state >= D_DTVD_TUNER_STATE_S_MAX) )
    {

        DTVD_TUNER_SYSERR_RANK_A( D_DTVD_TUNER_SYSERR_DRV_PARAM,
                                  DTVD_TUNER_STATE_COM,
                                  0, 0, 0, 0, 0, 0 );
        return D_DTVD_TUNER_NULL;
    }

    actp = tbl[kind];
    return &(*actp)[old_state][new_state];

}
Пример #9
0
void dtvd_tuner_timer_start
(
    unsigned long  funcid,      
    unsigned int   count        
)
{
    unsigned long data;

    volatile unsigned long temp_jiffies;   
    unsigned long main_exp;
    unsigned long sub_exp;

    DTVD_TUNER_TIMER_t *timer_info = &tdtvd_tuner_main.timer;

    DTVD_DEBUG_MSG_ENTER( (int)funcid, count, 0 );

    if( funcid >= D_DTVD_TUNER_TIMER_MAX )
    {

        DTVD_TUNER_SYSERR_RANK_A( D_DTVD_TUNER_SYSERR_DRV_PARAM,
                                  DTVD_TUNER_TIMER,
                                  funcid, count, 0, 0, 0, 0 );
        return;
    }

    dtvd_tuner_timer_stop( funcid );

    if( timer_info->timer_id < D_DTVD_TUNER_TIMER_TIMERID_MAX )
    {
        timer_info->timer_id++;

    }
    else
    {
        timer_info->timer_id = 1;
    }
    data = timer_info->timer_id;

    data = data | ( (unsigned long)D_DTVD_TUNER_TIMER_KIND_START_BIT << funcid );

    if( count == 0 )
    {

        timer_info->list[funcid].state = D_DTVD_TUNER_TIMER_RUN;
#ifdef DTVD_NO_HRTIMER
        timer_info->list[funcid].info.data = data;
#else
        timer_info->list[funcid].data = data;
#endif

        dtvd_tuner_timer_handler( data );

        return;
    }

    temp_jiffies = jiffies;
#ifdef DTVD_NO_HRTIMER

    sub_exp = count % 10;
    main_exp = count / 10;
    main_exp *= 10;

    timer_info->list[funcid].info.expires = temp_jiffies + ( HZ * main_exp / 1000  );
    timer_info->list[funcid].info.data = data;
    timer_info->list[funcid].info.function = dtvd_tuner_timer_handler;

    add_timer( &timer_info->list[funcid].info );
#else

    sub_exp = count % 1000;
    main_exp = count / 1000;

    timer_info->list[funcid].data = data;

    hrtimer_start( &timer_info->list[funcid].info, ktime_set(main_exp,sub_exp * NSEC_PER_MSEC ), HRTIMER_MODE_REL);

#endif 

    timer_info->list[funcid].state = D_DTVD_TUNER_TIMER_RUN;

    DTVD_DEBUG_MSG_EXIT();
    return;
}