Main Page | Class List | File List | Class Members | File Members

spi.h File Reference

SPI ( Serial Periphereal Interface ) subsystem definitions. More...

#include <linux/types.h>
#include <linux/list.h>

Include dependency graph for spi.h:

Include dependency graph

Go to the source code of this file.

Classes

struct  spi_msg
struct  spi_ops
struct  spi_driver
 A driver is capable of handling one or more physical devices present on SPI adapters. This information is used to inform the driver of adapter events. More...

struct  spi_algorithm
struct  spi_cs
struct  spi_adapter
struct  spi_client
struct  spi_rdwr_ioctl_data

Defines

#define SPI_M_RD   0x01 /**< Read mode flag */
#define SPI_M_WR   0x02 /**< Write mode flag */
#define SPI_M_NOADDR   0x04
#define SPI_CS   0x08 /**< CS active lecel ( default low ) */
#define SPI_MAJOR   228 /* This will change */
#define SPI_DF_NOTIFY   0x01 /* notify on bus (de/a)ttaches */
#define SPI_DF_DUMMY   0x02 /* do not connect any clients */
#define SPI_RDWR   0x6207 /**< IOCTL Combined R/W transfer (one stop only)*/
#define SPI_SETADDR   0x6206 /**< IOCTL Combined R/W transfer (one stop only)*/
#define SPI_FUNCS   0x6205 /**< IOCTL Get the adapter functionality */

Functions

int spi_add_adapter (struct spi_adapter *)
 Make the adapter available for use by clients using name adap->name. The adap->adapters list is initialised by this function.

int spi_del_adapter (struct spi_adapter *)
 Remove an adapter from the list of available SPI Bus adapters.

int spi_add_driver (struct spi_driver *)
int spi_del_driver (struct spi_driver *)
int spi_attach_client (struct spi_client *, const char *, const char *)
int spi_detach_client (struct spi_client *)
int spi_transfer (struct spi_adapter *, struct spi_msg msgs[], int)
int spi_write (struct spi_client *, int, const char *, int)
int spi_read (struct spi_client *, int, char *, int)
int spi_adapter_id (struct spi_adapter *adap)
int spi_command (struct spi_client *clnt, int cmd, void *arg)
int spi_open (struct spi_client *clnt)
void spi_close (struct spi_client *clnt)


Detailed Description

SPI ( Serial Periphereal Interface ) subsystem definitions.


Define Documentation

#define SPI_CS   0x08 /**< CS active lecel ( default low ) */
 

CS active lecel ( default low )

#define SPI_DF_NOTIFY   0x01 /* notify on bus (de/a)ttaches */
 

flags for the driver struct:

#define SPI_FUNCS   0x6205 /**< IOCTL Get the adapter functionality */
 

IOCTL Get the adapter functionality

#define SPI_M_RD   0x01 /**< Read mode flag */
 

Read mode flag

#define SPI_M_WR   0x02 /**< Write mode flag */
 

Write mode flag

#define SPI_RDWR   0x6207 /**< IOCTL Combined R/W transfer (one stop only)*/
 

IOCTL Combined R/W transfer (one stop only)

#define SPI_SETADDR   0x6206 /**< IOCTL Combined R/W transfer (one stop only)*/
 

IOCTL Combined R/W transfer (one stop only)


Function Documentation

int spi_adapter_id struct spi_adapter adap  ) 
 

spi_adapter_id This call returns a unique low identifier for each registered adapter

Parameters:
adap:spi_adapter 
Returns:
unique id or -1 if the adapter was not registered.

int spi_add_adapter struct spi_adapter adap  ) 
 

Make the adapter available for use by clients using name adap->name. The adap->adapters list is initialised by this function.

spi_add_adapter - register a new SPI bus adapter

Parameters:
adap: spi_adapter structure for the registering adapter

Returns:
0;

int spi_add_driver struct spi_driver driver  ) 
 

spi_add_driver - register a new SPI device driver

Parameters:
driver - driver structure to make available
Make the driver available for use by clients using name driver->name. The driver->drivers list is initialised by this function.

Returns 0;

int spi_attach_client struct spi_client client,
const char *  adap,
const char *  drv
 

spi_attach_client - attach a client to an adapter and driver

Parameters:
client: client structure to attach
adap: adapter (module) name
drv: driver (module) name
Attempt to attach a client (a user of a device driver) to a particular driver and adapter. If the specified driver or adapter aren't registered, request_module is used to load the relevant modules.

Returns 0 on success, or negative error code.

Here is the call graph for this function:

int spi_command struct spi_client clnt,
int  cmd,
void *  arg
[inline, static]
 

spi_command - send a command to a SPI device driver : registered client structure : device driver command

  • : device driver arguments
Ask the SPI device driver to perform some function. Further information should be sought from the device driver in question.

Returns negative error code on failure.

int spi_del_adapter struct spi_adapter adap  ) 
 

Remove an adapter from the list of available SPI Bus adapters.

spi_del_adapter - unregister a SPI bus adapter

Parameters:
adap: spi_adapter structure to unregister

Returns:
0;

int spi_del_driver struct spi_driver driver  ) 
 

spi_del_driver - unregister a SPI device driver

Parameters:
driver: driver to remove
Remove an driver from the list of available SPI Bus device drivers.

Returns 0;

int spi_detach_client struct spi_client client  ) 
 

spi_detach_client - detach a client from an adapter and driver

Parameters:
client: client structure to detach
Detach the client from the adapter and driver.

Here is the call graph for this function:

int spi_read struct spi_client client,
int  addr,
char *  buf,
int  len
 

spi_read - receive data from a device on an SPI bus

Parameters:
client: registered client structure
addr: SPI bus address
buf: buffer for bytes to receive
len: number of bytes to receive
Receive len bytes from device address addr on the SPI bus described by client to a buffer pointed to by buf.

Returns the number of bytes transferred, or negative error code.

Here is the call graph for this function:

int spi_transfer struct spi_adapter adap,
struct spi_msg  msgs[],
int  num
 

spi_transfer - transfer information on an SPI bus

Parameters:
adap: adapter structure to perform transfer on
msgs: array of spi_msg structures describing transfer
num: number of spi_msg structures
Transfer the specified messages to/from a device on the SPI bus.

Returns number of messages successfully transferred, otherwise negative error code.

int spi_write struct spi_client client,
int  addr,
const char *  buf,
int  len
 

spi_write - send data to a device on an SPI bus

Parameters:
client: registered client structure
addr: SPI bus address
buf: buffer for bytes to send
len: number of bytes to send
Send len bytes pointed to by buf to device address addr on the SPI bus described by client.

Returns:
the number of bytes transferred, or negative error code.

Here is the call graph for this function:


Generated on Sun Oct 24 20:23:17 2004 for Linux SPI subsystem by doxygen 1.3.6