void XGpio_SetDataDirection (XGpio * InstancePtr , unsigned Channel , u32 DirectionMask //0x0:output-------0xffffffff:input )无返回值000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 int XGpio_Initialize (XGpio *InstancePtr , //所定义的变量XXX:XGpio XXX; u16 DeviceId //实际应写成:XPAR_XXX_DEVICE_ID )成功返回值:XST_SUCCESS
失败返回值:XST_DEVICE_NOT_FOUND 000000000000000000000000000000000000000000000000000000000000000000000几个关于中断的函数总结void XGpio_InterruptClear (XGpio *InstancePtr , u32 Mask )无返回值void XGpio_InterruptDisable (XGpio * InstancePtr , u32 Mask )无返回值void XGpio_InterruptEnable (XGpio * InstancePtr , u32 Mask ) 无返回值u32 XGpio_InterruptGetEnabled ( XGpio * InstancePtr ) 无返回值u32 XGpio_InterruptGetStatus ( XGpio * InstancePtr )
void XGpio_InterruptGlobalDisable ( XGpio * InstancePtr ) 无返回值void XGpio_InterruptGlobalEnable ( XGpio * InstancePtr ) 无返回值 00000000000000000000000000000000000000000000000000000000000000000000000000000 XGpio_Config* XGpio_LookupConfig ( u16 DeviceId ) //实际应写成:XPAR_XXX_DEVICE_ID查找设备ID的设备配置0000000000000000000000000000000000000000000000000000000000000000000000000000000 int XGpio_SelfTest ( XGpio * InstancePtr )关于GPIO的几个源代码文件xgpio.hxgpio_extra.cxgpio_g.cxgpio_i.hxgpio_intr.cxgpio_l.hxgpio_selftest.cxgpio_sinit.c 0000000000000000000000000000000000000000000000000000000#define XGPIO_DATA2_OFFSET //Data register for 2nd channel #define XGPIO_DATA_OFFSET //Data register for 1st channel #define XGPIO_GIE_OFFSET //Glogal interrupt enable register #define XGPIO_IER_OFFSET //Interrupt enable register #define XGPIO_IR_CH1_MASK //Mask for the 1st channel #define XGPIO_IR_CH2_MASK //Mask for the 2nd channel #define XGPIO_IR_MASK //Mask of all bits #define XGPIO_ISR_OFFSET //Interrupt status register #define XGpio_mGetDataReg (BaseAddress, Channel ) //Get the data register of the specified GPIO channel.BaseAddress contains the base address of the GPIO device.Channel contains the channel (1 or 2) to operate on. #define XGpio_mReadReg (BaseAddress, RegOffset) //Read a value from a GPIO register. A 32 bit read is performed. If the GPIO component is implemented in a smaller width, only the least significant data is read from the register. The most significant data will be read as 0.BaseAddress is the base address of the GPIO device.Register is the register offset from the base to read from.Data is the data from the register. #define XGpio_mSetDataReg (BaseAddress, Channel, Data)//Set the data register of the specified GPIO channel. BaseAddress contains the base address of the GPIO device.Channel contains the channel (1 or 2) to operate on.Data is the value to be written to the data register. #define XGpio_mWriteReg (BaseAddress, RegOffset, Data) Write a value to a GPIO register. A 32 bit write is performed. If the GPIO component is implemented in a smaller width, only the least significant data is written. BaseAddress is the base address of the GPIO device.RegOffset is the register offset from the base to write to.Data is the data written to the register. #define XGPIO_TRI2_OFFSET //I/O direction reg for 2nd channel#define XGPIO_TRI_OFFSET //I/O direction reg for 1st channel 转载自:kenzol的博客 |