/**
 *  @brief        Initialize the CBUS hardware for the current instance.
 *
 *  @return    Status
 *  @retval    true        Success
 *  @retval    false        Failure
 *
 *  @note: Requires that SiiDrvCbusInstanceSet() is called prior to this call
 * 
 *****************************************************************************/
 bool_t SiiDrvCbusInitialize ( void )
{
    uint_t  index;

    SiiRegModify(RX_A__SWRST2, RX_M__SWRST2__CBUS_SRST, SET_BITS);
    SiiRegModify(RX_A__SWRST2, RX_M__SWRST2__CBUS_SRST, CLEAR_BITS);

    memset( pDrvCbus, 0, sizeof( CbusDrvInstanceData_t ));

    // Setup local DEVCAP registers for read by the peer
    for ( index = 0; index < (sizeof( cbusInitCbusRegsList) / 2); index += 2 )
    {
        SiiRegWrite( cbusInitCbusRegsList[ index], cbusInitCbusRegsList[ index + 1] );
    }

    // Audio link mode update by switch status
    if ( SiiSpdifEnableGet() || !SiiTdmEnableGet() )
    {
        SiiRegWrite(REG_CBUS_DEVICE_CAP_6, MHL_AUD_LINK_MODE_2CH);
    }
    
    // Enable the VS commands, all interrupts, and clear legacy
    SiiRegWrite( REG_CBUS_INTR_0_MASK, 0xFF );      // Enable desired interrupts
    SiiRegWrite( REG_CBUS_INTR_1_MASK, 0xCC );      // Enable desired interrupts
    SiiRegWrite( RX_CBUS_CH_RST_CTRL, 0x00 );       // MHL: Tri-state CBUS

#ifdef MHAWB_SUPPORT
    SiiDrvHawbEnable(false);
#endif
    return( true );
}
Example #2
0
//------------------------------------------------------------------------------
// Function:    SiiCbusAbortTimerStart
//------------------------------------------------------------------------------
void SiiCbusAbortTimerStart (void)
{
#ifdef MHAWB_SUPPORT
    SiiDrvHawbEnable(false);    //Disable HAWB when receive abort.
#endif
    SiiOsTimerStart(pCbus->chState.abortTimer, CBUS_ABORT_TIMER);
    SiiCbusAbortStateSet(true);
}
Example #3
0
static int_t CBusSendNextInQueue (void)
{
    int_t   result = SUCCESS;    

    if (SiiCbusAbortStateGet())
    {
        return( SUCCESS );
    }

    if ( ( pCbus->chState.request[ CH_ACTIVE_INDEX].reqStatus != CBUS_REQ_PENDING ) )
    {
#ifdef MHAWB_SUPPORT
        if (pCbus->chState.connected && (!pCbus->chState.burstWaitState))
        {
            if (pCbus->chState.remote_dcap[0x0A] & MHL_FEATURE_SP_SUPPORT)
                SiiDrvHawbEnable(true); //There's no pending CBUS message need to send out, take HAWB ON
        }
#endif
	    return( SUCCESS );
    }

#ifdef MHAWB_SUPPORT
    if (SiiDrvHawbEnable(false))
#endif
    {
        // Found a pending message, send it out
        if ( SiiDrvInternalCBusWriteCommand( &pCbus->chState.request[ CH_ACTIVE_INDEX] ))
        {
            pCbus->chState.state = CBUS_SENT;
            pCbus->chState.request[ CH_ACTIVE_INDEX].reqStatus = CBUS_REQ_SENT;
        }
        else
        {
            result = ERROR_WRITE_FAILED;
        }
    }
    return( result );
}