97
HPS_I2C_CONTROL Control
HPS_I2C_CONTROL is connected to HPS_GPIO48, bit 19 of
GPIO1
controller. HPS will own
I2C bus and then can access Audio CODEC and TV Decoder when the HPS_I2C_CONTROL
signal is set to high.
In this demo code, the following mask is defined to control HPS_I2C_CONTROL direction and
their output value.
#define HPS_I2C_CONTROL
( 0x00080000 )
The following statement can be used to configure the HPS_I2C_CONTROL associated pins as
output pin.
alt_setbits_word( ( virtua
( ( uint32_t )( ALT_GPIO1_SWPORTA_DDR_ADDR ) &
( uint32_t )( HW_REGS_MASK ) ) ),
HPS_I2C_CONTROL
);
The following statement can be used to set HPS_I2C_CONTROL high.
alt_setbits_word( ( virtua
( ( uint32_t )( ALT_GPIO1_SWPORTA_DR_ADDR ) &
( uint32_t )( HW_REGS_MASK ) ) ),
HPS_I2C_CONTROL
);
The following statement can be used to set HPS_I2C_CONTROL low.
alt_clrbits_word( ( virtua
( ( uint32_t )( ALT_GPIO1_SWPORTA_DR_ADDR ) &
( uint32_t )( HW_REGS_MASK ) ) ),
HPS_I2C_CONTROL
);
I2C Driver
Here is the list of procedures in order to read register value from TV Decoder by using the existing
I2C bus driver in the system:
Set HPS_I2C_CONTROL high so that HPS can access I2C bus.
Open I2C bus driver "/dev/i2c-0": file = open("/dev/i2c-0", O_RDWR);
Specify ADV7180 's I2C address 0x20: ioctl(file, I2C_SLAVE, 0x20);
Read or write registers;
Set HPS_I2C_CONTROL low to release I2C bus.
Summary of Contents for DE1-SOC
Page 1: ...1...
Page 108: ...107 Figure 8 4 Select Devices Page...