pci_device_write_cmd(), pci_device_write_status()

Write a value in the device command or status register

Synopsis:

#include <pci/pci.h>

pci_err_t pci_device_write_cmd( pci_devhdl_t hdl,
                                pci_cmd_t cmd,
                                pci_cmd_t *cmd_p );

pci_err_t pci_device_write_status( pci_devhdl_t hdl,
                                   pci_stat_t status,
                                   pci_stat_t *status_p );

Arguments:

hdl
The handle of the device, obtained by calling pci_device_attach().
cmd, status
The value that you want to write in the appropriate register.
cmd_p, status_p
NULL, or a pointer to a location where the function can store the old value.

Library:

libpci

Use the -l pci option to qcc to link against this library.

Description:

The pci_device_write_cmd() and pci_device_write_status() functions provide write access to the device command and status registers at offsets 0x4 and 0x6, respectively. The value to write is contained in cmd or status argument, respectively. If the optional cmd_p or status_p argument isn't NULL, the functions update it with the contents of the respective register after the write operation is completed (the register is read after the write).

Both functions return a pci_err_t that indicates success or failure. These functions take a pci_devhdl_t parameter as their first argument, and therefore you must successfully attach to the device before you can write the respective register.

Returns:

PCI_ERR_OK
Success.
PCI_ERR_EINVAL
You didn't successfully attach to the device.
PCI_ERR_ENODEV
The hdl argument doesn't refer to a valid device.

If any error occurs, you should assume that the storage pointed to by a non-NULL cmd_p or status_p contains invalid data.

Classification:

QNX Neutrino

Safety:  
Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes

See also:

pci_device_read*()