]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4virtio/lib/l4virtio.cc
Update
[l4.git] / l4 / pkg / l4virtio / lib / l4virtio.cc
1 /*
2  * Created on: 12.11.2013
3  *     Author: Matthias Lange <matthias.lange@kernkonzept.com>
4  *             Alexander Warg <alexander.wagr@kernkonzept.com>
5  */
6
7 #include <l4/l4virtio/virtio.h>
8 #include <l4/l4virtio/l4virtio>
9
10 L4_CV int
11 l4virtio_set_status(l4_cap_idx_t cap, unsigned status) L4_NOTHROW
12 {
13   return L4::Cap<L4virtio::Device>(cap)->set_status(status);
14 }
15
16 L4_CV int
17 l4virtio_config_queue(l4_cap_idx_t cap, unsigned queue) L4_NOTHROW
18 {
19   return L4::Cap<L4virtio::Device>(cap)->config_queue(queue);
20 }
21
22 L4_CV int
23 l4virtio_register_ds(l4_cap_idx_t cap, l4_cap_idx_t ds_cap,
24                      l4_uint64_t base, l4_umword_t offset,
25                      l4_umword_t sz) L4_NOTHROW
26 {
27   L4::Ipc::Cap<L4Re::Dataspace> ds;
28   ds = L4::Ipc::Cap<L4Re::Dataspace>::from_ci(ds_cap);
29   return L4::Cap<L4virtio::Device>(cap)->register_ds(ds, base, offset, sz);
30 }
31
32 L4_CV int
33 l4virtio_register_iface(l4_cap_idx_t cap, l4_cap_idx_t guest_irq,
34                         l4_cap_idx_t host_irq, l4_cap_idx_t config_ds) L4_NOTHROW
35 {
36   L4::Ipc::Cap<L4::Irq> girq;
37   girq = L4::Ipc::make_cap(L4::Cap<L4::Irq>(guest_irq), L4_CAP_FPAGE_RW);
38   return L4::Cap<L4virtio::Device>(cap)
39     ->register_iface(girq, L4::Cap<L4::Irq>(host_irq),
40                      L4::Cap<L4Re::Dataspace>(config_ds));
41 }