From ed8fe6653a821e893857c9491d576b8c6dee8dad Mon Sep 17 00:00:00 2001 From: rmspeers Date: Mon, 18 Apr 2011 23:47:42 +0000 Subject: [PATCH 1/1] telosb reflexive jamming, beta version, confirmed works in some testing, improvements still to be made git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@1003 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- client/GoodFETCCSPI.py | 5 ++++ client/goodfet.ccspi | 21 +++++++++++--- firmware/apps/radios/ccspi.c | 55 ++++++++++++++++++++++++++++++++---- firmware/platforms/telosb.h | 19 +++++++++++-- 4 files changed, 89 insertions(+), 11 deletions(-) diff --git a/client/GoodFETCCSPI.py b/client/GoodFETCCSPI.py index 8a216b3..0283d87 100644 --- a/client/GoodFETCCSPI.py +++ b/client/GoodFETCCSPI.py @@ -186,6 +186,11 @@ class GoodFETCCSPI(GoodFET): #self.strobe(0x09); return; + def RF_reflexjam(self): + """Place the device into reflexive jamming mode.""" + data = "" + self.writecmd(self.CCSPIAPP,0xA0,len(data),data); + return; def RF_modulated_spectrum(self): """Hold a carrier wave on the present frequency.""" diff --git a/client/goodfet.ccspi b/client/goodfet.ccspi index 99dbec2..74ec740 100755 --- a/client/goodfet.ccspi +++ b/client/goodfet.ccspi @@ -26,10 +26,9 @@ if(len(sys.argv)==1): print "%s bsniff [chan]" % sys.argv[0]; print "%s sniffdissect" % sys.argv[0]; - - print; - print "%s txtoscount [-i|-r] TinyOS BlinkToLED" % sys.argv[0]; - + print "\n%s txtoscount [-i|-r] TinyOS BlinkToLED" % sys.argv[0]; + print "%s reflexjam" % sys.argv[0]; + sys.exit(); #Initialize FET and set baud rate @@ -57,6 +56,20 @@ if(sys.argv[1]=="modulated_spectrum"): while(1): time.sleep(1); +if(sys.argv[1]=="reflexjam"): + client.RF_promiscuity(1); + client.RF_autocrc(0); + if len(sys.argv)>2: + freq=eval(sys.argv[2]); + if freq>100: + client.RF_setfreq(freq); + else: + client.RF_setchan(freq); + client.CC_RFST_RX(); + print "Listening as %010x on %i MHz" % (client.RF_getsmac(), + client.RF_getfreq()/10**6); + client.RF_reflexjam(); + if(sys.argv[1]=="info"): print "Found %s" % client.identstr(); print "Freq: %05f MHz" % (client.RF_getfreq()/(10**6)); diff --git a/firmware/apps/radios/ccspi.c b/firmware/apps/radios/ccspi.c index 277a440..83dfa37 100644 --- a/firmware/apps/radios/ccspi.c +++ b/firmware/apps/radios/ccspi.c @@ -140,7 +140,7 @@ void ccspi_handle_fn( uint8_t const app, break; case CCSPI_RX: #ifdef FIFOP - //Has there been an overflow? + //Has there been an overflow? if((!FIFO)&&FIFOP){ debugstr("Clearing overflow"); CLRSS; @@ -159,7 +159,7 @@ void ccspi_handle_fn( uint8_t const app, //ccspitrans8(0x3F|0x40); cmddata[0]=0xff; //to be replaced with length for(i=0;i #endif -//LED on P5.4 +//LED on P5.4 (LED1 red) #define PLEDOUT P5OUT #define PLEDDIR P5DIR #define PLEDPIN BIT4 +//LED on P5.5 (LED2 green) +#define PLED2OUT P5OUT +#define PLED2DIR P5DIR +#define PLED2PIN BIT5 +//LED on P5.6 (LED3 blue) +#define PLED3OUT P5OUT +#define PLED3DIR P5DIR +#define PLED3PIN BIT6 #define SPIOUT P3OUT @@ -49,7 +57,6 @@ #define CLRSS P4OUT&=~BIT2 #define DIRSS P4DIR|=BIT2 - //Flash CS is P4.4, redefine only for the SPI app. #ifdef SPIAPPLICATION #undef SETSS @@ -70,6 +77,14 @@ #define FIFOP (P1IN&BIT0) #define FIFO (P1IN&BIT3) +//GPIO Expansion Pins +#define GIO0 (P2OUT&BIT0) +#define GIO0HIGH P2OUT|=BIT0 +#define GIO0LOW P2OUT&=~BIT0 +#define GIO0OUT P2OUT +#define GIO0DIR P2DIR +#define GIO0PIN BIT0 + // network byte order converters #define htons(x) ((((uint16_t)(x) & 0xFF00) >> 8) | \ (((uint16_t)(x) & 0x00FF) << 8)) -- 2.20.1