Nut/OS configuration structure. More...
Data Structures | |
struct | _CONFOS |
Operating system configuration structure. More... | |
Defines | |
#define | CONFOS_EE_OFFSET 0 |
Non-volatile memory location. | |
#define | CONFOS_EE_MAGIC "OS" |
#define | MAX_HOSTNAME_LEN 15 |
Maximum number of characters allowed for hostname. | |
#define | CONFOS_VIRGIN_HOSTNAME "ethernut" |
Default hostname. | |
Typedefs | |
typedef struct _CONFOS | CONFOS |
Operating system configuration type. | |
Functions | |
int | NutLoadConfig (void) |
Load Nut/OS configuration from non-volatile memory. | |
int | NutSaveConfig (void) |
Save Nut/OS configuration in non-volatile memory. | |
Variables | |
CONFOS | confos |
Global system configuration structure. | |
CONFOS | confos |
Global system configuration structure. |
Nut/OS configuration structure.
#define CONFOS_EE_OFFSET 0 |
Non-volatile memory location.
Offset into non-volatile memory, where Nut/OS stores the system configuration. The default may be overridden by the Configurator.
Definition at line 103 of file confos.h.
Referenced by NutLoadConfig(), and NutSaveConfig().
#define CONFOS_EE_MAGIC "OS" |
Definition at line 107 of file confos.h.
Referenced by NutLoadConfig(), and NutSaveConfig().
#define MAX_HOSTNAME_LEN 15 |
Maximum number of characters allowed for hostname.
Intentionally not MAXHOSTNAMELEN to avoid conflicts with existing C libraries.
Definition at line 117 of file confos.h.
Referenced by NutSaveConfig().
#define CONFOS_VIRGIN_HOSTNAME "ethernut" |
Default hostname.
Used on virgin systems without any valid configuration.
Definition at line 126 of file confos.h.
Referenced by NutLoadConfig().
int NutLoadConfig | ( | void | ) |
Load Nut/OS configuration from non-volatile memory.
This routine is automatically called during system initialization. It tries to read the OS configuration structure CONFOS from non-volatile memory, starting at /ref CONFOS_EE_OFFSET.
The routine may fail, if
Definition at line 114 of file confos.c.
References CONFOS_EE_MAGIC, CONFOS_EE_OFFSET, CONFOS_VIRGIN_HOSTNAME, _CONFOS::hostname, _CONFOS::magic, memcmp(), NUTASSERT, NutNvMemLoad(), _CONFOS::size, strcpy(), and strlen().
Referenced by NutIdle().
int NutSaveConfig | ( | void | ) |
Save Nut/OS configuration in non-volatile memory.
Since Nut/OS version 4.7.5, this routine is no longer called automatically during system initialization. Thus, if NutLoadConfig() fails, then the non-volatile memory remains invalid and NutLoadConfig() will again fail during the next system start.
Definition at line 142 of file confos.c.
References CONFOS_EE_MAGIC, CONFOS_EE_OFFSET, _CONFOS::hostname, _CONFOS::magic, MAX_HOSTNAME_LEN, memcpy(), NUTASSERT, NutNvMemSave(), _CONFOS::size, and strlen().
Referenced by NutDiscoveryAppConf().
Global system configuration structure.
Contains the current system configuration. Nut/OS will load this structure from non-volatile memory during initialization.
Definition at line 97 of file confos.c.
Referenced by MibRegisterSysVars(), NutDiscoveryAnnTele(), NutDiscoveryAppConf(), and syslog_header().
Global system configuration structure.
Contains the current system configuration. Nut/OS will load this structure from non-volatile memory during initialization.
Definition at line 97 of file confos.c.
Referenced by MibRegisterSysVars(), NutDiscoveryAnnTele(), NutDiscoveryAppConf(), and syslog_header().