#ifndef _LIBXPIO_IMPL_H
#define _LIBXPIO_IMPL_H
#include <libxpio.h>
#include <sys/gpio/kgpio.h>
#include <sys/gpio/kgpio_provider.h>
#ifdef __cplusplus
extern "C" {
#endif
#define XPIO_ERR_LEN 1024
#define XPIO_NVL_LEN (16 * 1024)
struct xpio {
xpio_err_t xp_err;
int32_t xp_syserr;
char xp_errmsg[XPIO_ERR_LEN];
di_node_t xp_devinfo;
};
struct xpio_ctrl {
list_node_t xc_link;
xpio_t *xc_xpio;
di_minor_t xc_minor;
const char *xc_name;
int xc_fd;
};
struct xpio_ctrl_info {
uint32_t xci_ngpios;
uint32_t xci_ndpios;
char xci_devpath[MAXPATHLEN];
};
struct xpio_gpio_info {
uint32_t xgi_id;
kgpio_gpio_flags_t xgi_flags;
nvlist_t *xgi_nvl;
};
struct xpio_gpio_update {
xpio_update_err_t xgo_err;
int32_t xgo_syserr;
char xgo_errmsg[XPIO_ERR_LEN];
xpio_gpio_info_t *xgo_gpio;
nvlist_t *xgo_update;
nvlist_t *xgo_err_nvl;
};
struct xpio_dpio_info {
char xdi_dpio[DPIO_NAMELEN];
char xdi_ctrl[DPIO_NAMELEN];
uint32_t xdi_gpio;
dpio_caps_t xdi_caps;
dpio_flags_t xdi_flags;
};
extern bool xpio_error(xpio_t *, xpio_err_t, int32_t, const char *,
...) __PRINTFLIKE(4);
extern bool xpio_success(xpio_t *);
extern bool xpio_update_error(xpio_gpio_update_t *, xpio_update_err_t, int32_t,
const char *, ...) __PRINTFLIKE(4);
extern bool xpio_update_success(xpio_gpio_update_t *);
#ifdef __cplusplus
}
#endif
#endif