[tuxdroid-svn] r488 - firmware/tuxaudio/branches/audio_cleanup
Status: Beta
Brought to you by:
ks156
From: jaguarondi <c2m...@c2...> - 2007-09-06 11:36:17
|
Author: jaguarondi Date: 2007-09-06 13:35:14 +0200 (Thu, 06 Sep 2007) New Revision: 488 Removed: firmware/tuxaudio/branches/audio_cleanup/test.c firmware/tuxaudio/branches/audio_cleanup/test.h Modified: firmware/tuxaudio/branches/audio_cleanup/Makefile firmware/tuxaudio/branches/audio_cleanup/init.c firmware/tuxaudio/branches/audio_cleanup/main.c firmware/tuxaudio/branches/audio_cleanup/varis.c firmware/tuxaudio/branches/audio_cleanup/varis.h firmware/tuxaudio/branches/audio_cleanup/version.h Log: * Ported r482 from trunk. Modified: firmware/tuxaudio/branches/audio_cleanup/Makefile =================================================================== --- firmware/tuxaudio/branches/audio_cleanup/Makefile 2007-09-06 07:27:54 UTC (rev 487) +++ firmware/tuxaudio/branches/audio_cleanup/Makefile 2007-09-06 11:35:14 UTC (rev 488) @@ -167,10 +167,10 @@ $(AVRDUDE) -p $(MCU) -c jtag2isp -P usb -B 10 -e -U flash:w:$(PROJECT).hex -U eeprom:w:$(PROJECT).eep progisp_bl: $(PROJECT).hex $(PROJECT).eep $(PROJECT)_bl.hex - $(AVRDUDE) -p $(MCU) -c jtag2isp -P usb -B 10 -e -U flash:w:$(PROJECT).hex -U eeprom:w:$(PROJECT).eep -D -U flash:w:$(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 progstk: $(PROJECT).hex $(PROJECT).eep $(AVRDUDE) -p $(MCU) -c stk500v2 -e -U flash:w:$(PROJECT).hex -U eeprom:w:$(PROJECT).eep progstk_bl: $(PROJECT).hex $(PROJECT).eep $(PROJECT)_bl.hex - $(AVRDUDE) -p $(MCU) -c stk500v2 -e -U flash:w:$(PROJECT).hex -U eeprom:w:$(PROJECT).eep -D -U flash:w:$(PROJECT)_bl.hex + $(AVRDUDE) -p $(MCU) -c stk500v2 -e -U flash:w:$(PROJECT)_bl.hex -U eeprom:w:$(PROJECT).eep -D -U flash:w:$(PROJECT).hex Modified: firmware/tuxaudio/branches/audio_cleanup/init.c =================================================================== --- firmware/tuxaudio/branches/audio_cleanup/init.c 2007-09-06 07:27:54 UTC (rev 487) +++ firmware/tuxaudio/branches/audio_cleanup/init.c 2007-09-06 11:35:14 UTC (rev 488) @@ -59,7 +59,8 @@ // Port D initialization //PORTD.0 -> OUT IR receiver power - //PORTD.1 -> OUT microphone preamplifier power (PU at beginning the switched to strong 1) + //PORTD.1 -> OUT microphone preamplifier power (PU at beginning then + // switched to strong 1) //PORTD.2 -> IN RF SPI READY //PORTD.3 -> IN RF SPI START //PORTD.4 -> PU CHARGER STATUS Modified: firmware/tuxaudio/branches/audio_cleanup/main.c =================================================================== --- firmware/tuxaudio/branches/audio_cleanup/main.c 2007-09-06 07:27:54 UTC (rev 487) +++ firmware/tuxaudio/branches/audio_cleanup/main.c 2007-09-06 11:35:14 UTC (rev 488) @@ -169,10 +169,6 @@ else unmute_amp(); } - else if (audioBuf[0] == TEST_MODE_CMD) - { - test_mode = audioBuf[2]; /* audio test mode is the second parameter */ - } else if (audioBuf[0] == SLEEP_CMD) { pre_sleep_delay = 30; /* handle sleep in its own function */ @@ -400,57 +396,50 @@ { sampling_pwm = 0x04; /* reinit counter */ - if (test_mode == AT_AUDIOLINK) - { - OCR0B = ADCH; - } - else - { #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; + /* MEDIUM GAIN MODE */ + uint8_t tmp; - 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; - pushFifo(&ADCFifo, tmp); - /* HIGH GAIN MODE */ + 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; + pushFifo(&ADCFifo, tmp); + /* HIGH GAIN MODE */ #elif (MIC_GAIN == 12) - uint8_t tmp; + uint8_t tmp; - tmp = ADCL + 0x80; - pushFifo(&ADCFifo, tmp); - asm volatile ("lds __tmp_reg__, %0"::"M" (_SFR_MEM_ADDR(ADCH))); /* ADCH needs to be read for the next acquisition */ + tmp = ADCL + 0x80; + pushFifo(&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 */ - pushFifo(&ADCFifo, 0x01); - else - pushFifo(&ADCFifo, ADCH); + /* 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 */ + pushFifo(&ADCFifo, 0x01); + else + pushFifo(&ADCFifo, ADCH); #endif - if (!popFifo(&PWMFifo, &dataFifo)) /* set the sample value to timer pulse width */ + if (!popFifo(&PWMFifo, &dataFifo)) /* set the sample value to timer pulse width */ + { + OCR0B = dataFifo; + 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) { - OCR0B = dataFifo; - 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(); + if (tuxaudio_config.automute) + mute_amp(); + Fifoinert = 30; + //OCR0A = 250; // Normal operation for ADC sampling if FIFO Adaptative is on } - 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 - } - } } if (--sendSensorsCmpt == 0) sendSensorsFlag = 1; /* send status to the behavioural CPU, 8KHz divided by 256 lead to a status sent each 32ms */ Deleted: firmware/tuxaudio/branches/audio_cleanup/test.c =================================================================== --- firmware/tuxaudio/branches/audio_cleanup/test.c 2007-09-06 07:27:54 UTC (rev 487) +++ firmware/tuxaudio/branches/audio_cleanup/test.c 2007-09-06 11:35:14 UTC (rev 488) @@ -1,76 +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 "varis.h" -#include "flash.h" - -void testaudio(void) -{ - int i; - unsigned char ad2, ad1, ad0, tmp; - -/* erase_flash (); // Erase flash - program_flash (0x00, 0x00, 0x00, 0x01); // Write first byte of the TOC - program_flash (0x00, 0x00, 0x01, 0x00); // Write speudo TOC for test - program_flash (0x00, 0x00, 0x02, 0x04); - program_flash (0x00, 0x00, 0x03, 0x00); - program_flash (0x00, 0x00, 0x04, 0x00); - program_flash (0x00, 0x00, 0x05, 0x42); - program_flash (0x00, 0x00, 0x06, 0x00); - ad2 = 0x00; // Init sound address - ad1 = 0x04; - ad0 = 0x00; - write_enable (); - PORTB &= ~0x02; // Chip Select - SPDR = 0xAF; // Send Sequencial Program Command - while ((SPSR & 0x80) == 0); // Wait SPI response - SPDR = ad2; // Send Address - while ((SPSR & 0x80) == 0); // Wait SPI response - SPDR = ad1; - while ((SPSR & 0x80) == 0); // Wait SPI response - SPDR = ad0; - while ((SPSR & 0x80) == 0); // Wait SPI response - SPDR = 0x00; - while ((SPSR & 0x80) == 0); // Wait SPI response - PORTB |= 0x02; // Chip Deselect - while (read_status() != 0x10); // Wait Page Program Cycle - tmp = 1; - for (i = 0; i < 15872; i++) - { - PORTB &= ~0x02; // Chip Select - SPDR = 0xAF; // Send Sequencial Program Command - while ((SPSR & 0x80) == 0); // Wait SPI response - SPDR = tmp; // Write data in flash - while ((SPSR & 0x80) == 0); // Wait SPI response - PORTB |= 0x02; // Chip DeselecT - tmp++; - ad0++; // Increment address byte - if (ad0 == 0x00) - { - ad1++; - if (ad1 == 0x00) - ad2++; - } - while (read_status() != 0x10); // Wait Page Program Cycle - } -*/// ATTENTION NE PAS OBUBLIER LE MUTE -} Deleted: firmware/tuxaudio/branches/audio_cleanup/test.h =================================================================== --- firmware/tuxaudio/branches/audio_cleanup/test.h 2007-09-06 07:27:54 UTC (rev 487) +++ firmware/tuxaudio/branches/audio_cleanup/test.h 2007-09-06 11:35:14 UTC (rev 488) @@ -1,27 +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: */ - -#ifndef TEST_H -#define TEST_H - -extern void testaudio(void); - -#endif Modified: firmware/tuxaudio/branches/audio_cleanup/varis.c =================================================================== --- firmware/tuxaudio/branches/audio_cleanup/varis.c 2007-09-06 07:27:54 UTC (rev 487) +++ firmware/tuxaudio/branches/audio_cleanup/varis.c 2007-09-06 11:35:14 UTC (rev 488) @@ -71,6 +71,3 @@ volatile unsigned char lockAdaptFifo = 1; volatile unsigned char Fifoinert = 0; - -// Test mode -uint8_t test_mode = 0; Modified: firmware/tuxaudio/branches/audio_cleanup/varis.h =================================================================== --- firmware/tuxaudio/branches/audio_cleanup/varis.h 2007-09-06 07:27:54 UTC (rev 487) +++ firmware/tuxaudio/branches/audio_cleanup/varis.h 2007-09-06 11:35:14 UTC (rev 488) @@ -82,7 +82,4 @@ extern volatile unsigned char Fifoinert; -// Test mode -extern uint8_t test_mode; - #endif Modified: firmware/tuxaudio/branches/audio_cleanup/version.h =================================================================== --- firmware/tuxaudio/branches/audio_cleanup/version.h 2007-09-06 07:27:54 UTC (rev 487) +++ firmware/tuxaudio/branches/audio_cleanup/version.h 2007-09-06 11:35:14 UTC (rev 488) @@ -30,7 +30,7 @@ #define VER_MAJOR 0 #define VER_MINOR 3 -#define VER_UPDATE 0 +#define VER_UPDATE 1 #define AUTHOR_ID 0 /* official release */ |