Beispiel #1
0
void Active9232 (void) {
	uint8_t i;
	uint8_t *video_parm = &video_param[hd_720p][0];

        /* choose video mode */
	if (mhl_tpi_info->check_hdmi_sink()) {
		I2C_WriteByte(TPI_SLAVE_ADDR, 0x08, 0x70);
		I2C_WriteBlock(TPI_SLAVE_ADDR, 0x0, video_parm, 8);
		I2C_WriteByte(TPI_SLAVE_ADDR, 0x0, 0x60);
	}

	if (!mhl_tpi_info->check_hdmi_sink()) {
    		ReadModifyWriteTPI(0x1A, BIT_0, 0x01);
	}
	
	I2C_WriteByte(TPI_SLAVE_ADDR, 0x09, 0x00);
	I2C_WriteByte(TPI_SLAVE_ADDR, 0x19, 0x00);

	if (!mhl_tpi_info->check_hdmi_sink()) {
    		ReadModifyWriteTPI(0x1A, BIT_0, 0x00);
	}
	
	I2C_WriteByte(TPI_SLAVE_ADDR, 0x60, 0x00);
	I2C_WriteByte(TPI_SLAVE_ADDR, 0xbf, 0x00);

	for (i = 0; i < 14 ;i++)
		I2C_WriteByte(TPI_SLAVE_ADDR, 0x0C + i, avi_info_frame[hd_720p][i]);

	I2C_WriteByte(TPI_SLAVE_ADDR, 0xbf, 0xc6);
	
	if (mhl_tpi_info->check_hdmi_sink()) {
		I2C_WriteByte(TPI_SLAVE_ADDR, 0x26, 0x91);
		I2C_WriteByte(TPI_SLAVE_ADDR, 0x25, 0x03);
		I2C_WriteByte(TPI_SLAVE_ADDR, 0x27, 0x59);
		I2C_WriteByte(TPI_SLAVE_ADDR, 0x28, 0x00);
		I2C_WriteByte(TPI_SLAVE_ADDR, 0x1f, 0x80);
		I2C_WriteByte(TPI_SLAVE_ADDR, 0x20, 0x90);
		I2C_WriteByte(TPI_SLAVE_ADDR, 0x21, 0x00);
	
		I2C_WriteByte(TPI_SLAVE_ADDR, 0x24, 0x02);
		I2C_WriteByte(TPI_SLAVE_ADDR, 0x25, 0x00);
		I2C_WriteByte(TPI_SLAVE_ADDR, 0xbc, 0x02);
		I2C_WriteByte(TPI_SLAVE_ADDR, 0xbd, 0x24);
		I2C_WriteByte(TPI_SLAVE_ADDR, 0xbe, 0x92);
		I2C_WriteByte(TPI_SLAVE_ADDR, 0xbc, 0x02);
		I2C_WriteByte(TPI_SLAVE_ADDR, 0xbd, 0x2f);
		I2C_WriteByte(TPI_SLAVE_ADDR, 0xbe, 0x0);
		I2C_WriteByte(TPI_SLAVE_ADDR, 0x26, 0x81);
	
		I2C_WriteBlock(TPI_SLAVE_ADDR, 0xbf, audio_info_frame, 15);
		I2C_WriteByte(TPI_SLAVE_ADDR, 0x0a, 0x0);
	}
}
Beispiel #2
0
void ExtEeprom_WriteBlock(const uns8 *array, const uns8 adress, const uns8 length) {
	if (adress <= EEPROM_MEMORY_END_ADRESS) {
		if (g_ExtEepromDetected) {
			I2C_WriteBlock(EEPROM_ADRESS, array, adress, length);
		}
	} else {
		Trace_String("invalid ext eeprom adress");
	}
}
static inline int platform_write_i2c_block(struct i2c_adapter *i2c_bus
		, u8 page
		, u8 offset
		, u16 count
		, u8 *values
		)
{
#if 0
	struct i2c_msg	msg;
	u8		*buffer;
	int		ret;

	buffer = kmalloc(count + 1, GFP_KERNEL);
	if (!buffer) {
		printk("%s:%d buffer allocation failed\n",__FUNCTION__,__LINE__);
		return -ENOMEM;
	}

	buffer[0] = offset;
	memmove(&buffer[1], values, count);

	msg.flags = 0;
	msg.addr = page >> 1;
	msg.buf = buffer;
	msg.len = count + 1;

	ret = i2c_transfer(i2c_bus, &msg, 1);

	kfree(buffer);

	if (ret != 1) {
		printk("%s:%d I2c write failed 0x%02x:0x%02x\n"
				,__FUNCTION__,__LINE__, page, offset);
		ret = -EIO;
	} else {
		ret = 0;
	}

	return ret;
	#endif
	///printk("%s:%d I2c write page:0x%02x,offset:0x%02x,values:0x%02X,count:0x%02X\n"
	///			,__FUNCTION__,__LINE__, page, offset, values, count);
	I2C_WriteBlock(page, offset, values, count);
	return 0;
	
}
Beispiel #4
0
void I2C_Init(void)
{

    TRISJbits.TRISJ7 = 0;
    LATJbits.LATJ7 = 0;

    SYS_TMR_DelayMS(1000);

    I2C3CONCLR = 0x8000;  //Reset Status Registers
    I2C3BRG = 175; // 300 kHz Baudrate

    I2C3CONSET = 0x8000;  //Reset Status Registers
    
    SYS_TMR_DelayMS(1000);
    
    I2C_WriteBlock(0x42, 0x11, 0x06, 2); //Slow the clock rate by half and change to RGB format

}
Beispiel #5
0
//------------------------------------------------------------------------------
// Function: I2C_WriteByte
// Description: Write one byte to the spacifed I2C slave address at the specified offset.
//              The offset address is one byte (8 bit offset only).
//              No error information is returned.
//------------------------------------------------------------------------------
void I2C_WriteByte(BYTE deviceID, BYTE offset, BYTE value)
{
    I2C_WriteBlock( deviceID, offset, value, 1 );
}