* $Id$ *
Copyright (C) 2006-2007 by egnite Software GmbH. All rights reserved. Copyright (C) 2008 by egnite GmbH. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. 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. 3. Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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.
For additional information see http://www.ethernut.de/
* * $Log$ * *
Definition in file config.c.
Go to the source code of this file.
Defines | |
#define | CONFIG_MAGIC "ir1" |
#define | CONFOS_SECTOR 0 |
#define | CONFNET_SECTOR 1 |
#define | CONFIG_SECTOR 2 |
#define | DF_WRITE_POLLS 1000 |
#define | DFCMD_READ_STATUS 0xD7 |
#define | DFCMD_CONT_READ 0xE8 |
#define | DFCMD_BUF1_WRITE 0x84 |
#define | DFCMD_BUF1_FLASH 0x83 |
#define | DFCMD_PAGE_ERASE 0x81 |
#define | VS10XX_XCS_BIT 31 |
#define | VS10XX_XCS_PIO_ID PIOA_ID |
#define | VS10XX_XDCS_BIT 30 |
#define | VS10XX_XDCS_PIO_ID PIOB_ID |
#define | VS10XX_DREQ_BIT 30 |
#define | VS10XX_DREQ_PIO_ID PIOA_ID |
#define | VS10XX_SIGNAL sig_INTERRUPT1 |
#define | VS_XRESET_BIT 31 |
Functions | |
int | InitElektorHardware (void) |
int | SpiSetMode (void) |
static u_char | SpiByte (u_char val) |
int | At91SpiTransfer2 (u_int base, u_int cs, CONST void *txbuf, void *rxbuf, int xlen, CONST void *txnbuf, void *rxnbuf, int xnlen) |
size_t | ConfigSize (void) |
Calculate total size of configuration data. | |
void | ConfigFlush (void) |
static void | ConfigPut (u_char ch) |
static u_char | ConfigGet (void) |
void | ConfigSaveString (char *str) |
size_t | ConfigLoadString (char *str, size_t size) |
void | ConfigSaveBinary (void *data, size_t len) |
void | ConfigLoadBinary (void *data, size_t len) |
void | ConfigRewind (u_long pgn) |
int | NutLoadConfig (void) |
Load Nut/OS configuration from non-volatile memory. | |
int | NutSaveConfig (void) |
Save Nut/OS configuration in non-volatile memory. | |
int | NutNetLoadConfig (CONST char *name) |
Load network configuration from non-volatile memory. | |
int | NutNetSaveConfig (void) |
Save network configuration in non-volatile memory. | |
int | ConfigSave (void) |
Save configuration in non volatile memory. | |
int | ConfigLoad (void) |
void | ConfigResetFactory (void) |
Reset configuration to factory defaults. | |
int | ConfigInit (void) |
Variables | |
static int | at45db |
static u_int | page_size |
HTTP_PROXY | proxy |
HTTP proxy configuration. | |
static u_long | pgnum |
static int | pgpos = -1 |
static u_char | pgbuf [1056] |
CONFOS | confos |
CONFNET | confnet |
#define CONFIG_MAGIC "ir1" |
#define CONFOS_SECTOR 0 |
#define CONFNET_SECTOR 1 |
#define CONFIG_SECTOR 2 |
#define VS10XX_XCS_BIT 31 |
#define VS10XX_XDCS_BIT 30 |
#define VS_XRESET_BIT 31 |
int InitElektorHardware | ( | void | ) |
Definition at line 96 of file config.c.
References VS10XX_XCS_BIT, VS10XX_XDCS_BIT, and VS_XRESET_BIT.
Referenced by ConfigInit().
int SpiSetMode | ( | void | ) |
static u_char SpiByte | ( | u_char | val | ) | [static] |
int At91SpiTransfer2 | ( | u_int | base, | |
u_int | cs, | |||
CONST void * | txbuf, | |||
void * | rxbuf, | |||
int | xlen, | |||
CONST void * | txnbuf, | |||
void * | rxnbuf, | |||
int | xnlen | |||
) |
Definition at line 177 of file config.c.
References SpiByte(), and SpiSetMode().
size_t ConfigSize | ( | void | ) |
void ConfigFlush | ( | void | ) |
Definition at line 248 of file config.c.
Referenced by ConfigPut(), ConfigSave(), FavListSave(), NutNetSaveConfig(), and NutSaveConfig().
static void ConfigPut | ( | u_char | ch | ) | [static] |
Definition at line 256 of file config.c.
References ConfigFlush(), page_size, pgbuf, pgnum, and pgpos.
Referenced by ConfigSaveBinary(), and ConfigSaveString().
static u_char ConfigGet | ( | void | ) | [static] |
Definition at line 270 of file config.c.
References at45db, page_size, pgbuf, pgnum, and pgpos.
Referenced by ConfigLoadBinary(), and ConfigLoadString().
void ConfigSaveString | ( | char * | str | ) |
size_t ConfigLoadString | ( | char * | str, | |
size_t | size | |||
) |
void ConfigSaveBinary | ( | void * | data, | |
size_t | len | |||
) |
Definition at line 302 of file config.c.
Referenced by ConfigSave(), NutNetSaveConfig(), and NutSaveConfig().
void ConfigLoadBinary | ( | void * | data, | |
size_t | len | |||
) |
Definition at line 312 of file config.c.
Referenced by ConfigLoad(), NutLoadConfig(), and NutNetLoadConfig().
void ConfigRewind | ( | u_long | pgn | ) |
Definition at line 321 of file config.c.
Referenced by ConfigLoad(), ConfigSave(), FavListLoad(), FavListSave(), NutLoadConfig(), NutNetLoadConfig(), NutNetSaveConfig(), and NutSaveConfig().
int NutLoadConfig | ( | void | ) |
Load Nut/OS configuration from non-volatile memory.
This routine is automatically called during system initialization.
Definition at line 341 of file config.c.
References ConfigInit(), ConfigLoadBinary(), ConfigRewind(), confos, and CONFOS_SECTOR.
Referenced by main().
int NutSaveConfig | ( | void | ) |
Save Nut/OS configuration in non-volatile memory.
Definition at line 359 of file config.c.
References ConfigFlush(), ConfigRewind(), ConfigSaveBinary(), confos, and CONFOS_SECTOR.
Referenced by CgiSettings().
int NutNetLoadConfig | ( | CONST char * | name | ) |
Load network configuration from non-volatile memory.
If no configuration is available in EEPROM, all configuration parameters are cleared to zero. Except the MAC address, which is set to the Ethernet broadcast address.
name | Name of the device. |
Definition at line 383 of file config.c.
References ConfigInit(), ConfigLoadBinary(), ConfigRewind(), confnet, and CONFNET_SECTOR.
int NutNetSaveConfig | ( | void | ) |
Save network configuration in non-volatile memory.
Definition at line 403 of file config.c.
References ConfigFlush(), ConfigRewind(), ConfigSaveBinary(), confnet, and CONFNET_SECTOR.
Referenced by CgiSettings().
int ConfigSave | ( | void | ) |
Save configuration in non volatile memory.
Definition at line 416 of file config.c.
Referenced by CgiSettings(), and main().
void ConfigResetFactory | ( | void | ) |
Reset configuration to factory defaults.
Definition at line 470 of file config.c.
Referenced by CgiSettings(), and main().
int ConfigInit | ( | void | ) |
Definition at line 480 of file config.c.
Referenced by main(), NutLoadConfig(), and NutNetLoadConfig().
int at45db [static] |
u_int page_size [static] |
Definition at line 67 of file config.c.
Referenced by ConfigFlush(), ConfigGet(), ConfigInit(), and ConfigPut().
HTTP proxy configuration.
Definition at line 72 of file config.c.
Referenced by CgiSettings(), SendHttpRequest(), ShoutCastGetPlayList(), StationConnect(), and TcpHostConnect().
u_long pgnum [static] |
Definition at line 244 of file config.c.
Referenced by ConfigFlush(), ConfigGet(), ConfigPut(), and ConfigRewind().
int pgpos = -1 [static] |
Definition at line 245 of file config.c.
Referenced by ConfigFlush(), ConfigGet(), ConfigPut(), and ConfigRewind().
u_char pgbuf[1056] [static] |
CONFOS confos |
Definition at line 330 of file config.c.
Referenced by CgiSettings(), main(), NutLoadConfig(), and NutSaveConfig().
CONFNET confnet |
Definition at line 331 of file config.c.
Referenced by CgiSettings(), main(), NutNetLoadConfig(), and NutNetSaveConfig().