tux-droid-svn Mailing List for Tux Droid CE (Page 191)
Status: Beta
Brought to you by:
ks156
You can subscribe to this list here.
2007 |
Jan
|
Feb
(32) |
Mar
(108) |
Apr
(71) |
May
(38) |
Jun
(128) |
Jul
(1) |
Aug
(14) |
Sep
(77) |
Oct
(104) |
Nov
(90) |
Dec
(71) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(81) |
Feb
(18) |
Mar
(40) |
Apr
(102) |
May
(151) |
Jun
(74) |
Jul
(151) |
Aug
(257) |
Sep
(447) |
Oct
(379) |
Nov
(404) |
Dec
(430) |
2009 |
Jan
(173) |
Feb
(236) |
Mar
(519) |
Apr
(300) |
May
(112) |
Jun
(232) |
Jul
(314) |
Aug
(58) |
Sep
(203) |
Oct
(293) |
Nov
(26) |
Dec
(109) |
2010 |
Jan
(19) |
Feb
(25) |
Mar
(33) |
Apr
(1) |
May
|
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: jaguarondi <c2m...@c2...> - 2008-06-24 10:37:11
|
Author: jaguarondi Date: 2008-06-24 12:37:20 +0200 (Tue, 24 Jun 2008) New Revision: 1257 Added: firmware/fuxusb/branches/new_rf/ Log: * Branched for refactoring the RF. Copied: firmware/fuxusb/branches/new_rf (from rev 1256, firmware/fuxusb/trunk) |
From: jaguarondi <c2m...@c2...> - 2008-06-24 10:34:52
|
Author: jaguarondi Date: 2008-06-24 12:34:57 +0200 (Tue, 24 Jun 2008) New Revision: 1256 Removed: firmware/tuxaudio/branches/new_rf/interrupt.c Modified: firmware/tuxaudio/branches/new_rf/Makefile firmware/tuxaudio/branches/new_rf/PC_communication.c firmware/tuxaudio/branches/new_rf/communication.c firmware/tuxaudio/branches/new_rf/flash.c firmware/tuxaudio/branches/new_rf/main.c firmware/tuxaudio/branches/new_rf/parser.c firmware/tuxaudio/branches/new_rf/parser.h firmware/tuxaudio/branches/new_rf/varis.c firmware/tuxaudio/branches/new_rf/varis.h Log: * First functional version. A couple of things have been commented in order to test the RF communication first: flash and I2C. Next step is to move to 16kHz audio. Modified: firmware/tuxaudio/branches/new_rf/Makefile =================================================================== --- firmware/tuxaudio/branches/new_rf/Makefile 2008-06-24 10:24:05 UTC (rev 1255) +++ firmware/tuxaudio/branches/new_rf/Makefile 2008-06-24 10:34:57 UTC (rev 1256) @@ -1,7 +1,7 @@ # Makefile for the 'audio' CPU of Tux Droid ## Configuration Flags -MIC_GAIN = 6 # values can be 0, 6 or 12 (which is the gain in dB) +MIC_GAIN = 0 # values can be 0, 6 or 12 (which is the gain in dB) ## General Flags PROJECT = tuxaudio @@ -38,11 +38,7 @@ CINCS = # Compile options common for all C compilation units. -ifdef windir -CDEBUG = -gdwarf-2 -else CDEBUG = -g -endif CWARN = -Wall -Wstrict-prototypes CTUNING = -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums CFLAGS = $(COMMON) $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CSTANDARD) $(CEXTRA) @@ -142,29 +138,17 @@ size: ${TARGET} @echo -ifdef windir - @avr-size -C --mcu=${MCU} ${TARGET} -else @avr-size ${TARGET} -endif bl_size: ${BOOTLOADER} @echo -ifdef windir - @avr-size -C --mcu=${MCU} ${BOOTLOADER} -else @avr-size ${BOOTLOADER} -endif ## Generate SVN info # We need to change the status each time a file changes, thus so many # dependencies svnrev.h: $(CSOURCE) $(HEADERS) -ifdef windir - SubWCRev . svnrev.tmpl.h svnrev.h -else svnwcrev . svnrev.tmpl.h svnrev.h -endif ## Clean target .PHONY: clean @@ -178,11 +162,7 @@ ## Generate doxygen documentation .PHONY: doc doc: svnrev.h -ifdef windir - # XXX add windows version -else @./doc/builddoc.sh -endif # Programming @@ -192,6 +172,15 @@ progisp: $(PROJECT).hex $(PROJECT).eep $(AVRDUDE) -p $(MCU) -c jtag2isp -P usb -B 10 -e -U flash:w:$(PROJECT).hex -U eeprom:w:$(PROJECT).eep +dwen: + $(AVRDUDE) -p $(MCU) -c jtag2isp -P usb -B 10 -U hfuse:w:0x9D:m + +nodwen: + $(AVRDUDE) -p $(MCU) -c jtag2isp -P usb -B 10 -U hfuse:w:0xDD:m + +debug: + avarice -P $(MCU) -2 -w -j usb -p -f $(PROJECT).elf :4242 + progisp_bl: $(PROJECT).hex $(PROJECT).eep $(PROJECT)_bl.hex $(AVRDUDE) -p $(MCU) -c jtag2isp -P usb -B 10 -e -U flash:w:$(PROJECT)_bl.hex -U eeprom:w:$(PROJECT).eep -D -U flash:w:$(PROJECT).hex Modified: firmware/tuxaudio/branches/new_rf/PC_communication.c =================================================================== --- firmware/tuxaudio/branches/new_rf/PC_communication.c 2008-06-24 10:24:05 UTC (rev 1255) +++ firmware/tuxaudio/branches/new_rf/PC_communication.c 2008-06-24 10:34:57 UTC (rev 1256) @@ -31,113 +31,128 @@ void spiTransaction(void) { - if (spi_start) // Wait start - { - spi_start = 0; // Reset the spi start flag - spi_count = 0; // Reset spi counter - spi_slave = HEADERS; // Set state machine - spi_master = HEADERM; - // Reset SPI to fix strange bug on the spi - SPCR = 0x50; - SPSR = 0x00; - asm volatile /* Clear the SPI interrupt flag */ - ("in __tmp_reg__, %0" "\n\t" "in __tmp_reg__, %1" "\n\t":: - "I" (_SFR_IO_ADDR(SPSR)), "I"(_SFR_IO_ADDR(SPDR))); + /*if (rf_txe) // Wait TX EMPTY*/ + /*{*/ + /*uint8_t i;*/ + /*PORTB &= ~_BV(PB2); // Chip select*/ + /*rf_txe = 0;*/ + /*spi_ready = 0;*/ + /*SPDR = 1;*/ + /*while ((SPSR & 0x80) == 0);*/ + /*for (i=0; i<50; i++)*/ + /*{*/ + /*while (!spi_ready);*/ + /*spi_ready = 0;*/ + /*SPDR = i;//0x55;*/ + /*while ((SPSR & 0x80) == 0);*/ + /*}*/ + /*PORTB |= _BV(PB2); // Chip select*/ + + + /*spi_count = 0; // Reset spi counter*/ + /*spi_slave = HEADERS; // Set state machine*/ + /*spi_master = HEADERM;*/ + /*// Reset SPI to fix strange bug on the spi*/ + /*SPCR = 0x50;*/ + /*SPSR = 0x00;*/ + /*asm volatile [> Clear the SPI interrupt flag <]*/ + /*("in __tmp_reg__, %0" "\n\t" "in __tmp_reg__, %1" "\n\t"::*/ + /*"I" (_SFR_IO_ADDR(SPSR)), "I"(_SFR_IO_ADDR(SPDR)));*/ flash_onhold(); - PORTB &= ~0x04; // Chip select - while (1) - { - if (spi_ready) - { - spi_ready = 0; - if (spi_slave == HEADERS) - { - /* Sound */ - if (FifoLength(ADCFifo) >= 17) - spi_headerb = 0x02; /* frame will contain sound */ - else - spi_headerb = 0x00; /* no sound in frame */ + /*PORTB &= ~0x04; // Chip select*/ + /*while (1)*/ + /*{*/ + /*if (spi_ready)*/ + /*{*/ + /*spi_ready = 0;*/ + /*if (spi_slave == HEADERS)*/ + /*{*/ + /*[> Sound <]*/ + /*if (FifoLength(ADCFifo) >= 17)*/ + /*spi_headerb = 0x02; [> frame will contain sound <]*/ + /*else*/ + /*spi_headerb = 0x00; [> no sound in frame <]*/ - /* Status */ - if ((rf_data_sent_ack == RF_DATA_SENT_NACKED) - || (rf_data_sent_ack == RF_DATA_SENT_DROPPED)) - { - spi_headerb |= 0x08; /* resend the previous status if nacked */ - } - else if (rf_data_sent_ack != RF_DATA_SENT_BUSY) /* wait the end of transmission */ - if (!popStatus(spi_commandTX)) /* fetch the next status */ - spi_headerb |= 0x08; /* indicate that the frame contains status */ + /*[> Status <]*/ + /*if ((rf_data_sent_ack == RF_DATA_SENT_NACKED)*/ + /*|| (rf_data_sent_ack == RF_DATA_SENT_DROPPED))*/ + /*{*/ + /*spi_headerb |= 0x08; [> resend the previous status if nacked <]*/ + /*}*/ + /*else if (rf_data_sent_ack != RF_DATA_SENT_BUSY) [> wait the end of transmission <]*/ + /*if (!popStatus(spi_commandTX)) [> fetch the next status <]*/ + /*spi_headerb |= 0x08; [> indicate that the frame contains status <]*/ - SPDR = spi_headerb; // Header byte - spi_slave = GET_SOUND_FIFO; // Next state - } - else if (spi_slave == GET_SOUND_FIFO) - { - if (spi_count == 17) - spi_slave = PUT_COMMAND; // Next state - if (spi_headerb & 0x02) - { - uint8_t data; - cli(); - FifoGet(ADCFifo, &data); - SPDR = data; // Get data from FIFO - sei(); - } - else - SPDR = 0x00; // No data to transmit - } - else if (spi_slave == PUT_COMMAND) - { - if (spi_count == 21) - spi_slave = DUMMY; // Next state - if (spi_headerb & 0x08) - { - SPDR = spi_commandTX[spi_count - 18]; // Get command from buffer - } - else - SPDR = 0x00; // No command to transmit - } - else if (spi_slave == DUMMY) - { - SPDR = 0x00; // Dummy byte in case of big frame - } + /*SPDR = spi_headerb; // Header byte*/ + /*spi_slave = GET_SOUND_FIFO; // Next state*/ + /*}*/ + /*else if (spi_slave == GET_SOUND_FIFO)*/ + /*{*/ + /*if (spi_count == 17)*/ + /*spi_slave = PUT_COMMAND; // Next state*/ + /*if (spi_headerb & 0x02)*/ + /*{*/ + /*uint8_t data;*/ + /*cli();*/ + /*FifoGet(ADCFifo, &data);*/ + /*SPDR = data; // Get data from FIFO*/ + /*sei();*/ + /*}*/ + /*else*/ + /*SPDR = 0x00; // No data to transmit*/ + /*}*/ + /*else if (spi_slave == PUT_COMMAND)*/ + /*{*/ + /*if (spi_count == 21)*/ + /*spi_slave = DUMMY; // Next state*/ + /*if (spi_headerb & 0x08)*/ + /*{*/ + /*SPDR = spi_commandTX[spi_count - 18]; // Get command from buffer*/ + /*}*/ + /*else*/ + /*SPDR = 0x00; // No command to transmit*/ + /*}*/ + /*else if (spi_slave == DUMMY)*/ + /*{*/ + /*SPDR = 0x00; // Dummy byte in case of big frame*/ + /*}*/ - while ((SPSR & 0x80) == 0) ; // Wait SPI response + /*while ((SPSR & 0x80) == 0) ; // Wait SPI response*/ - spi_count++; - if (spi_master == HEADERM) - { - spi_master_config = SPDR; // Save header config byte - if (spi_master_config & 0x08) // Command - commandRX = 1; // Flag to send command on I2C - if (spi_master_config & 0x80) // Double frame - spi_lenght_data = 34; - else - spi_lenght_data = 17; - if (spi_master_config == 0x08 || spi_master_config == 0x00) - { - if (frame_without_sound) - frame_without_sound --; + /*spi_count++;*/ + /*if (spi_master == HEADERM)*/ + /*{*/ + /*spi_master_config = SPDR; // Save header config byte*/ + /*if (spi_master_config & 0x08) // Command*/ + /*commandRX = 1; // Flag to send command on I2C*/ + /*if (spi_master_config & 0x80) // Double frame*/ + /*spi_lenght_data = 34;*/ + /*else*/ + /*spi_lenght_data = 17;*/ + /*if (spi_master_config == 0x08 || spi_master_config == 0x00)*/ + /*{*/ + /*if (frame_without_sound)*/ + /*frame_without_sound --;*/ - else - sound_played = 0; - } - else - { - sound_played = 1; - frame_without_sound = frame_without_sound_timeout; - } + /*else*/ + /*sound_played = 0;*/ + /*}*/ + /*else*/ + /*{*/ + /*sound_played = 1;*/ + /*frame_without_sound = frame_without_sound_timeout;*/ + /*}*/ - spi_master = PUT_SOUND_FIFO; // Go to the next state + /*spi_master = PUT_SOUND_FIFO; // Go to the next state*/ - if (!programmingFlash && !flashPlay) // XXX code must be review it's very strange ..... - { - if (!(spi_master_config & 0x02)) - { - if (!lockAdaptFifo) - { - //adaptFifo(PWMFifo); // Adaptative FIFO -#if 0 + /*if (!programmingFlash && !flashPlay) // XXX code must be review it's very strange .....*/ + /*{*/ + /*if (!(spi_master_config & 0x02))*/ + /*{*/ + /*if (!lockAdaptFifo)*/ + /*{*/ + /*//adaptFifo(PWMFifo); // Adaptative FIFO*/ +/*#if 0*/ /** \brief 3 levels adaptative function. * \param p fifo pointer * @@ -145,117 +160,117 @@ * each level, a custom code or a function call can be provided to do the * adaptation. */ -void adaptFifo(fifo_t * p) -{ - unsigned char fifoLevel; +/*void adaptFifo(fifo_t * p)*/ +/*{*/ + /*unsigned char fifoLevel;*/ - fifoLevel = fifoLength(p); - if (!p->adpt_cycle) - { - if (p->matched == 8) - { - if (OCR0A < 254) - p->pwm_max = OCR0A + 2; - else - p->pwm_max = 255; - if (OCR0A > 231) - p->pwm_min = OCR0A - 2; - else - p->pwm_min = 230; - p->matched = 9; - } + /*fifoLevel = fifoLength(p);*/ + /*if (!p->adpt_cycle)*/ + /*{*/ + /*if (p->matched == 8)*/ + /*{*/ + /*if (OCR0A < 254)*/ + /*p->pwm_max = OCR0A + 2;*/ + /*else*/ + /*p->pwm_max = 255;*/ + /*if (OCR0A > 231)*/ + /*p->pwm_min = OCR0A - 2;*/ + /*else*/ + /*p->pwm_min = 230;*/ + /*p->matched = 9;*/ + /*}*/ - if (fifoLevel >= FIFO_ADAPT_HIGH) - { - if (OCR0A > p->pwm_min) - { - OCR0A--; - p->pwm_adpt_sens = 1; - } - } - else if (fifoLevel < FIFO_ADAPT_LOW) - { - if (OCR0A < p->pwm_max) - { - OCR0A++; - p->pwm_adpt_sens = 2; - } - } - else - { - if (p->pwm_adpt_sens) - { - if ((p->pwm_adpt_sens) == 1) - { - if (OCR0A < p->pwm_max) - OCR0A++; - } - else - { - if (OCR0A > p->pwm_min) - OCR0A--; - } - p->pwm_adpt_sens = 0; - p->matched = 0; - } - else - { - if (p->matched != 9) - p->matched++; - } - } - } - p->adpt_cycle++; - p->adpt_cycle &= (FIFO_ADAPT_RATE << 1) - 1; -} -#endif - lockAdaptFifo = 1; - } - else - FifoClear(PWMFifo); - } - else - { - lockAdaptFifo = 0; - } - } + /*if (fifoLevel >= FIFO_ADAPT_HIGH)*/ + /*{*/ + /*if (OCR0A > p->pwm_min)*/ + /*{*/ + /*OCR0A--;*/ + /*p->pwm_adpt_sens = 1;*/ + /*}*/ + /*}*/ + /*else if (fifoLevel < FIFO_ADAPT_LOW)*/ + /*{*/ + /*if (OCR0A < p->pwm_max)*/ + /*{*/ + /*OCR0A++;*/ + /*p->pwm_adpt_sens = 2;*/ + /*}*/ + /*}*/ + /*else*/ + /*{*/ + /*if (p->pwm_adpt_sens)*/ + /*{*/ + /*if ((p->pwm_adpt_sens) == 1)*/ + /*{*/ + /*if (OCR0A < p->pwm_max)*/ + /*OCR0A++;*/ + /*}*/ + /*else*/ + /*{*/ + /*if (OCR0A > p->pwm_min)*/ + /*OCR0A--;*/ + /*}*/ + /*p->pwm_adpt_sens = 0;*/ + /*p->matched = 0;*/ + /*}*/ + /*else*/ + /*{*/ + /*if (p->matched != 9)*/ + /*p->matched++;*/ + /*}*/ + /*}*/ + /*}*/ + /*p->adpt_cycle++;*/ + /*p->adpt_cycle &= (FIFO_ADAPT_RATE << 1) - 1;*/ +/*}*/ +/*#endif*/ + /*lockAdaptFifo = 1;*/ + /*}*/ + /*else*/ + /*FifoClear(PWMFifo);*/ + /*}*/ + /*else*/ + /*{*/ + /*lockAdaptFifo = 0;*/ + /*}*/ + /*}*/ - } - else if (spi_master == PUT_SOUND_FIFO) - { - if (spi_master_config & 0x02) - { - if (!flashPlay) - FifoPut(PWMFifo, SPDR); // Put into the FIFO - } - if (spi_count == (spi_lenght_data + 1)) - spi_master = READ_COMMAND; // Go to the next state + /*}*/ + /*else if (spi_master == PUT_SOUND_FIFO)*/ + /*{*/ + /*if (spi_master_config & 0x02)*/ + /*{*/ + /*if (!flashPlay)*/ + /*FifoPut(PWMFifo, SPDR); // Put into the FIFO*/ + /*}*/ + /*if (spi_count == (spi_lenght_data + 1))*/ + /*spi_master = READ_COMMAND; // Go to the next state*/ - } - else if (spi_master == READ_COMMAND) - { - if (spi_master_config & 0x08) - { - if (spi_master_config & 0x80) - spi_commandRX[spi_count - 36] = SPDR; // Put command into the buffer - else - spi_commandRX[spi_count - 19] = SPDR; // Put command into the buffer - } - if (spi_count == spi_lenght_data + 6) - { - /* Check the acknowledge from the rf */ - if (spi_headerb & 0x08) /* if data was sent in the current SPI transaction, mark buffer as full and drop the received status */ - rf_data_sent_ack = RF_DATA_SENT_BUSY; /* status buffer of the rf filled */ - else - rf_data_sent_ack = spi_commandRX[4]; /* get the acknowledge of the previous sent data */ + /*}*/ + /*else if (spi_master == READ_COMMAND)*/ + /*{*/ + /*if (spi_master_config & 0x08)*/ + /*{*/ + /*if (spi_master_config & 0x80)*/ + /*spi_commandRX[spi_count - 36] = SPDR; // Put command into the buffer*/ + /*else*/ + /*spi_commandRX[spi_count - 19] = SPDR; // Put command into the buffer*/ + /*}*/ + /*if (spi_count == spi_lenght_data + 6)*/ + /*{*/ + /*[> Check the acknowledge from the rf <]*/ + /*if (spi_headerb & 0x08) [> if data was sent in the current SPI transaction, mark buffer as full and drop the received status <]*/ + /*rf_data_sent_ack = RF_DATA_SENT_BUSY; [> status buffer of the rf filled <]*/ + /*else*/ + /*rf_data_sent_ack = spi_commandRX[4]; [> get the acknowledge of the previous sent data <]*/ - PORTB |= 0x04; // Chip deselect - break; - } - } - } - } - flash_enable(); - } + /*PORTB |= 0x04; // Chip deselect*/ + /*break;*/ + /*}*/ + /*}*/ + /*}*/ + /*}*/ + /*flash_enable();*/ + /*}*/ } Modified: firmware/tuxaudio/branches/new_rf/communication.c =================================================================== --- firmware/tuxaudio/branches/new_rf/communication.c 2008-06-24 10:24:05 UTC (rev 1255) +++ firmware/tuxaudio/branches/new_rf/communication.c 2008-06-24 10:34:57 UTC (rev 1256) @@ -27,6 +27,8 @@ #include "i2c.h" #include "parser.h" #include "hardware.h" +/* For ADCFifo... */ +#include "varis.h" /* I2C write message (out) */ static uint8_t out_buf[CMD_SIZE]; @@ -38,17 +40,21 @@ /** Size of the stack buffer to tuxcore */ #define CORE_OUT_BUF_SIZE 16 /** Size of the stack buffer to tuxrf */ -#define RF_OUT_BUF_SIZE 32 +#define RF_BUF_SIZE 32 FIFO_INSTANCE(core_cmdout_buf, CORE_OUT_BUF_SIZE); /** Stack for commands to be sent to tuxcore */ fifo_t *core_cmdout = FifoPointer(core_cmdout_buf); -FIFO_INSTANCE(rf_cmdout_buf_s, RF_OUT_BUF_SIZE); +FIFO_INSTANCE(rf_cmdout_buf_s, RF_BUF_SIZE); /** Stack for commands to be sent to rf */ fifo_t *rf_cmdout_buf = FifoPointer(rf_cmdout_buf_s); +FIFO_INSTANCE(rf_cmdin_buf_s, RF_BUF_SIZE); +/** Stack for commands received from the rf */ +fifo_t *rf_cmdin_buf = FifoPointer(rf_cmdin_buf_s); + /* * Initialize (clear) the communication buffers * XXX can't we delete this? @@ -94,7 +100,7 @@ static void get_core_cmd(void) { /* First check if the stack is not full */ - if (FifoLength(rf_cmdout_buf) > RF_OUT_BUF_SIZE - CMD_SIZE) + if (FifoLength(rf_cmdout_buf) > RF_BUF_SIZE - CMD_SIZE) return; if (i2c_get_status() != I2C_BUSY) @@ -146,7 +152,7 @@ { uint8_t i; - if (FifoLength(rf_cmdout_buf) > RF_OUT_BUF_SIZE - CMD_SIZE) + if (FifoLength(rf_cmdout_buf) > RF_BUF_SIZE - CMD_SIZE) return 0; uint8_t sreg; @@ -189,16 +195,12 @@ if (msg->addr == TUXCORE_ADDR) /* From tuxcore */ { - /* New pointer necessary as parse_cmd modifies the pointer. */ - uint8_t *cmd = msg->buf; - /* Parse the command */ - parse_cmd(cmd); - /* and forward if it isn't dropped. */ - if (cmd) - queue_rf_cmd(cmd); + /* Parse the command and forward if it isn't dropped. */ + if (!parse_cmd(msg->buf)) + queue_rf_cmd(msg->buf); /* As we got something, there's maybe more so if the stack is not full, * continue */ - if (FifoLength(rf_cmdout_buf) <= RF_OUT_BUF_SIZE - CMD_SIZE) + if (FifoLength(rf_cmdout_buf) <= RF_BUF_SIZE - CMD_SIZE) return 1; } return 0; @@ -229,6 +231,121 @@ } /** + * \brief Initialize the I2C communication and the in and out buffers. + */ +void communication_init(void) +{ + i2c_init(); + msg_out.addr = TUXCORE_ADDR; + msg_out.len = CMD_SIZE; + msg_in.addr = TUXCORE_ADDR; + msg_in.len = CMD_SIZE; + i2c_master_receive_handler(i2c_master_receive_service); +} + +/* + * SPI communication + */ + +/** \name SPI frame constants + * @{ */ +/** Size of the audio data in the SPI frame */ +#define AUDIO_SIZE 17 + +/* Bits of the config byte */ +#define CFG_CRCOK_MK _BV(0) +#define CFG_DATA_MK _BV(1) +#define CFG_AUDIO_MK _BV(2) +#define CFG_PREVAUDIO_MK _BV(3) + +/* SPI frame organization */ +#define SPI_SIZE 51 +#define SPI_IDX_OFFSET 0 +#define SPI_CONFIG_OFFSET 1 +#define SPI_DATA_OFFSET 3 +#define SPI_AUDIO_OFFSET (SPI_DATA_OFFSET + CMD_SIZE) +#define SPI_PREVAUDIO_OFFSET (SPI_AUDIO_OFFSET + AUDIO_SIZE) +/*! @} */ + +static uint8_t frame_in_idx, frame_out_idx; +static uint8_t spi_in[52], spi_out[52], spi_idx; + +/* INT1 (PD3) Interrupt on TXE signal. */ +ISR(SIG_INTERRUPT1) +{ + //PORTB |= 0x80; // XXX DEBUG + //if (spi_idx) // XXX debug + //PORTB |= 0x80; // XXX DEBUG + spi_idx = 0; + /* Chip select */ + PORTB &= ~_BV(PB2); + SPDR = spi_out[spi_idx]; + EIMSK |= _BV(INT0); + EIFR |= _BV(INT0); + //PORTB &= ~0x80; // XXX DEBUG +} + + +/* XXX add an spi_config byte as register that could be checked by bits */ +/* INT0 (PD0) Interrupt on SPIACK signal. */ +ISR(SIG_INTERRUPT0) +{ + //PORTB |= 0x80; // XXX DEBUG + /* Check if we got the start of SPI frame (TXE). */ + /* XXX try to remove this */ + if (PORTB & _BV(PB2)) + return; + /* Check that the previous SPI transmission is done. */ + if ((SPSR & 0x80) == 0) + return; + + spi_in[spi_idx++] = SPDR; + + if (spi_idx == SPI_SIZE) + { + /* Unselect by waiting here otherwise we would have to use the SPI + * interrupt to do it. */ + PORTB |= _BV(PB2); + EIMSK &= ~_BV(INT0); + } + else + { + SPDR = spi_out[spi_idx]; + } + //PORTB &= ~0x80; // XXX DEBUG +} + +/** + * \brief Adapt the audio output rate to keep the stack at a mean level. + */ +void adapt_audio_rate(void) +{ + static uint8_t prescaler = 0; + uint8_t static prev_stack_length = 0; + uint8_t stack_length = FifoLength(PWMFifo); + bool slope = 0; + + if (++prescaler == 0) + { + if (stack_length >= prev_stack_length) + slope = 1; + prev_stack_length = stack_length; + + if (slope && stack_length > 50) + OCR0A--; + if (!slope && stack_length < 80) + OCR0A++; + + /* Limits to avoid oscillations when a lot of frames are + * dropped and to prevent jumping over 255. */ + if (OCR0A > 252) + OCR0A = 252; + if (OCR0A < 246) + OCR0A = 246; + } +} + +/** * \brief Service routine that handles the regular communication tasks like sending * and fetching commands. */ @@ -237,9 +354,89 @@ /* Clear stack when the RF is disconnected. This makes sense but is * necessary otherwise the standalone commands won't be fetched anymore * when the RF is off. */ - if (!(RF_ONLINE_PIN & RF_ONLINE_MK)) - FifoClear(rf_cmdout_buf); + /* XXX this doesn't work anymore with the current RF, to check later. */ + /*if (!(RF_ONLINE_PIN & RF_ONLINE_MK))*/ + /*FifoClear(rf_cmdout_buf);*/ + /* Fill and process RF data. */ + if (spi_idx >= SPI_SIZE) + { + uint8_t config; + uint8_t i; + + spi_idx = 0; + + /* Add data and/or audio if necessary. */ + config = 0; + if (FifoLength(rf_cmdout_buf) >= CMD_SIZE) + { + config |= CFG_DATA_MK; + for (i=0; i<CMD_SIZE; i++) + { + FifoGet(rf_cmdout_buf, &spi_out[i+SPI_DATA_OFFSET]); + } + } + if (FifoLength(ADCFifo) >= AUDIO_SIZE) + { + config |= CFG_AUDIO_MK; + for (i=0; i<AUDIO_SIZE; i++) + { + FifoGet(ADCFifo, &spi_out[i+SPI_AUDIO_OFFSET]); + } + } + spi_out[SPI_IDX_OFFSET] = frame_out_idx++; + spi_out[SPI_CONFIG_OFFSET] = config; + + /* Incoming data */ + if (frame_in_idx != spi_in[SPI_IDX_OFFSET]) + { + //PORTB |= 0x80; // XXX DEBUG + frame_in_idx = spi_in[SPI_IDX_OFFSET]; + config = spi_in[SPI_CONFIG_OFFSET]; + if (config & CFG_DATA_MK) + { + /* Parse the command and forward to tuxcore if it isn't + * dropped. */ + uint8_t *cmd = &spi_in[SPI_DATA_OFFSET]; + if (!parse_cmd(cmd)) + queue_core_cmd(cmd); + } + if (config & CFG_PREVAUDIO_MK) + { + for (i=0; i<AUDIO_SIZE; i++) + { + FifoPut(PWMFifo, spi_in[i+SPI_PREVAUDIO_OFFSET]); + } + } + if (config & CFG_AUDIO_MK) + { + adapt_audio_rate(); + + //static uint8_t cnt = 0; + for (i=0; i<AUDIO_SIZE; i++) + { + //if ((spi_in[i+SPI_AUDIO_OFFSET] == (cnt+1)) || + //(spi_in[i+SPI_AUDIO_OFFSET] == (cnt-1))) + //{ + //PORTB |= 0x80; // XXX DEBUG + //} + //else + //PORTB &= ~0x80; // XXX DEBUG + //cnt = spi_in[i+SPI_AUDIO_OFFSET]; + + //FifoPut(PWMFifo, spi_in[i+SPI_AUDIO_OFFSET]); + if (FifoPut(PWMFifo, spi_in[i+SPI_AUDIO_OFFSET]) != FIFO_OK) + PORTB |= 0x80; // XXX DEBUG + else + PORTB &= ~0x80; // XXX DEBUG + } + } + //PORTB &= ~0x80; // XXX DEBUG + } + //else + //PORTB |= 0x80; // XXX DEBUG + } + /* If busy, pass. */ if (i2c_get_status() == I2C_BUSY) return; @@ -252,21 +449,8 @@ } /* Send otherwise get commands. */ - if (!send_core_cmds()) - { - get_core_cmd(); - } + //if (!send_core_cmds()) + //{ + //get_core_cmd(); + //} } - -/** - * \brief Initialize the I2C communication and the in and out buffers. - */ -void communication_init(void) -{ - i2c_init(); - msg_out.addr = TUXCORE_ADDR; - msg_out.len = CMD_SIZE; - msg_in.addr = TUXCORE_ADDR; - msg_in.len = CMD_SIZE; - i2c_master_receive_handler(i2c_master_receive_service); -} Modified: firmware/tuxaudio/branches/new_rf/flash.c =================================================================== --- firmware/tuxaudio/branches/new_rf/flash.c 2008-06-24 10:24:05 UTC (rev 1255) +++ firmware/tuxaudio/branches/new_rf/flash.c 2008-06-24 10:34:57 UTC (rev 1256) @@ -341,11 +341,13 @@ if (numSound == 0x00) /* if unprogrammed we have 0xFF stored in flash */ { flashPlay = 0; + soundToPlay = 0; return; } if (!nsound || (nsound > numSound)) /* check the limits */ { flashPlay = 0; + soundToPlay = 0; return; } @@ -387,26 +389,31 @@ if (ad[0] > TOP_A2) { flashPlay = 0; + soundToPlay = 0; return; } /* don't read outside the flash */ if (ad[3] > TOP_A2) { flashPlay = 0; + soundToPlay = 0; return; } /* don't read outside the flash */ if ((ad[0] == 0) && (ad[1] < 0x04)) { flashPlay = 0; + soundToPlay = 0; return; } /* minimum index not respected */ if ((ad[4] == 0) && (ad[5] < 0x04)) { flashPlay = 0; + soundToPlay = 0; return; } /* minimum index not respected */ if (ad[3] < ad[0]) { flashPlay = 0; + soundToPlay = 0; return; } /* check that the stop index is greater than the start index */ else if (ad[3] == ad[0]) @@ -414,6 +421,7 @@ if (ad[4] < ad[1]) { flashPlay = 0; + soundToPlay = 0; return; } else if (ad[4] == ad[1]) @@ -421,6 +429,7 @@ if (ad[5] <= ad[2]) { flashPlay = 0; + soundToPlay = 0; return; } } @@ -450,7 +459,7 @@ static void playingSound(void) { uint8_t sound; - while (!spi_start && !FifoFull(PWMFifo)) + while (!rf_txe && !FifoFull(PWMFifo)) { sound = spiSend(0x00); // Wait response sound = sound >> audioLevel; @@ -546,7 +555,7 @@ static void programming_sound(void) { - while (!spi_start) + while (!rf_txe) { if (FifoLength(PWMFifo)) { Deleted: firmware/tuxaudio/branches/new_rf/interrupt.c =================================================================== --- firmware/tuxaudio/branches/new_rf/interrupt.c 2008-06-24 10:24:05 UTC (rev 1255) +++ firmware/tuxaudio/branches/new_rf/interrupt.c 2008-06-24 10:34:57 UTC (rev 1256) @@ -1,46 +0,0 @@ -/* - * TUXAUDIO - Firmware for the 'audio' CPU of tuxdroid - * Copyright (C) 2007 C2ME S.A. <tux...@c2...> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* $Id$ */ - -#include <avr/io.h> -#include <avr/interrupt.h> -#include "varis.h" - -// Timer 0 overflow interrupt service routine (PWM) -ISR(SIG_OVERFLOW0) -{ - if (--sampling_pwm == 0) /* timer 0 is clocked at 32KHz so we divide it by 4 to get 8KHz */ - { - ADCSRA |= 0x40; // XXX a laisser la ?? - //FIFOputMic (AudioRampCmpt); - //AudioRampCmpt++; - - sampling_pwm = 0x04; // Reinit - - OCR0B = pullFifo(&PWMFifo); /* set the sample value to timer pulse width */ -// adaptSpkFifo(); - } -} - -// External Interrupt 0 service routine PD2 -void SIG_INTERRUPT0(void) -{ - spi_ready = 1; // Set the flag SPI ready from RF -} Modified: firmware/tuxaudio/branches/new_rf/main.c =================================================================== --- firmware/tuxaudio/branches/new_rf/main.c 2008-06-24 10:24:05 UTC (rev 1255) +++ firmware/tuxaudio/branches/new_rf/main.c 2008-06-24 10:34:57 UTC (rev 1256) @@ -41,7 +41,7 @@ /* * Debug and test flags */ -#define DBG_STACK 0 +#define DBG_STACK 0 /* * Stack Overflow detection @@ -50,14 +50,33 @@ * detect any stack overflow just by looking to the memory at any breakpoint */ #if (DBG_STACK) +extern uint16_t __heap_start; void init_ram(void) __attribute__ ((naked)) __attribute__ ((section(".init1"))); void init_ram(void) { uint8_t *ptr; - for (ptr = (uint8_t *) 0x0100; ptr < (uint8_t *) 0x0300; ptr++) + for (ptr = (uint8_t *) &__heap_start; ptr < (uint8_t *) 0x800500; ptr++) *ptr = 0x5F; } + +int8_t check_stack(void) +{ + uint8_t *ptr, cnt=0; + + for (ptr = (uint8_t *) &__heap_start; ptr < (uint8_t *) 0x800500; ptr++) + { + if (*ptr == 0x5F) + cnt++; + else + cnt = 0; + if (cnt == 10) + return 1; + } + return 0; +} +#else +#define check_stack() 1 #endif /* Set when sleep should be entered */ @@ -140,8 +159,8 @@ FifoClear(PWMFifo); /* Initialise the PWM fifo */ FifoClear(ADCFifo); /* Initialise the ADC fifo */ config_init(); /* load the configuration defaults from EEPROM */ - numSound = readFlashNumber(); - last_block = readLastBlock(numSound); + /*numSound = readFlashNumber();*/ + /*last_block = readLastBlock(numSound);*/ communication_init(); /* I2C initialization */ frame_without_sound_timeout = TTS_TIMEOUT; @@ -153,7 +172,7 @@ * This delay is critical as the INT0 is quite shaky and any glitches on * INT0 at the boot of the RF CPU immeditely crash this CPU or set it in * the while(1) loop of spi.c */ - while (RF_ONLINE_PIN & RF_ONLINE_MK); + //while (RF_ONLINE_PIN & RF_ONLINE_MK); /* Activate the interrupts used by the RF module. */ EIFR = (_BV(INT1) | _BV(INT0)); EIMSK = (_BV(INT1) | _BV(INT0)); @@ -162,26 +181,33 @@ { sei(); // Reactivate global interrupt in case of flash programmation + if (!check_stack()) + while(1) + { + PORTB |= 0x80; + PORTB &= ~0x80; + } spiTransaction(); // Spi transaction from radio - if (commandRX) // commend RX from radio - { - commandRX = 0; // Reset flag - parse_cmd(spi_commandRX); + //XXX to delete + //if (commandRX) // commend RX from radio + //{ + //commandRX = 0; // Reset flag + //parse_cmd(spi_commandRX); /* XXX there are some empty commands getting through, removed from * here for now. */ - if (spi_commandRX && spi_commandRX[0]) - queue_core_cmd(spi_commandRX); - } + //if (spi_commandRX[0]) + //queue_core_cmd(spi_commandRX); + //} - if (programmingFlash) // Restora all the context for flash programming - programming(); + /*if (programmingFlash) // Restora all the context for flash programming*/ + /*programming();*/ - if (flashPlay) - playSound(); + /*if (flashPlay)*/ + /*playSound();*/ - if (eraseFlag) - erase(); + /*if (eraseFlag)*/ + /*erase();*/ /* Send commands to I2C, otherwise get new status from tuxcore */ communication_task(); @@ -224,6 +250,7 @@ else DDRD &= ~0x03; } + queue_rf_cmd_p(0xFE, FifoLength(PWMFifo), OCR0A, 0); } /* Sleep mode */ @@ -232,16 +259,98 @@ } } -// External Interrupt 0 service routine PD2 -ISR(SIG_INTERRUPT0) +//static inline void audio_sampling(void) __attribute__ ( ( always_inline ) ); +//void audio_sampling(void) __attribute__ ( ( signal ) ); +//void audio_sampling(void) +//ISR(audio_sampling) +//{ + //ADCSRA |= 0x40; // ADC started at XXX a laisser la ?? + +//#ifndef MIC_GAIN +//#define MIC_GAIN 0 [> default value if not declared in the makefile <] +//#endif +//#if (MIC_GAIN == 6) + //[> MEDIUM GAIN MODE <] + //uint8_t tmp; + + //[> Audio in: microphone <] + //tmp = ADCL; + //tmp = tmp >> 1; + //if (!(ADCH & 0x01)) [> AND the 9th bit then add 0x80 is equivalent to AND the complement of the 9th bit <] + //tmp |= 0x80; + //FifoPut_inl(ADCFifo, tmp); + //[> HIGH GAIN MODE <] +//#elif (MIC_GAIN == 12) + //uint8_t tmp; + + //tmp = ADCL + 0x80; + //FifoPut_inl(ADCFifo, tmp); + //asm volatile ("lds __tmp_reg__, %0"::"M" (_SFR_MEM_ADDR(ADCH))); [> ADCH needs to be read for the next acquisition <] +//#else [> (MIC_GAIN == 0) or anything else <] + //[> LOW GAIN MODE <] + //[>if (ADCH == 0) [> XXX RF looses connection if too much '0' are sent, but the noise should normally be enough to avoid that <]<] + //[>FifoPut(ADCFifo, 0x01);<] + //[>else<] + //FifoPut_inl(ADCFifo, ADCH); +//#endif + + //FifoGet_inl(PWMFifo, (uint8_t *)&OCR0B); [> set the sample value to timer pulse width <] + //[>if (!FifoGet(PWMFifo, (uint8_t *)&OCR0B)) [> set the sample value to timer pulse width <]<] + //[>{<] + //[>Fifoinert = 0;<] + //[>if (tuxaudio_config.automute) [> XXX mute functions should not be called here each time a sample is placed, this is silly <]<] + //[>unmute_amp();<] + //[>}<] + //[>else<] + //[>{<] + //[>Fifoinert++;<] + //[>if (Fifoinert >= 30)<] + //[>{<] + //[>if (tuxaudio_config.automute)<] + //[>mute_amp();<] + //[>Fifoinert = 30;<] + //[>//OCR0A = 250; // Normal operation for ADC sampling if FIFO Adaptative is on<] + //[>}<] + //[>}<] + //[> XXX we should move this timer away from here <] + /* send status to the behavioural CPU, 8KHz divided by 256 lead to a + * status sent each 32ms */ + //if (--sendSensorsCmpt == 0) + //sendSensorsFlag = 1; + ////asm volatile ( + ////"pop r25 \n" + ////"pop r23 \n" + ////"pop r22 \n" + ////::); +//} + +ISR(__vector_audio_sampling) { - spi_start = 1; -} + //FifoPut(ADCFifo, ADCH); + FifoGet(PWMFifo, (uint8_t *)&OCR0B); /* set the sample value to timer pulse width */ + /*if (FifoGet(PWMFifo, (uint8_t *)&OCR0B)) [> set the sample value to timer pulse width <]*/ + /*{*/ + /*PORTB &= ~0x80; // XXX DEBUG*/ + /*}*/ + /*else*/ + /*{*/ + /*PORTB |= 0x80; // XXX DEBUG*/ + /*}*/ -// External Interrupt 1 service routine PD3 -ISR(SIG_INTERRUPT1) -{ - spi_ready = 1; + //static uint8_t cnt = 0; + //static uint8_t dir = 1; +//#define STEP 8 + //OCR0B = cnt; + //if (dir) + //cnt += STEP; + //else + //cnt -= STEP; + //if ((cnt >= (0xFF - STEP)) || (cnt == 0)) + //dir = !dir; + + ADCSRA |= 0x40; + if (--sendSensorsCmpt == 0) + sendSensorsFlag = 1; } /* @@ -250,61 +359,34 @@ */ ISR(SIG_OVERFLOW0) { + uint8_t tmp = sampling_pwm; - ADCSRA |= 0x40; // ADC started at XXX a laisser la ?? - if (--sampling_pwm == 0) /* timer 0 is clocked at 32KHz so we divide it by 4 to get 8KHz */ + /* timer 0 is clocked at 32KHz so we divide it by 4 to get 8KHz */ + tmp--; + tmp &= 3; + if (tmp == 0) { - sampling_pwm = 0x04; /* reinit counter */ - -#ifndef MIC_GAIN -#define MIC_GAIN 0 /* default value if not declared in the makefile */ -#endif -#if (MIC_GAIN == 6) - /* MEDIUM GAIN MODE */ - uint8_t tmp; - - /* Audio in: microphone */ - tmp = ADCL; - tmp = tmp >> 1; - if (!(ADCH & 0x01)) /* AND the 9th bit then add 0x80 is equivalent to AND the complement of the 9th bit */ - tmp |= 0x80; - FifoPut(ADCFifo, tmp); - /* HIGH GAIN MODE */ -#elif (MIC_GAIN == 12) - uint8_t tmp; - - tmp = ADCL + 0x80; - FifoPut(ADCFifo, tmp); - asm volatile ("lds __tmp_reg__, %0"::"M" (_SFR_MEM_ADDR(ADCH))); /* ADCH needs to be read for the next acquisition */ -#else /* (MIC_GAIN == 0) or anything else */ - /* LOW GAIN MODE */ - if (ADCH == 0) /* XXX RF looses connection if too much '0' are sent, but the noise should normally be enough to avoid that */ - FifoPut(ADCFifo, 0x01); - else - FifoPut(ADCFifo, ADCH); -#endif - - if (!FifoGet(PWMFifo, (uint8_t *)&OCR0B)) /* set the sample value to timer pulse width */ - { - Fifoinert = 0; - if (tuxaudio_config.automute) /* XXX mute functions should not be called here each time a sample is placed, this is silly */ - unmute_amp(); - } - else - { - Fifoinert++; - if (Fifoinert >= 30) - { - if (tuxaudio_config.automute) - mute_amp(); - Fifoinert = 30; - //OCR0A = 250; // Normal operation for ADC sampling if FIFO Adaptative is on - } - } - /* XXX we should move this timer away from here */ - /* send status to the behavioural CPU, 8KHz divided by 256 lead to a - * status sent each 32ms */ - if (--sendSensorsCmpt == 0) - sendSensorsFlag = 1; + asm("rcall __vector_audio_sampling"::); + cli(); } + sampling_pwm = tmp; } + +//ISR(SIG_OVERFLOW0) __attribute__((naked)); +//ISR(SIG_OVERFLOW0) +//{ + ////asm volatile ( + ////"in __tmp_reg__,__SREG__" "\n\t" + ////"push r24" "\n\t" + ////"lds r24, sampling_pwm" "\n\t" + ////"subi r24, 0x01" "\n\t" + ////"andi r24, 0x03" "\n\t" + ////"sts sampling_pwm, r24" "\n\t" + ////"brne 1f" "\n\t" + ////"rcall audio_sampling" "\n\t" + ////"1: cli" "\n\t" + ////"1: pop r24" "\n\t" + ////"out __SREG__, __tmp_reg__" "\n\t" + ////"reti" "\n\t" + ////::); +//} Modified: firmware/tuxaudio/branches/new_rf/parser.c =================================================================== --- firmware/tuxaudio/branches/new_rf/parser.c 2008-06-24 10:24:05 UTC (rev 1255) +++ firmware/tuxaudio/branches/new_rf/parser.c 2008-06-24 10:34:57 UTC (rev 1256) @@ -32,94 +32,101 @@ /** * Parse a cmd received by the computer or by tuxcore and drop it if it * shouldn't be forwarded. + * \return True if the command has been parsed and shouldn't be forwarded, + * false if it should be forwarded. */ -void parse_cmd(uint8_t *cmd) +bool parse_cmd(uint8_t *cmd) { + /* XXX there are some empty commands getting through, removed from + * here for now. */ - /* - * Commands that should be forwarded - */ - - /* Ping */ - if (cmd[0] == PONG_CMD) + /* + * Commands that shouldn't be forwarded. + */ + /* Version */ + if (cmd[0] == NULL_CMD) { - /* Index of the pong that is supposed to be received from tuxcore */ - static uint8_t pong_received; - /* Counter of the missed pongs */ - static uint8_t pong_missed; - if (pong_received-- < cmd[1]) /* new ping, reset */ - { - pong_received = cmd[1]; - pong_missed = 0; - } - else /* pongs */ - { - pong_missed += pong_received - cmd[1]; - pong_received = cmd[1]; /* resync */ - } - cmd[2] = pong_missed; } - else if (cmd[0] == SLEEP_CMD) + else if (cmd[0] == INFO_TUXAUDIO_CMD) { - /* XXX sleep commented for now */ - /* Forwards the cmd to the rf CPU */ - /*cmd[0] = SLEEP_ACK_CMD;*/ - /*cmd[1] = 0;*/ - /*cmd[2] = 0;*/ - /*cmd[3] = 0;*/ - /*pre_sleep_delay = 30; [> handle sleep in its own function <]*/ - /*sleep_f = 1;*/ - /*statusFlag = 1;*/ + send_info(); } - else + else if (cmd[0] == PLAY_SOUND_CMD) + /* param: cmd[1] : sound number */ + /* cmd[2] : mic sound intensity */ { - /* - * Commands that shouldn't be forwarded. - */ - /* Version */ - if (cmd[0] == INFO_TUXAUDIO_CMD) + /* Drop the cmd if a sound is already playing */ + if (!(flashPlay || programmingFlash)) { - send_info(); - } - else if (cmd[0] == PLAY_SOUND_CMD) - /* param: cmd[1] : sound number */ - /* cmd[2] : mic sound intensity */ - { - /* postpone the cmd if a sound is already playing */ - if (flashPlay || programmingFlash) - return; audioLevel = cmd[2]; - //playingAudio(cmd[1]); /* start playing the sound */ soundToPlay = cmd[1]; flashPlay = 1; flash_state = 1; } - else if (cmd[0] == MUTE_CMD) + } + else if (cmd[0] == MUTE_CMD) + { + if (cmd[1]) + mute_amp(); + else + unmute_amp(); + } + else if (cmd[0] == STORE_SOUND_CMD) + { + if (flashPlay) + flashPlay = 0; + flash_state = 1; /* Erasing flash flag */ + programmingFlash = 1; /* Set the flag to enter programming sequence */ + } + else if (cmd[0] == ERASE_FLASH_CMD) + { + eraseFlag = 1; + } + else if (cmd[0] == CONFIRM_STORAGE_CMD) + { + if (cmd[1]) + write_toc = 1; + else + write_toc = 2; + } + else + { + /* + * Commands that should be forwarded + */ + + /* Ping */ + if (cmd[0] == PONG_CMD) { - if (cmd[1]) - mute_amp(); - else - unmute_amp(); + /* Index of the pong that is supposed to be received from tuxcore */ + static uint8_t pong_received; + /* Counter of the missed pongs */ + static uint8_t pong_missed; + if (pong_received-- < cmd[1]) /* new ping, reset */ + { + pong_received = cmd[1]; + pong_missed = 0; + } + else /* pongs */ + { + pong_missed += pong_received - cmd[1]; + pong_received = cmd[1]; /* resync */ + } + cmd[2] = pong_missed; } - else if (cmd[0] == STORE_SOUND_CMD) + else if (cmd[0] == SLEEP_CMD) { - if (flashPlay) - flashPlay = 0; - flash_state = 1; /* Erasing flash flag */ - programmingFlash = 1; /* Set the flag to enter programming sequence */ + /* XXX sleep commented for now */ + /* Forwards the cmd to the rf CPU */ + /*cmd[0] = SLEEP_ACK_CMD;*/ + /*cmd[1] = 0;*/ + /*cmd[2] = 0;*/ + /*cmd[3] = 0;*/ + /*pre_sleep_delay = 30; [> handle sleep in its own function <]*/ + /*sleep_f = 1;*/ + /*statusFlag = 1;*/ } - else if (cmd[0] == ERASE_FLASH_CMD) - { - eraseFlag = 1; - } - else if (cmd[0] == CONFIRM_STORAGE_CMD) - { - if (cmd[1]) - write_toc = 1; - else - write_toc = 2; - } - /* Drop the command */ - cmd = NULL; + return false; } + return true; } Modified: firmware/tuxaudio/branches/new_rf/parser.h =================================================================== --- firmware/tuxaudio/branches/new_rf/parser.h 2008-06-24 10:24:05 UTC (rev 1255) +++ firmware/tuxaudio/branches/new_rf/parser.h 2008-06-24 10:34:57 UTC (rev 1256) @@ -24,6 +24,6 @@ #include <stdbool.h> -void parse_cmd(uint8_t *cmd); +bool parse_cmd(uint8_t *cmd); #endif /* PARSER_H */ Modified: firmware/tuxaudio/branches/new_rf/varis.c =================================================================== --- firmware/tuxaudio/branches/new_rf/varis.c 2008-06-24 10:24:05 UTC (rev 1255) +++ firmware/tuxaudio/branches/new_rf/varis.c 2008-06-24 10:34:57 UTC (rev 1256) @@ -38,7 +38,7 @@ volatile unsigned char spi_count; volatile unsigned char spi_lenght_data; volatile unsigned char spi_ready = 0; -volatile unsigned char spi_start = 0; +volatile unsigned char rf_txe = 0; volatile uint8_t spi_commandTX[5]; unsigned char spi_commandRX[5]; unsigned char commandRX = 0; Modified: firmware/tuxaudio/branches/new_rf/varis.h =================================================================== --- firmware/tuxaudio/branches/new_rf/varis.h 2008-06-24 10:24:05 UTC (rev 1255) +++ firmware/tuxaudio/branches/new_rf/varis.h 2008-06-24 10:34:57 UTC (rev 1256) @@ -40,7 +40,7 @@ extern volatile unsigned char spi_count; extern volatile unsigned char spi_lenght_data; extern volatile unsigned char spi_ready; -extern volatile unsigned char spi_start; +extern volatile unsigned char rf_txe; extern uint8_t spi_commandTX[5]; extern unsigned char spi_commandRX[5]; extern unsigned char commandRX; |
From: jaguarondi <c2m...@c2...> - 2008-06-24 10:23:56
|
Author: jaguarondi Date: 2008-06-24 12:24:05 +0200 (Tue, 24 Jun 2008) New Revision: 1255 Added: firmware/tuxaudio/branches/new_rf/ Log: * Added a new branch for the refactoring of the RF. Copied: firmware/tuxaudio/branches/new_rf (from rev 1245, firmware/tuxaudio/trunk) |
From: jaguarondi <c2m...@c2...> - 2008-06-24 10:16:26
|
Author: jaguarondi Date: 2008-06-24 12:16:32 +0200 (Tue, 24 Jun 2008) New Revision: 1254 Added: firmware/rf/ firmware/rf/trunk/ firmware/rf/trunk/Makefile firmware/rf/trunk/defines.h firmware/rf/trunk/device.c firmware/rf/trunk/init.c firmware/rf/trunk/init.h firmware/rf/trunk/interface.c firmware/rf/trunk/interface.h firmware/rf/trunk/misc.c firmware/rf/trunk/misc.h firmware/rf/trunk/prot.c firmware/rf/trunk/prot.h firmware/rf/trunk/rf_ctrl.c firmware/rf/trunk/rf_ctrl.h firmware/rf/trunk/varis.c firmware/rf/trunk/varis.h Removed: firmware/fuxrf/ firmware/rf/trunk/ firmware/rf/trunk/default/ firmware/rf/trunk/defines.h firmware/rf/trunk/device.aps firmware/rf/trunk/device.c firmware/rf/trunk/init.c firmware/rf/trunk/init.h firmware/rf/trunk/misc.c firmware/rf/trunk/misc.h firmware/rf/trunk/prot.c firmware/rf/trunk/prot.h firmware/rf/trunk/rf_ctrl.c firmware/rf/trunk/rf_ctrl.h firmware/rf/trunk/varis.c firmware/rf/trunk/varis.h firmware/tuxrf/ Log: * Both RF now share the same code. Use TYPE={slave,master} to compile one or the other. Copied: firmware/rf (from rev 1016, firmware/fuxrf) Property changes on: firmware/rf ___________________________________________________________________ Name: svn:mergeinfo + Copied: firmware/rf/trunk (from rev 1252, firmware/fuxrf/trunk) Copied: firmware/rf/trunk/Makefile (from rev 1253, firmware/fuxrf/trunk/Makefile) =================================================================== --- firmware/rf/trunk/Makefile (rev 0) +++ firmware/rf/trunk/Makefile 2008-06-24 10:16:32 UTC (rev 1254) @@ -0,0 +1,122 @@ +############################################################################### +# Makefile for the project device +############################################################################### + +## General Flags +MCU = atmega48 +TARGET = fuxrf.elf +CC = avr-gcc +AVRDUDE = avrdude + +## Options common to compile, link and assembly rules +COMMON = -mmcu=$(MCU) + +## Compile options common for all C compilation units. +CFLAGS = $(COMMON) +CFLAGS += -Wall -gstabs -DF_CPU=13824000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums +CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d +ifneq (,$(findstring master, $(TYPE))) + PROJECT = fuxrf + CFLAGS += -D_MASTER +else + ifneq (,$(findstring slave, $(TYPE))) + PROJECT = tuxrf + CFLAGS += -D_SLAVE + endif +endif + + +## Assembly specific flags +ASMFLAGS = $(COMMON) +ASMFLAGS += -x assembler-with-cpp -Wa,-gstabs + +## Linker flags +LDFLAGS = $(COMMON) + +## Intel Hex file production flags +HEX_FLASH_FLAGS = -R .eeprom + +HEX_EEPROM_FLAGS = -j .eeprom +HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load" +HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0 + +## Objects that must be built in order to link +OBJECTS = device.o init.o misc.o prot.o rf_ctrl.o varis.o interface.o #bootloader.o + +## Objects explicitly added by the user +LINKONLYOBJECTS = + +## Build +all: $(TARGET) fuxrf.hex fuxrf.eep fuxrf.lss size + +## Compile +device.o: device.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +init.o: init.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +misc.o: misc.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +prot.o: prot.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +rf_ctrl.o: rf_ctrl.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +varis.o: varis.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +interface.o: interface.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +bootloader.o: bootloader.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +##Link +$(TARGET): $(OBJECTS) + $(CC) $(LDFLAGS) $(OBJECTS) $(LINKONLYOBJECTS) $(LIBDIRS) $(LIBS) -o $(TARGET) + +%.hex: $(TARGET) + avr-objcopy -O ihex $(HEX_FLASH_FLAGS) $< $@ + +%.eep: $(TARGET) + avr-objcopy $(HEX_EEPROM_FLAGS) -O ihex $< $@ + +%.lss: $(TARGET) + avr-objdump -h -S $< > $@ + +size: ${TARGET} + @echo + @avr-size ${TARGET} + +## Clean target +.PHONY: clean +clean: + -rm -rf $(OBJECTS) device.elf dep/* device.hex device.eep device.lss device.map + + +## Other dependencies +-include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*) + +# Programming +prog: $(PROJECT).hex + tuxup $(PROJECT).hex $(PROJECT).eep + +dwen: + $(AVRDUDE) -p $(MCU) -c jtag2isp -P usb -B 10 -U hfuse:w:0x95:m + +nodwen: + $(AVRDUDE) -p $(MCU) -c jtag2isp -P usb -B 10 -U hfuse:w:0xD5:m + +debug: + avarice -P $(MCU) -B 1000 -2 -w -j usb -p -f $(PROJECT).elf :4242 + +progisp: $(PROJECT).hex $(PROJECT).eep + $(AVRDUDE) -p $(MCU) -c jtag2isp -P usb -B 10 -e \ + -U flash:w:$(PROJECT).hex + +progstk: $(PROJECT).hex $(PROJECT).eep + $(AVRDUDE) -p $(MCU) -c stk500v2 -e -U flash:w:$(PROJECT).hex \ + -U eeprom:w:$(PROJECT).eep Deleted: firmware/rf/trunk/defines.h =================================================================== --- firmware/fuxrf/trunk/defines.h 2008-06-24 09:27:28 UTC (rev 1252) +++ firmware/rf/trunk/defines.h 2008-06-24 10:16:32 UTC (rev 1254) @@ -1,106 +0,0 @@ -#ifndef DEFINES_H -#define DEFINES_H - -// Include defines for target MCU -#include <avr/io.h> -#include <compat/ina90.h> -#include <avr/interrupt.h> -#include <avr/pgmspace.h> -#include <avr/eeprom.h> - -// Define the used HOPPING SCHEME -#define HOPPING // No hopping, use signel channel TRX_CHANNEL. If no define use frequency hopping -#define TRX_CHANNEL 90 -#define FHA // Use frequency hopping adaptativ - -#define WIFI - -//------->rf_status-Defines<-------// -#define WAIT_HOPPING 0x02 -#define RXING 0x04 -#define TXING 0x08 -#define LOGGED 0x10 -#define FHA_EFFECTIVE 0x20 -#define MASTER 0x40 -#define SLAVE 0x80 -//------->rf_status-Defines<-------// - -//----->Header-Byte_1-Defines<-----// -#define MASTERH 0x01 -#define SLAVEH 0x02 -#define LOGGEDH 0x04 -#define FHTRSEQ 0x08 -#define FHAACKH 0x10 -#define CHANGEID 0x20 -#define REQUESTID 0x40 -#define SMALLFRAME 0x80 -//----->Header-Byte_1-Defines<-----// - -//------->FHAState-Defines<-------// -#define INIT 0x01 -#define SEND_SEQUENCE 0x02 -#define WAIT_SYNCHRO 0x04 -#define WAIT_ACK_CHF 0x10 -#define DO_UPDATE 0x20 -#define COMPUTE_FREQ 0x40 -//------->FHAState-Defines<-------// - -//------->RFinitState-Defines<-------// -#define WAIT_SLAVE 0x01 -#define WAIT_LOG 0x02 -#define SEND_FS 0x03 -#define WAIT_SYNCHRO 0x04 -//------->RFinitState-Defines<-------// - -//----->Assembler Definitions<-----// -#define _RETI __asm__ __volatile__ ("reti") -#define _NIX __asm__ __volatile__ ("nop") -#define _READ_FB __LPM -#define __EEPROM__ __attribute__((section(".eeprom"))) -#define SIGNAL_NAKED(signame)\ -void signame (void) __attribute__ ((signal)) __attribute__ ((naked));\ -void signame (void) -//----->Assembler Definitions<-----// - -//----->Hardware Definitions<-----// -#define set_clock __asm__ __volatile__ ("sbi 0x0B,4") //D.4# CLOCK PORTD.4 -#define clr_clock __asm__ __volatile__ ("cbi 0x0B,4") //D.4# CLOCK PORTD.4 -#define set_data __asm__ __volatile__ ("sbi 0x0B,1") //D.1# TXD/D PORTD.1 -#define clr_data __asm__ __volatile__ ("cbi 0x0B,1") //D.1# TXD/D PORTD.1 -#define set_enable __asm__ __volatile__ ("sbi 0x08,1") //C.1# ENABLE PORTC.1 -#define clr_enable __asm__ __volatile__ ("cbi 0x08,1") //C.1# ENABLE PORTC.1 -#define set_rxon __asm__ __volatile__ ("sbi 0x0B,5") //D.5# RXON PORTD.5 -#define clr_rxon __asm__ __volatile__ ("cbi 0x0B,5") //D.5# RXON PORTD.5 -#define set_txon __asm__ __volatile__ ("sbi 0x05,0") //B.0# TXON PORTB.0 -#define clr_txon __asm__ __volatile__ ("cbi 0x05,0") //B.0# TXON PORTB.0 -#define set_pupwr __asm__ __volatile__ ("sbi 0x0B,2") //D.2# PU_PWR PORTD.2 -#define clr_pupwr __asm__ __volatile__ ("cbi 0x0B,2") //D.2# PU_PWR PORTD.2 -#define set_nole __asm__ __volatile__ ("sbi 0x05,1") //B.1# OLE PORTB.1 -#define clr_nole __asm__ __volatile__ ("cbi 0x05,1") //B.1# OLE PORTB.1 -#define in_rxd input(PIND)&0x01 //# RXD PIND.0 -//----->Hardware Definitions<-----// - -//----->RF-Config-Word-Defines<-----// -#define TXEN 0x01 // XXX -#define RXEN 0x00 // XXX -#define CH00TX 0x1B -#define CH00RX 0x1C -//----->RF-Config-Word-Defines<-----// - -//----->RF-Timing-Defines<-----// - // T_SLOT == 1ms ==> every 1000us 48 Bytes of payload are exchanged -#define POLL_LOOPS 1 -#define T_1ms 1728 // Exact -> 1000us -#define T_PWR_UP_TX 69 // 69 == 40us (39.93) -#define T_LOOP_TX 341 // 341 == 197us (197.34) -#define T_START_TX 59 // 59 == 34us (34.14) -#define T_TX2RX 1259 // 1259 == 728us (728.59) -#define T_PWR_UP_RX 69 // 69 == 40us (39.93) -#define T_LOOP_RX 139 // 139 == 80us (80.44) -#define T_RX_ON 260 // 260 == 150us (150.46) -#define T_MAX_PAC_RX 1088 // 1088 == 630us (629.62) -#define T_RX2TX 172 // 172 == 100us (99.54) - // ==> 48KB/second (384.000bps) -//----->RF-Timing-Defines<-----// - -#endif Copied: firmware/rf/trunk/defines.h (from rev 1253, firmware/fuxrf/trunk/defines.h) =================================================================== --- firmware/rf/trunk/defines.h (rev 0) +++ firmware/rf/trunk/defines.h 2008-06-24 10:16:32 UTC (rev 1254) @@ -0,0 +1,228 @@ +//***************************************************************************** +//* Project: RF-Firmware Point to Multipoint for ISM - Transceiver ATR2406 * +//* Version: V1.0 * +//* File: defines.h * +//* Target MCU: ATMega88 * +//* Compiler: GCC * +//* Simulator: AVRStudio 4.08 * +//* Emulator: JTAG ICE * +//* Author: Christian Bechter * +//* Date: 31.01.06 * +//* Used Hardware: DEV-KIT-III * +//***************************************************************************** +//***************************************************************************** +//* Copyright 2006, Atmel Germany GmbH * +//* * +//* This software is owned by the Atmel Germany GmbH * +//* and is protected by and subject to worldwide patent protection. * +//* Atmel hereby grants to licensee a personal, * +//* non-exclusive, non-transferable license to copy, use, modify, create * +//* derivative works of, and compile the Atmel Source Code and derivative * +//* works for the sole purpose of creating custom software in support of * +//* licensee product to be used only in conjunction with a Atmel integrated * +//* circuit as specified in the applicable agreement. Any reproduction, * +//* modification, translation, compilation, or representation of this * +//* software except as specified above is prohibited without the express * +//* written permission of Atmel. * +//* * +//* Disclaimer: ATMEL MAKES NO WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, * +//* WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * +//* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * +//* Atmel reserves the right to make changes without further notice to the * +//* materials described herein. Atmel does not assume any liability arising * +//* out of the application or use of any product or circuit described herein. * +//* Atmel does not authorize its products for use as critical components in * +//* life-support systems where a malfunction or failure may reasonably be * +//* expected to result in significant injury to the user. The inclusion of * +//* Atmel products in a life-support systems application implies that the * +//* manufacturer assumes all risk of such use and in doing so indemnifies * +//* Atmel against all charges. * +//* * +//* Use may be limited by and subject to the applicable Atmel software * +//* license agreement. * +//***************************************************************************** +#ifndef DEFINES_H +#define DEFINES_H + +//include defines for target MCU +#include <avr/io.h> +#include <compat/ina90.h> +#include <avr/interrupt.h> +#include <avr/pgmspace.h> +#include <avr/eeprom.h> + +//**Define the used HOPPING SCHEME**// +//#define HOPPING +#define NOHOPP +#define TRX_CHANNEL 4 +//#define CYCHOPP +//**Define the used HOPPING SCHEME**// + +#define TXEN 0x01 +#define RXEN 0x00 +#define CONNECTED 0x80 + +#define TXING 0x08 +#define RXING 0x04 +#define MASTER 0x40 +#define SLAVE 0x80 + +//returns the address owned by the given label in registers R31:R30 +/* XXX ? delete? */ +#define GET_LABEL_ADDRESS(addr)\ +{\ + __asm__ __volatile__ ("\n"::"z"(addr));\ +} + +#define _NIX __asm__ __volatile__ ("nop") +//Hardware Definitions + +#define CLOCK_PORT PORTD +#define CLOCK_DDR DDRD +#define CLOCK_OUT PD4 +#define DATA_PORT PORTD +#define DATA_DDR DDRD +#define DATA_OUT PD1 +#define ENABLE_PORT PORTC +#define ENABLE_DDR DDRC +#define ENABLE_OUT PC1 +#define RXON_PORT PORTD +#define RXON_DDR DDRD +#define RXON_OUT PD5 +#define TXON_PORT PORTB +#define TXON_DDR DDRB +#define TXON_OUT PB0 +#define PUPWR_PORT PORTD +#define PUPWR_DDR DDRD +#define PUPWR_OUT PD2 +#define nOLE_PORT PORTB +#define nOLE_DDR DDRB +#define nOLE_OUT PB1 + +#define set_clock() (CLOCK_PORT |= _BV(CLOCK_OUT)) +#define clr_clock() (CLOCK_PORT &= ~_BV(CLOCK_OUT)) +#define set_data() (DATA_PORT |= _BV(DATA_OUT)) +#define clr_data() (DATA_PORT &= ~_BV(DATA_OUT)) +#define set_enable() (ENABLE_PORT |= _BV(ENABLE_OUT)) +#define clr_enable() (ENABLE_PORT &= ~_BV(ENABLE_OUT)) +#define set_rxon() (RXON_PORT |= _BV(RXON_OUT)) +#define clr_rxon() (RXON_PORT &= ~_BV(RXON_OUT)) +#define set_txon() (TXON_PORT |= _BV(TXON_OUT)) +#define clr_txon() (TXON_PORT &= ~_BV(TXON_OUT)) +#define set_pupwr() (PUPWR_PORT |= _BV(PUPWR_OUT)) +#define clr_pupwr() (PUPWR_PORT &= ~_BV(PUPWR_OUT)) +#define set_nole() (nOLE_PORT |= _BV(nOLE_OUT)) +#define clr_nole() (nOLE_PORT &= ~_BV(nOLE_OUT)) + +#define in_rxd input(PIND)&0x01 //# RXD PIND.0 +//Hardware Definitions + +//----->RF-Specifc-Defines<-----// +/* S[SC] of channel 0 in TX mode, p. 10 of datasheet */ +#define CH00TX 27 +/* S[SC] of channel 0 in RX mode, p. 10 of datasheet */ +#define CH00RX 28 +//----->RF-Specifc-Defines<-----// + + //T_SLOT == 1ms ==> every 1000us 48Bytes of payload are exchanged + #define POLL_LOOPS 4 + #define T_1ms 1728 //exact -> 1000us + #define T_PWR_UP_TX 69 //69 == 40us(39.93) + #define T_LOOP_TX 363 //363 == 210us(210.07) + #define T_TX2RX 1296 //1296 == 750us(749.99) + #define T_PWR_UP_RX 69 //69 == 40us(39.93) + #define T_LOOP_RX 276 //276 == 160us(159.72) + #define T_RX_ON 87 //87 == 50us(50.35) + #define T_MAX_PAC_RX 1124 //1124 == 650us(650.46) + #define T_RX2TX 172 //172 == 100us(99.54) + #define T_TS_SOLL 979 //979 == 566.32us(566.55) + #define T_START_SYNC 1086//1065 - 31 //(1065 - 31) == 616.32us(616.09) [31 == calc time!!(17.94us)] + #define T_SYNC 1086//1065 //1065 == 616.32(616.32) + // ==> 48KB/second (384.000bps) + +/* + //T_SLOT == 1.1ms ==> every 1100us 48Bytes of payload are exchanged + #define POLL_LOOPS 2 + #define T_1100us 1901 // -> 1100us(1100.11574) + #define T_PWR_UP_TX 70 //70 == 40us(40.51) + #define T_LOOP_TX 535 //535 == 310us(309.61) + #define T_TX2RX 1296 //1296 == 750us(749.99) + #define T_PWR_UP_RX 70 //70 == 40us(40.51) + #define T_LOOP_RX 448 //448 == 260us(259.26) + #define T_RX_ON 87 //87 == 50us(50.35) + #define T_MAX_PAC_RX 1124 //1124 == 650us(650.46) + #define T_RX2TX 172 //172 == 100us(99.54) + #define T_TS_SOLL 979 //979 == 566.32us(566.55) + #define T_START_SYNC 1065 - 31 //(1065 - 31) == 598.38us [31 == calc time!!(17.94us)] + #define T_SYNC 1065 //1065 == 616.32(616.32) + // ==> 43.6KB/second (349.090bps) +*/ +/* + //T_SLOT == 2ms ==> every 2000us 48Bytes of payload are exchanged + #define POLL_LOOPS 2 + #define T_2ms 3456 //exact -> 2000us + #define T_PWR_UP_TX 70 //70 == 40us(40.51) + #define T_LOOP_TX 605 //605 == 350us(350.11) + #define T_TX2RX 2781 //2781 == 1610us(1609.37) + #define T_PWR_UP_RX 70 //70 == 40us(40.51) + #define T_LOOP_RX 518 //518 == 300us(299.77) + #define T_RX_ON 87 //87 == 50us(50.35) + #define T_MAX_PAC_RX 1124 //1124 == 650us(650.46) + #define T_RX2TX 1657 //1657 == 960us(958.91) + #define T_START_SYNC 2550 - 31 //(2550 - 31) == 1475.69us [31 == calc time!!(17.94us)] + #define T_SYNC 2550 //2550 == 1475.69us + // ==> 24KB/second (192.000bps) +*/ +/* + //T_SLOT == 4ms ==> every 4000us 48Bytes of payload are exchanged + #define POLL_LOOPS 4 + #define T_4ms 6912 //exact -> 4000us + #define T_PWR_UP_TX 70 //70 == 40us(40.51) + #define T_LOOP_TX 605 //605 == 350us(350.11) + #define T_TX2RX 6237 //6237 == 3610us(3609.37) + #define T_PWR_UP_RX 70 //70 == 40us(40.51) + #define T_LOOP_RX 518 //518 == 300us(299.77) + #define T_RX_ON 87 //87 == 50us(50.35) + #define T_MAX_PAC_RX 1124 //1124 == 650us(650.46) + #define T_RX2TX 5113 //5113 == 2960us(2958.91) + #define T_START_SYNC 6006 - 31 //(6006 - 31) == 3475.69us [31 == calc time!!(17.94us)] + #define T_SYNC 6006 //6006 == 3475.69us + // ==> 12KB/second (96.000bps) +*/ +/* + //T_SLOT == 8ms ==> every 8000us 48Bytes of payload are exchanged + #define POLL_LOOPS 8 + #define T_8ms 13824 //exact -> 8000us + #define T_PWR_UP_TX 70 //70 == 40us(40.51) + #define T_LOOP_TX 605 //605 == 350us(350.11) + #define T_TX2RX 13149 //13149 == 7610us(7609.37) + #define T_PWR_UP_RX 70 //70 == 40us(40.51) + #define T_LOOP_RX 518 //518 == 300us(299.77) + #define T_RX_ON 87 //87 == 50us(50.35) + #define T_MAX_PAC_RX 1124 //1124 == 650us(650.46) + #define T_RX2TX 12025 //12025 == 6960us(6958.91) + #define T_START_SYNC 12918 - 31 //(12918 - 31) == 7475.69us [31 == calc time!!(17.94us)] + #define T_SYNC 12918 //12918 == 7475.69us + // ==> 6KB/second (48.000bps) +*/ +/* + //T_SLOT == 16ms ==> every 16000us 48Bytes of payload are exchanged + #define POLL_LOOPS 16 + #define T_16ms 27648 //exact -> 16000us + #define T_PWR_UP_TX 70 //70 == 40us(40.51) + #define T_LOOP_TX 605 //605 == 350us(350.11) + #define T_TX2RX 26973 //26973 == 15610us(15609.37) + #define T_PWR_UP_RX 70 //70 == 40us(40.51) + #define T_LOOP_RX 518 //518 == 300us(299.77) + #define T_RX_ON 87 //87 == 50us(50.35) + #define T_MAX_PAC_RX 1124 //1124 == 650us(650.46) + #define T_RX2TX 25849 //25849 == 14960us(14958.91) + #define T_START_SYNC 26742 - 31 //(26742 - 31) == 15475.69us [31 == calc time!!(17.94us)] + #define T_SYNC 26742 //26742 == 15475.69us + // ==> 3KB/second (24.000bps) +*/ +#define LED_ON __asm__ __volatile__ ("sbi 0x05,2") //B.2 +#define LED_OFF __asm__ __volatile__ ("cbi 0x05,2") //B.2 + +#endif + Deleted: firmware/rf/trunk/device.aps =================================================================== --- firmware/fuxrf/trunk/device.aps 2008-06-24 09:27:28 UTC (rev 1252) +++ firmware/rf/trunk/device.aps 2008-06-24 10:16:32 UTC (rev 1254) @@ -1 +0,0 @@ -<AVRStudio><MANAGEMENT><ProjectName>device</ProjectName><Created>10-Nov-2005 15:17:29</Created><LastEdit>01-Oct-2007 14:04:44</LastEdit><ICON>241</ICON><ProjectType>0</ProjectType><Created>10-Nov-2005 15:17:29</Created><Version>4</Version><Build>4, 12, 0, 454</Build><ProjectTypeName>AVR GCC</ProjectTypeName></MANAGEMENT><CODE_CREATION><ObjectFile>default\device.elf</ObjectFile><EntryFile></EntryFile><SaveFolder>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET>JTAGICE mkII</CURRENT_TARGET><CURRENT_PART>ATmega168</CURRENT_PART><BREAKPOINTS></BREAKPOINTS><IO_EXPAND><Item>51</Item><Item>580</Item><Item>103</Item><Item>17</Item><HIDE>false</HIDE></IO_EXPAND><REGISTERNAMES><Register>R00</Register><Register>R01</Register><Register>R02</Register><Register>R03</Register><Register>R04</Register><Register>R05</Register><Register>R06</Register><Register>R07</Register><Register>R08</Register><Register>R09</Register><Register>R10</Register><Register>R11</Register><Register>R12</Register><Register>R13</Register><Register>R14</Register><Register>R15</Register><Register>R16</Register><Register>R17</Register><Register>R18</Register><Register>R19</Register><Register>R20</Register><Register>R21</Register><Register>R22</Register><Register>R23</Register><Register>R24</Register><Register>R25</Register><Register>R26</Register><Register>R27</Register><Register>R28</Register><Register>R29</Register><Register>R30</Register><Register>R31</Register></REGISTERNAMES><COM>Auto</COM><COMType>0</COMType><WATCHNUM>1</WATCHNUM><WATCHNAMES><Pane0><Variables>ts</Variables><Variables>i</Variables><Variables>rf_rx_state</Variables><Variables>checksum</Variables><Variables>protocol_flags</Variables><Variables>rf_buffer_tx</Variables><Variables>channel</Variables><Variables>FHAState</Variables><Variables>frequencyTable</Variables><Variables>commandStatus</Variables></Pane0><Pane1><Variables>ACKmode</Variables><Variables>sof_ary</Variables><Variables>toy_id_h</Variables><Variables>toy_id_l</Variables><Variables>prf_buffer_tx</Variables><Variables>rf_tx_counter</Variables><Variables>tx_pac_len</Variables><Variables>rf_buffer_rx1</Variables><Variables>rf_buffer_rx2</Variables><Variables>pspi_buffer_rx</Variables><Variables>rf_buffer_tx2</Variables><Variables>rf_buffer_tx1</Variables><Variables>pspi_buffer_tx</Variables><Variables>rf_header</Variables><Variables>rf_status</Variables><Variables>watchdog</Variables><Variables>gfilter</Variables><Variables>replaceFrequency</Variables><Variables>frequencyTable</Variables><Variables>commandBuffer</Variables><Variables>spiConfigFrame</Variables></Pane1><Pane2></Pane2><Pane3></Pane3></WATCHNAMES><BreakOnTrcaeFull>0</BreakOnTrcaeFull></DEBUG_TARGET><Debugger><modules><module><map private="C:\Documents and Settings\Pascal\Desktop\TUX\Dongle\RF\Branches\RF_test\Branches\" public=""/><map private="C:\Documents and Settings\Pascal\Desktop\TUX\Dongle\RF\New_timing\" public=""/></module></modules><Triggers></Triggers></Debugger><AVRGCCPLUGIN><FILES><SOURCEFILE>device.c</SOURCEFILE><SOURCEFILE>init.c</SOURCEFILE><SOURCEFILE>misc.c</SOURCEFILE><SOURCEFILE>prot.c</SOURCEFILE><SOURCEFILE>rf_ctrl.c</SOURCEFILE><SOURCEFILE>varis.c</SOURCEFILE><SOURCEFILE>spi.c</SOURCEFILE><SOURCEFILE>bootloader.c</SOURCEFILE><HEADERFILE>varis.h</HEADERFILE><HEADERFILE>init.h</HEADERFILE><HEADERFILE>misc.h</HEADERFILE><HEADERFILE>prot.h</HEADERFILE><HEADERFILE>rf_ctrl.h</HEADERFILE><HEADERFILE>defines.h</HEADERFILE><HEADERFILE>bootloader.h</HEADERFILE><HEADERFILE>spi.h</HEADERFILE><HEADERFILE>version.h</HEADERFILE><HEADERFILE>common\commands.h</HEADERFILE><OTHERFILE>default\device.lss</OTHERFILE><OTHERFILE>default\device.map</OTHERFILE></FILES><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>NO</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE></EXTERNALMAKEFILE><PART>atmega48</PART><HEX>1</HEX><LIST>1</LIST><MAP>1</MAP><OUTPUTFILENAME>device.elf</OUTPUTFILENAME><OUTPUTDIR>default\</OUTPUTDIR><ISDIRTY>1</ISDIRTY><OPTIONS><OPTION><FILE>bootloader.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>device.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>init.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>misc.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>prot.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>rf_ctrl.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>spi.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>varis.c</FILE><OPTIONLIST></OPTIONLIST></OPTION></OPTIONS><INCDIRS/><LIBDIRS/><LIBS/><LINKOBJECTS/><OPTIONSFORALL>-Wall -gdwarf-2 -DF_CPU=13824000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums</OPTIONSFORALL><LINKEROPTIONS>-Wl,--section-start=.bootloader=0x0F00 -Wl,--section-start=.version=0x0EF0</LINKEROPTIONS><SEGMENTS><SEGMENT><NAME>.buffer_tx1</NAME><SEGMENT>SRAM</SEGMENT><ADDRESS>0x100</ADDRESS></SEGMENT><SEGMENT><NAME>.buffer_rx1</NAME><SEGMENT>SRAM</SEGMENT><ADDRESS>0x140</ADDRESS></SEGMENT><SEGMENT><NAME>.sof</NAME><SEGMENT>SRAM</SEGMENT><ADDRESS>0x1e6</ADDRESS></SEGMENT><SEGMENT><NAME>.globals</NAME><SEGMENT>SRAM</SEGMENT><ADDRESS>0x1ea</ADDRESS></SEGMENT><SEGMENT><NAME>.buffer_tx2</NAME><SEGMENT>SRAM</SEGMENT><ADDRESS>0x173</ADDRESS></SEGMENT><SEGMENT><NAME>.buffer_rx2</NAME><SEGMENT>SRAM</SEGMENT><ADDRESS>0x1b3</ADDRESS></SEGMENT></SEGMENTS></CONFIG></CONFIGS><LASTCONFIG>default</LASTCONFIG><USES_WINAVR>1</USES_WINAVR><GCC_LOC>C:\WinAVR-20060421\bin\avr-gcc.exe</GCC_LOC><MAKE_LOC>C:\WinAVR-20060421\utils\bin\make.exe</MAKE_LOC></AVRGCCPLUGIN><IOView><usergroups/></IOView><ProjectFiles><Files><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\varis.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\init.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\misc.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\prot.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\rf_ctrl.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\defines.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\bootloader.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\spi.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\version.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\common\commands.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\device.c</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\init.c</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\misc.c</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\prot.c</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\rf_ctrl.c</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\varis.c</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\spi.c</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\bootloader.c</Name></Files></ProjectFiles><Files><File00000><FileId>00000</FileId><FileName>device.c</FileName><Status>1</Status></File00000><File00001><FileId>00001</FileId><FileName>prot.c</FileName><Status>258</Status></File00001><File00002><FileId>00002</FileId><FileName>rf_ctrl.c</FileName><Status>258</Status></File00002><File00003><FileId>00003</FileId><FileName>init.c</FileName><Status>258</Status></File00003><File00004><FileId>00004</FileId><FileName>misc.c</FileName><Status>258</Status></File00004><File00005><FileId>00005</FileId><FileName>spi.c</FileName><Status>258</Status></File00005><File00006><FileId>00006</FileId><FileName>rf_ctrl.h</FileName><Status>1</Status></File00006></Files><Workspace><File00000><Position>329 132 1321 417</Position><LineCol>0 0</LineCol></File00000><File00006><Position>303 72 1391 507</Position><LineCol>48 49</LineCol><State>Maximized</State></File00006></Workspace><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio> Deleted: firmware/rf/trunk/device.c =================================================================== --- firmware/fuxrf/trunk/device.c 2008-06-24 09:27:28 UTC (rev 1252) +++ firmware/rf/trunk/device.c 2008-06-24 10:16:32 UTC (rev 1254) @@ -1,114 +0,0 @@ -#include <avr/wdt.h> -#include <stdlib.h> -#include "defines.h" -#include "init.h" -#include "misc.h" -#include "varis.h" -#include "prot.h" -#include "rf_ctrl.h" -#include "spi.h" -#include "common/commands.h" -#include "version.h" - -/* - * Configuration - */ -/* Bootloader can be included with the program. */ -#define BOOTLOADER 1 -/* Include version numbers. */ -#define VERSIONING 1 - -/* - * Version number - */ - -#define CPU_NUMBER FUXRF_CPU_NUM /* sound CPU */ - -#if (VERSIONING) -/* XXX Add the linker script to have fixed version positions once the project will compile with latest gcc under linux. */ -const author_t author __attribute__ ((section(".version"))) = -{ - AUTHOR_CMD, AUTHOR_ID, 0, -}; -const revision_t svn_revision __attribute__ ((section(".version"))) = -{ - REVISION_CMD, SVN_REV, SVN_STATUS, -}; -const version_t tag_version __attribute__ ((section(".version"))) = -{ - VERSION_CMD, CPU_VER_JOIN(CPU_NUMBER, VER_MAJOR), VER_MINOR, VER_UPDATE, -}; -#endif - -#if (BOOTLOADER) -#include "bootloader.h" -#endif - -#ifdef WIFI -const unsigned char OffsetTbl[] = - { 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41 }; -#endif - -//***************************************************************************** -//* Project: RF-Firmware for ISM * -//* Function: main * -//* Parameters: NONE * -//* Returns: NONE * -//* Action: Main routine of the Device * -//* Duration: tbd * -//* Size: tbd * -//* Date: 26.06.07 * -//* Description: Get connected to the tux, manage sleep mode and SPI * -//***************************************************************************** - -//MASTER -int main(void) -{ -#if (BOOTLOADER) - if (!(PINB & 0x04)) /* if SPI_SS is cleared at startup */ - asm volatile ("rjmp bootloader"::); /* jump to bootloader */ -#endif - - init_avr(); // System init - init_varis(); // Init variables - spiTransaction(); // Spi transaction to recieve -// spiConfigFrame[5] = 6; -// spiConfigFrame[6] = 32; - generate_frequency_sequence(); // Generate hopping sequence - init_frame_RF(); // Init RF frame - sei(); - gfilter = eeprom_read_byte(&ee_filter); // Read gaussian filter into the eeprom - if (gfilter == 0xFF) // No value program in the eeprom - gfilter = 5; - gfilter = (gfilter << 1); // Configure gaussian filter - system_start_up(); // Start RF connection - PORTD &= ~0x80; // On line radio - - while (1) // Infinite main loop - { -#ifdef WIFI - if (FHAState == COMPUTE_FREQ) - { - while (1) - { - replaceFrequency += OffsetTbl[random_numb]; // Calculate next channel - if (replaceFrequency >= 93) - replaceFrequency -= 91; - random_numb++; - if (random_numb == 12) - random_numb = 0; - if ((replaceFrequency < spiConfigFrame[5]) - || (replaceFrequency > spiConfigFrame[6])) - break; - } - FHAState = WAIT_ACK_CHF; - } -#endif - - if (spi_enable) // Spi transaction ready - { - spi_enable = 0; // Reset spi flag - spiTransaction(); - } - } -} Copied: firmware/rf/trunk/device.c (from rev 1253, firmware/fuxrf/trunk/device.c) =================================================================== --- firmware/rf/trunk/device.c (rev 0) +++ firmware/rf/trunk/device.c 2008-06-24 10:16:32 UTC (rev 1254) @@ -0,0 +1,106 @@ +//***************************************************************************** +//* Project: RF-Firmware Point to Multipoint for ISM - Transceiver ATR2406 * +//* Version: V1.0 * +//* File: appl.c * +//* Target MCU: ATMega88 * +//* Compiler: GCC * +//* Simulator: AVRStudio 4.08 * +//* Emulator: JTAG ICE * +//* Author: Christian Bechter * +//* Date: 31.01.06 * +//* Used Hardware: DEV-KIT-III * +//***************************************************************************** +//***************************************************************************** +//* Copyright 2006, Atmel Germany GmbH * +//* * +//* This software is owned by the Atmel Germany GmbH * +//* and is protected by and subject to worldwide patent protection. * +//* Atmel hereby grants to licensee a personal, * +//* non-exclusive, non-transferable license to copy, use, modify, create * +//* derivative works of, and compile the Atmel Source Code and derivative * +//* works for the sole purpose of creating custom software in support of * +//* licensee product to be used only in conjunction with a Atmel integrated * +//* circuit as specified in the applicable agreement. Any reproduction, * +//* modification, translation, compilation, or representation of this * +//* software except as specified above is prohibited without the express * +//* written permission of Atmel. * +//* * +//* Disclaimer: ATMEL MAKES NO WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, * +//* WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * +//* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * +//* Atmel reserves the right to make changes without further notice to the * +//* materials described herein. Atmel does not assume any liability arising * +//* out of the application or use of any product or circuit described herein. * +//* Atmel does not authorize its products for use as critical components in * +//* life-support systems where a malfunction or failure may reasonably be * +//* expected to result in significant injury to the user. The inclusion of * +//* Atmel products in a life-support systems application implies that the * +//* manufacturer assumes all risk of such use and in doing so indemnifies * +//* Atmel against all charges. * +//* * +//* Use may be limited by and subject to the applicable Atmel software * +//* license agreement. * +//***************************************************************************** + +#include "defines.h" +#include "init.h" +#include "interface.h" +#include "misc.h" +#include "varis.h" +#include "prot.h" +#include "rf_ctrl.h" + +#define DBG_STACK 1 + +#if (DBG_STACK) +extern uint16_t __heap_start; +void init_ram(void) __attribute__ ((naked)) + __attribute__ ((section(".init1"))); +void init_ram(void) +{ + uint8_t *ptr; + + for (ptr = (uint8_t *) &__heap_start; ptr < (uint8_t *) 0x800300; ptr++) + *ptr = 0x5F; +} +#endif + +//***************************************************************************** +//* Project: RF-Firmware for ISM * +//* Function: main * +//* Parameters: NONE * +//* Returns: NONE * +//* Action: Main routine of the Device * +//* Duration: tbd * +//* Size: tbd * +//* Date: 31.01.06 * +//* Description: Get connected to the Basestation, get values from the sensors* +//* and digital I/O * +//***************************************************************************** +//***************************************************************************** +// SETUP of RF_BUFFER_TX: * +// 0 - 5 -> Preamble * +// 6 - 7 -> Sync * +// 8 - 11 -> SOF * +// 12 -> LEN * +// 13 -> Command * +// 14 - 30 -> Payload * +// 31 -> Checksum * +//***************************************************************************** +int main(void) +{ + /* System init */ + init_avr(); + init_varis(); + interface_init(); + + /* XXX debug */ + DDRB |= _BV(PB3) | _BV(PB5); + DDRC |= _BV(PC3); + + + sei(); + system_start_up(); + for(;;){ + } +} Deleted: firmware/rf/trunk/init.c =================================================================== --- firmware/fuxrf/trunk/init.c 2008-06-24 09:27:28 UTC (rev 1252) +++ firmware/rf/trunk/init.c 2008-06-24 10:16:32 UTC (rev 1254) @@ -1,167 +0,0 @@ -#include "defines.h" -#include "init.h" -#include "varis.h" -#include "misc.h" - -//***************************************************************************** -//* Project: RF-Firmware for ISM * -//* Function: init_avr * -//* Parameters: NONE * -//* Returns: NONE * -//* Action: Basic setup of AVR * -//* Duration: tbd * -//* Size: tbd * -//* Date: 10.07.06 * -//* Description: Basic setup of the AVR I/O and for the RF-USART * -//***************************************************************************** -void init_avr(void) -{ - //init of AVR ports - //*************PORTB*************// - //PORTB.0 -> OUT TXON - //PORTB.1 -> OUT nOLE - //PORTB.2 -> IN CS - //PORTB.3 -> IN MOSI - //PORTB.4 -> OUT MISO - //PORTB.5 -> IN SCK - //PORTB.6 -> XTAL1 - //PORTB.7 -> XTAL2 (output to RF - Chip) - output(PORTB, 0x20); - output(DDRB, 0x13); - //*************PORTB*************// - //*************PORTC*************// - //PORTC.0 -> OUT READY SPI - //PORTC.1 -> OUT Enable - //PORTC.2 -> OUT READY SPI - //PORTC.3 -> OUT DEBUFG RF - //PORTC.4 -> NOT USED, PULLED UP - //PORTC.5 -> NOT USED, PULLED UP - //PORTC.6 -> DEBUG - PIN - output(PORTC, 0x31); - output(DDRC, 0x1F); - //*************PORTC*************// - //*************PORTD*************// - //PORTD.0 -> IN RX_DATA - //PORTD.1 -> OUT TX_DATA/Data - //PORTD.2 -> OUT PU_TRX/PU_REG - //PORTD.3 -> IN RESET LINE - //PORTD.4 -> I/O CLK_REC/Clock - //PORTD.5 -> OUT RXON - //PORTD.6 -> NOT USED, PULLED UP - //PORTD.7 -> OUT ON LINE - output(PORTD, 0xC0); - output(DDRD, 0xA6); - //*************PORTD*************// - //***********init-needed-peripherals***************// - output(UBRR0L, 0x05); - //***********init-needed-peripherals***************// - - SPCR = 0x40; /* XXX what's this for? */// Slave - SPSR = 0x00; - - /* Clear the SPI interrupt flag. XXX is this necessary at startup? */ - asm volatile - ("in __tmp_reg__, %0" "\n\t" - "in __tmp_reg__, %1" "\n\t" - ::"I" (_SFR_IO_ADDR(SPSR)), - "I"(_SFR_IO_ADDR(SPDR))); -} - -//***************************************************************************** -//* Project: RF-Firmware for ISM * -//* Function: init_varis * -//* Parameters: NONE * -//* Returns: NONE * -//* Action: init of the global variables * -//* Duration: tbd * -//* Size: tbd * -//* Date: 10.07.06 * -//* Description: global variables are init with their default values * -//***************************************************************************** -void init_varis(void) -{ - uint8_t i; - - i = input(SPL); - i ^= 0xFF; - extern uint16_t __bss_start; - extern uint16_t __stack; - uint8_t *ptr = (uint8_t *) & __bss_start; - - while (ptr < (uint8_t *) & __stack - i) - { /*sub because of returning of subroutine */ - *ptr++ = 0; - } // Reduce 26 bytes - - rx_buffer_ready = 0x00; - frameCmpt = 0; // Counter of RF frame - frequencyIndex = 0; // Pointer for the table of frequency - FHAState = INIT; // Init of status of FHA state machine - statisticPointer = 0; // Pointer for the table with statistic for FHA - spi_enable = 0; // Flag to start spi transaction - errorFrame = 0; // Detect error in transmission - commandStatus = 0; // Status of the command - ACKmode = 0; // Wait an ACK - - prf_buffer_rx = rf_buffer_rx1; // Init pointer for RF transaction - pspi_buffer_rx = rf_buffer_rx2; // Init pointer for SPI transaction - prf_buffer_tx = rf_buffer_tx1; // Init pointer for RF transaction - pspi_buffer_tx = rf_buffer_tx2; // Init pointer for SPI transaction -} - -//***************************************************************************** -//* Project: RF-Firmware for ISM * -//* Function: init_frame_RF * -//* Parameters: NONE * -//* Returns: NONE * -//* Action: init of TX buffer and compute checksum * -//* Duration: tbd * -//* Size: tbd * -//* Date: 26.06.07 * -//* Description: Init the TX buffers with the starting values * -//***************************************************************************** -void init_frame_RF(void) -{ - unsigned char i, header_rf; - - header_rf = SMALLFRAME; // First byte header of the frame - header_rf |= MASTERH; - - if (spiConfigFrame[1] == 0xFF) // Special mode - { - if (spiConfigFrame[3] == 0xFF) // Request ID - { - header_rf |= REQUESTID; - } - else // Change ID - { - header_rf |= CHANGEID; - } - } - - for (i = 0; i < 11; i++) - { - rf_buffer_tx1[i] = 0x55; // Preamble - rf_buffer_tx2[i] = 0x55; // Preamble - } - - for (i = 11; i < 13; i++) - { - rf_buffer_tx1[i] = 0xFF; // Synchro - rf_buffer_tx2[i] = 0xFF; // Synchro - } - - rf_buffer_tx1[14] = rf_buffer_tx2[14] = sof_ary[1] = spiConfigFrame[0]; // Set ID - rf_buffer_tx1[15] = rf_buffer_tx2[15] = sof_ary[2] = spiConfigFrame[1]; - rf_buffer_tx1[16] = rf_buffer_tx2[16] = header_rf; - if (spiConfigFrame[4] == 0x01) // Wake up from PC - rf_buffer_tx1[17] = rf_buffer_tx2[17] = 0x20; // Second byte header of the frame - else - rf_buffer_tx1[17] = rf_buffer_tx2[17] = 0x00; // Second byte header of the frame - - rf_buffer_tx1[18] = rf_buffer_tx2[18] = spiConfigFrame[2]; // Hopping parameters Index (dummy) / Toy ID for init - rf_buffer_tx1[19] = rf_buffer_tx2[19] = spiConfigFrame[3]; // Hopping parameters Channel (dummy) / Toy ID for init - rf_buffer_tx1[20] = rf_buffer_tx2[20] = 0x55; - calc_checksum(rf_buffer_tx1); - calc_checksum(rf_buffer_tx2); -} Copied: firmware/rf/trunk/init.c (from rev 1253, firmware/fuxrf/trunk/init.c) =================================================================== --- firmware/rf/trunk/init.c (rev 0) +++ firmware/rf/trunk/init.c 2008-06-24 10:16:32 UTC (rev 1254) @@ -0,0 +1,208 @@ +//***************************************************************************** +//* Project: RF-Firmware Point to Multipoint for ISM - Transceiver ATR2406 * +//* Version: V1.0 * +//* File: init.c * +//* Target MCU: ATMega88 * +//* Compiler: GCC * +//* Simulator: AVRStudio 4.08 * +//* Emulator: JTAG ICE * +//* Author: Christian Bechter * +//* Date: 31.01.06 * +//* Used Hardware: DEV-KIT-III * +//***************************************************************************** +//***************************************************************************** +//* Copyright 2006, Atmel Germany GmbH * +//* * +//* This software is owned by the Atmel Germany GmbH * +//* and is protected by and subject to worldwide patent protection. * +//* Atmel hereby grants to licensee a personal, * +//* non-exclusive, non-transferable license to copy, use, modify, create * +//* derivative works of, and compile the Atmel Source Code and derivative * +//* works for the sole purpose of creating custom software in support of * +//* licensee product to be used only in conjunction with a Atmel integrated * +//* circuit as specified in the applicable agreement. Any reproduction, * +//* modification, translation, compilation, or representation of this * +//* software except as specified above is prohibited without the express * +//* written permission of Atmel. * +//* * +//* Disclaimer: ATMEL MAKES NO WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, * +//* WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * +//* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * +//* Atmel reserves the right to make changes without further notice to the * +//* materials described herein. Atmel does not assume any liability arising * +//* out of the application or use of any product or circuit described herein. * +//* Atmel does not authorize its products for use as critical components in * +//* life-support systems where a malfunction or failure may reasonably be * +//* expected to result in significant injury to the user. The inclusion of * +//* Atmel products in a life-support systems application implies that the * +//* manufacturer assumes all risk of such use and in doing so indemnifies * +//* Atmel against all charges. * +//* * +//* Use may be limited by and subject to the applicable Atmel software * +//* license agreement. * +//***************************************************************************** + +#include "defines.h" +#include "init.h" +#include "varis.h" + + + +//***************************************************************************** +//* Project: RF-Firmware for ISM * +//* Function: init_avr * +//* Parameters: NONE * +//* Returns: NONE * +//* Action: Basic setup of AVR * +//* Duration: tbd * +//* Size: tbd * +//* Date: 31.01.06 * +//* Description: Basic setup of the AVR I/O and for the RF-USART * +//***************************************************************************** +void init_avr(void) +{ + //init of AVR ports + //*************PORTB*************// + //PORTB.0 -> OUT TXON + //PORTB.1 -> OUT nOLE + //PORTB.2 -> IN SS + //PORTB.3 -> IN MOSI + //PORTB.4 -> OUT MISO + //PORTB.5 -> IN SCK + //PORTB.6 -> XTAL1 + //PORTB.7 -> XTAL2 (output to RF - Chip) + PORTB = 0x20; + DDRB = 0x13; + //*************PORTB*************// + //*************PORTC*************// + //PORTC.0 -> SPIACK + //PORTC.1 -> OUT Enable + //PORTC.2 -> TXE (TX [register] empty) + //PORTC.3 -> NOT USED, PULLED UP + //PORTC.4 -> NOT USED, PULLED UP + //PORTC.5 -> NOT USED, PULLED UP + //PORTC.6 -> RESET + PORTC = 0x38; + DDRC = 0x07; + //*************PORTC*************// + //*************PORTD*************// + //PORTD.0 -> IN RX_DATA + //PORTD.1 -> OUT TX_DATA/Data + //PORTD.2 -> OUT PU_TRX/PU_REG + //PORTD.3 -> OUTPUT DEBUG + //PORTD.4 -> I/O CLK_REC/Clock + //PORTD.5 -> OUT RXON + //PORTD.6 -> NOT USED, PULLED UP + //PORTD.7 -> LINK + PORTD = 0x40; + DDRD = 0xAE; + //*************PORTD*************// + //***********init-needed-peripherals***************// + UBRR0L = 0x05; + //***********init-needed-peripherals***************// + /* Disable UART */ + UCSR0A = 0x00; + UCSR0B = 0x00; + UCSR0C = 0x00; + + /* Disable interrupts. */ + TIMSK1 = 0x00; +} +//***************************************************************************** +//* Project: RF-Firmware for ISM * +//* Function: init_varis * +//* Parameters: NONE * +//* Returns: NONE * +//* Action: init of the global variables * +//* Duration: tbd * +//* Size: tbd * +//* Date: 31.01.06 * +//* Description: global variables are init with their default values * +//***************************************************************************** +void init_varis(void) +{ + //************************************************************************* + // SETUP of RF_BUFFER_TX: * + // 0 - 5 -> Preamble * + // 6 - 7 -> Sync * + // 8 - 11 -> SOF * + // 12 -> LEN * + // 13 -> Command * + // 14 - 30 -> Payload * + // 31 -> Checksum * + //************************************************************************* + //Default setup of the rf_buffer_tx// + rf_buffer_tx[0] = rf_buffer_tx[1] = rf_buffer_tx[2] = 0x55 ^ SCRAMBLE_BYTE; + rf_buffer_tx[3] = rf_buffer_tx[4] = rf_buffer_tx[5] = 0x55 ^ SCRAMBLE_BYTE; + rf_buffer_tx[6] = rf_buffer_tx[7] = 0xFF ^ SCRAMBLE_BYTE; + //Default setup of the rf_buffer_tx// + /* XXX to be cleaned */ + sof_ary[0] = TRX_CHANNEL; + sof_ary[1] = 0x56; + sof_ary[2] = 0xFF; + sof_ary[3] = 0x56; + rf_buffer_tx[8]=channel; + rf_buffer_tx[9]=sof_ary[1]; + rf_buffer_tx[10]=sof_ary[2]; + rf_buffer_tx[11]=sof_ary[3]; + + //generate dummy packet + rf_buffer_tx[12]=52; /* Number of bytes from here */ + rf_buffer_tx[13]=0x55; + rf_buffer_tx[14]=0x55; + rf_buffer_tx[15]=0x55; + rf_buffer_tx[16]=0x55; + rf_buffer_tx[17]=0x55; + rf_buffer_tx[18]=0x55; + rf_buffer_tx[19]=0x55; + rf_buffer_tx[20]=0x55; + rf_buffer_tx[21]=0x55; + rf_buffer_tx[22]=0x55; + rf_buffer_tx[23]=0x55; + rf_buffer_tx[24]=0x55; + rf_buffer_tx[25]=0x55; + rf_buffer_tx[26]=0x55; + rf_buffer_tx[27]=0x55; + rf_buffer_tx[28]=0x55; + rf_buffer_tx[29]=0x55; + rf_buffer_tx[30]=0x55; + rf_buffer_tx[31]=0x55; + rf_buffer_tx[32]=0x55; + rf_buffer_tx[33]=0x55; + rf_buffer_tx[34]=0x55; + rf_buffer_tx[35]=0x55; + rf_buffer_tx[36]=0x55; + rf_buffer_tx[37]=0x55; + rf_buffer_tx[38]=0x55; + rf_buffer_tx[39]=0x55; + rf_buffer_tx[40]=0x55; + rf_buffer_tx[41]=0x55; + rf_buffer_tx[42]=0x55; + rf_buffer_tx[43]=0x55; + rf_buffer_tx[44]=0x55; + rf_buffer_tx[45]=0x55; + rf_buffer_tx[46]=0x55; + rf_buffer_tx[47]=0x55; + rf_buffer_tx[48]=0x55; + rf_buffer_tx[49]=0x55; + rf_buffer_tx[50]=0x55; + rf_buffer_tx[51]=0x55; + rf_buffer_tx[52]=0x55; + rf_buffer_tx[53]=0x55; + rf_buffer_tx[54]=0x55; + rf_buffer_tx[55]=0x55; + rf_buffer_tx[56]=0x55; + rf_buffer_tx[57]=0x55; + rf_buffer_tx[58]=0x55; + rf_buffer_tx[59]=0x55; + rf_buffer_tx[60]=0x55; + rf_buffer_tx[61]=0x55; + rf_buffer_tx[62]=0x55; + rf_buffer_tx[63]=0x34; /* Parity checksum manually calculated */ + + /*uint8_t i;*/ + /*for (i=13; i<63; i++)*/ + /*rf_buffer_tx[i] = 0x01;//1<<(i&7);*/ +} + + Deleted: firmware/rf/trunk/init.h =================================================================== --- firmware/fuxrf/trunk/init.h 2008-06-24 09:27:28 UTC (rev 1252) +++ firmware/rf/trunk/init.h 2008-06-24 10:16:32 UTC (rev 1254) @@ -1,10 +0,0 @@ -#ifndef INIT_H -#define INIT_H - -#include "defines.h" - -extern void init_avr(void); -extern void init_varis(void); -extern void init_frame_RF(void); - -#endif Copied: firmware/rf/trunk/init.h (from rev 1253, firmware/fuxrf/trunk/init.h) =================================================================== --- firmware/rf/trunk/init.h (rev 0) +++ firmware/rf/trunk/init.h 2008-06-24 10:16:32 UTC (rev 1254) @@ -0,0 +1,55 @@ +//***************************************************************************** +//* Project: RF-Firmware Point to Multipoint for ISM - Transceiver ATR2406 * +//* Version: V1.0 * +//* File: init.h * +//* Target MCU: ATMega88 * +//* Compiler: GCC * +//* Simulator: AVRStudio 4.08 * +//* Emulator: JTAG ICE * +//* Author: Christian Bechter * +//* Date: 31.01.06 * +//* Used Hardware: DEV-KIT-III * +//***************************************************************************** +//***************************************************************************** +//* Copyright 2006, Atmel Germany GmbH * +//* * +//* This software is owned by the Atmel Germany GmbH * +//* and is protected by and subject to worldwide patent protection. * +//* Atmel hereby grants to licensee a personal, * +//* non-exclusive, non-transferable license to copy, use, modify, create * +//* derivative works of, and compile the Atmel Source Code and derivative * +//* works for the sole purpose of creating custom software in support of * +//* licensee product to be used only in conjunction with a Atmel integrated * +//* circuit as specified in the applicable agreement. Any reproduction, * +//* modification, translation, compilation, or representation of this * +//* software except as specified above is prohibited without the express * +//* written permission of Atmel. * +//* * +//* Disclaimer: ATMEL MAKES NO WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, * +//* WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * +//* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * +//* Atmel reserves the right to make changes without further notice to the * +//* materials described herein. Atmel does not assume any liability arising * +//* out of the application or use of any product or circuit described herein. * +//* Atmel does not authorize its products for use as critical components in * +//* life-support systems where a malfunction or failure may reasonably be * +//* expected to result in significant injury to the user. The inclusion of * +//* Atmel products in a life-support systems application implies that the * +//* manufacturer assumes all risk of such use and in doing so indemnifies * +//* Atmel against all charges. * +//* * +//* Use may be limited by and subject to the applicable Atmel software * +//* license agreement. ... [truncated message content] |
From: jaguarondi <c2m...@c2...> - 2008-06-24 10:12:27
|
Author: jaguarondi Date: 2008-06-24 12:12:31 +0200 (Tue, 24 Jun 2008) New Revision: 1253 Added: firmware/fuxrf/trunk/Makefile firmware/fuxrf/trunk/interface.c firmware/fuxrf/trunk/interface.h Removed: firmware/fuxrf/trunk/default/ firmware/fuxrf/trunk/device.aps Modified: firmware/fuxrf/trunk/defines.h firmware/fuxrf/trunk/device.c firmware/fuxrf/trunk/init.c firmware/fuxrf/trunk/init.h firmware/fuxrf/trunk/misc.c firmware/fuxrf/trunk/misc.h firmware/fuxrf/trunk/prot.c firmware/fuxrf/trunk/prot.h firmware/fuxrf/trunk/rf_ctrl.c firmware/fuxrf/trunk/rf_ctrl.h firmware/fuxrf/trunk/varis.c firmware/fuxrf/trunk/varis.h Log: * First stpe of the refactoring of the RF. I started from the code from Atmel that was first checked-in here. This version is functional but still needs many functionalities: adaptative frequency hopping, wifi avoidance, sleep, redundancy of the audio data when a frame is lost, ID. We'll first try to have 16kHz audio through. Added: firmware/fuxrf/trunk/Makefile =================================================================== --- firmware/fuxrf/trunk/Makefile (rev 0) +++ firmware/fuxrf/trunk/Makefile 2008-06-24 10:12:31 UTC (rev 1253) @@ -0,0 +1,122 @@ +############################################################################### +# Makefile for the project device +############################################################################### + +## General Flags +MCU = atmega48 +TARGET = fuxrf.elf +CC = avr-gcc +AVRDUDE = avrdude + +## Options common to compile, link and assembly rules +COMMON = -mmcu=$(MCU) + +## Compile options common for all C compilation units. +CFLAGS = $(COMMON) +CFLAGS += -Wall -gstabs -DF_CPU=13824000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums +CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d +ifneq (,$(findstring master, $(TYPE))) + PROJECT = fuxrf + CFLAGS += -D_MASTER +else + ifneq (,$(findstring slave, $(TYPE))) + PROJECT = tuxrf + CFLAGS += -D_SLAVE + endif +endif + + +## Assembly specific flags +ASMFLAGS = $(COMMON) +ASMFLAGS += -x assembler-with-cpp -Wa,-gstabs + +## Linker flags +LDFLAGS = $(COMMON) + +## Intel Hex file production flags +HEX_FLASH_FLAGS = -R .eeprom + +HEX_EEPROM_FLAGS = -j .eeprom +HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load" +HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0 + +## Objects that must be built in order to link +OBJECTS = device.o init.o misc.o prot.o rf_ctrl.o varis.o interface.o #bootloader.o + +## Objects explicitly added by the user +LINKONLYOBJECTS = + +## Build +all: $(TARGET) fuxrf.hex fuxrf.eep fuxrf.lss size + +## Compile +device.o: device.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +init.o: init.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +misc.o: misc.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +prot.o: prot.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +rf_ctrl.o: rf_ctrl.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +varis.o: varis.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +interface.o: interface.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +bootloader.o: bootloader.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +##Link +$(TARGET): $(OBJECTS) + $(CC) $(LDFLAGS) $(OBJECTS) $(LINKONLYOBJECTS) $(LIBDIRS) $(LIBS) -o $(TARGET) + +%.hex: $(TARGET) + avr-objcopy -O ihex $(HEX_FLASH_FLAGS) $< $@ + +%.eep: $(TARGET) + avr-objcopy $(HEX_EEPROM_FLAGS) -O ihex $< $@ + +%.lss: $(TARGET) + avr-objdump -h -S $< > $@ + +size: ${TARGET} + @echo + @avr-size ${TARGET} + +## Clean target +.PHONY: clean +clean: + -rm -rf $(OBJECTS) device.elf dep/* device.hex device.eep device.lss device.map + + +## Other dependencies +-include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*) + +# Programming +prog: $(PROJECT).hex + tuxup $(PROJECT).hex $(PROJECT).eep + +dwen: + $(AVRDUDE) -p $(MCU) -c jtag2isp -P usb -B 10 -U hfuse:w:0x95:m + +nodwen: + $(AVRDUDE) -p $(MCU) -c jtag2isp -P usb -B 10 -U hfuse:w:0xD5:m + +debug: + avarice -P $(MCU) -B 1000 -2 -w -j usb -p -f $(PROJECT).elf :4242 + +progisp: $(PROJECT).hex $(PROJECT).eep + $(AVRDUDE) -p $(MCU) -c jtag2isp -P usb -B 10 -e \ + -U flash:w:$(PROJECT).hex + +progstk: $(PROJECT).hex $(PROJECT).eep + $(AVRDUDE) -p $(MCU) -c stk500v2 -e -U flash:w:$(PROJECT).hex \ + -U eeprom:w:$(PROJECT).eep Property changes on: firmware/fuxrf/trunk/Makefile ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Name: svn:eol-style + native Modified: firmware/fuxrf/trunk/defines.h =================================================================== --- firmware/fuxrf/trunk/defines.h 2008-06-24 09:27:28 UTC (rev 1252) +++ firmware/fuxrf/trunk/defines.h 2008-06-24 10:12:31 UTC (rev 1253) @@ -1,106 +1,228 @@ +//***************************************************************************** +//* Project: RF-Firmware Point to Multipoint for ISM - Transceiver ATR2406 * +//* Version: V1.0 * +//* File: defines.h * +//* Target MCU: ATMega88 * +//* Compiler: GCC * +//* Simulator: AVRStudio 4.08 * +//* Emulator: JTAG ICE * +//* Author: Christian Bechter * +//* Date: 31.01.06 * +//* Used Hardware: DEV-KIT-III * +//***************************************************************************** +//***************************************************************************** +//* Copyright 2006, Atmel Germany GmbH * +//* * +//* This software is owned by the Atmel Germany GmbH * +//* and is protected by and subject to worldwide patent protection. * +//* Atmel hereby grants to licensee a personal, * +//* non-exclusive, non-transferable license to copy, use, modify, create * +//* derivative works of, and compile the Atmel Source Code and derivative * +//* works for the sole purpose of creating custom software in support of * +//* licensee product to be used only in conjunction with a Atmel integrated * +//* circuit as specified in the applicable agreement. Any reproduction, * +//* modification, translation, compilation, or representation of this * +//* software except as specified above is prohibited without the express * +//* written permission of Atmel. * +//* * +//* Disclaimer: ATMEL MAKES NO WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, * +//* WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * +//* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * +//* Atmel reserves the right to make changes without further notice to the * +//* materials described herein. Atmel does not assume any liability arising * +//* out of the application or use of any product or circuit described herein. * +//* Atmel does not authorize its products for use as critical components in * +//* life-support systems where a malfunction or failure may reasonably be * +//* expected to result in significant injury to the user. The inclusion of * +//* Atmel products in a life-support systems application implies that the * +//* manufacturer assumes all risk of such use and in doing so indemnifies * +//* Atmel against all charges. * +//* * +//* Use may be limited by and subject to the applicable Atmel software * +//* license agreement. * +//***************************************************************************** #ifndef DEFINES_H #define DEFINES_H -// Include defines for target MCU +//include defines for target MCU #include <avr/io.h> #include <compat/ina90.h> #include <avr/interrupt.h> #include <avr/pgmspace.h> #include <avr/eeprom.h> -// Define the used HOPPING SCHEME -#define HOPPING // No hopping, use signel channel TRX_CHANNEL. If no define use frequency hopping -#define TRX_CHANNEL 90 -#define FHA // Use frequency hopping adaptativ +//**Define the used HOPPING SCHEME**// +//#define HOPPING +#define NOHOPP +#define TRX_CHANNEL 4 +//#define CYCHOPP +//**Define the used HOPPING SCHEME**// -#define WIFI +#define TXEN 0x01 +#define RXEN 0x00 +#define CONNECTED 0x80 -//------->rf_status-Defines<-------// -#define WAIT_HOPPING 0x02 -#define RXING 0x04 -#define TXING 0x08 -#define LOGGED 0x10 -#define FHA_EFFECTIVE 0x20 -#define MASTER 0x40 -#define SLAVE 0x80 -//------->rf_status-Defines<-------// +#define TXING 0x08 +#define RXING 0x04 +#define MASTER 0x40 +#define SLAVE 0x80 -//----->Header-Byte_1-Defines<-----// -#define MASTERH 0x01 -#define SLAVEH 0x02 -#define LOGGEDH 0x04 -#define FHTRSEQ 0x08 -#define FHAACKH 0x10 -#define CHANGEID 0x20 -#define REQUESTID 0x40 -#define SMALLFRAME 0x80 -//----->Header-Byte_1-Defines<-----// +//returns the address owned by the given label in registers R31:R30 +/* XXX ? delete? */ +#define GET_LABEL_ADDRESS(addr)\ +{\ + __asm__ __volatile__ ("\n"::"z"(addr));\ +} -//------->FHAState-Defines<-------// -#define INIT 0x01 -#define SEND_SEQUENCE 0x02 -#define WAIT_SYNCHRO 0x04 -#define WAIT_ACK_CHF 0x10 -#define DO_UPDATE 0x20 -#define COMPUTE_FREQ 0x40 -//------->FHAState-Defines<-------// +#define _NIX __asm__ __volatile__ ("nop") +//Hardware Definitions -//------->RFinitState-Defines<-------// -#define WAIT_SLAVE 0x01 -#define WAIT_LOG 0x02 -#define SEND_FS 0x03 -#define WAIT_SYNCHRO 0x04 -//------->RFinitState-Defines<-------// +#define CLOCK_PORT PORTD +#define CLOCK_DDR DDRD +#define CLOCK_OUT PD4 +#define DATA_PORT PORTD +#define DATA_DDR DDRD +#define DATA_OUT PD1 +#define ENABLE_PORT PORTC +#define ENABLE_DDR DDRC +#define ENABLE_OUT PC1 +#define RXON_PORT PORTD +#define RXON_DDR DDRD +#define RXON_OUT PD5 +#define TXON_PORT PORTB +#define TXON_DDR DDRB +#define TXON_OUT PB0 +#define PUPWR_PORT PORTD +#define PUPWR_DDR DDRD +#define PUPWR_OUT PD2 +#define nOLE_PORT PORTB +#define nOLE_DDR DDRB +#define nOLE_OUT PB1 -//----->Assembler Definitions<-----// -#define _RETI __asm__ __volatile__ ("reti") -#define _NIX __asm__ __volatile__ ("nop") -#define _READ_FB __LPM -#define __EEPROM__ __attribute__((section(".eeprom"))) -#define SIGNAL_NAKED(signame)\ -void signame (void) __attribute__ ((signal)) __attribute__ ((naked));\ -void signame (void) -//----->Assembler Definitions<-----// +#define set_clock() (CLOCK_PORT |= _BV(CLOCK_OUT)) +#define clr_clock() (CLOCK_PORT &= ~_BV(CLOCK_OUT)) +#define set_data() (DATA_PORT |= _BV(DATA_OUT)) +#define clr_data() (DATA_PORT &= ~_BV(DATA_OUT)) +#define set_enable() (ENABLE_PORT |= _BV(ENABLE_OUT)) +#define clr_enable() (ENABLE_PORT &= ~_BV(ENABLE_OUT)) +#define set_rxon() (RXON_PORT |= _BV(RXON_OUT)) +#define clr_rxon() (RXON_PORT &= ~_BV(RXON_OUT)) +#define set_txon() (TXON_PORT |= _BV(TXON_OUT)) +#define clr_txon() (TXON_PORT &= ~_BV(TXON_OUT)) +#define set_pupwr() (PUPWR_PORT |= _BV(PUPWR_OUT)) +#define clr_pupwr() (PUPWR_PORT &= ~_BV(PUPWR_OUT)) +#define set_nole() (nOLE_PORT |= _BV(nOLE_OUT)) +#define clr_nole() (nOLE_PORT &= ~_BV(nOLE_OUT)) -//----->Hardware Definitions<-----// -#define set_clock __asm__ __volatile__ ("sbi 0x0B,4") //D.4# CLOCK PORTD.4 -#define clr_clock __asm__ __volatile__ ("cbi 0x0B,4") //D.4# CLOCK PORTD.4 -#define set_data __asm__ __volatile__ ("sbi 0x0B,1") //D.1# TXD/D PORTD.1 -#define clr_data __asm__ __volatile__ ("cbi 0x0B,1") //D.1# TXD/D PORTD.1 -#define set_enable __asm__ __volatile__ ("sbi 0x08,1") //C.1# ENABLE PORTC.1 -#define clr_enable __asm__ __volatile__ ("cbi 0x08,1") //C.1# ENABLE PORTC.1 -#define set_rxon __asm__ __volatile__ ("sbi 0x0B,5") //D.5# RXON PORTD.5 -#define clr_rxon __asm__ __volatile__ ("cbi 0x0B,5") //D.5# RXON PORTD.5 -#define set_txon __asm__ __volatile__ ("sbi 0x05,0") //B.0# TXON PORTB.0 -#define clr_txon __asm__ __volatile__ ("cbi 0x05,0") //B.0# TXON PORTB.0 -#define set_pupwr __asm__ __volatile__ ("sbi 0x0B,2") //D.2# PU_PWR PORTD.2 -#define clr_pupwr __asm__ __volatile__ ("cbi 0x0B,2") //D.2# PU_PWR PORTD.2 -#define set_nole __asm__ __volatile__ ("sbi 0x05,1") //B.1# OLE PORTB.1 -#define clr_nole __asm__ __volatile__ ("cbi 0x05,1") //B.1# OLE PORTB.1 -#define in_rxd input(PIND)&0x01 //# RXD PIND.0 -//----->Hardware Definitions<-----// +#define in_rxd input(PIND)&0x01 //# RXD PIND.0 +//Hardware Definitions -//----->RF-Config-Word-Defines<-----// -#define TXEN 0x01 // XXX -#define RXEN 0x00 // XXX -#define CH00TX 0x1B -#define CH00RX 0x1C -//----->RF-Config-Word-Defines<-----// +//----->RF-Specifc-Defines<-----// +/* S[SC] of channel 0 in TX mode, p. 10 of datasheet */ +#define CH00TX 27 +/* S[SC] of channel 0 in RX mode, p. 10 of datasheet */ +#define CH00RX 28 +//----->RF-Specifc-Defines<-----// -//----->RF-Timing-Defines<-----// - // T_SLOT == 1ms ==> every 1000us 48 Bytes of payload are exchanged -#define POLL_LOOPS 1 -#define T_1ms 1728 // Exact -> 1000us -#define T_PWR_UP_TX 69 // 69 == 40us (39.93) -#define T_LOOP_TX 341 // 341 == 197us (197.34) -#define T_START_TX 59 // 59 == 34us (34.14) -#define T_TX2RX 1259 // 1259 == 728us (728.59) -#define T_PWR_UP_RX 69 // 69 == 40us (39.93) -#define T_LOOP_RX 139 // 139 == 80us (80.44) -#define T_RX_ON 260 // 260 == 150us (150.46) -#define T_MAX_PAC_RX 1088 // 1088 == 630us (629.62) -#define T_RX2TX 172 // 172 == 100us (99.54) - // ==> 48KB/second (384.000bps) -//----->RF-Timing-Defines<-----// + //T_SLOT == 1ms ==> every 1000us 48Bytes of payload are exchanged + #define POLL_LOOPS 4 + #define T_1ms 1728 //exact -> 1000us + #define T_PWR_UP_TX 69 //69 == 40us(39.93) + #define T_LOOP_TX 363 //363 == 210us(210.07) + #define T_TX2RX 1296 //1296 == 750us(749.99) + #define T_PWR_UP_RX 69 //69 == 40us(39.93) + #define T_LOOP_RX 276 //276 == 160us(159.72) + #define T_RX_ON 87 //87 == 50us(50.35) + #define T_MAX_PAC_RX 1124 //1124 == 650us(650.46) + #define T_RX2TX 172 //172 == 100us(99.54) + #define T_TS_SOLL 979 //979 == 566.32us(566.55) + #define T_START_SYNC 1086//1065 - 31 //(1065 - 31) == 616.32us(616.09) [31 == calc time!!(17.94us)] + #define T_SYNC 1086//1065 //1065 == 616.32(616.32) + // ==> 48KB/second (384.000bps) +/* + //T_SLOT == 1.1ms ==> every 1100us 48Bytes of payload are exchanged + #define POLL_LOOPS 2 + #define T_1100us 1901 // -> 1100us(1100.11574) + #define T_PWR_UP_TX 70 //70 == 40us(40.51) + #define T_LOOP_TX 535 //535 == 310us(309.61) + #define T_TX2RX 1296 //1296 == 750us(749.99) + #define T_PWR_UP_RX 70 //70 == 40us(40.51) + #define T_LOOP_RX 448 //448 == 260us(259.26) + #define T_RX_ON 87 //87 == 50us(50.35) + #define T_MAX_PAC_RX 1124 //1124 == 650us(650.46) + #define T_RX2TX 172 //172 == 100us(99.54) + #define T_TS_SOLL 979 //979 == 566.32us(566.55) + #define T_START_SYNC 1065 - 31 //(1065 - 31) == 598.38us [31 == calc time!!(17.94us)] + #define T_SYNC 1065 //1065 == 616.32(616.32) + // ==> 43.6KB/second (349.090bps) +*/ +/* + //T_SLOT == 2ms ==> every 2000us 48Bytes of payload are exchanged + #define POLL_LOOPS 2 + #define T_2ms 3456 //exact -> 2000us + #define T_PWR_UP_TX 70 //70 == 40us(40.51) + #define T_LOOP_TX 605 //605 == 350us(350.11) + #define T_TX2RX 2781 //2781 == 1610us(1609.37) + #define T_PWR_UP_RX 70 //70 == 40us(40.51) + #define T_LOOP_RX 518 //518 == 300us(299.77) + #define T_RX_ON 87 //87 == 50us(50.35) + #define T_MAX_PAC_RX 1124 //1124 == 650us(650.46) + #define T_RX2TX 1657 //1657 == 960us(958.91) + #define T_START_SYNC 2550 - 31 //(2550 - 31) == 1475.69us [31 == calc time!!(17.94us)] + #define T_SYNC 2550 //2550 == 1475.69us + // ==> 24KB/second (192.000bps) +*/ +/* + //T_SLOT == 4ms ==> every 4000us 48Bytes of payload are exchanged + #define POLL_LOOPS 4 + #define T_4ms 6912 //exact -> 4000us + #define T_PWR_UP_TX 70 //70 == 40us(40.51) + #define T_LOOP_TX 605 //605 == 350us(350.11) + #define T_TX2RX 6237 //6237 == 3610us(3609.37) + #define T_PWR_UP_RX 70 //70 == 40us(40.51) + #define T_LOOP_RX 518 //518 == 300us(299.77) + #define T_RX_ON 87 //87 == 50us(50.35) + #define T_MAX_PAC_RX 1124 //1124 == 650us(650.46) + #define T_RX2TX 5113 //5113 == 2960us(2958.91) + #define T_START_SYNC 6006 - 31 //(6006 - 31) == 3475.69us [31 == calc time!!(17.94us)] + #define T_SYNC 6006 //6006 == 3475.69us + // ==> 12KB/second (96.000bps) +*/ +/* + //T_SLOT == 8ms ==> every 8000us 48Bytes of payload are exchanged + #define POLL_LOOPS 8 + #define T_8ms 13824 //exact -> 8000us + #define T_PWR_UP_TX 70 //70 == 40us(40.51) + #define T_LOOP_TX 605 //605 == 350us(350.11) + #define T_TX2RX 13149 //13149 == 7610us(7609.37) + #define T_PWR_UP_RX 70 //70 == 40us(40.51) + #define T_LOOP_RX 518 //518 == 300us(299.77) + #define T_RX_ON 87 //87 == 50us(50.35) + #define T_MAX_PAC_RX 1124 //1124 == 650us(650.46) + #define T_RX2TX 12025 //12025 == 6960us(6958.91) + #define T_START_SYNC 12918 - 31 //(12918 - 31) == 7475.69us [31 == calc time!!(17.94us)] + #define T_SYNC 12918 //12918 == 7475.69us + // ==> 6KB/second (48.000bps) +*/ +/* + //T_SLOT == 16ms ==> every 16000us 48Bytes of payload are exchanged + #define POLL_LOOPS 16 + #define T_16ms 27648 //exact -> 16000us + #define T_PWR_UP_TX 70 //70 == 40us(40.51) + #define T_LOOP_TX 605 //605 == 350us(350.11) + #define T_TX2RX 26973 //26973 == 15610us(15609.37) + #define T_PWR_UP_RX 70 //70 == 40us(40.51) + #define T_LOOP_RX 518 //518 == 300us(299.77) + #define T_RX_ON 87 //87 == 50us(50.35) + #define T_MAX_PAC_RX 1124 //1124 == 650us(650.46) + #define T_RX2TX 25849 //25849 == 14960us(14958.91) + #define T_START_SYNC 26742 - 31 //(26742 - 31) == 15475.69us [31 == calc time!!(17.94us)] + #define T_SYNC 26742 //26742 == 15475.69us + // ==> 3KB/second (24.000bps) +*/ +#define LED_ON __asm__ __volatile__ ("sbi 0x05,2") //B.2 +#define LED_OFF __asm__ __volatile__ ("cbi 0x05,2") //B.2 + #endif + Deleted: firmware/fuxrf/trunk/device.aps =================================================================== --- firmware/fuxrf/trunk/device.aps 2008-06-24 09:27:28 UTC (rev 1252) +++ firmware/fuxrf/trunk/device.aps 2008-06-24 10:12:31 UTC (rev 1253) @@ -1 +0,0 @@ -<AVRStudio><MANAGEMENT><ProjectName>device</ProjectName><Created>10-Nov-2005 15:17:29</Created><LastEdit>01-Oct-2007 14:04:44</LastEdit><ICON>241</ICON><ProjectType>0</ProjectType><Created>10-Nov-2005 15:17:29</Created><Version>4</Version><Build>4, 12, 0, 454</Build><ProjectTypeName>AVR GCC</ProjectTypeName></MANAGEMENT><CODE_CREATION><ObjectFile>default\device.elf</ObjectFile><EntryFile></EntryFile><SaveFolder>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET>JTAGICE mkII</CURRENT_TARGET><CURRENT_PART>ATmega168</CURRENT_PART><BREAKPOINTS></BREAKPOINTS><IO_EXPAND><Item>51</Item><Item>580</Item><Item>103</Item><Item>17</Item><HIDE>false</HIDE></IO_EXPAND><REGISTERNAMES><Register>R00</Register><Register>R01</Register><Register>R02</Register><Register>R03</Register><Register>R04</Register><Register>R05</Register><Register>R06</Register><Register>R07</Register><Register>R08</Register><Register>R09</Register><Register>R10</Register><Register>R11</Register><Register>R12</Register><Register>R13</Register><Register>R14</Register><Register>R15</Register><Register>R16</Register><Register>R17</Register><Register>R18</Register><Register>R19</Register><Register>R20</Register><Register>R21</Register><Register>R22</Register><Register>R23</Register><Register>R24</Register><Register>R25</Register><Register>R26</Register><Register>R27</Register><Register>R28</Register><Register>R29</Register><Register>R30</Register><Register>R31</Register></REGISTERNAMES><COM>Auto</COM><COMType>0</COMType><WATCHNUM>1</WATCHNUM><WATCHNAMES><Pane0><Variables>ts</Variables><Variables>i</Variables><Variables>rf_rx_state</Variables><Variables>checksum</Variables><Variables>protocol_flags</Variables><Variables>rf_buffer_tx</Variables><Variables>channel</Variables><Variables>FHAState</Variables><Variables>frequencyTable</Variables><Variables>commandStatus</Variables></Pane0><Pane1><Variables>ACKmode</Variables><Variables>sof_ary</Variables><Variables>toy_id_h</Variables><Variables>toy_id_l</Variables><Variables>prf_buffer_tx</Variables><Variables>rf_tx_counter</Variables><Variables>tx_pac_len</Variables><Variables>rf_buffer_rx1</Variables><Variables>rf_buffer_rx2</Variables><Variables>pspi_buffer_rx</Variables><Variables>rf_buffer_tx2</Variables><Variables>rf_buffer_tx1</Variables><Variables>pspi_buffer_tx</Variables><Variables>rf_header</Variables><Variables>rf_status</Variables><Variables>watchdog</Variables><Variables>gfilter</Variables><Variables>replaceFrequency</Variables><Variables>frequencyTable</Variables><Variables>commandBuffer</Variables><Variables>spiConfigFrame</Variables></Pane1><Pane2></Pane2><Pane3></Pane3></WATCHNAMES><BreakOnTrcaeFull>0</BreakOnTrcaeFull></DEBUG_TARGET><Debugger><modules><module><map private="C:\Documents and Settings\Pascal\Desktop\TUX\Dongle\RF\Branches\RF_test\Branches\" public=""/><map private="C:\Documents and Settings\Pascal\Desktop\TUX\Dongle\RF\New_timing\" public=""/></module></modules><Triggers></Triggers></Debugger><AVRGCCPLUGIN><FILES><SOURCEFILE>device.c</SOURCEFILE><SOURCEFILE>init.c</SOURCEFILE><SOURCEFILE>misc.c</SOURCEFILE><SOURCEFILE>prot.c</SOURCEFILE><SOURCEFILE>rf_ctrl.c</SOURCEFILE><SOURCEFILE>varis.c</SOURCEFILE><SOURCEFILE>spi.c</SOURCEFILE><SOURCEFILE>bootloader.c</SOURCEFILE><HEADERFILE>varis.h</HEADERFILE><HEADERFILE>init.h</HEADERFILE><HEADERFILE>misc.h</HEADERFILE><HEADERFILE>prot.h</HEADERFILE><HEADERFILE>rf_ctrl.h</HEADERFILE><HEADERFILE>defines.h</HEADERFILE><HEADERFILE>bootloader.h</HEADERFILE><HEADERFILE>spi.h</HEADERFILE><HEADERFILE>version.h</HEADERFILE><HEADERFILE>common\commands.h</HEADERFILE><OTHERFILE>default\device.lss</OTHERFILE><OTHERFILE>default\device.map</OTHERFILE></FILES><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>NO</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE></EXTERNALMAKEFILE><PART>atmega48</PART><HEX>1</HEX><LIST>1</LIST><MAP>1</MAP><OUTPUTFILENAME>device.elf</OUTPUTFILENAME><OUTPUTDIR>default\</OUTPUTDIR><ISDIRTY>1</ISDIRTY><OPTIONS><OPTION><FILE>bootloader.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>device.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>init.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>misc.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>prot.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>rf_ctrl.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>spi.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>varis.c</FILE><OPTIONLIST></OPTIONLIST></OPTION></OPTIONS><INCDIRS/><LIBDIRS/><LIBS/><LINKOBJECTS/><OPTIONSFORALL>-Wall -gdwarf-2 -DF_CPU=13824000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums</OPTIONSFORALL><LINKEROPTIONS>-Wl,--section-start=.bootloader=0x0F00 -Wl,--section-start=.version=0x0EF0</LINKEROPTIONS><SEGMENTS><SEGMENT><NAME>.buffer_tx1</NAME><SEGMENT>SRAM</SEGMENT><ADDRESS>0x100</ADDRESS></SEGMENT><SEGMENT><NAME>.buffer_rx1</NAME><SEGMENT>SRAM</SEGMENT><ADDRESS>0x140</ADDRESS></SEGMENT><SEGMENT><NAME>.sof</NAME><SEGMENT>SRAM</SEGMENT><ADDRESS>0x1e6</ADDRESS></SEGMENT><SEGMENT><NAME>.globals</NAME><SEGMENT>SRAM</SEGMENT><ADDRESS>0x1ea</ADDRESS></SEGMENT><SEGMENT><NAME>.buffer_tx2</NAME><SEGMENT>SRAM</SEGMENT><ADDRESS>0x173</ADDRESS></SEGMENT><SEGMENT><NAME>.buffer_rx2</NAME><SEGMENT>SRAM</SEGMENT><ADDRESS>0x1b3</ADDRESS></SEGMENT></SEGMENTS></CONFIG></CONFIGS><LASTCONFIG>default</LASTCONFIG><USES_WINAVR>1</USES_WINAVR><GCC_LOC>C:\WinAVR-20060421\bin\avr-gcc.exe</GCC_LOC><MAKE_LOC>C:\WinAVR-20060421\utils\bin\make.exe</MAKE_LOC></AVRGCCPLUGIN><IOView><usergroups/></IOView><ProjectFiles><Files><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\varis.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\init.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\misc.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\prot.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\rf_ctrl.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\defines.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\bootloader.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\spi.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\version.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\common\commands.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\device.c</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\init.c</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\misc.c</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\prot.c</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\rf_ctrl.c</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\varis.c</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\spi.c</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\bootloader.c</Name></Files></ProjectFiles><Files><File00000><FileId>00000</FileId><FileName>device.c</FileName><Status>1</Status></File00000><File00001><FileId>00001</FileId><FileName>prot.c</FileName><Status>258</Status></File00001><File00002><FileId>00002</FileId><FileName>rf_ctrl.c</FileName><Status>258</Status></File00002><File00003><FileId>00003</FileId><FileName>init.c</FileName><Status>258</Status></File00003><File00004><FileId>00004</FileId><FileName>misc.c</FileName><Status>258</Status></File00004><File00005><FileId>00005</FileId><FileName>spi.c</FileName><Status>258</Status></File00005><File00006><FileId>00006</FileId><FileName>rf_ctrl.h</FileName><Status>1</Status></File00006></Files><Workspace><File00000><Position>329 132 1321 417</Position><LineCol>0 0</LineCol></File00000><File00006><Position>303 72 1391 507</Position><LineCol>48 49</LineCol><State>Maximized</State></File00006></Workspace><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio> Modified: firmware/fuxrf/trunk/device.c =================================================================== --- firmware/fuxrf/trunk/device.c 2008-06-24 09:27:28 UTC (rev 1252) +++ firmware/fuxrf/trunk/device.c 2008-06-24 10:12:31 UTC (rev 1253) @@ -1,54 +1,70 @@ -#include <avr/wdt.h> -#include <stdlib.h> +//***************************************************************************** +//* Project: RF-Firmware Point to Multipoint for ISM - Transceiver ATR2406 * +//* Version: V1.0 * +//* File: appl.c * +//* Target MCU: ATMega88 * +//* Compiler: GCC * +//* Simulator: AVRStudio 4.08 * +//* Emulator: JTAG ICE * +//* Author: Christian Bechter * +//* Date: 31.01.06 * +//* Used Hardware: DEV-KIT-III * +//***************************************************************************** +//***************************************************************************** +//* Copyright 2006, Atmel Germany GmbH * +//* * +//* This software is owned by the Atmel Germany GmbH * +//* and is protected by and subject to worldwide patent protection. * +//* Atmel hereby grants to licensee a personal, * +//* non-exclusive, non-transferable license to copy, use, modify, create * +//* derivative works of, and compile the Atmel Source Code and derivative * +//* works for the sole purpose of creating custom software in support of * +//* licensee product to be used only in conjunction with a Atmel integrated * +//* circuit as specified in the applicable agreement. Any reproduction, * +//* modification, translation, compilation, or representation of this * +//* software except as specified above is prohibited without the express * +//* written permission of Atmel. * +//* * +//* Disclaimer: ATMEL MAKES NO WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, * +//* WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * +//* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * +//* Atmel reserves the right to make changes without further notice to the * +//* materials described herein. Atmel does not assume any liability arising * +//* out of the application or use of any product or circuit described herein. * +//* Atmel does not authorize its products for use as critical components in * +//* life-support systems where a malfunction or failure may reasonably be * +//* expected to result in significant injury to the user. The inclusion of * +//* Atmel products in a life-support systems application implies that the * +//* manufacturer assumes all risk of such use and in doing so indemnifies * +//* Atmel against all charges. * +//* * +//* Use may be limited by and subject to the applicable Atmel software * +//* license agreement. * +//***************************************************************************** + #include "defines.h" #include "init.h" +#include "interface.h" #include "misc.h" #include "varis.h" #include "prot.h" #include "rf_ctrl.h" -#include "spi.h" -#include "common/commands.h" -#include "version.h" -/* - * Configuration - */ -/* Bootloader can be included with the program. */ -#define BOOTLOADER 1 -/* Include version numbers. */ -#define VERSIONING 1 +#define DBG_STACK 1 -/* - * Version number - */ - -#define CPU_NUMBER FUXRF_CPU_NUM /* sound CPU */ - -#if (VERSIONING) -/* XXX Add the linker script to have fixed version positions once the project will compile with latest gcc under linux. */ -const author_t author __attribute__ ((section(".version"))) = +#if (DBG_STACK) +extern uint16_t __heap_start; +void init_ram(void) __attribute__ ((naked)) + __attribute__ ((section(".init1"))); +void init_ram(void) { - AUTHOR_CMD, AUTHOR_ID, 0, -}; -const revision_t svn_revision __attribute__ ((section(".version"))) = -{ - REVISION_CMD, SVN_REV, SVN_STATUS, -}; -const version_t tag_version __attribute__ ((section(".version"))) = -{ - VERSION_CMD, CPU_VER_JOIN(CPU_NUMBER, VER_MAJOR), VER_MINOR, VER_UPDATE, -}; -#endif + uint8_t *ptr; -#if (BOOTLOADER) -#include "bootloader.h" + for (ptr = (uint8_t *) &__heap_start; ptr < (uint8_t *) 0x800300; ptr++) + *ptr = 0x5F; +} #endif -#ifdef WIFI -const unsigned char OffsetTbl[] = - { 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41 }; -#endif - //***************************************************************************** //* Project: RF-Firmware for ISM * //* Function: main * @@ -57,58 +73,34 @@ //* Action: Main routine of the Device * //* Duration: tbd * //* Size: tbd * -//* Date: 26.06.07 * -//* Description: Get connected to the tux, manage sleep mode and SPI * +//* Date: 31.01.06 * +//* Description: Get connected to the Basestation, get values from the sensors* +//* and digital I/O * //***************************************************************************** - -//MASTER +//***************************************************************************** +// SETUP of RF_BUFFER_TX: * +// 0 - 5 -> Preamble * +// 6 - 7 -> Sync * +// 8 - 11 -> SOF * +// 12 -> LEN * +// 13 -> Command * +// 14 - 30 -> Payload * +// 31 -> Checksum * +//***************************************************************************** int main(void) { -#if (BOOTLOADER) - if (!(PINB & 0x04)) /* if SPI_SS is cleared at startup */ - asm volatile ("rjmp bootloader"::); /* jump to bootloader */ -#endif + /* System init */ + init_avr(); + init_varis(); + interface_init(); - init_avr(); // System init - init_varis(); // Init variables - spiTransaction(); // Spi transaction to recieve -// spiConfigFrame[5] = 6; -// spiConfigFrame[6] = 32; - generate_frequency_sequence(); // Generate hopping sequence - init_frame_RF(); // Init RF frame - sei(); - gfilter = eeprom_read_byte(&ee_filter); // Read gaussian filter into the eeprom - if (gfilter == 0xFF) // No value program in the eeprom - gfilter = 5; - gfilter = (gfilter << 1); // Configure gaussian filter - system_start_up(); // Start RF connection - PORTD &= ~0x80; // On line radio + /* XXX debug */ + DDRB |= _BV(PB3) | _BV(PB5); + DDRC |= _BV(PC3); - while (1) // Infinite main loop - { -#ifdef WIFI - if (FHAState == COMPUTE_FREQ) - { - while (1) - { - replaceFrequency += OffsetTbl[random_numb]; // Calculate next channel - if (replaceFrequency >= 93) - replaceFrequency -= 91; - random_numb++; - if (random_numb == 12) - random_numb = 0; - if ((replaceFrequency < spiConfigFrame[5]) - || (replaceFrequency > spiConfigFrame[6])) - break; - } - FHAState = WAIT_ACK_CHF; - } -#endif - if (spi_enable) // Spi transaction ready - { - spi_enable = 0; // Reset spi flag - spiTransaction(); - } + sei(); + system_start_up(); + for(;;){ } } Modified: firmware/fuxrf/trunk/init.c =================================================================== --- firmware/fuxrf/trunk/init.c 2008-06-24 09:27:28 UTC (rev 1252) +++ firmware/fuxrf/trunk/init.c 2008-06-24 10:12:31 UTC (rev 1253) @@ -1,8 +1,53 @@ +//***************************************************************************** +//* Project: RF-Firmware Point to Multipoint for ISM - Transceiver ATR2406 * +//* Version: V1.0 * +//* File: init.c * +//* Target MCU: ATMega88 * +//* Compiler: GCC * +//* Simulator: AVRStudio 4.08 * +//* Emulator: JTAG ICE * +//* Author: Christian Bechter * +//* Date: 31.01.06 * +//* Used Hardware: DEV-KIT-III * +//***************************************************************************** +//***************************************************************************** +//* Copyright 2006, Atmel Germany GmbH * +//* * +//* This software is owned by the Atmel Germany GmbH * +//* and is protected by and subject to worldwide patent protection. * +//* Atmel hereby grants to licensee a personal, * +//* non-exclusive, non-transferable license to copy, use, modify, create * +//* derivative works of, and compile the Atmel Source Code and derivative * +//* works for the sole purpose of creating custom software in support of * +//* licensee product to be used only in conjunction with a Atmel integrated * +//* circuit as specified in the applicable agreement. Any reproduction, * +//* modification, translation, compilation, or representation of this * +//* software except as specified above is prohibited without the express * +//* written permission of Atmel. * +//* * +//* Disclaimer: ATMEL MAKES NO WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, * +//* WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * +//* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * +//* Atmel reserves the right to make changes without further notice to the * +//* materials described herein. Atmel does not assume any liability arising * +//* out of the application or use of any product or circuit described herein. * +//* Atmel does not authorize its products for use as critical components in * +//* life-support systems where a malfunction or failure may reasonably be * +//* expected to result in significant injury to the user. The inclusion of * +//* Atmel products in a life-support systems application implies that the * +//* manufacturer assumes all risk of such use and in doing so indemnifies * +//* Atmel against all charges. * +//* * +//* Use may be limited by and subject to the applicable Atmel software * +//* license agreement. * +//***************************************************************************** + #include "defines.h" #include "init.h" #include "varis.h" -#include "misc.h" + + //***************************************************************************** //* Project: RF-Firmware for ISM * //* Function: init_avr * @@ -11,62 +56,58 @@ //* Action: Basic setup of AVR * //* Duration: tbd * //* Size: tbd * -//* Date: 10.07.06 * +//* Date: 31.01.06 * //* Description: Basic setup of the AVR I/O and for the RF-USART * //***************************************************************************** void init_avr(void) { - //init of AVR ports + //init of AVR ports //*************PORTB*************// - //PORTB.0 -> OUT TXON - //PORTB.1 -> OUT nOLE - //PORTB.2 -> IN CS - //PORTB.3 -> IN MOSI - //PORTB.4 -> OUT MISO - //PORTB.5 -> IN SCK - //PORTB.6 -> XTAL1 - //PORTB.7 -> XTAL2 (output to RF - Chip) - output(PORTB, 0x20); - output(DDRB, 0x13); + //PORTB.0 -> OUT TXON + //PORTB.1 -> OUT nOLE + //PORTB.2 -> IN SS + //PORTB.3 -> IN MOSI + //PORTB.4 -> OUT MISO + //PORTB.5 -> IN SCK + //PORTB.6 -> XTAL1 + //PORTB.7 -> XTAL2 (output to RF - Chip) + PORTB = 0x20; + DDRB = 0x13; //*************PORTB*************// //*************PORTC*************// - //PORTC.0 -> OUT READY SPI - //PORTC.1 -> OUT Enable - //PORTC.2 -> OUT READY SPI - //PORTC.3 -> OUT DEBUFG RF - //PORTC.4 -> NOT USED, PULLED UP - //PORTC.5 -> NOT USED, PULLED UP - //PORTC.6 -> DEBUG - PIN - output(PORTC, 0x31); - output(DDRC, 0x1F); + //PORTC.0 -> SPIACK + //PORTC.1 -> OUT Enable + //PORTC.2 -> TXE (TX [register] empty) + //PORTC.3 -> NOT USED, PULLED UP + //PORTC.4 -> NOT USED, PULLED UP + //PORTC.5 -> NOT USED, PULLED UP + //PORTC.6 -> RESET + PORTC = 0x38; + DDRC = 0x07; //*************PORTC*************// + //*************PORTD*************// + //PORTD.0 -> IN RX_DATA + //PORTD.1 -> OUT TX_DATA/Data + //PORTD.2 -> OUT PU_TRX/PU_REG + //PORTD.3 -> OUTPUT DEBUG + //PORTD.4 -> I/O CLK_REC/Clock + //PORTD.5 -> OUT RXON + //PORTD.6 -> NOT USED, PULLED UP + //PORTD.7 -> LINK + PORTD = 0x40; + DDRD = 0xAE; //*************PORTD*************// - //PORTD.0 -> IN RX_DATA - //PORTD.1 -> OUT TX_DATA/Data - //PORTD.2 -> OUT PU_TRX/PU_REG - //PORTD.3 -> IN RESET LINE - //PORTD.4 -> I/O CLK_REC/Clock - //PORTD.5 -> OUT RXON - //PORTD.6 -> NOT USED, PULLED UP - //PORTD.7 -> OUT ON LINE - output(PORTD, 0xC0); - output(DDRD, 0xA6); - //*************PORTD*************// //***********init-needed-peripherals***************// - output(UBRR0L, 0x05); + UBRR0L = 0x05; //***********init-needed-peripherals***************// + /* Disable UART */ + UCSR0A = 0x00; + UCSR0B = 0x00; + UCSR0C = 0x00; - SPCR = 0x40; /* XXX what's this for? */// Slave - SPSR = 0x00; - - /* Clear the SPI interrupt flag. XXX is this necessary at startup? */ - asm volatile - ("in __tmp_reg__, %0" "\n\t" - "in __tmp_reg__, %1" "\n\t" - ::"I" (_SFR_IO_ADDR(SPSR)), - "I"(_SFR_IO_ADDR(SPDR))); + /* Disable interrupts. */ + TIMSK1 = 0x00; } - //***************************************************************************** //* Project: RF-Firmware for ISM * //* Function: init_varis * @@ -75,93 +116,93 @@ //* Action: init of the global variables * //* Duration: tbd * //* Size: tbd * -//* Date: 10.07.06 * +//* Date: 31.01.06 * //* Description: global variables are init with their default values * //***************************************************************************** void init_varis(void) { - uint8_t i; + //************************************************************************* + // SETUP of RF_BUFFER_TX: * + // 0 - 5 -> Preamble * + // 6 - 7 -> Sync * + // 8 - 11 -> SOF * + // 12 -> LEN * + // 13 -> Command * + // 14 - 30 -> Payload * + // 31 -> Checksum * + //************************************************************************* + //Default setup of the rf_buffer_tx// + rf_buffer_tx[0] = rf_buffer_tx[1] = rf_buffer_tx[2] = 0x55 ^ SCRAMBLE_BYTE; + rf_buffer_tx[3] = rf_buffer_tx[4] = rf_buffer_tx[5] = 0x55 ^ SCRAMBLE_BYTE; + rf_buffer_tx[6] = rf_buffer_tx[7] = 0xFF ^ SCRAMBLE_BYTE; + //Default setup of the rf_buffer_tx// + /* XXX to be cleaned */ + sof_ary[0] = TRX_CHANNEL; + sof_ary[1] = 0x56; + sof_ary[2] = 0xFF; + sof_ary[3] = 0x56; + rf_buffer_tx[8]=channel; + rf_buffer_tx[9]=sof_ary[1]; + rf_buffer_tx[10]=sof_ary[2]; + rf_buffer_tx[11]=sof_ary[3]; - i = input(SPL); - i ^= 0xFF; - extern uint16_t __bss_start; - extern uint16_t __stack; - uint8_t *ptr = (uint8_t *) & __bss_start; + //generate dummy packet + rf_buffer_tx[12]=52; /* Number of bytes from here */ + rf_buffer_tx[13]=0x55; + rf_buffer_tx[14]=0x55; + rf_buffer_tx[15]=0x55; + rf_buffer_tx[16]=0x55; + rf_buffer_tx[17]=0x55; + rf_buffer_tx[18]=0x55; + rf_buffer_tx[19]=0x55; + rf_buffer_tx[20]=0x55; + rf_buffer_tx[21]=0x55; + rf_buffer_tx[22]=0x55; + rf_buffer_tx[23]=0x55; + rf_buffer_tx[24]=0x55; + rf_buffer_tx[25]=0x55; + rf_buffer_tx[26]=0x55; + rf_buffer_tx[27]=0x55; + rf_buffer_tx[28]=0x55; + rf_buffer_tx[29]=0x55; + rf_buffer_tx[30]=0x55; + rf_buffer_tx[31]=0x55; + rf_buffer_tx[32]=0x55; + rf_buffer_tx[33]=0x55; + rf_buffer_tx[34]=0x55; + rf_buffer_tx[35]=0x55; + rf_buffer_tx[36]=0x55; + rf_buffer_tx[37]=0x55; + rf_buffer_tx[38]=0x55; + rf_buffer_tx[39]=0x55; + rf_buffer_tx[40]=0x55; + rf_buffer_tx[41]=0x55; + rf_buffer_tx[42]=0x55; + rf_buffer_tx[43]=0x55; + rf_buffer_tx[44]=0x55; + rf_buffer_tx[45]=0x55; + rf_buffer_tx[46]=0x55; + rf_buffer_tx[47]=0x55; + rf_buffer_tx[48]=0x55; + rf_buffer_tx[49]=0x55; + rf_buffer_tx[50]=0x55; + rf_buffer_tx[51]=0x55; + rf_buffer_tx[52]=0x55; + rf_buffer_tx[53]=0x55; + rf_buffer_tx[54]=0x55; + rf_buffer_tx[55]=0x55; + rf_buffer_tx[56]=0x55; + rf_buffer_tx[57]=0x55; + rf_buffer_tx[58]=0x55; + rf_buffer_tx[59]=0x55; + rf_buffer_tx[60]=0x55; + rf_buffer_tx[61]=0x55; + rf_buffer_tx[62]=0x55; + rf_buffer_tx[63]=0x34; /* Parity checksum manually calculated */ - while (ptr < (uint8_t *) & __stack - i) - { /*sub because of returning of subroutine */ - *ptr++ = 0; - } // Reduce 26 bytes - - rx_buffer_ready = 0x00; - frameCmpt = 0; // Counter of RF frame - frequencyIndex = 0; // Pointer for the table of frequency - FHAState = INIT; // Init of status of FHA state machine - statisticPointer = 0; // Pointer for the table with statistic for FHA - spi_enable = 0; // Flag to start spi transaction - errorFrame = 0; // Detect error in transmission - commandStatus = 0; // Status of the command - ACKmode = 0; // Wait an ACK - - prf_buffer_rx = rf_buffer_rx1; // Init pointer for RF transaction - pspi_buffer_rx = rf_buffer_rx2; // Init pointer for SPI transaction - prf_buffer_tx = rf_buffer_tx1; // Init pointer for RF transaction - pspi_buffer_tx = rf_buffer_tx2; // Init pointer for SPI transaction + /*uint8_t i;*/ + /*for (i=13; i<63; i++)*/ + /*rf_buffer_tx[i] = 0x01;//1<<(i&7);*/ } -//***************************************************************************** -//* Project: RF-Firmware for ISM * -//* Function: init_frame_RF * -//* Parameters: NONE * -//* Returns: NONE * -//* Action: init of TX buffer and compute checksum * -//* Duration: tbd * -//* Size: tbd * -//* Date: 26.06.07 * -//* Description: Init the TX buffers with the starting values * -//***************************************************************************** -void init_frame_RF(void) -{ - unsigned char i, header_rf; - header_rf = SMALLFRAME; // First byte header of the frame - header_rf |= MASTERH; - - if (spiConfigFrame[1] == 0xFF) // Special mode - { - if (spiConfigFrame[3] == 0xFF) // Request ID - { - header_rf |= REQUESTID; - } - else // Change ID - { - header_rf |= CHANGEID; - } - } - - for (i = 0; i < 11; i++) - { - rf_buffer_tx1[i] = 0x55; // Preamble - rf_buffer_tx2[i] = 0x55; // Preamble - } - - for (i = 11; i < 13; i++) - { - rf_buffer_tx1[i] = 0xFF; // Synchro - rf_buffer_tx2[i] = 0xFF; // Synchro - } - - rf_buffer_tx1[14] = rf_buffer_tx2[14] = sof_ary[1] = spiConfigFrame[0]; // Set ID - rf_buffer_tx1[15] = rf_buffer_tx2[15] = sof_ary[2] = spiConfigFrame[1]; - rf_buffer_tx1[16] = rf_buffer_tx2[16] = header_rf; - if (spiConfigFrame[4] == 0x01) // Wake up from PC - rf_buffer_tx1[17] = rf_buffer_tx2[17] = 0x20; // Second byte header of the frame - else - rf_buffer_tx1[17] = rf_buffer_tx2[17] = 0x00; // Second byte header of the frame - - rf_buffer_tx1[18] = rf_buffer_tx2[18] = spiConfigFrame[2]; // Hopping parameters Index (dummy) / Toy ID for init - rf_buffer_tx1[19] = rf_buffer_tx2[19] = spiConfigFrame[3]; // Hopping parameters Channel (dummy) / Toy ID for init - rf_buffer_tx1[20] = rf_buffer_tx2[20] = 0x55; - calc_checksum(rf_buffer_tx1); - calc_checksum(rf_buffer_tx2); -} Modified: firmware/fuxrf/trunk/init.h =================================================================== --- firmware/fuxrf/trunk/init.h 2008-06-24 09:27:28 UTC (rev 1252) +++ firmware/fuxrf/trunk/init.h 2008-06-24 10:12:31 UTC (rev 1253) @@ -1,10 +1,55 @@ +//***************************************************************************** +//* Project: RF-Firmware Point to Multipoint for ISM - Transceiver ATR2406 * +//* Version: V1.0 * +//* File: init.h * +//* Target MCU: ATMega88 * +//* Compiler: GCC * +//* Simulator: AVRStudio 4.08 * +//* Emulator: JTAG ICE * +//* Author: Christian Bechter * +//* Date: 31.01.06 * +//* Used Hardware: DEV-KIT-III * +//***************************************************************************** +//***************************************************************************** +//* Copyright 2006, Atmel Germany GmbH * +//* * +//* This software is owned by the Atmel Germany GmbH * +//* and is protected by and subject to worldwide patent protection. * +//* Atmel hereby grants to licensee a personal, * +//* non-exclusive, non-transferable license to copy, use, modify, create * +//* derivative works of, and compile the Atmel Source Code and derivative * +//* works for the sole purpose of creating custom software in support of * +//* licensee product to be used only in conjunction with a Atmel integrated * +//* circuit as specified in the applicable agreement. Any reproduction, * +//* modification, translation, compilation, or representation of this * +//* software except as specified above is prohibited without the express * +//* written permission of Atmel. * +//* * +//* Disclaimer: ATMEL MAKES NO WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, * +//* WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * +//* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * +//* Atmel reserves the right to make changes without further notice to the * +//* materials described herein. Atmel does not assume any liability arising * +//* out of the application or use of any product or circuit described herein. * +//* Atmel does not authorize its products for use as critical components in * +//* life-support systems where a malfunction or failure may reasonably be * +//* expected to result in significant injury to the user. The inclusion of * +//* Atmel products in a life-support systems application implies that the * +//* manufacturer assumes all risk of such use and in doing so indemnifies * +//* Atmel against all charges. * +//* * +//* Use may be limited by and subject to the applicable Atmel software * +//* license agreement. * +//***************************************************************************** #ifndef INIT_H #define INIT_H + + #include "defines.h" extern void init_avr(void); extern void init_varis(void); -extern void init_frame_RF(void); +extern void init_led_pwm(void); #endif Added: firmware/fuxrf/trunk/interface.c =================================================================== --- firmware/fuxrf/trunk/interface.c (rev 0) +++ firmware/fuxrf/trunk/interface.c 2008-06-24 10:12:31 UTC (rev 1253) @@ -0,0 +1,82 @@ +/* + * TUXAUDIO - Firmware for the 'audio' CPU of tuxdroid + * Copyright (C) 2007 C2ME S.A. <tux...@c2...> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* $Id$ */ + +#include <avr/io.h> +#include <avr/interrupt.h> + +#include "interface.h" +#include "varis.h" + +/** + * Initialize the SPI interface. + */ +void interface_init(void) +{ + SPCR = _BV(SPIE) | _BV(SPE); + clr_link(); + clr_txe(); + clr_spiack(); +} + +static uint8_t * const spi_in = (uint8_t *)rf_buffer_tx+13; +static uint8_t * spi_out; + +static uint8_t spi_idx; +ISR(SIG_SPI) +{ + /* Get byte n and prepare byte n+1 to send. */ + spi_in[spi_idx] = SPDR; + set_spiack(); + spi_idx++; + SPDR = spi_out[spi_idx]; + clr_spiack(); +} + +void spi_request(void) +{ + /* XXX should we disable/enable SPIE? */ + spi_idx = 0; + /* XXX size is at [0] -> +1 for the start of the frame */ + spi_out = (uint8_t *)rf_buffer_rx_full+1; + SPDR = spi_out[spi_idx]; + set_txe(); +} + +int8_t spi_complete(void) + /* XXX guess this isn't truly necessary */ +{ + clr_txe(); + if (spi_idx == 63) + { + return 1; + } + else if (spi_idx > 63) + /* Error */ + { + return -1; + } + else + /* Not finished */ + /* XXX what to do here? */ + { + return 0; + } +} Property changes on: firmware/fuxrf/trunk/interface.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Name: svn:eol-style + native Added: firmware/fuxrf/trunk/interface.h =================================================================== --- firmware/fuxrf/trunk/interface.h (rev 0) +++ firmware/fuxrf/trunk/interface.h 2008-06-24 10:12:31 UTC (rev 1253) @@ -0,0 +1,46 @@ +/* + * [TF]UXRF - Firmware for the 'RF' CPU of tuxdroid + * Copyright (C) 2007 C2ME S.A. <tux...@c2...> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* $Id$ */ + +#ifndef INTERFACE_H +#define INTERFACE_H + +#define LINK_PORT PORTD +#define LINK_DDR DDRD +#define LINK_OUT PD7 +#define TXE_PORT PORTC +#define TXE_DDR DDRC +#define TXE_OUT PC2 +#define SPIACK_PORT PORTC +#define SPIACK_DDR DDRC +#define SPIACK_OUT PC0 + +#define set_link() (LINK_PORT |= _BV(LINK_OUT)) +#define clr_link() (LINK_PORT &= ~_BV(LINK_OUT)) +#define set_txe() (TXE_PORT |= _BV(TXE_OUT)) +#define clr_txe() (TXE_PORT &= ~_BV(TXE_OUT)) +#define set_spiack() (SPIACK_PORT |= _BV(SPIACK_OUT)) +#define clr_spiack() (SPIACK_PORT &= ~_BV(SPIACK_OUT)) + +void interface_init(void); +int8_t spi_complete(void); +void spi_request(void); + +#endif /* INTERFACE_H */ Property changes on: firmware/fuxrf/trunk/interface.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Name: svn:eol-style + native Modified: firmware/fuxrf/trunk/misc.c =================================================================== --- firmware/fuxrf/trunk/misc.c 2008-06-24 09:27:28 UTC (rev 1252) +++ firmware/fuxrf/trunk/misc.c 2008-06-24 10:12:31 UTC (rev 1253) @@ -1,3 +1,47 @@ +//************... [truncated message content] |
From: remi <c2m...@c2...> - 2008-06-24 09:27:26
|
Author: remi Date: 2008-06-24 11:27:28 +0200 (Tue, 24 Jun 2008) New Revision: 1252 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_user_inputs.h Log: * Added a command to reset the RF * Changed to RF reset instead of dongle reset when too many read errors occur. * Changed read errors threshold from 50 to 3. * Removed one status reading of two, by cycle. * Changed cycle length from 50msec to 100msec. * Changed a threshold in the remote key release detection. (3 -> 2) Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c 2008-06-23 15:22:51 UTC (rev 1251) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c 2008-06-24 09:27:28 UTC (rev 1252) @@ -44,6 +44,7 @@ static int read_error_counter = 0; static char frame_status_request[5] = {1, 1, 0, 0, 0}; static char frame_reset_dongle[5] = {1, 1, 0, 0, 0xFE}; +static char frame_reset_rf[5] = {1, 1, 0, 0, 0xFD}; #ifdef USE_MUTEX static mutex_t __connected_mutex; @@ -285,7 +286,7 @@ #ifdef USE_MUTEX mutex_unlock(__read_write_mutex); #endif - log_error("Failed to write on USB device (RF disconnected)"); + log_warning("Failed to write on USB device (RF disconnected)"); return TuxUSBWriteError; } } @@ -327,10 +328,11 @@ if ((packet_count == 0) && (rf_state == 1)) { read_error_counter++; + log_warning("Read errors count : %d\n", read_error_counter); if (read_error_counter >= TUX_USB_ERROR_LIMIT) { - /* Reset of the dongle */ - tux_usb_reset(); + /* Reset of the RF */ + tux_usb_rf_reset(); } } else @@ -384,7 +386,7 @@ if (!tux_usb_connected()) { - log_error("Fux USB device not connected"); + log_warning("Fux USB device not connected"); return TuxUSBNotConnected; } @@ -413,6 +415,7 @@ if (!ret) { set_connected(false); + tux_usb_reset(); tux_usb_release(); log_error("Fux is disconnected"); return TuxUSBDisconnected; @@ -481,7 +484,6 @@ } tux_usb_read(data); - tux_usb_read(data); if (loop_cycle_complete_function) { @@ -560,6 +562,15 @@ } /** + * + */ +LIBLOCAL void +tux_usb_rf_reset(void) +{ + tux_hid_write(TUX_SEND_LENGTH, (char *)frame_reset_rf); +} + +/** * Send a raw command * @param data 5 bytes array */ Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.h =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.h 2008-06-23 15:22:51 UTC (rev 1251) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.h 2008-06-24 09:27:28 UTC (rev 1252) @@ -35,8 +35,8 @@ #define TUX_READ_EP 0x84 #define TUX_WRITE_TIMEOUT 1000 #define TUX_READ_TIMEOUT 1000 -#define TUX_READ_LOOP_INTERVAL 0.05 -#define TUX_USB_ERROR_LIMIT 50 +#define TUX_READ_LOOP_INTERVAL 0.1 +#define TUX_USB_ERROR_LIMIT 3 #define MIN_FIRMWARE_VERSION 0x030 #ifdef WIN32 @@ -172,6 +172,11 @@ */ extern void tux_usb_reset(void); +/** + * Reset the RF + */ +extern void tux_usb_rf_reset(void); + /** * Send a command to Tuxdroid. * @param data 4 bytes array Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_user_inputs.h =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_user_inputs.h 2008-06-23 15:22:51 UTC (rev 1251) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_user_inputs.h 2008-06-24 09:27:28 UTC (rev 1252) @@ -23,7 +23,7 @@ #include <stdbool.h> -#define RC5_TIMEOUT 3 +#define RC5_TIMEOUT 2 #define K_0 0x00 #define K_1 0x01 |
From: Paul_R <c2m...@c2...> - 2008-06-23 15:22:50
|
Author: Paul_R Date: 2008-06-23 17:22:51 +0200 (Mon, 23 Jun 2008) New Revision: 1251 Removed: software_suite_v2/middleware/tuxdriver/trunk/firmware/ Modified: firmware/hex_dev/fuxusb.hex Log: * Removed fuxusb.hex from the tuxdriver tree * Updated hex_dev with fuxusb - HID version Modified: firmware/hex_dev/fuxusb.hex =================================================================== (Binary files differ) |
From: remi <c2m...@c2...> - 2008-06-23 13:47:33
|
Author: remi Date: 2008-06-23 15:47:37 +0200 (Mon, 23 Jun 2008) New Revision: 1250 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_driver.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_sound_flash.c Log: * changed the status which give the sound flash playing state. Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_driver.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_driver.c 2008-06-23 13:23:11 UTC (rev 1249) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_driver.c 2008-06-23 13:47:37 UTC (rev 1250) @@ -153,7 +153,6 @@ case FRAME_HEADER_SENSORS1: if (header == ret) { - tux_sound_flash_update_flash_play(); tux_sound_flash_update_general_play(); tux_user_inputs_update_head_button(); tux_user_inputs_update_left_wing_button(); @@ -195,6 +194,9 @@ } break; */ + case FRAME_HEADER_AUDIO: + tux_sound_flash_update_flash_play(); + break; /*case FRAME_HEADER_PONG: tux_pong_update(); break;*/ Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_sound_flash.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_sound_flash.c 2008-06-23 13:23:11 UTC (rev 1249) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_sound_flash.c 2008-06-23 13:47:37 UTC (rev 1250) @@ -147,14 +147,14 @@ will not get the event. */ tracktoggle = !tracktoggle; - if (!hw_status_table.sensors1.play_internal_sound) + if (!hw_status_table.audio.sound_track_played) { new_track = STRING_VALUE_STOP; } else { sprintf(track[tracktoggle], "TRACK_%.3d", - hw_status_table.sensors1.play_internal_sound); + hw_status_table.audio.sound_track_played); new_track = track[tracktoggle]; } |
From: remi <c2m...@c2...> - 2008-06-23 13:23:02
|
Author: remi Date: 2008-06-23 15:23:11 +0200 (Mon, 23 Jun 2008) New Revision: 1249 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/log.c Log: * changed the logger. Now the file is opened for write a message and closed just after. Modified: software_suite_v2/middleware/tuxdriver/trunk/src/log.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/log.c 2008-06-23 13:13:51 UTC (rev 1248) +++ software_suite_v2/middleware/tuxdriver/trunk/src/log.c 2008-06-23 13:23:11 UTC (rev 1249) @@ -33,7 +33,7 @@ #endif /** All logged messages are prefixed with this text */ -#define LOG_PREFIX "tux_driver" +#define LOG_PREFIX "libtuxdriver" /** Current logging level */ static log_level_t current_level = LOG_LEVEL_INFO; @@ -80,6 +80,8 @@ { return false; } + fclose(log_file); + log_file = NULL; break; case LOG_TARGET_SHELL: @@ -106,8 +108,6 @@ switch (log_target) { case LOG_TARGET_TUX: - fclose(log_file); - log_file = NULL; break; case LOG_TARGET_SHELL: @@ -118,6 +118,22 @@ } /** + * + */ +static void +write_log_text(char *text) +{ + log_file = fopen(LOG_FILE, "a"); + if (log_file == NULL) + { + return; + } + fprintf(log_file, "%s\n", text); + fclose(log_file); + log_file = NULL; +} + +/** * Set the logging level. * * /param[in] new_level New logging level @@ -217,17 +233,17 @@ switch (log_target) { case LOG_TARGET_TUX: - fprintf(log_file, "%s\n", text); + write_log_text(text); break; case LOG_TARGET_SHELL: if (at_level == LOG_LEVEL_WARNING || at_level == LOG_LEVEL_ERROR) { - fprintf(stderr, "tux_driver: %s\n", text); + fprintf(stderr, "%s: %s\n", LOG_PREFIX, text); } else { - fprintf(stdout, "tux_driver: %s\n", text); + fprintf(stdout, "%s: %s\n", LOG_PREFIX, text); } break; } |
From: Paul_R <c2m...@c2...> - 2008-06-23 13:13:46
|
Author: Paul_R Date: 2008-06-23 15:13:51 +0200 (Mon, 23 Jun 2008) New Revision: 1248 Modified: software/tuxgi/trunk/tuxgi.py software/tuxgi/trunk/tuxgi2.glade Log: * Added the sound flash functions. The functions for the microphone aren't implemented yet * Fix a bug with the led function Modified: software/tuxgi/trunk/tuxgi.py =================================================================== --- software/tuxgi/trunk/tuxgi.py 2008-06-23 12:32:00 UTC (rev 1247) +++ software/tuxgi/trunk/tuxgi.py 2008-06-23 13:13:51 UTC (rev 1248) @@ -324,7 +324,6 @@ # ----------------------------------------------------------------------------- # Tab "main" events # ----------------------------------------------------------------------------- - #-------------------------------------------------------------------------- # On left led checkbox toggled #-------------------------------------------------------------------------- @@ -351,12 +350,9 @@ # On flash leds button clicked #-------------------------------------------------------------------------- def on_flash_bt_clicked(self, widget, *args): - def _funct(): - num_sb=self.get_widget("spinbutton1") - # XXX New command with counter - tux.led.both.blinkAsync(SPV_NORMAL, 1.0) + num_sb=self.get_widget("spinbutton1").get_value() + tux.led.both.blinkAsync(SPV_NORMAL, int(num_sb)) - thread.start_new_thread(_funct,()) #-------------------------------------------------------------------------- # On eyes open radiobutton toggled @@ -562,224 +558,154 @@ # On "play" external wave file button clicked #-------------------------------------------------------------------------- def on_wave_external_play_bt_clicked(self, widget, *args): - print "FIXME :: play external : not implemented yet" - ''' if str(self.get_widget("filechooserbutton1").get_filename())=="None": return - tux.sys.shell_free("aplay -D %s %s"% (soundcard, - self.get_widget("filechooserbutton1").get_filename())) - ''' + tux.wav.play(self.get_widget("filechooserbutton1").get_filename()) + #-------------------------------------------------------------------------- # On select original sounds #-------------------------------------------------------------------------- def on_incl_orig_toggled(self, widget, *args): - print "FIXME :: Original waves : not implemented yet" - ''' - st_wav_paths = wavs.wav_paths if widget.get_active(): - wavs.wav_paths=[] - wavs.wav_sizes=[] + self.wav_list = [] for i in range(17): - wavs.add_wav_path('/opt/tuxdroid/apps/tuxgi/sounds/%d.wav'%(i+1)) - for path in st_wav_paths: - wavs.add_wav_path(path) + self.wav_list.append('/opt/tuxdroid/tuxgi/sounds/%d.wav'%(i+1)) else: - if len(st_wav_paths) > 17: + if len(self.wav_list) > 17: for i in range(17): - wavs.wav_sizes.pop(0) - wavs.wav_paths.pop(0) + self.wav_list.pop(0) else: - wavs.wav_paths=[] - wavs.wav_sizes=[] + self.wav_list = [] self.refresh_wav_list() - ''' #-------------------------------------------------------------------------- # On select internal wave file event #-------------------------------------------------------------------------- def on_wave_internal_changed(self, widget, *args): - print "FIXME :: Internal waves : not implemented yet" - ''' filename=widget.get_filename() ext=len(filename)-filename.find(".wav") if ext != 4 : widget.unselect_filename(filename) - ''' #-------------------------------------------------------------------------- # On "add" button clicked #-------------------------------------------------------------------------- def on_wave_internal_add_bt_clicked(self, widget, *args): - print "FIXME :: Add sound : not implemented yet" - ''' if str(self.get_widget("filechooserbutton2").get_filename())=="None": return - wavs.add_wav_path(self.get_widget("filechooserbutton2").get_filename()) + self.wav_list.append(self.get_widget("filechooserbutton2").get_filename()) self.refresh_wav_list() - ''' + #-------------------------------------------------------------------------- # On "remove" button clicked #-------------------------------------------------------------------------- def on_wave_internal_remove_bt_clicked(self, widget, *args): - print "FIXME :: Remove sound : not implemented yet" - ''' index=int(self.get_widget("spinbutton8").get_value()) - if index>len(wavs.wav_paths):return - wavs.wav_sizes.pop(index-1) - wavs.wav_paths.pop(index-1) + if index>len(self.wav_list):return + self.wav_list.pop(index-1) self.refresh_wav_list() - ''' #-------------------------------------------------------------------------- # Refreshing wave list function #-------------------------------------------------------------------------- def refresh_wav_list(self): - print "FIXME :: Clear list : not implemented yet" - ''' wav_te=self.get_widget("textview3") wav_buffer=wav_te.get_buffer() wav_buffer.set_text("") i=1 - for wavfile in wavs.wav_paths: + for wavfile in self.wav_list: filename=wavfile[wavfile.rfind('/')+1:] wav_buffer.insert(wav_buffer.get_end_iter(),"%.2d : %s\n" %(i,filename)) i=i+1 - ''' #-------------------------------------------------------------------------- # On "clear" internal wave file list button clicked #-------------------------------------------------------------------------- def on_wave_internal_clist_bt_clicked(self, widget, *args): - print "FIXME :: Internal sounds : not implemented yet" - ''' - wavs.wav_sizes=[] - wavs.wav_paths=[] + self.wav_list = [] self.get_widget("checkbutton4").set_active(False) self.refresh_wav_list() - ''' #-------------------------------------------------------------------------- # On "store" button clicked #-------------------------------------------------------------------------- def on_wave_internal_store_bt_clicked(self, widget, *args): - print "FIXME :: Store waves : not implemented yet" - #thread.start_new_thread(self.sound_storing,()) + thread.start_new_thread(self.sound_storing,()) #-------------------------------------------------------------------------- # Store sound function #-------------------------------------------------------------------------- def sound_storing(self): - print "FIXME :: Sound storing : not implemeted yet" - ''' - if tux.status.rf_state() == 0: return - if len(wavs.wav_sizes)==0: return - wav_te=self.get_widget("textview3") - wav_buffer=wav_te.get_buffer() - if not wavs.wavs_merging("merged.wav"): - print wav_buffer.insert(wav_buffer.get_end_iter(), - "Sound storing : Error : file merged is too big\n") - return - wav_buffer.insert(wav_buffer.get_end_iter(), - "Sound storing : Erase flash\n") - tux.cmd.sound_storing(len(wavs.wav_sizes)) - tux.sys.wait(10) - current_pos=0x0400 - tux.sys.wait(0.1) - wav_buffer.insert(wav_buffer.get_end_iter(), - "Sound storing : Indexes\n") - tux.cmd.sound_store_index(0x00,0x04,0x00) - for size in wavs.wav_sizes: - current_pos=current_pos+size - tux.sys.wait(0.1) - tux.cmd.sound_store_index((current_pos & 0xFF0000)>>16, - (current_pos & 0x00FF00)>>8,current_pos & 0x0000FF) - wav_buffer.insert(wav_buffer.get_end_iter(),"Sound storing : Record\n") - tux.sys.shell("aplay -D %s merged.wav"%soundcard) - wav_buffer.insert(wav_buffer.get_end_iter(), - "Sound storing : Storage done.\n") - tux.sys.wait(0.3) - ''' + if tux.access.waitAcquire(10.0, ACCESS_PRIORITY_CRITICAL): + tux.soundFlash.reflash(self.wav_list) + tux.access.release() + #-------------------------------------------------------------------------- # On "play" flash sound button clicked #-------------------------------------------------------------------------- def on_wave_internal_play_bt_clicked(self, widget, *args): - print "FIXME :: Play internal wave %d : Not implemented yet" \ - %(self.get_widget("spinbutton7").get_value()) - ''' - def _funct(): - index=self.get_widget("spinbutton7").get_value() - tux.cmd.sound_play(int(index),0) + index=self.get_widget("spinbutton7").get_value() + tux.soundFlash.playAsync(int(index)) - thread.start_new_thread(_funct,()) - ''' + #-------------------------------------------------------------------------- # On "play flash sound number 1" button clicked #-------------------------------------------------------------------------- def on_wave_internal_play1_clicked(self, widget, *args): - pass - #thread.start_new_thread(tux.cmd.sound_play,(1,0,)) + tux.soundFlash.playAsync(1) #-------------------------------------------------------------------------- # On "play flash sound number 2" button clicked #-------------------------------------------------------------------------- def on_wave_internal_play2_clicked(self, widget, *args): - pass - #thread.start_new_thread(tux.cmd.sound_play,(2,0,)) + tux.soundFlash.playAsync(2) #-------------------------------------------------------------------------- # On "play flash sound number 3" button clicked #-------------------------------------------------------------------------- def on_wave_internal_play3_clicked(self, widget, *args): - pass - #thread.start_new_thread(tux.cmd.sound_play,(3,0,)) + tux.soundFlash.playAsync(3) #-------------------------------------------------------------------------- # On "play flash sound number 4" button clicked #-------------------------------------------------------------------------- def on_wave_internat_play4_clicked(self, widget, *args): - pass - #thread.start_new_thread(tux.cmd.sound_play,(4,0,)) + tux.soundFlash.playAsync(4) #-------------------------------------------------------------------------- # On "play flash sound number 5" button clicked #-------------------------------------------------------------------------- def on_wave_internal_play5_clicked(self, widget, *args): - pass - #thread.start_new_thread(tux.cmd.sound_play,(5,0,)) + tux.soundFlash.playAsync(5) #-------------------------------------------------------------------------- # On "play flash sound number 6" button clicked #-------------------------------------------------------------------------- def on_wave_internal_play6_clicked(self, widget, *args): - pass - #thread.start_new_thread(tux.cmd.sound_play,(6,0,)) + tux.soundFlash.playAsync(6) #-------------------------------------------------------------------------- # On "play flash sound number 7" button clicked #-------------------------------------------------------------------------- def on_wave_internal_play7_clicked(self, widget, *args): - pass - #thread.start_new_thread(tux.cmd.sound_play,(7,0,)) + tux.soundFlash.playAsync(7) #-------------------------------------------------------------------------- # On "play flash sound number 8" button clicked #-------------------------------------------------------------------------- def on_wave_internal_play8_clicked(self, widget, *args): - pass - #thread.start_new_thread(tux.cmd.sound_play,(8,0,)) + tux.soundFlash.playAsync(8) #-------------------------------------------------------------------------- # On "play flash sound number 9" button clicked #-------------------------------------------------------------------------- def on_wave_internal_play9_clicked(self, widget, *args): - pass - #thread.start_new_thread(tux.cmd.sound_play,(9,0,)) + tux.soundFlash.playAsync(9) #-------------------------------------------------------------------------- # On "play flash sound number 10" button clicked #-------------------------------------------------------------------------- def on_wave_internal_play10_clicked(self, widget, *args): - pass - #thread.start_new_thread(tux.cmd.sound_play,(10,0,)) + tux.soundFlash.playAsync(10) #-------------------------------------------------------------------------- # On "Play recorded wave file" button clicked @@ -827,26 +753,6 @@ def on_window2_destroy(self, widget, *args): print "closed" - #-------------------------------------------------------------------------- - # On "Send command" button clicked - #-------------------------------------------------------------------------- - def on_sendcommand_bt_clicked(self, widget, *args): - commandst=self.get_widget("entry1").get_text() - commands=commandst.split(" ") - if len(commands)<4: - return - else: - commandp=[0,0,0,0] - for i in range(len(commands)): - if commands[i].find("0x")!=-1: - commandp[i]=int(commands[i][2:],16) - else: - commandp[i]=int(commands[i]) - print "FIXME :: Raw command : This function isn't implemented yet" - #tux.cmd.raw(int(commandp[0]),int(commandp[1]),int(commandp[2]), - #int(commandp[3])) - - #------------------------------------------------------------------------------ # Main #------------------------------------------------------------------------------ Modified: software/tuxgi/trunk/tuxgi2.glade =================================================================== --- software/tuxgi/trunk/tuxgi2.glade 2008-06-23 12:32:00 UTC (rev 1247) +++ software/tuxgi/trunk/tuxgi2.glade 2008-06-23 13:13:51 UTC (rev 1248) @@ -70,7 +70,7 @@ <property name="visible">True</property> <child> - <widget class="GtkImage" id="image2"> + <widget class="GtkImage" id="image4"> <property name="width_request">21</property> <property name="height_request">21</property> <property name="visible">True</property> @@ -83,12 +83,12 @@ </widget> <packing> <property name="x">192</property> - <property name="y">0</property> + <property name="y">39</property> </packing> </child> <child> - <widget class="GtkImage" id="image3"> + <widget class="GtkImage" id="image2"> <property name="width_request">21</property> <property name="height_request">21</property> <property name="visible">True</property> @@ -101,60 +101,16 @@ </widget> <packing> <property name="x">192</property> - <property name="y">24</property> + <property name="y">10</property> </packing> </child> <child> - <widget class="GtkImage" id="image4"> - <property name="width_request">21</property> - <property name="height_request">21</property> - <property name="visible">True</property> - <property name="stock">gtk-cancel</property> - <property name="icon_size">4</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="x">192</property> - <property name="y">48</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label27"> - <property name="width_request">166</property> - <property name="height_request">20</property> - <property name="visible">True</property> - <property name="label" translatable="yes">Radio connection</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">True</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="x">0</property> - <property name="y">48</property> - </packing> - </child> - - <child> <widget class="GtkLabel" id="label9"> <property name="width_request">136</property> <property name="height_request">20</property> <property name="visible">True</property> - <property name="label" translatable="yes">Tux Droid daemon</property> + <property name="label" translatable="yes">Tux HTTP Server</property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> @@ -171,16 +127,16 @@ </widget> <packing> <property name="x">0</property> - <property name="y">0</property> + <property name="y">10</property> </packing> </child> <child> - <widget class="GtkLabel" id="label10"> + <widget class="GtkLabel" id="label27"> <property name="width_request">166</property> <property name="height_request">20</property> <property name="visible">True</property> - <property name="label" translatable="yes">Text To Speech daemon</property> + <property name="label" translatable="yes">Radio connection</property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> @@ -197,7 +153,7 @@ </widget> <packing> <property name="x">0</property> - <property name="y">24</property> + <property name="y">39</property> </packing> </child> </widget> @@ -2320,94 +2276,4 @@ </child> </widget> -<widget class="GtkWindow" id="window2"> - <property name="width_request">257</property> - <property name="height_request">70</property> - <property name="visible">True</property> - <property name="title" translatable="yes">Send command</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">False</property> - <property name="destroy_with_parent">False</property> - <property name="decorated">True</property> - <property name="skip_taskbar_hint">False</property> - <property name="skip_pager_hint">False</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - <property name="focus_on_map">True</property> - <property name="urgency_hint">False</property> - <signal name="destroy" handler="on_window2_destroy"/> - - <child> - <widget class="GtkFixed" id="fixed12"> - <property name="visible">True</property> - - <child> - <widget class="GtkEntry" id="entry1"> - <property name="width_request">160</property> - <property name="height_request">27</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes">0x31 0 0 0</property> - <property name="has_frame">True</property> - <property name="invisible_char">•</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="x">8</property> - <property name="y">32</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label26"> - <property name="width_request">149</property> - <property name="height_request">20</property> - <property name="visible">True</property> - <property name="label" translatable="yes">Type raw command:</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">True</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="x">8</property> - <property name="y">8</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="button35"> - <property name="width_request">72</property> - <property name="height_request">27</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Send</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <signal name="clicked" handler="on_sendcommand_bt_clicked"/> - </widget> - <packing> - <property name="x">176</property> - <property name="y">32</property> - </packing> - </child> - </widget> - </child> -</widget> - </glade-interface> |
From: Paul_R <c2m...@c2...> - 2008-06-23 12:31:55
|
Author: Paul_R Date: 2008-06-23 14:32:00 +0200 (Mon, 23 Jun 2008) New Revision: 1247 Modified: firmware/tuxaudio/trunk/flash.c Log: * Reset the soundToPlay variable when a invalid play command has been received. Modified: firmware/tuxaudio/trunk/flash.c =================================================================== --- firmware/tuxaudio/trunk/flash.c 2008-06-23 11:20:58 UTC (rev 1246) +++ firmware/tuxaudio/trunk/flash.c 2008-06-23 12:32:00 UTC (rev 1247) @@ -341,11 +341,13 @@ if (numSound == 0x00) /* if unprogrammed we have 0xFF stored in flash */ { flashPlay = 0; + soundToPlay = 0; return; } if (!nsound || (nsound > numSound)) /* check the limits */ { flashPlay = 0; + soundToPlay = 0; return; } @@ -387,26 +389,31 @@ if (ad[0] > TOP_A2) { flashPlay = 0; + soundToPlay = 0; return; } /* don't read outside the flash */ if (ad[3] > TOP_A2) { flashPlay = 0; + soundToPlay = 0; return; } /* don't read outside the flash */ if ((ad[0] == 0) && (ad[1] < 0x04)) { flashPlay = 0; + soundToPlay = 0; return; } /* minimum index not respected */ if ((ad[4] == 0) && (ad[5] < 0x04)) { flashPlay = 0; + soundToPlay = 0; return; } /* minimum index not respected */ if (ad[3] < ad[0]) { flashPlay = 0; + soundToPlay = 0; return; } /* check that the stop index is greater than the start index */ else if (ad[3] == ad[0]) @@ -414,6 +421,7 @@ if (ad[4] < ad[1]) { flashPlay = 0; + soundToPlay = 0; return; } else if (ad[4] == ad[1]) @@ -421,6 +429,7 @@ if (ad[5] <= ad[2]) { flashPlay = 0; + soundToPlay = 0; return; } } |
From: remi <c2m...@c2...> - 2008-06-23 11:20:53
|
Author: remi Date: 2008-06-23 13:20:58 +0200 (Mon, 23 Jun 2008) New Revision: 1246 Modified: software/tuxgi/trunk/tuxgi.py Log: * added the gtk mutex when the text view is changed (Operations from a thread) Modified: software/tuxgi/trunk/tuxgi.py =================================================================== --- software/tuxgi/trunk/tuxgi.py 2008-06-23 11:06:16 UTC (rev 1245) +++ software/tuxgi/trunk/tuxgi.py 2008-06-23 11:20:58 UTC (rev 1246) @@ -281,35 +281,44 @@ while self.__thread_on: if status_list_changed: status_list_changed=False + gtk.gdk.threads_enter() statusview_b=self.get_widget("textview1").get_buffer() statusview_b.set_text("") startiter = statusview_b.get_start_iter() + gtk.gdk.threads_leave() string="" if self.get_widget("checkbutton3").get_active(): for i in range(len(status_list_st)): string=status_list_st[i]+"\n"+string else: string=status_list_st[len(status_list_st)-1]+"\n" + gtk.gdk.threads_enter() statusview_b.insert(startiter,string) + gtk.gdk.threads_leave() if tux.server.getConnected() != last_tuxdaemon_connect: last_tuxdaemon_connect = tux.server.getConnected() + gtk.gdk.threads_enter() if tux.server.getConnected(): self.get_widget("image2").set_from_stock(gtk.STOCK_APPLY\ ,gtk.ICON_SIZE_BUTTON) else: self.get_widget("image2").set_from_stock(gtk.STOCK_CANCEL\ ,gtk.ICON_SIZE_BUTTON) + gtk.gdk.threads_leave() if tux.radio.getConnected()!=last_rf_state: last_rf_state = tux.radio.getConnected() + + gtk.gdk.threads_enter() if last_rf_state: self.get_widget("image4").set_from_stock(gtk.STOCK_APPLY\ ,gtk.ICON_SIZE_BUTTON) else: self.get_widget("image4").set_from_stock(gtk.STOCK_CANCEL\ ,gtk.ICON_SIZE_BUTTON) + gtk.gdk.threads_leave() time.sleep(0.05) # ----------------------------------------------------------------------------- |
From: remi <c2m...@c2...> - 2008-06-23 11:06:13
|
Author: remi Date: 2008-06-23 13:06:16 +0200 (Mon, 23 Jun 2008) New Revision: 1245 Modified: software/tuxgi/trunk/tuxgi.py Log: * changed the tux api object creation. * Added the resource access acquisition way in the "attitunes" functions Modified: software/tuxgi/trunk/tuxgi.py =================================================================== --- software/tuxgi/trunk/tuxgi.py 2008-06-23 08:50:09 UTC (rev 1244) +++ software/tuxgi/trunk/tuxgi.py 2008-06-23 11:06:16 UTC (rev 1245) @@ -30,7 +30,7 @@ import sys import time -from tuxisalive.api.sh import * +from tuxisalive.api import * # ----------------------------------------------- # Your script # ----------------------------------------------- @@ -86,6 +86,10 @@ if xterm_cmd is None: sys.stderr.write("Warning: couldn't find any suitable terminal" " to use as Tux Droid shell\n") +# Create a tux api object +tux = TuxAPI("127.0.0.1", 81) +# Set the auto connection +tux.server.autoConnect(CLIENT_LEVEL_RESTRICTED, "Tuxgi", "Passwd") #============================================================================== # Main window class @@ -154,13 +158,23 @@ # Attitunes #-------------------------------------------------------------------------- def on_fileAtt_selection_changed(self, widget, *args): - tux.attitune.load(widget.get_filename()) + # Wait 5 seconds max that the resource can be acquired + # help(tux.access.waitAcquire) to see the other priority + # levels + if tux.access.waitAcquire(5.0, ACCESS_PRIORITY_NORMAL): + tux.attitune.load(widget.get_filename()) + # Release the resource + tux.access.release() def on_btnPlayAtt_clicked(self, widget, *args): - tux.attitune.play() + if tux.access.waitAcquire(5.0): + tux.attitune.play() + tux.access.release() def on_btnStopAtt_clicked(self, widget, *args): - tux.attitune.stop() + if tux.access.waitAcquire(5.0): + tux.attitune.stop() + tux.access.release() #-------------------------------------------------------------------------- # On window destroy #-------------------------------------------------------------------------- |
From: Paul_R <c2m...@c2...> - 2008-06-23 08:50:07
|
Author: Paul_R Date: 2008-06-23 10:50:09 +0200 (Mon, 23 Jun 2008) New Revision: 1244 Modified: software/tuxgi/trunk/tuxgi.py Log: * Bug with the tuxapi import Modified: software/tuxgi/trunk/tuxgi.py =================================================================== --- software/tuxgi/trunk/tuxgi.py 2008-06-23 07:48:09 UTC (rev 1243) +++ software/tuxgi/trunk/tuxgi.py 2008-06-23 08:50:09 UTC (rev 1244) @@ -30,8 +30,7 @@ import sys import time -from tuxisalive.api import * -tux=shellTux() +from tuxisalive.api.sh import * # ----------------------------------------------- # Your script # ----------------------------------------------- |
From: remi <c2m...@c2...> - 2008-06-23 07:48:10
|
Author: remi Date: 2008-06-23 09:48:09 +0200 (Mon, 23 Jun 2008) New Revision: 1243 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_driver.c Log: * disabled the pong requests for the evaluation of the quality of the connection. This function is now incompatible with the last tuxcore firmware. Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_driver.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_driver.c 2008-06-23 07:09:22 UTC (rev 1242) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_driver.c 2008-06-23 07:48:09 UTC (rev 1243) @@ -195,9 +195,9 @@ } break; */ - case FRAME_HEADER_PONG: + /*case FRAME_HEADER_PONG: tux_pong_update(); - break; + break;*/ } } @@ -255,7 +255,7 @@ on_read_loop_cycle_complete(void) { tux_user_inputs_update_RC5(); - tux_pong_get(); + /* tux_pong_get(); */ tux_firmware_state_machine_call(); tux_sound_flash_state_machine_call(); tux_hw_status_header_counter_check(); |
From: Paul_R <c2m...@c2...> - 2008-06-23 07:09:13
|
Author: Paul_R Date: 2008-06-23 09:09:22 +0200 (Mon, 23 Jun 2008) New Revision: 1242 Modified: firmware/tuxaudio/trunk/flash.c firmware/tuxaudio/trunk/parser.c Log: * Fix a bug with the audio flash. Reset the playing status if the sound doesn't exists Modified: firmware/tuxaudio/trunk/flash.c =================================================================== --- firmware/tuxaudio/trunk/flash.c 2008-06-23 07:07:05 UTC (rev 1241) +++ firmware/tuxaudio/trunk/flash.c 2008-06-23 07:09:22 UTC (rev 1242) @@ -435,6 +435,7 @@ OCR0A = 250; // Normal operation for PWM if fifo adaptative is on flash_state = 0; + queue_rf_cmd_p(STATUS_AUDIO_CMD, numSound, 0, 0); } /* Static functions */ Modified: firmware/tuxaudio/trunk/parser.c =================================================================== --- firmware/tuxaudio/trunk/parser.c 2008-06-23 07:07:05 UTC (rev 1241) +++ firmware/tuxaudio/trunk/parser.c 2008-06-23 07:09:22 UTC (rev 1242) @@ -91,7 +91,6 @@ audioLevel = cmd[2]; //playingAudio(cmd[1]); /* start playing the sound */ soundToPlay = cmd[1]; - queue_rf_cmd_p(STATUS_AUDIO_CMD, cmd[1], 0, 0); flashPlay = 1; flash_state = 1; } |
From: Paul_R <c2m...@c2...> - 2008-06-23 07:06:58
|
Author: Paul_R Date: 2008-06-23 09:07:05 +0200 (Mon, 23 Jun 2008) New Revision: 1241 Modified: software_suite_v2/middleware/tuxdriver/trunk/firmware/fuxusb.hex Log: * Updated fuxusb - HID version Modified: software_suite_v2/middleware/tuxdriver/trunk/firmware/fuxusb.hex =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/firmware/fuxusb.hex 2008-06-23 07:04:54 UTC (rev 1240) +++ software_suite_v2/middleware/tuxdriver/trunk/firmware/fuxusb.hex 2008-06-23 07:07:05 UTC (rev 1241) @@ -1,135 +1,135 @@ -:101600001217D2120006300905120F7B80F5121650 -:08161000C850F012026980EBE2 -:0C17D200438F01C281D2A3D2AF020E23CC -:0C17DE00C8040401C9000004CA00000097 -:060E23001218F943BC8027 -:100E290090011E1205E10000271043BC1090011E1D -:100E3900E0FCA3E0FDA3E0FEA3E0FFEC4D4E4F6014 -:100E490018EF24FFFFEE34FFFEED34FFFDEC34FF15 -:0C0E5900FC90011E1205D580D453BCEFA4 -:100E65007D80E4FF1218F2E4FF1217321216485380 -:080E7500F1FC43F101D2B322AC -:10000600E5BD30E5051217B88012E5BD30E40512EE -:1000160018A78008E5BD30E00312189EE5BD30E361 -:100026000E53BDF71214679000FCE0600214F01244 -:0D0036001375120D56E5F8600312116A22D1 -:0415940041010E0003 -:100E7D00E5CFF0A3E5CFF0A3E5CFF0A3E5CFF022CA -:100E8D0090010BE4F07412A3F090011074FFF0A325 -:100E9D002253CEFB43CE802290010BE4F0A32253CC -:100EAD00CEFD53CE7F22900110E0FBA3E0FAA3E02C -:100EBD00F92253CE7F53CEFB22F053CEFB43CE10FF -:080ECD0022E4F5CF43CE102210 -:10164800E4900114F0A3F0A3F090010EF090013A99 -:06165800F0900139F022C0 -:1011A9007D857F011218F27F011217327D817F023E -:1011B9001218F27F021217327D817F031218F27F13 -:1011C900031217327D877F041218F27F0412173237 -:0C11D9007D837F051218F27F050217329B -:06190700E4F5C702094FE0 -:10094F0090010FE5CFF090010DE5CFF090010FE092 -:10095F005460707390010DE024FEB40A005066904D -:10096F00097C75F003A4C58325F0C583730209CFF5 -:10097F000209D40209D40209A402099A0209D40275 -:10098F00099F0209A90209B90209CA12063E806F1E -:10099F0012153A806A121618806590010FE07005E3 -:1009AF001213A0805A121743805590010FE0B481A3 -:1009BF000512186C804912178E8044120DBF803FAC -:1009CF0012165E803A803290010FE05460642070FE -:1009DF002890010DE0247E600F1460111460132421 -:1009EF00037014121558801712157680121214F80E -:1009FF00800D1215198008800053CEFB1217525329 -:030A0F00CE7F2275 -:1016180090011EE5CFF053CEFB43BC0112181A907F -:07162800011EE04480F5C63D -:01162F002298 -:1013A000AFCF120EBFEFD39401501B90010EEFF0A0 -:1013B000B4010912141B12148D12188012181A127B -:0913C00011A943BC0222121752CC -:0113C9002201 -:100DBF0090011E120E7D120EBF900120E0B4031899 -:100DCF0090011EE0701290013AF0900139F07F040B -:100DDF001217327F05121732900120E0B4010C90E8 -:100DEF00011EE0B401057F81121732900120E0B49B -:100DFF00020C90011EE0B401057F02121732900120 -:100E0F0020E0B4050C90011EE0B401057F0312171A -:040E1F003202181A69 +:101614001217E6120006300905120F8280F5121621 +:08162400DC50F012026980EBBA +:0C17E600438F01C281D2A3D2AF020E2AB1 +:0C17F200C8040401C9000004CA00000083 +:060E2A0012190D43BC800B +:100E300090011E1205E10000271043BC1090011E16 +:100E4000E0FCA3E0FDA3E0FEA3E0FFEC4D4E4F600D +:100E500018EF24FFFFEE34FFFEED34FFFDEC34FF0E +:0C0E6000FC90011E1205D580D453BCEF9D +:100E6C007D80E4FF121906E4FF12174612165C533C +:080E7C00F1FC43F101D2B322A5 +:10000600E5BD30E5051217CC8012E5BD30E40512DA +:1000160018BB8008E5BD30E0031218B2E5BD30E339 +:100026000E53BDF712147B9000FCE0600214F01230 +:0D00360013B1120D5DE5F860031211742284 +:0415A80041010E00EF +:100E8400E5CFF0A3E5CFF0A3E5CFF0A3E5CFF022C3 +:100E940090010BE4F07412A3F090011074FFF0A31E +:100EA4002253CEFB43CE802290010BE4F0A32253C5 +:100EB400CEFD53CE7F22900110E0FBA3E0FAA3E025 +:100EC400F92253CE7F53CEFB22F053CEFB43CE10F8 +:080ED40022E4F5CF43CE102209 +:10165C00E4900114F0A3F0A3F090010EF090013A85 +:06166C00F0900139F022AC +:1011B3007D857F011219067F011217467D817F020B +:1011C3001219067F021217467D817F031219067FCB +:1011D300031217467D877F041219067F04121746F0 +:0C11E3007D837F051219067F0502174668 +:06191B00E4F5C7020A1307 +:100A130090010FE5CFF090010DE5CFF090010FE0CD +:100A23005460707390010DE024FEB40A0050669088 +:100A33000A4075F003A4C58325F0C58373020A93A6 +:100A4300020A98020A98020A68020A5E020A9802D7 +:100A53000A63020A6D020A7D020A8E12063E806F45 +:100A630012154E806A12162C806590010FE07005F6 +:100A73001213DC805A121757805590010FE0B4818E +:100A83000512188080491217A28044120DC6803FB8 +:100A9300121672803A803290010FE0546064207025 +:100AA3002890010DE0247E600F146011146013245C +:100AB30003701412156C801712158A801212150C0C +:100AC300800D12152D8008800053CEFB121766533C +:030AD300CE7F22B1 +:10162C0090011EE5CFF053CEFB43BC0112182E9057 +:07163C00011EE04480F5C629 +:011643002284 +:1013DC00AFCF120EC6EFD39401501B90010EEFF05D +:1013EC00B4010912142F1214A112189412182E12EF +:0913FC0011B343BC022212176672 +:0114050022C4 +:100DC60090011E120E84120EC6900120E0B4031884 +:100DD60090011EE0701290013AF0900139F07F0404 +:100DE6001217467F05121746900120E0B4010C90B9 +:100DF600011EE0B401057F81121746900120E0B480 +:100E0600020C90011EE0B401057F02121746900104 +:100E160020E0B4050C90011EE0B401057F03121713 +:040E26004602182E3A :10063E00C20AAFCFAECFEE24FE601E14605424E289 -:10064E00603E14602924216003020759120E8D7436 +:10064E00603E14602924216003020759120E94742F :10065E0000F0A37446F002076390010B7401F0746E -:10066E004B120E947401F0A3741EF0020763120E67 -:10067E00A57422120E957402F0A37447F00207635C -:10068E00120EA57409120E957401F0A374D5F00222 +:10066E004B120E9B7401F0A3741EF0020763120E60 +:10067E00AC7422120E9C7402F0A37447F00207634E +:10068E00120EAC7409120E9C7401F0A374D5F00214 :10069E000763EFB4090040030207599006B0F8282B :1006AE0028730206CB0206D80206EA0206F70207F4 -:1006BE0009020726020715020737020748120E8D98 -:1006CE007400F0A37458F0020763120EA5740C1296 -:1006DE000E957400F0A3746AF0020763120E8D7407 -:1006EE0000F0A37476F0020763120EA5740C120EBE -:1006FE00957400F0A37488F0020763120E8D7400D7 -:10070E00F0A37494F0804E120EA5741E120E957402 -:10071E0000F0A374C8F0803D120EA57422120E953F -:10072E007400F0A374A6F0802C120EA5741A120E8B -:10073E00957400F0A374E6F0801B120EA5741E12C1 -:10074E000E957401F0A37400F0800A53CEFB1217BD -:10075E005253CE7F22E5CFE5CF90011FE5CFF0902B +:1006BE0009020726020715020737020748120E9491 +:1006CE007400F0A37458F0020763120EAC740C128F +:1006DE000E9C7400F0A3746AF0020763120E9474F9 +:1006EE0000F0A37476F0020763120EAC740C120EB7 +:1006FE009C7400F0A37488F0020763120E947400C9 +:10070E00F0A37494F0804E120EAC741E120E9C74F4 +:10071E0000F0A374C8F0803D120EAC7422120E9C31 +:10072E007400F0A374A6F0802C120EAC741A120E84 +:10073E009C7400F0A374E6F0801B120EAC741E12B3 +:10074E000E9C7401F0A37400F0800A53CEFB1217B6 +:10075E006653CE7F22E5CFE5CF90011FE5CFF09017 :10076E00011EE5CFF090010BE0FEA3E0FF90011E0D :10077E00E0FCA3E0FDD39FEC9E400CEF541F600203 :10078E008001D3920A800890010BECF0A3EDF012D9 -:10079E000E9ED390010CE0942090010BE09400404B -:1007AE000B120EB37D201210E540E722120EB3900D -:1007BE00010BA3E0FD1210E55029300A0A120EB308 -:1007CE00E4FD1210E5501CE5CE54427005E5CE3026 +:10079E000EA5D390010CE0942090010BE094004044 +:1007AE000B120EBA7D201210EF40E722120EBA90F5 +:1007BE00010BA3E0FD1210EF5029300A0A120EBAF7 +:1007CE00E4FD1210EF501CE5CE54427005E5CE301C :1007DE00E2F5E5CE20E20CE5CE5442600653CE7F24 :0307EE0053CEFDEA :0107F10022E5 -:1010E500900120EDF01216ED900110EBF0A3EAF05F -:1010F500A3E9F0900120E0FFC390010CE09FF09080 -:10110500010BE09400F0E5CE54427005E5CE30E0E9 -:10111500F553CEFEE5CE5442600853CEEF53CEFDD7 -:04112500C322D322EC -:10153A00120E9E90010EE0F5CF43CE10E5CE30E0BC -:0E154A00FB53CEFEE5CE544260FA120EAC22E8 -:0A186C00120E9E12175253CE7F2277 -:100F2B00E5CFE5CFAFCF120E9E90010FE0247F608F -:100F3B000C14600E2402701975CF018014E4F5CFE8 -:100F4B00800FEF547F2413F582E43401F583E0F531 -:100F5B00CF120ECEE5CE30E0FBE5CE20E2F653CE3F -:0F0F6B00FEE5CE544260FAE5CE20E2F5120EAC60 -:010F7A002254 -:1010130090010FE07002803790010FE0B40102806D -:101023002E90010FE06402702CE5CF7028E5CFAF5E -:10103300CFEF247F701975C70143CE20E4F5C79025 -:10104300011404120EC6E5CE30E0FB53CEFE22534C -:06105300CEFB1217522231 -:100ED50090010FE07002804790010FE0B40102809D -:100EE5003E90010FE06402703CE5CF7038E5CFAF6E -:100EF500CFEF601F247F702775C70153CEDF7F01B9 -:100F0500121732E4F5C7900114120EC6E5CE30E093 -:100F1500FB8008120EC7E5CE30E0FB53CEFE225310 -:060F2500CEFB1217522260 -:1015580090011E120E7D120E9E120ECEE5CE30E0C8 -:0D156800FB53CEFEE5CE544260FA120EACED -:011575002253 -:1015760090011E120E7D120E9E120ECEE5CE30E0AA -:0D158600FB53CEFEE5CE544260FA120EACCF -:011593002235 -:1014F80090011E120E7D120E9E75CF0A43CE10E586 -:10150800CE30E0FB53CEFEE5CE544260FA120EAC6C -:0115180022B0 -:1015190090011E120E7D120E9E75CF0143CE10E56D -:10152900CE30E0FB53CEFEE5CE544260FA120EAC4B -:01153900228F -:0C17EA00900125120E7D120EBF02181A8D -:0C17F600900129120E7D120EBF02181A7D -:0C18020090012D120E7D120EBF02181A6C -:0C180E00900131120E7D120EBF02181A5C -:0F17430053CEFBE5CE544260FA53CEFD02181A86 -:0E178E00E5CF90010AE5CFF053CEFB02181A0A -:10165E00120E9E90010AE0F5CF12181AE5CE5442F2 -:06166E0060FA120EAC222E -:0F17520043CE20E5CE30E3FB53CEDF53CEF7225C -:0C181A0043CE10E5CE30E0FB53CEFE22A2 +:1010EF00900120EDF0121701900110EBF0A3EAF040 +:1010FF00A3E9F0900120E0FFC390010CE09FF09076 +:10110F00010BE09400F0E5CE54427005E5CE30E0DF +:10111F00F553CEFEE5CE5442600853CEEF53CEFDCD +:04112F00C322D322E2 +:10154E00120EA590010EE0F5CF43CE10E5CE30E0A1 +:0E155E00FB53CEFEE5CE544260FA120EB322CD +:0A188000120EA512176653CE7F2248 +:100F3200E5CFE5CFAFCF120EA590010FE0247F6081 +:100F42000C14600E2402701975CF018014E4F5CFE1 +:100F5200800FEF547F2413F582E43401F583E0F52A +:100F6200CF120ED5E5CE30E0FBE5CE20E2F653CE31 +:0F0F7200FEE5CE544260FAE5CE20E2F5120EB352 +:010F8100224D +:1010630090010FE07002803790010FE0B40102801D +:101073002E90010FE06402702CE5CF7028E5CFAF0E +:10108300CFEF247F701975C70143CE20E4F5C790D5 +:10109300011404120ECDE5CE30E0FB53CEFE2253F5 +:0610A300CEFB12176622CD +:100EDC0090010FE07002804790010FE0B401028096 +:100EEC003E90010FE06402703CE5CF7038E5CFAF67 +:100EFC00CFEF601F247F702775C70153CEDF7F01B2 +:100F0C00121746E4F5C7900114120ECDE5CE30E071 +:100F1C00FB8008120ECEE5CE30E0FB53CEFE225302 +:060F2C00CEFB1217662245 +:10156C0090011E120E84120EA5120ED5E5CE30E09F +:0D157C00FB53CEFEE5CE544260FA120EB3D2 +:01158900223F +:10158A0090011E120E84120EA5120ED5E5CE30E081 +:0D159A00FB53CEFEE5CE544260FA120EB3B4 +:0115A7002221 +:10150C0090011E120E84120EA575CF0A43CE10E563 +:10151C00CE30E0FB53CEFEE5CE544260FA120EB351 +:01152C00229C +:10152D0090011E120E84120EA575CF0143CE10E54B +:10153D00CE30E0FB53CEFEE5CE544260FA120EB330 +:01154D00227B +:0C17FE00900125120E84120EC602182E57 +:0C180A00900129120E84120EC602182E46 +:0C18160090012D120E84120EC602182E36 +:0C182200900131120E84120EC602182E26 +:0F17570053CEFBE5CE544260FA53CEFD02182E5E +:0E17A200E5CF90010AE5CFF053CEFB02182EE2 +:10167200120EA590010AE0F5CF12182EE5CE5442C3 +:0616820060FA120EB32213 +:0F17660043CE20E5CE30E3FB53CEDF53CEF72248 +:0C182E0043CE10E5CE30E0FB53CEFE228E :100046001201100100000020EB0307FF410001022E :100056000301120309040000000000000000000074 :10006600000000000C034B00790073006F0068006D @@ -165,92 +165,94 @@ :10024600000600FF0901A1010903150026FF00951C :1002560040750881020904150026FF0095407508BF :030266009102C042 -:06159800C106C107C105F8 -:10116A00E5F830E00BE4F5C7E5CE30E203121907E3 -:10117A00E5F830E10312179CE5F830E2031216890C -:10118A00E5F830E303121674E5F830E4031214B2FA -:0F119A00E5F830E509300006120C7512121E221E -:1016DB0090013AE0600B75C704E5CE20E40343CEDE -:0216EB001022CB -:0E13750090010EE0602412177F501F20051C0F -:1013830075C70190011E7408F01216B38FCF900138 -:0C1393001EE014F0E070F243CE10D20512 -:01139F00222B -:0E179C0075C701E5CE30E00553CEFEC2052232 -:1016740075C70330060B12193AEF60057F0812157F -:05168400B253CEFD226F -:1016890075C70220060B12193AEF60057F0812157B -:05169900B253CEFD225A -:10121E0075C705900139E0FF700CE5CE30E107533C -:10122E00CEFD7401F022EFB4010EE5CE30E6095387 -:10123E00CEBFE4900139F022E5CE30E60453CEBFA6 -:05124E002253CEFD2239 -:1014B20075C704E5CE30E01A53CEFE90013AE0142F -:1014C200F0E0C394005002E4F090013AE06003437C -:0314D200CE102217 -:1014D500EF24FFFFEE34FFFEED34FFFDEC34FFFC9F -:1014E5000205D5E0FCA3E0FDA3E0FEA3E0FFEC4D83 -:0314F5004E4F2235 -:100C750075C705E5CE5442606D12193AEF14900020 -:100C8500FBF0AFCFE490011EF09000FBE0FE900179 -:100C95001EE0FDC39E501574BB2DF582E43400F5AE -:100CA50083E5CFF090011EE004F080DDEF600A24BB -:100CB500FE6030047030020A12C200D203E49001D3 -:100CC5001EF090011EE0FF24BBF582E43400F5839D -:100CD500E0FE74182FF8A60690011EE004F0E0B4BB -:060CE50004E022120BF4F2 -:010CEB0022E6 -:100D560030076590013AE0C39402505C75C704E41D -:100D6600F5CF30A303FF80027F018FCF900116E0FD -:100D7600F5CFE51060071313543FFF80027F008F05 -:100D8600CFE4F517E517C3951050091218618FCFF8 -:100D9600051780F0851017E517C3943C5007E4F556 -:100DA600CF051780F212188090013AE004F012166F -:080DB600DBE4900116F0C20716 -:010DBE002212 -:1013F30075C70475CFF0EF60047F0080027F018F13 -:10140300CFAF058FCFAF038FCF900123E0F5CF9000 -:08141300013AE004F00216DBCF -:100A12009000BBE0B401209000BEE02403600F14FC -:100A2200600F14600F146003020AB2D2072202148C -:100A32001B0212530210599000BBE0B4020DA3E056 -:100A4200600614706BD20622C206229000BBE064DC -:100A520006705D1218809017DE120AB39017DF122B -:100A62000AB39017E0120ABA9017E1120ABA901765 -:100A7200E2120AC19017E3120AC19017E3E474016B -:100A820093FF1216309017E5120AC89017E6120A61 -:100A9200C89017E7E493FF1216309017E7E4740149 -:100AA20093FF1216309017E9E493FF121630D20723 -:100AB20022E493FF12163022E493FF12163022E44E -:0D0AC20093FF12163022E493FF121630222B -:0A125300E4F5A8F5B175C314C281DB -:10125D0090011F1205E10000271043BC1090011FE3 -:10126D001214E8600890011F1214D580F053BCEFE2 -:0A127D00D2B375A61E75A6E180FE2F -:10105900E4F5A8F5B175C314D2B3C281FD7F40127E -:0B106900131B7B017DF47F041215CDEA -:1010740090011F1205E10000271043BC1090011FCE -:101084001214E8600890011F1214D580F053BCEFCD -:0B1094001218E375A61E75A6E180FE91 -:09189E0053BDFE43BC40C281228F -:0D17B80053BCBF53BDFE53BDDF53BDF72230 -:0918A70053BDEF1216480218802F -:06159E00C181C104C1027D -:0A187600E490011BF090011AF0222B -:0E17AA00121876D201D291C202C204D20022DD -:10148D0053AFFE43C31043C30253C3F753C3FB43D0 -:10149D00C32043C340D2B2D2B4D291D288D2A812C3 -:0514AD001876D20022B8 -:0300030002192EB1 -:03192E00D20432AE -:1002690030B410C204E490011CF0121877C201C224 +:0615AC00C106C107C105E4 +:10117400E5F830E00BE4F5C7E5CE30E20312191BC5 +:10118400E5F830E1031217B0E5F830E20312169DDA +:10119400E5F830E303121688E5F830E4031214C6C8 +:0F11A400E5F830E509300006120C7C1212282203 +:1016EF0090013AE0600B75C704E5CE20E40343CECA +:0216FF001022B7 +:0E13B10090010EE06024121793501F20051CBF +:1013BF0075C70190011E7408F01216C78FCF9001E8 +:0C13CF001EE014F0E070F243CE10D205D6 +:0113DB0022EF +:0E17B00075C701E5CE30E00553CEFEC205221E +:1016880075C70330060B12194EEF60057F08121557 +:05169800C653CEFD2247 +:10169D0075C70220060B12194EEF60057F08121553 +:0516AD00C653CEFD2232 +:1012280075C705900139E0FF700CE5CE30E1075332 +:10123800CEFD7401F022EFB4010EE5CE30E609537D +:10124800CEBFE4900139F022E5CE30E60453CEBF9C +:051258002253CEFD222F +:1014C60075C704E5CE30E01A53CEFE90013AE0141B +:1014D600F0E0C394005002E4F090013AE060034368 +:0314E600CE102203 +:1014E900EF24FFFFEE34FFFEED34FFFDEC34FFFC8B +:1014F9000205D5E0FCA3E0FDA3E0FEA3E0FFEC4D6F +:031509004E4F2220 +:100C7C0075C705E5CE5442606D12194EEF14900005 +:100C8C00FBF0AFCFE490011EF09000FBE0FE900172 +:100C9C001EE0FDC39E501574BB2DF582E43400F5A7 +:100CAC0083E5CFF090011EE004F080DDEF600A24B4 +:100CBC00FE603004703002094FC200D203E4900190 +:100CCC001EF090011EE0FF24BBF582E43400F58396 +:100CDC00E0FE74182FF8A60690011EE004F0E0B4B4 +:060CEC0004E022120BFBE4 +:010CF20022DF +:100D5D0030076590013AE0C39402505C75C704E416 +:100D6D00F5CF30A303FF80027F018FCF900116E0F6 +:100D7D00F5CFE51060071313543FFF80027F008FFE +:100D8D00CFE4F517E517C3951050091218758FCFDD +:100D9D00051780F0851017E517C3943C5007E4F54F +:100DAD00CF051780F212189490013AE004F0121654 +:080DBD00EFE4900116F0C207FB +:010DC500220B +:1012910075C70475CFF0EF60047F0080027F018F76 +:1012A100CFAF058FCFAF038FCF900123E0F5CFE410 +:1012B100FFE4F5CF0FEFB43BF890013AE004F00200 +:0212C10016EF26 +:10094F009000BBE07001229000BBE0B4012090004A +:10095F00BEE02403600F14600F14600F14600302D5 +:10096F0009F6D2072202142F02125D020FD1900056 +:10097F00BBE0B4020DA3E0600614706BD20622C276 +:10098F0006229000BBE06406705D1218949017F277 +:10099F001209F79017F31209F79017F41209FE9046 +:1009AF0017F51209FE9017F6120A059017F7120A9B +:1009BF00059017F7E4740193FF1216449017F9127C +:1009CF000A0C9017FA120A0C9017FBE493FF1216F9 +:1009DF00449017FBE4740193FF1216449017FDE443 +:1009EF0093FF121644D20722E493FF12164422E417 +:1009FF0093FF12164422E493FF12164422E493FF4E +:040A0F001216442255 +:0A125D00E4F5A8F5B175C314C281D1 +:1012670090011F1205E10000271043BC1090011FD9 +:101277001214FC600890011F1214E980F053BCEFB0 +:0A128700D2B375A61E75A6E180FE25 +:100FD100E4F5A8F5B175C314D2B3C2817B067D01D6 +:0E0FE1007F041215E17B017DF47F041215E1FF +:100FEF0090011F1205E10000271043BC1090011F54 +:100FFF001214FC600890011F1214E980F053BCEF2B +:0B100F001218F775A61E75A6E180FE02 +:0918B20053BDFE43BC40C281227B +:0D17CC0053BCBF53BDFE53BDDF53BDF7221C +:0918BB0053BDEF12165C021894F3 +:0615B200C181C104C10269 +:0A188A00E490011BF090011AF02217 +:0E17BE0012188AD201D291C202C204D20022B5 +:1014A10053AFFE43C31043C30253C3F753C3FB43BC +:1014B100C32043C340D2B2D2B4D291D288D2A812AF +:0514C100188AD2002290 +:030003000219429D +:03194200D204329A +:1002690030B410C204E490011CF012188BC201C210 :1002790091D202200203020487200403020487E4C6 -:1002890090011EF0C20490011BE0702C12177050EF +:1002890090011EF0C20490011BE0702C12178450DB :100299000E900118300304740A80127402800E3023 :1002A900030790011874088004E4900118F0F5C55B :1002B90090011B7401F0805790011BE0B40119A350 :1002C900E0B4110690011B7402F0900118E030E1CE -:1002D9003B12169E8FC5803790011BE0FF640270A8 +:1002D9003B1216B28FC5803790011BE0FF64027094 :1002E90027A3E0FEB4150F900118E030E302C20322 :1002F90090011B7403F0900118E030E30974062E95 :10030900F8E6F5C580098004EFB40303E4F5C59068 @@ -272,70 +274,70 @@ :100409000714E4B50610A3E5C5F0E0FF900116E076 :10041900C39F5002EFF0900119E0FF2406FDE43379 :10042900FC90011CE06D7001EC7041D200C202D257 -:1004390091D201E954826003121287900117E030CA +:1004390091D201E9548260031212C3900117E0308E :10044900E33C900120E06036E490011FF090011F29 -:10045900E02420F582E43401F583E0FF12163090A0 +:10045900E02420F582E43401F583E0FF121644908C :10046900011FE004F0E0C3940440E22290011EE081 :0E04790004F0300409E0C39405500302028D24 :010487002252 -:0415A4004100FD0005 -:1012B90074BB2FF582E43400F583E0FF9000FEE073 -:1012C900FE04F0900104E0FCA3E02EF582E43CF575 -:1012D90083EFF090011FE004F022E4900123F0FB7A -:0112E90022E2 -:100BF4009000BBE0B40105120FCA803120090E1227 -:100C040012E37D01FF1213F31218CB80209000BB76 -:100C1400E0B4030F1218CB1212E37DFE7F0112130E -:100C2400F3800A9000BBE0B40203120ACF9000FFE5 -:100C3400E0FF900106E0FEB50725900109E0FD9074 -:100C440000FEE0B50519900108E02DF0900107E0E1 -:100C54003400F0E49000FEF0900106F0D20822EE99 -:100C6400C39F400C1212E37D05FF1213F31218CB3D -:010C7400225D -:100F7B009000FCE07048300845781E7C017D017BB9 -:100F8B00017A0179007E007F0612055890012474C6 -:100F9B0040F0121349900097E020E0F99000FC74A8 -:100FAB0014F0900097E0C413135401FF9000FDE080 -:0F0FBB0004FDF0E4900123F0FB1213F3C20822AF -:100ACF00900106E070779000BCE0900101F0A3E484 -:100ADF00F09000BDE0FF900102E02FF0900101E0E7 -:100AEF003400F09000FBE0B404028039900101E083 -:100AFF00FEA3E0FFEE547FFC900107E06C7003A3B0 -:100B0F00E06F6024EF64C07003EE641D601A900103 -:100B1F0001E0640E7004A3E064C0600C1212E37D68 -:100B2F0003FF1213F31218CB90011F7403F09001FF -:100B3F001FE0FFC39423501A1212B980F190011FC6 -:100B4F007401F090011FE0FFC3942150051212B9F8 -:080B5F0080F1900106E004F0B2 -:010B6700226B -:100FCA009000FC74FAF01216FF1214419000BCE073 -:100FDA0025E0900100F09000BDE0900109F090003A -:100FEA00BEE09000FFF0E4900107F0A3F09000FE4D -:100FFA00F0900106F09000FDF0D209C2A8900123FA -:09100A00F0FB7DFF7F010213F3EE -:0818CB00C20912141B0217AA46 -:1016FF0012191E1218EB9001047400F0A37403F07A -:01170F0022B7 -:10134900900097E054BFF090011EE0900098F09053 -:10135900011FE0FCA3E0FDEC900001F0A3EDF0908B -:0C1369000124E02402900096F0021761BD -:10109F0090008AE0FF04F0748B2FF582E43400F5A2 -:1010AF0083E595F022E0FF04F074012FF582E4341C -:1010BF0000F58322900096E0FF900000E0C39F228E -:1010CF00E0FBA3E0FAA3E0F9EA494B22A3E0FAA37D -:0610DF00E0F5828A832285 -:04191E00759380221B -:0718EB007593C043B1022216 -:0C182600900083EBF0A3EAF0A3E9F022AD -:0C183200900087EBF0A3EAF0A3E9F0229D -:0F176100900097E04401F0E4900000F00219229C -:0419220043932022A9 -:0B185600439310900097E054FEF02236 -:031931008F95226D -:0419260043930422C1 -:04192A005393FB22B6 -:03193400AF95224A -:03193700AF942248 +:0415B8004100FD00F1 +:1012F50074BB2FF582E43400F583E0FF9000FEE037 +:10130500FE04F0900104E0FCA3E02EF582E43CF538 +:1013150083EFF090011FE004F022E4900123F0FB3D +:0113250022A5 +:100BFB009000BBE0B4010512101A803120090E12CF +:100C0B00131F7D01FF1212911218DF80209000BB81 +:100C1B00E0B4030F1218DF12131F7DFE7F011212B7 +:100C2B0091800A9000BBE0B40203120AD69000FF39 +:100C3B00E0FF900106E0FEB50725900109E0FD906D +:100C4B0000FEE0B50519900108E02DF0900107E0DA +:100C5B003400F0E49000FEF0900106F0D20822EE92 +:100C6B00C39F400C12131F7D05FF1212911218DF48 +:010C7B002256 +:100F82009000FCE07048300845781E7C017D017BB2 +:100F9200017A0179007E007F0612055890012474BF +:100FA20040F0121385900097E020E0F99000FC7465 +:100FB20014F0900097E0C413135401FF9000FDE079 +:0F0FC20004FDF0E4900123F0FB121291C208220B +:100AD600900106E070779000BCE0900101F0A3E47D +:100AE600F09000BDE0FF900102E02FF0900101E0E0 +:100AF6003400F09000FBE0B404028039900101E07C +:100B0600FEA3E0FFEE547FFC900107E06C7003A3A8 +:100B1600E06F6024EF64C07003EE641D601A9001FC +:100B260001E0640E7004A3E064C0600C12131F7D24 +:100B360003FF1212911218DF90011F7403F0900147 +:100B46001FE0FFC39423501A1212F580F190011F83 +:100B56007401F090011FE0FFC3942150051212F5B5 +:080B660080F1900106E004F0AB +:010B6E002264 +:10101A009000FC74FAF01217131214559000BCE0F9 +:10102A0025E0900100F09000BDE0900109F09000E9 +:10103A00BEE09000FFF0E4900107F0A3F09000FEFC +:10104A00F0900106F09000FDF0D209C2A8900123A9 +:09105A00F0FB7DFF7F0102129101 +:0818DF00C20912142F0217BE0A +:101713001219321218FF9001047400F0A37403F03D +:0117230022A3 +:10138500900097E054BFF090011EE0900098F09017 +:10139500011FE0FCA3E0FDEC900001F0A3EDF0904F +:0C13A5000124E02402900096F00217756D +:1010A90090008AE0FF04F0748B2FF582E43400F598 +:1010B90083E595F022E0FF04F074012FF582E43412 +:1010C90000F58322900096E0FF900000E0C39F2284 +:1010D900E0FBA3E0FAA3E0F9EA494B22A3E0FAA373 +:0610E900E0F5828A83227B +:041932007593802207 +:0718FF007593C043B1022202 +:0C183A00900083EBF0A3EAF0A3E9F02299 +:0C184600900087EBF0A3EAF0A3E9F02289 +:0F177500900097E04401F0E4900000F002193674 +:041936004393202295 +:0B186A00439310900097E054FEF02222 +:031945008F952259 +:04193A0043930422AD +:04193E005393FB22A2 +:03194800AF952236 +:03194B00AF942234 :030043000207F2BF :1007F200C0E0C0F0C083C082C0D075D008AF94EF13 :10080200120612093E00085708085710085F180818 @@ -343,119 +345,119 @@ :1008220048088C50087C58089F60089F68089F7091 :10083200089F7808B58008C78808B59008C7980847 :10084200CEA008FAA808FAB00921B80889C0088918 -:10085200C8000009415393DF90009880081210C32A -:10086200500B1210B4E0FF1219310209411218564E -:10087200900097E04440F002094112109F900097C7 -:10088200E04402F002093E02093912109F900086EC +:10085200C8000009415393DF90009880081210CD20 +:10086200500B1210BEE0FF12194502094112186A1C +:10087200900097E04440F00209411210A9900097BD +:10088200E04402F002093E0209391210A9900086E2 :10089200E014FF90008AE0C39F50278022900097C7 :1008A200E04401F090008AE4F0900097E054FBF0FD -:1008B20002092F12109F90008AE0C394085003028D -:1008C200092F020934900097E04404F01218EB90CB -:1008D20000831210CF601890008AE0FF7B017A003B -:1008E200798BC00A9000831210DBD00A12063C906A -:1008F2000097E054FEF080479000871210CF601AF4 -:100902007B017A007901C00A9000871210DBD00ABD +:1008B20002092F1210A990008AE0C3940850030283 +:1008C200092F020934900097E04404F01218FF90B7 +:1008D20000831210D9601890008AE0FF7B017A0031 +:1008E200798BC00A9000831210E5D00A12063C9060 +:1008F2000097E054FEF080479000871210D9601AEA +:100902007B017A007901C00A9000871210E5D00AB3 :100912007F8212063C900096EFF0900000E4F09087 -:1009220000001210B4E0F5951210C35005121926FA -:10093200800D12192A80081218EB800312185653E0 +:1009220000001210BEE0F5951210CD500512193AD2 +:10093200800D12193E80081218FF800312186A53A4 :0D09420093F7D0D0D082D083D0F0D0E03237 -:06190D00E4F514F51322BD -:0F177000C3E5139514D394204003D38001C32203 -:1015B2008F17C3E51395146440600FAF130513EF43 -:0A15C200543F2422F8A6CFD517E805 -:0115CC0022FC -:10169E00E514B513037F8022AF140514EF543F24D5 -:0516AE0022F8E6FF2216 -:06191300E4F516F51522B3 -:0F177F00C3E5159516D394204003D38001C322F0 -:101287008F17C3E515951664406026E517FDEFC374 -:101297009DFDE49400FC74992DF58274003CF58360 -:1012A700E0FEAD150515ED543F2462F8A606D517E7 -:0112B700D165 -:0112B8002213 -:1016B300E516B515037F8022AF160516EF543F24B8 -:0516C30062F8E6FF22C1 -:0215A800C10B75 -:0A188000E4F512F511F510C20B2279 -:10163000300B03121880AE10051074A22EF8A60706 -:08164000E510B43C02D20B22BC -:0B186100AF11051174A22FF8E6FF2262 -:0215AA00C10C72 -:10171000E0FEA3E0FFE4FCFDFB7AFAF9F8D3020552 -:01172000BF09 -:10141B00D291C281E4900120F0A3F0900120121729 -:10142B00104010900121E004F070F0900120E004D6 -:05143B00F080E8D28101 -:011440002289 -:10144100C291C281E490011FF0A3F090011F121715 -:10145100104010900120E004F070F090011FE004B2 -:05146100F080E8D281DB -:011466002263 -:1016C80020A304D20CD322300C0312141BD200C264 -:0216D8000CC341 -:0116DA0022ED -:0515AC0042013B0000BC -:1014670030090A7D207C017F007E01801520A30AB8 -:101477007D207C007F107E0080087D007C047F003B -:061487007E031212EA22AE -:1012EA0090013CE004F0700690013BE004F09001AC -:1012FA003BE0FAA3E0FBB50707EAB50603C2B3224F -:10130A00C3EB9DEA9C4009D2B3E490013BF0A3F001 -:01131A0022B0 -:0D17C50012057EF5CF740129F9E43AFA22ED -:0718F2008FC7AF058FD42260 -:1011E50030F805E4F5C7802E30F90575C70180266E -:1011F50030FA0575C702801E30FB0575C7038016DA -:1012050030FC0575C704800E30FD0575C7058006E1 -:0912150030FE0375C706AFC722C5 -:03193A00AFE222F7 -:0918B000AFE3EFFEADE2EDFF2213 -:1016ED00E4F5C7AF051DEF60051217C580F543CEB4 -:0216FD001022B9 -:0C183E00AF051DEF60051217C580F522F4 -:10172100AF051DEF600AE5CF1205971217CA80F0C9 -:011731002295 -:0918B9008FC7E4F5CE43CE2022D6 -:101732007401A807088002C333D8FCF5D5E4F5D5B7 -:011742002284 -:0718F90075A41043A30222B5 -:071900001218F943BC80221C -:1013CA0041746D656C202852290A63353133312DF9 -:1013DA007573622D6364632D315F305F320A0A00D0 -:0913EA001B631B5B3F32356C00F4 -:0B112900900135EBF0A3EAF0A3E9F021 -:10113400900135E0FBA3E475F0011205A9A9F0FACA -:1011440012057E900138F06013E0B40A057F0D1299 -:1011540018D3900138E0FF1218D380D47F0D1218F1 -:06116400D37F0A0218D33C -:0918C2007BFF7A1379EA02112977 -:100CEC0090013EEDF090013DEFF070097F0D121870 -:100CFC00D37F0A80377F1B1218D37F5B1218D390D7 -:100D0C00013EE0FFD394094003120D4A90013E12BC -:100D1C000D3C7F3B1218D390013DE0FFD39409406A -:100D2C0003120D4A90013D120D3C7F481218D3223C -:100D3C00E075F00A84E5F02430FF1218D322EF7529 -:0A0D4C00F00A842430FF1218D322AD -:05191900A298920D22CE -:1015E700759840538FF7438F0175CBFF75CAF37515 -:0915F700C834D2CA439812D32271 -:0818D3003099FDC2998F9922A2 -:0718DB003098FDAF99C2989F -:0118E20022E3 -:0A188A008FC5E5C430E7FB7F0122A3 -:0A18940043A22012FFC053A2DF227E -:0C184A008F1CAF058F1F121894AF1D22D9 -:1015CD00A2AF920EC2AF8F1CAF038F1FAF058F1D41 -:0915DD00121894A20E92AF7F01D6 -:0115E60022E2 -:08131B00900123EFF0A3EDF0B7 -:10132300A2AF920EC2AFE4FD7F0812184A900123C8 -:10133300E0F45FFFA3E04FF51D751C07121894A29C -:051343000E92AF7F01D6 -:011348002282 -:0818E300C2AF43A22002F40091 -:03000000020B6888 -:0C0B6800787FE4F6D8FD7581DD020BAF4C +:06192100E4F514F51322A9 +:0F178400C3E5139514D394204003D38001C322EF +:1015C6008F17C3E51395146440600FAF130513EF2F +:0A15D600543F2422F8A6CFD517E8F1 +:0115E00022E8 +:1016B200E514B513037F8022AF140514EF543F24C1 +:0516C20022F8E6FF2202 +:06192700E4F516F515229F +:0F179300C3E5159516D394204003D38001C322DC +:1012C3008F17C3E515951664406026E517FDEFC338 +:1012D3009DFDE49400FC74992DF58274003CF58324 +:1012E300E0FEAD150515ED543F2462F8A606D517AB +:0112F300D129 +:0112F40022D7 +:1016C700E516B515037F8022AF160516EF543F24A4 +:0516D70062F8E6FF22AD +:0215BC00C10B61 +:0A189400E4F512F511F510C20B2265 +:10164400300B03121894AE10051074A22EF8A607DE +:08165400E510B43C02D20B22A8 +:0B187500AF11051174A22FF8E6FF224E +:0215BE00C10C5E +:10172400E0FEA3E0FFE4FCFDFB7AFAF9F8D302053E +:01173400BFF5 +:10142F00D291C281E4900120F0A3F0900120121715 +:10143F00244010900121E004F070F0900120E004AE +:05144F00F080E8D281ED +:011454002275 +:10145500C291C281E490011FF0A3F090011F121701 +:10146500244010900120E004F070F090011FE0048A +:05147500F080E8D281C7 +:01147A00224F +:1016DC0020A304D20CD322300C0312142FD200C23C +:0216EC000CC32D +:0116EE0022D9 +:0515C00042013B0000A8 +:10147B0030090A7D207C017F007E01801520A30AA4 +:10148B007D207C007F107E0080087D007C047F0027 +:06149B007E03121326225D +:1013260090013CE004F0700690013BE004F090016F +:101336003BE0FAA3E0FBB50707EAB50603C2B32212 +:10134600C3EB9DEA9C4009D2B3E490013BF0A3F0C5 +:011356002274 +:0D17D90012057EF5CF740129F9E43AFA22D9 +:071906008FC7AF058FD4224B +:1011EF0030F805E4F5C7802E30F90575C701802664 +:1011FF0030FA0575C702801E30FB0575C7038016D0 +:10120F0030FC0575C704800E30FD0575C7058006D7 +:09121F0030FE0375C706AFC722BB +:03194E00AFE222E3 +:0918C400AFE3EFFEADE2EDFF22FF +:10170100E4F5C7AF051DEF60051217D980F543CE8B +:021711001022A4 +:0C185200AF051DEF60051217D980F522CC +:10173500AF051DEF600AE5CF1205971217DE80F0A1 +:011745002281 +:0918CD008FC7E4F5CE43CE2022C2 +:101746007401A807088002C333D8FCF5D5E4F5D5A3 +:011756002270 +:07190D0075A41043A30222A0 +:0719140012190D43BC8022F3 +:1014060041746D656C202852290A63353133312DBC +:101416007573622D6364632D315F305F320A0A0093 +:091426001B631B5B3F32356C00B7 +:0B113300900135EBF0A3EAF0A3E9F017 +:10113E00900135E0FBA3E475F0011205A9A9F0FAC0 +:10114E0012057E900138F06013E0B40A057F0D128F +:10115E0018E7900138E0FF1218E780D47F0D1218BF +:06116E00E77F0A0218E70A +:0918D6007BFF7A1479260211331C +:100CF30090013EEDF090013DEFF070097F0D121869 +:100D0300E77F0A80377F1B1218E77F5B1218E79093 +:100D1300013EE0FFD394094003120D5190013E12AE +:100D23000D437F3B1218E790013DE0FFD394094048 +:100D330003120D5190013D120D437F481218E72213 +:100D4300E075F00A84E5F02430FF1218E722EF750E +:0A0D5300F00A842430FF1218E72292 +:05192D00A298920D22BA +:1015FB00759840538FF7438F0175CBFF75CAF37501 +:09160B00C834D2CA439812D3225C +:0818E7003099FDC2998F99228E +:0718EF003098FDAF99C2988B +:0118F60022CF +:0A189E008FC5E5C430E7FB7F01228F +:0A18A80043A22012FFC053A2DF226A +:0C185E008F1CAF058F1F1218A8AF1D22B1 +:1015E100A2AF920FC2AF8F1CAF038F1FAF058F1D2C +:0915F1001218A8A20F92AF7F01AD +:0115FA0022CE +:0813570090013FEFF0A3EDF05F +:10135F00A2AF920EC2AFE4FD7F0812185E90013F5C +:10136F00E0F45FFFA3E04FF51D751C071218A8A24C +:05137F000E92AF7F019A +:011384002246 +:0818F700C2AF43A22002F4007D +:03000000020B6F81 +:0C0B6F00787FE4F6D8FD7581DD020BB63E :10048800E709F608DFFA8046E709F208DFFA803E56 :1004980088828C83E709F0A3DFFA8032E309F60843 :1004A800DFFA8078E309F208DFFA807088828C83AB @@ -489,13 +491,13 @@ :1006220093F8740193F5828883E47374029368608B :06063200EFA3A3A380DF8B :060638008A838982E4734D -:100B7400021600E493A3F8E493A34003F68001F281 -:100B840008DFF48029E493A3F85407240CC8C33382 -:100B9400C4540F4420C8834004F456800146F6DF51 -:100BA400E4800B0102040810204080901594E47E38 -:100BB400019360BCA3FF543F30E509541FFEE49346 -:100BC400A360010ECF54C025E060A840B8E493A30D -:100BD400FAE493A3F8E493A3C8C582C8CAC583CA38 -:100BE400F0A3C8C582C8CAC583CADFE9DEE780BEF0 -:0115B1000039 +:100B7B00021614E493A3F8E493A34003F68001F266 +:100B8B0008DFF48029E493A3F85407240CC8C3337B +:100B9B00C4540F4420C8834004F456800146F6DF4A +:100BAB00E4800B01020408102040809015A8E47E1D +:100BBB00019360BCA3FF543F30E509541FFEE4933F +:100BCB00A360010ECF54C025E060A840B8E493A306 +:100BDB00FAE493A3F8E493A3C8C582C8CAC583CA31 +:100BEB00F0A3C8C582C8CAC583CADFE9DEE780BEE9 +:0115C5000025 :00000001FF |
From: Paul_R <c2m...@c2...> - 2008-06-23 07:04:58
|
Author: Paul_R Date: 2008-06-23 09:04:54 +0200 (Mon, 23 Jun 2008) New Revision: 1240 Modified: firmware/hex_dev/fuxusb.hex firmware/hex_dev/tuxaudio.hex firmware/hex_dev/tuxcore.hex Log: * Updated hex files with the current codes Modified: firmware/hex_dev/fuxusb.hex =================================================================== (Binary files differ) Modified: firmware/hex_dev/tuxaudio.hex =================================================================== (Binary files differ) Modified: firmware/hex_dev/tuxcore.hex =================================================================== (Binary files differ) |
From: remi <c2m...@c2...> - 2008-06-20 12:44:19
|
Author: remi Date: 2008-06-20 14:44:27 +0200 (Fri, 20 Jun 2008) New Revision: 1239 Modified: firmware/tuxup/trunk/error.h firmware/tuxup/trunk/main.c Log: * Merged two error codes * Added the default error code in the function "program" Modified: firmware/tuxup/trunk/error.h =================================================================== --- firmware/tuxup/trunk/error.h 2008-06-20 12:42:12 UTC (rev 1238) +++ firmware/tuxup/trunk/error.h 2008-06-20 12:44:27 UTC (rev 1239) @@ -27,12 +27,11 @@ E_TUXUP_BADPARAMETER = 2, E_TUXUP_DONGLENOTFOUND = 3, E_TUXUP_DONGLEMANUALBOOTLOAD = 4, - E_TUXUP_BADHEXFILE = 5, - E_TUXUP_BADEEPFILE = 6, - E_TUXUP_BOOTLOADINGFAILED = 7, - E_TUXUP_USBERROR = 8, - E_TUXUP_DFUPROGNOTFOUND = 9, - E_TUXUP_PROGRAMMINGFAILED = 10 + E_TUXUP_BADPROGFILE = 5, + E_TUXUP_BOOTLOADINGFAILED = 6, + E_TUXUP_USBERROR = 7, + E_TUXUP_DFUPROGNOTFOUND = 8, + E_TUXUP_PROGRAMMINGFAILED = 9 } tuxup_error_t; #endif /* _ERROR_ */ Modified: firmware/tuxup/trunk/main.c =================================================================== --- firmware/tuxup/trunk/main.c 2008-06-20 12:42:12 UTC (rev 1238) +++ firmware/tuxup/trunk/main.c 2008-06-20 12:44:27 UTC (rev 1239) @@ -239,7 +239,7 @@ if ((fs = fopen(filename, "r")) == NULL) { fprintf(stderr, "Unable to open file '%s' for reading\n", filename); - exit(E_TUXUP_BADHEXFILE); + exit(E_TUXUP_BADPROGFILE); } while (fscanf(fs, " %s", word) != EOF) @@ -277,7 +277,7 @@ { printf("[FAIL] Programming of '%s' failed, this file is not a correct" " hex file for that CPU\n\n", filename); - return E_TUXUP_BADHEXFILE; + return E_TUXUP_BADPROGFILE; } printf("Programming %s in the ", filename); if (version.cpu_nbr == TUXCORE_CPU_NUM) @@ -304,7 +304,7 @@ { printf("Unrecognized CPU number, %s doesn't appear to be compiled" " for a CPU of tuxdroid.\n", filename); - return E_TUXUP_BADHEXFILE; + return E_TUXUP_BADPROGFILE; } printf("Version %d.%d.%d\n", version.ver_major, version.ver_minor, version.ver_update); @@ -357,7 +357,7 @@ else { printf("Wrong CPU number specified for the eeprom.\n"); - return E_TUXUP_BADEEPFILE; + return E_TUXUP_BADPROGFILE; } if (pretend) @@ -401,14 +401,14 @@ { printf("[FAIL] Programming of '%s' failed, this file is not a correct" " hex file for that CPU\n\n", filename); - return E_TUXUP_BADHEXFILE; + return E_TUXUP_BADPROGFILE; } if (version.cpu_nbr != FUXUSB_CPU_NUM) { printf("Unrecognized CPU number, %s doesn't appear to be compiled" " for a CPU of tuxdroid.\n", filename); - return E_TUXUP_BADHEXFILE; + return E_TUXUP_BADPROGFILE; } printf("Version %d.%d.%d\n", version.ver_major, version.ver_minor, version.ver_update); @@ -510,7 +510,7 @@ */ static int program(char const *filename, char const *path) { - int ret = -1; + int ret = E_TUXUP_BADPROGFILE; size_t len; char *extension, filenamepath[PATH_MAX]; @@ -571,7 +571,7 @@ } } } - if (ret == -1) + if (ret == E_TUXUP_BADPROGFILE) fprintf(stderr, "%s is not a valid programming file.\n", filename); fprintf(stdout, "\n"); return ret; @@ -585,7 +585,7 @@ char path[PATH_MAX]; enum program_modes_t program_mode = NONE; time_t start_time, end_time; - int ret = 0; + int ret = E_TUXUP_NOERROR; int next_option; |
From: remi <c2m...@c2...> - 2008-06-20 12:42:04
|
Author: remi Date: 2008-06-20 14:42:12 +0200 (Fri, 20 Jun 2008) New Revision: 1238 Modified: firmware/tuxup/trunk/Makefile Log: * changed by error the "gcc" and "windows ddk" paths in the Makefile. Modified: firmware/tuxup/trunk/Makefile =================================================================== --- firmware/tuxup/trunk/Makefile 2008-06-20 11:48:28 UTC (rev 1237) +++ firmware/tuxup/trunk/Makefile 2008-06-20 12:42:12 UTC (rev 1238) @@ -4,9 +4,9 @@ ## General Flags ifdef windir - CC = "E:\MinGWStudio\MinGW\bin\gcc.exe" + CC = "gcc.exe" DEFS = -DWIN32 - C_INCLUDE_DIRS = -I"E:\MinGWStudio\MinGW\include\ddk" + C_INCLUDE_DIRS = -I"C:\bin\MinGWStudio\MinGW\include\ddk" CFLAGS = -pipe -Wall -funsigned-char -g2 -O0 LIBS = -lwinmm -lhid -lsetupapi -lhidparse else |
From: remi <c2m...@c2...> - 2008-06-20 11:48:25
|
Author: remi Date: 2008-06-20 13:48:28 +0200 (Fri, 20 Jun 2008) New Revision: 1237 Added: firmware/tuxup/trunk/error.h Modified: firmware/tuxup/trunk/Makefile firmware/tuxup/trunk/bootloader.c firmware/tuxup/trunk/main.c Log: * Added specific error codes on the program exiting. * Added a sleep(5) at the end on the "prog_usb" function, between fux_disconnect and fux_connect. (Windows needs more time than linux to detect the reconnection of the dongle) Modified: firmware/tuxup/trunk/Makefile =================================================================== --- firmware/tuxup/trunk/Makefile 2008-06-17 14:46:21 UTC (rev 1236) +++ firmware/tuxup/trunk/Makefile 2008-06-20 11:48:28 UTC (rev 1237) @@ -4,9 +4,9 @@ ## General Flags ifdef windir - CC = "gcc.exe" + CC = "E:\MinGWStudio\MinGW\bin\gcc.exe" DEFS = -DWIN32 - C_INCLUDE_DIRS = -I"C:\bin\MinGWStudio\MinGW\include\ddk" + C_INCLUDE_DIRS = -I"E:\MinGWStudio\MinGW\include\ddk" CFLAGS = -pipe -Wall -funsigned-char -g2 -O0 LIBS = -lwinmm -lhid -lsetupapi -lhidparse else @@ -48,12 +48,14 @@ bootloader.h \ version.h \ tux_misc.h \ +error.h \ tux_hid_win32.h $(compile_source) bootloader.o: bootloader.c \ tux_misc.h \ tux_hid_win32.h \ +error.h \ tux-api.h $(compile_source) Modified: firmware/tuxup/trunk/bootloader.c =================================================================== --- firmware/tuxup/trunk/bootloader.c 2008-06-17 14:46:21 UTC (rev 1236) +++ firmware/tuxup/trunk/bootloader.c 2008-06-20 11:48:28 UTC (rev 1237) @@ -41,6 +41,7 @@ # include "tux_hid_unix.h" #endif #include "tux-api.h" +#include "error.h" /* Whether to display verbose messages. */ extern int verbose; @@ -412,7 +413,7 @@ { fprintf(stderr, "Bootloading failed, program aborted at dongle reply.\n"); - exit(1); + exit(E_TUXUP_BOOTLOADINGFAILED); } } else @@ -431,7 +432,7 @@ { fprintf(stderr, "\nBootloading failed, program aborted at dongle reply.\n"); - exit(1); + exit(E_TUXUP_BOOTLOADINGFAILED); } } } Added: firmware/tuxup/trunk/error.h =================================================================== --- firmware/tuxup/trunk/error.h (rev 0) +++ firmware/tuxup/trunk/error.h 2008-06-20 11:48:28 UTC (rev 1237) @@ -0,0 +1,38 @@ +/* + * Tuxup - Error + * Copyright (C) 2008 C2ME Sa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifndef _ERROR_H_ +#define _ERROR_H_ + +typedef enum +{ + E_TUXUP_NOERROR = 0, + E_TUXUP_BADPARAMETER = 2, + E_TUXUP_DONGLENOTFOUND = 3, + E_TUXUP_DONGLEMANUALBOOTLOAD = 4, + E_TUXUP_BADHEXFILE = 5, + E_TUXUP_BADEEPFILE = 6, + E_TUXUP_BOOTLOADINGFAILED = 7, + E_TUXUP_USBERROR = 8, + E_TUXUP_DFUPROGNOTFOUND = 9, + E_TUXUP_PROGRAMMINGFAILED = 10 +} tuxup_error_t; + +#endif /* _ERROR_ */ Modified: firmware/tuxup/trunk/main.c =================================================================== --- firmware/tuxup/trunk/main.c 2008-06-17 14:46:21 UTC (rev 1236) +++ firmware/tuxup/trunk/main.c 2008-06-20 11:48:28 UTC (rev 1237) @@ -32,6 +32,7 @@ #include "version.h" #include "common/defines.h" #include "tux_misc.h" +#include "error.h" #ifdef WIN32 # include "tux_hid_win32.h" # include <windows.h> @@ -144,7 +145,7 @@ if (device == NULL) { fprintf(stderr, "The dongle was not found, now exiting.\n"); - exit(1); + exit(E_TUXUP_DONGLENOTFOUND); } else { @@ -154,7 +155,7 @@ } #else fprintf(stderr, "The dongle was not found, now exiting.\n"); - exit(1); + exit(E_TUXUP_DONGLENOTFOUND); #endif } else @@ -176,14 +177,14 @@ if (device->descriptor.bcdDevice < 0x030) { fprintf(stderr, msg_old_firmware); - exit(1); + exit(E_TUXUP_DONGLEMANUALBOOTLOAD); } /* open USB device */ if ((dev_h = usb_open_tux(device)) == NULL) { fprintf(stderr, "USB DEVICE INIT ERROR \n"); - exit(1); + exit(E_TUXUP_USBERROR); } } #endif @@ -238,7 +239,7 @@ if ((fs = fopen(filename, "r")) == NULL) { fprintf(stderr, "Unable to open file '%s' for reading\n", filename); - exit(1); + exit(E_TUXUP_BADHEXFILE); } while (fscanf(fs, " %s", word) != EOF) @@ -276,7 +277,7 @@ { printf("[FAIL] Programming of '%s' failed, this file is not a correct" " hex file for that CPU\n\n", filename); - return 1; + return E_TUXUP_BADHEXFILE; } printf("Programming %s in the ", filename); if (version.cpu_nbr == TUXCORE_CPU_NUM) @@ -303,13 +304,13 @@ { printf("Unrecognized CPU number, %s doesn't appear to be compiled" " for a CPU of tuxdroid.\n", filename); - return 1; + return E_TUXUP_BADHEXFILE; } printf("Version %d.%d.%d\n", version.ver_major, version.ver_minor, version.ver_update); if (pretend) - return 0; + return E_TUXUP_NOERROR; #ifdef WIN32 if (bootload(cpu_i2c_addr, FLASH, filename)) #else @@ -321,7 +322,7 @@ #else printf("\033[2C[ \033[01;32mOK\033[00m ]\n"); #endif - return 0; + return E_TUXUP_NOERROR; } else { @@ -331,7 +332,7 @@ printf("\033[2C[\033[01;31mFAIL\033[00m]\n"); #endif } - return 1; + return E_TUXUP_PROGRAMMINGFAILED; } static int prog_eeprom(uint8_t cpu_nbr, char const *filename) @@ -356,11 +357,11 @@ else { printf("Wrong CPU number specified for the eeprom.\n"); - return 0; + return E_TUXUP_BADEEPFILE; } if (pretend) - return 0; + return E_TUXUP_NOERROR; #ifdef WIN32 if (bootload(cpu_i2c_addr, EEPROM, filename)) #else @@ -372,7 +373,7 @@ #else printf("\033[2C[ \033[01;32mOK\033[00m ]\n"); #endif - return 0; + return E_TUXUP_NOERROR; } else { @@ -382,7 +383,7 @@ printf("\033[2C[\033[01;31mFAIL\033[00m]\n"); #endif } - return 1; + return E_TUXUP_PROGRAMMINGFAILED; } static int prog_usb(char const *filename) @@ -400,20 +401,20 @@ { printf("[FAIL] Programming of '%s' failed, this file is not a correct" " hex file for that CPU\n\n", filename); - return 1; + return E_TUXUP_BADHEXFILE; } if (version.cpu_nbr != FUXUSB_CPU_NUM) { printf("Unrecognized CPU number, %s doesn't appear to be compiled" " for a CPU of tuxdroid.\n", filename); - return 1; + return E_TUXUP_BADHEXFILE; } printf("Version %d.%d.%d\n", version.ver_major, version.ver_minor, version.ver_update); if (pretend) - return 0; + return E_TUXUP_NOERROR; /* Check if the dongle is already in bootloader mode */ if (verbose) @@ -436,7 +437,7 @@ if (ret == 32512) { fprintf(stdout, msg_dfu_programmer_not_installed); - exit(1); + exit(E_TUXUP_DFUPROGNOTFOUND); } if (verbose) { @@ -467,7 +468,7 @@ else { fprintf(stderr, "Switching to bootloader mode failed.\n"); - return 1; + return E_TUXUP_BOOTLOADINGFAILED; } } #endif @@ -476,28 +477,30 @@ if (ret) { fprintf(stderr, "[FAIL] Erasing the USB CPU failed.\n"); - return ret; + return E_TUXUP_PROGRAMMINGFAILED; } sprintf(tmp_string, "dfu-programmer at89c5130 flash %s", filename); ret = system(tmp_string); if (ret) { fprintf(stderr, "[FAIL] Flashing the USB CPU failed.\n"); - return ret; + return E_TUXUP_PROGRAMMINGFAILED; } ret = system("dfu-programmer at89c5130 configure HSB 0x7b"); if (ret) { fprintf(stderr, "[FAIL] Configuring the USB CPU failed.\n"); - return ret; + return E_TUXUP_PROGRAMMINGFAILED; } ret = system("dfu-programmer at89c5130 start"); fprintf(stdout, "[OK]\n"); fux_disconnect(); + /* Windows needs more time than linux to enumerate the device */ + sleep(5); fux_connect(); - return 0; + return E_TUXUP_NOERROR; } /* @@ -616,7 +619,7 @@ case 'h': /* -h or --help */ /* User has requested usage information. Print it to standard * output, and exit with exit code zero (normal termination). */ - usage(stdout, 0); + usage(stdout, E_TUXUP_NOERROR); case 'm': /* -m or --main */ if (program_mode == NONE) program_mode = MAIN; @@ -624,7 +627,7 @@ { fprintf(stderr, "'-a' and '-m' options can't be used simultaneoulsy.\n\n"); - usage(stderr, 1); + usage(stderr, E_TUXUP_BADPARAMETER); } break; case 'a': /* -a or --all */ @@ -634,7 +637,7 @@ { fprintf(stderr, "'-a' and '-m' options can't be used simultaneoulsy.\n\n"); - usage(stderr, 1); + usage(stderr, E_TUXUP_BADPARAMETER); } break; case 'p': /* -a or --all */ @@ -646,12 +649,12 @@ case 'V': /* -V or --version */ fprintf(stdout, "%s %s, an uploader program for tuxdroid.\n\n", program_name, program_version); - exit(0); /* version is already printed, so just exit. */ + exit(E_TUXUP_NOERROR); /* version is already printed, so just exit. */ break; case '?': /* The user specified an invalid option. */ /* Print usage information to standard error, and exit with exit * code one (indicating abnormal termination). */ - usage(stderr, 1); + usage(stderr, E_TUXUP_NOERROR); case -1: /* Done with options. */ break; default: /* Something else: unexpected. */ @@ -679,14 +682,14 @@ else { fprintf(stderr, "too many files or paths specified.\n\n"); - usage(stderr, 1); + usage(stderr, E_TUXUP_BADPARAMETER); } } } else { fprintf(stderr, "no file nor path specified.\n\n"); - usage(stderr, 1); + usage(stderr, E_TUXUP_BADPARAMETER); } /* Select which files to program */ @@ -742,5 +745,5 @@ if (!pretend) printf("Time elapsed: %2.0f seconds.\n", difftime(end_time, start_time)); - return 0; + return ret; } |
From: jaguarondi <c2m...@c2...> - 2008-06-17 14:46:22
|
Author: jaguarondi Date: 2008-06-17 16:46:21 +0200 (Tue, 17 Jun 2008) New Revision: 1236 Modified: firmware/tuxdefs/api.h Log: * Added a definition for the null command. Modified: firmware/tuxdefs/api.h =================================================================== --- firmware/tuxdefs/api.h 2008-06-16 10:30:14 UTC (rev 1235) +++ firmware/tuxdefs/api.h 2008-06-17 14:46:21 UTC (rev 1236) @@ -74,6 +74,10 @@ * be reviewed prior to update this. */ +/** NULL command, does nothing and can be dropped anywhere in the communication + * chain. */ +#define NULL_CMD 0x00 + /** * \name Request general information * These commands request some general information of the CPUs and their |
From: Paul_R <c2m...@c2...> - 2008-06-16 10:30:08
|
Author: Paul_R Date: 2008-06-16 12:30:14 +0200 (Mon, 16 Jun 2008) New Revision: 1235 Modified: firmware/tuxup/trunk/main.c Log: * Increased the delay between the USB bootloader command and the dfu-programmer process. Modified: firmware/tuxup/trunk/main.c =================================================================== --- firmware/tuxup/trunk/main.c 2008-06-16 10:27:10 UTC (rev 1234) +++ firmware/tuxup/trunk/main.c 2008-06-16 10:30:14 UTC (rev 1235) @@ -449,12 +449,9 @@ if (HID) { tux_hid_write(5, send_data); - sleep(1); -#ifdef WIN32 /* Windows needs more time than linux to enumerate the new dfu * device */ - sleep(4); -#endif + sleep(5); } #ifndef WIN32 else |
From: Paul_R <c2m...@c2...> - 2008-06-16 10:27:09
|
Author: Paul_R Date: 2008-06-16 12:27:10 +0200 (Mon, 16 Jun 2008) New Revision: 1234 Modified: firmware/fuxusb/trunk/src/usb_commands.c firmware/fuxusb/trunk/src/usb_commands.h Log: * Added a parser for the ID, sleep and wifi functions. The functions aren't implemented yet. * Changed the way to enter on USB bootloader mode. When the BLJB fuse is activated, we need to have a command to reset it. The dongle can be blocked on bootloader mode, else, the dongle is blocked on the bootloader mode. I've changed the command to activate the bootloader without setting the BLJB fuse. Now, even if the process fail, the bootloader is exited when the dongle is plugged. Modified: firmware/fuxusb/trunk/src/usb_commands.c =================================================================== --- firmware/fuxusb/trunk/src/usb_commands.c 2008-06-13 15:06:44 UTC (rev 1233) +++ firmware/fuxusb/trunk/src/usb_commands.c 2008-06-16 10:27:10 UTC (rev 1234) @@ -32,8 +32,8 @@ #include "bootloader.h" #include "fifo_stt.h" #include "rf.h" -#include "lib_mcu\fa-usb\flash_api.h" -#include "lib_mcu\usb\usb_drv.h" +#include "lib_mcu/fa-usb/flash_api.h" +#include "lib_mcu/usb/usb_drv.h" /* Statics defs */ static void dongle_cmd_parser(void); @@ -163,11 +163,40 @@ * This function parse the commands for dongle. */ static void dongle_cmd_parser(void) -{ - if (command_received[0] == DONGLE_CMD) +{ + /* Communication commands (0x00) */ + if (command_received[0] == COMMUNICATION_CMD) { + switch (command_received[1]) + { + case DISCONNECT_TUX: + break; + + case CONNECT_TUX: + break; + + case REQUEST_USB_ID: + break; + + case REQUEST_RF_ID: + break; + + case SET_ID: + break; + + case WAKE_UP: + break; + + case SET_CHANNEL_RANGE: + break; + } + } + /* Dongle commands (0x01) */ + else if (command_received[0] == DONGLE_CMD) + { // XXX I don't know if bytes 1 and 2 will be used in the future. // ATM, they're not used, so I don't test them. + // Maybe tuxdriver must be changed to put the command on byte 1. /* Maintenance commands */ switch (command_received[3]) { @@ -188,7 +217,7 @@ break; } } - /* TTS commands */ + /* TTS commands (0x02) */ else if (command_received[0] == TTS_CMD) { switch (command_received[1]) @@ -202,7 +231,7 @@ break; } } - /* Dongle version command */ + /* Dongle version command (0x06) */ else if (command_received[0] == INFO_FUXUSB_CMD) { FIFO_STT_flush(); @@ -266,7 +295,8 @@ * bootloader mode. */ rf_reset_signal = 0; - __api_clr_BLJB(); + + __api_wr_EB(1); __api_wr_SBV (0xF4); reattach_usb(); Modified: firmware/fuxusb/trunk/src/usb_commands.h =================================================================== --- firmware/fuxusb/trunk/src/usb_commands.h 2008-06-13 15:06:44 UTC (rev 1233) +++ firmware/fuxusb/trunk/src/usb_commands.h 2008-06-16 10:27:10 UTC (rev 1234) @@ -41,6 +41,8 @@ * @{ */ /** \name Commands sub-types for the dongle * @{ */ +/** Wifi, ID, Sleep */ +#define COMMUNICATION_CMD 0 /** Maintenance */ #define DONGLE_CMD 1 /** Audio */ @@ -50,6 +52,24 @@ /** \name Maintenance commands sub-type * @{ */ +/** Disconnect */ +#define DISCONNECT_TUX 1 +/** Connect */ +#define CONNECT_TUX 2 +/** Dongle ID request */ +#define REQUEST_USB_ID 3 +/** RF ID request */ +#define REQUEST_RF_ID 4 +/** Set ID */ +#define SET_ID 5 +/** Wakeup */ +#define WAKE_UP 6 +/** Change channel range */ +#define SET_CHANNEL_RANGE 7 +/* @} */ + +/** \name Misc commands sub-type + * @{ */ /** New status request */ #define STATUS_REQUEST 0x00 /** RF reset request */ |
From: Paul_R <c2m...@c2...> - 2008-06-13 15:06:48
|
Author: Paul_R Date: 2008-06-13 17:06:44 +0200 (Fri, 13 Jun 2008) New Revision: 1233 Modified: firmware/tuxup/trunk/bootloader.c Log: * Bug : type error Modified: firmware/tuxup/trunk/bootloader.c =================================================================== --- firmware/tuxup/trunk/bootloader.c 2008-06-12 23:12:48 UTC (rev 1232) +++ firmware/tuxup/trunk/bootloader.c 2008-06-13 15:06:44 UTC (rev 1233) @@ -69,7 +69,7 @@ #define BOOT_EXIT 3 #ifndef WIN32 -static bool wait_status(char value, int timeout); +static bool wait_status(unsigned char value, int timeout); #endif static void compute_progress_bar(float line_nb); @@ -834,7 +834,7 @@ * bootloader ACK. */ #ifndef WIN32 -static bool wait_status(char value, int timeout) +static bool wait_status(unsigned char value, int timeout) { unsigned char data_buffer[5]; uint8_t sttime = time(NULL); |