Exemplo n.º 1
0
def getMacAddr() :
    a = events.Event()
    a.cmd = 0x43
    a.src = JTAGADDR
    a.setAddr(NETCONTROLADDR)
    a.data[0] = 0x03
    events.sendEvent(a)

    e = events.readEvent()
    nonecnt = 0
    while e == None:
        #events.sendEvent(a)
        e = events.readEvent()
        nonecnt += 1
    ma = [0, 0, 0, 0, 0, 0]

    lastEvt = None
    while e != None:
        lastEvt = e
        #events.sendEvent(a)
        e = events.readEvent()
        nonecnt += 1

    print e
    ma[5] = lastEvt.data[1] >> 8
    ma[4] = lastEvt.data[1] & 0xFF
    ma[3] = lastEvt.data[2] >> 8
    ma[2] = lastEvt.data[2] & 0xFF
    ma[1] = lastEvt.data[3] >> 8
    ma[0] = lastEvt.data[3] & 0xFF
    
    return ma
Exemplo n.º 2
0
def commitData():
    """
    Commits the current data buffer
    """

    a = events.Event()
    a.cmd = 103
    a.src = JTAGADDR
    a.setAddr(SYSCONTROLADDR)
    events.sendEvent(a)
Exemplo n.º 3
0
def setMacAddr(addr):
    """
    Sets the mac address
    The address should be a list of bytes
    """
    
    a = events.Event()
    a.cmd = 0x42
    a.src = JTAGADDR
    a.setAddr(NETCONTROLADDR)
    a.data[0] = 0x03
    a.data[1] = addr[5] << 8 | addr[4]
    a.data[2] = addr[3] << 8 | addr[2]
    a.data[3] = addr[1] << 8 | addr[0]
    print a
    events.sendEvent(a)
Exemplo n.º 4
0
def sendDataWords(data):
    """
    Sends  4 16-bit data words to be placed in the TX
    buffer

    data[0] becomes event[0]
        
    """
    
    a = events.Event()
    a.cmd = 101
    a.src = JTAGADDR
    a.setAddr(SYSCONTROLADDR)
    for i, d in enumerate(data):
        a.data[i] = d
    events.sendEvent(a)
Exemplo n.º 5
0
def readreg(val):

    a = events.Event()
    a.cmd = 0x30
    a.src = 0x07
    a.setAddr(0x4)
    a.data[0] = 0x00
    a.data[1] = val
    a.data[2] = 0x00
    a.data[3] = 0x00

    events.sendEvent(a)
    e = None
    while e == None:
        e = events.readEvent()
        if e == None:
            events.sendEvent(a)
    return e
Exemplo n.º 6
0
def setIP(addrstr, bcast = False):
    ipaddr = addrstr.split(".")

    ip0 = int(ipaddr[0])
    ip1 = int(ipaddr[1])
    ip2 = int(ipaddr[2])
    ip3 = int(ipaddr[3])
    
    a = events.Event()
    a.cmd = 0x42
    a.src = JTAGADDR
    a.setAddr(NETCONTROLADDR)
    if bcast:
        a.data[0] = 0x02
    else:
        a.data[0] = 0x01
    a.data[1] = ip0 << 8 | ip1
    a.data[2] = ip2 << 8 | ip3
    events.sendEvent(a)
Exemplo n.º 7
0
def toggleProg():
    """
    Toggle EPROG
    """

    maskevtlow = events.Event()
    maskevtlow.cmd = 100
    maskevtlow.src = JTAGADDR
    maskevtlow.setAddr(SYSCONTROLADDR)
    maskevtlow.data[0] = 0xFFFF
    maskevtlow.data[1] = 0xFFFF
    events.sendEvent(maskevtlow)
    
    a = events.Event()
    a.cmd = 102
    a.src = JTAGADDR
    a.setAddr(SYSCONTROLADDR)
    a.data[0] = 0xFF

    events.sendEvent(a)
Exemplo n.º 8
0
import events
m = events.Mask()
m.setAddr(3)
events.setMask(m)

# Dummy read of 0x01234567
a = events.Event()
a.cmd = 0x20
a.src = 0x01
a.setAddr(0x2)
a.data[0] = 0xFFFF
a.data[1] = 0xFFFF
a.data[2] = 0x0110
a.data[3] = 0x0800

events.sendEvent(a)
Exemplo n.º 9
0
 def sendEvent(self, event_name, event):
     result1 = sendEvent(self._getMessage(event_name), event)
     result2 = sendEvent('%s.%d' % (event_name, id(self)), event)
     return [result1, result2]
Exemplo n.º 10
0
 def sendEvent( self, event_name, event ):
     result1 = sendEvent( self._getMessage( event_name ), event )
     result2 = sendEvent( '%s.%d' % ( event_name, id(self) ), event )
     return [result1, result2]