diff options
Diffstat (limited to 'test cases/common/215 source set realistic example/devices')
5 files changed, 51 insertions, 0 deletions
diff --git a/test cases/common/215 source set realistic example/devices/meson.build b/test cases/common/215 source set realistic example/devices/meson.build new file mode 100644 index 0000000..68ee68e --- /dev/null +++ b/test cases/common/215 source set realistic example/devices/meson.build @@ -0,0 +1,3 @@ +specific.add(when: 'CONFIG_VIRTIO', if_true: files('virtio.cc')) +common.add(when: 'CONFIG_VIRTIO_PCI', if_true: files('virtio-pci.cc')) +common.add(when: 'CONFIG_VIRTIO_MMIO', if_true: files('virtio-mmio.cc')) diff --git a/test cases/common/215 source set realistic example/devices/virtio-mmio.cc b/test cases/common/215 source set realistic example/devices/virtio-mmio.cc new file mode 100644 index 0000000..5dab97e --- /dev/null +++ b/test cases/common/215 source set realistic example/devices/virtio-mmio.cc @@ -0,0 +1,16 @@ +#include <iostream> +#include "common.h" +#include "virtio.h" + +struct VirtioMMIODevice: VirtioDevice { + void say_hello(); +}; + +void VirtioMMIODevice::say_hello() +{ + some_virtio_thing(); + std::cout << ANSI_START << "virtio-mmio is available" + << ANSI_END << std::endl; +} + +static VirtioMMIODevice virtio_mmio; diff --git a/test cases/common/215 source set realistic example/devices/virtio-pci.cc b/test cases/common/215 source set realistic example/devices/virtio-pci.cc new file mode 100644 index 0000000..7df7a82 --- /dev/null +++ b/test cases/common/215 source set realistic example/devices/virtio-pci.cc @@ -0,0 +1,16 @@ +#include <iostream> +#include "common.h" +#include "virtio.h" + +struct VirtioPCIDevice: VirtioDevice { + void say_hello(); +}; + +void VirtioPCIDevice::say_hello() +{ + some_virtio_thing(); + std::cout << ANSI_START << "virtio-pci is available" + << ANSI_END << std::endl; +} + +static VirtioPCIDevice virtio_pci; diff --git a/test cases/common/215 source set realistic example/devices/virtio.cc b/test cases/common/215 source set realistic example/devices/virtio.cc new file mode 100644 index 0000000..fc51275 --- /dev/null +++ b/test cases/common/215 source set realistic example/devices/virtio.cc @@ -0,0 +1,6 @@ +#include <iostream> +#include "common.h" +#include "virtio.h" + +void VirtioDevice::some_virtio_thing() { +} diff --git a/test cases/common/215 source set realistic example/devices/virtio.h b/test cases/common/215 source set realistic example/devices/virtio.h new file mode 100644 index 0000000..a157731 --- /dev/null +++ b/test cases/common/215 source set realistic example/devices/virtio.h @@ -0,0 +1,10 @@ +#ifndef VIRTIO_H +#define VIRTIO_H 1 + +#include "common.h" + +struct VirtioDevice: Device { + void some_virtio_thing(); +}; + +#endif |