void ProcessRgnd (void)
{
	uint8_t rgndImpedance;
	rgndImpedance = SiiRegRead(REG_DISC_STAT2) & 0x03;
	TX_DEBUG_PRINT(("RGND = %02X : \n", (int)rgndImpedance));
	if (0x02 == rgndImpedance)
	{
		TX_DEBUG_PRINT(("(MHL Device)\n"));
		SiiMhlTxNotifyRgndMhl(); 
	}
	else
	{
		SiiRegModify(REG_DISC_CTRL9, BIT3, BIT3);	
		TX_DEBUG_PRINT(("(Non-MHL Device)\n"));
	}
}
///////////////////////////////////////////////////////////////////////////
// ProcessRgnd
//
// H/W has detected impedance change and interrupted.
// We look for appropriate impedance range to call it MHL and enable the
// hardware MHL discovery logic. If not, disable MHL discovery to allow
// USB to work appropriately.
//
// In current chip a firmware driven slow wake up pulses are sent to the
// sink to wake that and setup ourselves for full D0 operation.
///////////////////////////////////////////////////////////////////////////
void ProcessRgnd (void)
{
	uint8_t rgndImpedance;
	//
	// Impedance detection has completed - process interrupt
	//
	rgndImpedance = SiiRegRead(REG_DISC_STAT2) & 0x03;
	TX_DEBUG_PRINT(("Drv: RGND = %02X : \n", (int)rgndImpedance));

	//
	// 00, 01 or 11 means USB.
	// 10 means 1K impedance (MHL)
	//
	// If 1K, then only proceed with wake up pulses
	if (0x02 == rgndImpedance)
	{
		TX_DEBUG_PRINT(("(MHL Device)\n"));
		SiiMhlTxNotifyRgndMhl(); // this will call the application and then optionally call
		//The sequence of events during MHL discovery is as follows:
		//	(i) SiI9244 blocks on RGND interrupt (Page0:0x74[6]).
		//	(ii) System firmware turns off its own VBUS if present.
		//	(iii) System firmware waits for about 200ms (spec: TVBUS_CBUS_STABLE, 100 - 1000ms), then checks for the presence of
		//		VBUS from the Sink.
		//	(iv) If VBUS is present then system firmware proceed to drive wake pulses to the Sink as described in previous
		//		section.
		//	(v) If VBUS is absent the system firmware turns on its own VBUS, wait for an additional 200ms (spec:
		//		TVBUS_OUT_TO_STABLE, 100 - 1000ms), and then proceed to drive wake pulses to the Sink as described in above.

		// AP need to check VBUS power present or absent in here 	// by oscar 20110527
		
#if (VBUS_POWER_CHK == ENABLE)			// Turn on VBUS output.
		AppVbusControl( vbusPowerState = false );
#endif

		TX_DEBUG_PRINT(("[MHL]: Waiting T_SRC_VBUS_CBUS_TO_STABLE (%d ms)\n", (int)T_SRC_VBUS_CBUS_TO_STABLE));
		//HalTimerWait(T_SRC_VBUS_CBUS_TO_STABLE);
	}
	else
	{
		SiiRegModify(REG_DISC_CTRL9, BIT3, BIT3);	// USB Established
		TX_DEBUG_PRINT(("(Non-MHL Device)\n"));
	}
}