mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-17 05:32:45 +01:00
Merge pull request #5756 from kaspar030/remove_config
sys: remove config module
This commit is contained in:
commit
fcb08fac04
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 INRIA
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup boards
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief msb-430 common config module functions
|
||||
*
|
||||
* @author Oliver Hahm <oliver.hahm@inria.fr>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "board.h"
|
||||
#include "config.h"
|
||||
#include "flashrom.h"
|
||||
|
||||
void config_load(void)
|
||||
{
|
||||
if (*((uint16_t *) INFOMEM) == CONFIG_KEY) {
|
||||
memcpy(&sysconfig, (char *)(INFOMEM + sizeof(CONFIG_KEY)), sizeof(sysconfig));
|
||||
}
|
||||
else {
|
||||
config_save();
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t config_save(void)
|
||||
{
|
||||
configmem_t mem = { CONFIG_KEY, sysconfig };
|
||||
return (flashrom_erase((uint8_t *) INFOMEM) && flashrom_write((uint8_t *) INFOMEM, (uint8_t *) &mem, sizeof(mem)));
|
||||
}
|
@ -26,7 +26,6 @@
|
||||
#include "msba2_common.h"
|
||||
#include "lpc23xx.h"
|
||||
#include "cpu.h"
|
||||
#include "config.h"
|
||||
|
||||
#define CL_CPU_DIV 4
|
||||
|
||||
|
@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 INRIA
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup boards
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief msba2 common config module functions
|
||||
*
|
||||
* @author Oliver Hahm <oliver.hahm@inria.fr>
|
||||
* @author Zakaria Kasmi <zkasmi@inf.fu-berlin.de>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "config.h"
|
||||
#include "flashrom.h"
|
||||
|
||||
void config_load(void) {
|
||||
extern char configmem[];
|
||||
/* cast it here for strict-aliasing */
|
||||
uint16_t* tmp = (uint16_t*) configmem;
|
||||
if (*tmp == CONFIG_KEY) {
|
||||
memcpy(&sysconfig, (configmem + sizeof(CONFIG_KEY)), sizeof(sysconfig));
|
||||
}
|
||||
else {
|
||||
config_save();
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t config_save(void) {
|
||||
configmem_t mem = { CONFIG_KEY, sysconfig };
|
||||
return (flashrom_erase((uint8_t*) &configmem) && flashrom_write((uint8_t*) &configmem, (uint8_t*) &mem, sizeof(mem)));
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Eistec AB
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser General
|
||||
* Public License v2.1. See the file LICENSE in the top level directory for more
|
||||
* details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup board_mulle
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Mulle config module implementation
|
||||
*
|
||||
* @author Joakim Nohlgård <joakim.nohlgard@eistec.se>
|
||||
*
|
||||
* @note Waiting for PR #2353 (NVRAM API) before implementing this.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "config.h"
|
||||
|
||||
void config_load(void)
|
||||
{
|
||||
/* TODO: Implement */
|
||||
}
|
||||
|
||||
uint8_t config_save(void)
|
||||
{
|
||||
/* TODO: Implement */
|
||||
return 0;
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
/**
|
||||
* Native Board config.h implementation
|
||||
*
|
||||
* No functionality implemented at the moment.
|
||||
*
|
||||
* Copyright (C) 2014 Ludwig Knüpfer <ludwig.knuepfer@fu-berlin.de>
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*
|
||||
* @ingroup native_board
|
||||
* @{
|
||||
* @file
|
||||
* @author Ludwig Knüpfer <ludwig.knuepfer@fu-berlin.de>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "native_internal.h"
|
||||
|
||||
#define ENABLE_DEBUG (0)
|
||||
#include "debug.h"
|
||||
|
||||
/**
|
||||
* XXX: loading not implemented
|
||||
*/
|
||||
void config_load(void)
|
||||
{
|
||||
DEBUG("config_load()\n");
|
||||
|
||||
sysconfig.id = _native_id;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* XXX: storing not implemented
|
||||
*/
|
||||
uint8_t config_save(void)
|
||||
{
|
||||
printf("XXX: config_save(): not implemented - your config will vanish on process termination\n");
|
||||
return 1;
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
/**
|
||||
* board-config.c.
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "board.h"
|
||||
#include "config.h"
|
||||
#include "flashrom.h"
|
||||
|
||||
void config_load(void) {
|
||||
if (*((uint16_t*) INFOMEM) == CONFIG_KEY) {
|
||||
memcpy(&sysconfig, (char*) (INFOMEM + sizeof(CONFIG_KEY)), sizeof(sysconfig));
|
||||
}
|
||||
else {
|
||||
config_save();
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t config_save(void) {
|
||||
configmem_t mem = { CONFIG_KEY, sysconfig };
|
||||
return (flashrom_erase((uint8_t*) INFOMEM) && flashrom_write((uint8_t*) INFOMEM, (uint8_t*) &mem, sizeof(mem)));
|
||||
}
|
@ -31,7 +31,6 @@ QUIET ?= 1
|
||||
USEMODULE += shell
|
||||
USEMODULE += shell_commands
|
||||
USEMODULE += ps
|
||||
USEMODULE += config
|
||||
# include and auto-initialize all available sensors
|
||||
USEMODULE += saul_reg
|
||||
USEMODULE += saul_default
|
||||
|
@ -20,10 +20,6 @@
|
||||
|
||||
#include "auto_init.h"
|
||||
|
||||
#ifdef MODULE_CONFIG
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_BMP180
|
||||
#include "bmp180.h"
|
||||
#endif
|
||||
@ -97,11 +93,6 @@
|
||||
|
||||
void auto_init(void)
|
||||
{
|
||||
#ifdef MODULE_CONFIG
|
||||
DEBUG("Auto init loading config\n");
|
||||
config_load();
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_TINYMT32
|
||||
random_init(0);
|
||||
#endif
|
||||
|
@ -1 +0,0 @@
|
||||
include $(RIOTBASE)/Makefile.base
|
@ -1,24 +0,0 @@
|
||||
/**
|
||||
* System wide configuration struct.
|
||||
*
|
||||
* Copyright (C) 2013 INRIA.
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*
|
||||
* @ingroup config
|
||||
* @{
|
||||
* @file
|
||||
* @brief Provides system configuration struct with default values.
|
||||
* @author Oliver Hahm <oliver.hahm@inria.fr>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <config.h>
|
||||
|
||||
config_t sysconfig = {
|
||||
0, /**< default ID */
|
||||
"foobar", /**< default name */
|
||||
};
|
@ -1,76 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Freie Universität Berlin
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup core_internal
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Kernel configuration interface
|
||||
*
|
||||
* @author unknown
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define CONFIG_KEY (0x1701) /**< key to identify configuration */
|
||||
#define CONFIG_NAME_LEN (10) /**< length of name for configuration in bytes */
|
||||
|
||||
/**
|
||||
* @brief Memory for configuration defined externally.
|
||||
*/
|
||||
extern char configmem[];
|
||||
|
||||
/**
|
||||
* @brief Stores configuration data of the node.
|
||||
*/
|
||||
typedef struct {
|
||||
uint16_t id; /**< unique node identifier */
|
||||
char name[CONFIG_NAME_LEN]; /**< name of the node */
|
||||
} 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;
|
||||
|
||||
/**
|
||||
* @brief Variable sysconfig defined externally
|
||||
*/
|
||||
extern config_t sysconfig;
|
||||
|
||||
/**
|
||||
* @brief Write configuration back to flashrom.
|
||||
*
|
||||
* @return 1 on success, 0 otherwise
|
||||
*/
|
||||
uint8_t config_save(void);
|
||||
|
||||
/**
|
||||
* @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);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_H */
|
||||
/** @} */
|
@ -2,9 +2,6 @@ MODULE = shell_commands
|
||||
|
||||
SRC = shell_commands.c sc_sys.c
|
||||
|
||||
ifneq (,$(filter config,$(USEMODULE)))
|
||||
SRC += sc_id.c
|
||||
endif
|
||||
ifneq (,$(filter mci,$(USEMODULE)))
|
||||
SRC += sc_disk.c
|
||||
endif
|
||||
|
@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 INRIA.
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup sys_shell_commands
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Provides shell commands to configure node id
|
||||
*
|
||||
* @author Oliver Hahm <oliver.hahm@inria.fr>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "config.h"
|
||||
|
||||
int _id_handler(int argc, char **argv)
|
||||
{
|
||||
if (argc < 2) {
|
||||
printf("Current id: %u\n", sysconfig.id);
|
||||
}
|
||||
else {
|
||||
long newid = atoi(argv[1]);
|
||||
printf("Setting new id %ld\n", newid);
|
||||
sysconfig.id = newid;
|
||||
|
||||
if (!config_save()) {
|
||||
puts("ERROR setting new id");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user