Firmware
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PX4IO_serial Class Referenceabstract
Inheritance diagram for PX4IO_serial:
device::Device

Public Member Functions

virtual int init ()=0
 Initialise the driver and make it ready for use. More...
 
virtual int read (unsigned offset, void *data, unsigned count=1)
 Read directly from the device. More...
 
virtual int write (unsigned address, void *data, unsigned count=1)
 Write directly to the device. More...
 
- Public Member Functions inherited from device::Device
virtual ~Device ()=default
 Destructor. More...
 
virtual int ioctl (unsigned operation, unsigned &arg)
 Perform a device-specific operation. More...
 
uint8_t get_device_bus () const
 Return the bus ID the device is connected to. More...
 
uint32_t get_device_id () const
 
DeviceBusType get_device_bus_type () const
 Return the bus type the device is connected to. More...
 
uint8_t get_device_address () const
 Return the bus address of the device. More...
 
void set_device_address (int address)
 
void set_device_type (uint8_t devtype)
 Set the device type. More...
 
virtual bool external ()
 

Protected Member Functions

int init (IOPacket *io_buffer)
 Does the PX4IO_serial instance initialization. More...
 
virtual int _bus_exchange (IOPacket *_packet)=0
 Start the transaction with IO and wait for it to complete.
 
- Protected Member Functions inherited from device::Device
 Device (const char *name)
 
 Device (DeviceBusType bus_type, uint8_t bus, uint8_t address, uint8_t devtype=0)
 
 Device (const Device &)=delete
 
Deviceoperator= (const Device &)=delete
 
 Device (Device &&)=delete
 
Deviceoperator= (Device &&)=delete
 

Protected Attributes

perf_counter_t _pc_txns
 Performance counters.
 
perf_counter_t _pc_retries
 
perf_counter_t _pc_timeouts
 
perf_counter_t _pc_crcerrs
 
perf_counter_t _pc_protoerrs
 
perf_counter_t _pc_uerrs
 
perf_counter_t _pc_idle
 
perf_counter_t _pc_badidle
 
- Protected Attributes inherited from device::Device
union DeviceId _device_id
 device identifier information
 
const char * _name
 driver name
 
bool _debug_enabled {false}
 if true, debug messages are printed
 

Additional Inherited Members

- Public Types inherited from device::Device
enum  DeviceBusType { DeviceBusType_UNKNOWN = 0, DeviceBusType_I2C = 1, DeviceBusType_SPI = 2, DeviceBusType_UAVCAN = 3 }
 Device bus types for DEVID.
 
- Static Public Member Functions inherited from device::Device
static const char * get_device_bus_string (DeviceBusType bus)
 
static int device_id_print_buffer (char *buffer, int length, uint32_t id)
 Print decoded device id string to a buffer. More...
 

Member Function Documentation

§ init() [1/2]

virtual int PX4IO_serial::init ( )
pure virtual

Initialise the driver and make it ready for use.

Returns
OK if the driver initialized OK, negative errno otherwise;

Reimplemented from device::Device.

§ init() [2/2]

int PX4IO_serial::init ( IOPacket io_buffer)
protected

Does the PX4IO_serial instance initialization.

Parameters
io_bufferThe IO buffer that should be used for transfers.
Returns
0 on success.

§ read()

int PX4IO_serial::read ( unsigned  address,
void *  data,
unsigned  count = 1 
)
virtual

Read directly from the device.

The actual size of each unit quantity is device-specific.

Parameters
offsetThe device address at which to start reading
dataThe buffer into which the read values should be placed.
countThe number of items to read.
Returns
The number of items read on success, negative errno otherwise.

Reimplemented from device::Device.

§ write()

int PX4IO_serial::write ( unsigned  address,
void *  data,
unsigned  count = 1 
)
virtual

Write directly to the device.

The actual size of each unit quantity is device-specific.

Parameters
addressThe device address at which to start writing.
dataThe buffer from which values should be read.
countThe number of items to write.
Returns
The number of items written on success, negative errno otherwise.

Reimplemented from device::Device.


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