Fixed some compile warnings in client, minor tidy up with some dbprintf statements

This commit is contained in:
d18c7db 2010-01-04 03:08:45 +00:00
parent 709a8d3ff0
commit 1e1b303093
6 changed files with 12 additions and 285 deletions

View file

@ -252,7 +252,7 @@ void ReadMem(int addr)
{
const DWORD *data = ((DWORD *)addr);
Dbprintf("Reading memory at address %x: %02x %02x %02x %02x %02x %02x %02x %02x",
Dbprintf("%x: %02x %02x %02x %02x %02x %02x %02x %02x",
addr, data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);
}

View file

@ -19,7 +19,7 @@ DWORD BigBuf[12000];
void ReadMem(int addr);
void __attribute__((noreturn)) AppMain(void);
void SamyRun(void);
void DbpIntegers(int a, int b, int c);
//void DbpIntegers(int a, int b, int c);
void DbpString(char *str);
void Dbprintf(const char *fmt, ...);

View file

@ -1,269 +0,0 @@
unsigned char somestring[25];
//*********************************************************************
//******************** SYSTERM HEARTBEAT @ 10 ms *********************
//*********************************************************************
void InitSPI (void)
{
//set functionalite to pins:
//port0.11 -> NPCS0
//port0.12 -> MISO
//port0.13 -> MOSI
//port0.14 -> SPCK
PIOA_PDR = BIT11 | BIT12 | BIT13 | BIT14;
PIOA_ASR = BIT11 | BIT12 | BIT13 | BIT14;
PIOA_BSR = 0;
PMC_PCER |= 1 << 5; // Enable SPI timer clock.
/**** Fixed mode ****/
SPI_CR = 0x81; //SPI Enable, Sowtware reset
SPI_CR = 0x01; //SPI Enable
SPI_MR = 0x000E0011; //Master mode
SPI_CSR0 = 0x01010B11; //9 bit
}
//*********************************************************************
//*************************** Task 1 ********************************
//*********************************************************************
void Task_1(void *p)
{
char beat=0; // just flash the onboard LED for Heatbeat
while(1)
{
if(beat)
{
PIOA_SODR = BIT18;
beat=0;
}
else
{
PIOA_CODR = BIT18;
beat=1;
}
ctl_timeout_wait(ctl_get_current_time()+ 150);
}
}
//*********************************************************************
//*************************** Task 2 ********************************
//*********************************************************************
void Task_2(void *p)
{
unsigned long z;
unsigned int x,y;
unsigned char a,b,c,d,e;
char seconds,minutes,hours;
unsigned int nowold,tenths;
InitLCD();
/******* Put smiley face up in 4096 color mode *******/
LCD_Fill(0,0,132,132,Black);
LCD_Set_Resolution(HIGH_RES); // set 4096 color mode
// ShowImage_4096(0,0,smiley);
LCD_Set_Resolution(LOW_RES); // set 256 color mode
ctl_timeout_wait(ctl_get_current_time()+ 4000); // wait 4 seconds to view it
/******* Do some static on screen *******/
LCD_Fill(0,0,132,132,Black);
for(z=0;z<100000;z++)
{
while( (a = rand()) > 132);
while( (b = rand()) > 132);
c = rand();
LCD_PixelPut(a,b,c);
}
/******* Do some lines on screen *******/
LCD_Fill(0,0,132,132,Black);
for(z=1;z<300;z++)
{
while( (a = rand()) > 132);
while( (b = rand()) > 132);
while( (c = rand()) > 132);
while( (d = rand()) > 132);
e = rand(); // pick color
LCD_Line(a,b,c,d,e);
ctl_timeout_wait(ctl_get_current_time()+ 10);
}
/******* Do some Boxes on screen *******/
LCD_Fill(0,0,132,132,Black);
for(z=0;z<300;z++)
{
while( (a = rand()) > 132);
while( (b = rand()) > 132);
while( (c = rand()) > 132);
while( (d = rand()) > 132);
e = rand(); // pick color
LCD_Box(a,b,c,d,e);
ctl_timeout_wait(ctl_get_current_time()+ 10);
}
/******* Do some Circles on screen *******/
LCD_Fill(0,0,132,132,Black);
for(z=0;z<100;z++)
{
while( (a = rand()) > 132);
while( (b = rand()) > 132);
while( (c = rand()) > 127); // diameter
d = rand(); // pick color
LCD_Circle(a,b,c,d);
ctl_timeout_wait(ctl_get_current_time()+ 10);
}
/******* Do some Thick Circles on screen *******/
LCD_Fill(0,0,132,132,Black);
for(z=0;z<25;z++)
{
while( (a = rand()) > 132);
while( (b = rand()) > 132);
while( (c = rand()) > 40); // diameter
while( (d = rand()) > 10); // wall thicknes
e = rand(); // pick color
LCD_Thick_Circle(a,b,c,d,e);
ctl_timeout_wait(ctl_get_current_time()+ 1);
}
/******* Do something funky to wipe screen *******/
b=0;
for(a=0;a<131;a++)
{
LCD_Line(a,b,65,65,0x62);
}
for(b=0;b<131;b++)
{
LCD_Line(a,b,65,65,0x62);
}
for(;a>1;a--)
{
LCD_Line(a,b,65,65,0x62);
}
for(;b>1;b--)
{
LCD_Line(a,b,65,65,0x62);
}
ctl_timeout_wait(ctl_get_current_time()+ 1000);
/******* Show Image scrolling *******/
LCD_Fill(0,0,132,132,Black);
ShowImage(0,50,sparkfun);
sprintf(somestring,"Thanks SparkFun");
LCD_String(somestring,&FONT8x8F[0][0],5,10,LightGreen,Black);
ctl_timeout_wait(ctl_get_current_time()+ 2000); // hold sparkfun image for a bit
for(y=50;y<140;y++)
{
LCD_Line(0,y-1,132,y-1,Black); // wipe the white line as it moves down
ShowImage(0,y,sparkfun); // move image to Y location
ctl_timeout_wait(ctl_get_current_time()+ 25); // wait a bit
}
/******* Run radar in loop with example fonts displayed *******/
LCD_Fill(0,0,132,132,Black);
LCD_Thick_Circle(66,66,30,2,DarkBlue);
y=0;
while (1)
{
LCD_Circle_Line(66,66,28,0,y,LightGreen);
ctl_timeout_wait(ctl_get_current_time()+ 1);
tenths = ctl_current_time / 1000;
if(tenths != nowold)
{
nowold = tenths;
if(++seconds == 60)
{
seconds = 0;
if(++minutes == 60)
{
minutes=0;
hours++;
}
}
}
printf("a=%6lu - b=%6lu - c=%6lu - d=%6lu : Time=%lu\r\n",a,b,c,d,ctl_current_time);
sprintf(somestring,"%05lu",y);
LCD_String(somestring,&FONT6x8[0][0],52,25,White,Black);
sprintf(somestring,"Time:%02u:%02u:%02u",hours,minutes,seconds);
LCD_String(somestring,&FONT8x8F[0][0],14,10,DarkRed,Black);
sprintf(somestring,"Time:%02u:%02u:%02u",hours,minutes,seconds);
LCD_String(somestring,&FONT8x16[0][0],14,115,LightGreen,Black);
LCD_Circle_Line(66,66,28,0,y,Black);
if(++y==360)
{
y=0;
}
ctl_timeout_wait(ctl_get_current_time()+ 10);
}
}
/*************************************************************************
********************* Main Module *************************
********************* *************************
********************* Initialize Program *************************
********************* Sequences *************************
********************* *************************
*************************************************************************/
int main(void)
{
BoardInit();
InitSPI();
while (1)
{
Idle();
}
return 0;
}

View file

@ -54,7 +54,8 @@ void DoAcquisition125k(void)
if (i >= n) break;
}
}
Dbprintf("read samples, dest[0]=%x dest[1]=%x", dest[0], dest[1]);
Dbprintf("buffer samples: %02x %02x %02x %02x %02x %02x %02x %02x ...",
dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]);
}
void ModThenAcquireRawAdcSamples125k(int delay_off, int period_0, int period_1, BYTE *command)
@ -248,7 +249,7 @@ void ReadTItag(void)
crc = update_crc16(crc, (shift1>>16)&0xff);
crc = update_crc16(crc, (shift1>>24)&0xff);
Dbprintf("Info: Tag data_hi=%x, data_lo=%x, crc=%x",
Dbprintf("Info: Tag data: %x%08x, crc=%x",
(unsigned int)shift1, (unsigned int)shift0, (unsigned int)shift2 & 0xFFFF);
if (crc != (shift2&0xffff)) {
Dbprintf("Error: CRC mismatch, expected %x", (unsigned int)crc);
@ -343,7 +344,6 @@ void AcquireTiType(void)
n = TIBUFLEN*32;
// unpack buffer
for (i=TIBUFLEN-1; i>=0; i--) {
// DbpIntegers(0, 0, BigBuf[i]);
for (j=0; j<32; j++) {
if(BigBuf[i] & (1 << j)) {
dest[--n] = 1;
@ -359,11 +359,6 @@ void AcquireTiType(void)
// if not provided a valid crc will be computed from the data and written.
void WriteTItag(DWORD idhi, DWORD idlo, WORD crc)
{
// WARNING the order of the bytes in which we calc crc below needs checking
// i'm 99% sure the crc algorithm is correct, but it may need to eat the
// bytes in reverse or something
if(crc == 0) {
crc = update_crc16(crc, (idlo)&0xff);
crc = update_crc16(crc, (idlo>>8)&0xff);
@ -374,7 +369,7 @@ void WriteTItag(DWORD idhi, DWORD idlo, WORD crc)
crc = update_crc16(crc, (idhi>>16)&0xff);
crc = update_crc16(crc, (idhi>>24)&0xff);
}
Dbprintf("Writing the following data to tag: %x, %x, %x",
Dbprintf("Writing to tag: %x%08x, crc=%x",
(unsigned int) idhi, (unsigned int) idlo, crc);
// TI tags charge at 134.2Khz
@ -919,7 +914,7 @@ void CmdHIDdemodFSK(int findone, int *high, int *low, int ledcontrol)
found=1;
idx+=6;
if (found && (hi|lo)) {
Dbprintf("TAG ID: %x %x %x",
Dbprintf("TAG ID: %x%08x (%d)",
(unsigned int) hi, (unsigned int) lo, (unsigned int) (lo>>1) & 0xFFFF);
/* if we're only looking for one tag */
if (findone)
@ -952,7 +947,7 @@ void CmdHIDdemodFSK(int findone, int *high, int *low, int ledcontrol)
found=1;
idx+=6;
if (found && (hi|lo)) {
Dbprintf("TAG ID: %x %x %x",
Dbprintf("TAG ID: %x%08x (%d)",
(unsigned int) hi, (unsigned int) lo, (unsigned int) (lo>>1) & 0xFFFF);
/* if we're only looking for one tag */
if (findone)

View file

@ -10,6 +10,8 @@ WINLIBS = -lgdi32 -lsetupapi
CXXFLAGS = $(shell pkg-config --cflags QtCore QtGui 2>/dev/null) -Wall
QTLDLIBS = $(shell pkg-config --libs QtCore QtGui 2>/dev/null)
ifeq ($(shell echo ""),)
ifeq ($(shell uname),Darwin)
CXXFLAGS = -I/Library/Frameworks/QtGui.framework/Versions/Current/Headers -I/Library/Frameworks/QtCore.framework/Versions/Current/Headers
QTLDLIBS = -framework QtGui -framework QtCore
@ -25,7 +27,6 @@ else
QTGUI = guidummy.o
endif
ifeq ($(shell echo ""),)
RM = rm -f
BINS = proxmark3 snooper cli flasher
CLEAN = cli flasher proxmark3 snooper *.o *.moc.cpp

View file

@ -225,7 +225,7 @@ void WaitForAck(void) {
}
}
static DWORD ExpectedAddr;
static unsigned int ExpectedAddr;
static BYTE QueuedToSend[256];
static BOOL AllWritten;
#define PHYSICAL_FLASH_START 0x100000
@ -336,7 +336,7 @@ static void LoadFlashFromSRecords(const char *file, int start_addr, int end_addr
char addrStr[9];
memcpy(addrStr, s, 8);
addrStr[8] = '\0';
DWORD addr;
unsigned int addr;
sscanf(addrStr, "%x", &addr);
s += 8;