int edid_Initialize(u16 baseAddr, u16 sfrClock)
{
#ifdef CONFIG_HDMI_JZ4780_DEBUG
	printk("hdmi  %s: sfrClock = %u\n", __func__, sfrClock);
#endif
	LOG_TRACE2(baseAddr, sfrClock);
	/* mask interrupts */
	halEdid_MaskInterrupts(baseAddr + I2CM_BASE_ADDR, TRUE);
	edid_Reset(baseAddr);
	/* set clock division */
	halEdid_MasterClockDivision(baseAddr + I2CM_BASE_ADDR, 0x05);
	halEdid_FastSpeedHighCounter(baseAddr + I2CM_BASE_ADDR, edid_i2c_count(sfrClock, I2C_MIN_FS_SCL_HIGH_TIME ));
	halEdid_FastSpeedLowCounter(baseAddr + I2CM_BASE_ADDR, edid_i2c_count(sfrClock, I2C_MIN_FS_SCL_LOW_TIME));
	halEdid_StandardSpeedLowCounter(baseAddr + I2CM_BASE_ADDR,edid_i2c_count(sfrClock, I2C_MIN_SS_SCL_LOW_TIME));
	halEdid_StandardSpeedHighCounter(baseAddr + I2CM_BASE_ADDR, edid_i2c_count(sfrClock, I2C_MIN_SS_SCL_HIGH_TIME));
	/* set address to EDID address -see spec */
	halEdid_SlaveAddress(baseAddr + I2CM_BASE_ADDR, 0x50); /* HW deals with LSB (alternating the address between 0xA0 & 0xA1) */
	halEdid_SegmentAddr(baseAddr + I2CM_BASE_ADDR, 0x30); /* HW deals with LSB (making the segment address go to 60) */
	/* start reading E-EDID */
	edid_mStatus = EDID_READING;
	LOG_NOTICE("reading EDID");
	halEdid_MaskInterrupts(baseAddr + I2CM_BASE_ADDR, FALSE); /* enable interrupts */
	edid_ReadRequest(baseAddr, 0, 0);
	return TRUE;
}
VOID Task_Start(Task *pThis)
{
	LOG_TRACE2("\ninside Task_Start name: %d, Handle:%d .",pThis->hPriority,pThis->Handle);
	//TSK_setpri(pThis->Handle, pThis->hPriority);
	Task_setPri(pThis->Handle, pThis->hPriority);
	LOG_TRACE0("\n After Task_setpri");
}
void halFrameComposerAudio_UserLeft(u16 baseAddr, u8 bit, unsigned channel)
{
	LOG_TRACE2(bit, channel);
	if (channel < 4)
		access_CoreWrite(bit, baseAddr + FC_AUDSU, channel, 1);
	else
		LOG_ERROR2("invalid channel number: ", channel);
}
void halFrameComposerAudio_ValidityRight(u16 baseAddr, u8 bit, unsigned channel)
{
	LOG_TRACE2(bit, channel);
	if (channel < 4)
		access_CoreWrite(bit, baseAddr + FC_AUDSV, 4 + channel, 1);
	else
		LOG_ERROR("invalid channel number");
}
void halFrameComposerAudio_IecChannelLeft(u16 baseAddr, u8 value,
		unsigned channel)
{
	LOG_TRACE2(value, channel);
	if (channel == 0)
		access_CoreWrite(value, baseAddr + FC_AUDSCHNLS5, 0, 4);
	else if (channel == 1)
		access_CoreWrite(value, baseAddr + FC_AUDSCHNLS5, 4, 4);
	else if (channel == 2)
		access_CoreWrite(value, baseAddr + FC_AUDSCHNLS6, 0, 4);
	else if (channel == 3)
		access_CoreWrite(value, baseAddr + FC_AUDSCHNLS6, 4, 4);
	else
		LOG_ERROR2("invalid channel number: ", channel);
}
int edid_ReadRequest(u16 baseAddr, u8 address, u8 blockNo)
{
	/*to incorporate extensions we have to include the following - see VESA E-DDC spec. P 11 */
	u8 sPointer = blockNo / 2;
	u8 edidAddress = ((blockNo % 2) * 0x80) + address;

	LOG_TRACE2(sPointer, edidAddress);
	halEdid_RequestAddr(baseAddr + I2CM_BASE_ADDR, edidAddress);
	halEdid_SegmentPointer(baseAddr + I2CM_BASE_ADDR, sPointer);
	if (sPointer == 0)
	{
		halEdid_RequestRead(baseAddr + I2CM_BASE_ADDR);
	}
	else
	{
		halEdid_RequestExtRead(baseAddr + I2CM_BASE_ADDR);
	}
	return TRUE;
}
示例#7
0
void halSourcePhy_InterruptPolarity(u16 baseAddr, u8 bitShift, u8 value)
{
	LOG_TRACE2(bitShift, value);
	access_CoreWrite(value, (baseAddr + PHY_POL0), bitShift, 1);
}
u8 edid_EventHandler(u16 baseAddr, int hpd, u8 state)
{
	LOG_TRACE2(hpd, state);
	if (edid_mStatus != EDID_READING)
	{
		return EDID_IDLE;
	}
	else if (!hpd)
	{ /* hot plug detected without cable disconnection */
		error_Set(ERR_HPD_LOST);
		LOG_WARNING("hpd");
		edid_mStatus = EDID_ERROR;
	}
	else if ((state & BIT(0)) != 0) /* error */
	{ 
		LOG_WARNING("error");
		edid_mStatus = EDID_ERROR;
	}
	else if ((state & BIT(1)) != 0) /* done */
	{ 
		if (edid_mCurrAddress >= sizeof(edid_mBuffer))
		{
			error_Set(ERR_OVERFLOW);
			LOG_WARNING("overflow");
			edid_mStatus = EDID_ERROR;
		}
		else
		{
			edid_mBuffer[edid_mCurrAddress] = halEdid_ReadData(baseAddr
					+ I2CM_BASE_ADDR);
			edid_mBlockSum += edid_mBuffer[edid_mCurrAddress++];
			if (edid_mCurrAddress >= sizeof(edid_mBuffer))
			{
				/*check if checksum is correct (CEA-861 D Spec p108) */
				if (edid_mBlockSum % 0x100 == 0)
				{
					LOG_NOTICE("block checksum correct");
					edid_ParseBlock(baseAddr, edid_mBuffer);
					edid_mCurrAddress = 0;
					edid_mCurrBlockNo++;
					edid_mBlockSum = 0;
					if (edid_mCurrBlockNo >= edid_mBlocksNo)
					{
						edid_mStatus = EDID_DONE; 
					}
				}
				else
				{
					error_Set(ERR_BLOCK_CHECKSUM_INVALID);
					LOG_WARNING("block checksum invalid");
					edid_mStatus = EDID_ERROR; 
				}
			}
		}
	}
	if (edid_mStatus == EDID_READING)
	{
		edid_ReadRequest(baseAddr, edid_mCurrAddress, edid_mCurrBlockNo);
	}
	else if (edid_mStatus == EDID_DONE)
	{
		edid_mBlocksNo = 1;
		edid_mCurrBlockNo = 0;
		edid_mCurrAddress = 0;
		edid_mBlockSum = 0;
	}
	return edid_mStatus;
}
void halAudioGenerator_ChannelSelect(IM_UINT16 baseAddress, IM_UINT8 enable, IM_UINT8 channel)
{
	LOG_TRACE2(channel, enable);
	access_CoreWrite(enable, baseAddress + AG_GPA_CONF1, channel, 1);
}