Contiki 2.6

params.h

00001 #ifndef __PARAMS_H__
00002 #define __PARAMS_H__
00003 /* PARAMETER_STORAGE =
00004  * 0 Hard coded, minmal program and eeprom usage.
00005  * 1 Stored in fixed eeprom locations, rewritten from flash if corrupt.
00006  *   This allows parameter changes using a hardware programmer or custom application code.
00007  *   Corruption test is based on channel verify so get the channel before anything else!
00008  * 2 Obtained from eeprom using the general settings manager and read from program flash if not present.
00009  *   Useful for for testing builds without wearing out flash memory.
00010  * 3 Obtained from eeprom using the settings manager and rewritten from flash if not present.
00011  *   This ensures all parameters are present in upper eeprom flash.
00012  *
00013  * Note the parameters in this file can be changed without forcing a complete rebuild.
00014  */
00015 #define CONTIKI_CONF_RANDOM_MAC 0        //adds 78 bytes
00016 #define CONTIKI_CONF_SETTINGS_MANAGER 0  //adds 1696 bytes
00017 
00018 #if CONTIKI_CONF_SETTINGS_MANAGER
00019 //#define PARAMETER_STORAGE 2
00020 #define PARAMETER_STORAGE 2
00021 #else
00022 #define PARAMETER_STORAGE 1
00023 #endif
00024 
00025 /* Include settings.h, then dummy out the write routines */
00026 #include "settings.h"
00027 #if PARAMETER_STORAGE==2
00028 #define settings_add(...) 0
00029 #define settings_add_uint8(...) 0
00030 #define settings_add_uint16(...) 0
00031 #endif
00032 
00033 #if AVR_WEBSERVER
00034 /* Webserver builds can set some defaults in httpd-fsdata.c via makefsdata.h */
00035 extern uint8_t eemem_mac_address[8];
00036 extern uint8_t eemem_server_name[16];
00037 extern uint8_t eemem_domain_name[30];
00038 #endif
00039 
00040 #ifdef SERVER_NAME
00041 #define PARAMS_SERVERNAME SERVER_NAME
00042 #else
00043 #define PARAMS_SERVERNAME "ATMEGA128rfa1"
00044 #endif
00045 #ifdef DOMAIN_NAME
00046 #define PARAMS_DOMAINNAME DOMAIN_NAME
00047 #else
00048 #define PARAMS_DOMAINNAME "localhost"
00049 #endif
00050 #ifdef NODE_ID
00051 #define PARAMS_NODEID NODE_ID
00052 #else
00053 #define PARAMS_NODEID 0
00054 #endif
00055 #ifdef CHANNEL_802_15_4
00056 #define PARAMS_CHANNEL CHANNEL_802_15_4
00057 #else
00058 #define PARAMS_CHANNEL 26
00059 #endif
00060 #ifdef IEEE802154_PANID
00061 #define PARAMS_PANID IEEE802154_PANID
00062 #else
00063 #define PARAMS_PANID 0xABCD
00064 #endif
00065 #ifdef IEEE802154_PANADDR
00066 #define PARAMS_PANADDR IEEE802154_PANADDR
00067 #else
00068 #define PARAMS_PANADDR 0
00069 #endif
00070 #ifdef RF230_MAX_TX_POWER
00071 #define PARAMS_TXPOWER RF230_MAX_TX_POWER
00072 #else
00073 #define PARAMS_TXPOWER 0
00074 #endif
00075 #ifdef EUI64_ADDRESS
00076 #define PARAMS_EUI64ADDR EUI64_ADDRESS
00077 #else
00078 /* This form of of EUI64 mac allows full 6LoWPAN header compression from mac address */
00079 #if UIP_CONF_LL_802154
00080 //#define PARAMS_EUI64ADDR {0x02, 0xNN, 0xNN, 0xNN, 0xNN, 0xNN, 0xNN, 0xNN}
00081 #define PARAMS_EUI64ADDR {0x02, 0x00, 0x00, 0xff, 0xfe, 0x00, 0x00, 0x01}
00082 #else
00083 //#define PARAMS_EUI64ADDR {0x02, 0xNN, 0xNN, 0xff, 0xfe, 0xNN, 0xNN, 0xNN}
00084 #define PARAMS_EUI64ADDR {0x00, 0x00, 0x00, 0xff, 0xfe, 0x00, 0x00, 0x01}
00085 #endif
00086 /* This form of of EUI64 mac allows 16 bit 6LoWPAN header compression on multihops */
00087 //#define PARAMS_EUI64ADDR {0x02, 0x00, 0x00, 0xff, 0xfe, 0x00, 0xNN, 0xNN}
00088 #endif
00089 
00090 uint8_t params_get_eui64(uint8_t *eui64);
00091 #if PARAMETER_STORAGE==0
00092 /* Hard coded program flash parameters */
00093 #define params_get_servername(...) 
00094 #define params_get_nodeid(...) PARAMS_NODEID
00095 #define params_get_channel(...) PARAMS_CHANNEL
00096 #define params_get_panid(...) PARAMS_PANID
00097 #define params_get_panaddr(...) PARAMS_PANADDR
00098 #define params_get_txpower(...) PARAMS_TXPOWER
00099 #else
00100 /* Parameters stored in eeprom */
00101 uint16_t params_get_nodeid(void);
00102 uint8_t params_get_channel(void);
00103 uint16_t params_get_panid(void);
00104 uint16_t params_get_panaddr(void);
00105 uint8_t params_get_txpower(void);
00106 #endif
00107 
00108 #endif /* __PARAMS_H__ */