[tuxdroid-svn] r1315 - firmware/rf/trunk
Status: Beta
Brought to you by:
ks156
From: jaguarondi <c2m...@c2...> - 2008-07-08 14:51:34
|
Author: jaguarondi Date: 2008-07-08 16:51:42 +0200 (Tue, 08 Jul 2008) New Revision: 1315 Modified: firmware/rf/trunk/init.c Log: * Cleanup. Modified: firmware/rf/trunk/init.c =================================================================== --- firmware/rf/trunk/init.c 2008-07-08 14:26:00 UTC (rev 1314) +++ firmware/rf/trunk/init.c 2008-07-08 14:51:42 UTC (rev 1315) @@ -1,109 +1,80 @@ -//***************************************************************************** -//* 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. * -//***************************************************************************** +/* + * [TF]UXRF - Firmware for the 2 RF CPU of tuxdroid (TUXRF and FUXRF) + * Copyright (C) 2007 KySoH S.A. <in...@ky...> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* $Id$ */ + #include "defines.h" #include "init.h" #include "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 * -//***************************************************************************** +/* + * Initialization of the AVR I/O and peripherals. + */ 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 -> PASCAL SAID NOT TO TOUCH THIS ONE - //PORTD.4 -> I/O CLK_REC/Clock - //PORTD.5 -> OUT RXON - //PORTD.6 -> NOT USED, PULLED UP - //PORTD.7 -> LINK - PORTD = 0x40; - DDRD = 0xA6; - //*************PORTD*************// - //***********init-needed-peripherals***************// - UBRR0L = 0x05; - //***********init-needed-peripherals***************// - /* Disable UART */ + /* + 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; + + /* + 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; + + /* + PORTD.0 -> IN RX_DATA + PORTD.1 -> OUT TX_DATA/Data + PORTD.2 -> OUT PU_TRX/PU_REG + PORTD.3 -> PASCAL SAID NOT TO TOUCH THIS ONE + PORTD.4 -> I/O CLK_REC/Clock + PORTD.5 -> OUT RXON + PORTD.6 -> NOT USED, PULLED UP + PORTD.7 -> LINK + */ + PORTD = 0x40; + DDRD = 0xA6; + + /* USART baud rate */ + UBRR0L = 0x05; + + /* Disable the USART for now */ UCSR0A = 0x00; UCSR0B = 0x00; UCSR0C = 0x00; - /* Disable interrupts. */ + /* Disable timer interrupt. */ TIMSK1 = 0x00; /* Read the gaussian filter setting */ @@ -113,8 +84,8 @@ { GFCS = 4; } - } + //***************************************************************************** //* Project: RF-Firmware for ISM * //* Function: init_varis * @@ -208,5 +179,3 @@ rf_buffer_tx[62]=0x55; rf_buffer_tx[63]=0x34; /* Parity checksum manually calculated */ } - - |