Contiki 2.5
platform-conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010, Swedish Institute of Computer Science.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the Institute nor the names of its contributors
14  * may be used to endorse or promote products derived from this software
15  * without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  * $Id: platform-conf.h,v 1.1 2010/06/23 10:25:54 joxe Exp $
30  */
31 
32 /**
33  * \file
34  * A brief description of what this file is
35  * \author
36  * Niclas Finne <nfi@sics.se>
37  * Joakim Eriksson <joakime@sics.se>
38  */
39 
40 #ifndef __PLATFORM_CONF_H__
41 #define __PLATFORM_CONF_H__
42 
43 /*
44  * Definitions below are dictated by the hardware and not really
45  * changeable!
46  */
47 #define PLATFORM PLATFORM_AVR
48 
49 #define HARWARE_REVISION IRIS
50 
51 /* Clock ticks per second */
52 #define CLOCK_CONF_SECOND 128
53 
54 
55 /* LED ports */
56 #define LEDS_PxDIR DDRA // port direction register
57 #define LEDS_PxOUT PORTA // port register
58 #define LEDS_CONF_RED 0x04 //red led
59 #define LEDS_CONF_GREEN 0x02 // green led
60 #define LEDS_CONF_YELLOW 0x01 // yellow led
61 
62 /* COM port to be used for SLIP connection */
63 #define SLIP_PORT RS232_PORT_0
64 
65 /* Pre-allocated memory for loadable modules heap space (in bytes)*/
66 #define MMEM_CONF_SIZE 256
67 
68 /* Use the following address for code received via the codeprop
69  * facility
70  */
71 #define EEPROMFS_ADDR_CODEPROP 0x8000
72 
73 #define EEPROM_NODE_ID_START 0x00
74 
75 
76 #define NETSTACK_CONF_RADIO rf230_driver
77 
78 
79 /*
80  * SPI bus configuration for the TMote Sky.
81  */
82 
83 /* SPI input/output registers. */
84 #define SPI_TXBUF SPDR
85 #define SPI_RXBUF SPDR
86 
87 #define BV(bitno) _BV(bitno)
88 
89 #define SPI_WAITFOREOTx() do { while (!(SPSR & BV(SPIF))); } while (0)
90 #define SPI_WAITFOREORx() do { while (!(SPSR & BV(SPIF))); } while (0)
91 
92 #define SCK 1 /* - Output: SPI Serial Clock (SCLK) - ATMEGA128 PORTB, PIN1 */
93 #define MOSI 2 /* - Output: SPI Master out - slave in (MOSI) - ATMEGA128 PORTB, PIN2 */
94 #define MISO 3 /* - Input: SPI Master in - slave out (MISO) - ATMEGA128 PORTB, PIN3 */
95 
96 /*
97  * SPI bus - M25P80 external flash configuration.
98  */
99 
100 #define FLASH_PWR 3 /* P4.3 Output */
101 #define FLASH_CS 4 /* P4.4 Output */
102 #define FLASH_HOLD 7 /* P4.7 Output */
103 
104 /* Enable/disable flash access to the SPI bus (active low). */
105 
106 #define SPI_FLASH_ENABLE() ( P4OUT &= ~BV(FLASH_CS) )
107 #define SPI_FLASH_DISABLE() ( P4OUT |= BV(FLASH_CS) )
108 
109 #define SPI_FLASH_HOLD() ( P4OUT &= ~BV(FLASH_HOLD) )
110 #define SPI_FLASH_UNHOLD() ( P4OUT |= BV(FLASH_HOLD) )
111 
112 #define CSN 0
113 
114 #endif /* __PLATFORM_CONF_H__ */