i.MX31: Add some enums and a couple helper functions to make dealing with pin muxing...
[kugel-rb.git] / firmware / export / general.h
blob8da4a0ad59ab5e9ba4262f815f31668a35e274d8
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2006 by Michael Sevakis
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #ifndef GENERAL_H
23 #define GENERAL_H
25 #include <stdbool.h>
26 #include <stddef.h>
27 #include "config.h"
29 #if CONFIG_CODEC == SWCODEC
30 /* round a signed/unsigned 32bit value to the closest of a list of values */
31 /* returns the index of the closest value */
32 int round_value_to_list32(unsigned long value,
33 const unsigned long list[],
34 int count,
35 bool signd);
37 int make_list_from_caps32(unsigned long src_mask,
38 const unsigned long *src_list,
39 unsigned long caps_mask,
40 unsigned long *caps_list);
41 #endif /* CONFIG_CODEC == SWCODEC */
43 /* Create a filename with a number part in a way that the number is 1
44 * higher than the highest numbered file matching the same pattern.
45 * It is allowed that buffer and path point to the same memory location,
46 * saving a strcpy(). Path must always be given without trailing slash.
48 * "num" can point to an int specifying the number to use or NULL or a value
49 * less than zero to number automatically. The final number used will also
50 * be returned in *num. If *num is >= 0 then *num will be incremented by
51 * one. */
52 #if defined(HAVE_RECORDING) && (CONFIG_RTC == 0)
53 /* this feature is needed by recording without a RTC to prevent disk access
54 when changing files */
55 #define IF_CNFN_NUM_(...) __VA_ARGS__
56 #define IF_CNFN_NUM
57 #else
58 #define IF_CNFN_NUM_(...)
59 #endif
60 char *create_numbered_filename(char *buffer, const char *path,
61 const char *prefix, const char *suffix,
62 int numberlen IF_CNFN_NUM_(, int *num));
64 #if CONFIG_RTC
65 /* Create a filename with a date+time part.
66 It is allowed that buffer and path point to the same memory location,
67 saving a strcpy(). Path must always be given without trailing slash.
68 unique_time as true makes the function wait until the current time has
69 changed. */
70 char *create_datetime_filename(char *buffer, const char *path,
71 const char *prefix, const char *suffix,
72 bool unique_time);
73 #endif /* CONFIG_RTC */
75 #endif /* GENERAL_H */