cdev_setup()

Complete the setup for a character device's state structure

Synopsis:

#include <qvm/cdev.h>
int cdev_setup(struct cdev_state *cds,
               struct vdev_s *vdev,
               unsigned size)

Arguments:

cds
A pointer to a structure with the character device state (see cdev_state).
vdev
A pointer to the structure for the vdev that is using this state (see vdev_s).
size
The size, in bytes, of the input and output buffers.

Description:

This function allocates both the internal input and output buffers for the specified character device, and makes them both the specified size.

You should specify a non-zero size and use cdev_input_available() and cdev_write_buffer() to read and write data.

Note:
Currently, you can set size to zero (0) to use your own input and output buffers instead of the internal buffers. In this case, you must use cdev_read() and cdev_write() to read and write device data. However, the functionality of setting size to zero is deprecated and will be removed in a future release.

Returns:

EOK on success; otherwise, an errno value.

Page updated: