XilinxProcessorIPLib/drivers/dp14txss/examples/src/dats_dp14/idt_8t49n24x.c
int IDT_8T49N24x_SetGPOut(u32 I2CBaseAddress, u8 I2CSlaveAddress, u8 PortID, u8 Set)
{
	if (PortID > 3) {
		print("Invalid port ID\n\r");
		return XST_FAILURE;
	}

	u32 ByteCount = 0;
	u8 Data = 0;
	u8 Buffer[3];

	Buffer[0] = 0x00; // MSB RegAddr
	Buffer[1] = 0x38; // LSB RegAddr
	ByteCount = XIic_Send(I2CBaseAddress, I2CSlaveAddress, (u8*)Buffer, 2, XIIC_REPEATED_START);
	if (ByteCount != 2) {
		return XST_FAILURE;
	}
	ByteCount = XIic_Recv(I2CBaseAddress, I2CSlaveAddress, (u8*)Buffer, 1, XIIC_STOP);
	if (ByteCount != 1) {
		return XST_FAILURE;
	}
	Data = Buffer[0];

	if (Set == TRUE) {
		Data |= (1<<PortID);
	}
	else {
		Data &= ~(1<<PortID);
	}

	Buffer[0] = 0x00; // MSB RegAddr
	Buffer[1] = 0x38; // LSB RegAddr
	Buffer[2] = Data;
	ByteCount = XIic_Send(I2CBaseAddress, I2CSlaveAddress, (u8*)Buffer, 3, XIIC_STOP);
	if (ByteCount != 3) {
		return XST_FAILURE;
	}

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function sets the specified GPO of the IDT 8TN49N24x with default.
*
* @param I2CBaseAddress is the baseaddress of the I2C core.
* @param I2CSlaveAddress is the 7-bit I2C slave address.
* @param PortID specifies the port to update. Valid values are 0 to 3.
* @param Set specifies the value for the port.
*    - TRUE Port is driven high
*    - FALSE Port is driver low
*
* @return
*    - XST_SUCCESS Initialization was successful.
*    - XST_FAILURE I2C write error or incorrect parameters detected.
*
* @note
*   The specified port must be configured as a general purpose
*   output prior to calling this function.
*
******************************************************************************/
This function sets the specified GPO of the IDT 8TN49N24x with default.
This function sets the specified GPO of the IDT 8TN49N24x with default .
int IDT_8T49N24x_SetGPOut(u32 I2CBaseAddress, u8 I2CSlaveAddress, u8 PortID, u8 Set)
{
	if (PortID > 3) {
		print("Invalid port ID\n\r");
		return XST_FAILURE;
	}
	u32 ByteCount = 0;
	u8 Data = 0;
	u8 Buffer[3];
	Buffer[0] = 0x00; 
	Buffer[1] = 0x38; 
	ByteCount = XIic_Send(I2CBaseAddress, I2CSlaveAddress, (u8*)Buffer, 2, XIIC_REPEATED_START);
	if (ByteCount != 2) {
		return XST_FAILURE;
	}
	ByteCount = XIic_Recv(I2CBaseAddress, I2CSlaveAddress, (u8*)Buffer, 1, XIIC_STOP);
	if (ByteCount != 1) {
		return XST_FAILURE;
	}
	Data = Buffer[0];
	if (Set == TRUE) {
		Data |= (1<<PortID);
	}
	else {
		Data &= ~(1<<PortID);
	}
	Buffer[0] = 0x00; 
	Buffer[1] = 0x38; 
	Buffer[2] = Data;
	ByteCount = XIic_Send(I2CBaseAddress, I2CSlaveAddress, (u8*)Buffer, 3, XIIC_STOP);
	if (ByteCount != 3) {
		return XST_FAILURE;
	}
	return XST_SUCCESS;
}
int IDT_8T49N24x_SetGPOut ( u32 I2CBaseAddress , u8 I2CSlaveAddress , u8 PortID , u8 Set ) { if ( PortID > 3 ) { print ( " \n \r " ) ; return XST_FAILURE ; } u32 ByteCount = 0 ; u8 Data = 0 ; u8 Buffer [ 3 ] ; Buffer [ 0 ] = 0x00 ; Buffer [ 1 ] = 0x38 ; ByteCount = XIic_Send ( I2CBaseAddress , I2CSlaveAddress , ( u8 * ) Buffer , 2 , XIIC_REPEATED_START ) ; if ( ByteCount != 2 ) { return XST_FAILURE ; } ByteCount = XIic_Recv ( I2CBaseAddress , I2CSlaveAddress , ( u8 * ) Buffer , 1 , XIIC_STOP ) ; if ( ByteCount != 1 ) { return XST_FAILURE ; } Data = Buffer [ 0 ] ; if ( Set == TRUE ) { Data |= ( 1 << PortID ) ; } else { Data &= ~ ( 1 << PortID ) ; } Buffer [ 0 ] = 0x00 ; Buffer [ 1 ] = 0x38 ; Buffer [ 2 ] = Data ; ByteCount = XIic_Send ( I2CBaseAddress , I2CSlaveAddress , ( u8 * ) Buffer , 3 , XIIC_STOP ) ; if ( ByteCount != 3 ) { return XST_FAILURE ; } return XST_SUCCESS ; }
This function sets the specified GPO of the IDT 8TN49N24x with default.
This function sets the specified GPO of the IDT 8TN49N24x with default .
// MSB RegAddr // LSB RegAddr // MSB RegAddr // LSB RegAddr