GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / cfe / cfe / include / env_subr.h
blobe88cf46ca61643552d86d0a49698b9db91f4720f
1 /* *********************************************************************
2 * Broadcom Common Firmware Environment (CFE)
3 *
4 * Environment helper routines File: env_subr.h
5 *
6 * Definitions and prototypes for environment variable subroutines
7 *
8 * Author: Mitch Lichtenberg (mpl@broadcom.com)
9 *
10 *********************************************************************
12 * Copyright 2000,2001,2002,2003
13 * Broadcom Corporation. All rights reserved.
15 * This software is furnished under license and may be used and
16 * copied only in accordance with the following terms and
17 * conditions. Subject to these conditions, you may download,
18 * copy, install, use, modify and distribute modified or unmodified
19 * copies of this software in source and/or binary form. No title
20 * or ownership is transferred hereby.
22 * 1) Any source code used, modified or distributed must reproduce
23 * and retain this copyright notice and list of conditions
24 * as they appear in the source file.
26 * 2) No right is granted to use any trade name, trademark, or
27 * logo of Broadcom Corporation. The "Broadcom Corporation"
28 * name may not be used to endorse or promote products derived
29 * from this software without the prior written permission of
30 * Broadcom Corporation.
32 * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR
33 * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED
34 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
35 * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT
36 * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN
37 * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT,
38 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
39 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
40 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
41 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
42 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
43 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF
44 * THE POSSIBILITY OF SUCH DAMAGE.
45 ********************************************************************* */
49 /* *********************************************************************
50 * Constants
51 ********************************************************************* */
55 * TLV types. These codes are used in the "type-length-value"
56 * encoding of the items stored in the NVRAM device (flash or EEPROM)
58 * The layout of the flash/nvram is as follows:
60 * <type> <length> <data ...> <type> <length> <data ...> <type_end>
62 * The type code of "ENV_TLV_TYPE_END" marks the end of the list.
63 * The "length" field marks the length of the data section, not
64 * including the type and length fields.
66 * Environment variables are stored as follows:
68 * <type_env> <length> <flags> <name> = <value>
70 * If bit 0 (low bit) is set, the length is an 8-bit value.
71 * If bit 0 (low bit) is clear, the length is a 16-bit value
73 * Bit 7 set indicates "user" TLVs. In this case, bit 0 still
74 * indicates the size of the length field.
76 * Flags are from the constants below:
80 #define ENV_LENGTH_16BITS 0x00 /* for low bit */
81 #define ENV_LENGTH_8BITS 0x01
83 #define ENV_TYPE_USER 0x80
85 #define ENV_CODE_SYS(n,l) (((n)<<1)|(l))
86 #define ENV_CODE_USER(n,l) ((((n)<<1)|(l)) | ENV_TYPE_USER)
89 * The actual TLV types we support
92 #define ENV_TLV_TYPE_END 0x00
93 #define ENV_TLV_TYPE_ENV ENV_CODE_SYS(0,ENV_LENGTH_8BITS)
96 * Environment variable flags
99 #define ENV_FLG_NORMAL 0x00 /* normal read/write */
100 #define ENV_FLG_BUILTIN 0x01 /* builtin - not stored in flash */
101 #define ENV_FLG_READONLY 0x02 /* read-only - cannot be changed */
103 #define ENV_FLG_MASK 0xFF /* mask of attributes we keep */
104 #define ENV_FLG_ADMIN 0x100 /* lets us internally override permissions */
106 /* *********************************************************************
107 * Prototypes
108 ********************************************************************* */
110 int env_delenv(const char *name);
111 char *env_getenv(const char *name);
112 int env_setenv(const char *name,char *value,int flags);
113 int env_load(void);
114 int env_save(void);
115 int env_enum(int idx,char *name,int *namelen,char *val,int *vallen);
116 int env_envtype(const char *name);