diff options
Diffstat (limited to 'drivers/staging/vc04_services/interface/vchi/vchi.h')
-rw-r--r-- | drivers/staging/vc04_services/interface/vchi/vchi.h | 102 |
1 files changed, 52 insertions, 50 deletions
diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index f85562b9ba9e..56b1037d8e25 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -8,17 +8,17 @@ #include "interface/vchi/vchi_common.h" /****************************************************************************** - Global defs + * Global defs *****************************************************************************/ -#define VCHI_BULK_ROUND_UP(x) ((((unsigned long)(x))+VCHI_BULK_ALIGN-1) & ~(VCHI_BULK_ALIGN-1)) -#define VCHI_BULK_ROUND_DOWN(x) (((unsigned long)(x)) & ~(VCHI_BULK_ALIGN-1)) -#define VCHI_BULK_ALIGN_NBYTES(x) (VCHI_BULK_ALIGNED(x) ? 0 : (VCHI_BULK_ALIGN - ((unsigned long)(x) & (VCHI_BULK_ALIGN-1)))) +#define VCHI_BULK_ROUND_UP(x) ((((unsigned long)(x)) + VCHI_BULK_ALIGN - 1) & ~(VCHI_BULK_ALIGN - 1)) +#define VCHI_BULK_ROUND_DOWN(x) (((unsigned long)(x)) & ~(VCHI_BULK_ALIGN - 1)) +#define VCHI_BULK_ALIGN_NBYTES(x) (VCHI_BULK_ALIGNED(x) ? 0 : (VCHI_BULK_ALIGN - ((unsigned long)(x) & (VCHI_BULK_ALIGN - 1)))) #ifdef USE_VCHIQ_ARM #define VCHI_BULK_ALIGNED(x) 1 #else -#define VCHI_BULK_ALIGNED(x) (((unsigned long)(x) & (VCHI_BULK_ALIGN-1)) == 0) +#define VCHI_BULK_ALIGNED(x) (((unsigned long)(x) & (VCHI_BULK_ALIGN - 1)) == 0) #endif struct vchi_version { @@ -45,18 +45,19 @@ struct vchi_held_msg { struct service_creation { struct vchi_version version; int32_t service_id; - VCHI_CALLBACK_T callback; + vchi_callback callback; void *callback_param; }; // Opaque handle for a VCHI instance -typedef struct opaque_vchi_instance_handle_t *VCHI_INSTANCE_T; +struct vchi_instance_handle; // Opaque handle for a server or client -typedef struct opaque_vchi_service_handle_t *VCHI_SERVICE_HANDLE_T; +struct vchi_service_handle; /****************************************************************************** - Global funcs - implementation is specific to which side you are on (local / remote) + * Global funcs - implementation is specific to which side you are on + * (local / remote) *****************************************************************************/ #ifdef __cplusplus @@ -64,98 +65,99 @@ extern "C" { #endif // Routine used to initialise the vchi on both local + remote connections -extern int32_t vchi_initialise(VCHI_INSTANCE_T *instance_handle); +extern int32_t vchi_initialise(struct vchi_instance_handle **instance_handle); extern int32_t vchi_exit(void); -extern int32_t vchi_connect(VCHI_INSTANCE_T instance_handle); +extern int32_t vchi_connect(struct vchi_instance_handle *instance_handle); //When this is called, ensure that all services have no data pending. //Bulk transfers can remain 'queued' -extern int32_t vchi_disconnect(VCHI_INSTANCE_T instance_handle); +extern int32_t vchi_disconnect(struct vchi_instance_handle *instance_handle); // helper functions -extern void *vchi_allocate_buffer(VCHI_SERVICE_HANDLE_T handle, uint32_t *length); -extern void vchi_free_buffer(VCHI_SERVICE_HANDLE_T handle, void *address); -extern uint32_t vchi_current_time(VCHI_INSTANCE_T instance_handle); +extern void *vchi_allocate_buffer(struct vchi_service_handle *handle, uint32_t *length); +extern void vchi_free_buffer(struct vchi_service_handle *handle, void *address); +extern uint32_t vchi_current_time(struct vchi_instance_handle *instance_handle); /****************************************************************************** - Global service API + * Global service API *****************************************************************************/ // Routine to destroy a service -extern int32_t vchi_service_destroy(const VCHI_SERVICE_HANDLE_T handle); +extern int32_t vchi_service_destroy(const struct vchi_service_handle *handle); // Routine to open a named service -extern int32_t vchi_service_open(VCHI_INSTANCE_T instance_handle, +extern int32_t vchi_service_open(struct vchi_instance_handle *instance_handle, struct service_creation *setup, - VCHI_SERVICE_HANDLE_T *handle); + struct vchi_service_handle **handle); -extern int32_t vchi_get_peer_version(const VCHI_SERVICE_HANDLE_T handle, +extern int32_t vchi_get_peer_version(const struct vchi_service_handle *handle, short *peer_version); // Routine to close a named service -extern int32_t vchi_service_close(const VCHI_SERVICE_HANDLE_T handle); +extern int32_t vchi_service_close(const struct vchi_service_handle *handle); // Routine to increment ref count on a named service -extern int32_t vchi_service_use(const VCHI_SERVICE_HANDLE_T handle); +extern int32_t vchi_service_use(const struct vchi_service_handle *handle); // Routine to decrement ref count on a named service -extern int32_t vchi_service_release(const VCHI_SERVICE_HANDLE_T handle); +extern int32_t vchi_service_release(const struct vchi_service_handle *handle); // Routine to set a control option for a named service -extern int32_t vchi_service_set_option(const VCHI_SERVICE_HANDLE_T handle, - VCHI_SERVICE_OPTION_T option, - int value); +extern int32_t vchi_service_set_option(const struct vchi_service_handle *handle, + enum vchi_service_option option, + int value); /* Routine to send a message from kernel memory across a service */ extern int -vchi_queue_kernel_message(VCHI_SERVICE_HANDLE_T handle, +vchi_queue_kernel_message(struct vchi_service_handle *handle, void *data, unsigned int size); /* Routine to send a message from user memory across a service */ extern int -vchi_queue_user_message(VCHI_SERVICE_HANDLE_T handle, +vchi_queue_user_message(struct vchi_service_handle *handle, void __user *data, unsigned int size); // Routine to receive a msg from a service // Dequeue is equivalent to hold, copy into client buffer, release -extern int32_t vchi_msg_dequeue(VCHI_SERVICE_HANDLE_T handle, +extern int32_t vchi_msg_dequeue(struct vchi_service_handle *handle, void *data, uint32_t max_data_size_to_read, uint32_t *actual_msg_size, - VCHI_FLAGS_T flags); + enum vchi_flags flags); // Routine to look at a message in place. // The message is not dequeued, so a subsequent call to peek or dequeue // will return the same message. -extern int32_t vchi_msg_peek(VCHI_SERVICE_HANDLE_T handle, +extern int32_t vchi_msg_peek(struct vchi_service_handle *handle, void **data, uint32_t *msg_size, - VCHI_FLAGS_T flags); + enum vchi_flags flags); // Routine to remove a message after it has been read in place with peek // The first message on the queue is dequeued. -extern int32_t vchi_msg_remove(VCHI_SERVICE_HANDLE_T handle); +extern int32_t vchi_msg_remove(struct vchi_service_handle *handle); // Routine to look at a message in place. // The message is dequeued, so the caller is left holding it; the descriptor is // filled in and must be released when the user has finished with the message. -extern int32_t vchi_msg_hold(VCHI_SERVICE_HANDLE_T handle, +extern int32_t vchi_msg_hold(struct vchi_service_handle *handle, void **data, // } may be NULL, as info can be uint32_t *msg_size, // } obtained from HELD_MSG_T - VCHI_FLAGS_T flags, + enum vchi_flags flags, struct vchi_held_msg *message_descriptor); // Initialise an iterator to look through messages in place -extern int32_t vchi_msg_look_ahead(VCHI_SERVICE_HANDLE_T handle, +extern int32_t vchi_msg_look_ahead(struct vchi_service_handle *handle, struct vchi_msg_iter *iter, - VCHI_FLAGS_T flags); + enum vchi_flags flags); -/****************************************************************************** - Global service support API - operations on held messages and message iterators - *****************************************************************************/ +/******************************************************************************* + * Global service support API - operations on held messages + * and message iterators + ******************************************************************************/ // Routine to get the address of a held message extern void *vchi_held_msg_ptr(const struct vchi_held_msg *message); @@ -196,42 +198,42 @@ extern int32_t vchi_msg_iter_hold_next(struct vchi_msg_iter *iter, struct vchi_held_msg *message); /****************************************************************************** - Global bulk API + * Global bulk API *****************************************************************************/ // Routine to prepare interface for a transfer from the other side -extern int32_t vchi_bulk_queue_receive(VCHI_SERVICE_HANDLE_T handle, +extern int32_t vchi_bulk_queue_receive(struct vchi_service_handle *handle, void *data_dst, uint32_t data_size, - VCHI_FLAGS_T flags, + enum vchi_flags flags, void *transfer_handle); // Prepare interface for a transfer from the other side into relocatable memory. -int32_t vchi_bulk_queue_receive_reloc(const VCHI_SERVICE_HANDLE_T handle, +int32_t vchi_bulk_queue_receive_reloc(const struct vchi_service_handle *handle, uint32_t offset, uint32_t data_size, - const VCHI_FLAGS_T flags, + const enum vchi_flags flags, void * const bulk_handle); // Routine to queue up data ready for transfer to the other (once they have signalled they are ready) -extern int32_t vchi_bulk_queue_transmit(VCHI_SERVICE_HANDLE_T handle, +extern int32_t vchi_bulk_queue_transmit(struct vchi_service_handle *handle, const void *data_src, uint32_t data_size, - VCHI_FLAGS_T flags, + enum vchi_flags flags, void *transfer_handle); /****************************************************************************** - Configuration plumbing + * Configuration plumbing *****************************************************************************/ #ifdef __cplusplus } #endif -extern int32_t vchi_bulk_queue_transmit_reloc(VCHI_SERVICE_HANDLE_T handle, +extern int32_t vchi_bulk_queue_transmit_reloc(struct vchi_service_handle *handle, uint32_t offset, uint32_t data_size, - VCHI_FLAGS_T flags, + enum vchi_flags flags, void *transfer_handle); #endif /* VCHI_H_ */ |