Exemplo n.º 1
0
static void mhl_work(struct work_struct *work)
{
	int T_Monitor = T_MONITORING_PERIOD;
	while(1) {
		SiiOsScheduler();
		if (!T_Monitor)
		{
			if (rcpKeyCode >= 0)
			{
	            if (!MhlTxCBusBusy())
	            {
	
	//            	SiiOsDebugPrintSimple(SII_OSAL_DEBUG_TRACE_ALWAYS,"App:%d Sending RCP (%02X)\n",(int)__LINE__, (int) rcpKeyCode);
	             	//
	             	// If RCP engine is ready, send one code
	             	//
	             	if( SiiMhlTxRcpSend( (uint8_t)rcpKeyCode ))
	             	{
	//             		SiiOsDebugPrintSimple(SII_OSAL_DEBUG_TRACE_ALWAYS,"App:%d SiiMhlTxRcpSend (%02X)\n",(int)__LINE__, (int) rcpKeyCode);
	             	}
	             	else
	             	{
	//             		SiiOsDebugPrintSimple(SII_OSAL_DEBUG_TRACE_ALWAYS,"App:%d SiiMhlTxRcpSend (%02X) Returned Failure.\n",(int)__LINE__, (int) rcpKeyCode);
	             	}
	             	rcpKeyCode = -1;
	            }
			}
	#ifdef ENABLE_WRITE_BURST_TEST
	        else if ( (!MhlTxCBusBusy()) && (testStart) )
	        {
	        #define TEST_COUNT_LIMIT 100
	            if (testCount < TEST_COUNT_LIMIT)
	            {
	            static uint8_t testData[17]="MyDogHasFleas\0\0\0";
	                if (0 == SiiMhlTxRequestWriteBurst(0,sizeof(testData)-1,testData))
	                {
	                    testCount++;
	                }
	            }
	            else
	            {
	                testStart = 0;
	                SiiOsDebugPrintSimple(SII_OSAL_DEBUG_TRACE_ALWAYS,"App:%d Write Burst test complete after %d iterations\n",(int)__LINE__,testCount);
	            }
	        }
	#endif //)
			if (rcpkParam >= 0)
			{
		        SiiMhlTxRcpkSend((uint8_t)rcpkParam);
		        rcpkParam = -1;
			}
			T_Monitor = T_MONITORING_PERIOD;
		}
		else
		{
			T_Monitor--;
		}
		msleep(10);
	}
}
ssize_t SendRcp(struct device *dev, struct device_attribute *attr,
				const char *buf, size_t count)
{
	unsigned long	keyCode;
	int				status = -EINVAL;
	SII_DEBUG_PRINT(SII_OSAL_DEBUG_TRACE,"SendRcp received string: ""%s""\n", buf);
	if(HalAcquireIsrLock() != HAL_RET_SUCCESS)
	{
		return -ERESTARTSYS;
	}
	while(gDriverContext.flags & MHL_STATE_FLAG_RCP_READY) {
		if(strict_strtoul(buf, 0, &keyCode)) {
			SII_DEBUG_PRINT(SII_OSAL_DEBUG_TRACE,"Unable to convert keycode string\n");
			break;
		}
		if(keyCode >= 0xFE) {
			SII_DEBUG_PRINT(SII_OSAL_DEBUG_TRACE,"keycode (0x%x) is too large to be valid\n", (int)keyCode);
			break;
		}
		gDriverContext.flags &= ~(MHL_STATE_FLAG_RCP_RECEIVED |
								  MHL_STATE_FLAG_RCP_ACK |
								  MHL_STATE_FLAG_RCP_NAK);
		gDriverContext.flags |= MHL_STATE_FLAG_RCP_SENT;
		gDriverContext.keyCode = (uint8_t)keyCode;
		SiiMhlTxRcpSend((uint8_t)keyCode);
		status = count;
		break;
	}
	HalReleaseIsrLock();
	return status;
}
Exemplo n.º 3
0
void    ProcessRcp(uint8_t event, uint8_t eventParameter)
{
	uint8_t         rcpKeyCode;

	switch (event) {
	case    MHL_TX_EVENT_DISCONNECTION:
		TPI_DEBUG_PRINT(("App: Got event = MHL_TX_EVENT_DISCONNECTION\n"));
		break;
	case    MHL_TX_EVENT_CONNECTION:
		TPI_DEBUG_PRINT(("App: Got event = MHL_TX_EVENT_CONNECTION\n"));
		break;
	case    MHL_TX_EVENT_RCP_READY:
#if 0
		rcpKeyCode = APP_DEMO_RCP_SEND_KEY_CODE;
		TPI_DEBUG_PRINT(("App: Got event = MHL_TX_EVENT_RCP_READY...Sending RCP (%02X)\n", (int) rcpKeyCode));
		if ((0 == (BIT_0 & eventParameter)))
			TPI_DEBUG_PRINT(("App: Peer does NOT support RCP\n"));
		if ((0 == (BIT_1 & eventParameter)))
			TPI_DEBUG_PRINT(("App: Peer does NOT support RAP\n"));
		if ((0 == (BIT_2 & eventParameter)))
			TPI_DEBUG_PRINT(("App: Peer does NOT support WRITE_BURST\n"));
		if (SiiMhlTxRcpSend(rcpKeyCode)) {
			TPI_DEBUG_PRINT(("App: SiiMhlTxRcpSend (%02X)\n", (int) rcpKeyCode));
			TPI_DEBUG_PRINT(("Stupid coding check\n"));
		} else
			TPI_DEBUG_PRINT(("App: SiiMhlTxRcpSend (%02X) Returned Failure.\n", (int) rcpKeyCode));
#endif
		break;
	case    MHL_TX_EVENT_RCP_RECEIVED:
		TPI_DEBUG_PRINT(("App: Received an RCP key code = %02X\n", eventParameter));
		rcpKeyCode = ProcessRcpKeyCode(eventParameter);
		SiiMhlTxRcpkSend((int) rcpKeyCode);
		break;
	case    MHL_TX_EVENT_RCPK_RECEIVED:
		TPI_DEBUG_PRINT(("App: Received an RCPK = %02X\n", (int)eventParameter));
		break;
	case    MHL_TX_EVENT_RCPE_RECEIVED:
		TPI_DEBUG_PRINT(("App: Received an RCPE = %02X\n", (int)eventParameter));
		break;
	case    MHL_TX_EVENT_NONE:
		break;
	default:
		TPI_DEBUG_PRINT(("App: Got event = %02X, eventParameter = %02X\n", (int)event, (int)eventParameter));
		break;
	}
}
Exemplo n.º 4
0
void	AppRcpDemo( uint8_t event, uint8_t eventParameter)
{
    uint8_t 	rcpKeyCode;
    
    //printf("App: Got event = %02X, eventParameter = %02X\n", (int)event, (int)eventParameter);
    
    switch( event )
    {
    case	MHL_TX_EVENT_DISCONNECTION:
        printk("App: Got event = MHL_TX_EVENT_DISCONNECTION\n");
        #ifdef CONFIG_OPPO_MODIFY
        //added by zhangyue on 2011-11-01 for adding the auto hpd feature
        #ifdef zy_auto_hpd
	  //deleted by zhangyue on 2011-12-23 for debug audio problem start
        //external_common_enable_hpd_feature(false);
	  //deleted by zhangyue on 2011-12-23 for debug audio problem end
        #endif
        #endif
        break;
    
    case	MHL_TX_EVENT_CONNECTION:
        printk("App: Got event = MHL_TX_EVENT_CONNECTION\n");
        #ifdef CONFIG_OPPO_MODIFY
        //added by zhangyue on 2011-11-01 for adding the auto hpd feature
        #ifdef zy_auto_hpd
        //modified by zhangyue on 2012-01-09 for debug the first plugin mhl can not output video start
        
        //external_common_enable_hpd_feature(true);
        //modified by zhangyue on 2012-01-09 for debug the first plugin mhl can not output video start
        #endif
        #endif
        break;
    
    case	MHL_TX_EVENT_RCP_READY:
        // Demo RCP key code PLAY
        rcpKeyCode = APP_DEMO_RCP_SEND_KEY_CODE;
        printk("App: Got event = MHL_TX_EVENT_RCP_READY...Sending RCP (%02X)\n", (int) rcpKeyCode);
    
    
        if( (0 == (MHL_FEATURE_RCP_SUPPORT & eventParameter)) ){
            printk( "App: Peer does NOT support RCP\n" );
        }
        if( (0 == (MHL_FEATURE_RAP_SUPPORT & eventParameter)) ){
            printk( "App: Peer does NOT support RAP\n" );
        }
        if( (0 == (MHL_FEATURE_SP_SUPPORT & eventParameter)) ){
            printk( "App: Peer does NOT support WRITE_BURST\n" );
        }
        
        
        //
        // If RCP engine is ready, send one code
        //
        if( SiiMhlTxRcpSend( rcpKeyCode )){
            printk("App: SiiMhlTxRcpSend (%02X)\n", (int) rcpKeyCode);
        }else{
            printk("App: SiiMhlTxRcpSend (%02X) Returned Failure.\n", (int) rcpKeyCode);
        }
        
        break;
    
    case	MHL_TX_EVENT_RCP_RECEIVED:
        //
        // Check if we got an RCP. Application can perform the operation here
        // and send RCPK or RCPE. For now, we send the RCPK
        //
        #ifdef ZY_IMPLEMENT_RCP
        rcpKeyCode = eventParameter;
        #else
        rcpKeyCode = eventParameter & 0x7F;
        #endif
        printk("App1: Received an RCP key code = %02X\n", (int)rcpKeyCode );
        
        // Added RCP key printf and interface with UI. //by oscar 20101217
        #ifdef ZY_IMPLEMENT_RCP
        input_report_mhl_rcp_key(rcpKeyCode);
	  #endif
        
        SiiMhlTxRcpkSend(rcpKeyCode);
        break;
        
    case	MHL_TX_EVENT_RCPK_RECEIVED:
        printk("App: Received an RCPK = %02X\n",MHL_TX_EVENT_RCPK_RECEIVED);
        break;
    
    case	MHL_TX_EVENT_RCPE_RECEIVED:
        printk("App: Received an RCPE = %02X\n",MHL_TX_EVENT_RCPE_RECEIVED);
        break;
    
    default:
        break;
    }
}