MMAL_3-15-2015
mmal_vc_api.h
Go to the documentation of this file.
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 #ifndef MMAL_VC_API_H
29 #define MMAL_VC_API_H
30 
37 #include "interface/mmal/mmal_types.h"
38 #include "interface/mmal/mmal_parameters.h"
39 #include "interface/mmal/mmal_port.h"
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
48 typedef enum {
49  MMAL_STATS_COMP_IDLE,
50  MMAL_STATS_COMP_CREATED,
51  MMAL_STATS_COMP_DESTROYING,
52  MMAL_STATS_COMP_DESTROYED,
53  MMAL_STATS_COMP_UNUSED = 0xffffffff /* force 32bit */
55 
59  struct MMAL_DRIVER_COMPONENT_T *comp;
61  uint32_t pid;
62  uint32_t pool_mem_alloc_size;
63  char name[20];
64 };
65 
69 {
70  struct
71  {
72  uint32_t rx;
73  uint32_t rx_zero_copy;
74  uint32_t rx_empty;
75  uint32_t rx_fails;
76  uint32_t tx;
77  uint32_t tx_zero_copy;
78  uint32_t tx_empty;
79  uint32_t tx_fails;
80  uint32_t tx_short_msg;
81  uint32_t rx_short_msg;
82  } buffers;
83  struct service
84  {
85  uint32_t created;
86  uint32_t pending_destroy;
87  uint32_t destroyed;
88  uint32_t failures;
89  } service;
90  struct commands
91  {
92  uint32_t bad_messages;
93  uint32_t executed;
94  uint32_t failed;
95  uint32_t replies;
96  uint32_t reply_fails;
97  } commands;
98  struct
99  {
100  uint32_t tx;
101  uint32_t tx_fails;
102  } events;
103  struct
104  {
105  uint32_t created;
106  uint32_t destroyed;
107  uint32_t destroying;
108  uint32_t failed;
109  uint32_t list_size;
110  struct MMAL_VC_COMP_STATS_T component_list[8];
111  } components;
112  struct
113  {
114  uint32_t enqueued_messages;
115  uint32_t dequeued_messages;
116  uint32_t max_parameter_set_delay;
117  uint32_t max_messages_waiting;
118  } worker;
119 
120 };
121 typedef struct MMAL_VC_STATS_T MMAL_VC_STATS_T;
122 
123 /* Simple circular text buffer used to store 'interesting' data
124  * from MMAL clients. e.g. settings for each picture taken */
126 {
128  char buffer[16 << 10];
130  uint32_t magic;
132  int32_t offset;
134  unsigned count;
135 };
137 
140 typedef enum
141 {
142  MMAL_STATS_FOUND,
143  MMAL_STATS_COMPONENT_NOT_FOUND,
144  MMAL_STATS_PORT_NOT_FOUND,
145  MMAL_STATS_INVALID = 0x7fffffff
147 
148 MMAL_STATUS_T mmal_vc_init(void);
149 void mmal_vc_deinit(void);
150 
151 MMAL_STATUS_T mmal_vc_use(void);
152 MMAL_STATUS_T mmal_vc_release(void);
153 
154 MMAL_STATUS_T mmal_vc_get_version(uint32_t *major, uint32_t *minor, uint32_t *minimum);
155 MMAL_STATUS_T mmal_vc_get_stats(MMAL_VC_STATS_T *stats, int reset);
156 
169  MMAL_STATS_RESULT_T *result,
170  char *name,
171  size_t namelen,
172  MMAL_PORT_TYPE_T type,
173  unsigned component,
174  unsigned port,
175  MMAL_CORE_STATS_DIR dir,
176  MMAL_BOOL_T reset);
187 MMAL_STATUS_T mmal_vc_host_log(const char *msg);
188 
189 /* For backwards compatibility in builds */
190 #define MMAL_VC_API_HAVE_HOST_LOG
191 
192 /* VC DEBUG ONLY ************************************************************/
209 MMAL_STATUS_T mmal_vc_consume_mem(size_t size, uint32_t *handle);
210 
211 typedef enum
212 {
213  MMAL_VC_COMPACT_NONE = 0,
214  MMAL_VC_COMPACT_NORMAL = 1,
215  MMAL_VC_COMPACT_DISCARD = 2,
216  MMAL_VC_COMPACT_AGGRESSIVE = 4,
217  MMAL_VC_COMPACT_SHUFFLE = 0x80,
218  MMAL_VC_COMPACT_ALL = MMAL_VC_COMPACT_NORMAL | MMAL_VC_COMPACT_DISCARD | MMAL_VC_COMPACT_AGGRESSIVE,
219 } MMAL_VC_COMPACT_MODE_T;
220 
224 MMAL_STATUS_T mmal_vc_compact(MMAL_VC_COMPACT_MODE_T mode, uint32_t *duration);
225 
229 MMAL_STATUS_T mmal_vc_lmk(uint32_t alloc_size);
230 
231 #ifdef __cplusplus
232 }
233 #endif
234 #endif
Definition: mmal_common.h:64
Definition: mmal_vc_api.h:90
uint32_t destroyed
Definition: mmal_vc_api.h:87
uint32_t pending_destroy
Definition: mmal_vc_api.h:86
uint32_t rx_fails
Definition: mmal_vc_api.h:75
uint32_t failures
Definition: mmal_vc_api.h:88
MMAL_PORT_TYPE_T
Definition: mmal_port.h:45
MMAL_STATUS_T mmal_vc_get_core_stats(MMAL_CORE_STATISTICS_T *stats, MMAL_STATS_RESULT_T *result, char *name, size_t namelen, MMAL_PORT_TYPE_T type, unsigned component, unsigned port, MMAL_CORE_STATS_DIR dir, MMAL_BOOL_T reset)
MMAL_STATS_RESULT_T
Definition: mmal_vc_api.h:140
uint32_t created
Definition: mmal_vc_api.h:85
Definition: mmal_vc_api.h:83
uint32_t tx_fails
Definition: mmal_vc_api.h:79
uint32_t rx
Definition: mmal_vc_api.h:72
uint32_t tx_zero_copy
Definition: mmal_vc_api.h:77
MMAL_STATS_COMP_STATE_T
Definition: mmal_vc_api.h:48
uint32_t tx
Definition: mmal_vc_api.h:76
uint32_t rx_zero_copy
Definition: mmal_vc_api.h:73
uint32_t rx_empty
Definition: mmal_vc_api.h:74
uint32_t tx_short_msg
Definition: mmal_vc_api.h:80
uint32_t rx_short_msg
Definition: mmal_vc_api.h:81
Definition: mmal_vc_api.h:125
MMAL_STATUS_T mmal_vc_host_log(const char *msg)
unsigned count
Definition: mmal_vc_api.h:134
uint32_t magic
Definition: mmal_vc_api.h:130
uint32_t tx_empty
Definition: mmal_vc_api.h:78
Definition: mmal_vc_api.h:58
MMAL_STATUS_T
Definition: mmal_types.h:46
MMAL_STATUS_T mmal_vc_lmk(uint32_t alloc_size)
int32_t offset
Definition: mmal_vc_api.h:132
Definition: mmal_vc_api.h:68
char buffer[16<< 10]
Definition: mmal_vc_api.h:128
MMAL_STATUS_T mmal_vc_consume_mem(size_t size, uint32_t *handle)
MMAL_STATUS_T mmal_vc_compact(MMAL_VC_COMPACT_MODE_T mode, uint32_t *duration)