19 #include "libpruio/pruio.h"
20 #include "libpruio/pruio_pins.h"
21 #include "libpruio/pruio_prussdrv.h"
73 {printf(
"failed loading instructions\n");
return -1;}
79 int main(
int argc,
char **argv)
90 printf(
"initialisation failed (%s)\n",
io->Errr);
break;}
106 printf(
"prussdrv_open failed\n");
break;}
127 printf(
"P8_11 configuration failed (%s)\n",
io->Errr);
break;}
134 printf(
"failed setting input P9_42 (%s)\n",
io->Errr);
break;}
136 printf(
"config failed (%s)\n",
io->Errr);
break;}
151 printf(
"instructions loaded, starting PRU-%d\n",
pru_num);
153 for (
i = 0;
i < 20;
i++)
159 printf(
"failed reading input P9_42 (%s)\n",
io->Errr);
break;}
161 printf(
"--> Frequency: %3.0f MHz, Duty:%3.0f %c \n",
162 (
f * .000001), (
d * 100),
'%');
VAR io
create new driver UDT
unsigned short uint16
16 bit unsigned integer data type.
unsigned int uint32
32 bit unsigned integer data type.
char * pruio_config(pruIo *Io, uint32 Samp, uint32 Mask, uint32 Tmr, uint16 Mds)
Wrapper function for PruIo::config().
char * pruio_cap_Value(pruIo *Io, uint8 Ball, float_t *Hz, float_t *Du)
Wrapper function for CapMod::Value().
float float_t
float data type.
int int32
32 bit signed integer data type.
pruIo * pruio_new(uint16 Act, uint8 Av, uint32 OpD, uint8 SaD)
Wrapper function for the constructor PruIo::PruIo().
char * pruio_cap_config(pruIo *Io, uint8 Ball, float_t FLow)
Wrapper function for CapMod::config().
void pruio_destroy(pruIo *Io)
Wrapper function for the destructor PruIo::~PruIo().
@ PRUIO_ACT_PWM0
Activate PWMSS-0 (including eCAP, eQEP, ePWM).
@ PRUIO_ACT_PRU1
Activate PRU-1 (= default, instead of PRU-0).
#define PRUSS0_PRU0_IRAM
ID for PRU-0 instruction ram.
#define PRUSS0_PRU1_DRAM
ID for PRU-1 data ram.
#define PRU_EVTOUT_0
ID for host interrupt 0.
#define PRU0_ARM_INTERRUPT
System event PRU-0 -> ARM.
#define PRUSS0_PRU1_IRAM
ID for PRU-1 instruction ram.
#define PRUSS0_PRU0_DRAM
ID for PRU-0 data ram.
#define P9_42
CPU ball number for double pin 42 on header 9 (second ball is 104)
#define P8_11
CPU ball number for pin 11 on header 8.
int32 prussdrv_pru_disable(uint32 prunum)
See prussdrv_pru_disable(BYVAL_AS_UInt32 PruId)
char * prussdrv_pru_resume(uint32 prunum)
See prussdrv_pru_resume(BYVAL_AS_UInt32 PruId)
#define prussdrv_pru_enable(N)
Macro for variadic parameter list.
void prussdrv_pru_clear_event(uint32 host_interrupt, uint32 sysevent)
See prussdrv_pru_clear_event(BYVAL_AS_UInt32 Irq, BYVAL_AS_UInt32 Event)
uint32 prussdrv_pru_wait_event(uint32 host_interrupt)
See prussdrv_pru_wait_event(BYVAL_AS_UInt32 Irq)
int32 prussdrv_open(uint32 host_interrupt)
See prussdrv_open(BYVAL_AS_UInt32 Irq)
int32 prussdrv_pru_write_memory(uint32 pru_ram_id, uint32 wordoffset, const uint32 *memarea, uint32 bytelength)
See prussdrv_pru_write_memory(BYVAL_AS_UInt32 RamId, BYVAL_AS_UInt32 Offs, BYVAL_AS_CONST_UInt32_PTR ...
int32 prussdrv_map_prumem(uint32 pru_ram_id, void **address)
See prussdrv_map_prumem(BYVAL_AS_UInt32 RamId, BYVAL_AS_ANY_PTR_PTR Addr)
UInt32 pru_intr
ID of its interrupt.
UInt32_PTR dram
a pointer to PRU data ram
UInt32 pru_num
which pru to use
UInt32 pru_iram
ID of its instruction ram.
UInt32 pru_dram
ID of its data ram.
float_t f
the measured frequency
float_t d
the measured duty cycle
int main(int argc, char **argv)
The main function.
int32 load_firmware(uint32 IRam)
load firmware to PRU
Wrapper structure for PruIo.