[tuxdroid-svn] r1254 - in firmware: . rf rf/trunk
Status: Beta
Brought to you by:
ks156
From: jaguarondi <c2m...@c2...> - 2008-06-24 10:16:26
|
Author: jaguarondi Date: 2008-06-24 12:16:32 +0200 (Tue, 24 Jun 2008) New Revision: 1254 Added: firmware/rf/ firmware/rf/trunk/ firmware/rf/trunk/Makefile firmware/rf/trunk/defines.h firmware/rf/trunk/device.c firmware/rf/trunk/init.c firmware/rf/trunk/init.h firmware/rf/trunk/interface.c firmware/rf/trunk/interface.h firmware/rf/trunk/misc.c firmware/rf/trunk/misc.h firmware/rf/trunk/prot.c firmware/rf/trunk/prot.h firmware/rf/trunk/rf_ctrl.c firmware/rf/trunk/rf_ctrl.h firmware/rf/trunk/varis.c firmware/rf/trunk/varis.h Removed: firmware/fuxrf/ firmware/rf/trunk/ firmware/rf/trunk/default/ firmware/rf/trunk/defines.h firmware/rf/trunk/device.aps firmware/rf/trunk/device.c firmware/rf/trunk/init.c firmware/rf/trunk/init.h firmware/rf/trunk/misc.c firmware/rf/trunk/misc.h firmware/rf/trunk/prot.c firmware/rf/trunk/prot.h firmware/rf/trunk/rf_ctrl.c firmware/rf/trunk/rf_ctrl.h firmware/rf/trunk/varis.c firmware/rf/trunk/varis.h firmware/tuxrf/ Log: * Both RF now share the same code. Use TYPE={slave,master} to compile one or the other. Copied: firmware/rf (from rev 1016, firmware/fuxrf) Property changes on: firmware/rf ___________________________________________________________________ Name: svn:mergeinfo + Copied: firmware/rf/trunk (from rev 1252, firmware/fuxrf/trunk) Copied: firmware/rf/trunk/Makefile (from rev 1253, firmware/fuxrf/trunk/Makefile) =================================================================== --- firmware/rf/trunk/Makefile (rev 0) +++ firmware/rf/trunk/Makefile 2008-06-24 10:16:32 UTC (rev 1254) @@ -0,0 +1,122 @@ +############################################################################### +# Makefile for the project device +############################################################################### + +## General Flags +MCU = atmega48 +TARGET = fuxrf.elf +CC = avr-gcc +AVRDUDE = avrdude + +## Options common to compile, link and assembly rules +COMMON = -mmcu=$(MCU) + +## Compile options common for all C compilation units. +CFLAGS = $(COMMON) +CFLAGS += -Wall -gstabs -DF_CPU=13824000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums +CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d +ifneq (,$(findstring master, $(TYPE))) + PROJECT = fuxrf + CFLAGS += -D_MASTER +else + ifneq (,$(findstring slave, $(TYPE))) + PROJECT = tuxrf + CFLAGS += -D_SLAVE + endif +endif + + +## Assembly specific flags +ASMFLAGS = $(COMMON) +ASMFLAGS += -x assembler-with-cpp -Wa,-gstabs + +## Linker flags +LDFLAGS = $(COMMON) + +## Intel Hex file production flags +HEX_FLASH_FLAGS = -R .eeprom + +HEX_EEPROM_FLAGS = -j .eeprom +HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load" +HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0 + +## Objects that must be built in order to link +OBJECTS = device.o init.o misc.o prot.o rf_ctrl.o varis.o interface.o #bootloader.o + +## Objects explicitly added by the user +LINKONLYOBJECTS = + +## Build +all: $(TARGET) fuxrf.hex fuxrf.eep fuxrf.lss size + +## Compile +device.o: device.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +init.o: init.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +misc.o: misc.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +prot.o: prot.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +rf_ctrl.o: rf_ctrl.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +varis.o: varis.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +interface.o: interface.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +bootloader.o: bootloader.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +##Link +$(TARGET): $(OBJECTS) + $(CC) $(LDFLAGS) $(OBJECTS) $(LINKONLYOBJECTS) $(LIBDIRS) $(LIBS) -o $(TARGET) + +%.hex: $(TARGET) + avr-objcopy -O ihex $(HEX_FLASH_FLAGS) $< $@ + +%.eep: $(TARGET) + avr-objcopy $(HEX_EEPROM_FLAGS) -O ihex $< $@ + +%.lss: $(TARGET) + avr-objdump -h -S $< > $@ + +size: ${TARGET} + @echo + @avr-size ${TARGET} + +## Clean target +.PHONY: clean +clean: + -rm -rf $(OBJECTS) device.elf dep/* device.hex device.eep device.lss device.map + + +## Other dependencies +-include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*) + +# Programming +prog: $(PROJECT).hex + tuxup $(PROJECT).hex $(PROJECT).eep + +dwen: + $(AVRDUDE) -p $(MCU) -c jtag2isp -P usb -B 10 -U hfuse:w:0x95:m + +nodwen: + $(AVRDUDE) -p $(MCU) -c jtag2isp -P usb -B 10 -U hfuse:w:0xD5:m + +debug: + avarice -P $(MCU) -B 1000 -2 -w -j usb -p -f $(PROJECT).elf :4242 + +progisp: $(PROJECT).hex $(PROJECT).eep + $(AVRDUDE) -p $(MCU) -c jtag2isp -P usb -B 10 -e \ + -U flash:w:$(PROJECT).hex + +progstk: $(PROJECT).hex $(PROJECT).eep + $(AVRDUDE) -p $(MCU) -c stk500v2 -e -U flash:w:$(PROJECT).hex \ + -U eeprom:w:$(PROJECT).eep Deleted: firmware/rf/trunk/defines.h =================================================================== --- firmware/fuxrf/trunk/defines.h 2008-06-24 09:27:28 UTC (rev 1252) +++ firmware/rf/trunk/defines.h 2008-06-24 10:16:32 UTC (rev 1254) @@ -1,106 +0,0 @@ -#ifndef DEFINES_H -#define DEFINES_H - -// Include defines for target MCU -#include <avr/io.h> -#include <compat/ina90.h> -#include <avr/interrupt.h> -#include <avr/pgmspace.h> -#include <avr/eeprom.h> - -// Define the used HOPPING SCHEME -#define HOPPING // No hopping, use signel channel TRX_CHANNEL. If no define use frequency hopping -#define TRX_CHANNEL 90 -#define FHA // Use frequency hopping adaptativ - -#define WIFI - -//------->rf_status-Defines<-------// -#define WAIT_HOPPING 0x02 -#define RXING 0x04 -#define TXING 0x08 -#define LOGGED 0x10 -#define FHA_EFFECTIVE 0x20 -#define MASTER 0x40 -#define SLAVE 0x80 -//------->rf_status-Defines<-------// - -//----->Header-Byte_1-Defines<-----// -#define MASTERH 0x01 -#define SLAVEH 0x02 -#define LOGGEDH 0x04 -#define FHTRSEQ 0x08 -#define FHAACKH 0x10 -#define CHANGEID 0x20 -#define REQUESTID 0x40 -#define SMALLFRAME 0x80 -//----->Header-Byte_1-Defines<-----// - -//------->FHAState-Defines<-------// -#define INIT 0x01 -#define SEND_SEQUENCE 0x02 -#define WAIT_SYNCHRO 0x04 -#define WAIT_ACK_CHF 0x10 -#define DO_UPDATE 0x20 -#define COMPUTE_FREQ 0x40 -//------->FHAState-Defines<-------// - -//------->RFinitState-Defines<-------// -#define WAIT_SLAVE 0x01 -#define WAIT_LOG 0x02 -#define SEND_FS 0x03 -#define WAIT_SYNCHRO 0x04 -//------->RFinitState-Defines<-------// - -//----->Assembler Definitions<-----// -#define _RETI __asm__ __volatile__ ("reti") -#define _NIX __asm__ __volatile__ ("nop") -#define _READ_FB __LPM -#define __EEPROM__ __attribute__((section(".eeprom"))) -#define SIGNAL_NAKED(signame)\ -void signame (void) __attribute__ ((signal)) __attribute__ ((naked));\ -void signame (void) -//----->Assembler Definitions<-----// - -//----->Hardware Definitions<-----// -#define set_clock __asm__ __volatile__ ("sbi 0x0B,4") //D.4# CLOCK PORTD.4 -#define clr_clock __asm__ __volatile__ ("cbi 0x0B,4") //D.4# CLOCK PORTD.4 -#define set_data __asm__ __volatile__ ("sbi 0x0B,1") //D.1# TXD/D PORTD.1 -#define clr_data __asm__ __volatile__ ("cbi 0x0B,1") //D.1# TXD/D PORTD.1 -#define set_enable __asm__ __volatile__ ("sbi 0x08,1") //C.1# ENABLE PORTC.1 -#define clr_enable __asm__ __volatile__ ("cbi 0x08,1") //C.1# ENABLE PORTC.1 -#define set_rxon __asm__ __volatile__ ("sbi 0x0B,5") //D.5# RXON PORTD.5 -#define clr_rxon __asm__ __volatile__ ("cbi 0x0B,5") //D.5# RXON PORTD.5 -#define set_txon __asm__ __volatile__ ("sbi 0x05,0") //B.0# TXON PORTB.0 -#define clr_txon __asm__ __volatile__ ("cbi 0x05,0") //B.0# TXON PORTB.0 -#define set_pupwr __asm__ __volatile__ ("sbi 0x0B,2") //D.2# PU_PWR PORTD.2 -#define clr_pupwr __asm__ __volatile__ ("cbi 0x0B,2") //D.2# PU_PWR PORTD.2 -#define set_nole __asm__ __volatile__ ("sbi 0x05,1") //B.1# OLE PORTB.1 -#define clr_nole __asm__ __volatile__ ("cbi 0x05,1") //B.1# OLE PORTB.1 -#define in_rxd input(PIND)&0x01 //# RXD PIND.0 -//----->Hardware Definitions<-----// - -//----->RF-Config-Word-Defines<-----// -#define TXEN 0x01 // XXX -#define RXEN 0x00 // XXX -#define CH00TX 0x1B -#define CH00RX 0x1C -//----->RF-Config-Word-Defines<-----// - -//----->RF-Timing-Defines<-----// - // T_SLOT == 1ms ==> every 1000us 48 Bytes of payload are exchanged -#define POLL_LOOPS 1 -#define T_1ms 1728 // Exact -> 1000us -#define T_PWR_UP_TX 69 // 69 == 40us (39.93) -#define T_LOOP_TX 341 // 341 == 197us (197.34) -#define T_START_TX 59 // 59 == 34us (34.14) -#define T_TX2RX 1259 // 1259 == 728us (728.59) -#define T_PWR_UP_RX 69 // 69 == 40us (39.93) -#define T_LOOP_RX 139 // 139 == 80us (80.44) -#define T_RX_ON 260 // 260 == 150us (150.46) -#define T_MAX_PAC_RX 1088 // 1088 == 630us (629.62) -#define T_RX2TX 172 // 172 == 100us (99.54) - // ==> 48KB/second (384.000bps) -//----->RF-Timing-Defines<-----// - -#endif Copied: firmware/rf/trunk/defines.h (from rev 1253, firmware/fuxrf/trunk/defines.h) =================================================================== --- firmware/rf/trunk/defines.h (rev 0) +++ firmware/rf/trunk/defines.h 2008-06-24 10:16:32 UTC (rev 1254) @@ -0,0 +1,228 @@ +//***************************************************************************** +//* Project: RF-Firmware Point to Multipoint for ISM - Transceiver ATR2406 * +//* Version: V1.0 * +//* File: defines.h * +//* Target MCU: ATMega88 * +//* Compiler: GCC * +//* Simulator: AVRStudio 4.08 * +//* Emulator: JTAG ICE * +//* Author: Christian Bechter * +//* Date: 31.01.06 * +//* Used Hardware: DEV-KIT-III * +//***************************************************************************** +//***************************************************************************** +//* Copyright 2006, Atmel Germany GmbH * +//* * +//* This software is owned by the Atmel Germany GmbH * +//* and is protected by and subject to worldwide patent protection. * +//* Atmel hereby grants to licensee a personal, * +//* non-exclusive, non-transferable license to copy, use, modify, create * +//* derivative works of, and compile the Atmel Source Code and derivative * +//* works for the sole purpose of creating custom software in support of * +//* licensee product to be used only in conjunction with a Atmel integrated * +//* circuit as specified in the applicable agreement. Any reproduction, * +//* modification, translation, compilation, or representation of this * +//* software except as specified above is prohibited without the express * +//* written permission of Atmel. * +//* * +//* Disclaimer: ATMEL MAKES NO WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, * +//* WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * +//* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * +//* Atmel reserves the right to make changes without further notice to the * +//* materials described herein. Atmel does not assume any liability arising * +//* out of the application or use of any product or circuit described herein. * +//* Atmel does not authorize its products for use as critical components in * +//* life-support systems where a malfunction or failure may reasonably be * +//* expected to result in significant injury to the user. The inclusion of * +//* Atmel products in a life-support systems application implies that the * +//* manufacturer assumes all risk of such use and in doing so indemnifies * +//* Atmel against all charges. * +//* * +//* Use may be limited by and subject to the applicable Atmel software * +//* license agreement. * +//***************************************************************************** +#ifndef DEFINES_H +#define DEFINES_H + +//include defines for target MCU +#include <avr/io.h> +#include <compat/ina90.h> +#include <avr/interrupt.h> +#include <avr/pgmspace.h> +#include <avr/eeprom.h> + +//**Define the used HOPPING SCHEME**// +//#define HOPPING +#define NOHOPP +#define TRX_CHANNEL 4 +//#define CYCHOPP +//**Define the used HOPPING SCHEME**// + +#define TXEN 0x01 +#define RXEN 0x00 +#define CONNECTED 0x80 + +#define TXING 0x08 +#define RXING 0x04 +#define MASTER 0x40 +#define SLAVE 0x80 + +//returns the address owned by the given label in registers R31:R30 +/* XXX ? delete? */ +#define GET_LABEL_ADDRESS(addr)\ +{\ + __asm__ __volatile__ ("\n"::"z"(addr));\ +} + +#define _NIX __asm__ __volatile__ ("nop") +//Hardware Definitions + +#define CLOCK_PORT PORTD +#define CLOCK_DDR DDRD +#define CLOCK_OUT PD4 +#define DATA_PORT PORTD +#define DATA_DDR DDRD +#define DATA_OUT PD1 +#define ENABLE_PORT PORTC +#define ENABLE_DDR DDRC +#define ENABLE_OUT PC1 +#define RXON_PORT PORTD +#define RXON_DDR DDRD +#define RXON_OUT PD5 +#define TXON_PORT PORTB +#define TXON_DDR DDRB +#define TXON_OUT PB0 +#define PUPWR_PORT PORTD +#define PUPWR_DDR DDRD +#define PUPWR_OUT PD2 +#define nOLE_PORT PORTB +#define nOLE_DDR DDRB +#define nOLE_OUT PB1 + +#define set_clock() (CLOCK_PORT |= _BV(CLOCK_OUT)) +#define clr_clock() (CLOCK_PORT &= ~_BV(CLOCK_OUT)) +#define set_data() (DATA_PORT |= _BV(DATA_OUT)) +#define clr_data() (DATA_PORT &= ~_BV(DATA_OUT)) +#define set_enable() (ENABLE_PORT |= _BV(ENABLE_OUT)) +#define clr_enable() (ENABLE_PORT &= ~_BV(ENABLE_OUT)) +#define set_rxon() (RXON_PORT |= _BV(RXON_OUT)) +#define clr_rxon() (RXON_PORT &= ~_BV(RXON_OUT)) +#define set_txon() (TXON_PORT |= _BV(TXON_OUT)) +#define clr_txon() (TXON_PORT &= ~_BV(TXON_OUT)) +#define set_pupwr() (PUPWR_PORT |= _BV(PUPWR_OUT)) +#define clr_pupwr() (PUPWR_PORT &= ~_BV(PUPWR_OUT)) +#define set_nole() (nOLE_PORT |= _BV(nOLE_OUT)) +#define clr_nole() (nOLE_PORT &= ~_BV(nOLE_OUT)) + +#define in_rxd input(PIND)&0x01 //# RXD PIND.0 +//Hardware Definitions + +//----->RF-Specifc-Defines<-----// +/* S[SC] of channel 0 in TX mode, p. 10 of datasheet */ +#define CH00TX 27 +/* S[SC] of channel 0 in RX mode, p. 10 of datasheet */ +#define CH00RX 28 +//----->RF-Specifc-Defines<-----// + + //T_SLOT == 1ms ==> every 1000us 48Bytes of payload are exchanged + #define POLL_LOOPS 4 + #define T_1ms 1728 //exact -> 1000us + #define T_PWR_UP_TX 69 //69 == 40us(39.93) + #define T_LOOP_TX 363 //363 == 210us(210.07) + #define T_TX2RX 1296 //1296 == 750us(749.99) + #define T_PWR_UP_RX 69 //69 == 40us(39.93) + #define T_LOOP_RX 276 //276 == 160us(159.72) + #define T_RX_ON 87 //87 == 50us(50.35) + #define T_MAX_PAC_RX 1124 //1124 == 650us(650.46) + #define T_RX2TX 172 //172 == 100us(99.54) + #define T_TS_SOLL 979 //979 == 566.32us(566.55) + #define T_START_SYNC 1086//1065 - 31 //(1065 - 31) == 616.32us(616.09) [31 == calc time!!(17.94us)] + #define T_SYNC 1086//1065 //1065 == 616.32(616.32) + // ==> 48KB/second (384.000bps) + +/* + //T_SLOT == 1.1ms ==> every 1100us 48Bytes of payload are exchanged + #define POLL_LOOPS 2 + #define T_1100us 1901 // -> 1100us(1100.11574) + #define T_PWR_UP_TX 70 //70 == 40us(40.51) + #define T_LOOP_TX 535 //535 == 310us(309.61) + #define T_TX2RX 1296 //1296 == 750us(749.99) + #define T_PWR_UP_RX 70 //70 == 40us(40.51) + #define T_LOOP_RX 448 //448 == 260us(259.26) + #define T_RX_ON 87 //87 == 50us(50.35) + #define T_MAX_PAC_RX 1124 //1124 == 650us(650.46) + #define T_RX2TX 172 //172 == 100us(99.54) + #define T_TS_SOLL 979 //979 == 566.32us(566.55) + #define T_START_SYNC 1065 - 31 //(1065 - 31) == 598.38us [31 == calc time!!(17.94us)] + #define T_SYNC 1065 //1065 == 616.32(616.32) + // ==> 43.6KB/second (349.090bps) +*/ +/* + //T_SLOT == 2ms ==> every 2000us 48Bytes of payload are exchanged + #define POLL_LOOPS 2 + #define T_2ms 3456 //exact -> 2000us + #define T_PWR_UP_TX 70 //70 == 40us(40.51) + #define T_LOOP_TX 605 //605 == 350us(350.11) + #define T_TX2RX 2781 //2781 == 1610us(1609.37) + #define T_PWR_UP_RX 70 //70 == 40us(40.51) + #define T_LOOP_RX 518 //518 == 300us(299.77) + #define T_RX_ON 87 //87 == 50us(50.35) + #define T_MAX_PAC_RX 1124 //1124 == 650us(650.46) + #define T_RX2TX 1657 //1657 == 960us(958.91) + #define T_START_SYNC 2550 - 31 //(2550 - 31) == 1475.69us [31 == calc time!!(17.94us)] + #define T_SYNC 2550 //2550 == 1475.69us + // ==> 24KB/second (192.000bps) +*/ +/* + //T_SLOT == 4ms ==> every 4000us 48Bytes of payload are exchanged + #define POLL_LOOPS 4 + #define T_4ms 6912 //exact -> 4000us + #define T_PWR_UP_TX 70 //70 == 40us(40.51) + #define T_LOOP_TX 605 //605 == 350us(350.11) + #define T_TX2RX 6237 //6237 == 3610us(3609.37) + #define T_PWR_UP_RX 70 //70 == 40us(40.51) + #define T_LOOP_RX 518 //518 == 300us(299.77) + #define T_RX_ON 87 //87 == 50us(50.35) + #define T_MAX_PAC_RX 1124 //1124 == 650us(650.46) + #define T_RX2TX 5113 //5113 == 2960us(2958.91) + #define T_START_SYNC 6006 - 31 //(6006 - 31) == 3475.69us [31 == calc time!!(17.94us)] + #define T_SYNC 6006 //6006 == 3475.69us + // ==> 12KB/second (96.000bps) +*/ +/* + //T_SLOT == 8ms ==> every 8000us 48Bytes of payload are exchanged + #define POLL_LOOPS 8 + #define T_8ms 13824 //exact -> 8000us + #define T_PWR_UP_TX 70 //70 == 40us(40.51) + #define T_LOOP_TX 605 //605 == 350us(350.11) + #define T_TX2RX 13149 //13149 == 7610us(7609.37) + #define T_PWR_UP_RX 70 //70 == 40us(40.51) + #define T_LOOP_RX 518 //518 == 300us(299.77) + #define T_RX_ON 87 //87 == 50us(50.35) + #define T_MAX_PAC_RX 1124 //1124 == 650us(650.46) + #define T_RX2TX 12025 //12025 == 6960us(6958.91) + #define T_START_SYNC 12918 - 31 //(12918 - 31) == 7475.69us [31 == calc time!!(17.94us)] + #define T_SYNC 12918 //12918 == 7475.69us + // ==> 6KB/second (48.000bps) +*/ +/* + //T_SLOT == 16ms ==> every 16000us 48Bytes of payload are exchanged + #define POLL_LOOPS 16 + #define T_16ms 27648 //exact -> 16000us + #define T_PWR_UP_TX 70 //70 == 40us(40.51) + #define T_LOOP_TX 605 //605 == 350us(350.11) + #define T_TX2RX 26973 //26973 == 15610us(15609.37) + #define T_PWR_UP_RX 70 //70 == 40us(40.51) + #define T_LOOP_RX 518 //518 == 300us(299.77) + #define T_RX_ON 87 //87 == 50us(50.35) + #define T_MAX_PAC_RX 1124 //1124 == 650us(650.46) + #define T_RX2TX 25849 //25849 == 14960us(14958.91) + #define T_START_SYNC 26742 - 31 //(26742 - 31) == 15475.69us [31 == calc time!!(17.94us)] + #define T_SYNC 26742 //26742 == 15475.69us + // ==> 3KB/second (24.000bps) +*/ +#define LED_ON __asm__ __volatile__ ("sbi 0x05,2") //B.2 +#define LED_OFF __asm__ __volatile__ ("cbi 0x05,2") //B.2 + +#endif + Deleted: firmware/rf/trunk/device.aps =================================================================== --- firmware/fuxrf/trunk/device.aps 2008-06-24 09:27:28 UTC (rev 1252) +++ firmware/rf/trunk/device.aps 2008-06-24 10:16:32 UTC (rev 1254) @@ -1 +0,0 @@ -<AVRStudio><MANAGEMENT><ProjectName>device</ProjectName><Created>10-Nov-2005 15:17:29</Created><LastEdit>01-Oct-2007 14:04:44</LastEdit><ICON>241</ICON><ProjectType>0</ProjectType><Created>10-Nov-2005 15:17:29</Created><Version>4</Version><Build>4, 12, 0, 454</Build><ProjectTypeName>AVR GCC</ProjectTypeName></MANAGEMENT><CODE_CREATION><ObjectFile>default\device.elf</ObjectFile><EntryFile></EntryFile><SaveFolder>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET>JTAGICE mkII</CURRENT_TARGET><CURRENT_PART>ATmega168</CURRENT_PART><BREAKPOINTS></BREAKPOINTS><IO_EXPAND><Item>51</Item><Item>580</Item><Item>103</Item><Item>17</Item><HIDE>false</HIDE></IO_EXPAND><REGISTERNAMES><Register>R00</Register><Register>R01</Register><Register>R02</Register><Register>R03</Register><Register>R04</Register><Register>R05</Register><Register>R06</Register><Register>R07</Register><Register>R08</Register><Register>R09</Register><Register>R10</Register><Register>R11</Register><Register>R12</Register><Register>R13</Register><Register>R14</Register><Register>R15</Register><Register>R16</Register><Register>R17</Register><Register>R18</Register><Register>R19</Register><Register>R20</Register><Register>R21</Register><Register>R22</Register><Register>R23</Register><Register>R24</Register><Register>R25</Register><Register>R26</Register><Register>R27</Register><Register>R28</Register><Register>R29</Register><Register>R30</Register><Register>R31</Register></REGISTERNAMES><COM>Auto</COM><COMType>0</COMType><WATCHNUM>1</WATCHNUM><WATCHNAMES><Pane0><Variables>ts</Variables><Variables>i</Variables><Variables>rf_rx_state</Variables><Variables>checksum</Variables><Variables>protocol_flags</Variables><Variables>rf_buffer_tx</Variables><Variables>channel</Variables><Variables>FHAState</Variables><Variables>frequencyTable</Variables><Variables>commandStatus</Variables></Pane0><Pane1><Variables>ACKmode</Variables><Variables>sof_ary</Variables><Variables>toy_id_h</Variables><Variables>toy_id_l</Variables><Variables>prf_buffer_tx</Variables><Variables>rf_tx_counter</Variables><Variables>tx_pac_len</Variables><Variables>rf_buffer_rx1</Variables><Variables>rf_buffer_rx2</Variables><Variables>pspi_buffer_rx</Variables><Variables>rf_buffer_tx2</Variables><Variables>rf_buffer_tx1</Variables><Variables>pspi_buffer_tx</Variables><Variables>rf_header</Variables><Variables>rf_status</Variables><Variables>watchdog</Variables><Variables>gfilter</Variables><Variables>replaceFrequency</Variables><Variables>frequencyTable</Variables><Variables>commandBuffer</Variables><Variables>spiConfigFrame</Variables></Pane1><Pane2></Pane2><Pane3></Pane3></WATCHNAMES><BreakOnTrcaeFull>0</BreakOnTrcaeFull></DEBUG_TARGET><Debugger><modules><module><map private="C:\Documents and Settings\Pascal\Desktop\TUX\Dongle\RF\Branches\RF_test\Branches\" public=""/><map private="C:\Documents and Settings\Pascal\Desktop\TUX\Dongle\RF\New_timing\" public=""/></module></modules><Triggers></Triggers></Debugger><AVRGCCPLUGIN><FILES><SOURCEFILE>device.c</SOURCEFILE><SOURCEFILE>init.c</SOURCEFILE><SOURCEFILE>misc.c</SOURCEFILE><SOURCEFILE>prot.c</SOURCEFILE><SOURCEFILE>rf_ctrl.c</SOURCEFILE><SOURCEFILE>varis.c</SOURCEFILE><SOURCEFILE>spi.c</SOURCEFILE><SOURCEFILE>bootloader.c</SOURCEFILE><HEADERFILE>varis.h</HEADERFILE><HEADERFILE>init.h</HEADERFILE><HEADERFILE>misc.h</HEADERFILE><HEADERFILE>prot.h</HEADERFILE><HEADERFILE>rf_ctrl.h</HEADERFILE><HEADERFILE>defines.h</HEADERFILE><HEADERFILE>bootloader.h</HEADERFILE><HEADERFILE>spi.h</HEADERFILE><HEADERFILE>version.h</HEADERFILE><HEADERFILE>common\commands.h</HEADERFILE><OTHERFILE>default\device.lss</OTHERFILE><OTHERFILE>default\device.map</OTHERFILE></FILES><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>NO</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE></EXTERNALMAKEFILE><PART>atmega48</PART><HEX>1</HEX><LIST>1</LIST><MAP>1</MAP><OUTPUTFILENAME>device.elf</OUTPUTFILENAME><OUTPUTDIR>default\</OUTPUTDIR><ISDIRTY>1</ISDIRTY><OPTIONS><OPTION><FILE>bootloader.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>device.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>init.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>misc.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>prot.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>rf_ctrl.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>spi.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>varis.c</FILE><OPTIONLIST></OPTIONLIST></OPTION></OPTIONS><INCDIRS/><LIBDIRS/><LIBS/><LINKOBJECTS/><OPTIONSFORALL>-Wall -gdwarf-2 -DF_CPU=13824000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums</OPTIONSFORALL><LINKEROPTIONS>-Wl,--section-start=.bootloader=0x0F00 -Wl,--section-start=.version=0x0EF0</LINKEROPTIONS><SEGMENTS><SEGMENT><NAME>.buffer_tx1</NAME><SEGMENT>SRAM</SEGMENT><ADDRESS>0x100</ADDRESS></SEGMENT><SEGMENT><NAME>.buffer_rx1</NAME><SEGMENT>SRAM</SEGMENT><ADDRESS>0x140</ADDRESS></SEGMENT><SEGMENT><NAME>.sof</NAME><SEGMENT>SRAM</SEGMENT><ADDRESS>0x1e6</ADDRESS></SEGMENT><SEGMENT><NAME>.globals</NAME><SEGMENT>SRAM</SEGMENT><ADDRESS>0x1ea</ADDRESS></SEGMENT><SEGMENT><NAME>.buffer_tx2</NAME><SEGMENT>SRAM</SEGMENT><ADDRESS>0x173</ADDRESS></SEGMENT><SEGMENT><NAME>.buffer_rx2</NAME><SEGMENT>SRAM</SEGMENT><ADDRESS>0x1b3</ADDRESS></SEGMENT></SEGMENTS></CONFIG></CONFIGS><LASTCONFIG>default</LASTCONFIG><USES_WINAVR>1</USES_WINAVR><GCC_LOC>C:\WinAVR-20060421\bin\avr-gcc.exe</GCC_LOC><MAKE_LOC>C:\WinAVR-20060421\utils\bin\make.exe</MAKE_LOC></AVRGCCPLUGIN><IOView><usergroups/></IOView><ProjectFiles><Files><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\varis.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\init.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\misc.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\prot.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\rf_ctrl.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\defines.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\bootloader.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\spi.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\version.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\common\commands.h</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\device.c</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\init.c</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\misc.c</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\prot.c</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\rf_ctrl.c</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\varis.c</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\spi.c</Name><Name>C:\Documents and Settings\david\My Documents\tux\firmware\fuxrf\trunk\bootloader.c</Name></Files></ProjectFiles><Files><File00000><FileId>00000</FileId><FileName>device.c</FileName><Status>1</Status></File00000><File00001><FileId>00001</FileId><FileName>prot.c</FileName><Status>258</Status></File00001><File00002><FileId>00002</FileId><FileName>rf_ctrl.c</FileName><Status>258</Status></File00002><File00003><FileId>00003</FileId><FileName>init.c</FileName><Status>258</Status></File00003><File00004><FileId>00004</FileId><FileName>misc.c</FileName><Status>258</Status></File00004><File00005><FileId>00005</FileId><FileName>spi.c</FileName><Status>258</Status></File00005><File00006><FileId>00006</FileId><FileName>rf_ctrl.h</FileName><Status>1</Status></File00006></Files><Workspace><File00000><Position>329 132 1321 417</Position><LineCol>0 0</LineCol></File00000><File00006><Position>303 72 1391 507</Position><LineCol>48 49</LineCol><State>Maximized</State></File00006></Workspace><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio> Deleted: firmware/rf/trunk/device.c =================================================================== --- firmware/fuxrf/trunk/device.c 2008-06-24 09:27:28 UTC (rev 1252) +++ firmware/rf/trunk/device.c 2008-06-24 10:16:32 UTC (rev 1254) @@ -1,114 +0,0 @@ -#include <avr/wdt.h> -#include <stdlib.h> -#include "defines.h" -#include "init.h" -#include "misc.h" -#include "varis.h" -#include "prot.h" -#include "rf_ctrl.h" -#include "spi.h" -#include "common/commands.h" -#include "version.h" - -/* - * Configuration - */ -/* Bootloader can be included with the program. */ -#define BOOTLOADER 1 -/* Include version numbers. */ -#define VERSIONING 1 - -/* - * Version number - */ - -#define CPU_NUMBER FUXRF_CPU_NUM /* sound CPU */ - -#if (VERSIONING) -/* XXX Add the linker script to have fixed version positions once the project will compile with latest gcc under linux. */ -const author_t author __attribute__ ((section(".version"))) = -{ - AUTHOR_CMD, AUTHOR_ID, 0, -}; -const revision_t svn_revision __attribute__ ((section(".version"))) = -{ - REVISION_CMD, SVN_REV, SVN_STATUS, -}; -const version_t tag_version __attribute__ ((section(".version"))) = -{ - VERSION_CMD, CPU_VER_JOIN(CPU_NUMBER, VER_MAJOR), VER_MINOR, VER_UPDATE, -}; -#endif - -#if (BOOTLOADER) -#include "bootloader.h" -#endif - -#ifdef WIFI -const unsigned char OffsetTbl[] = - { 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41 }; -#endif - -//***************************************************************************** -//* Project: RF-Firmware for ISM * -//* Function: main * -//* Parameters: NONE * -//* Returns: NONE * -//* Action: Main routine of the Device * -//* Duration: tbd * -//* Size: tbd * -//* Date: 26.06.07 * -//* Description: Get connected to the tux, manage sleep mode and SPI * -//***************************************************************************** - -//MASTER -int main(void) -{ -#if (BOOTLOADER) - if (!(PINB & 0x04)) /* if SPI_SS is cleared at startup */ - asm volatile ("rjmp bootloader"::); /* jump to bootloader */ -#endif - - init_avr(); // System init - init_varis(); // Init variables - spiTransaction(); // Spi transaction to recieve -// spiConfigFrame[5] = 6; -// spiConfigFrame[6] = 32; - generate_frequency_sequence(); // Generate hopping sequence - init_frame_RF(); // Init RF frame - sei(); - gfilter = eeprom_read_byte(&ee_filter); // Read gaussian filter into the eeprom - if (gfilter == 0xFF) // No value program in the eeprom - gfilter = 5; - gfilter = (gfilter << 1); // Configure gaussian filter - system_start_up(); // Start RF connection - PORTD &= ~0x80; // On line radio - - while (1) // Infinite main loop - { -#ifdef WIFI - if (FHAState == COMPUTE_FREQ) - { - while (1) - { - replaceFrequency += OffsetTbl[random_numb]; // Calculate next channel - if (replaceFrequency >= 93) - replaceFrequency -= 91; - random_numb++; - if (random_numb == 12) - random_numb = 0; - if ((replaceFrequency < spiConfigFrame[5]) - || (replaceFrequency > spiConfigFrame[6])) - break; - } - FHAState = WAIT_ACK_CHF; - } -#endif - - if (spi_enable) // Spi transaction ready - { - spi_enable = 0; // Reset spi flag - spiTransaction(); - } - } -} Copied: firmware/rf/trunk/device.c (from rev 1253, firmware/fuxrf/trunk/device.c) =================================================================== --- firmware/rf/trunk/device.c (rev 0) +++ firmware/rf/trunk/device.c 2008-06-24 10:16:32 UTC (rev 1254) @@ -0,0 +1,106 @@ +//***************************************************************************** +//* Project: RF-Firmware Point to Multipoint for ISM - Transceiver ATR2406 * +//* Version: V1.0 * +//* File: appl.c * +//* Target MCU: ATMega88 * +//* Compiler: GCC * +//* Simulator: AVRStudio 4.08 * +//* Emulator: JTAG ICE * +//* Author: Christian Bechter * +//* Date: 31.01.06 * +//* Used Hardware: DEV-KIT-III * +//***************************************************************************** +//***************************************************************************** +//* Copyright 2006, Atmel Germany GmbH * +//* * +//* This software is owned by the Atmel Germany GmbH * +//* and is protected by and subject to worldwide patent protection. * +//* Atmel hereby grants to licensee a personal, * +//* non-exclusive, non-transferable license to copy, use, modify, create * +//* derivative works of, and compile the Atmel Source Code and derivative * +//* works for the sole purpose of creating custom software in support of * +//* licensee product to be used only in conjunction with a Atmel integrated * +//* circuit as specified in the applicable agreement. Any reproduction, * +//* modification, translation, compilation, or representation of this * +//* software except as specified above is prohibited without the express * +//* written permission of Atmel. * +//* * +//* Disclaimer: ATMEL MAKES NO WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, * +//* WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * +//* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * +//* Atmel reserves the right to make changes without further notice to the * +//* materials described herein. Atmel does not assume any liability arising * +//* out of the application or use of any product or circuit described herein. * +//* Atmel does not authorize its products for use as critical components in * +//* life-support systems where a malfunction or failure may reasonably be * +//* expected to result in significant injury to the user. The inclusion of * +//* Atmel products in a life-support systems application implies that the * +//* manufacturer assumes all risk of such use and in doing so indemnifies * +//* Atmel against all charges. * +//* * +//* Use may be limited by and subject to the applicable Atmel software * +//* license agreement. * +//***************************************************************************** + +#include "defines.h" +#include "init.h" +#include "interface.h" +#include "misc.h" +#include "varis.h" +#include "prot.h" +#include "rf_ctrl.h" + +#define DBG_STACK 1 + +#if (DBG_STACK) +extern uint16_t __heap_start; +void init_ram(void) __attribute__ ((naked)) + __attribute__ ((section(".init1"))); +void init_ram(void) +{ + uint8_t *ptr; + + for (ptr = (uint8_t *) &__heap_start; ptr < (uint8_t *) 0x800300; ptr++) + *ptr = 0x5F; +} +#endif + +//***************************************************************************** +//* Project: RF-Firmware for ISM * +//* Function: main * +//* Parameters: NONE * +//* Returns: NONE * +//* Action: Main routine of the Device * +//* Duration: tbd * +//* Size: tbd * +//* Date: 31.01.06 * +//* Description: Get connected to the Basestation, get values from the sensors* +//* and digital I/O * +//***************************************************************************** +//***************************************************************************** +// SETUP of RF_BUFFER_TX: * +// 0 - 5 -> Preamble * +// 6 - 7 -> Sync * +// 8 - 11 -> SOF * +// 12 -> LEN * +// 13 -> Command * +// 14 - 30 -> Payload * +// 31 -> Checksum * +//***************************************************************************** +int main(void) +{ + /* System init */ + init_avr(); + init_varis(); + interface_init(); + + /* XXX debug */ + DDRB |= _BV(PB3) | _BV(PB5); + DDRC |= _BV(PC3); + + + sei(); + system_start_up(); + for(;;){ + } +} Deleted: firmware/rf/trunk/init.c =================================================================== --- firmware/fuxrf/trunk/init.c 2008-06-24 09:27:28 UTC (rev 1252) +++ firmware/rf/trunk/init.c 2008-06-24 10:16:32 UTC (rev 1254) @@ -1,167 +0,0 @@ -#include "defines.h" -#include "init.h" -#include "varis.h" -#include "misc.h" - -//***************************************************************************** -//* Project: RF-Firmware for ISM * -//* Function: init_avr * -//* Parameters: NONE * -//* Returns: NONE * -//* Action: Basic setup of AVR * -//* Duration: tbd * -//* Size: tbd * -//* Date: 10.07.06 * -//* Description: Basic setup of the AVR I/O and for the RF-USART * -//***************************************************************************** -void init_avr(void) -{ - //init of AVR ports - //*************PORTB*************// - //PORTB.0 -> OUT TXON - //PORTB.1 -> OUT nOLE - //PORTB.2 -> IN CS - //PORTB.3 -> IN MOSI - //PORTB.4 -> OUT MISO - //PORTB.5 -> IN SCK - //PORTB.6 -> XTAL1 - //PORTB.7 -> XTAL2 (output to RF - Chip) - output(PORTB, 0x20); - output(DDRB, 0x13); - //*************PORTB*************// - //*************PORTC*************// - //PORTC.0 -> OUT READY SPI - //PORTC.1 -> OUT Enable - //PORTC.2 -> OUT READY SPI - //PORTC.3 -> OUT DEBUFG RF - //PORTC.4 -> NOT USED, PULLED UP - //PORTC.5 -> NOT USED, PULLED UP - //PORTC.6 -> DEBUG - PIN - output(PORTC, 0x31); - output(DDRC, 0x1F); - //*************PORTC*************// - //*************PORTD*************// - //PORTD.0 -> IN RX_DATA - //PORTD.1 -> OUT TX_DATA/Data - //PORTD.2 -> OUT PU_TRX/PU_REG - //PORTD.3 -> IN RESET LINE - //PORTD.4 -> I/O CLK_REC/Clock - //PORTD.5 -> OUT RXON - //PORTD.6 -> NOT USED, PULLED UP - //PORTD.7 -> OUT ON LINE - output(PORTD, 0xC0); - output(DDRD, 0xA6); - //*************PORTD*************// - //***********init-needed-peripherals***************// - output(UBRR0L, 0x05); - //***********init-needed-peripherals***************// - - SPCR = 0x40; /* XXX what's this for? */// Slave - SPSR = 0x00; - - /* Clear the SPI interrupt flag. XXX is this necessary at startup? */ - asm volatile - ("in __tmp_reg__, %0" "\n\t" - "in __tmp_reg__, %1" "\n\t" - ::"I" (_SFR_IO_ADDR(SPSR)), - "I"(_SFR_IO_ADDR(SPDR))); -} - -//***************************************************************************** -//* Project: RF-Firmware for ISM * -//* Function: init_varis * -//* Parameters: NONE * -//* Returns: NONE * -//* Action: init of the global variables * -//* Duration: tbd * -//* Size: tbd * -//* Date: 10.07.06 * -//* Description: global variables are init with their default values * -//***************************************************************************** -void init_varis(void) -{ - uint8_t i; - - i = input(SPL); - i ^= 0xFF; - extern uint16_t __bss_start; - extern uint16_t __stack; - uint8_t *ptr = (uint8_t *) & __bss_start; - - while (ptr < (uint8_t *) & __stack - i) - { /*sub because of returning of subroutine */ - *ptr++ = 0; - } // Reduce 26 bytes - - rx_buffer_ready = 0x00; - frameCmpt = 0; // Counter of RF frame - frequencyIndex = 0; // Pointer for the table of frequency - FHAState = INIT; // Init of status of FHA state machine - statisticPointer = 0; // Pointer for the table with statistic for FHA - spi_enable = 0; // Flag to start spi transaction - errorFrame = 0; // Detect error in transmission - commandStatus = 0; // Status of the command - ACKmode = 0; // Wait an ACK - - prf_buffer_rx = rf_buffer_rx1; // Init pointer for RF transaction - pspi_buffer_rx = rf_buffer_rx2; // Init pointer for SPI transaction - prf_buffer_tx = rf_buffer_tx1; // Init pointer for RF transaction - pspi_buffer_tx = rf_buffer_tx2; // Init pointer for SPI transaction -} - -//***************************************************************************** -//* Project: RF-Firmware for ISM * -//* Function: init_frame_RF * -//* Parameters: NONE * -//* Returns: NONE * -//* Action: init of TX buffer and compute checksum * -//* Duration: tbd * -//* Size: tbd * -//* Date: 26.06.07 * -//* Description: Init the TX buffers with the starting values * -//***************************************************************************** -void init_frame_RF(void) -{ - unsigned char i, header_rf; - - header_rf = SMALLFRAME; // First byte header of the frame - header_rf |= MASTERH; - - if (spiConfigFrame[1] == 0xFF) // Special mode - { - if (spiConfigFrame[3] == 0xFF) // Request ID - { - header_rf |= REQUESTID; - } - else // Change ID - { - header_rf |= CHANGEID; - } - } - - for (i = 0; i < 11; i++) - { - rf_buffer_tx1[i] = 0x55; // Preamble - rf_buffer_tx2[i] = 0x55; // Preamble - } - - for (i = 11; i < 13; i++) - { - rf_buffer_tx1[i] = 0xFF; // Synchro - rf_buffer_tx2[i] = 0xFF; // Synchro - } - - rf_buffer_tx1[14] = rf_buffer_tx2[14] = sof_ary[1] = spiConfigFrame[0]; // Set ID - rf_buffer_tx1[15] = rf_buffer_tx2[15] = sof_ary[2] = spiConfigFrame[1]; - rf_buffer_tx1[16] = rf_buffer_tx2[16] = header_rf; - if (spiConfigFrame[4] == 0x01) // Wake up from PC - rf_buffer_tx1[17] = rf_buffer_tx2[17] = 0x20; // Second byte header of the frame - else - rf_buffer_tx1[17] = rf_buffer_tx2[17] = 0x00; // Second byte header of the frame - - rf_buffer_tx1[18] = rf_buffer_tx2[18] = spiConfigFrame[2]; // Hopping parameters Index (dummy) / Toy ID for init - rf_buffer_tx1[19] = rf_buffer_tx2[19] = spiConfigFrame[3]; // Hopping parameters Channel (dummy) / Toy ID for init - rf_buffer_tx1[20] = rf_buffer_tx2[20] = 0x55; - calc_checksum(rf_buffer_tx1); - calc_checksum(rf_buffer_tx2); -} Copied: firmware/rf/trunk/init.c (from rev 1253, firmware/fuxrf/trunk/init.c) =================================================================== --- firmware/rf/trunk/init.c (rev 0) +++ firmware/rf/trunk/init.c 2008-06-24 10:16:32 UTC (rev 1254) @@ -0,0 +1,208 @@ +//***************************************************************************** +//* Project: RF-Firmware Point to Multipoint for ISM - Transceiver ATR2406 * +//* Version: V1.0 * +//* File: init.c * +//* Target MCU: ATMega88 * +//* Compiler: GCC * +//* Simulator: AVRStudio 4.08 * +//* Emulator: JTAG ICE * +//* Author: Christian Bechter * +//* Date: 31.01.06 * +//* Used Hardware: DEV-KIT-III * +//***************************************************************************** +//***************************************************************************** +//* Copyright 2006, Atmel Germany GmbH * +//* * +//* This software is owned by the Atmel Germany GmbH * +//* and is protected by and subject to worldwide patent protection. * +//* Atmel hereby grants to licensee a personal, * +//* non-exclusive, non-transferable license to copy, use, modify, create * +//* derivative works of, and compile the Atmel Source Code and derivative * +//* works for the sole purpose of creating custom software in support of * +//* licensee product to be used only in conjunction with a Atmel integrated * +//* circuit as specified in the applicable agreement. Any reproduction, * +//* modification, translation, compilation, or representation of this * +//* software except as specified above is prohibited without the express * +//* written permission of Atmel. * +//* * +//* Disclaimer: ATMEL MAKES NO WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, * +//* WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * +//* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * +//* Atmel reserves the right to make changes without further notice to the * +//* materials described herein. Atmel does not assume any liability arising * +//* out of the application or use of any product or circuit described herein. * +//* Atmel does not authorize its products for use as critical components in * +//* life-support systems where a malfunction or failure may reasonably be * +//* expected to result in significant injury to the user. The inclusion of * +//* Atmel products in a life-support systems application implies that the * +//* manufacturer assumes all risk of such use and in doing so indemnifies * +//* Atmel against all charges. * +//* * +//* Use may be limited by and subject to the applicable Atmel software * +//* license agreement. * +//***************************************************************************** + +#include "defines.h" +#include "init.h" +#include "varis.h" + + + +//***************************************************************************** +//* Project: RF-Firmware for ISM * +//* Function: init_avr * +//* Parameters: NONE * +//* Returns: NONE * +//* Action: Basic setup of AVR * +//* Duration: tbd * +//* Size: tbd * +//* Date: 31.01.06 * +//* Description: Basic setup of the AVR I/O and for the RF-USART * +//***************************************************************************** +void init_avr(void) +{ + //init of AVR ports + //*************PORTB*************// + //PORTB.0 -> OUT TXON + //PORTB.1 -> OUT nOLE + //PORTB.2 -> IN SS + //PORTB.3 -> IN MOSI + //PORTB.4 -> OUT MISO + //PORTB.5 -> IN SCK + //PORTB.6 -> XTAL1 + //PORTB.7 -> XTAL2 (output to RF - Chip) + PORTB = 0x20; + DDRB = 0x13; + //*************PORTB*************// + //*************PORTC*************// + //PORTC.0 -> SPIACK + //PORTC.1 -> OUT Enable + //PORTC.2 -> TXE (TX [register] empty) + //PORTC.3 -> NOT USED, PULLED UP + //PORTC.4 -> NOT USED, PULLED UP + //PORTC.5 -> NOT USED, PULLED UP + //PORTC.6 -> RESET + PORTC = 0x38; + DDRC = 0x07; + //*************PORTC*************// + //*************PORTD*************// + //PORTD.0 -> IN RX_DATA + //PORTD.1 -> OUT TX_DATA/Data + //PORTD.2 -> OUT PU_TRX/PU_REG + //PORTD.3 -> OUTPUT DEBUG + //PORTD.4 -> I/O CLK_REC/Clock + //PORTD.5 -> OUT RXON + //PORTD.6 -> NOT USED, PULLED UP + //PORTD.7 -> LINK + PORTD = 0x40; + DDRD = 0xAE; + //*************PORTD*************// + //***********init-needed-peripherals***************// + UBRR0L = 0x05; + //***********init-needed-peripherals***************// + /* Disable UART */ + UCSR0A = 0x00; + UCSR0B = 0x00; + UCSR0C = 0x00; + + /* Disable interrupts. */ + TIMSK1 = 0x00; +} +//***************************************************************************** +//* Project: RF-Firmware for ISM * +//* Function: init_varis * +//* Parameters: NONE * +//* Returns: NONE * +//* Action: init of the global variables * +//* Duration: tbd * +//* Size: tbd * +//* Date: 31.01.06 * +//* Description: global variables are init with their default values * +//***************************************************************************** +void init_varis(void) +{ + //************************************************************************* + // SETUP of RF_BUFFER_TX: * + // 0 - 5 -> Preamble * + // 6 - 7 -> Sync * + // 8 - 11 -> SOF * + // 12 -> LEN * + // 13 -> Command * + // 14 - 30 -> Payload * + // 31 -> Checksum * + //************************************************************************* + //Default setup of the rf_buffer_tx// + rf_buffer_tx[0] = rf_buffer_tx[1] = rf_buffer_tx[2] = 0x55 ^ SCRAMBLE_BYTE; + rf_buffer_tx[3] = rf_buffer_tx[4] = rf_buffer_tx[5] = 0x55 ^ SCRAMBLE_BYTE; + rf_buffer_tx[6] = rf_buffer_tx[7] = 0xFF ^ SCRAMBLE_BYTE; + //Default setup of the rf_buffer_tx// + /* XXX to be cleaned */ + sof_ary[0] = TRX_CHANNEL; + sof_ary[1] = 0x56; + sof_ary[2] = 0xFF; + sof_ary[3] = 0x56; + rf_buffer_tx[8]=channel; + rf_buffer_tx[9]=sof_ary[1]; + rf_buffer_tx[10]=sof_ary[2]; + rf_buffer_tx[11]=sof_ary[3]; + + //generate dummy packet + rf_buffer_tx[12]=52; /* Number of bytes from here */ + rf_buffer_tx[13]=0x55; + rf_buffer_tx[14]=0x55; + rf_buffer_tx[15]=0x55; + rf_buffer_tx[16]=0x55; + rf_buffer_tx[17]=0x55; + rf_buffer_tx[18]=0x55; + rf_buffer_tx[19]=0x55; + rf_buffer_tx[20]=0x55; + rf_buffer_tx[21]=0x55; + rf_buffer_tx[22]=0x55; + rf_buffer_tx[23]=0x55; + rf_buffer_tx[24]=0x55; + rf_buffer_tx[25]=0x55; + rf_buffer_tx[26]=0x55; + rf_buffer_tx[27]=0x55; + rf_buffer_tx[28]=0x55; + rf_buffer_tx[29]=0x55; + rf_buffer_tx[30]=0x55; + rf_buffer_tx[31]=0x55; + rf_buffer_tx[32]=0x55; + rf_buffer_tx[33]=0x55; + rf_buffer_tx[34]=0x55; + rf_buffer_tx[35]=0x55; + rf_buffer_tx[36]=0x55; + rf_buffer_tx[37]=0x55; + rf_buffer_tx[38]=0x55; + rf_buffer_tx[39]=0x55; + rf_buffer_tx[40]=0x55; + rf_buffer_tx[41]=0x55; + rf_buffer_tx[42]=0x55; + rf_buffer_tx[43]=0x55; + rf_buffer_tx[44]=0x55; + rf_buffer_tx[45]=0x55; + rf_buffer_tx[46]=0x55; + rf_buffer_tx[47]=0x55; + rf_buffer_tx[48]=0x55; + rf_buffer_tx[49]=0x55; + rf_buffer_tx[50]=0x55; + rf_buffer_tx[51]=0x55; + rf_buffer_tx[52]=0x55; + rf_buffer_tx[53]=0x55; + rf_buffer_tx[54]=0x55; + rf_buffer_tx[55]=0x55; + rf_buffer_tx[56]=0x55; + rf_buffer_tx[57]=0x55; + rf_buffer_tx[58]=0x55; + rf_buffer_tx[59]=0x55; + rf_buffer_tx[60]=0x55; + rf_buffer_tx[61]=0x55; + rf_buffer_tx[62]=0x55; + rf_buffer_tx[63]=0x34; /* Parity checksum manually calculated */ + + /*uint8_t i;*/ + /*for (i=13; i<63; i++)*/ + /*rf_buffer_tx[i] = 0x01;//1<<(i&7);*/ +} + + Deleted: firmware/rf/trunk/init.h =================================================================== --- firmware/fuxrf/trunk/init.h 2008-06-24 09:27:28 UTC (rev 1252) +++ firmware/rf/trunk/init.h 2008-06-24 10:16:32 UTC (rev 1254) @@ -1,10 +0,0 @@ -#ifndef INIT_H -#define INIT_H - -#include "defines.h" - -extern void init_avr(void); -extern void init_varis(void); -extern void init_frame_RF(void); - -#endif Copied: firmware/rf/trunk/init.h (from rev 1253, firmware/fuxrf/trunk/init.h) =================================================================== --- firmware/rf/trunk/init.h (rev 0) +++ firmware/rf/trunk/init.h 2008-06-24 10:16:32 UTC (rev 1254) @@ -0,0 +1,55 @@ +//***************************************************************************** +//* Project: RF-Firmware Point to Multipoint for ISM - Transceiver ATR2406 * +//* Version: V1.0 * +//* File: init.h * +//* Target MCU: ATMega88 * +//* Compiler: GCC * +//* Simulator: AVRStudio 4.08 * +//* Emulator: JTAG ICE * +//* Author: Christian Bechter * +//* Date: 31.01.06 * +//* Used Hardware: DEV-KIT-III * +//***************************************************************************** +//***************************************************************************** +//* Copyright 2006, Atmel Germany GmbH * +//* * +//* This software is owned by the Atmel Germany GmbH * +//* and is protected by and subject to worldwide patent protection. * +//* Atmel hereby grants to licensee a personal, * +//* non-exclusive, non-transferable license to copy, use, modify, create * +//* derivative works of, and compile the Atmel Source Code and derivative * +//* works for the sole purpose of creating custom software in support of * +//* licensee product to be used only in conjunction with a Atmel integrated * +//* circuit as specified in the applicable agreement. Any reproduction, * +//* modification, translation, compilation, or representation of this * +//* software except as specified above is prohibited without the express * +//* written permission of Atmel. * +//* * +//* Disclaimer: ATMEL MAKES NO WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, * +//* WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * +//* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * +//* Atmel reserves the right to make changes without further notice to the * +//* materials described herein. Atmel does not assume any liability arising * +//* out of the application or use of any product or circuit described herein. * +//* Atmel does not authorize its products for use as critical components in * +//* life-support systems where a malfunction or failure may reasonably be * +//* expected to result in significant injury to the user. The inclusion of * +//* Atmel products in a life-support systems application implies that the * +//* manufacturer assumes all risk of such use and in doing so indemnifies * +//* Atmel against all charges. * +//* * +//* Use may be limited by and subject to the applicable Atmel software * +//* license agreement. ... [truncated message content] |