XilinxProcessorIPLib/drivers/gpio/examples/xgpio_tapp_example.c
int GpioInputExample(u16 DeviceId, u32 *DataRead)
{
	 int Status;

	 /*
	  * Initialize the GPIO driver so that it's ready to use,
	  * specify the device ID that is generated in xparameters.h
	  */
	 Status = XGpio_Initialize(&GpioInput, DeviceId);
	 if (Status != XST_SUCCESS) {
		  return XST_FAILURE;
	 }

	 /* Set the direction for all signals to be inputs */
	 XGpio_SetDataDirection(&GpioInput, LED_CHANNEL, 0xFFFFFFFF);

	 /* Read the state of the data so that it can be  verified */
	 *DataRead = XGpio_DiscreteRead(&GpioInput, LED_CHANNEL);

	 return XST_SUCCESS;

}
/******************************************************************************/
/**
*
* This function  performs a test on the GPIO driver/device with the GPIO
* configured as INPUT
*
* @param	DeviceId is the XPAR_<GPIO_instance>_DEVICE_ID value from
*		xparameters.h
* @param	DataRead is the pointer where the data read from GPIO Input is
*		returned
*
* @return
*		- XST_SUCCESS if the Test is successful
*		- XST_FAILURE if the test is not successful
*
* @note	  	None.
*
******************************************************************************/
This function  performs a test on the GPIO driver/device with the GPIO
configured as INPUT
This function performs a test on the GPIO driver / device with the GPIO configured as INPUT
int GpioInputExample(u16 DeviceId, u32 *DataRead)
{
	 int Status;
	 Status = XGpio_Initialize(&GpioInput, DeviceId);
	 if (Status != XST_SUCCESS) {
		  return XST_FAILURE;
	 }
	 XGpio_SetDataDirection(&GpioInput, LED_CHANNEL, 0xFFFFFFFF);
	 *DataRead = XGpio_DiscreteRead(&GpioInput, LED_CHANNEL);
	 return XST_SUCCESS;
}
int GpioInputExample ( u16 DeviceId , u32 * DataRead ) { int Status ; Status = XGpio_Initialize ( & GpioInput , DeviceId ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } XGpio_SetDataDirection ( & GpioInput , LED_CHANNEL , 0xFFFFFFFF ) ; * DataRead = XGpio_DiscreteRead ( & GpioInput , LED_CHANNEL ) ; return XST_SUCCESS ; }
This function  performs a test on the GPIO driver/device with the GPIO
configured as INPUT
This function performs a test on the GPIO driver / device with the GPIO configured as INPUT
/*
	  * Initialize the GPIO driver so that it's ready to use,
	  * specify the device ID that is generated in xparameters.h
	  */ /* Set the direction for all signals to be inputs */ /* Read the state of the data so that it can be  verified */