15 from __future__
import print_function
16 from libpruio
import *
41 def load_firmware(IRam):
42 PRUcode = (c_uint32*8)(
53 raise AssertionError(
"failed loading instructions")
57 io =
pruio_new(PRUIO_DEF_ACTIVE, 4, 0x98, 0)
61 if IO.Errr:
raise AssertionError(
"pruio_new failed (%s)" % IO.Errr)
69 pru_iram = PRUSS0_PRU0_IRAM
71 pru_dram = PRUSS0_PRU0_DRAM
73 pru_intr = PRU0_ARM_INTERRUPT
76 pru_iram = PRUSS0_PRU1_IRAM
77 pru_dram = PRUSS0_PRU1_DRAM
78 pru_intr = PRU0_ARM_INTERRUPT
83 raise AssertionError(
"prussdrv_open failed (%s)" % IO.Errr)
86 load_firmware(pru_iram)
91 dram = pointer(c_uint32(0))
96 dram[4] = pru_intr + 16
100 print(
"instructions loaded, starting PRU-%d" % pru_num)
107 if(dram[0] == (dram[1] + (dram[2] * dram[3]))):
108 print(
"Test OK %d == %d + (%d * %d)\n" % (dram[0], dram[1], dram[2], dram[3]))
110 print(
"Test failed: %d != %d + (%d * %d)\n" % (dram[0], dram[1], dram[2], dram[3]))
pruIo * pruio_new(uint16 Act, uint8 Av, uint32 OpD, uint8 SaD)
Wrapper function for the constructor PruIo::PruIo().
void pruio_destroy(pruIo *Io)
Wrapper function for the destructor PruIo::~PruIo().
int32 prussdrv_pru_disable(uint32 prunum)
See prussdrv_pru_disable(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)