build_mux_command_device_read_ba()

QNX SDP8.0PCI Server User's GuideAPIConfiguration

Build a command to perform base address register read requests

Synopsis:

#include <pci/pci_mux.h>

int build_mux_command_device_read_ba( req_read_ba_t *req,
                                      pcimux_devhdl_t hdl,
                                      int nba,
                                      pcimux_req_type_t reqType );

Arguments:

req
A pointer to a req_read_ba_t structure.
hdl
The connection handle from pci_mux_init().
nba
The number of base address entries to read.
reqType
One of the following request types:
  • pcimux_reqType_e_MANDATORY — Specify the base address numbers to get information for.

    If you specify pcimux_reqType_e_MANDATORY, you may use the bar_num array in the req_read_ba_t structure to specify the BARs (base address requests) by number, from which information is to be retrieved from. Valid BAR numbers are from 0 through 5, inclusive. Use a BAR number of -1 to retrieve address space information for expansion ROMs.

    The definition of req_read_ba_t is:
    typedef struct req_read_ba_ {
        pci_mux_req_t     hdr;        /* Header information */
        pcimux_devhdl_t   hdl;        /* Connection handle */
        int_t             nba;        /* Number of base address entries */
        pcimux_req_type_t reqType;    /* Request type */
        int_t             bar_num[7]; /* BAR numbers */
    } req_read_ba_t;
                                    
  • pcimux_reqType_e_UNSPECIFIED — The system reads base address entries associated with the specified device sequentially, up to the lesser of req->nba or the actual number of associated base addresses.

Library:

libpci

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

Description:

The build_mux_command_device_read_ba() function builds a command for pci_mux_command() to send. The function then returns a response in the form of a reply_read_ba_t structure, which contains BAR information.

Returns:

A reply_read_ba_t structure, which includes the members listed below:

typedef struct __attribute__( ( packed, aligned( 8 ) ) ) reply_read_ba_ {
    pci_mux_req_t   hdr;
    pcimux_ba_t     ba[7];
    pcimux_err_t    err;
    int_t           nba;
} reply_read_ba_t;
hdr
The header information for the reply structure.
ba
An array of size 7. The first reply nba entries will be filled out with BAR information upon successful completion.
err
An error code from pci_device_read_ba() or one of the following:
  • PCI_ERR_OK — Successfully read nba (reply side) number of BARs and populated the ba array.
  • PCI_ERR_ENOENT — Failed to find device based on hdl.
nba
If you set the reqType to pci_reqType_e_MANDATORY, the reply nba will be equal to the request nba. Otherwise:
  • If the requested nba was greater than or equal to the number of BAR entries, the reply nba is the number of valid entries in ba, which is less than or equal to the requested nba.
  • If the requested nba was less than or equal to the number of BARs implemented in hardware, nba contains a value that's the 2's complement of the number of base addresses.

Classification:

QNX OS

Safety:
Cancellation point No
Signal handler No
Thread Yes
Page updated: