libpruio  0.2
Input/Output driver for digital/analog lines on Beagleboard hardware
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
pruio.h File Reference

The main header code of the C wrapper for libpruio. More...

#include "pruio.hp"
#include "prussdrv.h"
#include "pruss_intc_mapping.h"
Include dependency graph for pruio.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  adcSteps
 Wrapper structure for AdcSteps. More...
 
struct  adcSet
 Wrapper structure for AdcSet. More...
 
struct  adcUdt
 Wrapper structure for AdcUdt. More...
 
struct  gpioSet
 Wrapper structure for GpioSet. More...
 
struct  gpioArr
 Wrapper structure for GpioArr. More...
 
struct  gpioUdt
 Wrapper structure for GpioUdt. More...
 
struct  pwmssSet
 Wrapper structure for PwmssSet. More...
 
struct  pwmssArr
 Wrapper structure for PwmssArr. More...
 
struct  pwmssUdt
 Wrapper structure for PwmssUdt. More...
 
struct  ballSet
 Wrapper structure for BallSet. More...
 
struct  pruIo
 Wrapper structure for PruIo. More...
 

Macros

#define PRUIO_VERSION   "0.2"
 version string
 
#define AM33XX
 tell pruss_intc_mapping.bi that we use ARM33xx
 
#define PRUIO_DEF_AVRAGE   4
 the default setting for avaraging
 
#define PRUIO_DEF_ODELAY   183
 the default value for open delay in channel settings
 
#define PRUIO_DEF_SDELAY   0
 the default value for sample delay in channel settings
 
#define PRUIO_DEF_SAMPLS   1
 the default number of samples to use (configures single mode)
 
#define PRUIO_DEF_STPMSK   510
 the default step mask (steps 1 to 8 for AIN0 to AIN7, no charge step)
 
#define PRUIO_DEF_TIMERV   0
 the default timer value (sampling rate)
 
#define PRUIO_DEF_LSLMOD   4
 the default bit mode (4 = 16 bit encoding)
 
#define PRUIO_DEF_CLKDIV   0
 the default clock divisor (0 = full speed AFE = 2.4 MHz)
 

Typedefs

typedef signed char int8
 8 bit signed integer data type
 
typedef short int16
 16 bit signed integer data type
 
typedef int int32
 32 bit signed integer data type
 
typedef unsigned char uint8
 8 bit unsigned integer data type
 
typedef unsigned short uint16
 16 bit unsigned integer data type
 
typedef unsigned int uint32
 32 bit unsigned integer data type
 
typedef float float_t
 float data type
 
typedef struct pruIo pruIo
 forward declaration More...
 
typedef struct adcSet adcSet
 Wrapper structure for AdcSet. More...
 
typedef struct adcUdt adcUdt
 Wrapper structure for AdcUdt. More...
 
typedef struct gpioSet gpioSet
 Wrapper structure for GpioSet. More...
 
typedef struct gpioArr gpioArr
 Wrapper structure for GpioArr. More...
 
typedef struct gpioUdt gpioUdt
 Wrapper structure for GpioUdt. More...
 
typedef struct pwmssSet pwmssSet
 Wrapper structure for PwmssSet. More...
 
typedef struct pwmssArr pwmssArr
 Wrapper structure for PwmssArr. More...
 
typedef struct pwmssUdt pwmssUdt
 Wrapper structure for PwmssUdt. More...
 
typedef struct pwmMod pwmMod
 Wrapper structure for PwmMod. More...
 
typedef struct capMod capMod
 Wrapper structure for CapMod. More...
 
typedef struct qepMod qepMod
 Wrapper structure for QepMod. More...
 
typedef struct ballSet ballSet
 Wrapper structure for BallSet. More...
 

Enumerations

enum  activateDevice {
  PRUIO_ACT_PRU1 = 1, PRUIO_ACT_ADC = 1 << 1, PRUIO_ACT_GPIO0 = 1 << 2, PRUIO_ACT_GPIO1 = 1 << 3,
  PRUIO_ACT_GPIO2 = 1 << 4, PRUIO_ACT_GPIO3 = 1 << 5, PRUIO_ACT_PWM0 = 1 << 6, PRUIO_ACT_PWM1 = 1 << 7,
  PRUIO_ACT_PWM2 = 1 << 8, PRUIO_DEF_ACTIVE = 0xFFFF
}
 the PRUSS driver library More...
 

Functions

pruIopruio_new (uint16 Act, uint8 Av, uint32 OpD, uint8 SaD)
 Wrapper function for the constructor PruIo::PruIo(). More...
 
void pruio_destroy (pruIo *Io)
 Wrapper function for the destructor PruIo::~PruIo. More...
 
char * pruio_config (pruIo *Io, uint32 Samp, uint32 Mask, uint32 Tmr, uint16 Mds)
 Wrapper function for PruIo::config(). More...
 
char * pruio_Pin (pruIo *Io, uint8 Ball)
 Wrapper function for PruIo::get_config(). More...
 
char * pruio_mm_start (pruIo *Io, uint32 Trg1, uint32 Trg2, uint32 Trg3, uint32 Trg4)
 Wrapper function for PruIo::mm_start(). More...
 
char * pruio_rb_start (pruIo *Io)
 Wrapper function for PruIo::rb_start(). More...
 
char * pruio_gpio_setValue (pruIo *Io, uint8 Ball, uint8 Modus)
 Wrapper function for GpioUdt::config(). More...
 
uint32 pruio_gpio_Value (pruIo *Io, uint8 Ball)
 Wrapper function for GpioUdt::Value(). More...
 
char * pruio_adc_setStep (pruIo *Io, uint8 Stp, uint8 ChN, uint8 Av, uint8 SaD, uint32 OpD)
 Wrapper function for AdcUdt::setStep(). More...
 
uint32 pruio_adc_mm_trg_pin (pruIo *Io, uint8 Ball, uint8 GpioV, uint16 Skip)
 Wrapper function for AdcUdt::mm_trg_pin(). More...
 
uint32 pruio_adc_mm_trg_ain (pruIo *Io, uint8 Stp, int32 AdcV, uint8 Rela, uint16 Skip)
 Wrapper function for AdcUdt::mm_trg_ain(). More...
 
uint32 pruio_adc_mm_trg_pre (pruIo *Io, uint8 Stp, int32 AdcV, uint16 Samp, uint8 Rela)
 Wrapper function for AdcUdt::mm_trg_pre(). More...
 
char * pruio_cap_config (pruIo *Io, uint8 Ball, float_t FLow)
 Wrapper function for CapMod::config(). More...
 
char * pruio_cap_Value (pruIo *Io, uint8 Ball, float_t *Hz, float_t *Du)
 Wrapper function for CapMod::Value(). More...
 
char * pruio_pwm_Value (pruIo *Io, uint8 Ball, float_t *Hz, float_t *Du)
 Wrapper function for PwmMod::Value(). More...
 
char * pruio_pwm_setValue (pruIo *Io, uint8 Ball, float_t Hz, float_t Du)
 Wrapper function for PwmMod::setValue(). More...
 

Detailed Description

The main header code of the C wrapper for libpruio.

This file provides the declarations of macros, types and classes in C syntax. Include this file in your code to make use of libpruio. This file contains a translation of the context of all FreeBASIC headers (pruio.bi, pruio.hp, pruio_adc.bi, pruio_gpio.bi and pruio_pwm.bi) in one file.

Feel free to translate this file in order to create language bindings for non-C languages and use libpruio in polyglot applications. Check also file pruio_pins.h for a convenient way to declare header pins.

Note
The header pruio_pins.h is not shown in this documentation because it confuses Doxygen. It mixes up references with the original header pruio/pruio_pins.bi.

Licence: LGPLv2 (http://www.gnu.org/licenses/lgpl-2.0.html)

Copyright 2014 by Thomas{ dOt ]Freiherr[ aT ]gmx[DoT}net

Definition in file pruio.h.

Typedef Documentation

typedef struct adcSet adcSet

Wrapper structure for AdcSet.

Since
0.2
typedef struct adcUdt adcUdt

Wrapper structure for AdcUdt.

Since
0.2
typedef struct ballSet ballSet

Wrapper structure for BallSet.

Since
0.2
typedef struct capMod capMod

Wrapper structure for CapMod.

Since
0.2

Definition at line 357 of file pruio.h.

typedef struct gpioArr gpioArr

Wrapper structure for GpioArr.

Since
0.2
typedef struct gpioSet gpioSet

Wrapper structure for GpioSet.

Since
0.2
typedef struct gpioUdt gpioUdt

Wrapper structure for GpioUdt.

Since
0.2
typedef struct pruIo pruIo

forward declaration

Wrapper structure for PruIo.

Since
0.0

Definition at line 46 of file pruio.h.

typedef struct pwmMod pwmMod

Wrapper structure for PwmMod.

Since
0.2

Definition at line 351 of file pruio.h.

typedef struct pwmssArr pwmssArr

Wrapper structure for PwmssArr.

Since
0.2
typedef struct pwmssSet pwmssSet

Wrapper structure for PwmssSet.

Since
0.2
typedef struct pwmssUdt pwmssUdt

Wrapper structure for PwmssUdt.

Since
0.2
typedef struct qepMod qepMod

Wrapper structure for QepMod.

Since
0.2

Definition at line 363 of file pruio.h.

Enumeration Type Documentation

the PRUSS driver library

PRUSS driver interrupt settings Wrapper enumerators for ActivateDevice.

Since
0.2
Enumerator
PRUIO_ACT_PRU1 

activate PRU-1 (= default, instead of PRU-0)

PRUIO_ACT_ADC 

activate ADC

PRUIO_ACT_GPIO0 

activate GPIO-0

PRUIO_ACT_GPIO1 

activate GPIO-1

PRUIO_ACT_GPIO2 

activate GPIO-2

PRUIO_ACT_GPIO3 

activate GPIO-3

PRUIO_ACT_PWM0 

activate PWMSS-0 (including eCAP, eQEP, ePWM)

PRUIO_ACT_PWM1 

activate PWMSS-1 (including eCAP, eQEP, ePWM)

PRUIO_ACT_PWM2 

activate PWMSS-2 (including eCAP, eQEP, ePWM)

PRUIO_DEF_ACTIVE 

activate all devices

Definition at line 375 of file pruio.h.

Function Documentation

uint32 pruio_adc_mm_trg_ain ( pruIo Io,
uint8  Stp,
int32  AdcV,
uint8  Rela,
uint16  Skip 
)

Wrapper function for AdcUdt::mm_trg_ain().

Parameters
IoThe pointer of the PruIo instance
Stpthe step number to use for trigger input
AdcVthe sample value to match (positive check greater than, negative check less than)
Relaif AdcV is relative to the current input
Skipthe number of samples to skip (defaults to 0 = zero, max. 1023)
Returns
the trigger configuration (or zero in case of an error, check PruIo::Errr)
Since
0.2
uint32 pruio_adc_mm_trg_pin ( pruIo Io,
uint8  Ball,
uint8  GpioV,
uint16  Skip 
)

Wrapper function for AdcUdt::mm_trg_pin().

Parameters
IoThe pointer of the PruIo instance
Ballthe CPU ball number to test
GpioVthe state to check (defaults to high = 1)
Skipthe number of samples to skip (defaults to 0 = zero, max. 1023)
Returns
the trigger configuration (or zero in case of an error, check PruIo::Errr)
Since
0.2
uint32 pruio_adc_mm_trg_pre ( pruIo Io,
uint8  Stp,
int32  AdcV,
uint16  Samp,
uint8  Rela 
)

Wrapper function for AdcUdt::mm_trg_pre().

Parameters
IoThe pointer of the PruIo instance
Stpthe step number to use for trigger input
AdcVthe sample value to match (positive check greater than, negative check less than)
Sampthe number of samples for the pre-trigger
Relaif AdcV is relative to the current input
Returns
the trigger configuration (or zero in case of an error, check PruIo::Errr)
Since
0.2
char* pruio_adc_setStep ( pruIo Io,
uint8  Stp,
uint8  ChN,
uint8  Av,
uint8  SaD,
uint32  OpD 
)

Wrapper function for AdcUdt::setStep().

Parameters
IoThe pointer of the PruIo instance
Stpstep index (0 = step 0 => charge step, 1 = step 1 (=> AIN0 by default), ..., 17 = idle step)
ChNchannel number to scan (0 = AIN0, 1 = AIN1, ...)
Avnew value for avaraging (defaults to 4)
SaDnew value for sample delay (defaults to 0)
OpDnew value for open delay (defaults to 0x98)
Returns
zero on success (otherwise a string with an error message)
Since
0.2
char* pruio_cap_config ( pruIo Io,
uint8  Ball,
float_t  FLow 
)

Wrapper function for CapMod::config().

Parameters
IoThe pointer of the PruIo instance
BallThe CPU ball number to configure
FLowMinimal frequency to measure (> .0232831)
Returns
zero on success (otherwise a string with an error message)
Since
0.2

Here is the caller graph for this function:

char* pruio_cap_Value ( pruIo Io,
uint8  Ball,
float_t Hz,
float_t Du 
)

Wrapper function for CapMod::Value().

Parameters
IoThe pointer of the PruIo instance
Ballthe CPU ball number to test
HzA pointer to store the frequency value (or null)
DuA pointer to store the duty cycle value (or null)
Returns
zero on success (otherwise a string with an error message)
Since
0.2

Here is the caller graph for this function:

char* pruio_config ( pruIo Io,
uint32  Samp,
uint32  Mask,
uint32  Tmr,
uint16  Mds 
)

Wrapper function for PruIo::config().

Parameters
IoThe pointer of the PruIo instance
Sampnumber of samples to fetch (defaults to zero)
Maskmask for active steps (defaults to all 8 channels active in steps 1 to 8)
Tmrtimer value in [ns] to specify the sampling rate (defaults to zero, MM only)
Mdsmodus for output (defaults to 4 = 16 bit)
Returns
zero on success (otherwise a string with an error message)
Since
0.2

Here is the caller graph for this function:

void pruio_destroy ( pruIo Io)

Wrapper function for the destructor PruIo::~PruIo.

Parameters
IoThe pointer of the instance.
Since
0.0

Here is the caller graph for this function:

char * pruio_gpio_setValue ( pruIo Io,
uint8  Ball,
uint8  Modus 
)

Wrapper function for GpioUdt::config().

Wrapper function for GpioUdt::setValue().

Parameters
IoThe pointer of the PruIo instance
Ballthe CPU ball number to set
Modusthe mode for the GPIO
Returns
zero on success (otherwise a pointer to an error message)
Since
0.2
Parameters
IoThe pointer of the PruIo instance
Ballthe CPU ball number to set
Modusthe mode for the GPIO
Returns
zero on success (otherwise a pointer to an error message)
Since
0.2
0.2

Here is the caller graph for this function:

uint32 pruio_gpio_Value ( pruIo Io,
uint8  Ball 
)

Wrapper function for GpioUdt::Value().

Parameters
IoThe pointer of the PruIo instance
Ballthe CPU ball number to test
Returns
GPIO state (otherwise -1, check PruIo::Errr for an error message)
Since
0.2

Here is the caller graph for this function:

char* pruio_mm_start ( pruIo Io,
uint32  Trg1,
uint32  Trg2,
uint32  Trg3,
uint32  Trg4 
)

Wrapper function for PruIo::mm_start().

Parameters
IoThe pointer of the PruIo instance
Trg1settings for first trigger (default = no trigger)
Trg2settings for second trigger (default = no trigger)
Trg3settings for third trigger (default = no trigger)
Trg4settings for fourth trigger (default = no trigger)
Returns
zero on success (otherwise a string with an error message)
Since
0.2
pruIo* pruio_new ( uint16  Act,
uint8  Av,
uint32  OpD,
uint8  SaD 
)

Wrapper function for the constructor PruIo::PruIo().

Parameters
Actmask for active subsystems and PRU number
Avavaraging for default steps (0 to 16, defaults to 0)
OpDopen delay for default steps (0 to 0x3FFFF, defaults to 0x98)
SaDsample delay for default steps (0 to 255, defaults to 0)
Returns
A pointer for the new instance.

Since the constructor reads the original devices configurations and the destructor restores them, it's recommended to create and use just one PruIo instance at the same time.

Since
0.0

Here is the caller graph for this function:

char* pruio_Pin ( pruIo Io,
uint8  Ball 
)

Wrapper function for PruIo::get_config().

Parameters
IoThe pointer of the PruIo instance
Ballthe CPU ball number to describe
Returns
a human-readable text string (internal string, never free it)
Since
0.2
char* pruio_pwm_setValue ( pruIo Io,
uint8  Ball,
float_t  Hz,
float_t  Du 
)

Wrapper function for PwmMod::setValue().

Parameters
IoThe pointer of the PruIo instance
Ballthe CPU ball number to set
HzThe frequency to set (or -1 for no change).
DuThe duty cycle to set (0.0 to 1.0, or -1 for no change).
Returns
zero on success (otherwise a string with an error message)
Since
0.2

Here is the caller graph for this function:

char* pruio_pwm_Value ( pruIo Io,
uint8  Ball,
float_t Hz,
float_t Du 
)

Wrapper function for PwmMod::Value().

Parameters
IoThe pointer of the PruIo instance
Ballthe CPU ball number to test
HzA pointer to store the frequency value (or null)
DuA pointer to store the duty cycle value (or null)
Returns
zero on success (otherwise a string with an error message)
Since
0.2
char* pruio_rb_start ( pruIo Io)

Wrapper function for PruIo::rb_start().

Parameters
IoThe pointer of the PruIo instance
Returns
zero on success (otherwise a string with an error message)
Since
0.2