Change i2c config on e200. Seems to speed things up somewhat.
[kugel-rb.git] / apps / settings_list.h
blob97443e35beb8e3ce6b92c836aa5188117d2b8bb1
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2007 Jonathan Gordon
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
19 #ifndef __SETTINGSLIST_H
20 #define __SETTINGSLIST_H
21 #include <stdio.h>
22 #include <stddef.h>
23 #include <stdbool.h>
24 #include <limits.h>
25 #include "inttypes.h"
27 typedef int (*_isfunc_type)(void);
29 union storage_type {
30 int int_;
31 unsigned int uint_;
32 bool bool_;
33 char *charptr;
34 unsigned char *ucharptr;
35 _isfunc_type func;
37 /* the variable type for the setting */
38 #define F_T_INT 1
39 #define F_T_UINT 2
40 #define F_T_BOOL 3
41 #define F_T_CHARPTR 4
42 #define F_T_UCHARPTR 5
43 #define F_T_MASK 0x7
45 struct sound_setting {
46 int setting; /* from the enum in firmware/sound.h */
48 #define F_T_SOUND 0x8 /* this variable uses the set_sound stuff, \
49 | with one of the above types (usually F_T_INT) \
50 These settings get the default from sound_default(setting); */
51 struct bool_setting {
52 void (*option_callback)(bool);
53 int lang_yes;
54 int lang_no;
56 #define F_BOOL_SETTING (F_T_BOOL|0x10)
57 #define F_RGB 0x20
59 struct filename_setting {
60 const char* prefix;
61 const char* suffix;
62 int max_len;
64 #define F_FILENAME 0x40
66 struct int_setting {
67 void (*option_callback)(int);
68 int unit;
69 int min;
70 int max;
71 int step;
72 void (*formatter)(char*, int, int, const char*);
73 long (*get_talk_id)(int);
75 #define F_INT_SETTING 0x80
77 struct choice_setting {
78 void (*option_callback)(int);
79 int count;
80 union {
81 unsigned char **desc;
82 int *talks;
85 #define F_CHOICE_SETTING 0x100
86 #define F_CHOICETALKS 0x200 /* uses .talks in the above struct for the talks */
87 /* and cfg_vals for the strings to display */
88 /* these use the _isfunc_type type for the function */
89 /* typedef int (*_isfunc_type)(void); */
90 #define F_MIN_ISFUNC 0x100000 /* min(above) is function pointer to above type */
91 #define F_MAX_ISFUNC 0x200000 /* max(above) is function pointer to above type */
92 #define F_DEF_ISFUNC 0x400000 /* default_val is function pointer to above type */
94 #define F_THEMESETTING 0x800000
96 #define F_NVRAM_BYTES_MASK 0xE000 /*0-4 bytes can be stored */
97 #define F_NVRAM_MASK_SHIFT 13
98 #define NVRAM_CONFIG_VERSION 2
99 /* Above define should be bumped if
100 - a new NVRAM setting is added between 2 other NVRAM settings
101 - number of bytes for a NVRAM setting is changed
102 - a NVRAM setting is removed
104 #define F_TEMPVAR 0x400 /* used if the setting should be set using a temp var */
105 #define F_FLIPLIST 0x800 /* used if the order in the setting screen is backwards */
107 struct settings_list {
108 uint32_t flags; /* ____ ____ TFFF ____ NNN_ FTVC IFRB STTT */
109 void *setting;
110 int lang_id; /* -1 for none */
111 union storage_type default_val;
112 const char *cfg_name; /* this settings name in the cfg file */
113 const char *cfg_vals; /*comma seperated legal values, or NULL */
114 /* used with F_T_UCHARPTR this is the folder prefix */
115 union {
116 void *RESERVED; /* to stop compile errors, will be removed */
117 struct sound_setting *sound_setting; /* use F_T_SOUND for this */
118 struct bool_setting *bool_setting; /* F_BOOL_SETTING */
119 struct filename_setting *filename_setting; /* use F_FILENAME */
120 struct int_setting *int_setting; /* use F_INT_SETTING */
121 struct choice_setting *choice_setting; /* F_CHOICE_SETTING */
125 #ifndef PLUGIN
126 /* not needed for plugins and just causes compile error,
127 possibly fix proberly later */
128 extern const struct settings_list settings[];
129 extern const int nb_settings;
131 #endif
133 #endif