⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tinyos.txt

📁 tinyOS(1.x)contrib hsu pic18f4620 .platform
💻 TXT
📖 第 1 页 / 共 5 页
字号:
 * - Redistributions in binary form must reproduce the above copyright 
 *   notice, this list of conditions and the following disclaimer in the 
 *   documentation and/or other materials provided with the distribution.
 * - Neither the name of the Helmut-Schmidt-University nor the names 
 *   of its contributors may be used to endorse or promote products derived
 *   from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 
 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 
 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

/* @author Hans-Joerg Koerber 
 *         <hj.koerber at hsu-hh.de>
 *	   (+49)40-6541-2638/2627
 *
 * $Date: 2005/04/15 10:00:07 $
 * $Revision: 1.1 $
 *
 */


/*
 *  The following  polynomial is used: x^8+x^2+x^1+x^0
 *
 */

 int8_t crc8[256] =  {  0x00, 0x07, 0x0e, 0x09, 0x1c, 0x1b, 0x12, 0x15, 
			      0x38, 0x3f, 0x36, 0x31, 0x24, 0x23, 0x2a, 0x2d, 
		              0x70, 0x77, 0x7e, 0x79, 0x6c, 0x6b, 0x62, 0x65, 
			      0x48, 0x4f, 0x46, 0x41, 0x54, 0x53, 0x5a, 0x5d, 
			      0xe0, 0xe7, 0xee, 0xe9, 0xfc, 0xfb, 0xf2, 0xf5, 
			      0xd8, 0xdf, 0xd6, 0xd1, 0xc4, 0xc3, 0xca, 0xcd, 
			      0x90, 0x97, 0x9e, 0x99, 0x8c, 0x8b, 0x82, 0x85, 
			      0xa8, 0xaf, 0xa6, 0xa1, 0xb4, 0xb3, 0xba, 0xbd, 
			      0xc7, 0xc0, 0xc9, 0xce, 0xdb, 0xdc, 0xd5, 0xd2, 
			      0xff, 0xf8, 0xf1, 0xf6, 0xe3, 0xe4, 0xed, 0xea, 
			      0xb7, 0xb0, 0xb9, 0xbe, 0xab, 0xac, 0xa5, 0xa2, 
			      0x8f, 0x88, 0x81, 0x86, 0x93, 0x94, 0x9d, 0x9a, 
			      0x27, 0x20, 0x29, 0x2e, 0x3b, 0x3c, 0x35, 0x32, 
			      0x1f, 0x18, 0x11, 0x16, 0x03, 0x04, 0x0d, 0x0a, 
			      0x57, 0x50, 0x59, 0x5e, 0x4b, 0x4c, 0x45, 0x42, 
			      0x6f, 0x68, 0x61, 0x66, 0x73, 0x74, 0x7d, 0x7a, 
			      0x89, 0x8e, 0x87, 0x80, 0x95, 0x92, 0x9b, 0x9c, 
			      0xb1, 0xb6, 0xbf, 0xb8, 0xad, 0xaa, 0xa3, 0xa4, 
			      0xf9, 0xfe, 0xf7, 0xf0, 0xe5, 0xe2, 0xeb, 0xec, 
			      0xc1, 0xc6, 0xcf, 0xc8, 0xdd, 0xda, 0xd3, 0xd4, 
			      0x69, 0x6e, 0x67, 0x60, 0x75, 0x72, 0x7b, 0x7c, 
			      0x51, 0x56, 0x5f, 0x58, 0x4d, 0x4a, 0x43, 0x44, 
			      0x19, 0x1e, 0x17, 0x10, 0x05, 0x02, 0x0b, 0x0c, 
			      0x21, 0x26, 0x2f, 0x28, 0x3d, 0x3a, 0x33, 0x34, 
			      0x4e, 0x49, 0x40, 0x47, 0x52, 0x55, 0x5c, 0x5b, 
			      0x76, 0x71, 0x78, 0x7f, 0x6A, 0x6d, 0x64, 0x63, 
			      0x3e, 0x39, 0x30, 0x37, 0x22, 0x25, 0x2c, 0x2b, 
			      0x06, 0x01, 0x08, 0x0f, 0x1a, 0x1d, 0x14, 0x13, 
			      0xae, 0xa9, 0xa0, 0xa7, 0xb2, 0xb5, 0xbc, 0xbb, 
			      0x96, 0x91, 0x98, 0x9f, 0x8a, 0x8D, 0x84, 0x83, 
			      0xde, 0xd9, 0xd0, 0xd7, 0xc2, 0xc5, 0xcc, 0xcb, 
			      0xe6, 0xe1, 0xe8, 0xef, 0xfa, 0xfd, 0xf4, 0xf3 };

