Skip to content
Ricky Su edited this page May 15, 2014 · 2 revisions

Driver

Xilinx driver implements a pin-bank convert function so that the pin based functions can be used. The pin number are defined as following:

0 - 31,  Bank 0
32 - 53, Bank 1
54 - 85, Bank 2
86 - 117, Bank 3

The frequently used pin based APIs are

int XGpioPs_ReadPin(XGpioPs *InstancePtr, int Pin);
void XGpioPs_WritePin(XGpioPs *InstancePtr, int Pin, int Data);
void XGpioPs_SetDirectionPin(XGpioPs *InstancePtr, int Pin, int Direction);
int XGpioPs_GetDirectionPin(XGpioPs *InstancePtr, int Pin);
void XGpioPs_SetOutputEnablePin(XGpioPs *InstancePtr, int Pin, int Enable);
int XGpioPs_GetOutputEnablePin(XGpioPs *InstancePtr, int Pin);

The XGpioPs instance initialization process can be referred in sw\XilinxProcessorIPLib\drivers\gpiops_vx_xx_a\examples\xgpiops_polled_example.c where x is the version numbers.

Here is a simplified example of the above version, to toggle ZC702 DS23.Example