summaryrefslogtreecommitdiff
path: root/apps/settings_list.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/settings_list.h')
-rw-r--r--apps/settings_list.h100
1 files changed, 100 insertions, 0 deletions
diff --git a/apps/settings_list.h b/apps/settings_list.h
new file mode 100644
index 0000000000..01e8cea1e7
--- /dev/null
+++ b/apps/settings_list.h
@@ -0,0 +1,100 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id: $
9 *
10 * Copyright (C) 2007 Jonathan Gordon
11 *
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.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
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"
26
27union storage_type {
28 int int_;
29 unsigned int uint_;
30 bool bool_;
31 char *charptr;
32 unsigned char *ucharptr;
33};
34/* the variable type for the setting */
35#define F_T_INT 1
36#define F_T_UINT 2
37#define F_T_BOOL 3
38#define F_T_CHARPTR 4
39#define F_T_UCHARPTR 5
40#define F_T_MASK 0x7
41
42struct sound_setting {
43 int setting; /* from the enum in firmware/sound.h */
44};
45#define F_T_SOUND 0x8 /* this variable uses the set_sound stuff, \
46 | with one of the above types (usually F_T_INT) \
47 These settings get the default from sound_default(setting); */
48struct bool_setting {
49 void (*option_callback)(bool);
50 int lang_yes;
51 int lang_no;
52};
53#define F_BOOL_SETTING F_T_BOOL|0x10
54#define F_RGB 0x20
55
56struct int_setting {
57 void (*option_callback)(int);
58 int min;
59 int max;
60 int step;
61};
62#define F_NVRAM_BYTES_MASK 0xE00 /*0-4 bytes can be stored */
63#define F_NVRAM_MASK_SHIFT 9
64#define NVRAM_CONFIG_VERSION 1
65/* Above define should be bumped if
66- a new NVRAM setting is added between 2 other NVRAM settings
67- number of bytes for a NVRAM setting is changed
68- a NVRAM setting is removed
69*/
70
71struct filename_setting {
72 const char* prefix;
73 const char* suffix;
74 int max_len;
75};
76#define F_FILENAME 0x40
77struct settings_list {
78 uint32_t flags; /* ____ ____ ____ ____ ____ NNN_ _FRB STTT */
79 void *setting;
80 union storage_type default_val;
81 const char *cfg_name; /* this settings name in the cfg file */
82 const char *cfg_vals; /*comma seperated legal values, or NULL */
83 /* used with F_T_UCHARPTR this is the folder prefix */
84 union {
85 void *RESERVED; /* to stop compile errors, will be removed */
86 struct sound_setting *sound_setting; /* use F_T_SOUND for this */
87 struct bool_setting *bool_setting; /* F_BOOL_SETTING */
88 struct filename_setting *filename_setting; /* use F_FILENAME */
89 };
90};
91
92#ifndef PLUGIN
93/* not needed for plugins and just causes compile error,
94 possibly fix proberly later */
95extern const struct settings_list settings[];
96extern const int nb_settings;
97
98#endif
99
100#endif