class::hal::CFifo

class hal::CFifo
  : public hal::Device

The Channeled FIFO allows access to channeled fifo devices. A channeled FIFO device is a FIFO with multiple independent channels. The file descriptor’s location/offset (updated with lseek()) is used to set the channel.

Summary

int exit(

int channel
) const

int flush(

int channel
) const

int get_count() const

int get_info(

cfifo_info_t & info
) const

int get_info(

int channel,
fifo_info_t & info
) const

FifoInfo get_info(

int channel
)

int get_owner(

int channel,
int & owner
) const

u32 get_ready_channels() const

int init(

int channel
) const

int initialize(

int channel
) const

int set_attr(

int channel,
const fifo_attr_t & attr
) const

int set_attributes(

int channel,
const fifo_attr_t & attr
) const

int set_owner(

int channel,
int owner
) const

int set_writeblock(

int channel,
bool value
) const

Members

int exit(

int channel
) const

Exits the FIFO specified by channel.

Parameters

  • channel The FIFO channel to de-initialize

Returns

Zero on success


int flush(

int channel
) const

Flushes the FIFO specified by channel.

Parameters

  • channel The channel to flush

Returns

Zero on success


int get_count() const

Gets the number of channels in the channeled fifo.


int get_info(

cfifo_info_t & info
) const

Gets the info for the channeled fifo.


int get_info(

int channel,
fifo_info_t & info
) const

Gets the info specified by channel.

Parameters

  • channel The channel for which to fetch the FIFO info

  • info A reference to the destination information

Returns

Zero on success


FifoInfo get_info(

int channel
)

Returns the Fifo info for the specified channel.


int get_owner(

int channel,
int & owner
) const

Gets the owner of the specified channel.

Parameters

  • channel The channel that is queried

  • owner A reference to write the owner value

Returns

Zero on success or less than zero for an error

This method along with set_owner() provides a mechanism to reserve the channel for a particular application. If the owner has been set to a non-zero value, it is already being used by another process and should not be used.


u32 get_ready_channels() const

Gets a bitmask of channels that have at least one byte that is ready to be read.

Returns

Bitmask of channels that are ready to be read


int init(

int channel
) const


int initialize(

int channel
) const

Initializes the FIFO specified by channel.

Parameters

  • channel The FIFO channel to initialize

Returns

Zero on success


int set_attr(

int channel,
const fifo_attr_t & attr
) const


int set_attributes(

int channel,
const fifo_attr_t & attr
) const

Sets the FIFO attributes specified by channel.

Parameters

  • channel The channel for which to set the FIFO attributes

  • attr A reference to the fifo attributes

Returns


int set_owner(

int channel,
int owner
) const

Sets the owner of a channel.

Parameters

  • channel The channel

  • owner The owner (usually the process ID)

Returns

Zero on success

This method is used with get_owner() to allow processes to reserve channels for passing information.


int set_writeblock(

int channel,
bool value
) const

Enables or disables write blocking on the FIFO specified by channel.

Parameters

  • channel The target channel

  • value True to enable write blocking

Returns

Zero on success

If write blocking is enabled, the FIFO will block (or return EAGAIN is O_NONBLOCK is on) if no bytes can be written to the FIFO. If a single byte can be written, write() will return 1.

With write blocking disable, write() will never block. It will simply overwrite the data that is already in the FIFO.


X

Thanks for Coming!

Subscribe to news and updates