1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /* Copyright (c) 2010-2012 Broadcom. All rights reserved. */
7 /******************************************************************************
9 *****************************************************************************/
11 // Macros to manipulate 'FOURCC' values
12 #define MAKE_FOURCC(x) ((int32_t)((x[0] << 24) | (x[1] << 16) | (x[2] << 8) | x[3]))
14 // Opaque handle for a VCHIQ instance
15 struct vchiq_instance;
17 /******************************************************************************
18 * Global funcs - implementation is specific to which side you are on
20 *****************************************************************************/
22 // Routine used to initialise the vchi on both local + remote connections
23 extern int32_t vchi_initialise(struct vchiq_instance **instance);
25 extern int32_t vchi_connect(struct vchiq_instance *instance);
27 //When this is called, ensure that all services have no data pending.
28 //Bulk transfers can remain 'queued'
29 extern int32_t vchi_disconnect(struct vchiq_instance *instance);
31 /******************************************************************************
33 *****************************************************************************/
34 // Routine to open a named service
35 extern int vchi_service_open(struct vchiq_instance *instance,
36 struct vchiq_service_params *params,
39 extern int32_t vchi_get_peer_version(unsigned handle, short *peer_version);
41 // Routine to close a named service
42 extern int32_t vchi_service_close(unsigned handle);
44 // Routine to increment ref count on a named service
45 extern int32_t vchi_service_use(unsigned handle);
47 // Routine to decrement ref count on a named service
48 extern int32_t vchi_service_release(unsigned handle);
50 /* Routine to send a message from kernel memory across a service */
51 extern int vchi_queue_kernel_message(unsigned handle, void *data,
54 // Routine to look at a message in place.
55 // The message is dequeued, so the caller is left holding it; the descriptor is
56 // filled in and must be released when the user has finished with the message.
57 struct vchiq_header *vchi_msg_hold(unsigned handle);
59 /*******************************************************************************
60 * Global service support API - operations on held messages
61 * and message iterators
62 ******************************************************************************/
64 // Routine to release a held message after it has been processed
65 extern int32_t vchi_held_msg_release(unsigned handle, struct vchiq_header *message);
67 /******************************************************************************
69 *****************************************************************************/
71 // Routine to prepare interface for a transfer from the other side
72 extern int32_t vchi_bulk_queue_receive(unsigned handle,
75 enum vchiq_bulk_mode mode,
76 void *transfer_handle);
78 // Routine to queue up data ready for transfer to the other (once they have signalled they are ready)
79 extern int32_t vchi_bulk_queue_transmit(unsigned handle,
82 enum vchiq_bulk_mode mode,
83 void *transfer_handle);
85 /******************************************************************************
86 * Configuration plumbing
87 *****************************************************************************/
91 /****************************** End of file **********************************/