2013-11-27 16:28:31 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2013 Freie Universität Berlin
|
|
|
|
*
|
|
|
|
* This file subject to the terms and conditions of the GNU Lesser General
|
|
|
|
* Public License. See the file LICENSE in the top level directory for more
|
|
|
|
* details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @addtogroup core_internal
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file config.h
|
|
|
|
* @brief Kernel configuration interface
|
|
|
|
*
|
2013-11-27 17:54:30 +01:00
|
|
|
* @author unknown
|
2013-11-27 16:28:31 +01:00
|
|
|
*/
|
|
|
|
|
2010-12-01 16:26:48 +01:00
|
|
|
#ifndef CONFIG_H
|
|
|
|
#define CONFIG_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#define CONFIG_KEY (0x1701)
|
|
|
|
|
|
|
|
extern char configmem[];
|
|
|
|
|
|
|
|
/* @brief: Stores configuration data of the node */
|
|
|
|
typedef struct {
|
|
|
|
uint16_t id; ///< unique node identifier
|
|
|
|
uint8_t radio_address; ///< address for radio communication
|
|
|
|
uint8_t radio_channel; ///< current frequency
|
|
|
|
} config_t;
|
|
|
|
|
|
|
|
/* @brief: Element to store in flashrom */
|
|
|
|
typedef struct {
|
|
|
|
uint16_t magic_key; ///< validity check
|
|
|
|
config_t config; ///< the node's configuration
|
|
|
|
} configmem_t;
|
|
|
|
|
|
|
|
extern config_t sysconfig;
|
|
|
|
|
2012-06-06 10:51:38 +02:00
|
|
|
/**
|
|
|
|
* @brief: Write configuration back to flashrom
|
|
|
|
*
|
2013-06-20 18:18:29 +02:00
|
|
|
* @return 1 on success, 0 otherwise
|
2012-06-06 10:51:38 +02:00
|
|
|
*/
|
2010-12-01 16:26:48 +01:00
|
|
|
uint8_t config_save(void);
|
|
|
|
|
2013-06-20 18:18:29 +02:00
|
|
|
/**
|
2012-06-06 10:51:38 +02:00
|
|
|
* @brief: Read configuration from flashrom and stores it to sysconfig
|
|
|
|
*
|
|
|
|
* @note: If no configuration is present within flashrom a new configuration will be created
|
|
|
|
*/
|
|
|
|
void config_load(void);
|
|
|
|
|
2013-11-27 16:28:31 +01:00
|
|
|
/** @} */
|
2010-12-01 16:26:48 +01:00
|
|
|
#endif /* CONFIG_H */
|