struct xdio;
    Contains information and state for an initialized XDIO core.
    
int open_xdio(struct xdio *x,int num);
    Pass this function a pointer to an uninitialized xdio structure. Returns
    true on success.  The "num" parameter is the zero-index core number to
    open.

void close_xdio(struct xdio *x);
    Call this function to release the resources associated with an XDIO
    core.

int setClockSpeed(xdio *x,int fast);

    Each XDIO core can be set to one of two clock speeds: SLOW and FAST.
    The actual clock period of each of these speeds depends on the model;
    this function returns the clock period in nanoseconds for the speed
    selected.

void setPinDirection(xdio *x,int pin,enum PIN_DIRECTION dir);

    Each XDIO pin can be configured as either an input or as an output.
    Input pins are pulled high when nothing else is connected.  Use this
    function to set the zero-indexed pin number to either INPUT or OUTPUT.
    Be aware that some functions automatically set certain pins to a specific
    direction.

void setPin(xdio *x,int pin,enum PIN_VALUE val);

    Call this function to set the output value of the given pin to either
    LOW or HIGH.  In some cases this call will not make sense, such as when
    the pin is an input, or under the control of another function.

int getPin(xdio *x,int pin);

    This function returns the current state of the specified pin, as either
    LOW (0) or HIGH (1).

void initPulseTimer(xdio *x,int pin,int acc,enum PULSE_TYPE ptype);

    Prepare the pulse timer to begin sampling pulses on the specified pin.
    It is not required that the specified pin be an input.  Pass a true
    value for the "acc" parameter if you wish pulse times to be accumulated
    across each pulse, instead of only timing the last pulse.  The acceptable
    pulse types are:
      PULSE_LOW_TIME (same as NEGEDGE_TO_POSEDGE)
      PULSE_HIGH_TIME (same as POSEDGE_TO_NEGEDGE)
      PULSE_PERIOD_LOW (same as NEGEDGE_TO_NEGEDGE)
      PULSE_PERIOD_HIGH (same as POSEDGE_TO_POSEDGE)

long long getPulseTimer(xdio *x,int sync,int reset);

    Get the current value of the pulse type, optionally waiting for the
    end of the current pulse (may wait indefinitely) and optionally resetting
    the value of the pulse timer after it is read.  The value returned is
    the number of nano-seconds (rounded to the previous clock period) 
    the pulse timer measured for the latest pulse, or, if "acc" was set, 
    the sum of all pulse times since last reset.

int pinLevelChanged(xdio *x,int pin);

    Returns true if the specified pin has changed state since the last time 
    this function was called for the given pin, and false otherwise.

void generatePulse(xdio *x,long long forNs);

    Generate a single pulse on pin 4.  The current state of the pin will
    be inverted for the specified number of nano-seconds, rounded to the
    clock period, after which the pin's state will be returned to its
    original value.

int startPWM(xdio *x,int freq,int microDutyCycle);

    Generates a square wave on pin 4 with the given frequency in Hz (rounded
    to the nearest frequency attainable with the current clock speed) and
    duty cycle expression as 10,000ths of a percent.  This pulse-wave
    modulation occurs continuously until stopped.

    This function will return true on success, or false if an invalid
    parameter value was passed, such as a frequency outside of the
    range of the current clock speed, or no duty cycle.

void pausePWM(xdio *x);

    Stop generating PWM output on pin 4.  The characteristics of the
    waveform are retained.

void resumePWM(xdio *x);

    Resume generating PWM output on pin 4 using the current waveform
    characteristics.  You should not call this function until the function
    startPWM has been called.

void initCounter(xdio *x,enum COUNTER_TYPE type,enum INDEX_TYPE index);

    Configure the counter type to either EDGE_COUNTER (counts edges on pin 7)
    or QUADRATURE (counts up/down based on pin 6/7 quadrature input).  The
    index types are either NO_RESET (do not reset the counter implicitly)
    or NEGEDGE_RESET or POSEDGE_RESET (reset the counter on the respective
    edge on pin 5).


int getQCTR(xdio *x);

    Returns the current count of the edge/quadrature counter.

void setQCTR(xdio *x,int v);

     Sets the edge/quadrature counter to the specified value.
