From: dodge-this Date: Mon, 12 Apr 2010 20:38:01 +0000 (+0000) Subject: Updates to ARM7TDMI JTAG app and optimizations for debughex() and added debughex32... X-Git-Url: http://git.rot13.org/?p=goodfet;a=commitdiff_plain;h=64ef261d7416ef8cb3ec6cdf7130fc4d8afad8cd Updates to ARM7TDMI JTAG app and optimizations for debughex() and added debughex32() for 32-bit longs git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@457 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- diff --git a/client/GoodFET.py b/client/GoodFET.py index a2f3160..518cf47 100755 --- a/client/GoodFET.py +++ b/client/GoodFET.py @@ -8,6 +8,8 @@ import sys, time, string, cStringIO, struct, glob, serial, os; import sqlite3; +fmt = ("B", ">24, (val>>16)&0xff, (val>>8)&0xff, val&0xff]) - print "DEBUG:SET_REGISTER: %s"%repr(self.data) + self.writecmd(0x33,GET_REGISTER,20,[reg,0,0,0,val>>24, (val>>16)&0xff, (val>>8)&0xff, val&0xff,9,8,7,6,5,4,3,2,1,0,2,3]) + print "DEBUG:SET_REGISTER: %s"%asp.hexText(self.data) retval = struct.unpack(">24, (reg>>16)&0xff, (reg>>8)&0xff, reg&0xff]) - self.writecmd(0x33,GET_REGISTER,16*4,regarray) - print "DEBUG:SET_REGISTER: %s"%repr(self.data) - retval = struct.unpack(">24, (reg>>16)&0xff, (reg>>8)&0xff, reg&0xff]) + self.writecmd(0x33,GET_REGISTER,16*4,regarry) + print "DEBUG:SET_REGISTER: %s"%asp.hexText(self.data) + #retval = struct.unpack(" - +*/ diff --git a/firmware/include/command.h b/firmware/include/command.h index dda9b64..743a008 100644 --- a/firmware/include/command.h +++ b/firmware/include/command.h @@ -115,10 +115,14 @@ void txlong(unsigned long l); //! Transmit a word. void txword(unsigned int l); +//! Transmit a debug sequence of bytes +void debugbytes(const char *bytes, unsigned int len); //! Transmit a debug string. void debugstr(const char *str); //! brief Debug a hex word string. void debughex(u16 v); +//! brief Debug a hex long string. +void debughex32(u32 v); //! Delay for a count. void delay(unsigned int count); diff --git a/firmware/lib/command.c b/firmware/lib/command.c index 1de6f0a..571d0c0 100644 --- a/firmware/lib/command.c +++ b/firmware/lib/command.c @@ -32,24 +32,12 @@ void debugstr(const char *str){ //! brief Debug a hex word string. void debughex(u16 v) { - unsigned char a[7]; - a[0]='0'; a[1]='x'; - - a[2]=0xf&(v>>12); - a[2]+=(a[2]>9)?('a'-10):'0'; - - a[3]=0xf&(v>>8); - a[3]+=(a[3]>9)?('a'-10):'0'; - - a[4]=0xf&(v>>4); - a[4]+=(a[4]>9)?('a'-10):'0'; - - a[5]=0xf&(v>>0); - a[5]+=(a[5]>9)?('a'-10):'0'; - - a[6]=0; + debugbytes((void *)&v, 2); +} - txstring(0xFF,0xFF,a); +//! brief Debug a hex word string. +void debughex32(u32 v) { + debugbytes((void *)&v, 4); } /*! \brief Transmit debug bytes.