uint8_t blockCRC_8(uint8_t *ptrMsg, uint8_t length)
{
	unsigned char data;
	
	data=0;
	
	EECON1bits_EEPGD = 1 ; //access flash program memory
	do 
	{
		data = crc8[data^*ptrMsg++];
	}while(--length);
	EECON1bits_EEPGD = 0 ;
	
	return (data);
}


						

--- NEW FILE: GenericComm.nc ---
// $Id: GenericComm.nc,v 1.1 2005/04/15 10:00:07 hjkoerber Exp $

/*								
 * "Copyright (c) 2000-2003 The Regents of the University  of California.  
 * All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written agreement is
 * hereby granted, provided that the above copyright notice, the following
 * two paragraphs and the author appear in all copies of this software.
 * 
 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
 *
 * Copyright (c) 2002-2003 Intel Corporation
 * All rights reserved.
 *
 * This file is distributed under the terms in the attached INTEL-LICENSE     
 * file. If you do not find these files, copies can be found by writing to
 * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, 
 * 94704.  Attention:  Intel License Inquiry.
 */


/*
 * @author Jason Hill
 * @author David Gay
 * @author Hans-Joerg Koerber 
 *         <hj.koerber at hsu-hh.de>
 *	   (+49)40-6541-2638/2627
 *
 * $Date: 2005/04/15 10:00:07 $
 * $Revision: 1.1 $
 *
 */



configuration GenericComm
{
  provides {
    interface StdControl as Control;

    // The interface are as parameterised by the active message id
    interface SendMsg[uint8_t id];
    interface ReceiveMsg[uint8_t id];

    // How many packets were received in the past second
    command uint16_t activity();
  }
  uses {
    // signaled after every send completion for components which wish to
    // retry failed sends
    event result_t sendDone();
  }
}
implementation
{
  // CRCPacket should be multiply instantiable. As it is, I have to use
  // RadioCRCPacket for the radio, and UARTNoCRCPacket for the UART to
  // avoid conflicting components of CRCPacket.
  components AMStandard, 
    EnOceanRadioIntC as RadioPacket, 
    UARTFramedPacket as UARTPacket,
    PIC18F4620TimerC, HPLPowerManagementM;


  Control = AMStandard.Control;
  SendMsg = AMStandard.SendMsg;
  ReceiveMsg = AMStandard.ReceiveMsg;
  sendDone = AMStandard.sendDone;

  activity = AMStandard.activity;
  AMStandard.TimerControl -> PIC18F4620TimerC.StdControl;  
  AMStandard.ActivityTimer ->  PIC18F4620TimerC.Timer[unique("Timer")];
  
  AMStandard.UARTControl -> UARTPacket.Control;
  AMStandard.UARTSend -> UARTPacket.Send;
  AMStandard.UARTReceive -> UARTPacket.Receive;
  
  AMStandard.RadioControl -> RadioPacket.Control;
  AMStandard.RadioSend -> RadioPacket.Send;
  AMStandard.RadioReceive -> RadioPacket.Receive;
  AMStandard.PowerManagement -> HPLPowerManagementM.PowerManagement;
  //AMStandard.RadioReceive -> InjectMsg.RadioReceiveMsg; // for nido
  
}

--- NEW FILE: hardware.h ---
// $Id: hardware.h,v 1.1 2005/04/15 10:00:07 hjkoerber Exp $

/*									
 * "Copyright (c) 2000-2003 The Regents of the University  of California.  
 * All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written agreement is
 * hereby granted, provided that the above copyright notice, the following
 * two paragraphs and the author appear in all copies of this software.
 * 
 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
 *
 * Copyright (c) 2002-2003 Intel Corporation
 * All rights reserved.
 *
 * This file is distributed under the terms in the attached INTEL-LICENSE     
 * file. If you do not find these files, copies can be found by writing to
 * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, 
 * 94704.  Attention:  Intel License Inquiry.
 */
/*								
 *  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.  By
 *  downloading, copying, installing or using the software you agree to
 *  this license.  If you do not agree to this license, do not download,
 *  install, copy or use the software.
 *
 *  Intel Open Source License 
 *
 *  Copyright (c) 2002 Intel Corporation 
 *  All rights reserved. 
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are
 *  met:
 * 
 *	Redistributions of source code must retain the above copyright
 *  notice, this list of conditions and the following disclaimer.
 *	Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *      Neither the name of the Intel Corporation nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  
 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 *  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 *  PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE INTEL OR ITS
 *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */ 


/*
 * @author Jason Hill
 * @author Philip Levis
 * @author Nelson Lee
 * @author David Gay
 * @author: Hans-Joerg Koerber 
 *          <hj.koerber at hsu-hh.de>
 *	    (+49)40-6541-2638/2627

 *
 * $Date: 2005/04/15 10:00:07 $
 * $Revision: 1.1 $
 *
 */



