adevs
Classes | Public Member Functions | Protected Member Functions | List of all members
adevs::QemuDeviceModel Class Referenceabstract

#include <adevs_qemu.h>

Inheritance diagram for adevs::QemuDeviceModel:
adevs::QemuNic adevs::QemuSerialPort adevs::uCsimSerialPort

Classes

class  io_buffer
 

Public Member Functions

int num_bytes_to_read ()
 
void read_bytes (void *buf)
 
virtual void write_bytes (void *data, int num_bytes)=0
 
virtual void append_qemu_arguments (std::vector< std::string > &args)=0
 
virtual ~QemuDeviceModel ()
 Destructor.
 
 QemuDeviceModel ()
 Constructor.
 
void read_loop ()
 Called by the reading thread to execute the read loop.
 
void init_func ()
 

Protected Member Functions

void start ()
 
virtual io_bufferread ()=0
 
virtual void initialize_io_structures ()=0
 

Detailed Description

This is the interface to be implemented by all device models that will be encapsulated in a model of the computer. The interface is written from the perspective of a person outside the computer.

Member Function Documentation

virtual void adevs::QemuDeviceModel::append_qemu_arguments ( std::vector< std::string > &  args)
pure virtual

The device may append arguments to the qemu command line by appending them to this vector. Distinct elements in the vector will be separated by a space on the command line. This method should called by the simulator prior to forking qemu.

Implemented in adevs::uCsimSerialPort, adevs::QemuSerialPort, and adevs::QemuNic.

int adevs::QemuDeviceModel::num_bytes_to_read ( )

Returns the number of bytes available to be read from the device. For message oriented devices, this will be the size of the next message (e.g., an ethernet frame).

Returns
Number of bytes available to read
void adevs::QemuDeviceModel::read_bytes ( void *  buf)

Copy the available data to the supplied buffer.

Parameters
bufBuffer with space sufficient to hold num_bytes_to_read()
virtual void adevs::QemuDeviceModel::write_bytes ( void *  data,
int  num_bytes 
)
pure virtual

Cause data to arrive at the external, physical port. This call will block if the corresponding write to the underlying file descriptor blocks.

Parameters
dataData buffer to copy to device
num_bytesNumber of bytes to copy

Implemented in adevs::uCsimSerialPort, adevs::QemuSerialPort, and adevs::QemuNic.


The documentation for this class was generated from the following file: