typedef
struct {
u16
DeviceId; /* Unique ID of device */
u32
BaseAddress; /* Device base address */
int
InterruptPresent; /* Are interrupts supported in h/w */
int
IsDual; /* Are 2 channels supported in h/w */
typedef
struct {
u32
BaseAddress; /* Device base address */
u32
IsReady; /* Device is initialized and ready */
int
InterruptPresent; /* Are interrupts supported in h/w */
int
IsDual; /* Are 2 channels supported in h/w */
/*
* Initialization functions in xgpio_sinit.c
*/
int XGpio_Initialize(XGpio *InstancePtr, u16 DeviceId);
XGpio_Config *XGpio_LookupConfig(u16 DeviceId);
函数名 | XGpio_Initialize |
输入 | 1、 XGpio *InstancePtr:需要进行初始化的GPIO结构体; 2、 u16 DeviceId:就是上文提到的DeviceId了。 |
返回 | - XST_SUCCESS if the initialization was successfull. - XST_DEVICE_NOT_FOUND if the device configuration data was not found for a device with the supplied device ID. |
说明 | GPIO初始化 |
函数名 | XGpio_LookupConfig |
输入 | u16 DeviceId:就是上文提到的DeviceId了。 |
返回 | A pointer of data type XGpio_Config which points to the device configuration if DeviceID is found. - NULL if DeviceID is not found. 返回XGpio_Config结构体指针就是了 |
说明 | 获取初始化结构体信息 |
/*
* API Basic functions implemented in xgpio.c
*/
void XGpio_SetDataDirection(XGpio *InstancePtr, unsigned Channel,
u32 DirectionMask);
u32 XGpio_GetDataDirection(XGpio *InstancePtr, unsigned Channel);
获取GPIO的输入输出方向信息。
u32 XGpio_DiscreteRead(XGpio *InstancePtr, unsigned Channel);
GPIO数据读。
/*
* API Functions implemented in xgpio_extra.c
*/
void XGpio_DiscreteSet(XGpio *InstancePtr, unsigned Channel, u32 Mask);
GPIO置1,相应位为1就置1,为0不作改变。
void XGpio_DiscreteClear(XGpio *InstancePtr, unsigned Channel, u32 Mask);
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |