|
Zephyr Project API 4.4.99
A Scalable Open Source RTOS
|
Interfaces for Virtual I/O (VIRTIO) devices. More...
Topics | |
| Virtqueue Interface | |
| Virtqueue Interface. | |
Files | |
| file | virtio.h |
| Main header file for Virtio driver API. | |
| file | virtio_config.h |
| VIRTIO common definitions based on the specification. | |
Data Structures | |
| struct | virtio_driver_api |
| @driver_ops{VIRTIO} More... | |
Typedefs | |
| typedef uint16_t(* | virtio_enumerate_queues) (uint16_t queue_idx, uint16_t max_queue_size, void *opaque) |
| Callback used during virtqueue enumeration. | |
Functions | |
| static struct virtq * | virtio_get_virtqueue (const struct device *dev, uint16_t queue_idx) |
| Returns virtqueue at given idx. | |
| static void | virtio_notify_virtqueue (const struct device *dev, uint16_t queue_idx) |
| Notifies virtqueue. | |
| static void * | virtio_get_device_specific_config (const struct device *dev) |
| Returns device specific config. | |
| static bool | virtio_read_device_feature_bit (const struct device *dev, int bit) |
| Returns feature bit offered by virtio device. | |
| static int | virtio_write_driver_feature_bit (const struct device *dev, int bit, bool value) |
| Sets feature bit. | |
| static int | virtio_commit_feature_bits (const struct device *dev) |
| Commits feature bits. | |
| static int | virtio_init_virtqueues (const struct device *dev, uint16_t num_queues, virtio_enumerate_queues cb, void *opaque) |
| Initializes virtqueues. | |
| static void | virtio_finalize_init (const struct device *dev) |
| Finalizes initialization of the virtio device. | |
| typedef struct virtq *(* | virtio_api_get_virtqueue) (const struct device *dev, uint16_t queue_idx) |
| @def_driverbackendgroup{VIRTIO,virtio_interface} | |
| typedef void(* | virtio_api_notify_virtqueue) (const struct device *dev, uint16_t queue_idx) |
| Type definition of VIRTIO API function for notifying a virtqueue. | |
| typedef void *(* | virtio_api_get_device_specific_config) (const struct device *dev) |
| Type definition of VIRTIO API function for getting the device specific config. | |
| typedef bool(* | virtio_api_read_device_feature_bit) (const struct device *dev, int bit) |
| Type definition of VIRTIO API function for reading a device feature bit. | |
| typedef int(* | virtio_api_write_driver_feature_bit) (const struct device *dev, int bit, bool value) |
| Type definition of VIRTIO API function for writing a driver feature bit. | |
| typedef int(* | virtio_api_commit_feature_bits) (const struct device *dev) |
| Type definition of VIRTIO API function for committing the feature bits. | |
| typedef int(* | virtio_api_init_virtqueues) (const struct device *dev, uint16_t num_queues, virtio_enumerate_queues cb, void *opaque) |
| Type definition of VIRTIO API function for initializing the virtqueues. | |
| typedef void(* | virtio_api_finalize_init) (const struct device *dev) |
| Type definition of VIRTIO API function for finalizing the initialization. | |
Interfaces for Virtual I/O (VIRTIO) devices.
| typedef int(* virtio_api_commit_feature_bits) (const struct device *dev) |
#include <virtio.h>
Type definition of VIRTIO API function for committing the feature bits.
See virtio_commit_feature_bits() for argument descriptions.
| typedef void(* virtio_api_finalize_init) (const struct device *dev) |
#include <virtio.h>
Type definition of VIRTIO API function for finalizing the initialization.
See virtio_finalize_init() for argument descriptions.
| typedef void *(* virtio_api_get_device_specific_config) (const struct device *dev) |
#include <virtio.h>
Type definition of VIRTIO API function for getting the device specific config.
See virtio_get_device_specific_config() for argument descriptions.
#include <virtio.h>
@def_driverbackendgroup{VIRTIO,virtio_interface}
Type definition of VIRTIO API function for getting a virtqueue. See virtio_get_virtqueue() for argument descriptions.
| typedef int(* virtio_api_init_virtqueues) (const struct device *dev, uint16_t num_queues, virtio_enumerate_queues cb, void *opaque) |
#include <virtio.h>
Type definition of VIRTIO API function for initializing the virtqueues.
See virtio_init_virtqueues() for argument descriptions.
#include <virtio.h>
Type definition of VIRTIO API function for notifying a virtqueue.
See virtio_notify_virtqueue() for argument descriptions.
#include <virtio.h>
Type definition of VIRTIO API function for reading a device feature bit.
See virtio_read_device_feature_bit() for argument descriptions.
#include <virtio.h>
Type definition of VIRTIO API function for writing a driver feature bit.
See virtio_write_driver_feature_bit() for argument descriptions.
| typedef uint16_t(* virtio_enumerate_queues) (uint16_t queue_idx, uint16_t max_queue_size, void *opaque) |
#include <virtio.h>
Callback used during virtqueue enumeration.
| queue_idx | index of currently inspected queue |
| max_queue_size | maximum permitted size of currently inspected queue |
| opaque | pointer to user provided data |
|
inlinestatic |
#include <virtio.h>
Commits feature bits.
| dev | virtio device it operates on |
|
inlinestatic |
#include <virtio.h>
Finalizes initialization of the virtio device.
| dev | virtio device it operates on |
|
inlinestatic |
#include <virtio.h>
Returns device specific config.
| dev | virtio device it operates on |
#include <virtio.h>
Returns virtqueue at given idx.
| dev | virtio device it operates on |
| queue_idx | index of virtqueue to get |
|
inlinestatic |
#include <virtio.h>
Initializes virtqueues.
| dev | virtio device it operates on |
| num_queues | number of queues to initialize |
| cb | callback called for each available virtqueue |
| opaque | pointer to user provided data that will be passed to the callback |
#include <virtio.h>
Notifies virtqueue.
Note that according to spec 2.7.13.3 the device may access the buffers as soon as the avail->idx is increased, which is done by virtq_add_buffer_chain, so the device may access the buffers even without notifying it with virtio_notify_virtqueue
| dev | virtio device it operates on |
| queue_idx | virtqueue to be notified |
#include <virtio.h>
Returns feature bit offered by virtio device.
| dev | virtio device it operates on |
| bit | selected bit |