Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
spi_bitbang.h File Reference
#include <linux/workqueue.h>

Go to the source code of this file.

Data Structures

struct  spi_bitbang
 

Macros

#define BITBANG_CS_ACTIVE   1 /* normally nCS, active low */
 
#define BITBANG_CS_INACTIVE   0
 

Functions

int spi_bitbang_setup (struct spi_device *spi)
 
void spi_bitbang_cleanup (struct spi_device *spi)
 
int spi_bitbang_transfer (struct spi_device *spi, struct spi_message *m)
 
int spi_bitbang_setup_transfer (struct spi_device *spi, struct spi_transfer *t)
 
int spi_bitbang_start (struct spi_bitbang *spi)
 
int spi_bitbang_stop (struct spi_bitbang *spi)
 

Macro Definition Documentation

#define BITBANG_CS_ACTIVE   1 /* normally nCS, active low */

Definition at line 25 of file spi_bitbang.h.

#define BITBANG_CS_INACTIVE   0

Definition at line 26 of file spi_bitbang.h.

Function Documentation

void spi_bitbang_cleanup ( struct spi_device spi)

spi_bitbang_cleanup - default cleanup for per-word I/O loops

Definition at line 231 of file spi-bitbang.c.

int spi_bitbang_setup ( struct spi_device spi)

spi_bitbang_setup - default setup for per-word I/O loops

Definition at line 184 of file spi-bitbang.c.

int spi_bitbang_setup_transfer ( struct spi_device spi,
struct spi_transfer t 
)

Definition at line 142 of file spi-bitbang.c.

int spi_bitbang_start ( struct spi_bitbang bitbang)

spi_bitbang_start - start up a polled/bitbanging SPI master driver : driver handle

Caller should have zero-initialized all parts of the structure, and then provided callbacks for chip selection and I/O loops. If the master has a transfer method, its final step should call spi_bitbang_transfer; or, that's the default if the transfer routine is not initialized. It should also set up the bus number and number of chipselects.

For i/o loops, provide callbacks either per-word (for bitbanging, or for hardware that basically exposes a shift register) or per-spi_transfer (which takes better advantage of hardware like fifos or DMA engines).

Drivers using per-word I/O loops should use (or call) spi_bitbang_setup, spi_bitbang_cleanup and spi_bitbang_setup_transfer to handle those spi master methods. Those methods are the defaults if the bitbang->txrx_bufs routine isn't initialized.

This routine registers the spi_master, which will process requests in a dedicated task, keeping IRQs unblocked most of the time. To stop processing those requests, call spi_bitbang_stop().

Definition at line 433 of file spi-bitbang.c.

int spi_bitbang_stop ( struct spi_bitbang bitbang)

spi_bitbang_stop - stops the task providing spi communication

Definition at line 493 of file spi-bitbang.c.

int spi_bitbang_transfer ( struct spi_device spi,
struct spi_message m 
)

spi_bitbang_transfer - default submit to transfer queue

Definition at line 384 of file spi-bitbang.c.