My Project
mmal_vc_msgs.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_MSGS_H
29 #define MMAL_VC_MSGS_H
30 
36 #include "interface/vcos/vcos.h"
37 #include "interface/mmal/mmal.h"
38 #include "mmal_vc_api.h"
39 
40 #define MMAL_CONTROL_FOURCC() VCHIQ_MAKE_FOURCC('m','m','a','l')
41 
42 /* Major version indicates binary backwards compatibility */
43 #define WORKER_VER_MAJOR 16
44 #define WORKER_VER_MINIMUM 10
45 /* Minor version is not used normally.
46  */
47 #define WORKER_VER_MINOR 1
48 #ifndef WORKER_VER_MINIMUM
49 #endif
50 
51 #define VIDEOCORE_PREFIX "vc"
52 
53 #define MMAL_MAX_PORTS 8
55 #define MMAL_WORKER_MAX_MSG_LEN 512
56 #define MMAL_VC_CORE_STATS_NAME_MAX 32
61 #define MMAL_WORKER_MSG_LEN 28
62 
66 #define MMAL_FORMAT_EXTRADATA_MAX_SIZE 128
67 
70 #define MMAL_VC_SHORT_DATA 128
71 
75 /* Please update the array in mmal_vc_msgnames.c if this is updated.
76  */
77 typedef enum {
96  /* VC debug mode only - due to security, denial of service implications */
108 
111 typedef struct
112 {
113  uint32_t magic;
114  uint32_t msgid;
115  struct MMAL_CONTROL_SERVICE_T *control_service;
117  union {
118  struct MMAL_WAITER_T *waiter;
119  } u;
120 
122  /* Make sure this structure is 64 bit aligned */
123  uint32_t dummy;
125 
126 /* Make sure mmal_worker_msg_header will preserve 64 bits alignment */
128 
129 /* Message structures sent to worker thread.
130  */
131 
135 typedef struct
136 {
140 
142 typedef struct
143 {
145  uint32_t flags;
146  uint32_t major;
147  uint32_t minor;
148  uint32_t minimum;
150 
152 typedef struct
153 {
156  char name[128];
157  uint32_t pid;
159 
163 typedef struct
164 {
167  uint32_t component_handle;
168  uint32_t input_num;
169  uint32_t output_num;
170  uint32_t clock_num;
173 
176 typedef struct
177 {
179  uint32_t component_handle;
181 
184 typedef struct
185 {
187  uint32_t component_handle;
189 
192 typedef struct
193 {
195  uint32_t component_handle;
197 
200 typedef struct
201 {
203  uint32_t component_handle;
205  uint32_t index;
208 
211 typedef struct
212 {
214  uint32_t component_handle;
216  uint32_t index;
220  uint8_t extradata[MMAL_FORMAT_EXTRADATA_MAX_SIZE];
223 
225 typedef struct
226 {
229  uint32_t component_handle;
231  uint32_t index;
232  int32_t found;
233  uint32_t port_handle;
237  uint8_t extradata[MMAL_FORMAT_EXTRADATA_MAX_SIZE];
240 
241 typedef struct
242 {
246 
247 typedef struct
248 {
251  uint8_t secret[32];
254 
255 typedef struct
256 {
259  uint32_t time;
262 
265 {
274 };
275 
278 typedef struct
279 {
282  uint32_t port_handle;
284 
286  union {
287  struct {
289  } enable;
290  struct {
291  uint32_t component_handle;
292  uint32_t port_handle;
293  } connect;
294  } param;
295 
298 
299 #define MMAL_WORKER_PORT_PARAMETER_SPACE 96
300 
301 #define MMAL_WORKER_PORT_PARAMETER_SET_MAX \
302  (MMAL_WORKER_PORT_PARAMETER_SPACE*sizeof(uint32_t)+sizeof(MMAL_PARAMETER_HEADER_T))
303 
304 #define MMAL_WORKER_PORT_PARAMETER_GET_MAX MMAL_WORKER_PORT_PARAMETER_SET_MAX
305 
308 typedef struct
309 {
311  uint32_t component_handle;
312  uint32_t port_handle;
317 
320 typedef struct
321 {
323  uint32_t component_handle;
324  uint32_t port_handle;
329 
330 typedef struct
331 {
333  uint32_t component_handle;
334  uint32_t port_handle;
337 
340 typedef struct
341 {
348 
354 {
355  uint32_t magic;
356  uint32_t component_handle;
357  uint32_t port_handle;
361 };
362 
369 {
371 
376 
383 
387 
390 
396 
399 
403 #define MMAL_WORKER_EVENT_SPACE 256
404 
411 {
413 
415  uint32_t port_type;
416  uint32_t port_num;
417 
418  uint32_t cmd;
419  uint32_t length;
421  MMAL_BUFFER_HEADER_T *delayed_buffer; /* Only used to remember buffer for bulk rx */
424 
425 typedef struct
426 {
429  uint32_t reset;
432 
433 typedef enum {
439 
440 typedef struct
441 {
444  uint32_t handle;
446  char description[32];
448 
449 /*
450  * Per-port core statistics
451  */
452 typedef struct
453 {
455  uint32_t component_index;
456  uint32_t port_index;
461 
462 typedef struct
463 {
468  char component_name[MMAL_VC_CORE_STATS_NAME_MAX];
470 
471 typedef struct
472 {
475  /* The amount of memory to reserve */
476  uint32_t size;
477  /* Handle to newly allocated memory or MEM_HANDLE_INVALD on failure */
478  uint32_t handle;
481 
482 typedef struct
483 {
486  uint32_t mode;
487  uint32_t duration;
490 
491 typedef struct
492 {
494  /* Message text to add to the circular buffer */
498 
499 typedef struct
500 {
502  /* The memory allocation size to pass to lmk, as if in a response to an
503  * allocation for this amount of memory. */
504  uint32_t alloc_size;
507 
508 static inline void mmal_vc_buffer_header_to_msg(mmal_worker_buffer_from_host *msg,
509  MMAL_BUFFER_HEADER_T *header)
510 {
511  msg->buffer_header.cmd = header->cmd;
512  msg->buffer_header.offset = header->offset;
513  msg->buffer_header.length = header->length;
514  msg->buffer_header.flags = header->flags;
515  msg->buffer_header.pts = header->pts;
516  msg->buffer_header.dts = header->dts;
517  msg->buffer_header.alloc_size = header->alloc_size;
518  msg->buffer_header.data = header->data;
519  msg->buffer_header_type_specific = *header->type;
520 }
521 
522 static inline void mmal_vc_msg_to_buffer_header(MMAL_BUFFER_HEADER_T *header,
524 {
525  header->cmd = msg->buffer_header.cmd;
526  header->offset = msg->buffer_header.offset;
527  header->length = msg->buffer_header.length;
528  header->flags = msg->buffer_header.flags;
529  header->pts = msg->buffer_header.pts;
530  header->dts = msg->buffer_header.dts;
531  *header->type = msg->buffer_header_type_specific;
532 }
533 
534 #endif
535 
mmal_worker_msg_header header
Definition: mmal_vc_msgs.h:257
struct MMAL_DRIVER_BUFFER_T drvbuf
Definition: mmal_vc_msgs.h:375
mmal_worker_msg_header header
Definition: mmal_vc_msgs.h:454
#define MMAL_VC_SHORT_DATA
Definition: mmal_vc_msgs.h:70
struct MMAL_CONTROL_SERVICE_T * control_service
Definition: mmal_vc_msgs.h:115
MMAL_PARAMETER_HEADER_T param
Definition: mmal_vc_msgs.h:325
mmal_worker_msg_header header
Definition: mmal_vc_msgs.h:412
mmal_worker_msg_header header
Definition: mmal_vc_msgs.h:213
MMAL_PORT_TYPE_T port_type
Definition: mmal_vc_msgs.h:230
MMAL_PORT_TYPE_T port_type
Definition: mmal_vc_msgs.h:215
mmal_worker_msg_header header
Definition: mmal_vc_msgs.h:370
struct MMAL_WAITER_T * waiter
Definition: mmal_vc_msgs.h:118
MMAL_WORKER_CMD_T
Definition: mmal_vc_msgs.h:77
MMAL_ES_FORMAT_T format
Definition: mmal_vc_msgs.h:235
mmal_worker_msg_header header
Definition: mmal_vc_msgs.h:280
MMAL_PARAMETER_HEADER_T param
Definition: mmal_vc_msgs.h:313
MMAL_WORKER_OPAQUE_MEM_OP op
Definition: mmal_vc_msgs.h:443
mmal_worker_msg_header header
Definition: mmal_vc_msgs.h:332
mmal_worker_msg_header header
Definition: mmal_vc_msgs.h:493
#define MMAL_WORKER_EVENT_SPACE
Definition: mmal_vc_msgs.h:403
mmal_worker_msg_header header
Definition: mmal_vc_msgs.h:427
MMAL_PORT_TYPE_T
Definition: mmal_port.h:45
#define MMAL_WORKER_PORT_PARAMETER_SPACE
Definition: mmal_vc_msgs.h:299
#define MMAL_VC_CORE_STATS_NAME_MAX
Definition: mmal_vc_msgs.h:56
MMAL_STATUS_T status
Definition: mmal_vc_msgs.h:485
uint32_t alloc_size
Definition: mmal_vc_msgs.h:504
MMAL_PORT_TYPE_T port_type
Definition: mmal_vc_msgs.h:204
#define MMAL_FORMAT_EXTRADATA_MAX_SIZE
Definition: mmal_vc_msgs.h:66
struct MMAL_DRIVER_BUFFER_T drvbuf_ref
Definition: mmal_vc_msgs.h:382
uint8_t short_data[MMAL_VC_SHORT_DATA]
Definition: mmal_vc_msgs.h:395
mmal_worker_msg_header header
Definition: mmal_vc_msgs.h:137
MMAL_STATS_RESULT_T
Definition: mmal_vc_api.h:140
mmal_worker_msg_header header
Definition: mmal_vc_msgs.h:202
struct mmal_worker_buffer_from_host mmal_worker_buffer_from_host
mmal_worker_msg_header header
Definition: mmal_vc_msgs.h:178
MMAL_BUFFER_HEADER_TYPE_SPECIFIC_T * type
Definition: mmal_buffer.h:95
MMAL_WORKER_PORT_ACTIONS
Definition: mmal_vc_msgs.h:264
MMAL_PARAMETER_HEADER_T param
Definition: mmal_vc_msgs.h:335
MMAL_STATUS_T status
Definition: mmal_vc_msgs.h:121
MMAL_ES_SPECIFIC_FORMAT_T es
Definition: mmal_vc_msgs.h:236
struct MMAL_COMPONENT_T * client_component
Definition: mmal_vc_msgs.h:414
mmal_worker_msg_header header
Definition: mmal_vc_msgs.h:227
MMAL_BUFFER_HEADER_T * delayed_buffer
Definition: mmal_vc_msgs.h:421
vcos_static_assert(!(sizeof(mmal_worker_msg_header) &0x7))
struct MMAL_VC_CLIENT_BUFFER_CONTEXT_T * client_context
Definition: mmal_vc_msgs.h:360
mmal_worker_msg_header header
Definition: mmal_vc_msgs.h:473
mmal_worker_msg_header header
Definition: mmal_vc_msgs.h:144
mmal_worker_msg_header header
Definition: mmal_vc_msgs.h:154
#define MMAL_WORKER_MSG_LEN
Definition: mmal_vc_msgs.h:61
MMAL_BUFFER_HEADER_T buffer_header
Definition: mmal_vc_msgs.h:385
mmal_worker_msg_header header
Definition: mmal_vc_msgs.h:310
struct mmal_worker_event_to_host mmal_worker_event_to_host
mmal_worker_msg_header header
Definition: mmal_vc_msgs.h:186
mmal_worker_msg_header header
Definition: mmal_vc_msgs.h:501
uint8_t data[MMAL_WORKER_EVENT_SPACE]
Definition: mmal_vc_msgs.h:420
MMAL_PARAMETER_HEADER_T param
Definition: mmal_vc_msgs.h:344
MMAL_ES_SPECIFIC_FORMAT_T es
Definition: mmal_vc_msgs.h:219
int32_t MMAL_BOOL_T
Definition: mmal_common.h:60
mmal_worker_msg_header header
Definition: mmal_vc_msgs.h:484
mmal_worker_msg_header header
Definition: mmal_vc_msgs.h:194
MMAL_BUFFER_HEADER_TYPE_SPECIFIC_T buffer_header_type_specific
Definition: mmal_vc_msgs.h:386
MMAL_STATUS_T
Definition: mmal_types.h:46
mmal_worker_msg_header header
Definition: mmal_vc_msgs.h:342
MMAL_STATUS_T status
Definition: mmal_vc_msgs.h:244
mmal_worker_msg_header header
Definition: mmal_vc_msgs.h:442
MMAL_ES_FORMAT_T format
Definition: mmal_vc_msgs.h:218
MMAL_VC_STATS_T stats
Definition: mmal_vc_msgs.h:428
#define MMAL_WORKER_MAX_MSG_LEN
Definition: mmal_vc_msgs.h:55
mmal_worker_msg_header header
Definition: mmal_vc_msgs.h:322
mmal_worker_msg_header header
Definition: mmal_vc_msgs.h:243
MMAL_STATUS_T status
Definition: mmal_vc_msgs.h:228
MMAL_WORKER_OPAQUE_MEM_OP
Definition: mmal_vc_msgs.h:433
mmal_worker_msg_header header
Definition: mmal_vc_msgs.h:165
mmal_worker_msg_header header
Definition: mmal_vc_msgs.h:249