Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python3
- from uio.utils import fix_ctypes_struct
- from uio.ti.icss import Icss
- import ctypes
- from ctypes import c_uint32 as u32, c_uint16 as u16, c_int32 as int32
- from time import sleep
- from sys import exit
- pruss = Icss( "/dev/uio/pruss/module" )
- pruss.initialize()
- ddr = pruss.ddr
- pruss.uart.initialize(baudrate = 460800)
- core_1 = pruss.core1
- core_1.load( 'fw-c/stream.out' )
- core_0 = pruss.core0
- core_0.load( 'fw/decoder.bin' )
- class Message( ctypes.Structure ):
- _fields_ = [
- ( 'id', u32 ),
- ('timestamp',u32),
- ('position', u32),
- ('force', int32),
- ]
- # used to communicate ddr layout to C program
- class DDRLayout( ctypes.Structure ):
- _fields_ = [
- ( 'msgbuf', u32 ),
- ( 'num_msgs', u16 ),
- ( 'msg_size', u16 ),
- ]
- # volatile variables in pruss shared memory
- class SharedVars( ctypes.Structure ):
- _fields_ = [
- ( 'abort_file', u32 ),
- ( 'abort_line', u32 ),
- ( 'ridx', u16 ),
- ]
- # if you don't want the ringbuffer at the start of the ddr region, specify offset here
- MSGBUF_OFFSET = 0
- # you can use a fixed ringbuffer size:
- #NUM_MSGS = 1024
- # or you can scale the ringbuffer to fit the size of the ddr region:
- NUM_MSGS = ( ddr.size - MSGBUF_OFFSET - ctypes.sizeof( u16 ) ) // ctypes.sizeof( Message )
- NUM_MSGS = min( NUM_MSGS, 65535 ) # make sure number of messages fits in u16
- # map shared memory variables
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement