/*
Copyright 2003/2004, Freie Universitaet Berlin. All rights reserved.

These sources were developed at the Freie Universität Berlin, Computer
Systems and Telematics group.

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 Freie Universitaet Berlin (FUB) 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 FUB and the contributors on an "as is"
basis, without any representations or warranties of any kind, express
or implied including, but not limited to, representations or
warranties of non-infringement, merchantability or fitness for a
particular purpose. In no event shall FUB 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.

This implementation was developed by the CST group at the FUB.
Contributors: Marco Hutta

For documentation and questions please use the web site
http://scatterweb.mi.fu-berlin.de and the mailinglist
scatterweb@lists.spline.inf.fu-berlin.de (subscription via the Website).
Berlin, 2003/2004/2005
*/

#ifndef ScatterWeb_Configuration
#define ScatterWeb_Configuration

// Base address for application config, if needed.
#define EADR_APPCONFIG            (0x0D00)

// Possible flags for Comm_logLevel and Config.boot_logLevel.
#define DEBUG_RADIO               (0x80)  // Radio debug output.
#define DEBUG_DCO                 (0x40)  // Dco adjusting debug output.
#define DEBUG_SCOS                (0x20)  // ScOS debug output.
#define NO                        (0x01)  // Comm_print() gets through.
#define LOW                       (0x02)  // Comm_print(), Comm_log(LOW) get through.
#define MEDIUM                    (0x03)  // Comm_print(), Comm_log(LOW), log(MEDIUM) get through.
#define HIGH                      (0x04)  // Comm_print(), Comm_log(LOW), log(MEDIUM), log(HIGH) get through.
#define VERBOSE                   (0x05)  // All get through.

// Possible flags for Configuration.panicFlags.
#define PANIC_ON_STACK_OVERFLOW   (0x01)  // Panic if wd_stackCheck detects a low stack.
#define PANIC_ON_FULL_TIMERS      (0x02)  // Panic if timers get full.
#define PANIC_ON_BAD_RESET        (0x04)  // Panic if last reset was a bad reset.
#define PANIC_DISABLES_APP        (0x80)  // If set and a Panic occured, dont initialize the application.

// Possible flags for Configuration.firmwareFlags 
#define FF_DCOCHECKER             (0x02) // If set dco adjusting will be enabled.

// Configuration of the device
typedef struct {
  UINT16 id;              // Id of this MSP device
  UINT16 rxReceiveLimit;  // Threshold for receive power to realize a "Carrier Detect" with ADU.
  UINT8 transmitPower;    // Power for transmittting, set via ::setTxPower at boot time.
  UINT8 boot_logLevel;    // Comm_logLevel is initialized with that value.
  UINT8 panicFlags;       // Controls panic behaviour.
  UINT8 firmwareFlags;    // Other bits for firmware behaviour.
} config_t;

// Copy of the Configuration
extern config_t Configuration;

/*
 * Function to init status information
 *
 * @return bool   True always
 *  
 */  
bool Configuration_init();

/*
 * Function to save status information
 *
 * @return bool   True always
 *   
 */
bool Configuration_save();

/*
 * Function to print status information
 *
 * @return bool   True always
 *   
 */
bool Configuration_print(); 

#endif
