1/*
2Copyright (c) 2012, Broadcom Europe Ltd
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, 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
16THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23ON 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
25SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*/
27
28#ifndef MMAL_VC_CLIENT_H
29#define MMAL_VC_CLIENT_H
30
31/** @file mmal_vc_client_priv.h
32 *
33 * Internal API for vchiq_arm MMAL client.
34 */
35
36struct MMAL_CLIENT_T;
37typedef struct MMAL_CLIENT_T MMAL_CLIENT_T;
38
39void mmal_vc_client_init(void);
40
41/** Hold the context required when sending a buffer to the copro.
42 */
43typedef struct MMAL_VC_CLIENT_BUFFER_CONTEXT_T
44{
45 uint32_t magic;
46
47 /** Called when VC is done with the buffer */
48 void (*callback)(struct mmal_worker_buffer_from_host *);
49
50 /** Called when VC sends an event */
51 void (*callback_event)(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *event);
52
53 /** The port this buffer was sent to */
54 MMAL_PORT_T *port;
55
56 /** The original buffer from the host. */
57 MMAL_BUFFER_HEADER_T *buffer;
58
59 /** The actual message sent to the host */
60 struct mmal_worker_buffer_from_host msg;
61} MMAL_VC_CLIENT_BUFFER_CONTEXT_T;
62
63
64MMAL_CLIENT_T *mmal_vc_get_client(void);
65
66MMAL_STATUS_T mmal_vc_sendwait_message(MMAL_CLIENT_T *client,
67 mmal_worker_msg_header *header,
68 size_t size,
69 uint32_t msgid,
70 void *dest,
71 size_t *destlen,
72 MMAL_BOOL_T send_dummy_bulk);
73
74MMAL_STATUS_T mmal_vc_send_message(MMAL_CLIENT_T *client,
75 mmal_worker_msg_header *header, size_t size,
76 uint8_t *data, size_t data_size,
77 uint32_t msgid);
78
79uint32_t mmal_vc_allocate_client_component(MMAL_COMPONENT_T *component);
80void mmal_vc_release_client_component(MMAL_COMPONENT_T *component);
81
82uint32_t mmal_vc_allocate_client_context(MMAL_VC_CLIENT_BUFFER_CONTEXT_T *context);
83MMAL_VC_CLIENT_BUFFER_CONTEXT_T *mmal_vc_lookup_client_context(int index);
84void mmal_vc_release_client_context(MMAL_VC_CLIENT_BUFFER_CONTEXT_T *context);
85#endif
86
87