1 | /* |
2 | Copyright (c) 2012, Broadcom Europe Ltd |
3 | All rights reserved. |
4 | |
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted provided that the following conditions are met: |
7 | * Redistributions of source code must retain the above copyright |
8 | notice, this list of conditions and the following disclaimer. |
9 | * Redistributions in binary form must reproduce the above copyright |
10 | notice, this list of conditions and the following disclaimer in the |
11 | documentation and/or other materials provided with the distribution. |
12 | * Neither the name of the copyright holder nor the |
13 | names of its contributors may be used to endorse or promote products |
14 | derived from this software without specific prior written permission. |
15 | |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY |
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ |
27 | |
28 | /** \file mmal_common.h |
29 | * Multi-Media Abstraction Layer - Common definitions |
30 | */ |
31 | |
32 | #ifndef MMAL_COMMON_H |
33 | #define MMAL_COMMON_H |
34 | |
35 | #include <stdlib.h> |
36 | #include <string.h> |
37 | #include <stddef.h> |
38 | #include <assert.h> |
39 | |
40 | #include <interface/vcos/vcos.h> |
41 | |
42 | /* C99 64bits integers */ |
43 | #ifndef INT64_C |
44 | # define INT64_C(value) value##LL |
45 | # define UINT64_C(value) value##ULL |
46 | #endif |
47 | |
48 | #define MMAL_TSRING(s) #s |
49 | #define MMAL_TO_STRING(s) MMAL_TSRING(s) |
50 | |
51 | #define MMAL_COUNTOF(x) (sizeof((x))/sizeof((x)[0])) |
52 | #define MMAL_MIN(a,b) ((a)<(b)?(a):(b)) |
53 | #define MMAL_MAX(a,b) ((a)<(b)?(b):(a)) |
54 | |
55 | /* FIXME: should be different for big endian */ |
56 | #define MMAL_FOURCC(a,b,c,d) ((a) | (b << 8) | (c << 16) | (d << 24)) |
57 | #define MMAL_PARAM_UNUSED(a) (void)(a) |
58 | #define MMAL_MAGIC MMAL_FOURCC('m','m','a','l') |
59 | |
60 | typedef int32_t MMAL_BOOL_T; |
61 | #define MMAL_FALSE 0 |
62 | #define MMAL_TRUE 1 |
63 | |
64 | typedef struct MMAL_CORE_STATISTICS_T |
65 | { |
66 | uint32_t buffer_count; /**< Total buffer count on this port */ |
67 | uint32_t first_buffer_time; /**< Time (us) of first buffer seen on this port */ |
68 | uint32_t last_buffer_time; /**< Time (us) of most recently buffer on this port */ |
69 | uint32_t max_delay; /**< Max delay (us) between buffers, ignoring first few frames */ |
70 | } MMAL_CORE_STATISTICS_T; |
71 | |
72 | /** Statistics collected by the core on all ports, if enabled in the build. |
73 | */ |
74 | typedef struct MMAL_CORE_PORT_STATISTICS_T |
75 | { |
76 | MMAL_CORE_STATISTICS_T rx; |
77 | MMAL_CORE_STATISTICS_T tx; |
78 | } MMAL_CORE_PORT_STATISTICS_T; |
79 | |
80 | /** Unsigned 16.16 fixed point value, also known as Q16.16 */ |
81 | typedef uint32_t MMAL_FIXED_16_16_T; |
82 | |
83 | #endif /* MMAL_COMMON_H */ |
84 | |