spi_getdevinfo()

Updated: April 19, 2023

The spi_getdevinfo() function gets the information for a specific device on the SPI bus. The prototype for this function is:

int spi_getdevinfo( int fd,
                    uint32_t device,
                    spi_devinfo_t *devinfo );

The arguments are:

fd
The file descriptor returned by spi_open().
device
The device you want to get information about:
Specify: To get information about:
SPI_DEV_ID_NONE The first device
A device ID ORed with SPI_DEV_DEFAULT The specified device
A device ID The next device
devinfo
A pointer to the device information structure:
typedef struct {
    uint32_t    device;     /* Device ID */
    char        name[16];   /* Device description */
    spi_cfg_t   cfg;        /* Device configuration */
} spi_devinfo_t;
  

This function returns EOK if the device information is obtained successfully.