Contiki 2.5
params.h
1 #ifndef __PARAMS_H__
2 #define __PARAMS_H__
3 /* PARAMETER_STORAGE =
4  * 0 Hard coded, minmal program and eeprom usage.
5  * 1 Stored in fixed eeprom locations, rewritten from flash if corrupt.
6  * This allows parameter changes using a hardware programmer or custom application code.
7  * Corruption test is based on channel verify so get the channel before anything else!
8  * 2 Obtained from eeprom using the general settings manager and read from program flash if not present.
9  * Useful for for testing builds without wearing out flash memory.
10  * 3 Obtained from eeprom using the settings manager and rewritten from flash if not present.
11  * This ensures all parameters are present in upper eeprom flash.
12  *
13  * Note the parameters in this file can be changed without forcing a complete rebuild.
14  */
15 #define CONTIKI_CONF_RANDOM_MAC 0 //adds 78 bytes
16 #define CONTIKI_CONF_SETTINGS_MANAGER 0 //adds 1696 bytes
17 
18 #if CONTIKI_CONF_SETTINGS_MANAGER
19 //#define PARAMETER_STORAGE 2
20 #define PARAMETER_STORAGE 2
21 #else
22 #define PARAMETER_STORAGE 1
23 #endif
24 
25 /* Include settings.h, then dummy out the write routines */
26 #include "settings.h"
27 #if PARAMETER_STORAGE==2
28 #define settings_add(...) 0
29 #define settings_add_uint8(...) 0
30 #define settings_add_uint16(...) 0
31 #endif
32 
33 #if AVR_WEBSERVER
34 /* Webserver builds can set some defaults in httpd-fsdata.c via makefsdata.h */
35 extern uint8_t eemem_mac_address[8];
36 extern uint8_t eemem_server_name[16];
37 extern uint8_t eemem_domain_name[30];
38 #endif
39 
40 #ifdef SERVER_NAME
41 #define PARAMS_SERVERNAME SERVER_NAME
42 #else
43 #define PARAMS_SERVERNAME "ATMEGA128rfa1"
44 #endif
45 #ifdef DOMAIN_NAME
46 #define PARAMS_DOMAINNAME DOMAIN_NAME
47 #else
48 #define PARAMS_DOMAINNAME "localhost"
49 #endif
50 #ifdef NODE_ID
51 #define PARAMS_NODEID NODE_ID
52 #else
53 #define PARAMS_NODEID 0
54 #endif
55 #ifdef CHANNEL_802_15_4
56 #define PARAMS_CHANNEL CHANNEL_802_15_4
57 #else
58 #define PARAMS_CHANNEL 26
59 #endif
60 #ifdef IEEE802154_PANID
61 #define PARAMS_PANID IEEE802154_PANID
62 #else
63 #define PARAMS_PANID 0xABCD
64 #endif
65 #ifdef IEEE802154_PANADDR
66 #define PARAMS_PANADDR IEEE802154_PANADDR
67 #else
68 #define PARAMS_PANADDR 0
69 #endif
70 #ifdef RF230_MAX_TX_POWER
71 #define PARAMS_TXPOWER RF230_MAX_TX_POWER
72 #else
73 #define PARAMS_TXPOWER 0
74 #endif
75 #ifdef EUI64_ADDRESS
76 #define PARAMS_EUI64ADDR EUI64_ADDRESS
77 #else
78 /* This form of of EUI64 mac allows full 6LoWPAN header compression from mac address */
79 #if UIP_CONF_LL_802154
80 //#define PARAMS_EUI64ADDR {0x02, 0xNN, 0xNN, 0xNN, 0xNN, 0xNN, 0xNN, 0xNN}
81 #define PARAMS_EUI64ADDR {0x02, 0x00, 0x00, 0xff, 0xfe, 0x00, 0x00, 0x01}
82 #else
83 //#define PARAMS_EUI64ADDR {0x02, 0xNN, 0xNN, 0xff, 0xfe, 0xNN, 0xNN, 0xNN}
84 #define PARAMS_EUI64ADDR {0x00, 0x00, 0x00, 0xff, 0xfe, 0x00, 0x00, 0x01}
85 #endif
86 /* This form of of EUI64 mac allows 16 bit 6LoWPAN header compression on multihops */
87 //#define PARAMS_EUI64ADDR {0x02, 0x00, 0x00, 0xff, 0xfe, 0x00, 0xNN, 0xNN}
88 #endif
89 
90 uint8_t params_get_eui64(uint8_t *eui64);
91 #if PARAMETER_STORAGE==0
92 /* Hard coded program flash parameters */
93 #define params_get_servername(...)
94 #define params_get_nodeid(...) PARAMS_NODEID
95 #define params_get_channel(...) PARAMS_CHANNEL
96 #define params_get_panid(...) PARAMS_PANID
97 #define params_get_panaddr(...) PARAMS_PANADDR
98 #define params_get_txpower(...) PARAMS_TXPOWER
99 #else
100 /* Parameters stored in eeprom */
101 uint16_t params_get_nodeid(void);
102 uint8_t params_get_channel(void);
103 uint16_t params_get_panid(void);
104 uint16_t params_get_panaddr(void);
105 uint8_t params_get_txpower(void);
106 #endif
107 
108 #endif /* __PARAMS_H__ */