ssize_t ReadDevCap(struct device *dev, struct device_attribute *attr, char *buf) { uint8_t regValue; int status = -EINVAL; SII_DEBUG_PRINT(SII_OSAL_DEBUG_TRACE, "ReadDevCap called\n"); if(HalAcquireIsrLock() != HAL_RET_SUCCESS) { return -ERESTARTSYS; } do { if(gDriverContext.flags & MHL_STATE_FLAG_CONNECTED) { status = SiiTxGetPeerDevCapEntry(gDriverContext.devCapOffset, ®Value); if(status != 0) { status = -EAGAIN; break; } status = scnprintf(buf, PAGE_SIZE, "offset:0x%02x=0x%02x", gDriverContext.devCapOffset, regValue); } } while(false); HalReleaseIsrLock(); return status; }
/////////////////////////////////////////////////////////////////////////////// // // AppNotifyMhlEvent // // This function is invoked from the MhlTx component to notify the application // about detected events that may be of interest to it. // // Application module must provide this function. // MhlTxNotifyEventsStatus_e AppNotifyMhlEvent(uint8_t eventCode, uint8_t eventParam) { MhlTxNotifyEventsStatus_e retVal = MHL_TX_EVENT_STATUS_PASSTHROUGH; switch(eventCode) { case MHL_TX_EVENT_DISCONNECTION: // SiiOsDebugPrintSimple(SII_OSAL_DEBUG_TRACE_ALWAYS, "App: Got event = MHL_TX_EVENT_DISCONNECTION\n"); #ifdef BYPASS_VBUS_HW_SUPPORT //( // turn off VBUS power here #endif //) break; case MHL_TX_EVENT_CONNECTION: // SiiOsDebugPrintSimple(SII_OSAL_DEBUG_TRACE_ALWAYS, "App: Got event = MHL_TX_EVENT_CONNECTION\n"); SiiMhlTxSetPreferredPixelFormat(MHL_STATUS_CLK_MODE_NORMAL); #ifdef ENABLE_WRITE_BURST_TEST //( testCount=0; testStart=0; // SiiOsDebugPrintSimple(SII_OSAL_DEBUG_TRACE_ALWAYS,"App:%d Reset Write Burst test counter\n",(int)__LINE__); #endif //) break; case MHL_TX_EVENT_RCP_READY: if( (0 == (MHL_FEATURE_RCP_SUPPORT & eventParam)) ) { // SiiOsDebugPrintSimple(SII_OSAL_DEBUG_TRACE_ALWAYS, "App:%d Peer does NOT support RCP\n",(int)__LINE__ ); } else { // SiiOsDebugPrintSimple(SII_OSAL_DEBUG_TRACE_ALWAYS, "App:%d Peer supports RCP\n",(int)__LINE__ ); // Demo RCP key code Volume Up rcpKeyCode = APP_DEMO_RCP_SEND_KEY_CODE; } if( (0 == (MHL_FEATURE_RAP_SUPPORT & eventParam)) ) { // SiiOsDebugPrintSimple(SII_OSAL_DEBUG_TRACE_ALWAYS, "App:%d Peer does NOT support RAP\n",(int)__LINE__ ); } else { // SiiOsDebugPrintSimple(SII_OSAL_DEBUG_TRACE_ALWAYS, "App:%d Peer supports RAP\n",(int)__LINE__ ); #ifdef ENABLE_WRITE_BURST_TEST //( testEnable = 1; #endif //) } if( (0 == (MHL_FEATURE_SP_SUPPORT & eventParam)) ) { // SiiOsDebugPrintSimple(SII_OSAL_DEBUG_TRACE_ALWAYS, "App:%d Peer does NOT support WRITE_BURST\n",(int)__LINE__ ); } else { // SiiOsDebugPrintSimple(SII_OSAL_DEBUG_TRACE_ALWAYS, "App:%d Peer supports WRITE_BURST\n",(int)__LINE__ ); } 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 // // SiiOsDebugPrintSimple(SII_OSAL_DEBUG_TRACE_ALWAYS, "App: Received an RCP key code = %02X\n", (int)eventParam ); rcpkParam = (int16_t) eventParam; break; case MHL_TX_EVENT_RCPK_RECEIVED: // SiiOsDebugPrintSimple(SII_OSAL_DEBUG_TRACE_ALWAYS, "App: Received an RCPK = %02X\n", (int)eventParam); #ifdef ENABLE_WRITE_BURST_TEST //( if ((APP_DEMO_RCP_SEND_KEY_CODE == eventParam)&& testEnable) { testStart=1; // SiiOsDebugPrintSimple(SII_OSAL_DEBUG_TRACE_ALWAYS,"App:%d Write Burst test Starting:...\n",(int)__LINE__); } #endif //) break; case MHL_TX_EVENT_RCPE_RECEIVED: // SiiOsDebugPrintSimple(SII_OSAL_DEBUG_TRACE_ALWAYS, "App: Received an RCPE = %02X\n", (int)eventParam); break; case MHL_TX_EVENT_DCAP_CHG: { uint8_t i,myData; // SiiOsDebugPrintSimple(SII_OSAL_DEBUG_TRACE_ALWAYS, "App: MHL_TX_EVENT_DCAP_CHG: ",myData); for(i=0;i<16;++i) { if (0 == SiiTxGetPeerDevCapEntry(i,&myData)) { // SiiOsDebugPrintSimple(SII_OSAL_DEBUG_TRACE_ALWAYS, "0x%02x ",(int)myData); } else { // SiiOsDebugPrintSimple(SII_OSAL_DEBUG_TRACE_ALWAYS, "busy "); } } // SiiOsDebugPrintSimple(SII_OSAL_DEBUG_TRACE_ALWAYS, "\n"); } break; case MHL_TX_EVENT_DSCR_CHG: { ScratchPadStatus_e temp; uint8_t myData[16]; temp = SiiGetScratchPadVector(0,sizeof(myData), myData); switch(temp) { case SCRATCHPAD_FAIL: case SCRATCHPAD_NOT_SUPPORTED: case SCRATCHPAD_BUSY: // SiiOsDebugPrintSimple(SII_OSAL_DEBUG_TRACE_ALWAYS, "SiiGetScratchPadVector returned 0x%02x\n",(int)temp); break; case SCRATCHPAD_SUCCESS: { uint8_t i; // SiiOsDebugPrintSimple(SII_OSAL_DEBUG_TRACE_ALWAYS, "New ScratchPad: ",(int)temp); for (i=0;i<sizeof(myData);++i) { // SiiOsDebugPrintSimple(SII_OSAL_DEBUG_TRACE_ALWAYS, "(%02x, %c) \n",(int)temp,(char)temp); } // SiiOsDebugPrintSimple(SII_OSAL_DEBUG_TRACE_ALWAYS, "\n",(int)temp); } break; } } break; #ifdef BYPASS_VBUS_HW_SUPPORT //( case MHL_TX_EVENT_POW_BIT_CHG: if (eventParam) // power bit changed { // turn OFF power here ; } retVal = MHL_TX_EVENT_STATUS_HANDLED; break; case MHL_TX_EVENT_RGND_MHL: // for OEM to do: if sink is NOT supplying VBUS power then turn it on here retVal = MHL_TX_EVENT_STATUS_HANDLED; break; #else //)( case MHL_TX_EVENT_POW_BIT_CHG: case MHL_TX_EVENT_RGND_MHL: // let the lower layers handle these. break; #endif //) default: // SiiOsDebugPrintSimple(SII_OSAL_DEBUG_TRACE_ALWAYS, "Unknown event: 0x%02x\n",(int)eventCode); break; } return retVal; }