XilinxProcessorIPLib/drivers/v_hdmitxss/examples/xhdmi_example/PassThroughVersal/xhdmi_menu.c
static XHdmi_MenuType XHdmi_DP159Menu(XHdmi_Menu *InstancePtr, u8 Input) {
    /* Variables */
    XHdmi_MenuType  Menu;
    u8 Addr, Data;

    /* Default */
    Menu = XHDMI_DP159_MENU;

    switch (Input) {
    case 1 :
	xil_printf("Enter Read Addr: 0x");
	Addr = XHdmi_SubMenuProcess(1);
	xil_printf("\r\n");

	// Reset I2C controller before issuing new transaction. This is required to
	// recover the IIC controller in case a previous transaction is pending.
	XIic_WriteReg(XPAR_IIC_0_BASEADDR, XIIC_RESETR_OFFSET,
			XIIC_RESET_MASK);

	xil_printf("Addr 0x%02x: 0x%02x\r\n", (Addr),
			i2c_dp159_read(1, Addr));
	break;

    case 2 :
	xil_printf("Enter Write Addr: 0x");
	Addr = XHdmi_SubMenuProcess(1);
	xil_printf("\r\n");
	xil_printf("Enter Write Data: 0x");
	Data = XHdmi_SubMenuProcess(1);
	xil_printf("\r\n");

	// Reset I2C controller before issuing new transaction. This is required to
	// recover the IIC controller in case a previous transaction is pending.
	XIic_WriteReg(XPAR_IIC_0_BASEADDR, XIIC_RESETR_OFFSET,
			XIIC_RESET_MASK);

	i2c_dp159_write(1, Addr, Data);

	break;

    case 3 :
    i2c_dp159_dump();
	break;

    case 4 :
	xil_printf("Enter Read Addr: 0x");
	Addr = XHdmi_SubMenuProcess(1);
	xil_printf("\r\n");

	// Reset I2C controller before issuing new transaction. This is required to
	// recover the IIC controller in case a previous transaction is pending.
	XIic_WriteReg(XPAR_IIC_0_BASEADDR, XIIC_RESETR_OFFSET,
			XIIC_RESET_MASK);

	xil_printf("Addr 0x%02x: 0x%02x\r\n", (Addr),
			i2c_tmds181_read(1, Addr));
	break;

    case 5 :
	xil_printf("Enter Write Addr: 0x");
	Addr = XHdmi_SubMenuProcess(1);
	xil_printf("\r\n");
	xil_printf("Enter Write Data: 0x");
	Data = XHdmi_SubMenuProcess(1);
	xil_printf("\r\n");

	// Reset I2C controller before issuing new transaction. This is required to
	// recover the IIC controller in case a previous transaction is pending.
	XIic_WriteReg(XPAR_IIC_0_BASEADDR, XIIC_RESETR_OFFSET,
			XIIC_RESET_MASK);

	i2c_tmds181_write(1, Addr, Data);

	break;

    case 6 :
    i2c_tmds181_dump();
	break;

	// Exit
    case 99 :
	xil_printf("Returning to main menu.\r\n");
	Menu = XHDMI_MAIN_MENU;
	break;

default :
	    xil_printf("Unknown option\r\n");
	    XHdmi_DisplayDP159Menu();
	    break;
    }

    return Menu;
}
/*****************************************************************************/
/**
*
* This function implements the HDMI debug menu state.
*
* @param input is the value used for the next menu state decoder.
*
* @return The next menu state.
*
******************************************************************************/
This function implements the HDMI debug menu state.
This function implements the HDMI debug menu state .
static XHdmi_MenuType XHdmi_DP159Menu(XHdmi_Menu *InstancePtr, u8 Input) {
    XHdmi_MenuType  Menu;
    u8 Addr, Data;
    Menu = XHDMI_DP159_MENU;
    switch (Input) {
    case 1 :
	xil_printf("Enter Read Addr: 0x");
	Addr = XHdmi_SubMenuProcess(1);
	xil_printf("\r\n");
	XIic_WriteReg(XPAR_IIC_0_BASEADDR, XIIC_RESETR_OFFSET,
			XIIC_RESET_MASK);
	xil_printf("Addr 0x%02x: 0x%02x\r\n", (Addr),
			i2c_dp159_read(1, Addr));
	break;
    case 2 :
	xil_printf("Enter Write Addr: 0x");
	Addr = XHdmi_SubMenuProcess(1);
	xil_printf("\r\n");
	xil_printf("Enter Write Data: 0x");
	Data = XHdmi_SubMenuProcess(1);
	xil_printf("\r\n");
	XIic_WriteReg(XPAR_IIC_0_BASEADDR, XIIC_RESETR_OFFSET,
			XIIC_RESET_MASK);
	i2c_dp159_write(1, Addr, Data);
	break;
    case 3 :
    i2c_dp159_dump();
	break;
    case 4 :
	xil_printf("Enter Read Addr: 0x");
	Addr = XHdmi_SubMenuProcess(1);
	xil_printf("\r\n");
	XIic_WriteReg(XPAR_IIC_0_BASEADDR, XIIC_RESETR_OFFSET,
			XIIC_RESET_MASK);
	xil_printf("Addr 0x%02x: 0x%02x\r\n", (Addr),
			i2c_tmds181_read(1, Addr));
	break;
    case 5 :
	xil_printf("Enter Write Addr: 0x");
	Addr = XHdmi_SubMenuProcess(1);
	xil_printf("\r\n");
	xil_printf("Enter Write Data: 0x");
	Data = XHdmi_SubMenuProcess(1);
	xil_printf("\r\n");
	XIic_WriteReg(XPAR_IIC_0_BASEADDR, XIIC_RESETR_OFFSET,
			XIIC_RESET_MASK);
	i2c_tmds181_write(1, Addr, Data);
	break;
    case 6 :
    i2c_tmds181_dump();
	break;
    case 99 :
	xil_printf("Returning to main menu.\r\n");
	Menu = XHDMI_MAIN_MENU;
	break;
default :
	    xil_printf("Unknown option\r\n");
	    XHdmi_DisplayDP159Menu();
	    break;
    }
    return Menu;
}
static XHdmi_MenuType XHdmi_DP159Menu ( XHdmi_Menu * InstancePtr , u8 Input ) { XHdmi_MenuType Menu ; u8 Addr , Data ; Menu = XHDMI_DP159_MENU ; switch ( Input ) { case 1 : xil_printf ( " " ) ; Addr = XHdmi_SubMenuProcess ( 1 ) ; xil_printf ( " \r \n " ) ; XIic_WriteReg ( XPAR_IIC_0_BASEADDR , XIIC_RESETR_OFFSET , XIIC_RESET_MASK ) ; xil_printf ( " \r \n " , ( Addr ) , i2c_dp159_read ( 1 , Addr ) ) ; break ; case 2 : xil_printf ( " " ) ; Addr = XHdmi_SubMenuProcess ( 1 ) ; xil_printf ( " \r \n " ) ; xil_printf ( " " ) ; Data = XHdmi_SubMenuProcess ( 1 ) ; xil_printf ( " \r \n " ) ; XIic_WriteReg ( XPAR_IIC_0_BASEADDR , XIIC_RESETR_OFFSET , XIIC_RESET_MASK ) ; i2c_dp159_write ( 1 , Addr , Data ) ; break ; case 3 : i2c_dp159_dump ( ) ; break ; case 4 : xil_printf ( " " ) ; Addr = XHdmi_SubMenuProcess ( 1 ) ; xil_printf ( " \r \n " ) ; XIic_WriteReg ( XPAR_IIC_0_BASEADDR , XIIC_RESETR_OFFSET , XIIC_RESET_MASK ) ; xil_printf ( " \r \n " , ( Addr ) , i2c_tmds181_read ( 1 , Addr ) ) ; break ; case 5 : xil_printf ( " " ) ; Addr = XHdmi_SubMenuProcess ( 1 ) ; xil_printf ( " \r \n " ) ; xil_printf ( " " ) ; Data = XHdmi_SubMenuProcess ( 1 ) ; xil_printf ( " \r \n " ) ; XIic_WriteReg ( XPAR_IIC_0_BASEADDR , XIIC_RESETR_OFFSET , XIIC_RESET_MASK ) ; i2c_tmds181_write ( 1 , Addr , Data ) ; break ; case 6 : i2c_tmds181_dump ( ) ; break ; case 99 : xil_printf ( " \r \n " ) ; Menu = XHDMI_MAIN_MENU ; break ; default : xil_printf ( " \r \n " ) ; XHdmi_DisplayDP159Menu ( ) ; break ; } return Menu ; }
This function implements the HDMI debug menu state.
This function implements the HDMI debug menu state .
/* Variables */ /* Default */ // Reset I2C controller before issuing new transaction. This is required to // recover the IIC controller in case a previous transaction is pending. // Reset I2C controller before issuing new transaction. This is required to // recover the IIC controller in case a previous transaction is pending. // Reset I2C controller before issuing new transaction. This is required to // recover the IIC controller in case a previous transaction is pending. // Reset I2C controller before issuing new transaction. This is required to // recover the IIC controller in case a previous transaction is pending. // Exit