Пример #1
0
 def cmd_status(self, ui, args):
     """display dac status"""
     s = []
     for (ofs, name) in cs43l22_regset:
         val = self.rd(ofs)
         s.append(['0x%02x' % ofs, ': 0x%02x' % val, name])
     ui.put('%s\n' % util.display_cols(s))
Пример #2
0
 def cmd_status(self, ui, args):
   """display dac status"""
   s = []
   for (ofs, name) in cs43l22_regset:
     val = self.rd(ofs)
     s.append(['0x%02x' % ofs, ': 0x%02x' % val, name])
   ui.put('%s\n' % util.display_cols(s))
Пример #3
0
 def cmd_status(self, ui, args):
     """display dac status"""
     s = []
     for (ofs, name) in adau1961_regset:
         n = (1, 6)[ofs == 0x4002]
         val = ' '.join(['%02x' % x for x in self.rdbuf(ofs, n)])
         s.append(['0x%04x' % ofs, name, val])
     ui.put('%s\n' % util.display_cols(s))
Пример #4
0
 def display_function_help(self, help_info):
   """display function help"""
   s = []
   for (parm, descr) in help_info:
     p_str = (parm, '')[parm is None]
     d_fmt = (': %s', '  %s')[parm is None]
     d_str = (d_fmt % descr, '')[descr is None]
     s.append(['  ', p_str, d_str])
   self.ui.put('%s\n' % util.display_cols(s, [0, 16, 0]))
Пример #5
0
 def display_function_help(self, help_info):
     """display function help"""
     s = []
     for (parm, descr) in help_info:
         if parm is None:
             s.append(['', ''])
         elif descr is None:
             s.append([parm, ''])
         else:
             s.append([parm, ': %s' % descr])
     self.ui.put('%s\n' % util.display_cols(s, [16, 0]))
Пример #6
0
Файл: cli.py Проект: deadsy/pycs
 def display_function_help(self, help_info):
   """display function help"""
   s = []
   for (parm, descr) in help_info:
     if parm is None:
       s.append(['', ''])
     elif descr is None:
       s.append([parm, ''])
     else:
       s.append([parm, ': %s' % descr])
   self.ui.put('%s\n' % util.display_cols(s, [16, 0]))
Пример #7
0
Файл: soc.py Проект: deadsy/pycs
 def cmd_map(self, ui, args):
   """display memory map"""
   clist = []
   for p in self.peripheral_list():
     start = p.address
     size = p.size
     if size is None:
       region = ': %08x' % start
     else:
       region = ': %08x %08x %s' % (start, start + size - 1, util.memsize(size))
     clist.append([p.name, region, p.description])
   ui.put('%s\n' % util.display_cols(clist, [0,0,0]))
Пример #8
0
 def cmd_map(self, ui, args):
   """display memory map"""
   clist = []
   for p in self.peripheral_list():
     start = p.address
     size = p.size
     if size is None:
       region = ': %08x' % start
     else:
       region = ': %08x %08x %s' % (start, start + size - 1, util.memsize(size))
     clist.append([p.name, region, p.description])
   ui.put('%s\n' % util.display_cols(clist, [0, 0, 0]))
Пример #9
0
 def cmd_info(self, ui, args):
   """show rtt information"""
   if self.adr is None:
     ui.put('%s\n' % _not_initialised)
     return
   # print the rtt info
   cols = []
   cols.append(['rtt address', ': 0x%08x' % self.adr])
   if len(self.t2h) > 0:
     cols.extend([['target to host', ': %s' % b] for b in self.t2h])
   if len(self.h2t) > 0:
     cols.extend([['host to target', ': %s' % b] for b in self.h2t])
   ui.put('%s\n' % util.display_cols(cols))
Пример #10
0
 def command_help(self, cmd, menu):
   """display help results for a command at a menu level"""
   s = []
   for item in menu:
     name = item[0]
     if name.startswith(cmd):
       if isinstance(item[1], tuple):
         # submenu: the next string is the help
         descr = item[2]
       else:
         # command: docstring is the help
         descr = item[1].__doc__
       s.append(['  ', name, ': %s' % descr])
   self.ui.put('%s\n' % util.display_cols(s, [0, 16, 0]))
Пример #11
0
 def display(self, register_name=None, fields=False):
     """return a display string for this peripheral"""
     if self.registers:
         clist = []
         if register_name is not None:
             # decode a single register
             r = self.registers[register_name]
             clist.extend(r.display(fields))
         else:
             # decode all registers
             for r in self.register_list():
                 clist.extend(r.display(fields))
         return util.display_cols(clist, [0, 0, 0, 0])
     else:
         return 'no registers for %s' % self.name
