Change i2c config on e200. Seems to speed things up somewhat.
[kugel-rb.git] / apps / misc.h
blob959674fefd21b4fd5bdee8b404300e8bca33d738
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 by Daniel Stenberg
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 MISC_H
20 #define MISC_H
22 #include <stdbool.h>
24 /* Format a large-range value for output, using the appropriate unit so that
25 * the displayed value is in the range 1 <= display < 1000 (1024 for "binary"
26 * units) if possible, and 3 significant digits are shown. If a buffer is
27 * given, the result is snprintf()'d into that buffer, otherwise the result is
28 * voiced.*/
29 char *output_dyn_value(char *buf, int buf_size, int value,
30 const unsigned char **units, bool bin_scale);
32 /* Create a filename with a number part in a way that the number is 1
33 * higher than the highest numbered file matching the same pattern.
34 * It is allowed that buffer and path point to the same memory location,
35 * saving a strcpy(). Path must always be given without trailing slash.
37 * "num" can point to an int specifying the number to use or NULL or a value
38 * less than zero to number automatically. The final number used will also
39 * be returned in *num. If *num is >= 0 then *num will be incremented by
40 * one. */
41 #if CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING) && (CONFIG_RTC == 0)
42 /* this feature is needed by SWCODEC recording without a RTC to prevent
43 disk access when changing files */
44 #define IF_CNFN_NUM_(...) __VA_ARGS__
45 #define IF_CNFN_NUM
46 #else
47 #define IF_CNFN_NUM_(...)
48 #endif
49 char *create_numbered_filename(char *buffer, const char *path,
50 const char *prefix, const char *suffix,
51 int numberlen IF_CNFN_NUM_(, int *num));
53 /* Format time into buf.
55 * buf - buffer to format to.
56 * buf_size - size of buffer.
57 * t - time to format, in milliseconds.
59 void format_time(char* buf, int buf_size, long t);
61 #if CONFIG_RTC
62 /* Create a filename with a date+time part.
63 It is allowed that buffer and path point to the same memory location,
64 saving a strcpy(). Path must always be given without trailing slash.
65 unique_time as true makes the function wait until the current time has
66 changed. */
67 char *create_datetime_filename(char *buffer, const char *path,
68 const char *prefix, const char *suffix,
69 bool unique_time);
70 #endif /* CONFIG_RTC */
72 /* Read (up to) a line of text from fd into buffer and return number of bytes
73 * read (which may be larger than the number of bytes stored in buffer). If
74 * an error occurs, -1 is returned (and buffer contains whatever could be
75 * read). A line is terminated by a LF char. Neither LF nor CR chars are
76 * stored in buffer.
78 int read_line(int fd, char* buffer, int buffer_size);
79 int fast_readline(int fd, char *buf, int buf_size, void *parameters,
80 int (*callback)(int n, const char *buf, void *parameters));
82 #ifdef HAVE_LCD_BITMAP
83 /* Save a .BMP file containing the current screen contents. */
84 void screen_dump(void);
85 void screen_dump_set_hook(void (*hook)(int fh));
86 #endif
88 bool settings_parseline(char* line, char** name, char** value);
89 long default_event_handler_ex(long event, void (*callback)(void *), void *parameter);
90 long default_event_handler(long event);
91 bool list_stop_handler(void);
92 void car_adapter_mode_init(void);
93 extern int show_logo(void);
95 #if CONFIG_CODEC == SWCODEC
96 /* Return current ReplayGain mode a file should have (REPLAYGAIN_TRACK or
97 * REPLAYGAIN_ALBUM) if ReplayGain processing is enabled, or -1 if no
98 * information present.
100 int get_replaygain_mode(bool have_track_gain, bool have_album_gain);
101 #endif
103 #ifdef BOOTFILE
104 #ifndef USB_IPODSTYLE
105 void check_bootfile(bool do_rolo);
106 #endif
107 #endif
109 #endif /* MISC_H */