1*fd71220bSRobert Mustacchi /* 2*fd71220bSRobert Mustacchi * This file and its contents are supplied under the terms of the 3*fd71220bSRobert Mustacchi * Common Development and Distribution License ("CDDL"), version 1.0. 4*fd71220bSRobert Mustacchi * You may only use this file in accordance with the terms of version 5*fd71220bSRobert Mustacchi * 1.0 of the CDDL. 6*fd71220bSRobert Mustacchi * 7*fd71220bSRobert Mustacchi * A full copy of the text of the CDDL should have accompanied this 8*fd71220bSRobert Mustacchi * source. A copy of the CDDL is also available via the Internet at 9*fd71220bSRobert Mustacchi * http://www.illumos.org/license/CDDL. 10*fd71220bSRobert Mustacchi */ 11*fd71220bSRobert Mustacchi 12*fd71220bSRobert Mustacchi /* 13*fd71220bSRobert Mustacchi * Copyright 2022 Oxide Computer Company 14*fd71220bSRobert Mustacchi */ 15*fd71220bSRobert Mustacchi 16*fd71220bSRobert Mustacchi #ifndef _LIBXPIO_H 17*fd71220bSRobert Mustacchi #define _LIBXPIO_H 18*fd71220bSRobert Mustacchi 19*fd71220bSRobert Mustacchi /* 20*fd71220bSRobert Mustacchi * An evolving, but private, interface to the kernel GPIO and DPIO subsystems 21*fd71220bSRobert Mustacchi * (hence xPIO). 22*fd71220bSRobert Mustacchi */ 23*fd71220bSRobert Mustacchi 24*fd71220bSRobert Mustacchi #ifdef __cplusplus 25*fd71220bSRobert Mustacchi extern "C" { 26*fd71220bSRobert Mustacchi #endif 27*fd71220bSRobert Mustacchi 28*fd71220bSRobert Mustacchi #include <stdint.h> 29*fd71220bSRobert Mustacchi #include <stdbool.h> 30*fd71220bSRobert Mustacchi #include <libdevinfo.h> 31*fd71220bSRobert Mustacchi #include <sys/gpio/dpio.h> 32*fd71220bSRobert Mustacchi 33*fd71220bSRobert Mustacchi typedef enum { 34*fd71220bSRobert Mustacchi XPIO_ERR_OK = 0, 35*fd71220bSRobert Mustacchi /* 36*fd71220bSRobert Mustacchi * Indicates that there was a memory allocation error. The system error 37*fd71220bSRobert Mustacchi * contains the specific errno. 38*fd71220bSRobert Mustacchi */ 39*fd71220bSRobert Mustacchi XPIO_ERR_NO_MEM, 40*fd71220bSRobert Mustacchi /* 41*fd71220bSRobert Mustacchi * Indicates that an error occurred while trying to use the devinfo 42*fd71220bSRobert Mustacchi * library. 43*fd71220bSRobert Mustacchi */ 44*fd71220bSRobert Mustacchi XPIO_ERR_LIBDEVINFO, 45*fd71220bSRobert Mustacchi /* 46*fd71220bSRobert Mustacchi * Indicates that an internal error condition occurred. 47*fd71220bSRobert Mustacchi */ 48*fd71220bSRobert Mustacchi XPIO_ERR_INTERNAL, 49*fd71220bSRobert Mustacchi /* 50*fd71220bSRobert Mustacchi * Indicates that the function was given an invalid pointer argument. 51*fd71220bSRobert Mustacchi */ 52*fd71220bSRobert Mustacchi XPIO_ERR_BAD_PTR, 53*fd71220bSRobert Mustacchi /* 54*fd71220bSRobert Mustacchi * Indicate that the passed in minor node name was not the right type. 55*fd71220bSRobert Mustacchi */ 56*fd71220bSRobert Mustacchi XPIO_ERR_WRONG_MINOR_TYPE, 57*fd71220bSRobert Mustacchi /* 58*fd71220bSRobert Mustacchi * Indicates a failure to open a device file. 59*fd71220bSRobert Mustacchi */ 60*fd71220bSRobert Mustacchi XPIO_ERR_OPEN_DEV, 61*fd71220bSRobert Mustacchi /* 62*fd71220bSRobert Mustacchi * Indicates a failure to talk with the kgpio subsystem. 63*fd71220bSRobert Mustacchi */ 64*fd71220bSRobert Mustacchi XPIO_ERR_KGPIO, 65*fd71220bSRobert Mustacchi /* 66*fd71220bSRobert Mustacchi * Indicates that the specified GPIO controller does not exist. 67*fd71220bSRobert Mustacchi */ 68*fd71220bSRobert Mustacchi XPIO_ERR_BAD_CTRL_NAME, 69*fd71220bSRobert Mustacchi /* 70*fd71220bSRobert Mustacchi * Indicates that the requested GPIO name or number does not exist. 71*fd71220bSRobert Mustacchi */ 72*fd71220bSRobert Mustacchi XPIO_ERR_BAD_GPIO_ID, 73*fd71220bSRobert Mustacchi /* 74*fd71220bSRobert Mustacchi * Indicates that there was something wrong with the attributes that 75*fd71220bSRobert Mustacchi * were handed in an update. The update structure has additional 76*fd71220bSRobert Mustacchi * information. 77*fd71220bSRobert Mustacchi */ 78*fd71220bSRobert Mustacchi XPIO_ERR_BAD_UPDATE, 79*fd71220bSRobert Mustacchi /* 80*fd71220bSRobert Mustacchi * Indicates that an attempt to perform an update cannot proceed because 81*fd71220bSRobert Mustacchi * the structure has already been used for an update and has error 82*fd71220bSRobert Mustacchi * information associated with it. 83*fd71220bSRobert Mustacchi */ 84*fd71220bSRobert Mustacchi XPIO_ERR_UPDATE_USED, 85*fd71220bSRobert Mustacchi /* 86*fd71220bSRobert Mustacchi * Indicates that the features that were passed in to create the DPIO 87*fd71220bSRobert Mustacchi * included something that was invalid. 88*fd71220bSRobert Mustacchi */ 89*fd71220bSRobert Mustacchi XPIO_ERR_BAD_DPIO_FEAT, 90*fd71220bSRobert Mustacchi /* 91*fd71220bSRobert Mustacchi * Indicates that the name of the DPIO was invalid or does not exist. 92*fd71220bSRobert Mustacchi */ 93*fd71220bSRobert Mustacchi XPIO_ERR_BAD_DPIO_NAME, 94*fd71220bSRobert Mustacchi /* 95*fd71220bSRobert Mustacchi * Indicates that the name of the GPIO was invalid. 96*fd71220bSRobert Mustacchi */ 97*fd71220bSRobert Mustacchi XPIO_ERR_BAD_GPIO_NAME, 98*fd71220bSRobert Mustacchi /* 99*fd71220bSRobert Mustacchi * Indicates that an attempt to lookup something (e.g. a GPIO) did not 100*fd71220bSRobert Mustacchi * succeed. 101*fd71220bSRobert Mustacchi */ 102*fd71220bSRobert Mustacchi XPIO_ERR_NO_LOOKUP_MATCH 103*fd71220bSRobert Mustacchi } xpio_err_t; 104*fd71220bSRobert Mustacchi 105*fd71220bSRobert Mustacchi typedef enum { 106*fd71220bSRobert Mustacchi XPIO_ATTR_TYPE_STRING, 107*fd71220bSRobert Mustacchi XPIO_ATTR_TYPE_UINT32 108*fd71220bSRobert Mustacchi } xpio_attr_type_t; 109*fd71220bSRobert Mustacchi 110*fd71220bSRobert Mustacchi typedef enum { 111*fd71220bSRobert Mustacchi XPIO_ATTR_PROT_RO, 112*fd71220bSRobert Mustacchi XPIO_ATTR_PROT_RW 113*fd71220bSRobert Mustacchi } xpio_attr_prot_t; 114*fd71220bSRobert Mustacchi 115*fd71220bSRobert Mustacchi typedef struct xpio xpio_t; 116*fd71220bSRobert Mustacchi typedef struct xpio_ctrl xpio_ctrl_t; 117*fd71220bSRobert Mustacchi typedef struct xpio_ctrl_info xpio_ctrl_info_t; 118*fd71220bSRobert Mustacchi typedef struct xpio_gpio_info xpio_gpio_info_t; 119*fd71220bSRobert Mustacchi typedef struct xpio_gpio_attr xpio_gpio_attr_t; 120*fd71220bSRobert Mustacchi typedef struct xpio_gpio_attr_err xpio_gpio_attr_err_t; 121*fd71220bSRobert Mustacchi typedef struct xpio_gpio_update xpio_gpio_update_t; 122*fd71220bSRobert Mustacchi typedef struct xpio_dpio_info xpio_dpio_info_t; 123*fd71220bSRobert Mustacchi 124*fd71220bSRobert Mustacchi 125*fd71220bSRobert Mustacchi extern xpio_t *xpio_init(void); 126*fd71220bSRobert Mustacchi extern void xpio_fini(xpio_t *); 127*fd71220bSRobert Mustacchi 128*fd71220bSRobert Mustacchi extern xpio_err_t xpio_err(xpio_t *); 129*fd71220bSRobert Mustacchi extern int32_t xpio_syserr(xpio_t *); 130*fd71220bSRobert Mustacchi extern const char *xpio_errmsg(xpio_t *); 131*fd71220bSRobert Mustacchi extern const char *xpio_err2str(xpio_t *, xpio_err_t); 132*fd71220bSRobert Mustacchi 133*fd71220bSRobert Mustacchi /* 134*fd71220bSRobert Mustacchi * Controller Discovery Functions 135*fd71220bSRobert Mustacchi */ 136*fd71220bSRobert Mustacchi typedef struct { 137*fd71220bSRobert Mustacchi di_minor_t xcd_minor; 138*fd71220bSRobert Mustacchi } xpio_ctrl_disc_t; 139*fd71220bSRobert Mustacchi 140*fd71220bSRobert Mustacchi typedef bool (*xpio_ctrl_disc_f)(xpio_t *, xpio_ctrl_disc_t *, void *); 141*fd71220bSRobert Mustacchi extern void xpio_ctrl_discover(xpio_t *, xpio_ctrl_disc_f, void *); 142*fd71220bSRobert Mustacchi 143*fd71220bSRobert Mustacchi extern bool xpio_ctrl_init(xpio_t *, di_minor_t, xpio_ctrl_t **); 144*fd71220bSRobert Mustacchi extern bool xpio_ctrl_init_by_name(xpio_t *, const char *, xpio_ctrl_t **); 145*fd71220bSRobert Mustacchi extern void xpio_ctrl_fini(xpio_ctrl_t *); 146*fd71220bSRobert Mustacchi 147*fd71220bSRobert Mustacchi /* 148*fd71220bSRobert Mustacchi * Get information about a controller. Once obtained, the lifetime is disjoint 149*fd71220bSRobert Mustacchi * from the controller. 150*fd71220bSRobert Mustacchi */ 151*fd71220bSRobert Mustacchi extern bool xpio_ctrl_info(xpio_ctrl_t *, xpio_ctrl_info_t **); 152*fd71220bSRobert Mustacchi extern void xpio_ctrl_info_free(xpio_ctrl_info_t *); 153*fd71220bSRobert Mustacchi extern uint32_t xpio_ctrl_info_ngpios(xpio_ctrl_info_t *); 154*fd71220bSRobert Mustacchi extern uint32_t xpio_ctrl_info_ndpios(xpio_ctrl_info_t *); 155*fd71220bSRobert Mustacchi extern const char *xpio_ctrl_info_devpath(xpio_ctrl_info_t *); 156*fd71220bSRobert Mustacchi 157*fd71220bSRobert Mustacchi /* 158*fd71220bSRobert Mustacchi * Ways to translae between human known names to the provider's underlying IDs. 159*fd71220bSRobert Mustacchi * This only searches the specified controller. 160*fd71220bSRobert Mustacchi */ 161*fd71220bSRobert Mustacchi extern bool xpio_gpio_lookup_id(xpio_ctrl_t *, const char *, uint32_t *); 162*fd71220bSRobert Mustacchi 163*fd71220bSRobert Mustacchi /* 164*fd71220bSRobert Mustacchi * Snapshot information about a GPIO, walk and understand its attributes. Once 165*fd71220bSRobert Mustacchi * obtained, the lifetime is disjoint from the underlying controller and handle. 166*fd71220bSRobert Mustacchi * Each gpio can be operated on in parallel safely. Attributes are tied to the 167*fd71220bSRobert Mustacchi * corresponding gpio. 168*fd71220bSRobert Mustacchi */ 169*fd71220bSRobert Mustacchi extern bool xpio_gpio_info(xpio_ctrl_t *, uint32_t, xpio_gpio_info_t **); 170*fd71220bSRobert Mustacchi extern uint32_t xpio_gpio_id(xpio_gpio_info_t *); 171*fd71220bSRobert Mustacchi extern xpio_gpio_attr_t *xpio_gpio_attr_next(xpio_gpio_info_t *, 172*fd71220bSRobert Mustacchi xpio_gpio_attr_t *); 173*fd71220bSRobert Mustacchi extern xpio_gpio_attr_t *xpio_gpio_attr_find(xpio_gpio_info_t *, const char *); 174*fd71220bSRobert Mustacchi extern const char *xpio_gpio_attr_name(xpio_gpio_info_t *, xpio_gpio_attr_t *); 175*fd71220bSRobert Mustacchi extern xpio_attr_type_t xpio_gpio_attr_type(xpio_gpio_info_t *, 176*fd71220bSRobert Mustacchi xpio_gpio_attr_t *); 177*fd71220bSRobert Mustacchi extern xpio_attr_prot_t xpio_gpio_attr_prot(xpio_gpio_info_t *, 178*fd71220bSRobert Mustacchi xpio_gpio_attr_t *); 179*fd71220bSRobert Mustacchi extern bool xpio_gpio_attr_value_uint32(xpio_gpio_attr_t *, uint32_t *); 180*fd71220bSRobert Mustacchi extern bool xpio_gpio_attr_value_string(xpio_gpio_attr_t *, const char **); 181*fd71220bSRobert Mustacchi extern void xpio_gpio_attr_possible_uint32(xpio_gpio_info_t *, 182*fd71220bSRobert Mustacchi xpio_gpio_attr_t *, uint32_t **, uint_t *); 183*fd71220bSRobert Mustacchi extern void xpio_gpio_attr_possible_string(xpio_gpio_info_t *, 184*fd71220bSRobert Mustacchi xpio_gpio_attr_t *, const char ***, uint_t *); 185*fd71220bSRobert Mustacchi extern bool xpio_gpio_attr_xlate_to_str(xpio_gpio_info_t *, xpio_gpio_attr_t *, 186*fd71220bSRobert Mustacchi char *, size_t); 187*fd71220bSRobert Mustacchi extern bool xpio_gpio_attr_xlate_uint32_to_str(xpio_gpio_info_t *, 188*fd71220bSRobert Mustacchi xpio_gpio_attr_t *, uint32_t, char *, size_t); 189*fd71220bSRobert Mustacchi extern void xpio_gpio_info_free(xpio_gpio_info_t *); 190*fd71220bSRobert Mustacchi 191*fd71220bSRobert Mustacchi /* 192*fd71220bSRobert Mustacchi * The GPIO update data structure is used to track all of the updates that need 193*fd71220bSRobert Mustacchi * to occur to a given GPIO. This structure is tied to the gpio information 194*fd71220bSRobert Mustacchi * because the attributes that a given GPIO has may vary between GPIOs in a 195*fd71220bSRobert Mustacchi * given provider. This update structure can then be given to xpio_gpio_set() to 196*fd71220bSRobert Mustacchi * actually set the information. 197*fd71220bSRobert Mustacchi * 198*fd71220bSRobert Mustacchi * When it comes to error handling and checking here, we only attempt to verify 199*fd71220bSRobert Mustacchi * that an attribute is one that the provider reported to us. We do not attempt 200*fd71220bSRobert Mustacchi * to verify whether it is read-only or not. However, as part of translating 201*fd71220bSRobert Mustacchi * values, we will verify the types. There are two different groups of setting 202*fd71220bSRobert Mustacchi * functions. One is intended for CLI applications which just takes a string and 203*fd71220bSRobert Mustacchi * does all the translation that is necessary as part of setting the attribute. 204*fd71220bSRobert Mustacchi * The other set allows one to specify the types of values themselves. 205*fd71220bSRobert Mustacchi * 206*fd71220bSRobert Mustacchi * To try and provide reasonable error handling, we provide a unique set of 207*fd71220bSRobert Mustacchi * error routines (e.g. these do not require the xpio_t). Finally, as part of 208*fd71220bSRobert Mustacchi * attempting to set a gpio, errors will be returned as something that one can 209*fd71220bSRobert Mustacchi * iterate and determine what wrong with each attribute value to attempt to make 210*fd71220bSRobert Mustacchi * error handling easier. 211*fd71220bSRobert Mustacchi */ 212*fd71220bSRobert Mustacchi typedef enum { 213*fd71220bSRobert Mustacchi /* 214*fd71220bSRobert Mustacchi * Indicates that the update was OK. 215*fd71220bSRobert Mustacchi */ 216*fd71220bSRobert Mustacchi XPIO_UPDATE_ERR_OK, 217*fd71220bSRobert Mustacchi /* 218*fd71220bSRobert Mustacchi * Indicates that there was an attempt to update a read-only attribute. 219*fd71220bSRobert Mustacchi */ 220*fd71220bSRobert Mustacchi XPIO_UPDATE_ERR_RO, 221*fd71220bSRobert Mustacchi /* 222*fd71220bSRobert Mustacchi * Indicates that the attribute's name was unknown to the provider. 223*fd71220bSRobert Mustacchi */ 224*fd71220bSRobert Mustacchi XPIO_UPDATE_ERR_UNKNOWN_ATTR, 225*fd71220bSRobert Mustacchi /* 226*fd71220bSRobert Mustacchi * Indicates that the value for a given attribute's type was incorrect. 227*fd71220bSRobert Mustacchi */ 228*fd71220bSRobert Mustacchi XPIO_UPDATE_ERR_BAD_TYPE, 229*fd71220bSRobert Mustacchi /* 230*fd71220bSRobert Mustacchi * Indicates that the system didn't know the value in question. 231*fd71220bSRobert Mustacchi */ 232*fd71220bSRobert Mustacchi XPIO_UPDATE_ERR_UNKNOWN_VAL, 233*fd71220bSRobert Mustacchi /* 234*fd71220bSRobert Mustacchi * Indicates that the system was unable to translate an attribute value 235*fd71220bSRobert Mustacchi * into its underlying type. 236*fd71220bSRobert Mustacchi */ 237*fd71220bSRobert Mustacchi XPIO_UPDATE_ERR_CANT_XLATE, 238*fd71220bSRobert Mustacchi /* 239*fd71220bSRobert Mustacchi * Indicates that this was a valid attribute, but it could not be 240*fd71220bSRobert Mustacchi * applied. 241*fd71220bSRobert Mustacchi */ 242*fd71220bSRobert Mustacchi XPIO_UPDATE_ERR_CANT_APPLY_VAL, 243*fd71220bSRobert Mustacchi /* 244*fd71220bSRobert Mustacchi * Indicates that we ran out of memory processing something. 245*fd71220bSRobert Mustacchi */ 246*fd71220bSRobert Mustacchi XPIO_UPDATE_ERR_NO_MEM, 247*fd71220bSRobert Mustacchi /* 248*fd71220bSRobert Mustacchi * Indicates that an internal error occurred in the library. 249*fd71220bSRobert Mustacchi */ 250*fd71220bSRobert Mustacchi XPIO_UPDATE_ERR_INTERNAL 251*fd71220bSRobert Mustacchi } xpio_update_err_t; 252*fd71220bSRobert Mustacchi 253*fd71220bSRobert Mustacchi extern bool xpio_gpio_update_init(xpio_t *, xpio_gpio_info_t *, 254*fd71220bSRobert Mustacchi xpio_gpio_update_t **); 255*fd71220bSRobert Mustacchi 256*fd71220bSRobert Mustacchi extern xpio_update_err_t xpio_update_err(xpio_gpio_update_t *); 257*fd71220bSRobert Mustacchi extern int32_t xpio_update_syserr(xpio_gpio_update_t *); 258*fd71220bSRobert Mustacchi extern const char *xpio_update_errmsg(xpio_gpio_update_t *); 259*fd71220bSRobert Mustacchi extern const char *xpio_update_err2str(xpio_gpio_update_t *, 260*fd71220bSRobert Mustacchi xpio_update_err_t); 261*fd71220bSRobert Mustacchi 262*fd71220bSRobert Mustacchi /* 263*fd71220bSRobert Mustacchi * These two routines allow a caller to set an attribute's value directly. There 264*fd71220bSRobert Mustacchi * is no checking on whether the attribute's value is known or valid. 265*fd71220bSRobert Mustacchi */ 266*fd71220bSRobert Mustacchi extern bool xpio_gpio_attr_set_str(xpio_gpio_update_t *, xpio_gpio_attr_t *, 267*fd71220bSRobert Mustacchi const char *); 268*fd71220bSRobert Mustacchi extern bool xpio_gpio_attr_set_uint32(xpio_gpio_update_t *, xpio_gpio_attr_t *, 269*fd71220bSRobert Mustacchi uint32_t); 270*fd71220bSRobert Mustacchi /* 271*fd71220bSRobert Mustacchi * The two update functions above assume that you have already determined the 272*fd71220bSRobert Mustacchi * right type. This one performs any translation that might be required to go 273*fd71220bSRobert Mustacchi * from a string to the underlying type and then sets the attribute 274*fd71220bSRobert Mustacchi * appropriately. This will also verify that the value is known to the system, 275*fd71220bSRobert Mustacchi * unlike the ones above. 276*fd71220bSRobert Mustacchi */ 277*fd71220bSRobert Mustacchi extern bool xpio_gpio_attr_from_str(xpio_gpio_update_t *, 278*fd71220bSRobert Mustacchi xpio_gpio_attr_t *, const char *); 279*fd71220bSRobert Mustacchi 280*fd71220bSRobert Mustacchi /* 281*fd71220bSRobert Mustacchi * This proceeds to update the GPIO that this update structure is for. After 282*fd71220bSRobert Mustacchi * calling this, if this fails, then one can iterate the update structure for 283*fd71220bSRobert Mustacchi * errors that occurred. 284*fd71220bSRobert Mustacchi */ 285*fd71220bSRobert Mustacchi extern bool xpio_gpio_update(xpio_ctrl_t *, xpio_gpio_update_t *); 286*fd71220bSRobert Mustacchi extern xpio_gpio_attr_err_t *xpio_gpio_attr_err_next(xpio_gpio_update_t *, 287*fd71220bSRobert Mustacchi xpio_gpio_attr_err_t *); 288*fd71220bSRobert Mustacchi extern const char *xpio_gpio_attr_err_name(xpio_gpio_attr_err_t *); 289*fd71220bSRobert Mustacchi extern xpio_update_err_t xpio_gpio_attr_err_err(xpio_gpio_attr_err_t *); 290*fd71220bSRobert Mustacchi 291*fd71220bSRobert Mustacchi /* 292*fd71220bSRobert Mustacchi * This tears down the xpio_gpio_update_t, at which point any outstanding 293*fd71220bSRobert Mustacchi * xpio_gpio_attr_err_t's are no longer valid (that is their lifetime is joined 294*fd71220bSRobert Mustacchi * together). 295*fd71220bSRobert Mustacchi */ 296*fd71220bSRobert Mustacchi extern void xpio_gpio_update_free(xpio_gpio_update_t *); 297*fd71220bSRobert Mustacchi 298*fd71220bSRobert Mustacchi /* 299*fd71220bSRobert Mustacchi * Create a DPIO from the specified GPIO. The DPIO's supported features are 300*fd71220bSRobert Mustacchi * based on the following bitfield. 301*fd71220bSRobert Mustacchi */ 302*fd71220bSRobert Mustacchi typedef enum { 303*fd71220bSRobert Mustacchi XPIO_DPIO_F_READ = 1 << 0, 304*fd71220bSRobert Mustacchi XPIO_DPIO_F_WRITE = 1 << 1, 305*fd71220bSRobert Mustacchi XPIO_DPIO_F_KERNEL = 1 << 2, 306*fd71220bSRobert Mustacchi } xpio_dpio_features_t; 307*fd71220bSRobert Mustacchi 308*fd71220bSRobert Mustacchi extern bool xpio_dpio_create(xpio_ctrl_t *, xpio_gpio_info_t *, const char *, 309*fd71220bSRobert Mustacchi xpio_dpio_features_t); 310*fd71220bSRobert Mustacchi extern bool xpio_dpio_destroy(xpio_ctrl_t *, xpio_gpio_info_t *); 311*fd71220bSRobert Mustacchi 312*fd71220bSRobert Mustacchi /* 313*fd71220bSRobert Mustacchi * DPIO Discovery and Basic Information 314*fd71220bSRobert Mustacchi */ 315*fd71220bSRobert Mustacchi typedef struct { 316*fd71220bSRobert Mustacchi di_minor_t xdd_minor; 317*fd71220bSRobert Mustacchi } xpio_dpio_disc_t; 318*fd71220bSRobert Mustacchi 319*fd71220bSRobert Mustacchi typedef bool (*xpio_dpio_disc_f)(xpio_t *, xpio_dpio_disc_t *, void *); 320*fd71220bSRobert Mustacchi extern void xpio_dpio_discover(xpio_t *, xpio_dpio_disc_f, void *); 321*fd71220bSRobert Mustacchi 322*fd71220bSRobert Mustacchi extern bool xpio_dpio_info(xpio_t *, di_minor_t, xpio_dpio_info_t **); 323*fd71220bSRobert Mustacchi extern const char *xpio_dpio_info_ctrl(xpio_dpio_info_t *); 324*fd71220bSRobert Mustacchi extern const char *xpio_dpio_info_name(xpio_dpio_info_t *); 325*fd71220bSRobert Mustacchi extern uint32_t xpio_dpio_info_gpionum(xpio_dpio_info_t *); 326*fd71220bSRobert Mustacchi extern dpio_caps_t xpio_dpio_info_caps(xpio_dpio_info_t *); 327*fd71220bSRobert Mustacchi extern dpio_flags_t xpio_dpio_info_flags(xpio_dpio_info_t *); 328*fd71220bSRobert Mustacchi extern void xpio_dpio_info_free(xpio_dpio_info_t *); 329*fd71220bSRobert Mustacchi 330*fd71220bSRobert Mustacchi #ifdef __cplusplus 331*fd71220bSRobert Mustacchi } 332*fd71220bSRobert Mustacchi #endif 333*fd71220bSRobert Mustacchi 334*fd71220bSRobert Mustacchi #endif /* _LIBXPIO_H */ 335