Write a value in the device command or status register
#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 );
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.
If any error occurs, you should assume that the storage pointed to by a non-NULL cmd_p or status_p contains invalid data.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | No |
Thread | Yes |