Пример #12
0
Файл: soc.py Проект: deadsy/pycs
 def display(self, register_name = None, fields= False):
   """return a display string for this peripheral"""
   if self.registers:
     clist = []
     if register_name is not None:
       # decode a single register
       r = self.registers[register_name]
       clist.extend(r.display(fields))
     else:
       # decode all registers
       for r in self.register_list():
         clist.extend(r.display(fields))
     return util.display_cols(clist, [0,0,0,0])
   else:
     return 'no registers for %s' % self.name
Пример #13
0
 def cmd_regs(self, ui, args):
   """display cpu registers"""
   self.halt()
   regs = [self.dbgio.rdreg(name) for name in regnames]
   if len(self.saved_regs) == 0:
     self.saved_regs = regs
   delta = [('*', '')[x == y] for (x, y) in zip(self.saved_regs, regs)]
   self.saved_regs = regs
   cols = []
   for i in range(len(regnames)):
     if regs[i] is None:
       # we don't know this register value
       continue
     cols.append([regnames[i], ': %08x' % regs[i], delta[i]])
   ui.put('%s\n' % util.display_cols(cols))
Пример #14
0
 def __str__(self):
     return util.display_cols([x.col_str() for x in self.sectors])
Пример #15
0
 def __str__(self):
   return util.display_cols([x.col_str() for x in self.rows])
Пример #16
0
 def __str__(self):
     s = []
     for p in self.ports:
         s.extend(self.__status(p))
     return util.display_cols(s)
Пример #17
0
 def __str__(self):
   s = []
   for p in self.ports:
     s.extend(self.__status(p))
   return util.display_cols(s)
Пример #18
0
  def cmd_vtable(self, ui, args):
    """display exceptions vector table"""
    s = []
    group = self.NVIC_GetPriorityGrouping()
    vtable = self.device.SCB.VTOR.rd()
    icsr = self.device.SCB.ICSR.rd()
    shcsr = self.device.SCB.SHCSR.rd()

    s.append('priority group : %s' % self.NVIC_DecodeString(group))
    s.append('vector table   : %08x' % vtable)
    s.append('')
    ui.put('%s\n' % '\n'.join(s))

    i_list = self.device.interrupt_list()
    # stip superfluous prefix/suffix from external interrupt names
    names = [i.name for i in i_list]
    # don't include the system exceptions
    k = find_irq(i_list, 0)
    irq_names = names[k:]
    util.rm_prefix(irq_names, ('INT_',))
    util.rm_suffix(irq_names, ('_IRQ',))
    names[k:] = irq_names

    clist = []
    clist.append(['Name','  Exc','Irq','EPA','Prio','Vector', ''])

    for (name, i) in zip(names, i_list):
      irq = i.irq
      n = i.irq + NUM_SYS_EXC
      exc_n = ': %d' % n
      irq_n = ('-', '%d' % irq)[irq >= 0]
      # enabled/pending/active
      enabled = pending = active = -1
      if irq >= 0:
        idx = (irq >> 5) & 7
        shift = irq & 31
        enabled = (self.device.NVIC.ISER0.rd(idx) >> shift) & 1
        pending = (self.device.NVIC.ISPR0.rd(idx) >> shift) & 1
        active = (self.device.NVIC.IABR0.rd(idx) >> shift) & 1
      else:
        if irq == NMI_IRQn:
          enabled = 1
          pending = (icsr >> 31) & 1
        elif irq == MemManage_IRQn:
          enabled = (shcsr >> 16) & 1
          pending = (shcsr >> 13) & 1
          active = (shcsr >> 0) & 1
        elif irq == BusFault_IRQn:
          enabled = (shcsr >> 17) & 1
          pending = (shcsr >> 14) & 1
          active = (shcsr >> 1) & 1
        elif irq == UsageFault_IRQn:
          enabled = (shcsr >> 18) & 1
          pending = (shcsr >> 12) & 1
          active = (shcsr >> 3) & 1
        elif irq == SVCall_IRQn:
          pending = (shcsr >> 15) & 1
          active = (shcsr >> 7) & 1
        elif irq == DebugMonitor_IRQn:
          active = (shcsr >> 8) & 1
        elif irq == PendSV_IRQn:
          pending = (icsr >> 28) & 1
        elif irq == SysTick_IRQn:
          enabled = (self.device.SysTick.CTRL.rd() >> 1) & 1
          pending = (icsr >> 26) & 1
      l = []
      l.append(util.format_bit(enabled, 'e'))
      l.append(util.format_bit(pending, 'p'))
      l.append(util.format_bit(active, 'a'))
      epa = ''.join(l)
      # priority
      priority = self.NVIC_GetPriority(irq)
      if priority < 0:
        prio = '%d' % priority
      else:
        prio = '%d.%d' % self.NVIC_DecodePriority(priority, group)
      # vector
      vector = '%08x' % (self.rd(vtable + (n * 4), 32) & ~1)
      clist.append([name, exc_n, irq_n, epa, prio, vector, i.description])
    ui.put('%s\n' % util.display_cols(clist, [0,0,0,0,0,0,0]))