一款HDMI一分二的配置

一款HDMI一分二的配置

一. 根据芯片寄存器手册制作

#define HDXADDR             (0XA0)
			               
#define REG_CONFIG                (0X00)             // default 0XFF
#define BIT_CONFIG_TMDS_MODE      (BIT7)             // Enable TMDS Standby mode.  "0": Standby mode  "1": Normal mode
#define BIT_CONFIG_PORT1_SEL      (BIT5)             // Output TMDS Port 1 Select. "0": Disable       "1": Enable
#define BIT_CONFIG_PORT2_SEL      (BIT4)             // Output TMDS Port 2 Select. "0": Disable       "1": Enable
												     						  
#define REG_RX_SET                (0X01)             // default 0X00
#define BIT_RX_INPUT_TERMINATION  (BIT7)             // Disable Input Port input termination.    "0": Enable Rpd connection   "1": Disable Rpd connection
#define BIT_RX_TERMINATION_VBIAS  (BIT6)             // TMDS Input termination V-bias selection. "0": Connect to GND          "1": Connect to VDD
#define BIT_RX_VBIAS_SEL          (BIT5)             // V-bias register selection enable.        "0": bit[6] control disable  "1": bit[6] control enable
#define BIT_RX_EQ_SETTING         (BIT2|BIT3|BIT4)   // EQ programmable setting. "000": 2.5  "001": 5  "010": 7.5  "011": 10  "100": 12.5  "101": 15  "110": 17.5  "111": 20
#define BIT_RX_SQUELCH_CTL        (BIT1)             // Squelch Control Bit.                     "0": Squelch enable          "1": Squelch disable

#define REG_TX_SET0               (0X03)             // default 0X00
#define REG_TX_SET1               (0X04)			 // default 0X00		      
#define BIT_TX_TMDS_CTL           (BIT7)             // TMDS output control. "0": Open drain  "1": Double termination
#define BIT_TX_PRE_EMPHASIS       (BIT6|BIT5|BIT4)   // TMDS output Pre-emphasis control. "000": 0 dB  "001": 1.5 dB  "010": 2.5 dB  "011": 3.5 dB  "1xx": 6 dB (750 mVpp swing)
#define BIT_TX_SWING              (BIT3|BIT2)        // TMDS output swing setting. "00": 500 mV as default  "01": -10%  "10": +10%  "11": +20%
#define BIT_TX_SLEW_RATE          (BIT1|BIT0)        // TMDS output slew rate setting. "00": as default         "01" /      "10": + 5%  "11": +10%

二. 需要配置的参数

芯片资料I2C介绍只有连续写和连续读模式,所以只能一次写8个或者一次读8个寄存器的参数,每个数据间有一个ACK。

1.eq的设置
由上面的定义,可以知道,eq的值在0-7

uint8_t g_drive_cifg[8] = {0XFF, 0X00, 0X00, 0X00, 0X00, 0X00, 0X0F, 0X00};

#define EQ_MAX_VALUE    (0X07)
#define EQ_MIN_VALUE    (0X00)

void  HDX_EqSetting(uint8_t value)
{
	uint8_t SendByte;
	
	if(value > EQ_MAX_VALUE) return;
		
	g_drive_cifg[REG_RX_SET] = (value<<2) & BIT_RX_EQ_SETTING;
	
	PI3HDx412Write(P13HDX412ADDR, g_drive_cifg);
}

2.配置TMDS output Pre-emphasis control,TMDS output swing setting和TMDS output slew rate setting
为了在使用时的便捷性,我把所有情况做成参数直接写入,不用单个配置,总共有80种配置的参数

#define DRIVE_MAX_VALUE    (0X4F)
#define DRIVE_MIN_VALUE    (0X00)

void HDX_DriveSetting(uint8_t value)
{
	uint8_t SendByte;
	
	if(value > DRIVE_MAX_VALUE) return;
	
	SendByte = value & (BIT_TX_SLEW_RATE|BIT_TX_SWING|BIT_TX_PRE_EMPHASIS);	
	g_drive_cifg[REG_TX_SET0] = SendByte;
	g_drive_cifg[REG_TX_SET1] = SendByte;	
	
	PI3HDx412Write(P13HDX412ADDR, g_drive_cifg);	
}

使用的时候调用即可

你可能感兴趣的:(一款HDMI一分二的配置)