Function table

The spi_funcs_t structure is a table of pointers to functions that you can provide for your hardware-specific low-level module. The high-level code calls these functions.

typedef struct {
    size_t  size;   /* size of this structure */
    void*   (*init)( void *hdl, char *options );
    void    (*fini)( void *hdl );
    int     (*drvinfo)( void *hdl, spi_drvinfo_t *info );
    int     (*devinfo)( void *hdl, uint32_t device,
                        spi_devinfo_t *info );
    int     (*setcfg)( void *hdl, uint16_t device,
                       spi_cfg_t *cfg );
    void*   (*xfer)( void *hdl, uint32_t device, uint8_t *buf,
                     int *len );
    int     (*dma_xfer)( void *hdl, uint32_t device,
                         spi_dma_paddr_t *paddr, int len );
} spi_funcs_t;

There has to be a function table entry in the low-level module, and it has to be named spi_drv_entry. High-level code looks for this symbol name to find the function table for the low-level module.