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 eeprom 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 PARAMETER_STORAGE 0
00016 //#define PARAMETER_STORAGE 1 //+476
00017 //#define PARAMETER_STORAGE 2 //+2045
00018 //#define PARAMETER_STORAGE 3 //+2144
00019 
00020 //#define CONTIKI_CONF_SETTINGS_MANAGER 1
00021 //#define CONTIKI_CONF_RANDOM_MAC 1        //adds 78 bytes
00022 
00023 #if CONTIKI_CONF_SETTINGS_MANAGER
00024 #if MCU_CONF_LOW_WEAR
00025 #define PARAMETER_STORAGE 2
00026 #else
00027 #define PARAMETER_STORAGE 3
00028 #endif
00029 #else
00030 #if MCU_CONF_LOW_WEAR
00031 #define PARAMETER_STORAGE 0
00032 #else
00033 #define PARAMETER_STORAGE 1
00034 #endif
00035 #endif
00036 
00037 /* Include settings.h, then dummy out the write routines */
00038 #include "settings.h"
00039 #if PARAMETER_STORAGE==2
00040 #define settings_add(...) 0
00041 #define settings_add_uint8(...) 0
00042 #define settings_add_uint16(...) 0
00043 #endif
00044 
00045 #if AVR_WEBSERVER
00046 /* Webserver builds can set some defaults in httpd-fsdata.c via makefsdata.h */
00047 extern uint8_t eemem_mac_address[8];
00048 extern uint8_t eemem_server_name[16];
00049 extern uint8_t eemem_domain_name[30];
00050 #endif
00051 
00052 #ifdef SERVER_NAME
00053 #define PARAMS_SERVERNAME SERVER_NAME
00054 #else
00055 #define PARAMS_SERVERNAME "Raven_webserver"
00056 #endif
00057 #ifdef DOMAIN_NAME
00058 #define PARAMS_DOMAINNAME DOMAIN_NAME
00059 #else
00060 #define PARAMS_DOMAINNAME "localhost"
00061 #endif
00062 #ifdef NODE_ID
00063 #define PARAMS_NODEID NODE_ID
00064 #else
00065 #define PARAMS_NODEID 0
00066 #endif
00067 #ifdef CHANNEL_802_15_4
00068 #define PARAMS_CHANNEL CHANNEL_802_15_4
00069 #else
00070 #define PARAMS_CHANNEL 26
00071 #endif
00072 #ifdef IEEE802154_PANID
00073 #define PARAMS_PANID IEEE802154_PANID
00074 #else
00075 #define PARAMS_PANID 0xABCD
00076 #endif
00077 #ifdef IEEE802154_PANADDR
00078 #define PARAMS_PANADDR IEEE802154_PANADDR
00079 #else
00080 #define PARAMS_PANADDR 0
00081 #endif
00082 #ifdef RF230_MAX_TX_POWER
00083 #define PARAMS_TXPOWER RF230_MAX_TX_POWER
00084 #else
00085 #define PARAMS_TXPOWER 0
00086 #endif
00087 #ifdef EUI64_ADDRESS
00088 #define PARAMS_EUI64ADDR EUI64_ADDRESS
00089 #else
00090 /* This form of of EUI64 mac allows full 6LoWPAN header compression from mac address */
00091 #if UIP_CONF_LL_802154
00092 //#define PARAMS_EUI64ADDR {0x02, 0xNN, 0xNN, 0xNN, 0xNN, 0xNN, 0xNN, 0xNN}
00093 #define PARAMS_EUI64ADDR {0x02, 0x11, 0x22, 0xff, 0xfe, 0x33, 0x44, 0x55};
00094 #else
00095 //#define PARAMS_EUI64ADDR {0x02, 0xNN, 0xNN, 0xff, 0xfe, 0xNN, 0xNN, 0xNN}
00096 #define PARAMS_EUI64ADDR {0x02, 0x11, 0x22, 0xff, 0xfe, 0x33, 0x44, 0x55};
00097 #endif
00098 /* This form of of EUI64 mac allows 16 bit 6LoWPAN header compression on multihops */
00099 //#define PARAMS_EUI64ADDR {0x02, 0x00, 0x00, 0xff, 0xfe, 0x00, 0xNN, 0xNN}
00100 #endif
00101 
00102 uint8_t params_get_eui64(uint8_t *eui64);
00103 #if PARAMETER_STORAGE==0
00104 /* Hard coded program flash parameters */
00105 #define params_get_servername(...) 
00106 #define params_get_nodeid(...) PARAMS_NODEID
00107 #define params_get_channel(...) PARAMS_CHANNEL
00108 #define params_get_panid(...) PARAMS_PANID
00109 #define params_get_panaddr(...) PARAMS_PANADDR
00110 #define params_get_txpower(...) PARAMS_TXPOWER
00111 #else
00112 /* Parameters stored in eeprom */
00113 uint16_t params_get_nodeid(void);
00114 uint8_t params_get_channel(void);
00115 uint16_t params_get_panid(void);
00116 uint16_t params_get_panaddr(void);
00117 uint8_t params_get_txpower(void);
00118 #endif
00119 
00120 #endif /* __PARAMS_H__ */