RTXI 1.3
mmap Namespace Reference

Functions

def dump_cmd
def prepare_cmd

Variables

tuple dev = c.comedi_open('/dev/comedi0')
tuple fd = c.comedi_fileno(dev)
int freq = 1000
int subdevice = 0
int nscans = 8000
int secs = 10
list chans = [0,1,2,3]
list gains = [0,0,0,0]
list aref = [c.AREF_GROUND, c.AREF_GROUND, c.AREF_GROUND, c.AREF_GROUND]
list cmdtest_messages
tuple nchans = len(chans)
tuple mylist = c.chanlist(nchans)
tuple size = c.comedi_get_buffer_size(dev, subdevice)
tuple map = mmap.mmap(fd, size, mmap.MAP_SHARED, mmap.PROT_READ)
tuple cmd = c.comedi_cmd_struct()
 ret = c.comedi_get_buffer_size(dev, subdevice) if ret==-1: raise "Error fetching comedi buffer size" else: print "buffer size = ", ret ret = c.comedi_get_max_buffer_size(dev, subdevice) if ret==-1: raise "Error fetching comedi max buff size" else: print "max buff size = ", ret construct a comedi command
tuple ret = c.comedi_command_test(dev,cmd)
 nbytes = front - back chunk_limit = (nbytes / size) * size # count for "size" sized chunks remainder = nbytessize # bytes left after chunk_limit chunks done for i in range(0,chunk_limit,size): DATA.fromstring(map.read(size)) # read chunks for i in range(0,remainder,2): DATA.fromstring(map.read(2)) # read remaining bytes
int front = 0
int back = 0
tuple of = open("stream_log.bin","wb")
string format = "H"
int flag = 1
 print "front = ", front
int time_limit = 2
tuple t0 = time.time()
tuple t1 = time.time()
tuple DATA = array.array("H")

Function Documentation

def mmap::dump_cmd (   cmd)

Definition at line 69 of file mmap.py.

def mmap::prepare_cmd (   dev,
  subdev,
  C 
)

Definition at line 85 of file mmap.py.


Variable Documentation

list mmap::aref = [c.AREF_GROUND, c.AREF_GROUND, c.AREF_GROUND, c.AREF_GROUND]

Definition at line 44 of file mmap.py.

Definition at line 150 of file mmap.py.

list mmap::chans = [0,1,2,3]

Definition at line 42 of file mmap.py.

tuple mmap::cmd = c.comedi_cmd_struct()

ret = c.comedi_get_buffer_size(dev, subdevice) if ret==-1: raise "Error fetching comedi buffer size" else: print "buffer size = ", ret ret = c.comedi_get_max_buffer_size(dev, subdevice) if ret==-1: raise "Error fetching comedi max buff size" else: print "max buff size = ", ret construct a comedi command

Definition at line 116 of file mmap.py.

Initial value:
00001 [
00002         "success",
00003         "invalid source",
00004         "source conflict",
00005         "invalid argument",
00006         "argument conflict",
00007         "invalid chanlist"]

Definition at line 46 of file mmap.py.

tuple mmap::DATA = array.array("H")

Definition at line 174 of file mmap.py.

tuple mmap::dev = c.comedi_open('/dev/comedi0')

Definition at line 27 of file mmap.py.

tuple mmap::fd = c.comedi_fileno(dev)

Definition at line 31 of file mmap.py.

int mmap::flag = 1

print "front = ", front

Definition at line 156 of file mmap.py.

Definition at line 154 of file mmap.py.

int mmap::freq = 1000

Definition at line 35 of file mmap.py.

int mmap::front = 0

Definition at line 149 of file mmap.py.

list mmap::gains = [0,0,0,0]

Definition at line 43 of file mmap.py.

tuple mmap::map = mmap.mmap(fd, size, mmap.MAP_SHARED, mmap.PROT_READ)

Definition at line 66 of file mmap.py.

Definition at line 57 of file mmap.py.

tuple mmap::nchans = len(chans)

Definition at line 54 of file mmap.py.

int mmap::nscans = 8000

Definition at line 37 of file mmap.py.

tuple mmap::of = open("stream_log.bin","wb")

Definition at line 152 of file mmap.py.

tuple mmap::ret = c.comedi_command_test(dev,cmd)

nbytes = front - back chunk_limit = (nbytes / size) * size # count for "size" sized chunks remainder = nbytessize # bytes left after chunk_limit chunks done for i in range(0,chunk_limit,size): DATA.fromstring(map.read(size)) # read chunks for i in range(0,remainder,2): DATA.fromstring(map.read(2)) # read remaining bytes

time.sleep(.01)

Definition at line 130 of file mmap.py.

int mmap::secs = 10

Definition at line 38 of file mmap.py.

tuple mmap::size = c.comedi_get_buffer_size(dev, subdevice)

Definition at line 64 of file mmap.py.

int mmap::subdevice = 0

Definition at line 36 of file mmap.py.

tuple mmap::t0 = time.time()

Definition at line 159 of file mmap.py.

tuple mmap::t1 = time.time()

Definition at line 166 of file mmap.py.

Definition at line 158 of file mmap.py.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines