[tuxdroid-svn] r1294 - firmware/rf/trunk
Status: Beta
Brought to you by:
ks156
From: jaguarondi <c2m...@c2...> - 2008-07-02 07:40:14
|
Author: jaguarondi Date: 2008-07-02 09:40:23 +0200 (Wed, 02 Jul 2008) New Revision: 1294 Added: firmware/rf/trunk/main.c Removed: firmware/rf/trunk/device.c Modified: firmware/rf/trunk/Makefile Log: * Renamed device.c into main.c. Modified: firmware/rf/trunk/Makefile =================================================================== --- firmware/rf/trunk/Makefile 2008-07-02 07:38:17 UTC (rev 1293) +++ firmware/rf/trunk/Makefile 2008-07-02 07:40:23 UTC (rev 1294) @@ -1,5 +1,5 @@ ############################################################################### -# Makefile for the project device +# Makefile for [TF]UXRF ############################################################################### ## General Flags @@ -53,9 +53,9 @@ ## Objects that must be built in order to link ifeq ($(BOOTLOADER),1) -OBJECTS = device.o init.o misc.o prot.o rf_ctrl.o varis.o interface.o bootloader.o +OBJECTS = main.o init.o misc.o prot.o rf_ctrl.o varis.o interface.o bootloader.o else -OBJECTS = device.o init.o misc.o prot.o rf_ctrl.o varis.o interface.o +OBJECTS = main.o init.o misc.o prot.o rf_ctrl.o varis.o interface.o endif ## Objects explicitly added by the user @@ -65,7 +65,7 @@ all: svnrev.h $(TARGET) $(PROJECT).hex $(PROJECT).eep $(PROJECT).lss size ## Compile -device.o: device.c +main.o: main.c $(CC) $(INCLUDES) $(CFLAGS) -c $< init.o: init.c @@ -112,7 +112,7 @@ ## Clean target .PHONY: clean clean: - -rm -rf $(OBJECTS) device.elf dep/* $(PROJECT).* svnrev.h + -rm -rf $(OBJECTS) main.elf dep/* $(PROJECT).* svnrev.h ## Other dependencies Deleted: firmware/rf/trunk/device.c =================================================================== --- firmware/rf/trunk/device.c 2008-07-02 07:38:17 UTC (rev 1293) +++ firmware/rf/trunk/device.c 2008-07-02 07:40:23 UTC (rev 1294) @@ -1,114 +0,0 @@ -/* - * [TF]UXRF - Firmware for the 2 RF CPU of tuxdroid (TUXRF and FUXRF) - * Copyright (C) 2007 KySoH S.A. <in...@ky...> - * - * 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 "defines.h" -#include "init.h" -#include "interface.h" -#include "misc.h" -#include "varis.h" -#include "prot.h" -#include "rf_ctrl.h" - -/* - * Version number - */ -#include "version.h" -#include "svnrev.h" -#include "common/api.h" -#include "common/defines.h" - -#ifdef _SLAVE -#define CPU_NUMBER TUXRF_CPU_NUM /* TUXRF CPU */ -#else -#define CPU_NUMBER FUXRF_CPU_NUM /* FUXRF CPU */ -#endif -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 to 1 to enable stack debugging. */ -#define DBG_STACK 0 - -#if (BOOTLOADER) -#include "bootloader.h" -#endif - -#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 - -/** - * Main function of the RF firmware. - * After initialization, the RF is completely handled by interrupts, the main - * loop is empty. - */ -int main(void) -{ -#ifdef _SLAVE - volatile uint16_t _count=0; - /* Wait for the head button signal to rise if it isn't pressed. */ - for (;_count<0xFFFF; _count++); - /* If head is pushed at startup */ - if (!(PIND & 0x40)) - /* jump to bootloader */ -#if (BOOTLOADER) - asm volatile ("rjmp bootloader" ::); -#else - asm volatile ("rjmp bootloader_start" ::); -#endif -#elif defined(_MASTER) - /* If SPI_SS is cleared at startup */ - if (!(PINB & 0x04)) - /* jump to bootloader */ -#if (BOOTLOADER) - asm volatile ("rjmp bootloader" ::); -#else - asm volatile ("rjmp bootloader_start" ::); -#endif -#endif - - /* System init */ - init_avr(); - init_varis(); - interface_init(); - - /* XXX debug */ - DDRB |= _BV(PB3) | _BV(PB5); - DDRC |= _BV(PC3); - - - sei(); - system_start_up(); - for(;;){ - } -} Copied: firmware/rf/trunk/main.c (from rev 1293, firmware/rf/trunk/device.c) =================================================================== --- firmware/rf/trunk/main.c (rev 0) +++ firmware/rf/trunk/main.c 2008-07-02 07:40:23 UTC (rev 1294) @@ -0,0 +1,114 @@ +/* + * [TF]UXRF - Firmware for the 2 RF CPU of tuxdroid (TUXRF and FUXRF) + * Copyright (C) 2007 KySoH S.A. <in...@ky...> + * + * 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 "defines.h" +#include "init.h" +#include "interface.h" +#include "misc.h" +#include "varis.h" +#include "prot.h" +#include "rf_ctrl.h" + +/* + * Version number + */ +#include "version.h" +#include "svnrev.h" +#include "common/api.h" +#include "common/defines.h" + +#ifdef _SLAVE +#define CPU_NUMBER TUXRF_CPU_NUM /* TUXRF CPU */ +#else +#define CPU_NUMBER FUXRF_CPU_NUM /* FUXRF CPU */ +#endif +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 to 1 to enable stack debugging. */ +#define DBG_STACK 0 + +#if (BOOTLOADER) +#include "bootloader.h" +#endif + +#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 + +/** + * Main function of the RF firmware. + * After initialization, the RF is completely handled by interrupts, the main + * loop is empty. + */ +int main(void) +{ +#ifdef _SLAVE + volatile uint16_t _count=0; + /* Wait for the head button signal to rise if it isn't pressed. */ + for (;_count<0xFFFF; _count++); + /* If head is pushed at startup */ + if (!(PIND & 0x40)) + /* jump to bootloader */ +#if (BOOTLOADER) + asm volatile ("rjmp bootloader" ::); +#else + asm volatile ("rjmp bootloader_start" ::); +#endif +#elif defined(_MASTER) + /* If SPI_SS is cleared at startup */ + if (!(PINB & 0x04)) + /* jump to bootloader */ +#if (BOOTLOADER) + asm volatile ("rjmp bootloader" ::); +#else + asm volatile ("rjmp bootloader_start" ::); +#endif +#endif + + /* System init */ + init_avr(); + init_varis(); + interface_init(); + + /* XXX debug */ + DDRB |= _BV(PB3) | _BV(PB5); + DDRC |= _BV(PC3); + + + sei(); + system_start_up(); + for(;;){ + } +} Property changes on: firmware/rf/trunk/main.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Name: svn:mergeinfo + Name: svn:eol-style + native |