xref: /aosp_15_r20/external/tinyalsa_new/include/tinyalsa/limits.h (revision 02e95f1a335b55495d41ca67eaf42361f13704fa)
1*02e95f1aSMarcin Radomski /* limits.h
2*02e95f1aSMarcin Radomski **
3*02e95f1aSMarcin Radomski ** Copyright 2011, The Android Open Source Project
4*02e95f1aSMarcin Radomski **
5*02e95f1aSMarcin Radomski ** Redistribution and use in source and binary forms, with or without
6*02e95f1aSMarcin Radomski ** modification, are permitted provided that the following conditions are met:
7*02e95f1aSMarcin Radomski **     * Redistributions of source code must retain the above copyright
8*02e95f1aSMarcin Radomski **       notice, this list of conditions and the following disclaimer.
9*02e95f1aSMarcin Radomski **     * Redistributions in binary form must reproduce the above copyright
10*02e95f1aSMarcin Radomski **       notice, this list of conditions and the following disclaimer in the
11*02e95f1aSMarcin Radomski **       documentation and/or other materials provided with the distribution.
12*02e95f1aSMarcin Radomski **     * Neither the name of The Android Open Source Project nor the names of
13*02e95f1aSMarcin Radomski **       its contributors may be used to endorse or promote products derived
14*02e95f1aSMarcin Radomski **       from this software without specific prior written permission.
15*02e95f1aSMarcin Radomski **
16*02e95f1aSMarcin Radomski ** THIS SOFTWARE IS PROVIDED BY The Android Open Source Project ``AS IS'' AND
17*02e95f1aSMarcin Radomski ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18*02e95f1aSMarcin Radomski ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19*02e95f1aSMarcin Radomski ** ARE DISCLAIMED. IN NO EVENT SHALL The Android Open Source Project BE LIABLE
20*02e95f1aSMarcin Radomski ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21*02e95f1aSMarcin Radomski ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22*02e95f1aSMarcin Radomski ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23*02e95f1aSMarcin Radomski ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24*02e95f1aSMarcin Radomski ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25*02e95f1aSMarcin Radomski ** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
26*02e95f1aSMarcin Radomski ** DAMAGE.
27*02e95f1aSMarcin Radomski */
28*02e95f1aSMarcin Radomski 
29*02e95f1aSMarcin Radomski #ifndef TINYALSA_LIMITS_H
30*02e95f1aSMarcin Radomski #define TINYALSA_LIMITS_H
31*02e95f1aSMarcin Radomski 
32*02e95f1aSMarcin Radomski #include <tinyalsa/interval.h>
33*02e95f1aSMarcin Radomski 
34*02e95f1aSMarcin Radomski #include <limits.h>
35*02e95f1aSMarcin Radomski #include <stdint.h>
36*02e95f1aSMarcin Radomski 
37*02e95f1aSMarcin Radomski #define TINYALSA_SIGNED_INTERVAL_MAX SSIZE_MAX
38*02e95f1aSMarcin Radomski #define TINYALSA_SIGNED_INTERVAL_MIN SSIZE_MIN
39*02e95f1aSMarcin Radomski 
40*02e95f1aSMarcin Radomski #define TINYALSA_UNSIGNED_INTERVAL_MAX SIZE_MAX
41*02e95f1aSMarcin Radomski #define TINYALSA_UNSIGNED_INTERVAL_MIN SIZE_MIN
42*02e95f1aSMarcin Radomski 
43*02e95f1aSMarcin Radomski #define TINYALSA_CHANNELS_MAX 32U
44*02e95f1aSMarcin Radomski #define TINYALSA_CHANNELS_MIN 1U
45*02e95f1aSMarcin Radomski 
46*02e95f1aSMarcin Radomski #define TINYALSA_FRAMES_MAX (ULONG_MAX / (TINYALSA_CHANNELS_MAX * 4))
47*02e95f1aSMarcin Radomski #define TINYALSA_FRAMES_MIN 0U
48*02e95f1aSMarcin Radomski 
49*02e95f1aSMarcin Radomski #if TINYALSA_FRAMES_MAX > TINYALSA_UNSIGNED_INTERVAL_MAX
50*02e95f1aSMarcin Radomski #error "Frames max exceeds measurable value."
51*02e95f1aSMarcin Radomski #endif
52*02e95f1aSMarcin Radomski 
53*02e95f1aSMarcin Radomski #if TINYALSA_FRAMES_MIN < TINYALSA_UNSIGNED_INTERVAL_MIN
54*02e95f1aSMarcin Radomski #error "Frames min exceeds measurable value."
55*02e95f1aSMarcin Radomski #endif
56*02e95f1aSMarcin Radomski 
57*02e95f1aSMarcin Radomski extern const struct tinyalsa_unsigned_interval tinyalsa_channels_limit;
58*02e95f1aSMarcin Radomski 
59*02e95f1aSMarcin Radomski extern const struct tinyalsa_unsigned_interval tinyalsa_frames_limit;
60*02e95f1aSMarcin Radomski 
61*02e95f1aSMarcin Radomski #endif /* TINYALSA_LIMITS_H */
62*02e95f1aSMarcin Radomski 
63