tux-droid-svn Mailing List for Tux Droid CE (Page 223)
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...> - 2007-06-26 14:12:48
|
Author: jaguarondi Date: 2007-06-26 16:12:36 +0200 (Tue, 26 Jun 2007) New Revision: 456 Added: firmware/fuxrf/trunk/bootloader.c firmware/fuxrf/trunk/bootloader.h firmware/fuxrf/trunk/spi.c firmware/fuxrf/trunk/spi.h firmware/tuxrf/trunk/bootloader.c firmware/tuxrf/trunk/bootloader.h firmware/tuxrf/trunk/sleep.c firmware/tuxrf/trunk/sleep.h firmware/tuxrf/trunk/spi.c firmware/tuxrf/trunk/spi.h Modified: firmware/fuxrf/trunk/default/Makefile firmware/fuxrf/trunk/defines.h firmware/fuxrf/trunk/device.aps 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/varis.c firmware/fuxrf/trunk/varis.h firmware/tuxrf/trunk/default/Makefile firmware/tuxrf/trunk/defines.h firmware/tuxrf/trunk/device.aps firmware/tuxrf/trunk/device.c firmware/tuxrf/trunk/init.c firmware/tuxrf/trunk/init.h firmware/tuxrf/trunk/misc.c firmware/tuxrf/trunk/misc.h firmware/tuxrf/trunk/prot.c firmware/tuxrf/trunk/prot.h firmware/tuxrf/trunk/rf_ctrl.c firmware/tuxrf/trunk/varis.c firmware/tuxrf/trunk/varis.h Log: * Merged the current RF programs from Pascal. Added: firmware/fuxrf/trunk/bootloader.c =================================================================== --- firmware/fuxrf/trunk/bootloader.c (rev 0) +++ firmware/fuxrf/trunk/bootloader.c 2007-06-26 14:12:36 UTC (rev 456) @@ -0,0 +1,76 @@ +#include <avr/io.h> +#include <avr/boot.h> +#include <avr/pgmspace.h> +#include <util/twi.h> +#include "bootloader.h" + +typedef union +{ + uint16_t w; + uint8_t b[2]; +} union16_t; + +/** \ingroup minimal_bootloader + * + * Minimal I2C bootloader + * + * This function is naked, you can call it but it will never return. + */ +void bootloader(void) +{ + union16_t pageAddress, data; + uint16_t address; + uint8_t i, twStatus; + + /* twi intialisation */ + TWBR = (F_CPU / 100000UL - 16) / 2; + TWAR = I2C_BL_TWAR; + + TWCR = _BV(TWEA) | _BV(TWEN) | _BV(TWINT); + for (;;) + { + i2cWaitForComplete(); /* wait the I2C address */ + if ((twStatus = TW_STATUS) != TW_SR_SLA_ACK) while(1); + TWCR = _BV(TWEA) | _BV(TWEN) | _BV(TWINT); + i2cWaitForComplete(); /* wait the high byte of the page address */ + if ((twStatus = TW_STATUS) != TW_SR_DATA_ACK) while(1); + pageAddress.b[1] = TWDR; + TWCR = _BV(TWEA) | _BV(TWEN) | _BV(TWINT); + i2cWaitForComplete(); /* wait the low byte of the page address */ + if ((twStatus = TW_STATUS) != TW_SR_DATA_ACK) while(1); + pageAddress.b[0] = TWDR; + if (pageAddress.w & 0x003F) while(1); /* incorrect page address */$ + if (pageAddress.w >= 0x0F00) while(1); /* don't overwrite the bootloader */$ + address = pageAddress.w; + TWCR = _BV(TWEA) | _BV(TWEN) | _BV(TWINT); + for (i=0; i<SPM_PAGESIZE; i++) /* fill the complete page with the next data */ + { + i2cWaitForComplete(); /* wait data */ + if ((twStatus = TW_STATUS) == TW_SR_DATA_ACK) + { + if ((i & 0x01) == 0) + { + data.b[0] = TWDR; + } + else + { + data.b[1] = TWDR; + boot_page_fill (address, data.w); + address += 2; + } + TWCR = _BV(TWEA) | _BV(TWEN) | _BV(TWINT); + } + else while(1); /* error in communication */ + } + i2cWaitForComplete(); + if ((twStatus = TW_STATUS) != TW_SR_STOP) while(1); /* if no stop at this exact position, there's something wrong with the number of bytes sent, we cancel */ + TWCR = _BV(TWEA) | _BV(TWEN) | _BV(TWINT); /* clear the interrupt immediately so not to miss the next frame */ + boot_page_erase (pageAddress.w); + boot_page_write (pageAddress.w); /* Store buffer in flash page */ + } +} + +void i2cWaitForComplete(void) +{ + while( !(TWCR & _BV(TWINT)) ); /* wait for i2c interface to complete operation */ +} Property changes on: firmware/fuxrf/trunk/bootloader.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Name: svn:eol-style + native Added: firmware/fuxrf/trunk/bootloader.h =================================================================== --- firmware/fuxrf/trunk/bootloader.h (rev 0) +++ firmware/fuxrf/trunk/bootloader.h 2007-06-26 14:12:36 UTC (rev 456) @@ -0,0 +1,46 @@ +/* KySoH's iTux agent + Copyright (c) 2006, C2ME S.A. + All rights reserved. + * Bootloader source code + * created on 2006/11/25 David Bourgeois + * ------------------------------------------------------------------- + * $Id$ + */ + +#ifndef _BOOTLOADER_H_ +#define _BOOTLOADER_H_ + +/** \defgroup minimal_bootloader Minimal I2C bootloader + \ingroup firmware + \file + \brief Minimal I2C bootloader + \author David Bourgeois + \date 2006 +$ + The footprint is less than 0xFF bytes so it should be + possible to place the bootlaoder at 0x0F00 in your application +$ + Use the following linker option: + \code + -Wl,--section-start=.bootloader=0x0F00 + \endcode + To include this bootloader in your application, include bootloader.h: + \code + #include "bootloader.h" + \endcode + and change the slave address in bootloader mode in the define below. Then + call it with: + \code + asm volatile ("rjmp bootloader" ::); + \endcode + */ + +/** \ingroup tuxRF_firmware + Slave address for bootloader mode + */ +#define I2C_BL_TWAR (0X33 << 1) + +void bootloader(void) __attribute__ ((section (".bootloader"))) __attribute__ ((naked)); +void i2cWaitForComplete(void) __attribute__ ((section (".bootloader"))); + +#endif /* _BOOTLOADER_H_ */ Property changes on: firmware/fuxrf/trunk/bootloader.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Name: svn:eol-style + native Modified: firmware/fuxrf/trunk/default/Makefile =================================================================== --- firmware/fuxrf/trunk/default/Makefile 2007-06-26 13:41:18 UTC (rev 455) +++ firmware/fuxrf/trunk/default/Makefile 2007-06-26 14:12:36 UTC (rev 456) @@ -6,15 +6,15 @@ PROJECT = device MCU = atmega48 TARGET = device.elf -CC = avr-gcc +CC = avr-gcc.exe ## Options common to compile, link and assembly rules COMMON = -mmcu=$(MCU) ## Compile options common for all C compilation units. CFLAGS = $(COMMON) -CFLAGS += -Wall -gdwarf-2 -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -CFLAGS += -Wp,-M,-MP,-MT,$(*F).o,-MF,dep/$(@F).d +CFLAGS += -Wall -gdwarf-2 -DF_CPU=13824000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums +CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d ## Assembly specific flags ASMFLAGS = $(COMMON) @@ -22,11 +22,13 @@ ## Linker flags LDFLAGS = $(COMMON) -LDFLAGS += -LDFLAGS += -Wl,-section-start=.buffer_rx=0x800100 -LDFLAGS += -Wl,-section-start=.buffer_tx=0x800140 -LDFLAGS += -Wl,-section-start=.sof=0x800180 -LDFLAGS += -Wl,-section-start=.globals=0x800185 +LDFLAGS += -Wl,--section-start=.bootloader=0x0F00 -Wl,-Map=device.map +LDFLAGS += -Wl,-section-start=.buffer_tx1=0x800100 +LDFLAGS += -Wl,-section-start=.buffer_rx1=0x800140 +LDFLAGS += -Wl,-section-start=.sof=0x8001e6 +LDFLAGS += -Wl,-section-start=.globals=0x8001ea +LDFLAGS += -Wl,-section-start=.buffer_tx2=0x800173 +LDFLAGS += -Wl,-section-start=.buffer_rx2=0x8001b3 ## Intel Hex file production flags @@ -38,10 +40,13 @@ ## Objects that must be built in order to link -OBJECTS = device.o init.o misc.o prot.o rf_ctrl.o varis.o +OBJECTS = device.o init.o misc.o prot.o rf_ctrl.o varis.o spi.o bootloader.o +## Objects explicitly added by the user +LINKONLYOBJECTS = + ## Build -all: $(TARGET) device.hex device.eep +all: $(TARGET) device.hex device.eep device.lss size ## Compile device.o: ../device.c @@ -62,9 +67,15 @@ varis.o: ../varis.c $(CC) $(INCLUDES) $(CFLAGS) -c $< +spi.o: ../spi.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +bootloader.o: ../bootloader.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + ##Link $(TARGET): $(OBJECTS) - $(CC) $(LDFLAGS) $(OBJECTS) $(LIBDIRS) $(LIBS) -o $(TARGET) + $(CC) $(LDFLAGS) $(OBJECTS) $(LINKONLYOBJECTS) $(LIBDIRS) $(LIBS) -o $(TARGET) %.hex: $(TARGET) avr-objcopy -O ihex $(HEX_FLASH_FLAGS) $< $@ @@ -75,11 +86,16 @@ %.lss: $(TARGET) avr-objdump -h -S $< > $@ +size: ${TARGET} + @echo + @avr-size -C --mcu=${MCU} ${TARGET} + ## Clean target .PHONY: clean clean: - -rm -rf $(OBJECTS) device.elf dep/ device.hex device.eep + -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/*) Modified: firmware/fuxrf/trunk/defines.h =================================================================== --- firmware/fuxrf/trunk/defines.h 2007-06-26 13:41:18 UTC (rev 455) +++ firmware/fuxrf/trunk/defines.h 2007-06-26 14:12:36 UTC (rev 456) @@ -1,231 +1,112 @@ -//***************************************************************************** -//* 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 <io.h> -#include <ina90.h> -#include <avr/signal.h> -#include <interrupt.h> -#include <pgmspace.h> -#include <eeprom.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 0 -//#define CYCHOPP -//**Define the used HOPPING SCHEME**// +// 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$ -//include defines for target MCU -//own firmware definitions -#define uc_8 unsigned char -#define ui_16 unsigned int -#define sc_8 char -#define si_16 int +#define WIFI -#define TXEN 0x01 -#define RXEN 0x00 -#define CONNECTED 0x80 +// Type definition +#define uc_8 unsigned char +#define ui_16 unsigned int +#define sc_8 char +#define si_16 int +//------->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<-----// -#define TXING 0x08 -#define RXING 0x04 -#define MASTER 0x40 -#define SLAVE 0x80 +//------->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<-------// - -//returns the address owned by the given label in registers R31:R30 -#define GET_LABEL_ADDRESS(addr) \ -{ \ - __asm__ __volatile__ ( \ - " \n" \ - : :"z" (addr) ); \ -} - -#define _SLEEP __asm__ __volatile__ ("sleep") +//----->Assembler Definitions<-----// #define _RETI __asm__ __volatile__ ("reti") #define _NIX __asm__ __volatile__ ("nop") -#define _MY_IJMP __asm__ __volatile__ ("ijmp") -#define _SEI __asm__ __volatile__ ("sei") -#define _CLI __asm__ __volatile__ ("cli") -#define __FLASH__ __attribute__((__progmem__)) #define _READ_FB __LPM #define __EEPROM__ __attribute__((section(".eeprom"))) #define SIGNAL_NAKED(signame)\ void signame (void) __attribute__ ((signal)) __attribute__ ((naked));\ void signame (void) -//Hardware Definitions +//----->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<-----// - -#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-Specifc-Defines<-----// -#define CH00TX 0x1B -#define CH00RX 0x1C -//----->RF-Specifc-Defines<-----// - - //T_SLOT == 1ms ==> every 1000us 48Bytes of payload are exchanged - #define POLL_LOOPS 2 - #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 1065 - 31 //(1065 - 31) == 616.32us(616.09) [31 == calc time!!(17.94us)] - #define T_SYNC 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 - Modified: firmware/fuxrf/trunk/device.aps =================================================================== --- firmware/fuxrf/trunk/device.aps 2007-06-26 13:41:18 UTC (rev 455) +++ firmware/fuxrf/trunk/device.aps 2007-06-26 14:12:36 UTC (rev 456) @@ -1 +1 @@ -<AVRStudio><MANAGEMENT><ProjectName>device</ProjectName><Created>10-Nov-2005 15:17:29</Created><LastEdit>10-Jul-2006 08:52:53</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>D:\ATR2406\Firmware\dragonfly\Ineltek_Demo\gcc_template_48\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET>JTAGICE mkII</CURRENT_TARGET><CURRENT_PART>ATmega48</CURRENT_PART><BREAKPOINTS></BREAKPOINTS><IO_EXPAND><Item>51</Item><Item>52</Item><Item>34</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>0</WATCHNUM><WATCHNAMES><Pane0><Variables>ts</Variables><Variables>i</Variables><Variables>rf_rx_state</Variables><Variables>checksum</Variables><Variables>protocol_flags</Variables></Pane0><Pane1></Pane1><Pane2></Pane2><Pane3></Pane3></WATCHNAMES><BreakOnTrcaeFull>0</BreakOnTrcaeFull></DEBUG_TARGET><Debugger><modules><module></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><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></FILES><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>NO</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE></EXTERNALMAKEFILE><PART>atmega48</PART><HEX>1</HEX><LIST>0</LIST><MAP>0</MAP><OUTPUTFILENAME>device.elf</OUTPUTFILENAME><OUTPUTDIR>default\</OUTPUTDIR><ISDIRTY>1</ISDIRTY><OPTIONS/><INCDIRS/><LIBDIRS/><LIBS/><OPTIONSFORALL>-Wall -gdwarf-2 -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums</OPTIONSFORALL><LINKEROPTIONS></LINKEROPTIONS><SEGMENTS><SEGMENT><NAME>.buffer_rx</NAME><SEGMENT>SRAM</SEGMENT><ADDRESS>0x100</ADDRESS></SEGMENT><SEGMENT><NAME>.buffer_tx</NAME><SEGMENT>SRAM</SEGMENT><ADDRESS>0x140</ADDRESS></SEGMENT><SEGMENT><NAME>.sof</NAME><SEGMENT>SRAM</SEGMENT><ADDRESS>0x180</ADDRESS></SEGMENT><SEGMENT><NAME>.globals</NAME><SEGMENT>SRAM</SEGMENT><ADDRESS>0x185</ADDRESS></SEGMENT></SEGMENTS></CONFIG></CONFIGS><LASTCONFIG>default</LASTCONFIG><USES_WINAVR>1</USES_WINAVR><GCC_LOC>D:\gcc_avr\WinAVR\bin</GCC_LOC><MAKE_LOC>D:\gcc_avr\WinAVR\utils\bin</MAKE_LOC></AVRGCCPLUGIN><Files><File00000><FileId>00000</FileId><FileName>device.c</FileName><Status>259</Status></File00000><File00001><FileId>00001</FileId><FileName>varis.c</FileName><Status>257</Status></File00001><File00002><FileId>00002</FileId><FileName>prot.c</FileName><Status>259</Status></File00002><File00003><FileId>00003</FileId><FileName>rf_ctrl.c</FileName><Status>259</Status></File00003><File00004><FileId>00004</FileId><FileName>init.c</FileName><Status>259</Status></File00004><File00005><FileId>00005</FileId><FileName>prot.h</FileName><Status>1</Status></File00005><File00006><FileId>00006</FileId><FileName>defines.h</FileName><Status>1</Status></File00006></Files><Workspace><File00000><Position>402 72 1042 686</Position><LineCol>75 0</LineCol><State>Maximized</State></File00000><File00001><Position>454 66 1432 709</Position><LineCol>0 0</LineCol></File00001><File00002><Position>464 135 1255 596</Position><LineCol>0 0</LineCol></File00002><File00003><Position>486 157 1145 594</Position><LineCol>0 0</LineCol></File00003><File00004><Position>508 179 971 616</Position><LineCol>0 0</LineCol></File00004><File00005><Position>530 201 993 638</Position><LineCol>0 0</LineCol></File00005><File00006><Position>581 225 1273 684</Position><LineCol>0 0</LineCol></File00006></Workspace><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio> +<AVRStudio><MANAGEMENT><ProjectName>device</ProjectName><Created>10-Nov-2005 15:17:29</Created><LastEdit>12-Jun-2007 15:02:37</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\Pascal\Desktop\RF_test\Master\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><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><OTHERFILE>default\device.lss</OTHERFILE><OTHERFILE>default\device.map</OTHERFILE></FILES><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>NO</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE></EXTERNALMAKEFILE><PART>atmega168</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>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</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\bin\avr-gcc.exe</GCC_LOC><MAKE_LOC>C:\_WinAVR\utils\bin\make.exe</MAKE_LOC></AVRGCCPLUGIN><Files><File00000><FileId>00000</FileId><FileName>device.c</FileName><Status>259</Status></File00000><File00001><FileId>00001</FileId><FileName>varis.c</FileName><Status>257</Status></File00001><File00002><FileId>00002</FileId><FileName>prot.c</FileName><Status>259</Status></File00002><File00003><FileId>00003</FileId><FileName>rf_ctrl.c</FileName><Status>259</Status></File00003><File00004><FileId>00004</FileId><FileName>init.c</FileName><Status>259</Status></File00004><File00005><FileId>00005</FileId><FileName>prot.h</FileName><Status>1</Status></File00005><File00006><FileId>00006</FileId><FileName>defines.h</FileName><Status>1</Status></File00006><File00007><FileId>00007</FileId><FileName>misc.c</FileName><Status>259</Status></File00007><File00008><FileId>00008</FileId><FileName>varis.h</FileName><Status>257</Status></File00008><File00009><FileId>00009</FileId><FileName>init.h</FileName><Status>1</Status></File00009><File00010><FileId>00010</FileId><FileName>bootloader.c</FileName><Status>2</Status></File00010><File00011><FileId>00011</FileId><FileName>bootloader.h</FileName><Status>1</Status></File00011><File00012><FileId>00012</FileId><FileName>rf_ctrl.h</FileName><Status>1</Status></File00012><File00013><FileId>00013</FileId><FileName>misc.h</FileName><Status>1</Status></File00013><File00014><FileId>00014</FileId><FileName>spi.h</FileName><Status>1</Status></File00014><File00015><FileId>00015</FileId><FileName>C:\_WinAVR\avr\include\stdint.h</FileName><Status>259</Status></File00015><File00016><FileId>00016</FileId><FileName>spi.c</FileName><Status>259</Status></File00016></Files><Workspace><File00000><Position>335 72 1401 572</Position><LineCol>37 0</LineCol><State>Maximized</State></File00000><File00001><Position>1936 62 3034 649</Position><LineCol>0 0</LineCol></File00001><File00002><Position>5580 38 6678 625</Position><LineCol>0 0</LineCol></File00002><File00003><Position>10095 8 11193 595</Position><LineCol>0 0</LineCol></File00003><File00004><Position>11707 12 12805 651</Position><LineCol>0 0</LineCol></File00004><File00005><Position>17228 83 17691 520</Position><LineCol>0 0</LineCol></File00005><File00006><Position>4376 46 5474 633</Position><LineCol>0 0</LineCol></File00006><File00007><Position>17140 158 18114 563</Position><LineCol>0 0</LineCol></File00007><File00008><Position>14611 2 15589 563</Position><LineCol>0 0</LineCol></File00008><File00009><Position>16998 48 17931 366</Position><LineCol>0 0</LineCol></File00009><File00011><Position>16136 41 16947 360</Position><LineCol>0 0</LineCol></File00011><File00012><Position>16230 167 17188 546</Position><LineCol>0 0</LineCol></File00012><File00013><Position>16252 196 17210 601</Position><LineCol>0 0</LineCol></File00013><File00014><Position>9629 216 10587 647</Position><LineCol>0 0</LineCol></File00014><File00015><Position>9497 42 10455 473</Position><LineCol>0 0</LineCol></File00015><File00016><Position>2871 56 3969 643</Position><LineCol>0 0</LineCol></File00016></Workspace><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio> Modified: firmware/fuxrf/trunk/device.c =================================================================== --- firmware/fuxrf/trunk/device.c 2007-06-26 13:41:18 UTC (rev 455) +++ firmware/fuxrf/trunk/device.c 2007-06-26 14:12:36 UTC (rev 456) @@ -1,96 +1,85 @@ -//***************************************************************************** -//* 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 <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" +#ifdef WIFI +const unsigned char OffsetTbl[] = { 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41 }; +#endif + +/* Bootloader can be included with the program */ +#define BOOTLOADER 1 + +#if (BOOTLOADER) +#include "bootloader.h" +#endif + //***************************************************************************** //* Project: RF-Firmware for ISM * //* Function: main * //* Parameters: NONE * //* Returns: NONE * //* Action: Main routine of the Device * -//* Duration: tbd * +//* 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 * -//***************************************************************************** + +//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(); - init_varis(); - - _SEI; - system_start_up(); + 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 - - - - - for(;;){ - - } - + 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(); + } + }$ } - - - - Modified: firmware/fuxrf/trunk/init.c =================================================================== --- firmware/fuxrf/trunk/init.c 2007-06-26 13:41:18 UTC (rev 455) +++ firmware/fuxrf/trunk/init.c 2007-06-26 14:12:36 UTC (rev 456) @@ -1,53 +1,9 @@ -//***************************************************************************** -//* 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 * @@ -56,51 +12,64 @@ //* Action: Basic setup of AVR * //* Duration: tbd * //* Size: tbd * -//* Date: 31.01.06 * +//* 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 + //init of AVR ports //*************PORTB*************// - //PORTB.0 -> OUT TXON - //PORTB.1 -> OUT nOLE - //PORTB.2 -> OUT LED - //PORTB.3 -> NOT USED, PULLED UP - //PORTB.4 -> NOT USED, PULLED UP - //PORTB.5 -> NOT USED, PULLED UP - //PORTB.6 -> XTAL1 - //PORTB.7 -> XTAL2 (output to RF - Chip) - output(PORTB,0x38); - output(DDRB,0x07); + //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 -> NOT USED, PULLED UP - //PORTC.1 -> OUT Enable - //PORTC.2 -> NOT USED, PULLED UP - //PORTC.3 -> NOT USED, PULLED UP - //PORTC.4 -> NOT USED, PULLED UP - //PORTC.5 -> NOT USED, PULLED UP - //PORTC.6 -> DEBUG - PIN - output(PORTC,0x3D); - output(DDRC,0x02); + //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 -> NOT USED, PULLED UP - //PORTD.4 -> I/O CLK_REC/Clock - //PORTD.5 -> OUT RXON - //PORTD.6 -> NOT USED, PULLED UP - //PORTD.7 -> NOT USED, PULLED UP - output(PORTD,0xC8); - output(DDRD,0x26); + //*************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); + output(UBRR0L,0x05); //***********init-needed-peripherals***************// +$ + SPCR=0x40; // Slave + SPSR=0x00; + // Clear the SPI interrupt flag + 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)) + );$ } + + //***************************************************************************** //* Project: RF-Firmware for ISM * //* Function: init_varis * @@ -109,99 +78,82 @@ //* Action: init of the global variables * //* Duration: tbd * //* Size: tbd * -//* Date: 31.01.06 * +//* Date: 10.07.06 * //* Description: global variables are init with their default values * //***************************************************************************** void init_varis(void) { - uc_8 i; + uc_8 i; - i = input(SPL); - i ^= 0xFF; - extern ui_16 __bss_start; - extern ui_16 __stack; - uc_8 *ptr = (uc_8*)&__bss_start; - while(ptr<(uc_8*)&__stack - i){/*sub because of returning of subroutine*/ - *ptr++=0; - } - //***************************************************************************** - // 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; - rf_buffer_tx[3] = rf_buffer_tx[4] = rf_buffer_tx[5] = 0x55; - rf_buffer_tx[6] = rf_buffer_tx[7] = 0xFF; - //Default setup of the rf_buffer_tx// - sof_ary[1] = 0x36; - sof_ary[2] = 0x36; - sof_ary[3] = 0x36; - 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 ui_16 __bss_start; + extern ui_16 __stack; + uc_8 *ptr = (uc_8*)&__bss_start; + while(ptr<(uc_8*)&__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 - //generate dummy packet - rf_buffer_tx[12]=52;//22; - rf_buffer_tx[13]=0xCB; - rf_buffer_tx[14]=0xCB; - rf_buffer_tx[15]=0x55; - rf_buffer_tx[16]=0x55; - rf_buffer_tx[17]=0xCC; - rf_buffer_tx[18]=0xCC; - rf_buffer_tx[19]=0xDE; - rf_buffer_tx[20]=0xAD; - rf_buffer_tx[21]=0xDE; - rf_buffer_tx[22]=0xAD; - rf_buffer_tx[23]=0xCB; - rf_buffer_tx[24]=0xCB; - rf_buffer_tx[25]=0x55; - rf_buffer_tx[26]=0x55; - rf_buffer_tx[27]=0xCC; - rf_buffer_tx[28]=0xCC; - rf_buffer_tx[29]=0xDE; - rf_buffer_tx[30]=0xAD; - rf_buffer_tx[31]=0xDE; - rf_buffer_tx[32]=0xAD; - 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]=52;//[33]=22 + 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 } +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 2007-06-26 13:41:18 UTC (rev 455) +++ firmware/fuxrf/trunk/init.h 2007-06-26 14:12:36 UTC (rev 456) @@ -1,46 +1,3 @@ -//***************************************************************************** -//* Project: RF-Firmware Point to Multipoint for ISM - Transceiver ATR2406 * -//* Version: ... [truncated message content] |
From: jaguarondi <c2m...@c2...> - 2007-06-26 13:41:21
|
Author: jaguarondi Date: 2007-06-26 15:41:18 +0200 (Tue, 26 Jun 2007) New Revision: 455 Modified: firmware/tuxaudio/trunk/spi.c firmware/tuxaudio/trunk/varis.c firmware/tuxaudio/trunk/varis.h Log: * Changed the acknowledge of the status sent by spi so that it's compatible with the new RF firmware (Modification from Pascal.) Modified: firmware/tuxaudio/trunk/spi.c =================================================================== --- firmware/tuxaudio/trunk/spi.c 2007-06-26 09:30:43 UTC (rev 454) +++ firmware/tuxaudio/trunk/spi.c 2007-06-26 13:41:18 UTC (rev 455) @@ -57,17 +57,26 @@ 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)) + /* Resend the previous command if nacked */ + if ((rf_data_sent_ack == RF_DATA_SENT_NACKED) && + (unlockCommand)) { - spi_headerb |= 0x08; /* resend the previous status if nacked */ - cli(); - sei(); + spi_headerb |= 0x08; + unlockCommand = 0x00; } - 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 */ + /* Wait the end of transmission */ + else if ((rf_data_sent_ack != RF_DATA_SENT_BUSY) && + (unlockCommand)) + { + /* fetch the next status */ + if (!popStatus(spi_commandTX)) + { + /* indicate that the frame contains status */ + spi_headerb |= 0x08; + rf_data_sent_ack = RF_DATA_SENT_BUSY; + unlockCommand = 0x00; + } + } SPDR = spi_headerb; // Header byte spi_slave = GET_SOUND_FIFO; // Next state @@ -155,15 +164,20 @@ 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) + { + if ((spi_commandRX[4] == RF_DATA_SENT_ACKED) || + (spi_commandRX[4] == RF_DATA_SENT_NACKED)) + /* Get acknowledge of previous sent data */ + rf_data_sent_ack = spi_commandRX[4]; + } } + else if ((rf_data_sent_ack == RF_DATA_SENT_ACKED) || + (rf_data_sent_ack == RF_DATA_SENT_NACKED)) + /* Wait radio ready to send the next command */ + unlockCommand = 1; 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 spi_enable = 1; break; Modified: firmware/tuxaudio/trunk/varis.c =================================================================== --- firmware/tuxaudio/trunk/varis.c 2007-06-26 09:30:43 UTC (rev 454) +++ firmware/tuxaudio/trunk/varis.c 2007-06-26 13:41:18 UTC (rev 455) @@ -43,6 +43,7 @@ volatile unsigned char spi_commandRX[5]; unsigned char commandRX = 0; uint8_t rf_data_sent_ack; +uint8_t unlockCommand = 1; // FIFO Variable volatile uint8_t PWMbuffer[128]; Modified: firmware/tuxaudio/trunk/varis.h =================================================================== --- firmware/tuxaudio/trunk/varis.h 2007-06-26 09:30:43 UTC (rev 454) +++ firmware/tuxaudio/trunk/varis.h 2007-06-26 13:41:18 UTC (rev 455) @@ -45,6 +45,7 @@ extern volatile unsigned char spi_commandRX[5]; extern unsigned char commandRX; extern uint8_t rf_data_sent_ack; +extern uint8_t unlockCommand; #define RF_DATA_SENT_FREE 0x00 #define RF_DATA_SENT_BUSY 0x01 |
From: jaguarondi <c2m...@c2...> - 2007-06-26 09:31:12
|
Author: jaguarondi Date: 2007-06-26 11:30:43 +0200 (Tue, 26 Jun 2007) New Revision: 454 Modified: api/python/trunk/tuxapi_class.py Log: * Fixed bug #36 when printing status in the API. Modified: api/python/trunk/tuxapi_class.py =================================================================== --- api/python/trunk/tuxapi_class.py 2007-06-25 18:55:50 UTC (rev 453) +++ api/python/trunk/tuxapi_class.py 2007-06-26 09:30:43 UTC (rev 454) @@ -163,7 +163,7 @@ self.tcp_data_fifo_event.append(tmp_tcp_data) self.tcp_data_fifo_event_mutex.release() if self.print_status: - struct_data = ["%.2x" % ord(datae) for datae in self.tcp_data] + struct_data = ["%.2x" % ord(datae) for datae in tmp_tcp_data] print " ".join(struct_data) time.sleep(0.01) |
From: neimad <c2m...@c2...> - 2007-06-25 18:56:23
|
Author: neimad Date: 2007-06-25 20:55:50 +0200 (Mon, 25 Jun 2007) New Revision: 453 Modified: software/tuxgi/trunk/tuxgi.py Log: * Set xterm_cmd to None by default. Fixes issue #37. Modified: software/tuxgi/trunk/tuxgi.py =================================================================== --- software/tuxgi/trunk/tuxgi.py 2007-06-25 15:32:53 UTC (rev 452) +++ software/tuxgi/trunk/tuxgi.py 2007-06-25 18:55:50 UTC (rev 453) @@ -74,6 +74,7 @@ else: py_cmd = 'python' +xterm_cmd = None for term in terminal_shells: if not os.popen('type %s 2>/dev/null' % term[0]).close(): xterm_cmd = '%s %s %s -i /opt/tuxdroid/api/python/tux.py' \ |
Author: jaguarondi Date: 2007-06-25 17:32:53 +0200 (Mon, 25 Jun 2007) New Revision: 452 Added: firmware/fuxrf/ firmware/fuxrf/branches/ firmware/fuxrf/tags/ firmware/fuxrf/trunk/ firmware/fuxrf/trunk/default/ firmware/fuxrf/trunk/default/Makefile firmware/fuxrf/trunk/defines.h firmware/fuxrf/trunk/device.aps 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 firmware/fuxusb/ firmware/fuxusb/branches/ firmware/fuxusb/tags/ firmware/fuxusb/trunk/ firmware/fuxusb/trunk/bootloading.c firmware/fuxusb/trunk/bootloading.h firmware/fuxusb/trunk/config.h firmware/fuxusb/trunk/global.c firmware/fuxusb/trunk/global.h firmware/fuxusb/trunk/i2c.c firmware/fuxusb/trunk/i2c.h firmware/fuxusb/trunk/lib_board/ firmware/fuxusb/trunk/lib_board/c5131_evab.h firmware/fuxusb/trunk/lib_board/kbd_drv.c firmware/fuxusb/trunk/lib_board/kbd_drv.h firmware/fuxusb/trunk/lib_c/ firmware/fuxusb/trunk/lib_c/stdint.h firmware/fuxusb/trunk/lib_mcu/ firmware/fuxusb/trunk/lib_mcu/5131_drv.h firmware/fuxusb/trunk/lib_mcu/c51_drv.h firmware/fuxusb/trunk/lib_mcu/compiler.h firmware/fuxusb/trunk/lib_mcu/ext_5131.h firmware/fuxusb/trunk/lib_mcu/fa-usb/ firmware/fuxusb/trunk/lib_mcu/fa-usb/fa-usb.html firmware/fuxusb/trunk/lib_mcu/fa-usb/flash_api.bak firmware/fuxusb/trunk/lib_mcu/fa-usb/flash_api.c firmware/fuxusb/trunk/lib_mcu/fa-usb/flash_api.h firmware/fuxusb/trunk/lib_mcu/mcu.h firmware/fuxusb/trunk/lib_mcu/mcu_drv.h firmware/fuxusb/trunk/lib_mcu/reg_5131.h firmware/fuxusb/trunk/lib_mcu/spi/ firmware/fuxusb/trunk/lib_mcu/spi/spi_lib.c firmware/fuxusb/trunk/lib_mcu/spi/spi_lib.h firmware/fuxusb/trunk/lib_mcu/twi/ firmware/fuxusb/trunk/lib_mcu/twi/twi.h firmware/fuxusb/trunk/lib_mcu/uart/ firmware/fuxusb/trunk/lib_mcu/uart/tools/ firmware/fuxusb/trunk/lib_mcu/uart/tools/c51_bdr.c firmware/fuxusb/trunk/lib_mcu/uart/uart_bdr.h firmware/fuxusb/trunk/lib_mcu/uart/uart_lib.c firmware/fuxusb/trunk/lib_mcu/uart/uart_lib.h firmware/fuxusb/trunk/lib_mcu/usb/ firmware/fuxusb/trunk/lib_mcu/usb/uart_usb_lib.c firmware/fuxusb/trunk/lib_mcu/usb/uart_usb_lib.h firmware/fuxusb/trunk/lib_mcu/usb/usb_drv.c firmware/fuxusb/trunk/lib_mcu/usb/usb_drv.h firmware/fuxusb/trunk/main.c firmware/fuxusb/trunk/modules/ firmware/fuxusb/trunk/modules/fifo/ firmware/fuxusb/trunk/modules/fifo/fifo.c firmware/fuxusb/trunk/modules/fifo/fifo.h firmware/fuxusb/trunk/modules/fifo/fifo_mic.c firmware/fuxusb/trunk/modules/fifo/fifo_mic.h firmware/fuxusb/trunk/modules/fifo/fifo_spk.c firmware/fuxusb/trunk/modules/fifo/fifo_spk.h firmware/fuxusb/trunk/modules/fifo_stt/ firmware/fuxusb/trunk/modules/fifo_stt/fifo_stt.bak firmware/fuxusb/trunk/modules/fifo_stt/fifo_stt.c firmware/fuxusb/trunk/modules/fifo_stt/fifo_stt.h firmware/fuxusb/trunk/modules/scheduler/ firmware/fuxusb/trunk/modules/scheduler/scheduler.c firmware/fuxusb/trunk/modules/scheduler/scheduler.h firmware/fuxusb/trunk/modules/spi/ firmware/fuxusb/trunk/modules/spi/spi_task.c firmware/fuxusb/trunk/modules/spi/spi_task.h firmware/fuxusb/trunk/modules/timer_soft/ firmware/fuxusb/trunk/modules/timer_soft/timer_soft.c firmware/fuxusb/trunk/modules/timer_soft/timer_soft.gif firmware/fuxusb/trunk/modules/timer_soft/timer_soft.h firmware/fuxusb/trunk/modules/usb/ firmware/fuxusb/trunk/modules/usb/usb_task.c firmware/fuxusb/trunk/modules/usb/usb_task.h firmware/fuxusb/trunk/modules/usb_enum/ firmware/fuxusb/trunk/modules/usb_enum/USB_ENUM.H firmware/fuxusb/trunk/modules/usb_enum/usb_enum.c firmware/fuxusb/trunk/usb_RFDongle.Opt firmware/fuxusb/trunk/usb_RFDongle.Uv2 firmware/fuxusb/trunk/version.h firmware/tuxrf/ firmware/tuxrf/branches/ firmware/tuxrf/tags/ firmware/tuxrf/trunk/ firmware/tuxrf/trunk/default/ firmware/tuxrf/trunk/default/Makefile firmware/tuxrf/trunk/defines.h firmware/tuxrf/trunk/device.aps firmware/tuxrf/trunk/device.c firmware/tuxrf/trunk/init.c firmware/tuxrf/trunk/init.h firmware/tuxrf/trunk/misc.c firmware/tuxrf/trunk/misc.h firmware/tuxrf/trunk/prot.c firmware/tuxrf/trunk/prot.h firmware/tuxrf/trunk/rf_ctrl.c firmware/tuxrf/trunk/rf_ctrl.h firmware/tuxrf/trunk/varis.c firmware/tuxrf/trunk/varis.h Log: * Added current firmware of the USB dongle * Added initial projects given from Atmel for the RF modules Added: firmware/fuxrf/trunk/default/Makefile =================================================================== --- firmware/fuxrf/trunk/default/Makefile (rev 0) +++ firmware/fuxrf/trunk/default/Makefile 2007-06-25 15:32:53 UTC (rev 452) @@ -0,0 +1,85 @@ +############################################################################### +# Makefile for the project device +############################################################################### + +## General Flags +PROJECT = device +MCU = atmega48 +TARGET = device.elf +CC = avr-gcc + +## Options common to compile, link and assembly rules +COMMON = -mmcu=$(MCU) + +## Compile options common for all C compilation units. +CFLAGS = $(COMMON) +CFLAGS += -Wall -gdwarf-2 -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums +CFLAGS += -Wp,-M,-MP,-MT,$(*F).o,-MF,dep/$(@F).d + +## Assembly specific flags +ASMFLAGS = $(COMMON) +ASMFLAGS += -x assembler-with-cpp -Wa,-gdwarf2 + +## Linker flags +LDFLAGS = $(COMMON) +LDFLAGS += +LDFLAGS += -Wl,-section-start=.buffer_rx=0x800100 +LDFLAGS += -Wl,-section-start=.buffer_tx=0x800140 +LDFLAGS += -Wl,-section-start=.sof=0x800180 +LDFLAGS += -Wl,-section-start=.globals=0x800185 + + +## 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 + +## Build +all: $(TARGET) device.hex device.eep + +## 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 $< + +##Link +$(TARGET): $(OBJECTS) + $(CC) $(LDFLAGS) $(OBJECTS) $(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 $< > $@ + +## Clean target +.PHONY: clean +clean: + -rm -rf $(OBJECTS) device.elf dep/ device.hex device.eep + +## Other dependencies +-include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*) + Property changes on: firmware/fuxrf/trunk/default/Makefile ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Name: svn:eol-style + native Added: firmware/fuxrf/trunk/defines.h =================================================================== --- firmware/fuxrf/trunk/defines.h (rev 0) +++ firmware/fuxrf/trunk/defines.h 2007-06-25 15:32:53 UTC (rev 452) @@ -0,0 +1,231 @@ +//***************************************************************************** +//* 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 <io.h> +#include <ina90.h> +#include <avr/signal.h> +#include <interrupt.h> +#include <pgmspace.h> +#include <eeprom.h> + +//**Define the used HOPPING SCHEME**// +//#define HOPPING +#define NOHOPP +#define TRX_CHANNEL 0 +//#define CYCHOPP +//**Define the used HOPPING SCHEME**// + +//include defines for target MCU +//own firmware definitions +#define uc_8 unsigned char +#define ui_16 unsigned int +#define sc_8 char +#define si_16 int + +#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 +#define GET_LABEL_ADDRESS(addr) \ +{ \ + __asm__ __volatile__ ( \ + " \n" \ + : :"z" (addr) ); \ +} + +#define _SLEEP __asm__ __volatile__ ("sleep") +#define _RETI __asm__ __volatile__ ("reti") +#define _NIX __asm__ __volatile__ ("nop") +#define _MY_IJMP __asm__ __volatile__ ("ijmp") +#define _SEI __asm__ __volatile__ ("sei") +#define _CLI __asm__ __volatile__ ("cli") +#define __FLASH__ __attribute__((__progmem__)) +#define _READ_FB __LPM +#define __EEPROM__ __attribute__((section(".eeprom"))) +#define SIGNAL_NAKED(signame)\ +void signame (void) __attribute__ ((signal)) __attribute__ ((naked));\ +void signame (void) +//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-Specifc-Defines<-----// +#define CH00TX 0x1B +#define CH00RX 0x1C +//----->RF-Specifc-Defines<-----// + + //T_SLOT == 1ms ==> every 1000us 48Bytes of payload are exchanged + #define POLL_LOOPS 2 + #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 1065 - 31 //(1065 - 31) == 616.32us(616.09) [31 == calc time!!(17.94us)] + #define T_SYNC 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 + Property changes on: firmware/fuxrf/trunk/defines.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Name: svn:eol-style + native Added: firmware/fuxrf/trunk/device.aps =================================================================== --- firmware/fuxrf/trunk/device.aps (rev 0) +++ firmware/fuxrf/trunk/device.aps 2007-06-25 15:32:53 UTC (rev 452) @@ -0,0 +1 @@ +<AVRStudio><MANAGEMENT><ProjectName>device</ProjectName><Created>10-Nov-2005 15:17:29</Created><LastEdit>10-Jul-2006 08:52:53</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>D:\ATR2406\Firmware\dragonfly\Ineltek_Demo\gcc_template_48\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET>JTAGICE mkII</CURRENT_TARGET><CURRENT_PART>ATmega48</CURRENT_PART><BREAKPOINTS></BREAKPOINTS><IO_EXPAND><Item>51</Item><Item>52</Item><Item>34</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>0</WATCHNUM><WATCHNAMES><Pane0><Variables>ts</Variables><Variables>i</Variables><Variables>rf_rx_state</Variables><Variables>checksum</Variables><Variables>protocol_flags</Variables></Pane0><Pane1></Pane1><Pane2></Pane2><Pane3></Pane3></WATCHNAMES><BreakOnTrcaeFull>0</BreakOnTrcaeFull></DEBUG_TARGET><Debugger><modules><module></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><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></FILES><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>NO</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE></EXTERNALMAKEFILE><PART>atmega48</PART><HEX>1</HEX><LIST>0</LIST><MAP>0</MAP><OUTPUTFILENAME>device.elf</OUTPUTFILENAME><OUTPUTDIR>default\</OUTPUTDIR><ISDIRTY>1</ISDIRTY><OPTIONS/><INCDIRS/><LIBDIRS/><LIBS/><OPTIONSFORALL>-Wall -gdwarf-2 -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums</OPTIONSFORALL><LINKEROPTIONS></LINKEROPTIONS><SEGMENTS><SEGMENT><NAME>.buffer_rx</NAME><SEGMENT>SRAM</SEGMENT><ADDRESS>0x100</ADDRESS></SEGMENT><SEGMENT><NAME>.buffer_tx</NAME><SEGMENT>SRAM</SEGMENT><ADDRESS>0x140</ADDRESS></SEGMENT><SEGMENT><NAME>.sof</NAME><SEGMENT>SRAM</SEGMENT><ADDRESS>0x180</ADDRESS></SEGMENT><SEGMENT><NAME>.globals</NAME><SEGMENT>SRAM</SEGMENT><ADDRESS>0x185</ADDRESS></SEGMENT></SEGMENTS></CONFIG></CONFIGS><LASTCONFIG>default</LASTCONFIG><USES_WINAVR>1</USES_WINAVR><GCC_LOC>D:\gcc_avr\WinAVR\bin</GCC_LOC><MAKE_LOC>D:\gcc_avr\WinAVR\utils\bin</MAKE_LOC></AVRGCCPLUGIN><Files><File00000><FileId>00000</FileId><FileName>device.c</FileName><Status>259</Status></File00000><File00001><FileId>00001</FileId><FileName>varis.c</FileName><Status>257</Status></File00001><File00002><FileId>00002</FileId><FileName>prot.c</FileName><Status>259</Status></File00002><File00003><FileId>00003</FileId><FileName>rf_ctrl.c</FileName><Status>259</Status></File00003><File00004><FileId>00004</FileId><FileName>init.c</FileName><Status>259</Status></File00004><File00005><FileId>00005</FileId><FileName>prot.h</FileName><Status>1</Status></File00005><File00006><FileId>00006</FileId><FileName>defines.h</FileName><Status>1</Status></File00006></Files><Workspace><File00000><Position>402 72 1042 686</Position><LineCol>75 0</LineCol><State>Maximized</State></File00000><File00001><Position>454 66 1432 709</Position><LineCol>0 0</LineCol></File00001><File00002><Position>464 135 1255 596</Position><LineCol>0 0</LineCol></File00002><File00003><Position>486 157 1145 594</Position><LineCol>0 0</LineCol></File00003><File00004><Position>508 179 971 616</Position><LineCol>0 0</LineCol></File00004><File00005><Position>530 201 993 638</Position><LineCol>0 0</LineCol></File00005><File00006><Position>581 225 1273 684</Position><LineCol>0 0</LineCol></File00006></Workspace><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio> Added: firmware/fuxrf/trunk/device.c =================================================================== --- firmware/fuxrf/trunk/device.c (rev 0) +++ firmware/fuxrf/trunk/device.c 2007-06-25 15:32:53 UTC (rev 452) @@ -0,0 +1,96 @@ +//***************************************************************************** +//* 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 "misc.h" +#include "varis.h" +#include "prot.h" +#include "rf_ctrl.h" + + +//***************************************************************************** +//* 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) +{ + + init_avr(); + init_varis(); + + _SEI; + system_start_up(); + + + + + + for(;;){ + + } + +} + + + + Property changes on: firmware/fuxrf/trunk/device.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Name: svn:eol-style + native Added: firmware/fuxrf/trunk/init.c =================================================================== --- firmware/fuxrf/trunk/init.c (rev 0) +++ firmware/fuxrf/trunk/init.c 2007-06-25 15:32:53 UTC (rev 452) @@ -0,0 +1,207 @@ +//***************************************************************************** +//* 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 -> OUT LED + //PORTB.3 -> NOT USED, PULLED UP + //PORTB.4 -> NOT USED, PULLED UP + //PORTB.5 -> NOT USED, PULLED UP + //PORTB.6 -> XTAL1 + //PORTB.7 -> XTAL2 (output to RF - Chip) + output(PORTB,0x38); + output(DDRB,0x07); + //*************PORTB*************// + //*************PORTC*************// + //PORTC.0 -> NOT USED, PULLED UP + //PORTC.1 -> OUT Enable + //PORTC.2 -> NOT USED, PULLED UP + //PORTC.3 -> NOT USED, PULLED UP + //PORTC.4 -> NOT USED, PULLED UP + //PORTC.5 -> NOT USED, PULLED UP + //PORTC.6 -> DEBUG - PIN + output(PORTC,0x3D); + output(DDRC,0x02); + //*************PORTC*************// + //*************PORTD*************// + //PORTD.0 -> IN RX_DATA + //PORTD.1 -> OUT TX_DATA/Data + //PORTD.2 -> OUT PU_TRX/PU_REG + //PORTD.3 -> NOT USED, PULLED UP + //PORTD.4 -> I/O CLK_REC/Clock + //PORTD.5 -> OUT RXON + //PORTD.6 -> NOT USED, PULLED UP + //PORTD.7 -> NOT USED, PULLED UP + output(PORTD,0xC8); + output(DDRD,0x26); + //*************PORTD*************// + //***********init-needed-peripherals***************// + output(UBRR0L,0x05); + //***********init-needed-peripherals***************// +} +//***************************************************************************** +//* 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) +{ + uc_8 i; + + i = input(SPL); + i ^= 0xFF; + extern ui_16 __bss_start; + extern ui_16 __stack; + uc_8 *ptr = (uc_8*)&__bss_start; + while(ptr<(uc_8*)&__stack - i){/*sub because of returning of subroutine*/ + *ptr++=0; + } + //***************************************************************************** + // 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; + rf_buffer_tx[3] = rf_buffer_tx[4] = rf_buffer_tx[5] = 0x55; + rf_buffer_tx[6] = rf_buffer_tx[7] = 0xFF; + //Default setup of the rf_buffer_tx// + sof_ary[1] = 0x36; + sof_ary[2] = 0x36; + sof_ary[3] = 0x36; + 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;//22; + rf_buffer_tx[13]=0xCB; + rf_buffer_tx[14]=0xCB; + rf_buffer_tx[15]=0x55; + rf_buffer_tx[16]=0x55; + rf_buffer_tx[17]=0xCC; + rf_buffer_tx[18]=0xCC; + rf_buffer_tx[19]=0xDE; + rf_buffer_tx[20]=0xAD; + rf_buffer_tx[21]=0xDE; + rf_buffer_tx[22]=0xAD; + rf_buffer_tx[23]=0xCB; + rf_buffer_tx[24]=0xCB; + rf_buffer_tx[25]=0x55; + rf_buffer_tx[26]=0x55; + rf_buffer_tx[27]=0xCC; + rf_buffer_tx[28]=0xCC; + rf_buffer_tx[29]=0xDE; + rf_buffer_tx[30]=0xAD; + rf_buffer_tx[31]=0xDE; + rf_buffer_tx[32]=0xAD; + 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]=52;//[33]=22 +} + + Property changes on: firmware/fuxrf/trunk/init.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Name: svn:eol-style + native Added: firmware/fuxrf/trunk/init.h =================================================================== --- firmware/fuxrf/trunk/init.h (rev 0) +++ firmware/fuxrf/trunk/init.h 2007-06-25 15:32:53 UTC (rev 452) @@ -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. * +//***************************************************************************** +#ifndef INIT_H +#define INIT_H + + + +#include "defines.h" + +extern void init_avr(void); +extern void init_varis(void); +extern void init_led_pwm(void); + +#endif Property changes on: firmware/fuxrf/trunk/init.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Name: svn:eol-style + native Added: firmware/fuxrf/trunk/misc.c =================================================================== --- firmware/fuxrf/trunk/misc.c (rev 0) +++ firmware/fuxrf/trunk/misc.c 2007-06-25 15:32:53 UTC (rev 452) @@ -0,0 +1,137 @@ +//***************************************************************************** +//* Project: RF-Firmware Point to Multipoint for ISM - Transceiver ATR2406 * +//* Version: V1.0 * +//* File: misc.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" +#include "rf_ctrl.h" + + + +//***************************************************************************** +//* Project: RF-Firmware for ISM * +//* Function: wait_n_10us * +//* Parameters: val * +//* Returns: NONE * +//* Action: wait n * 10us * +//* Duration: tbd * +//* Size: tbd * +//* Date: 31.01.06 * +//* Description: Generates a delay. T(delay) = val * 10us * +//***************************************************************************** +void wait_n_10us(uc_8 val) +{ + uc_8 i,j; + i = val; + for(i=0;i<val;i++){ + for(j=0;j<16;j++){ + _NIX; + _NIX; + _NIX; + _NIX; + } + } +} +//***************************************************************************** +//* Project: RF-Firmware for ISM * +//* Function: get_random * +//* Parameters: NONE * +//* Returns: NONE * +//* Action: get a random value by sampling the RXD pin of the ATR2406 * +//* Duration: tbd * +//* Size: tbd * +//* Date: 31.01.06 * +//* Description: Random value needed for system setup * +//***************************************************************************** +uc_8 get_random(void) +{ + uc_8 i,random; + //init of the global variable random, this is done by using the noise + //output of the RF-Chip when settlet up for receive without having + //a transmitter, may check if RSSI is low to be sure there is only noise. + //The RX_DATA pin of the ATR2406 is sampled. + pwr_up_atr2406(); + set_rxon; + for(i=0;i<0xFF;i++){ + random = 0x00; + _NIX; + } + for(i=0;i<0x41;i++){ + if((i&0x07)==0x00){ + random = random << 1; + if((in_rxd)){ + random |= 0x01; + } + } + } + pwr_dwn_atr2406(); + return random; +} +//***************************************************************************** +//* Project: RF-Firmware for ISM * +//* Function: calc_checksum * +//* Parameters: val * +//* Returns: NONE * +//* Action: calc_checksum * +//* Duration: tbd * +//* Size: tbd * +//* Date: 31.01.06 * +//* Description: Calculate the checksum of a RF - Packet * +//***************************************************************************** +void calc_checksum(void) +{ + uc_8 i,tmp; + uc_8 *ptr; + ptr = (uc_8 *)&rf_buffer_tx[12]; + tmp = 0x00; + for(i=rf_buffer_tx[12];i>0x01;i--){ + tmp ^= *ptr++; + } + *ptr = tmp; +} + + + + Property changes on: firmware/fuxrf/trunk/misc.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Name: svn:eol-style + native Added: firmware/fuxrf/trunk/misc.h =================================================================== --- firmware/fuxrf/trunk/misc.h (rev 0) +++ firmware/fuxrf/trunk/misc.h 2007-06-25 15:32:53 UTC (rev 452) @@ -0,0 +1,58 @@ +//***************************************************************************** +//* Project: RF-Firmware Point to Multipoint for ISM - Transceiver ATR2406 * +//* Version: V1.0 * +//* File: misc.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 MISC_H +#define MISC_H + + + +#include "defines.h" + + +extern void wait_n_10us(uc_8 val); +extern uc_8 get_random(void); +extern void calc_checksum(void); + + + +#endif Property changes on: firmware/fuxrf/trunk/misc.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Name: svn:eol-style + native Added: firmware/fuxrf/trunk/prot.c =================================================================== --- firmware/fuxrf/trunk/prot.c (rev 0) +++ firmware/fuxrf/trunk/prot.c 2007-06-25 15:32:53 UTC (rev 452) @@ -0,0 +1,125 @@ +//***************************************************************************** +//* Project: RF-Firmware Point to Multipoint for ISM - Transceiver ATR2406 * +//* Version: V1.0 * +//* File: prot.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 "misc.h" +#include "varis.h" +#include "prot.h" +#include "rf_ctrl.h" + +//***************************************************************************** +//* Project: RF-Firmware for ISM * +//* Function: get_link * +//* Parameters: NONE * +//* Returns: NONE * +//* Action: connect to a base station, if possible * +//* Duration: tbd * +//* Size: tbd * +//* Date: 31.01.06 * +//* Description: Synchronise to the Basestation and get logged into the system* +//*****************************************************... [truncated message content] |
From: neimad <c2m...@c2...> - 2007-06-24 17:36:35
|
Author: neimad Date: 2007-06-24 19:36:34 +0200 (Sun, 24 Jun 2007) New Revision: 451 Modified: daemon/trunk/libs/USBDaemon_status_table.h Log: * Fixed comments: 80-column rule. Modified: daemon/trunk/libs/USBDaemon_status_table.h =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.h 2007-06-24 17:34:08 UTC (rev 450) +++ daemon/trunk/libs/USBDaemon_status_table.h 2007-06-24 17:36:34 UTC (rev 451) @@ -257,10 +257,19 @@ extern author_t hw_author[4]; extern unsigned char sound_flash_count; -struct connection_status_t { - bool usb_request_f; /** usb request flag set when a USB command is issued and reset when the answer has been received in the status; only used for functions that should get an answer */ - uint16_t tux_id; /** id of the tux which is currently connected or was last connected */ - uint8_t wifi_channel; /** wifi channel that the RF modules will avoid; set to 0 to disable this function */ +struct connection_status_t +{ + /** USB request flag set when a USB command is issued and reset + when the answer has been received in the status; only used for + functions that should get an answer */ + bool usb_request_f; + + /** Id of the tux which is currently connected or was last connected */ + uint16_t tux_id; + + /** Wifi channel that the RF modules will avoid; set to 0 to + disable this function */ + uint8_t wifi_channel; }; extern struct connection_status_t connection_status; |
From: neimad <c2m...@c2...> - 2007-06-24 17:34:10
|
Author: neimad Date: 2007-06-24 19:34:08 +0200 (Sun, 24 Jun 2007) New Revision: 450 Modified: daemon/trunk/libs/USBDaemon_status_table.h Log: * Fixed indentation of file's top comment. Modified: daemon/trunk/libs/USBDaemon_status_table.h =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.h 2007-06-24 17:25:46 UTC (rev 449) +++ daemon/trunk/libs/USBDaemon_status_table.h 2007-06-24 17:34:08 UTC (rev 450) @@ -1,23 +1,22 @@ - /* -* Tux Droid - USB Daemon -* Copyright (C) 2007 C2ME Sa <rem...@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, 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. -*/ + * Tux Droid - USB Daemon + * Copyright (C) 2007 C2ME Sa <rem...@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, 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$ */ |
From: neimad <c2m...@c2...> - 2007-06-24 17:25:53
|
Author: neimad Date: 2007-06-24 19:25:46 +0200 (Sun, 24 Jun 2007) New Revision: 449 Modified: daemon/trunk/libs/USBDaemon_command_tux.c daemon/trunk/libs/USBDaemon_status_table.c daemon/trunk/libs/USBDaemon_status_table.h Log: * Variable current_audio_channel was only used in USBDaemon_command_tux.c. Removed its definition from USBDaemon_status_table.[ch]. Modified: daemon/trunk/libs/USBDaemon_command_tux.c =================================================================== --- daemon/trunk/libs/USBDaemon_command_tux.c 2007-06-24 17:23:09 UTC (rev 448) +++ daemon/trunk/libs/USBDaemon_command_tux.c 2007-06-24 17:25:46 UTC (rev 449) @@ -39,6 +39,8 @@ uint8_t b[2]; } union_uint16_t; +static unsigned char current_audio_channel = 0; + /*_____________________ F U N C T I O N S __________________________________*/ static void tux_connection(unsigned char const data[], unsigned char result[]); Modified: daemon/trunk/libs/USBDaemon_status_table.c =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.c 2007-06-24 17:23:09 UTC (rev 448) +++ daemon/trunk/libs/USBDaemon_status_table.c 2007-06-24 17:25:46 UTC (rev 449) @@ -47,7 +47,6 @@ static unsigned char last_remote_key = 0xFF; static unsigned char last_toggle_key = 0xFF; unsigned char sound_flash_count = 0; -unsigned char current_audio_channel = 0; /** * \brief Status table and settings of the dongle and RF modules Modified: daemon/trunk/libs/USBDaemon_status_table.h =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.h 2007-06-24 17:23:09 UTC (rev 448) +++ daemon/trunk/libs/USBDaemon_status_table.h 2007-06-24 17:25:46 UTC (rev 449) @@ -257,7 +257,6 @@ extern revision_t hw_revision[4]; extern author_t hw_author[4]; extern unsigned char sound_flash_count; -extern unsigned char current_audio_channel; struct connection_status_t { bool usb_request_f; /** usb request flag set when a USB command is issued and reset when the answer has been received in the status; only used for functions that should get an answer */ |
From: neimad <c2m...@c2...> - 2007-06-24 17:23:13
|
Author: neimad Date: 2007-06-24 19:23:09 +0200 (Sun, 24 Jun 2007) New Revision: 448 Modified: daemon/trunk/libs/USBDaemon_status_table.c Log: * Made a few global variables static. Modified: daemon/trunk/libs/USBDaemon_status_table.c =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.c 2007-06-24 17:11:52 UTC (rev 447) +++ daemon/trunk/libs/USBDaemon_status_table.c 2007-06-24 17:23:09 UTC (rev 448) @@ -35,18 +35,17 @@ _PORT_BYTE_ portd; _PORT_BYTE_ sensors1; _PORT_BYTE_ position2; -unsigned char DONGLE_status = 0; +static unsigned char DONGLE_status = 0; unsigned char RF_status = 0; unsigned char CMD_status = 0; unsigned char pong_received; unsigned char cmd_status_flag; -unsigned char pong_received; version_t hw_version[4]; revision_t hw_revision[4]; author_t hw_author[4]; -unsigned char last_cpu_ver; -unsigned char last_remote_key = 0xFF; -unsigned char last_toggle_key = 0xFF; +static unsigned char last_cpu_ver; +static unsigned char last_remote_key = 0xFF; +static unsigned char last_toggle_key = 0xFF; unsigned char sound_flash_count = 0; unsigned char current_audio_channel = 0; |
From: neimad <c2m...@c2...> - 2007-06-24 17:11:59
|
Author: neimad Date: 2007-06-24 19:11:52 +0200 (Sun, 24 Jun 2007) New Revision: 447 Modified: daemon/trunk/libs/USBDaemon_status_table.c Log: * Fixed indentation of file's top comment. Modified: daemon/trunk/libs/USBDaemon_status_table.c =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.c 2007-06-24 17:10:50 UTC (rev 446) +++ daemon/trunk/libs/USBDaemon_status_table.c 2007-06-24 17:11:52 UTC (rev 447) @@ -1,23 +1,22 @@ - /* -* Tux Droid - USB Daemon -* Copyright (C) 2007 C2ME Sa <rem...@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, 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. -*/ + * Tux Droid - USB Daemon + * Copyright (C) 2007 C2ME Sa <rem...@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, 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$ */ |
From: neimad <c2m...@c2...> - 2007-06-24 17:10:52
|
Author: neimad Date: 2007-06-24 19:10:50 +0200 (Sun, 24 Jun 2007) New Revision: 446 Modified: daemon/trunk/libs/USBDaemon_status_table.c daemon/trunk/libs/USBDaemon_status_table.h Log: * Made lots of functions static. Modified: daemon/trunk/libs/USBDaemon_status_table.c =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.c 2007-06-24 16:56:22 UTC (rev 445) +++ daemon/trunk/libs/USBDaemon_status_table.c 2007-06-24 17:10:50 UTC (rev 446) @@ -58,130 +58,8 @@ /*_____________________ F U N C T I O N S __________________________________*/ -/************************************************************************ */ - -/* update_raw_status_table() */ - -/************************************************************************ */ -void update_raw_status_table(const unsigned char *new_status) +static void update_version_table(const unsigned char *new_status) { - switch (new_status[0]) - { - case STATUS_ID_CMD: - /* The answer from the usb_tux_connection command has been received */ - connection_status.usb_request_f = false; - connection_status.tux_id = (new_status[1] << 8) + new_status[2]; - log_debug("id retunred by tux: %i (0x%.2x%.2x)", - connection_status.tux_id, new_status[1], new_status[2]); - break; - case STATUS_PORTS_CMD: - if (portb.Byte != new_status[1]) - portb_changed(new_status[1]); - if (portc.Byte != new_status[2]) - portc_changed(new_status[2]); - if (portd.Byte != new_status[3]) - portd_changed(new_status[3]); - break; - - case STATUS_SENSORS1_CMD: - if (sensors1.Byte != new_status[1]) - sensors1_changed(new_status[1]); - break; - - case STATUS_LIGHT_CMD: - if (sensors2.level_light_high.Byte != new_status[1] - || sensors2.level_light_low.Byte != new_status[2]) - sensors2_changed(new_status[1], new_status[2], new_status[3]); - break; - - case STATUS_POSITION1_CMD: - if (position1.eyes_position.Byte != new_status[1] - || position1.mouth_position.Byte != new_status[2] - || position1.wings_position.Byte != new_status[3]) - position1_changed(new_status[1], new_status[2], new_status[3]); - break; - - case STATUS_POSITION2_CMD: - if (position2.Byte != new_status[1]) - position2_changed(new_status[1]); - break; - - case PONG_CMD: - pong_received++; - pong_event(new_status[1], pong_received); - break; - - case VERSION_CMD: - update_version_table(new_status); - break; - - case REVISION_CMD: - update_revision_table(new_status); - break; - - case AUTHOR_CMD: - update_author_table(new_status); - break; - - case SOUND_VAR_CMD: - update_sound_flash_count(new_status); - break; - - case STATUS_IR_CMD: - update_ir(new_status); - break; - - default: - if (show_invalid_raw) - log_debug("%.2x %.2x %.2x %.2x", new_status[0], new_status[1], - new_status[2], new_status[3]); - break; - } -} - -/************************************************************************ */ - -/* update_system_status_table() */ - -/************************************************************************ */ -void update_system_status_table(const unsigned char *new_status) -{ - tcp_frame_t tcp_frame; - - tcp_frame_zero(&tcp_frame); - - tcp_frame[0] = SOURCE_TUX; - tcp_frame[1] = SS_DEFAULT; - tcp_frame[2] = DATA_TP_RSP; - tcp_frame[3] = SUBDATA_TP_STATUS; - - DONGLE_status = new_status[0]; - - /*RF status change */ - if (RF_status != new_status[1]) - { - RF_status = new_status[1]; - tcp_frame[4] = DATA_STATUS_RF_CONNECTED; - tcp_frame[5] = RF_status; - tcp_server_send_raw(tcp_frame); - } - - /* Command status change */ - if (CMD_status != new_status[2]) - { - CMD_status = new_status[2]; - if (CMD_status == ACK_CMD_OK || CMD_status == ACK_CMD_KO) - cmd_status_flag = 0; - } -} - -/************************************************************************ */ - -/* update_version_table() */ - -/************************************************************************ */ -void update_version_table(const unsigned char *new_status) -{ unsigned long tmp; version_t *hw_ver; @@ -192,12 +70,7 @@ hw_version[last_cpu_ver] = *hw_ver; } -/************************************************************************ */ - -/* update_revision_table() */ - -/************************************************************************ */ -void update_revision_table(const unsigned char *new_status) +static void update_revision_table(const unsigned char *new_status) { unsigned long tmp; revision_t *hw_rev; @@ -208,12 +81,7 @@ hw_revision[last_cpu_ver] = *hw_rev; } -/************************************************************************ */ - -/* update_author_table() */ - -/************************************************************************ */ -void update_author_table(const unsigned char *new_status) +static void update_author_table(const unsigned char *new_status) { unsigned long tmp; author_t *hw_aut; @@ -224,22 +92,12 @@ hw_author[last_cpu_ver] = *hw_aut; } -/************************************************************************ */ - -/* update_sound_flash_count() */ - -/************************************************************************ */ -void update_sound_flash_count(const unsigned char *new_status) +static void update_sound_flash_count(const unsigned char *new_status) { sound_flash_count = new_status[1]; } -/************************************************************************ */ - -/* update_ir() */ - -/************************************************************************ */ -void update_ir(const unsigned char *new_status) +static void update_ir(const unsigned char *new_status) { unsigned char code; unsigned char toggle; @@ -288,12 +146,76 @@ } } -/************************************************************************ */ +static void sensors1_changed(unsigned char new_value) +{ + tcp_frame_t tcp_frame; -/* pong_event() */ + tcp_frame_zero(&tcp_frame); -/************************************************************************ */ -void pong_event(unsigned char pong_number, unsigned char pong_received) + tcp_frame[0] = SOURCE_TUX; + tcp_frame[1] = SS_DEFAULT; + tcp_frame[2] = DATA_TP_RSP; + tcp_frame[3] = SUBDATA_TP_STATUS; + + /* Left wing push */ + if ((sensors1.Byte & 0x01) != (new_value & 0x01)) + { + tcp_frame[4] = DATA_STATUS_LEFT_WING_PUSH; + tcp_frame[5] = !sensors1.bits.PB0; + log_debug("Left wing button %s", tcp_frame[5] ? "Down" : "Up"); + tcp_server_send_raw(tcp_frame); + } + + /* Right wing push */ + if ((sensors1.Byte & 0x02) != (new_value & 0x02)) + { + tcp_frame[4] = DATA_STATUS_RIGHT_WING_PUSH; + tcp_frame[5] = !sensors1.bits.PB1; + log_debug("Right wing button %s", tcp_frame[5] ? "Down" : "Up"); + tcp_server_send_raw(tcp_frame); + } + + /* power plug insertion switch */ + if ((sensors1.Byte & 0x04) != (new_value & 0x04)) + { + tcp_frame[4] = DATA_STATUS_POWER_PLUG_SWITCH; + tcp_frame[5] = !sensors1.bits.PB2; + log_debug("power plug insertion switch %s", tcp_frame[5] ? "off" : "on"); + tcp_server_send_raw(tcp_frame); + } + + /* Head push */ + if ((sensors1.Byte & 0x08) != (new_value & 0x08)) + { + tcp_frame[4] = DATA_STATUS_HEAD_PUSH_SWITCH; + tcp_frame[5] = !sensors1.bits.PB3; + log_debug("Head button %s", tcp_frame[5] ? "Down" : "Up"); + tcp_server_send_raw(tcp_frame); + } + + /* Led charger */ + if ((sensors1.Byte & 0x10) != (new_value & 0x10)) + { + tcp_frame[4] = DATA_STATUS_CHARGER_LED_STATUS; + tcp_frame[5] = sensors1.bits.PB4; + log_debug("Charger led %d", tcp_frame[5]); + tcp_server_send_raw(tcp_frame); + } + + /* mute status */ + if ((sensors1.Byte & 0x80) != (new_value & 0x80)) + { + tcp_frame[4] = DATA_STATUS_MUTE_STATUS; + tcp_frame[5] = !sensors1.bits.PB7; + log_debug("mute status %s", tcp_frame[5] ? "on" : "off"); + tcp_server_send_raw(tcp_frame); + } + + sensors1.Byte = new_value; +} + +static void sensors2_changed(unsigned char new_value_high, unsigned char new_value_low, + unsigned char new_light_mode) { tcp_frame_t tcp_frame; @@ -303,6 +225,27 @@ tcp_frame[1] = SS_DEFAULT; tcp_frame[2] = DATA_TP_RSP; tcp_frame[3] = SUBDATA_TP_STATUS; + + tcp_frame[4] = DATA_STATUS_LIGHT_LEVEL; + + sensors2.level_light_high.Byte = new_value_high; + sensors2.level_light_low.Byte = new_value_low; + sensors2.light_mode.Byte = new_light_mode; + + tcp_frame[5] = new_value_high; + tcp_frame[6] = new_value_low; +} + +static void pong_event(unsigned char pong_number, unsigned char pong_received) +{ + tcp_frame_t tcp_frame; + + tcp_frame_zero(&tcp_frame); + + tcp_frame[0] = SOURCE_TUX; + tcp_frame[1] = SS_DEFAULT; + tcp_frame[2] = DATA_TP_RSP; + tcp_frame[3] = SUBDATA_TP_STATUS; tcp_frame[4] = DATA_STATUS_PONG; tcp_frame[5] = pong_number; tcp_frame[6] = pong_received; @@ -310,12 +253,13 @@ tcp_server_send_raw(tcp_frame); } + /************************************************************************ */ /* portb_changed() */ /************************************************************************ */ -void portb_changed(unsigned char new_value) +static void portb_changed(unsigned char new_value) { tcp_frame_t tcp_frame; @@ -388,7 +332,7 @@ /* portc_changed() */ /************************************************************************ */ -void portc_changed(unsigned char new_value) +static void portc_changed(unsigned char new_value) { tcp_frame_t tcp_frame; @@ -435,7 +379,7 @@ /* portd_changed() */ /************************************************************************ */ -void portd_changed(unsigned char new_value) +static void portd_changed(unsigned char new_value) { tcp_frame_t tcp_frame; @@ -513,12 +457,15 @@ portd.Byte = new_value; } + /************************************************************************ */ -/* sensors1_changed() */ +/* position1_changed() */ /************************************************************************ */ -void sensors1_changed(unsigned char new_value) +static void position1_changed(unsigned char eyes_position, + unsigned char mouth_position, + unsigned char wings_position) { tcp_frame_t tcp_frame; @@ -529,70 +476,37 @@ tcp_frame[2] = DATA_TP_RSP; tcp_frame[3] = SUBDATA_TP_STATUS; - /* Left wing push */ - if ((sensors1.Byte & 0x01) != (new_value & 0x01)) + if (position1.eyes_position.Byte != eyes_position) { - tcp_frame[4] = DATA_STATUS_LEFT_WING_PUSH; - tcp_frame[5] = !sensors1.bits.PB0; - log_debug("Left wing button %s", tcp_frame[5] ? "Down" : "Up"); + position1.eyes_position.Byte = eyes_position; + tcp_frame[4] = DATA_STATUS_EYES_POSITION_COUNTER; + tcp_frame[5] = eyes_position; tcp_server_send_raw(tcp_frame); } - /* Right wing push */ - if ((sensors1.Byte & 0x02) != (new_value & 0x02)) + if (position1.mouth_position.Byte != mouth_position) { - tcp_frame[4] = DATA_STATUS_RIGHT_WING_PUSH; - tcp_frame[5] = !sensors1.bits.PB1; - log_debug("Right wing button %s", tcp_frame[5] ? "Down" : "Up"); + position1.mouth_position.Byte = mouth_position; + tcp_frame[4] = DATA_STATUS_MOUTH_POSITION_COUNTER; + tcp_frame[5] = mouth_position; tcp_server_send_raw(tcp_frame); } - /* power plug insertion switch */ - if ((sensors1.Byte & 0x04) != (new_value & 0x04)) + if (position1.wings_position.Byte != wings_position) { - tcp_frame[4] = DATA_STATUS_POWER_PLUG_SWITCH; - tcp_frame[5] = !sensors1.bits.PB2; - log_debug("power plug insertion switch %s", tcp_frame[5] ? "off" : "on"); + position1.wings_position.Byte = wings_position; + tcp_frame[4] = DATA_STATUS_WINGS_POSITION_COUNTER; + tcp_frame[5] = wings_position; tcp_server_send_raw(tcp_frame); } - - /* Head push */ - if ((sensors1.Byte & 0x08) != (new_value & 0x08)) - { - tcp_frame[4] = DATA_STATUS_HEAD_PUSH_SWITCH; - tcp_frame[5] = !sensors1.bits.PB3; - log_debug("Head button %s", tcp_frame[5] ? "Down" : "Up"); - tcp_server_send_raw(tcp_frame); - } - - /* Led charger */ - if ((sensors1.Byte & 0x10) != (new_value & 0x10)) - { - tcp_frame[4] = DATA_STATUS_CHARGER_LED_STATUS; - tcp_frame[5] = sensors1.bits.PB4; - log_debug("Charger led %d", tcp_frame[5]); - tcp_server_send_raw(tcp_frame); - } - - /* mute status */ - if ((sensors1.Byte & 0x80) != (new_value & 0x80)) - { - tcp_frame[4] = DATA_STATUS_MUTE_STATUS; - tcp_frame[5] = !sensors1.bits.PB7; - log_debug("mute status %s", tcp_frame[5] ? "on" : "off"); - tcp_server_send_raw(tcp_frame); - } - - sensors1.Byte = new_value; } /************************************************************************ */ -/* sensors2_changed() */ +/* position2_changed() */ /************************************************************************ */ -void sensors2_changed(unsigned char new_value_high, unsigned char new_value_low, - unsigned char new_light_mode) +static void position2_changed(unsigned char spin_position) { tcp_frame_t tcp_frame; @@ -603,65 +517,100 @@ tcp_frame[2] = DATA_TP_RSP; tcp_frame[3] = SUBDATA_TP_STATUS; - tcp_frame[4] = DATA_STATUS_LIGHT_LEVEL; + tcp_frame[4] = DATA_STATUS_SPIN_POSITION_COUNTER; + position2.Byte = spin_position; + tcp_frame[5] = spin_position; - sensors2.level_light_high.Byte = new_value_high; - sensors2.level_light_low.Byte = new_value_low; - sensors2.light_mode.Byte = new_light_mode; - - tcp_frame[5] = new_value_high; - tcp_frame[6] = new_value_low; + tcp_server_send_raw(tcp_frame); } /************************************************************************ */ -/* position1_changed() */ +/* update_raw_status_table() */ /************************************************************************ */ -void position1_changed(unsigned char eyes_position, - unsigned char mouth_position, - unsigned char wings_position) +void update_raw_status_table(const unsigned char *new_status) { - tcp_frame_t tcp_frame; + switch (new_status[0]) + { + case STATUS_ID_CMD: + /* The answer from the usb_tux_connection command has been received */ + connection_status.usb_request_f = false; + connection_status.tux_id = (new_status[1] << 8) + new_status[2]; + log_debug("id retunred by tux: %i (0x%.2x%.2x)", + connection_status.tux_id, new_status[1], new_status[2]); + break; + case STATUS_PORTS_CMD: + if (portb.Byte != new_status[1]) + portb_changed(new_status[1]); + if (portc.Byte != new_status[2]) + portc_changed(new_status[2]); + if (portd.Byte != new_status[3]) + portd_changed(new_status[3]); + break; - tcp_frame_zero(&tcp_frame); + case STATUS_SENSORS1_CMD: + if (sensors1.Byte != new_status[1]) + sensors1_changed(new_status[1]); + break; - tcp_frame[0] = SOURCE_TUX; - tcp_frame[1] = SS_DEFAULT; - tcp_frame[2] = DATA_TP_RSP; - tcp_frame[3] = SUBDATA_TP_STATUS; + case STATUS_LIGHT_CMD: + if (sensors2.level_light_high.Byte != new_status[1] + || sensors2.level_light_low.Byte != new_status[2]) + sensors2_changed(new_status[1], new_status[2], new_status[3]); + break; - if (position1.eyes_position.Byte != eyes_position) - { - position1.eyes_position.Byte = eyes_position; - tcp_frame[4] = DATA_STATUS_EYES_POSITION_COUNTER; - tcp_frame[5] = eyes_position; - tcp_server_send_raw(tcp_frame); - } + case STATUS_POSITION1_CMD: + if (position1.eyes_position.Byte != new_status[1] + || position1.mouth_position.Byte != new_status[2] + || position1.wings_position.Byte != new_status[3]) + position1_changed(new_status[1], new_status[2], new_status[3]); + break; - if (position1.mouth_position.Byte != mouth_position) - { - position1.mouth_position.Byte = mouth_position; - tcp_frame[4] = DATA_STATUS_MOUTH_POSITION_COUNTER; - tcp_frame[5] = mouth_position; - tcp_server_send_raw(tcp_frame); - } + case STATUS_POSITION2_CMD: + if (position2.Byte != new_status[1]) + position2_changed(new_status[1]); + break; - if (position1.wings_position.Byte != wings_position) - { - position1.wings_position.Byte = wings_position; - tcp_frame[4] = DATA_STATUS_WINGS_POSITION_COUNTER; - tcp_frame[5] = wings_position; - tcp_server_send_raw(tcp_frame); + case PONG_CMD: + pong_received++; + pong_event(new_status[1], pong_received); + break; + + case VERSION_CMD: + update_version_table(new_status); + break; + + case REVISION_CMD: + update_revision_table(new_status); + break; + + case AUTHOR_CMD: + update_author_table(new_status); + break; + + case SOUND_VAR_CMD: + update_sound_flash_count(new_status); + break; + + case STATUS_IR_CMD: + update_ir(new_status); + break; + + default: + if (show_invalid_raw) + log_debug("%.2x %.2x %.2x %.2x", new_status[0], new_status[1], + new_status[2], new_status[3]); + break; } } /************************************************************************ */ -/* position2_changed() */ +/* update_system_status_table() */ /************************************************************************ */ -void position2_changed(unsigned char spin_position) +void update_system_status_table(const unsigned char *new_status) { tcp_frame_t tcp_frame; @@ -672,9 +621,22 @@ tcp_frame[2] = DATA_TP_RSP; tcp_frame[3] = SUBDATA_TP_STATUS; - tcp_frame[4] = DATA_STATUS_SPIN_POSITION_COUNTER; - position2.Byte = spin_position; - tcp_frame[5] = spin_position; + DONGLE_status = new_status[0]; - tcp_server_send_raw(tcp_frame); + /*RF status change */ + if (RF_status != new_status[1]) + { + RF_status = new_status[1]; + tcp_frame[4] = DATA_STATUS_RF_CONNECTED; + tcp_frame[5] = RF_status; + tcp_server_send_raw(tcp_frame); + } + + /* Command status change */ + if (CMD_status != new_status[2]) + { + CMD_status = new_status[2]; + if (CMD_status == ACK_CMD_OK || CMD_status == ACK_CMD_KO) + cmd_status_flag = 0; + } } Modified: daemon/trunk/libs/USBDaemon_status_table.h =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.h 2007-06-24 16:56:22 UTC (rev 445) +++ daemon/trunk/libs/USBDaemon_status_table.h 2007-06-24 17:10:50 UTC (rev 446) @@ -264,35 +264,10 @@ uint16_t tux_id; /** id of the tux which is currently connected or was last connected */ uint8_t wifi_channel; /** wifi channel that the RF modules will avoid; set to 0 to disable this function */ }; + extern struct connection_status_t connection_status; -/*_____________________ F U N C T I O N S __________________________________*/ extern void update_raw_status_table(const unsigned char *new_status); extern void update_system_status_table(const unsigned char *new_status); -extern void update_version_table(const unsigned char *new_status); -extern void update_revision_table(const unsigned char *new_status); - -extern void update_author_table(const unsigned char *new_status); - -extern void update_sound_flash_count(const unsigned char *new_status); - -extern void update_ir(const unsigned char *new_status); - -extern void pong_event(unsigned char pong_number, unsigned char pong_received); - -extern void portb_changed(unsigned char new_value); -extern void portc_changed(unsigned char new_value); -extern void portd_changed(unsigned char new_value); - -extern void sensors1_changed(unsigned char new_value); -extern void sensors2_changed(unsigned char new_value_high, - unsigned char new_value_low, - unsigned char new_light_mode); - -extern void position1_changed(unsigned char eyes_position, - unsigned char mouth_position, - unsigned char wings_position); -extern void position2_changed(unsigned char new_value); - #endif |
From: neimad <c2m...@c2...> - 2007-06-24 16:56:23
|
Author: neimad Date: 2007-06-24 18:56:22 +0200 (Sun, 24 Jun 2007) New Revision: 445 Modified: daemon/trunk/libs/USBDaemon_status_table.c Log: * Removed duplicate semicolons. Modified: daemon/trunk/libs/USBDaemon_status_table.c =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.c 2007-06-24 16:51:33 UTC (rev 444) +++ daemon/trunk/libs/USBDaemon_status_table.c 2007-06-24 16:56:22 UTC (rev 445) @@ -46,8 +46,8 @@ revision_t hw_revision[4]; author_t hw_author[4]; unsigned char last_cpu_ver; -unsigned char last_remote_key = 0xFF;; -unsigned char last_toggle_key = 0xFF;; +unsigned char last_remote_key = 0xFF; +unsigned char last_toggle_key = 0xFF; unsigned char sound_flash_count = 0; unsigned char current_audio_channel = 0; |
From: neimad <c2m...@c2...> - 2007-06-24 16:51:35
|
Author: neimad Date: 2007-06-24 18:51:33 +0200 (Sun, 24 Jun 2007) New Revision: 444 Modified: daemon/trunk/libs/USBDaemon_command_tux.c Log: * Reordered functions to avoid unnecessary prototypes. Modified: daemon/trunk/libs/USBDaemon_command_tux.c =================================================================== --- daemon/trunk/libs/USBDaemon_command_tux.c 2007-06-24 16:49:21 UTC (rev 443) +++ daemon/trunk/libs/USBDaemon_command_tux.c 2007-06-24 16:51:33 UTC (rev 444) @@ -42,14 +42,6 @@ /*_____________________ F U N C T I O N S __________________________________*/ static void tux_connection(unsigned char const data[], unsigned char result[]); -static int disconnect_from_tux(void); -static int connect_to_tux(uint16_t id); -static int id_request(uint16_t *id); -static int id_lookup(uint16_t *id); -static int change_id(uint16_t id); -static int wakeup_tux(const uint16_t id); -static int avoid_wifi_channel(int wifi_channel); -static int random_tux_connection(void); static void sub_daemon_cmd_struct(unsigned char const data[], unsigned char result[], @@ -640,173 +632,6 @@ } /** - * tux connection commands - */ -static void tux_connection(unsigned char const data[], unsigned char result[]) -{ - result[0] = data[0]; - switch (data[0]) - { - case TUX_CONNECTION_DISCONNECT: - if (disconnect_from_tux() == 0) - result[1] = TUX_CONNECTION_ACK; - else - result[1] = TUX_CONNECTION_NACK; - break; - case TUX_CONNECTION_CONNECT: - { - union_uint16_t id; - id.b[1] = data[1]; - id.b[0] = data[2]; - if (connect_to_tux(id.w) == 0) - result[1] = TUX_CONNECTION_ACK; - else - result[1] = TUX_CONNECTION_NACK; - } - break; - case TUX_CONNECTION_ID_REQUEST: - { - union_uint16_t id; - if (id_request((uint16_t *)&id) == 0) - { - result[1] = TUX_CONNECTION_ACK; - result[2] = id.b[1]; /* MSB */ - result[3] = id.b[0]; /* LSB */ - } - else - result[1] = TUX_CONNECTION_NACK; - } - break; - case TUX_CONNECTION_ID_LOOKUP: - { - union_uint16_t id; - if (id_lookup((uint16_t *)&id) == 0) - { - result[1] = TUX_CONNECTION_ACK; - result[2] = id.b[1]; /* MSB */ - result[3] = id.b[0]; /* LSB */ - } - else - result[1] = TUX_CONNECTION_NACK; - } - break; - case TUX_CONNECTION_CHANGE_ID: - { - union_uint16_t id; - id.b[0] = data[2]; /* LSB */ - id.b[1] = data[1]; /* MSB */ - if (change_id(id.w) >= 0) - result[1] = TUX_CONNECTION_ACK; - else - result[1] = TUX_CONNECTION_NACK; - } - break; - case TUX_CONNECTION_SLEEP: - if (send_usb_tux_cmd(SLEEP_CMD, 0, SLEEP_MODE, 0) == ACK_CMD_OK) - result[1] = TUX_CONNECTION_ACK; - else - result[1] = TUX_CONNECTION_NACK; - break; - case TUX_CONNECTION_WAKEUP: - { - union_uint16_t id; - id.b[0] = data[2]; /* LSB */ - id.b[1] = data[1]; /* MSB */ - if (wakeup_tux(id.w) == 0) - result[1] = TUX_CONNECTION_ACK; - else - result[1] = TUX_CONNECTION_NACK; - } - break; - case TUX_CONNECTION_RANDOM: - if (random_tux_connection() == 0) - result[1] = TUX_CONNECTION_ACK; - else - result[1] = TUX_CONNECTION_NACK; - break; - case TUX_CONNECTION_WIRELESS_CHANNEL: - if (avoid_wifi_channel(data[1]) == 0) - result[1] = TUX_CONNECTION_ACK; - else - result[1] = TUX_CONNECTION_NACK; - break; - } -} - -/************************************************************************ */ -/* tux_req_info() */ -/************************************************************************ */ -static void tux_req_info(unsigned char const data[], unsigned char result[]) -{ - result[0] = data[0]; - - if (data[0] == TUX_REQ_INFO_VERSION) - { - version_t *ver = &hw_version[data[1]]; - revision_t *rev = &hw_revision[data[1]]; - author_t *auth = &hw_author[data[1]]; - - result[1] = CPU_VER_MAJ(ver->cpu_ver_maj); - result[2] = ver->ver_minor; - result[3] = ver->ver_update; - result[4] = (unsigned char)((rev->revision & 0xFF00) >> 8); - result[5] = (unsigned char)(rev->revision & 0x00FF); - result[6] = (unsigned char)((auth->author_id & 0xFF00) >> 8); - result[7] = (unsigned char)(auth->author_id & 0x00FF); - } -} - -/************************************************************************** */ -/* TUX USB */ -/************************************************************************** */ - -/************************************************************************ */ -/* send_usb_tuxcmd() */ -/************************************************************************ */ -unsigned char send_usb_tux_cmd(unsigned char cmd, unsigned char param1, - unsigned char param2, unsigned char param3) -{ - unsigned char usb_frame[TUX_SEND_LENGTH]; - - usb_frame[0] = 0; - usb_frame[1] = cmd; - usb_frame[2] = param1; - usb_frame[3] = param2; - usb_frame[4] = param3; - return usb_send_TuxDroid(usb_frame); -} - -/************************************************************************ */ -/* send_usb_donglecmd() */ -/************************************************************************ */ -unsigned char send_usb_dongle_cmd(usb_dongle_commands_t cmd, - unsigned char param1, unsigned char param2, unsigned char param3) -{ - unsigned char data[TUX_SEND_LENGTH]; - - data[0] = USB_DONGLE_CMD; - data[1] = cmd; - data[2] = param1; - data[3] = param2; - data[4] = param3; - log_debug("USB PC->Dongle: %#x, %#x, %#x, %#x, %#x\n", data[0], data[1], - data[2], data[3], data[4]); - - return usb_write_TuxDroid(data, TUX_SEND_LENGTH); -} - -/** - * Initialize audio. - */ -void tux_audio_init(void) -{ - /* Resets audio channel selection; there are 2 audio interfaces in the - * dongle, the second is dedicated to TTS. */ - send_usb_dongle_cmd(USB_AUDIO_CMD, 0, 0, 0); - current_audio_channel = 0; -} - -/** * Disconnect from tux * * The return value only tells whether the command has been sent successfully @@ -847,25 +672,6 @@ } /** - * Connect to the first tux discovered - * - * Catch any disconnected tux, request its ID and connect to it. - * - * \return 0 if successful, -1 otherwise - */ -static int random_tux_connection(void) -{ - uint16_t id; - if (id_lookup((uint16_t *)&id) < 0) - return -1; - - if (connect_to_tux(id) < 0) - return -1; - - return 0; -} - -/** * Get the ID of tux currently connected * * \param *id pointer where the id should be returned @@ -998,6 +804,25 @@ } /** + * Connect to the first tux discovered + * + * Catch any disconnected tux, request its ID and connect to it. + * + * \return 0 if successful, -1 otherwise + */ +static int random_tux_connection(void) +{ + uint16_t id; + if (id_lookup((uint16_t *)&id) < 0) + return -1; + + if (connect_to_tux(id) < 0) + return -1; + + return 0; +} + +/** * Wake-up a tux if it's in sleep mode. * * \return 0 if successful, -1 otherwise @@ -1019,6 +844,7 @@ return -1; } + /** * Configure the RF module to avoid a given wifi channel * @@ -1054,3 +880,170 @@ else return -1; } + +/** + * tux connection commands + */ +static void tux_connection(unsigned char const data[], unsigned char result[]) +{ + result[0] = data[0]; + switch (data[0]) + { + case TUX_CONNECTION_DISCONNECT: + if (disconnect_from_tux() == 0) + result[1] = TUX_CONNECTION_ACK; + else + result[1] = TUX_CONNECTION_NACK; + break; + case TUX_CONNECTION_CONNECT: + { + union_uint16_t id; + id.b[1] = data[1]; + id.b[0] = data[2]; + if (connect_to_tux(id.w) == 0) + result[1] = TUX_CONNECTION_ACK; + else + result[1] = TUX_CONNECTION_NACK; + } + break; + case TUX_CONNECTION_ID_REQUEST: + { + union_uint16_t id; + if (id_request((uint16_t *)&id) == 0) + { + result[1] = TUX_CONNECTION_ACK; + result[2] = id.b[1]; /* MSB */ + result[3] = id.b[0]; /* LSB */ + } + else + result[1] = TUX_CONNECTION_NACK; + } + break; + case TUX_CONNECTION_ID_LOOKUP: + { + union_uint16_t id; + if (id_lookup((uint16_t *)&id) == 0) + { + result[1] = TUX_CONNECTION_ACK; + result[2] = id.b[1]; /* MSB */ + result[3] = id.b[0]; /* LSB */ + } + else + result[1] = TUX_CONNECTION_NACK; + } + break; + case TUX_CONNECTION_CHANGE_ID: + { + union_uint16_t id; + id.b[0] = data[2]; /* LSB */ + id.b[1] = data[1]; /* MSB */ + if (change_id(id.w) >= 0) + result[1] = TUX_CONNECTION_ACK; + else + result[1] = TUX_CONNECTION_NACK; + } + break; + case TUX_CONNECTION_SLEEP: + if (send_usb_tux_cmd(SLEEP_CMD, 0, SLEEP_MODE, 0) == ACK_CMD_OK) + result[1] = TUX_CONNECTION_ACK; + else + result[1] = TUX_CONNECTION_NACK; + break; + case TUX_CONNECTION_WAKEUP: + { + union_uint16_t id; + id.b[0] = data[2]; /* LSB */ + id.b[1] = data[1]; /* MSB */ + if (wakeup_tux(id.w) == 0) + result[1] = TUX_CONNECTION_ACK; + else + result[1] = TUX_CONNECTION_NACK; + } + break; + case TUX_CONNECTION_RANDOM: + if (random_tux_connection() == 0) + result[1] = TUX_CONNECTION_ACK; + else + result[1] = TUX_CONNECTION_NACK; + break; + case TUX_CONNECTION_WIRELESS_CHANNEL: + if (avoid_wifi_channel(data[1]) == 0) + result[1] = TUX_CONNECTION_ACK; + else + result[1] = TUX_CONNECTION_NACK; + break; + } +} + +/************************************************************************ */ +/* tux_req_info() */ +/************************************************************************ */ +static void tux_req_info(unsigned char const data[], unsigned char result[]) +{ + result[0] = data[0]; + + if (data[0] == TUX_REQ_INFO_VERSION) + { + version_t *ver = &hw_version[data[1]]; + revision_t *rev = &hw_revision[data[1]]; + author_t *auth = &hw_author[data[1]]; + + result[1] = CPU_VER_MAJ(ver->cpu_ver_maj); + result[2] = ver->ver_minor; + result[3] = ver->ver_update; + result[4] = (unsigned char)((rev->revision & 0xFF00) >> 8); + result[5] = (unsigned char)(rev->revision & 0x00FF); + result[6] = (unsigned char)((auth->author_id & 0xFF00) >> 8); + result[7] = (unsigned char)(auth->author_id & 0x00FF); + } +} + +/************************************************************************** */ +/* TUX USB */ +/************************************************************************** */ + +/************************************************************************ */ +/* send_usb_tuxcmd() */ +/************************************************************************ */ +unsigned char send_usb_tux_cmd(unsigned char cmd, unsigned char param1, + unsigned char param2, unsigned char param3) +{ + unsigned char usb_frame[TUX_SEND_LENGTH]; + + usb_frame[0] = 0; + usb_frame[1] = cmd; + usb_frame[2] = param1; + usb_frame[3] = param2; + usb_frame[4] = param3; + return usb_send_TuxDroid(usb_frame); +} + +/************************************************************************ */ +/* send_usb_donglecmd() */ +/************************************************************************ */ +unsigned char send_usb_dongle_cmd(usb_dongle_commands_t cmd, + unsigned char param1, unsigned char param2, unsigned char param3) +{ + unsigned char data[TUX_SEND_LENGTH]; + + data[0] = USB_DONGLE_CMD; + data[1] = cmd; + data[2] = param1; + data[3] = param2; + data[4] = param3; + log_debug("USB PC->Dongle: %#x, %#x, %#x, %#x, %#x\n", data[0], data[1], + data[2], data[3], data[4]); + + return usb_write_TuxDroid(data, TUX_SEND_LENGTH); +} + +/** + * Initialize audio. + */ +void tux_audio_init(void) +{ + /* Resets audio channel selection; there are 2 audio interfaces in the + * dongle, the second is dedicated to TTS. */ + send_usb_dongle_cmd(USB_AUDIO_CMD, 0, 0, 0); + current_audio_channel = 0; +} |
From: neimad <c2m...@c2...> - 2007-06-24 16:49:50
|
Author: neimad Date: 2007-06-24 18:49:21 +0200 (Sun, 24 Jun 2007) New Revision: 443 Modified: daemon/trunk/libs/USBDaemon_status_table.c Log: * Use macro constants ACK_CMD_{OK,OK} for CMD_status instead of hardcoded values. Modified: daemon/trunk/libs/USBDaemon_status_table.c =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.c 2007-06-24 16:28:00 UTC (rev 442) +++ daemon/trunk/libs/USBDaemon_status_table.c 2007-06-24 16:49:21 UTC (rev 443) @@ -170,7 +170,7 @@ if (CMD_status != new_status[2]) { CMD_status = new_status[2]; - if (CMD_status == 2 || CMD_status == 3) + if (CMD_status == ACK_CMD_OK || CMD_status == ACK_CMD_KO) cmd_status_flag = 0; } } |
From: neimad <c2m...@c2...> - 2007-06-24 16:28:02
|
Author: neimad Date: 2007-06-24 18:28:00 +0200 (Sun, 24 Jun 2007) New Revision: 442 Modified: daemon/trunk/libs/USBDaemon_command_tux.c Log: * Several checks in tux_connection() tested >= 0 while the functions checked only return <= 0 (0 meaning success). Changed these checks to test == 0. Modified: daemon/trunk/libs/USBDaemon_command_tux.c =================================================================== --- daemon/trunk/libs/USBDaemon_command_tux.c 2007-06-24 16:19:37 UTC (rev 441) +++ daemon/trunk/libs/USBDaemon_command_tux.c 2007-06-24 16:28:00 UTC (rev 442) @@ -256,9 +256,7 @@ tcp_server_send_raw_to_client(client_id, ack_dp_frame); /* Send tcp frame to client */ if (ACK_DP == ACK_DP_OK) - { tcp_server_send_raw_to_client(client_id, tcp_frame); - } } } @@ -650,7 +648,7 @@ switch (data[0]) { case TUX_CONNECTION_DISCONNECT: - if (disconnect_from_tux() >= 0) + if (disconnect_from_tux() == 0) result[1] = TUX_CONNECTION_ACK; else result[1] = TUX_CONNECTION_NACK; @@ -660,7 +658,7 @@ union_uint16_t id; id.b[1] = data[1]; id.b[0] = data[2]; - if (connect_to_tux(id.w) >= 0) + if (connect_to_tux(id.w) == 0) result[1] = TUX_CONNECTION_ACK; else result[1] = TUX_CONNECTION_NACK; @@ -669,7 +667,7 @@ case TUX_CONNECTION_ID_REQUEST: { union_uint16_t id; - if (id_request((uint16_t *)&id) >= 0) + if (id_request((uint16_t *)&id) == 0) { result[1] = TUX_CONNECTION_ACK; result[2] = id.b[1]; /* MSB */ @@ -682,7 +680,7 @@ case TUX_CONNECTION_ID_LOOKUP: { union_uint16_t id; - if (id_lookup((uint16_t *)&id) >= 0) + if (id_lookup((uint16_t *)&id) == 0) { result[1] = TUX_CONNECTION_ACK; result[2] = id.b[1]; /* MSB */ @@ -714,14 +712,14 @@ union_uint16_t id; id.b[0] = data[2]; /* LSB */ id.b[1] = data[1]; /* MSB */ - if (wakeup_tux(id.w) >= 0) + if (wakeup_tux(id.w) == 0) result[1] = TUX_CONNECTION_ACK; else result[1] = TUX_CONNECTION_NACK; } break; case TUX_CONNECTION_RANDOM: - if (random_tux_connection() >= 0) + if (random_tux_connection() == 0) result[1] = TUX_CONNECTION_ACK; else result[1] = TUX_CONNECTION_NACK; |
From: neimad <c2m...@c2...> - 2007-06-24 16:20:10
|
Author: neimad Date: 2007-06-24 18:19:37 +0200 (Sun, 24 Jun 2007) New Revision: 441 Modified: daemon/trunk/libs/USBDaemon_command_tux.c Log: * wifi_channel is an int; no point in using unsigned char. * Added check in avoid_wifi_channel() to ensure the given wifi channel is in the valid range. Modified: daemon/trunk/libs/USBDaemon_command_tux.c =================================================================== --- daemon/trunk/libs/USBDaemon_command_tux.c 2007-06-24 14:56:03 UTC (rev 440) +++ daemon/trunk/libs/USBDaemon_command_tux.c 2007-06-24 16:19:37 UTC (rev 441) @@ -48,7 +48,7 @@ static int id_lookup(uint16_t *id); static int change_id(uint16_t id); static int wakeup_tux(const uint16_t id); -static int avoid_wifi_channel(unsigned char wifi_channel); +static int avoid_wifi_channel(int wifi_channel); static int random_tux_connection(void); static void sub_daemon_cmd_struct(unsigned char const data[], @@ -727,7 +727,7 @@ result[1] = TUX_CONNECTION_NACK; break; case TUX_CONNECTION_WIRELESS_CHANNEL: - if (avoid_wifi_channel(data[1]) >= 0) + if (avoid_wifi_channel(data[1]) == 0) result[1] = TUX_CONNECTION_ACK; else result[1] = TUX_CONNECTION_NACK; @@ -1034,7 +1034,7 @@ * * \return 0 if successful, -1 otherwise */ -static int avoid_wifi_channel(unsigned char wifi_channel) +static int avoid_wifi_channel(int wifi_channel) { /* * Conversion of the lower and higher frequencies of a wifi channel into @@ -1046,6 +1046,9 @@ static const uint8_t higher_ATR_channel[15] = {2, 26, 32, 38, 43, 49, 55, 61, 67, 72, 78, 84, 90, 92, 92}; + if (wifi_channel < 0 || wifi_channel > 14) + return -1; + if (send_usb_dongle_cmd(USB_TUX_CONNECTION_CMD, USB_TUX_CONNECTION_CHANGE_ID, lower_ATR_channel[wifi_channel], higher_ATR_channel[wifi_channel]) == USB_FRAME_SIZE) |
From: neimad <c2m...@c2...> - 2007-06-24 14:56:07
|
Author: neimad Date: 2007-06-24 16:56:03 +0200 (Sun, 24 Jun 2007) New Revision: 440 Modified: daemon/trunk/libs/USBDaemon_command_tux.c Log: * English. Modified: daemon/trunk/libs/USBDaemon_command_tux.c =================================================================== --- daemon/trunk/libs/USBDaemon_command_tux.c 2007-06-24 13:04:05 UTC (rev 439) +++ daemon/trunk/libs/USBDaemon_command_tux.c 2007-06-24 14:56:03 UTC (rev 440) @@ -851,7 +851,7 @@ /** * Connect to the first tux discovered * - * Catch any disconnected tux, request it's ID and connect to it. + * Catch any disconnected tux, request its ID and connect to it. * * \return 0 if successful, -1 otherwise */ @@ -904,7 +904,7 @@ * Get the ID of the first disconnected tux which is discoverred * * The first disconnected tux that will detect this command will reply with - * it's ID and disconnect immediately. You can then connect to that tux with + * its ID and disconnect immediately. You can then connect to that tux with * the ID you just got. * * In order to get the ID's of more than one disconnected tux, you have to |
From: neimad <c2m...@c2...> - 2007-06-24 13:04:33
|
Author: neimad Date: 2007-06-24 15:04:05 +0200 (Sun, 24 Jun 2007) New Revision: 439 Modified: daemon/trunk/libs/USBDaemon_tcp_server.c Log: * Fixed indentation of file's top comment. Modified: daemon/trunk/libs/USBDaemon_tcp_server.c =================================================================== --- daemon/trunk/libs/USBDaemon_tcp_server.c 2007-06-24 13:03:30 UTC (rev 438) +++ daemon/trunk/libs/USBDaemon_tcp_server.c 2007-06-24 13:04:05 UTC (rev 439) @@ -1,23 +1,22 @@ - /* -* Tux Droid - USB Daemon -* Copyright (C) 2007 C2ME Sa <rem...@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, 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. -*/ + * Tux Droid - USB Daemon + * Copyright (C) 2007 C2ME Sa <rem...@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, 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$ */ |
From: neimad <c2m...@c2...> - 2007-06-24 13:03:48
|
Author: neimad Date: 2007-06-24 15:03:30 +0200 (Sun, 24 Jun 2007) New Revision: 438 Modified: daemon/trunk/libs/USBDaemon_tcp_server.c Log: * Made TCP server handle, address and status private. Modified: daemon/trunk/libs/USBDaemon_tcp_server.c =================================================================== --- daemon/trunk/libs/USBDaemon_tcp_server.c 2007-06-24 13:01:23 UTC (rev 437) +++ daemon/trunk/libs/USBDaemon_tcp_server.c 2007-06-24 13:03:30 UTC (rev 438) @@ -40,9 +40,9 @@ /*_____________________ V A R I A B L E S __________________________________*/ -int tcp_server_handle = -1; -struct sockaddr_in tcp_server_sockaddr; -tux_tcp_status_t tux_tcp_status = TUX_TCP_STATUS_DOWN; +static int tcp_server_handle = -1; +static struct sockaddr_in tcp_server_sockaddr; +static tux_tcp_status_t tux_tcp_status = TUX_TCP_STATUS_DOWN; int tcp_clients_handle[TUX_MAX_TCP_CLIENTS] = { [0 ... TUX_MAX_TCP_CLIENTS - 1] = -1 }; |
From: neimad <c2m...@c2...> - 2007-06-24 13:01:25
|
Author: neimad Date: 2007-06-24 15:01:23 +0200 (Sun, 24 Jun 2007) New Revision: 437 Modified: daemon/trunk/libs/USBDaemon_tcp_server.c Log: * Moved tcp_remove_client() below tcp_add_client(). One is static, one is not, which means there's something not quite right. Need cleaning this up. Modified: daemon/trunk/libs/USBDaemon_tcp_server.c =================================================================== --- daemon/trunk/libs/USBDaemon_tcp_server.c 2007-06-24 12:59:50 UTC (rev 436) +++ daemon/trunk/libs/USBDaemon_tcp_server.c 2007-06-24 13:01:23 UTC (rev 437) @@ -140,6 +140,22 @@ } /** + * Remove a TCP client. + * + * The client's entry in the clients array is left empty (-1), so this + * array may contain holes. + * + * @param[in] id_client Id of client to remove + */ +void tcp_remove_client(int id_client) +{ + close(tcp_clients_handle[id_client]); + tcp_clients_handle[id_client] = -1; + + tcp_clients_count--; +} + +/** * Server's event loop */ void tcp_server_loop(void) @@ -284,19 +300,3 @@ close(tcp_server_handle); } - -/** - * Remove a TCP client. - * - * The client's entry in the clients array is left empty (-1), so this - * array may contain holes. - * - * @param[in] id_client Id of client to remove - */ -void tcp_remove_client(int id_client) -{ - close(tcp_clients_handle[id_client]); - tcp_clients_handle[id_client] = -1; - - tcp_clients_count--; -} |
From: neimad <c2m...@c2...> - 2007-06-24 12:59:52
|
Author: neimad Date: 2007-06-24 14:59:50 +0200 (Sun, 24 Jun 2007) New Revision: 436 Modified: daemon/trunk/libs/USBDaemon_tcp_server.c Log: * Added tcp_add_client(), which adds a newly connected client to the array of clients. Modified: daemon/trunk/libs/USBDaemon_tcp_server.c =================================================================== --- daemon/trunk/libs/USBDaemon_tcp_server.c 2007-06-24 12:52:25 UTC (rev 435) +++ daemon/trunk/libs/USBDaemon_tcp_server.c 2007-06-24 12:59:50 UTC (rev 436) @@ -118,6 +118,28 @@ } /** + * Add a TCP client. + * + * @param[in] sock Client's socket + * + * @return client id if successful, -1 otherwise + */ +static int tcp_add_client(int sock) +{ + int i; + + for (i = 0; i < TUX_MAX_TCP_CLIENTS; i++) + if (tcp_clients_handle[i] < 0) + { + tcp_clients_handle[i] = sock; + tcp_clients_count++; + return i; + } + + return -1; +} + +/** * Server's event loop */ void tcp_server_loop(void) @@ -173,19 +195,10 @@ log_error("accept failed: %m"); else { - int client_added = 0; + int client_id = tcp_add_client(tmp_client); - for (i = 0; i < TUX_MAX_TCP_CLIENTS; i++) - if (tcp_clients_handle[i] < 0) - { - tcp_clients_handle[i] = tmp_client; - tcp_clients_count++; - client_added = 1; - break; - } - - if (client_added) - log_info("client %d connected", i); + if (client_id != -1) + log_info("client %d connected", client_id); else { log_error("client rejected: client table full"); |
From: neimad <c2m...@c2...> - 2007-06-24 12:52:29
|
Author: neimad Date: 2007-06-24 14:52:25 +0200 (Sun, 24 Jun 2007) New Revision: 435 Modified: daemon/trunk/libs/USBDaemon_tcp_server.c Log: * Don't compact the array of tcp client handles: there's no point in doing so, and it even may hinder debugging as a client id would then change over time (depending on its index in the array). Modified: daemon/trunk/libs/USBDaemon_tcp_server.c =================================================================== --- daemon/trunk/libs/USBDaemon_tcp_server.c 2007-06-24 12:42:54 UTC (rev 434) +++ daemon/trunk/libs/USBDaemon_tcp_server.c 2007-06-24 12:52:25 UTC (rev 435) @@ -272,24 +272,18 @@ close(tcp_server_handle); } -/************************************************************************ */ - -/* Remove a tcp client */ - -/************************************************************************ */ +/** + * Remove a TCP client. + * + * The client's entry in the clients array is left empty (-1), so this + * array may contain holes. + * + * @param[in] id_client Id of client to remove + */ void tcp_remove_client(int id_client) { - int i, j; - int tmp_handle; - - tmp_handle = tcp_clients_handle[id_client]; + close(tcp_clients_handle[id_client]); tcp_clients_handle[id_client] = -1; + tcp_clients_count--; - close(tmp_handle); - for (i = id_client; i < TUX_MAX_TCP_CLIENTS - 1; i++) - { - tcp_clients_handle[i] = tcp_clients_handle[i + 1]; - for (j = 0; j < 16; j++) - tcp_clients_name[i][j] = tcp_clients_name[i + 1][j]; - } } |
From: neimad <c2m...@c2...> - 2007-06-24 12:42:55
|
Author: neimad Date: 2007-06-24 14:42:54 +0200 (Sun, 24 Jun 2007) New Revision: 434 Modified: daemon/trunk/libs/USBDaemon_usb.c Log: * Fixed comments on return value of usb_{read,write}_TuxDroid(). Modified: daemon/trunk/libs/USBDaemon_usb.c =================================================================== --- daemon/trunk/libs/USBDaemon_usb.c 2007-06-24 12:40:41 UTC (rev 433) +++ daemon/trunk/libs/USBDaemon_usb.c 2007-06-24 12:42:54 UTC (rev 434) @@ -177,7 +177,7 @@ * @param[in] buf Buffer to write * @param[in] size Size of buffer * - * \return number of bytes written if successful, < 0 otherwise + * @return number of bytes written if successful, < 0 otherwise */ int usb_write_TuxDroid(const void *buf, size_t size) { @@ -190,6 +190,8 @@ * * @param[out] buf Buffer to store data in * @param[in] size Size of buffer + * + * @return number of bytes read if successful, < 0 otherwise */ int usb_read_TuxDroid(void *buf, size_t size) { |
From: neimad <c2m...@c2...> - 2007-06-24 12:40:57
|
Author: neimad Date: 2007-06-24 14:40:41 +0200 (Sun, 24 Jun 2007) New Revision: 433 Added: daemon/trunk/Doxyfile Log: * Very crude Doxygen file: only set project name, excluded Quilt directories, enabled recursive doc generation and file dependency graph (with dot). Left all comments in so we can more easily tailor it to our needs. Comments and defaults may eventually be removed once we've settled with settings that suit our needs. Added: daemon/trunk/Doxyfile =================================================================== --- daemon/trunk/Doxyfile (rev 0) +++ daemon/trunk/Doxyfile 2007-06-24 12:40:41 UTC (rev 433) @@ -0,0 +1,1253 @@ +# Doxyfile 1.4.7 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = "Tux Droid daemon" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = doc + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, +# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, +# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, +# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, +# Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# This tag can be used to specify the encoding used in the generated output. +# The encoding is not always determined by the language that is chosen, +# but also whether or not the output is meant for Windows or non-Windows users. +# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES +# forces the Windows encoding (this is the default for the Windows binary), +# whereas setting the tag to NO uses a Unix-style encoding (the default for +# all platforms other than Windows). + +USE_WINDOWS_ENCODING = NO + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like the Qt-style comments (thus requiring an +# explicit @brief command for a brief description. + +JAVADOC_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the DETAILS_AT_TOP tag is set to YES then Doxygen +# will output the detailed description near the top, like JavaDoc. +# If set to NO, the detailed description appears after the member +# documentation. + +DETAILS_AT_TOP = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for Java. +# For instance, namespaces will be presented as packages, qualified scopes +# will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to +# include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = NO + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from the +# version control system). Doxygen will invoke the program by executing (via +# popen()) the command <command> <input-file>, where <command> is the value of +# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +# Damien-- exclude Quilt directories +EXCLUDE = .pc patches + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command <filter> <input-file>, where <filter> +# is the value of the INPUT_FILTER tag, and <input-file> is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = YES + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentstion. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = NO + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. + +GENERATE_TREEVIEW = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = YES + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = YES + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = YES + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will +# generate a call dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected +# functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then doxygen will +# generate a caller dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable caller graphs for selected +# functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_WIDTH = 1024 + +# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_HEIGHT = 1024 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that a graph may be further truncated if the graph's +# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH +# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), +# the graph is not depth-constrained. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, which results in a white background. +# Warning: Depending on the platform used, enabling this option may lead to +# badly anti-aliased labels on the edges of a graph (i.e. they become hard to +# read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO |
From: neimad <c2m...@c2...> - 2007-06-24 12:32:06
|
Author: neimad Date: 2007-06-24 14:31:59 +0200 (Sun, 24 Jun 2007) New Revision: 432 Modified: daemon/trunk/libs/USBDaemon_log.c daemon/trunk/libs/USBDaemon_log.h Log: * Use bool in logging facility. Modified: daemon/trunk/libs/USBDaemon_log.c =================================================================== --- daemon/trunk/libs/USBDaemon_log.c 2007-06-24 12:25:51 UTC (rev 431) +++ daemon/trunk/libs/USBDaemon_log.c 2007-06-24 12:31:59 UTC (rev 432) @@ -45,19 +45,19 @@ static FILE *log_file; /** Whether the log has been opened */ -static int log_opened; +static bool log_opened; /** * @brief Open the log. * * @param[in] target Logging target * - * @return 1 if successfull, 0 otherwise + * @return true if successfull, false otherwise */ -int log_open(log_target_t target) +bool log_open(log_target_t target) { if (log_opened) - return 1; + return true; switch (target) { @@ -68,7 +68,7 @@ case LOG_TARGET_TUX: log_file = fopen(LOG_FILE, "at"); if (log_file == NULL) - return 0; + return false; break; case LOG_TARGET_SHELL: @@ -76,9 +76,9 @@ } log_target = target; - log_opened = 1; + log_opened = true; - return 1; + return true; } /** @@ -104,7 +104,7 @@ break; } - log_opened = 0; + log_opened = false; } /** @@ -138,9 +138,9 @@ * If the priority of the specifed level is lower than the priority * of the current logging level, the message is silently dropped. * - * @return 1 if successful, 0 otherwise + * @return true if successful, false otherwise */ -int log_text(log_level_t at_level, const char *fmt, ...) +bool log_text(log_level_t at_level, const char *fmt, ...) { char text[1024], *p = text; size_t size = sizeof(text); @@ -151,13 +151,13 @@ /* No need for the log to be 'opened' when logging to std{out,err} */ if (log_target != LOG_TARGET_SHELL && !log_opened) - return 0; + return false; /* Logging at level NONE has no sense */ assert(at_level >= LOG_LEVEL_DEBUG && at_level < LOG_LEVEL_NONE); if (at_level < current_level) - return 1; + return true; /* Add date & time when LOG_TARGET_TUX */ if (log_target == LOG_TARGET_TUX) @@ -165,7 +165,7 @@ now = time(NULL); r = strftime(p, size, "%F %T ", localtime(&now)); if (r == 0) - return 0; + return false; p += r; size -= r; @@ -176,7 +176,7 @@ { r = snprintf(p, size, "%s: ", level_names[at_level]); if (r < 0) - return 0; + return false; p += r; size -= r; @@ -186,7 +186,7 @@ r = vsnprintf(p, size, fmt, al); va_end(al); if (r < 0) - return 0; + return false; switch (log_target) { @@ -207,5 +207,5 @@ break; } - return 1; + return true; } Modified: daemon/trunk/libs/USBDaemon_log.h =================================================================== --- daemon/trunk/libs/USBDaemon_log.h 2007-06-24 12:25:51 UTC (rev 431) +++ daemon/trunk/libs/USBDaemon_log.h 2007-06-24 12:31:59 UTC (rev 432) @@ -1,6 +1,8 @@ #ifndef __USBDAEMON_LOG_H__ #define __USBDAEMON_LOG_H__ +#include <stdbool.h> + /** Logging target */ typedef enum log_target { @@ -9,7 +11,7 @@ LOG_TARGET_SHELL } log_target_t; -extern int log_open(log_target_t target); +extern bool log_open(log_target_t target); extern void log_close(void); /** Logging levels, in increasing priorities */ @@ -25,7 +27,7 @@ extern void log_set_level(log_level_t new_level); extern log_level_t log_get_level(void); -extern int log_text(log_level_t at_level, const char *fmt, ...) +extern bool log_text(log_level_t at_level, const char *fmt, ...) __attribute__((format(printf, 2, 3))); #define log_debug(fmt, ...) log_text(LOG_LEVEL_DEBUG, (fmt), ## __VA_ARGS__) |