def __init__(self, devname='/dev/evs/r13'): self._device = mevr.new(devname) self._device.Enable(True) me = (-1 << mevr.IRQ_MASTER_ENABLE) hb = (1 << mevr.IRQFLAG_HEARTBEAT) self._device.IrqEnable(me | hb) signal.signal(signal.SIGIO, self.handler) self._device.IrqAssignHandler()
def main(): # 0xc908146 #Can be used both for testing "normal" pci API and new UDP API #Just comment/uncomment the necessary lines below #evr = mevr_udp.new('evr300lab01', 2000) evr = mevr.new('/dev/evrtga3') #example_a(evr) #example_b(evr) example_c(evr) #evr.map.Pulse[0].Width = 1 #evr.SetFineDelay(0, 0) #evr.Enable(True) #print evr.map._parent._real.read_register(evr.map._parent._base + 0x200) return evr
# (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import mevg, mevr if False: r13 = mevr.new('/dev/evs/r13') r14 = mevr.new('/dev/evs/r14') g10 = mevg.new('/dev/evs/g10') g12 = mevg.new('/dev/evs/g12') def rdMapItem(dev, event): r = dev.GetVal(0x4000 + 16*event) print bin(r) return r def wtMapItem(dev, event, val): dev.SetVal(0x4000 + 16*event, val) def buscaSub(ob, txt):
def __init__(self, url = '/dev/evs/r13'): self.ev = mevr.new(url) self._url = url
import mevr import signal import time import os import fcntl p = 0 er = mevr.new('/dev/evs/r13') def handler(a, b): global p, er print '**** que passa neng\n' p = p + 1 er.SetVal(0x8, 0xff) er.IrqHandled() signal.signal(signal.SIGIO, handler) er = mevr.new('/dev/evs/r13') #er = mevr.new('/tmp/mentida.bin') # er.SetVal(0xc,0xff) er.Enable(True) me = (-1 << mevr.IRQ_MASTER_ENABLE) hb = (1 << mevr.IRQFLAG_HEARTBEAT) print int(me | hb) er.IrqEnable(me | hb)