from ctypes import *
wl = cdll.wlcomp
hDll = pointer(c_ulong(wl.LoadAPIDLL('lcomp.dll')))
hErr = pointer(c_ulong())
print 'hDll', hDll
hIfc = pointer(c_ulong(wl.CallCreateInstance(hDll, 0, hErr)))
print 'hIfc', hIfc
print 'hErr', hErr
print wl.OpenLDevice(hIfc)
print 'Load Bios', wl.LoadBios(hIfc, 'L761')
print 'Plata Test', wl.PlataTest(hIfc)
class SlotParams(Structure):
_fields_ = [('Base', c_ulong),
('BaseL', c_ulong),
('Base1', c_ulong),
('BaseL1', c_ulong),
('Mem', c_ulong),
('MemL', c_ulong),
('Mem1', c_ulong),
('MemL1', c_ulong),
('Irq', c_ulong),
('BoardType', c_ulong),
('DSPType', c_ulong),
('Dma', c_ulong),
('DmaDac', c_ulong),
('DTA_REG', c_ulong),
('IDMA_REG', c_ulong),
('CMD_REG', c_ulong),
('IRQ_RST', c_ulong),
('DTA_ARRAY', c_ulong),
('RDY_REG', c_ulong),
('CFG_REG', c_ulong)]
"""
sl = pointer(SlotParams())
wl.GetSlotParam(hIfc, sl)
for field in sl.contents._fields_:
value = getattr(sl.contents, field[0])
print field[0], hex(int(value))
"""
print 'InitStartDevice', wl.InitStartLDevice(hIfc)
print 'StartDevice', wl.StartLDevice(hIfc)
L_ASYNC_ADC_INP = 6
class AsyncParam(Structure):
_fields_ = [
('s_Type', c_ulong),
('FIFO', c_ulong),
('IrgStep', c_ulong),
('Pages', c_ulong),
('dRate', c_double),
('Rate', c_ulong),
('NCh', c_ulong),
('Chn', c_ulong * 128),
('Data', c_ulong * 128),
('Mode', c_ulong)]
for i in range(0, 10):
pp = pointer(AsyncParam())
pp.contents.s_Type = L_ASYNC_ADC_INP
pp.contents.Chn[0] = 1
print wl.IoAsync(hIfc, pp), pp.contents.Data[0]