#ifndef _H_hardware_h
#define _H_hardware_h


#define TOSH_NEW_AVRLIBC // mica128 requires avrlibc v. 20021209 or greater
#include "pic18f4620_defs.h"
#include "pic18f4620hardware.h"


// LED assignments
TOSH_ASSIGN_PIN(RED_LED, D, 0);              
TOSH_ASSIGN_PIN(GREEN_LED, D, 1);
TOSH_ASSIGN_PIN(YELLOW_LED, D, 2);


// Radio transmitter control assignments
TOSH_ASSIGN_PIN(TX_BASE, B, 1 );
TOSH_ASSIGN_PIN(TX_ON, B, 3 ); 
TOSH_ASSIGN_PIN(TX_DATA, B, 5 ); 
TOSH_ASSIGN_PIN(TX_ANT_ON, D, 7 );

// Radio receiver control assignments
TOSH_ASSIGN_PIN(RX_RSSI, A, 0);              
TOSH_ASSIGN_PIN(RX_RF_GAIN, A, 4);          // RX_RF_gain = 0  scales down the gain about 18 dB,for the concrete functioning refer to the infineon "tda 5200" manual, p. 4-3 
TOSH_ASSIGN_PIN(NOT_RX_ON, C, 2); 
TOSH_ASSIGN_PIN(RX_DATA, B, 4); 
TOSH_ASSIGN_PIN(RX_ANT_ON, D, 6 );

// Uart assignments
TOSH_ASSIGN_PIN(SER_TX, C, 6);
TOSH_ASSIGN_PIN(SER_RX, C, 7);
TOSH_ASSIGN_PIN(SER_RX_NN, B, 0);           // NN = not needed, but implemented on EnOcean

// SPI assignments
TOSH_ASSIGN_PIN(SCK, C, 3);
TOSH_ASSIGN_PIN(SDI, C, 4);
TOSH_ASSIGN_PIN(SDO, C, 5);

// RTC assignments
TOSH_ASSIGN_PIN(RTC_INT, B, 2); 

// Reference Voltage assignments
TOSH_ASSIGN_PIN(Vref_SUPPLY, D, 5)
TOSH_ASSIGN_PIN(Vref_HIGH, A, 3);

// I2C  assignments
TOSH_ASSIGN_PIN(SCL, C, 3);
TOSH_ASSIGN_PIN(SDA, C, 4);
           
 
// Power Control assignmenst
TOSH_ASSIGN_PIN(PORTA1, A, 1);
TOSH_ASSIGN_PIN(PORTA2, A, 2);
TOSH_ASSIGN_PIN(PORTA5, A, 5);

//TOSH_ASSIGN_PIN(PORTC, C, 0);             // used by 32.768 kHz crystal
//TOSH_ASSIGN_PIN(PORTC, C, 1);
TOSH_ASSIGN_PIN(PORTD3, D, 3);
TOSH_ASSIGN_PIN(PORTD4, D, 4); 
TOSH_ASSIGN_PIN(EXP_IO_3, D, 3);
TOSH_ASSIGN_PIN(EXP_IO_4, D, 4);
TOSH_ASSIGN_PIN(PORTE0, E, 0)
TOSH_ASSIGN_PIN(PORTE1, E, 1);
TOSH_ASSIGN_PIN(PORTE2, E, 2);

//ICD2 PINS
TOSH_ASSIGN_PIN(ICSP_CLK, B, 6);
TOSH_ASSIGN_PIN(ICSP_DATA, B, 7);


void TOSH_SET_PIN_DIRECTIONS(void)
{

  TOSH_MAKE_RED_LED_OUTPUT();
  TOSH_MAKE_YELLOW_LED_OUTPUT();
  TOSH_MAKE_GREEN_LED_OUTPUT();

  TOSH_MAKE_TX_BASE_OUTPUT();
  TOSH_MAKE_TX_ON_OUTPUT();
  TOSH_MAKE_TX_DATA_OUTPUT();
  TOSH_MAKE_TX_ANT_ON_OUTPUT();
  TOSH_MAKE_RX_RSSI_INPUT();             
  TOSH_MAKE_RX_RF_GAIN_OUTPUT();            
  TOSH_MAKE_NOT_RX_ON_OUTPUT(); 
  TOSH_MAKE_RX_DATA_INPUT(); 
  TOSH_MAKE_RX_ANT_ON_OUTPUT();

  TOSH_MAKE_SER_TX_OUTPUT(); 
  TOSH_MAKE_SER_RX_INPUT(); 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -