X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=shellcode%2Fchipcon%2Fcc1110%2Frxpacket.c;h=0535f0b5a57e4b3c56b243c0f67ec7b5755aceb1;hp=9bea2421a88107533052d28487d0a5761c593c93;hb=d0498df7bc06959a19fe1ef2c4fc066dd8d68c92;hpb=a06f45d24b010987c9128261ff33dd2c93db0970 diff --git a/shellcode/chipcon/cc1110/rxpacket.c b/shellcode/chipcon/cc1110/rxpacket.c index 9bea242..0535f0b 100644 --- a/shellcode/chipcon/cc1110/rxpacket.c +++ b/shellcode/chipcon/cc1110/rxpacket.c @@ -1,20 +1,42 @@ #include #include "cc1110-ext.h" -char __xdata at 0xfe00 packet[256] ; - +#define MAXLEN 0xFF +char __xdata at 0xfe00 packet[MAXLEN] ; //! Receives a packet out of the radio from 0xFE00. void main(){ - unsigned char len=100, i=0; - RFST=RFST_SRX; //Begin to receive. - while(i!=len+1){ - while(RFTXRXIF); //Wait for byte to be ready. + unsigned char len=16, i=0; + + do{ + //1-out the buffer. + for(i=0;i<64;i++) + packet[i]=0xFF; + i=0; + + //Disable interrupts. + RFTXRXIE=0; + + //idle a bit. + RFST=RFST_SIDLE; + while(MARCSTATE!=MARC_STATE_IDLE); - RFTXRXIF=0; //Clear the flag. - packet[i++]=RFD; //Grab the next byte. - len=packet[0]; //First byte of the packet is the length. - } - RFST = RFST_SIDLE; //End transmit. + //Begin to receive. + RFST=RFST_SRX; + while(MARCSTATE!=MARC_STATE_RX); + + while(i