void setRxHDCPBStatus(WORD bstatus)
{
    HDMIRX_WriteI2C_Byte(REG_RX_BLOCK_SEL,1);
    HDMIRX_WriteI2C_Byte(REG_RX_BSTATUSH,(BYTE)((bstatus>>8)& 0x0F));
    HDMIRX_WriteI2C_Byte(REG_RX_BSTATUSL,(BYTE)(bstatus & 0xFF));
    HDMIRX_WriteI2C_Byte(REG_RX_BLOCK_SEL,0);

    cDownStream = (BYTE)(bstatus &0x7F);
    if((0==(bstatus & 0x880))&& cDownStream <= HDMIRX_MAX_KSV)
    {
        SHABuff[cDownStream*5] = (BYTE)(bstatus &0xFF);
        SHABuff[cDownStream*5+1] = (BYTE)((bstatus>>8)&0x0F)| (IsHDMIRXHDMIMode()?0x10:0);
    }
SYS_STATUS RxHDCPGetBstatus(USHORT *pBstatus)
{
    if(!pBstatus)
    {
        return ER_FAIL ;
    }
    HDMIRX_WriteI2C_Byte(REG_RX_BLOCK_SEL,1);
    *pBstatus=HDMIRX_ReadI2C_Byte(REG_RX_BSTATUSH);
    *pBstatus <<= 8 ;
    *pBstatus |= HDMIRX_ReadI2C_Byte(REG_RX_BSTATUSL);
    HDMIRX_WriteI2C_Byte(REG_RX_BLOCK_SEL,0);
    HDMIRX_DEBUG_PRINTF(("RxHDCPGetBstatus\n"));
	return ER_SUCCESS;
}
Example #3
0
File: it6604.c Project: 9crk/it6604
SYS_STATUS HDMIRX_WriteI2C_ByteN(BYTE RegAddr, BYTE *pData, int N)
{
	int i;
	for(i=0;i<N;i++){
		HDMIRX_WriteI2C_Byte(RegAddr+i, *(pData+i));
	}
	return 0;
}
SYS_STATUS RxHDCPGetM0()
{
	BYTE i=0;
    if(cDownStream > HDMIRX_MAX_KSV)
    {
        return ER_FAIL ;
    }
    HDMIRX_WriteI2C_Byte(REG_RX_BLOCK_SEL,1);
	for(;i<8;i++)
	{
		SHABuff[cDownStream*5+2+i]=HDMIRX_ReadI2C_Byte(REG_RX_M0_B0+i);
		HDMIRX_DEBUG_PRINTF3(("M[%d] = %02X\n",i,(int)SHABuff[cDownStream*5+2+i]));
	}

    HDMIRX_WriteI2C_Byte(REG_RX_BLOCK_SEL,0);
    HDMIRX_DEBUG_PRINTF(("RxHDCPGetM0\n"));
	return ER_SUCCESS;
}
SYS_STATUS setRxHDCPKSVList(BYTE offset, BYTE *pKSVList, BYTE count)
{
	BYTE i=0;
    if(!pKSVList)
    {
        return ER_FAIL ;
    }

    HDMIRX_WriteI2C_Byte(REG_RX_BLOCK_SEL,1);
    if((offset+count)> HDMIRX_MAX_KSV)
    {
        return ER_FAIL ;
    }

    for(KSVOffset = offset ; (KSVOffset < HDMIRX_MAX_KSV)&& (KSVOffset < count); KSVOffset ++)
    {
        if (KSVOffset < 4)
        {
        	for(i = 0 ;i<5;i++)
        	{
        		HDMIRX_WriteI2C_Byte(REG_RX_KSV_FIFO00+i+KSVOffset*5,pKSVList[(KSVOffset-offset)*5+i]);
        		SHABuff[KSVOffset*5+i] = pKSVList[(KSVOffset-offset)*5+i] ;
        	}
        }
        else
        {
        	for(i = 0 ;i<5;i++)
        	{
        		HDMIRX_WriteI2C_Byte(REG_RX_KSV_FIFO40+i+KSVOffset*5-20,pKSVList[(KSVOffset-offset)*5+i]);
        		SHABuff[KSVOffset*5+i] = pKSVList[(KSVOffset-offset)*5+i] ;
        	}
        }
    }
    HDMIRX_WriteI2C_Byte(REG_RX_BLOCK_SEL,0);

	return ER_SUCCESS;
}
void RxHDCPRepeaterCapabilityClear(BYTE uc)
{
	HDMIRX_WriteI2C_Byte(REG_RX_CDEPTH_CTRL,HDMIRX_ReadI2C_Byte(REG_RX_CDEPTH_CTRL)&(~uc));
    HDMIRX_DEBUG_PRINTF(("RxHDCPRepeaterCapabilityClear=%2X\n",(int)uc));
}
static ssize_t store_dbg(struct device * dev, struct device_attribute *attr, const char * buf, size_t count)
{
    char tmpbuf[128];
    int i=0;
    unsigned int adr;
    unsigned int value=0;
    while((buf[i])&&(buf[i]!=',')&&(buf[i]!=' ')){
        tmpbuf[i]=buf[i];
        i++;
    }
    tmpbuf[i]=0;
    if(strncmp(tmpbuf, "config_dvin", 11)==0){
#ifdef DEBUG_DVIN  
        config_dvin (hs_pol_inv,          
                  vs_pol_inv,          
                  de_pol_inv,          
                  field_pol_inv,       
                  ext_field_sel,       
                  de_mode,             
                  data_comp_map,       
                  mode_422to444,       
                  dvin_clk_inv,        
                  vs_hs_tim_ctrl,      
                  hs_lead_vs_odd_min,  
                  hs_lead_vs_odd_max,  
                  active_start_pix_fe, 
                  active_start_pix_fo, 
                  active_start_line_fe,
                  active_start_line_fo,
                  line_width,          
                  field_height);
#endif       
    }
    else if(strncmp(tmpbuf, "pause", 5)==0){
        hdmirx_device.task_pause = 1;
        printk("Pause %s\n", __func__);
    }
    else if(strncmp(tmpbuf, "start", 5)==0){
        hdmirx_device.task_pause = 0;
        printk("Start %s\n", __func__);
    }
    else if(strncmp(tmpbuf, "spdif", 5)==0){
        setHDMIRX_SPDIFOutput();
    }
    else if(strncmp(tmpbuf, "i2s", 3)==0){
        setHDMIRX_I2SOutput(0x1);
    }
    else if(strncmp(tmpbuf, "hpd", 3)==0){
        if(tmpbuf[3]=='0'){
            CLEAR_HPD;
        }
        else if(tmpbuf[3]=='1'){
            SET_HPD;
        }
    }
    else if(tmpbuf[0]=='w'){
        adr=simple_strtoul(tmpbuf+2, NULL, 16);
        value=simple_strtoul(buf+i+1, NULL, 16);
        if(buf[1]=='h'){
            HDMIRX_WriteI2C_Byte(adr, value);
        }
        else if(buf[1]=='c'){
            WRITE_MPEG_REG(adr, value);
            pr_info("write %x to CBUS reg[%x]\n",value,adr);
        }
        else if(buf[1]=='p'){
            WRITE_APB_REG(adr, value);
            pr_info("write %x to APB reg[%x]\n",value,adr);
        }
    }
    else if(tmpbuf[0]=='r'){
        adr=simple_strtoul(tmpbuf+2, NULL, 16);
        if(buf[1]=='h'){
            value = HDMIRX_ReadI2C_Byte(adr);
            pr_info("HDMI reg[%x]=%x\n", adr, value);
        }
        else if(buf[1]=='c'){
            value = READ_MPEG_REG(adr);
            pr_info("CBUS reg[%x]=%x\n", adr, value);
        }
        else if(buf[1]=='p'){
            value = READ_APB_REG(adr);
            pr_info("APB reg[%x]=%x\n", adr, value);
        }
    }

    return 16;    
}