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 service information
15 struct opaque_vchi_service_t;
17 // Descriptor for a held message. Allocated by client, initialised by vchi_msg_hold,
18 // vchi_msg_iter_hold or vchi_msg_iter_hold_next. Fields are for internal VCHI use only.
19 struct vchi_held_msg {
20 struct opaque_vchi_service_t *service;
28 // Opaque handle for a VCHIQ instance
29 struct vchiq_instance;
31 /******************************************************************************
32 * Global funcs - implementation is specific to which side you are on
34 *****************************************************************************/
36 // Routine used to initialise the vchi on both local + remote connections
37 extern int32_t vchi_initialise(struct vchiq_instance **instance);
39 extern int32_t vchi_connect(struct vchiq_instance *instance);
41 //When this is called, ensure that all services have no data pending.
42 //Bulk transfers can remain 'queued'
43 extern int32_t vchi_disconnect(struct vchiq_instance *instance);
45 /******************************************************************************
47 *****************************************************************************/
48 // Routine to open a named service
49 extern int32_t vchi_service_open(struct vchiq_instance *instance,
50 struct vchiq_service_params *setup,
51 struct vchi_service **service);
53 extern int32_t vchi_get_peer_version(struct vchi_service *service,
56 // Routine to close a named service
57 extern int32_t vchi_service_close(struct vchi_service *service);
59 // Routine to increment ref count on a named service
60 extern int32_t vchi_service_use(struct vchi_service *service);
62 // Routine to decrement ref count on a named service
63 extern int32_t vchi_service_release(struct vchi_service *service);
65 /* Routine to send a message from kernel memory across a service */
66 extern int vchi_queue_kernel_message(struct vchi_service *service, void *data,
69 // Routine to look at a message in place.
70 // The message is dequeued, so the caller is left holding it; the descriptor is
71 // filled in and must be released when the user has finished with the message.
72 extern int32_t vchi_msg_hold(unsigned handle,
73 void **data, // } may be NULL, as info can be
74 uint32_t *msg_size, // } obtained from HELD_MSG_T
75 struct vchi_held_msg *message_descriptor);
77 /*******************************************************************************
78 * Global service support API - operations on held messages
79 * and message iterators
80 ******************************************************************************/
82 // Routine to release a held message after it has been processed
83 extern int32_t vchi_held_msg_release(struct vchi_held_msg *message);
85 /******************************************************************************
87 *****************************************************************************/
89 // Routine to prepare interface for a transfer from the other side
90 extern int32_t vchi_bulk_queue_receive(struct vchi_service *service,
93 enum vchiq_bulk_mode mode,
94 void *transfer_handle);
96 // Routine to queue up data ready for transfer to the other (once they have signalled they are ready)
97 extern int32_t vchi_bulk_queue_transmit(struct vchi_service *service,
100 enum vchiq_bulk_mode mode,
101 void *transfer_handle);
103 /******************************************************************************
104 * Configuration plumbing
105 *****************************************************************************/
109 /****************************** End of file **********************************/