1/*
2 * Copyright 2018, Data61
3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO)
4 * ABN 41 687 119 230.
5 *
6 * This software may be distributed and modified according to the terms of
7 * the BSD 2-Clause license. Note that NO WARRANTY is provided.
8 * See "LICENSE_BSD2.txt" for details.
9 *
10 * @TAG(DATA61_BSD)
11 */
12
13#pragma once
14
15#include <virtqueue.h>
16#include <camkes/virtqueue.h>
17
18/* Registers a virtqueue channel. This is expected to be called from a template.
19 * @param virtqueue_id A unique id (< MAX_CAMKES_VIRTQUEUE_ID) to register the
20 * channel with
21 * @param size Size of the virtqueue buffer shared memory region
22 * @param buf A pointer to the shared memory region used to create a virtqueue
23 * @param notify A function pointer that performs a signal on the virtqueue
24 * @param recv_notification Capability to notification that can receive events from other end
25 * @param recv_badge Badge value for events received on the notification
26 * @param role The components role over the virtqueue channel (DEVICE or DRIVER)
27 * @return Positive 0 on success, -1 on error
28 */
29int camkes_virtqueue_channel_register(int virtqueue_id, const char *interface_name, unsigned queue_len, size_t size,
30									  volatile void *buf, void (*notify)(void),
31                                      seL4_CPtr recv_notification, seL4_Word recv_badge, virtqueue_role_t role);
32