def __init__(this, mbus, writeback=False, log_level=logging.WARN): assert (isinstance(mbus, MBusInterface)) this.mbus = mbus this.writeback = writeback this.local = {} this.log = m3_logging.getLogger(type(this).__name__) this.log.setLevel(log_level)
def __init__(this, mbus, base_addr, writeback=False, \ log_level = logging.WARN): ''' note: base_addr will need to be updated every time ''' super(RegFile, this).__init__(mbus) this.base_addr = base_addr this.log = m3_logging.getLogger(type(this).__name__) this.log.setLevel(log_level) # specific ordering matching on-board gdb code this.names = [ 'isr_lr', 'sp', 'r8', 'r9', 'r10', 'r11', 'r4', 'r5', 'r6', 'r7', 'r0', 'r1', 'r2', 'r3', 'r12', 'lr', 'pc', 'xpsr', ] this.trans_names = {'r13': 'sp', 'r14': 'lr', 'r15': 'pc'} # The M0 does not include floating-point registers this.warn_names = [ 'f0', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'fps', ] this.warn_trans_names = {'cpsr': 'xpsr'} this.offsets = dict(zip(this.names, range(0, 4 * len(this.names), 4))) this.writeback = writeback this.local = {}
def __init__(this, _ice, prc_addr, log_level=logging.WARN): this.ice = _ice this.ice_addr = 0xe if (prc_addr > 0x0 and prc_addr < 0xf): this.prc_addr = prc_addr elif (prc_addr >= 0xf0000 and prc_addr < 0xfffff): raise MBusInterfaceException("Only short prefixes supported") else: raise MBusInterfaceException("Bad MBUS Addr") this.log = m3_logging.getLogger(type(this).__name__) this.log.setLevel(log_level) this.log.info("MBUS Re-configuring ICE MBus to listen for "+\ "Debug Packets") this.ice.mbus_set_internal_reset(True) this.ice.mbus_set_snoop(False) this.ice.mbus_set_short_prefix(hex(this.ice_addr)) this.ice.mbus_set_internal_reset(False) #register the callback this.callback_queue = Queue.Queue() this.ice.msg_handler['b++'] = this._callback
import threading import multiprocessing import struct # if Py2K: import imp try: from __init__ import __version__ import m3_logging except: from . import __version__ from . import m3_logging logger = m3_logging.getLogger(__name__) class MBusInterface(object): class UnalignedException(Exception): pass class MBusInterfaceException(Exception): pass ''' A class to wrap MBus into simple read/write commands ''' # def __init__(this, _ice, prc_addr, log_level=logging.WARN):