[tuxdroid-svn] r1118 - firmware/tuxaudio/trunk
Status: Beta
Brought to you by:
ks156
From: jaguarondi <c2m...@c2...> - 2008-05-06 15:10:41
|
Author: jaguarondi Date: 2008-05-06 17:00:57 +0200 (Tue, 06 May 2008) New Revision: 1118 Added: firmware/tuxaudio/trunk/misc.c firmware/tuxaudio/trunk/misc.h firmware/tuxaudio/trunk/parser.c firmware/tuxaudio/trunk/parser.h Modified: firmware/tuxaudio/trunk/Makefile firmware/tuxaudio/trunk/bootloader.c firmware/tuxaudio/trunk/communication.c firmware/tuxaudio/trunk/communication.h firmware/tuxaudio/trunk/flash.c firmware/tuxaudio/trunk/hardware.h firmware/tuxaudio/trunk/init.h firmware/tuxaudio/trunk/main.c firmware/tuxaudio/trunk/varis.c firmware/tuxaudio/trunk/varis.h Log: * Added 2 modules: parser and misc. The parser functions spread in main.c and communication.c are now merged into one function in parser.c. All commands coming from the RF and tuxcore will be parsed by the same function now. * Moved some functions around and some cleanup. Modified: firmware/tuxaudio/trunk/Makefile =================================================================== --- firmware/tuxaudio/trunk/Makefile 2008-05-06 14:56:11 UTC (rev 1117) +++ firmware/tuxaudio/trunk/Makefile 2008-05-06 15:00:57 UTC (rev 1118) @@ -69,7 +69,7 @@ ## Objects that must be built in order to link -OBJECTS = init.o main.o varis.o fifo.o spi.o AT26F004.o flash.o communication.o PC_communication.o i2c.o config.o +OBJECTS = init.o main.o varis.o fifo.o spi.o AT26F004.o flash.o communication.o parser.o misc.o PC_communication.o i2c.o config.o ## Objects explicitly added by the user LINKONLYOBJECTS = @@ -103,6 +103,12 @@ communication.o: communication.c $(CC) $(INCLUDES) $(CFLAGS) -c $< +parser.o: parser.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +misc.o: misc.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + PC_communication.o: PC_communication.c $(CC) $(INCLUDES) $(CFLAGS) -c $< Modified: firmware/tuxaudio/trunk/bootloader.c =================================================================== --- firmware/tuxaudio/trunk/bootloader.c 2008-05-06 14:56:11 UTC (rev 1117) +++ firmware/tuxaudio/trunk/bootloader.c 2008-05-06 15:00:57 UTC (rev 1118) @@ -54,7 +54,7 @@ jump_to_application(); TWBR = (F_CPU / 100000UL - 16) / 2; /* twi intialisation */ - TWAR = TUXAUDIO_BL_TWAR; + TWAR = (TUXAUDIO_BL_ADDR << 1); TWCR = _BV(TWEA) | _BV(TWEN) | _BV(TWINT); for (;;) Modified: firmware/tuxaudio/trunk/communication.c =================================================================== --- firmware/tuxaudio/trunk/communication.c 2008-05-06 14:56:11 UTC (rev 1117) +++ firmware/tuxaudio/trunk/communication.c 2008-05-06 15:00:57 UTC (rev 1118) @@ -24,20 +24,20 @@ #include "communication.h" #include "i2c.h" -#include "hardware.h" -#include "config.h" +#include "parser.h" -#define I2C_TUXCORE_ADDR 0x2A - +/* I2C write message (out) */ static uint8_t out_buf[CMD_SIZE]; static struct i2c_msg msg_out = {0, 0, out_buf}; +/* I2C read message (in) */ static uint8_t in_buf[CMD_SIZE]; static struct i2c_msg msg_in = {0, 0, in_buf}; -volatile uint8_t ret; + +/* XXX to delete */ uint8_t statusFlag; /* - * core_cmdout is a buffer for commands to be sent to tuxcore + * core_cmdout is a stack for commands to be sent to tuxcore */ FIFO_INSTANCE(core_cmdout_buf, COMMAND_BUF_SIZE); fifo_t *core_cmdout = FifoPointer(core_cmdout_buf); @@ -81,7 +81,7 @@ void i2cCommunicationInit(void) { i2c_init(); - msg_out.addr = I2C_TUXCORE_ADDR; + msg_out.addr = TUXCORE_ADDR; msg_out.buf = out_buf; i2c_master_receive_handler(i2cMasterReceiveService); } @@ -107,7 +107,7 @@ nack_cnt = 0; switch (msg_out.addr) { - case I2C_TUXCORE_ADDR: + case TUXCORE_ADDR: /* Return 0 as if there were nothing to do so we can do something else. Returning here doesn't drop the message. */ return 0; @@ -132,8 +132,8 @@ * bytes) XXX add an error feedback on this */ return -1; } - msg_out.addr = I2C_TUXCORE_ADDR; - ret = i2c_send_bytes(&msg_out); + msg_out.addr = TUXCORE_ADDR; + i2c_send_bytes(&msg_out); } else /* Nothing to do anymore */ @@ -147,9 +147,9 @@ if (i2c_get_status() != I2C_BUSY) { statusFlag = 0; - msg_in.addr = I2C_TUXCORE_ADDR; + msg_in.addr = TUXCORE_ADDR; msg_in.len = CMD_SIZE; - ret = i2c_read_bytes(&msg_in); + i2c_read_bytes(&msg_in); } } @@ -204,44 +204,6 @@ send_status(c); } -uint8_t pong_received; /* value of the pong received from the behavior */ -uint8_t pong_missed; /* counting the pong missed on the I2C */ - -void parse_core_cmd(uint8_t *data) -{ - uint8_t i; - - if (*data < 0xC0) - /* Audio command to be executed, can't have 3 parameters */ - { - for (i = 0; i < CMD_SIZE; i++) - audioBuf[i] = data[i]; - audioBufIdx = CMD_SIZE; - /* XXX only fill buffer if it's not full, need to add the check */ - } - else - /* Status, forward to RF and testers */ - { - /* Intercept some of them */ - /* Pong check */ - if (data[0] == PONG_CMD) - { - if (pong_received-- < data[1]) /* new ping, reset */ - { - pong_received = data[1]; - pong_missed = 0; - } - else if (pong_received > data[1]) /* pongs missed */ - { - pong_missed++; - pong_received = data[1]; /* resync */ - } - data[2] = pong_missed; - } - send_status(data); - } -} - /* * Slave receiver function associated with the i2c ISR * @@ -256,12 +218,15 @@ if (receiveDataLength != CMD_SIZE) /* Error here. */ return; - if (msg_in.addr == I2C_TUXCORE_ADDR) + if (msg_in.addr == TUXCORE_ADDR) /* From tuxcore */ { - /* Parse commands */ - parse_core_cmd(receiveData); - /* If we got something, there's maybe more so continue. */ + /* Parse the command */ + parse_cmd(receiveData); + /* and forward if it isn't dropped. */ + if (receiveData) + send_status(receiveData); + /* As we got something, there's maybe more so continue. */ statusFlag = 1; } } @@ -291,3 +256,12 @@ sei(); return 0; } + +void core_communications(bool tick) +{ + if (!sendCommands()) + { + if (statusFlag) + getStatus(); + } +} Modified: firmware/tuxaudio/trunk/communication.h =================================================================== --- firmware/tuxaudio/trunk/communication.h 2008-05-06 14:56:11 UTC (rev 1117) +++ firmware/tuxaudio/trunk/communication.h 2008-05-06 15:00:57 UTC (rev 1118) @@ -64,5 +64,6 @@ uint8_t param3); uint8_t popStatus(uint8_t * command); void getStatus(void); +void core_communications(bool tick); #endif /* COMMUNICATION_H */ Modified: firmware/tuxaudio/trunk/flash.c =================================================================== --- firmware/tuxaudio/trunk/flash.c 2008-05-06 14:56:11 UTC (rev 1117) +++ firmware/tuxaudio/trunk/flash.c 2008-05-06 15:00:57 UTC (rev 1118) @@ -232,7 +232,6 @@ programming_state = 0; programmingFlash = 0; TIMSK0 = 0x01; - //info_flg = 1; send_status_p(STATUS_FLASH_PROG_CMD, STANDBY, 0, 0); send_status_p(SOUND_VAR_CMD, numSound, last_block, 0); } @@ -296,7 +295,6 @@ last_block = 0; send_status_p(STATUS_FLASH_PROG_CMD, STANDBY, 0, 0); send_status_p(SOUND_VAR_CMD, numSound, last_block, 0); - //info_flg = 1; TIMSK0 = 0x01; } } Modified: firmware/tuxaudio/trunk/hardware.h =================================================================== --- firmware/tuxaudio/trunk/hardware.h 2008-05-06 14:56:11 UTC (rev 1117) +++ firmware/tuxaudio/trunk/hardware.h 2008-05-06 15:00:57 UTC (rev 1118) @@ -52,4 +52,29 @@ #define flash_onhold() (FLASH_PORT &= ~FLASH_HOLD_PIN) #define flash_enable() (FLASH_PORT |= FLASH_HOLD_PIN) +/* Power management */ +#define POWER_DDR DDRD /* VCC power switch */ +#define POWER_MK _BV(PD6) +#define POWER_PT PORTD + +/* Audio mute */ +#define MUTE_DDR DDRD /* amp _SHDN pin */ +#define MUTE_MK _BV(PD7) +#define MUTE_PT PORTD + +#define AUDIO_OUT_DDR DDRD /* PWM output compare pin */ +#define AUDIO_OUT_MK _BV(PD5) +#define AUDIO_OUT_PT PORTD + +static __inline__ void unmute_amp(void) +{ + (MUTE_PT |= MUTE_MK); + (AUDIO_OUT_DDR |= AUDIO_OUT_MK); +} +static __inline__ void mute_amp(void) +{ + (MUTE_PT &= ~MUTE_MK); + (AUDIO_OUT_DDR &= ~AUDIO_OUT_MK); +} + #endif /* _HARDWARE_H_ */ Modified: firmware/tuxaudio/trunk/init.h =================================================================== --- firmware/tuxaudio/trunk/init.h 2008-05-06 14:56:11 UTC (rev 1117) +++ firmware/tuxaudio/trunk/init.h 2008-05-06 15:00:57 UTC (rev 1118) @@ -24,29 +24,5 @@ extern void init_avr(void); -/* Power management */ -#define POWER_DDR DDRD /* VCC power switch */ -#define POWER_MK _BV(PD6) -#define POWER_PT PORTD -/* Audio mute */ -#define MUTE_DDR DDRD /* amp _SHDN pin */ -#define MUTE_MK _BV(PD7) -#define MUTE_PT PORTD - -#define AUDIO_OUT_DDR DDRD /* PWM output compare pin */ -#define AUDIO_OUT_MK _BV(PD5) -#define AUDIO_OUT_PT PORTD - -static __inline__ void unmute_amp(void) -{ - (MUTE_PT |= MUTE_MK); - (AUDIO_OUT_DDR |= AUDIO_OUT_MK); -} -static __inline__ void mute_amp(void) -{ - (MUTE_PT &= ~MUTE_MK); - (AUDIO_OUT_DDR &= ~AUDIO_OUT_MK); -} - #endif Modified: firmware/tuxaudio/trunk/main.c =================================================================== --- firmware/tuxaudio/trunk/main.c 2008-05-06 14:56:11 UTC (rev 1117) +++ firmware/tuxaudio/trunk/main.c 2008-05-06 15:00:57 UTC (rev 1118) @@ -21,7 +21,6 @@ #include <avr/io.h> #include <avr/interrupt.h> -#include <avr/pgmspace.h> #include <util/delay.h> #include <avr/sleep.h> @@ -34,8 +33,8 @@ #include "fifo.h" #include "i2c.h" #include "communication.h" +#include "parser.h" #include "flash.h" -#include "version.h" #include "config.h" #include "PC_communication.h" @@ -44,43 +43,10 @@ */ #include "AT26F004.h" -/* - * Version number - */ -#define CPU_NUMBER TUXAUDIO_CPU_NUM /* audio CPU */ -const author_t author __attribute__ ((section("version.3"))) = -{AUTHOR_CMD, AUTHOR_ID, VARIATION}; -const revision_t svn_revision __attribute__ ((section("version.2"))) = -{REVISION_CMD, SVN_REV, RELEASE_TYPE}; -const version_t tag_version __attribute__ ((section("version.1"))) = -{VERSION_CMD, CPU_VER_JOIN(CPU_NUMBER, VER_MAJOR), VER_MINOR, VER_UPDATE}; - /* Set when sleep should be entered */ -static uint8_t pre_sleep_delay = 0, sleep_f = 0; +static uint8_t pre_sleep_delay = 0; -void send_info(void) -{ - uint8_t i, buf[12]; - uint8_t *data = ((uint8_t *) & tag_version); - - /* Retrieve version information */ - for (i = 0; i < 12; i++) - buf[i] = pgm_read_byte(data++); - cli(); - send_status((uint8_t const *) buf); - sei(); - - buf[0] = SOUND_VAR_CMD; - buf[1] = numSound; - buf[2] = last_block; - buf[3] = 0; - cli(); - send_status((uint8_t const *) buf); - sei(); - info_flg = 0; -} - ISR(SIG_PIN_CHANGE1) { /* Nothing to do here, it's just an interrupt set on the head button to @@ -151,88 +117,6 @@ } #endif -/* - * Parse commands received by the twi interface and trigger the associated - * functions or send status bytes to the RF interface - * - * audioBufIdx is reset at the end of this function which means the buffer - * will be overwritten. So it is necessary to process or backup the data in - * this function. - */ -void audioIntParser(void) -{ - if (audioBuf[0] == PLAY_SOUND_CMD) - /* param: audioBuf[1] : sound number */ - /* audioBuf[2] : mic sound intensity */ - { - /* postpone the command if a sound is already playing */ - if (flashPlay || programmingFlash) - return; - audioLevel = audioBuf[2]; - //playingAudio(audioBuf[1]); /* start playing the sound */ - soundToPlay = audioBuf[1]; - send_status_p(STATUS_AUDIO_CMD, audioBuf[1], 0, 0); - flashPlay = 1; - flash_state = 1; - } - else if (audioBuf[0] == MUTE_CMD) - { - if (audioBuf[1]) - mute_amp(); - else - unmute_amp(); - } - else if (audioBuf[0] == SLEEP_CMD) - { - pre_sleep_delay = 30; /* handle sleep in its own function */ - /* Forwards the command to the rf CPU */ - audioBuf[0] = SLEEP_ACK_CMD; - audioBuf[1] = 0; - audioBuf[2] = 0; - audioBuf[3] = 0; - cli(); - send_status(audioBuf); - sei(); - sleep_f = 1; - statusFlag = 1; - } - audioBufIdx = 0; /* clear buffer; this buffer can only hold one command so should be simply reset here */ -} - -/* - * Directly parse some commands received by the RF interface and push the - * others on the commandFifo to be sent through i2c to the behavioural CPU - */ -void commandParser(uint8_t * command) -{ - if (command[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 (command[0] == ERASE_FLASH_CMD) - { - eraseFlag = 1; - } - - /* Version */ - else if (command[0] == INFO_TUXAUDIO_CMD) - info_flg = 1; /* info should be sent when the buffer will be free */ - - else if (command[0] == CONFIRM_STORAGE_CMD) - { - if (command[1]) - write_toc = 1; - else - write_toc = 2; - } - - else - send_core_cmd(command); /* push the command set on the filo stack */ -} - /** * \brief Send sensors status * @@ -270,10 +154,6 @@ sei(); /* Init global interrupt */ - /* Send CPU information at startup */ - /* XXX doesn't seem to work anymore */ - spi_commandRX[0] = INFO_TUXAUDIO_CMD; - commandParser(spi_commandRX); /* Activate INTO and INT1 only if the RF board is present, this is for * production tests only. @@ -294,7 +174,9 @@ if (commandRX) // commend RX from radio { commandRX = 0; // Reset flag - commandParser(spi_commandRX); // Analyse command RX + parse_cmd(spi_commandRX); + if (spi_commandRX) + send_core_cmd(spi_commandRX); } if (programmingFlash) // Restora all the context for flash programming @@ -307,16 +189,12 @@ erase(); /* Send commands to I2C, otherwise get new status from tuxcore */ - if (!sendCommands()) - { - if (statusFlag) - getStatus(); - else if (sleep_f) - { - sleep_f = 0; - sleep(); - } - } + core_communications(0); + /*else if (sleep_f)*/ + /*{*/ + /*sleep_f = 0;*/ + /*sleep();*/ + /*}*/ if (sendSensorsFlag) { @@ -335,6 +213,7 @@ /* wait for audio commands to be processed */ //if (!audioBufIdx && !flashPlay) + /* Main tick to retrieve status */ statusFlag = 1; /* Delay used to power the IR receiver slowly */ @@ -354,14 +233,7 @@ DDRD &= ~0x03; } } - if (audioBufIdx) - audioIntParser(); - - /* Send information to the computer. */ - if (info_flg) - send_info(); - /* Sleep mode */ if (pre_sleep_delay == 1) sleep(); Added: firmware/tuxaudio/trunk/misc.c =================================================================== --- firmware/tuxaudio/trunk/misc.c (rev 0) +++ firmware/tuxaudio/trunk/misc.c 2008-05-06 15:00:57 UTC (rev 1118) @@ -0,0 +1,62 @@ +/* + * 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/pgmspace.h> +#include <avr/interrupt.h> + +#include "misc.h" +#include "communication.h" +#include "version.h" + +/* + * Version number + */ +#define CPU_NUMBER TUXAUDIO_CPU_NUM /* audio CPU */ +const author_t author __attribute__ ((section("version.3"))) = +{AUTHOR_CMD, AUTHOR_ID, VARIATION}; +const revision_t svn_revision __attribute__ ((section("version.2"))) = +{REVISION_CMD, SVN_REV, RELEASE_TYPE}; +const version_t tag_version __attribute__ ((section("version.1"))) = +{VERSION_CMD, CPU_VER_JOIN(CPU_NUMBER, VER_MAJOR), VER_MINOR, VER_UPDATE}; + +/** + * Send version information. + */ +void send_info(void) +{ + uint8_t i, buf[12]; + uint8_t *data = ((uint8_t *) & tag_version); + + /* Retrieve version information */ + for (i = 0; i < 12; i++) + buf[i] = pgm_read_byte(data++); + cli(); + send_status((uint8_t const *) buf); + sei(); + + buf[0] = SOUND_VAR_CMD; + buf[1] = numSound; + buf[2] = last_block; + buf[3] = 0; + cli(); + send_status((uint8_t const *) buf); + sei(); +} Property changes on: firmware/tuxaudio/trunk/misc.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Name: svn:eol-style + native Added: firmware/tuxaudio/trunk/misc.h =================================================================== --- firmware/tuxaudio/trunk/misc.h (rev 0) +++ firmware/tuxaudio/trunk/misc.h 2008-05-06 15:00:57 UTC (rev 1118) @@ -0,0 +1,27 @@ +/* + * 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$ */ + +#ifndef MISC_H +#define MISC_H + +void send_info(void); + +#endif /* MISC_H */ Property changes on: firmware/tuxaudio/trunk/misc.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Name: svn:eol-style + native Added: firmware/tuxaudio/trunk/parser.c =================================================================== --- firmware/tuxaudio/trunk/parser.c (rev 0) +++ firmware/tuxaudio/trunk/parser.c 2008-05-06 15:00:57 UTC (rev 1118) @@ -0,0 +1,126 @@ +/* + * 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 <stddef.h> +#include <avr/interrupt.h> + +#include "parser.h" +#include "communication.h" +#include "hardware.h" +#include "misc.h" +#include "varis.h" /* XXX remove this one */ +#include "flash.h" /* XXX remove this one */ + +/** + * Parse a cmd received by the computer or by tuxcore and drop it if it + * shouldn't be forwarded. + */ +void parse_cmd(uint8_t *cmd) +{ + static uint8_t pong_received; /* value of the pong received from the behavior */ + static uint8_t pong_missed; /* counting the pong missed on the I2C */ + + /* + * Commands that should be forwarded + */ + + /* Ping */ + if (cmd[0] == PONG_CMD) + { + if (pong_received-- < cmd[1]) /* new ping, reset */ + { + pong_received = cmd[1]; + pong_missed = 0; + } + else if (pong_received > cmd[1]) /* pongs missed */ + { + pong_missed += pong_received - cmd[1]; + pong_received = cmd[1]; /* resync */ + } + cmd[2] = pong_missed; + } + else if (cmd[0] == SLEEP_CMD) + { + /* Forwards the cmd to the rf CPU */ + cmd[0] = SLEEP_ACK_CMD; + cmd[1] = 0; + cmd[2] = 0; + cmd[3] = 0; + cli(); + send_status(cmd); + sei(); + /* XXX sleep commented for now */ + /*pre_sleep_delay = 30; [> handle sleep in its own function <]*/ + /*sleep_f = 1;*/ + /*statusFlag = 1;*/ + } + else + { + /* + * Commands that shouldn't be forwarded. + */ + /* Version */ + if (cmd[0] == INFO_TUXAUDIO_CMD) + { + 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]; + send_status_p(STATUS_AUDIO_CMD, cmd[1], 0, 0); + flashPlay = 1; + flash_state = 1; + } + 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; + } + cmd = NULL; + } +} Property changes on: firmware/tuxaudio/trunk/parser.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Name: svn:eol-style + native Added: firmware/tuxaudio/trunk/parser.h =================================================================== --- firmware/tuxaudio/trunk/parser.h (rev 0) +++ firmware/tuxaudio/trunk/parser.h 2008-05-06 15:00:57 UTC (rev 1118) @@ -0,0 +1,29 @@ +/* + * 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$ */ + +#ifndef PARSER_H +#define PARSER_H + +#include <stdbool.h> + +void parse_cmd(uint8_t *cmd); + +#endif /* PARSER_H */ Property changes on: firmware/tuxaudio/trunk/parser.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Name: svn:eol-style + native Modified: firmware/tuxaudio/trunk/varis.c =================================================================== --- firmware/tuxaudio/trunk/varis.c 2008-05-06 14:56:11 UTC (rev 1117) +++ firmware/tuxaudio/trunk/varis.c 2008-05-06 15:00:57 UTC (rev 1118) @@ -77,5 +77,4 @@ uint8_t last_block = 0; // General flags -uint8_t info_flg = 0; /* indicates if version information should be sent */ uint8_t write_toc = 0; Modified: firmware/tuxaudio/trunk/varis.h =================================================================== --- firmware/tuxaudio/trunk/varis.h 2008-05-06 14:56:11 UTC (rev 1117) +++ firmware/tuxaudio/trunk/varis.h 2008-05-06 15:00:57 UTC (rev 1118) @@ -87,6 +87,5 @@ extern uint8_t last_block; // General flags -extern uint8_t info_flg; extern uint8_t write_toc; #endif |