spibus0at91.c File Reference

Primary AT91 SPI bus controller. More...

Go to the source code of this file.

Functions

int At91Spi0ChipSelect (uint_fast8_t cs, uint_fast8_t hi)
 Set the specified chip select to a given level.
int At91SpiBus0Select (NUTSPINODE *node, uint32_t tmo)
 Select a device on the first SPI bus.
int At91SpiBus0Deselect (NUTSPINODE *node)
 Deselect a device on the first SPI bus.
void At91SpiBus0Interrupt (void *arg)
int At91SpiBus0Transfer (NUTSPINODE *node, CONST void *txbuf, void *rxbuf, int xlen)
 Transfer data on the SPI bus using single buffered interrupt mode.

Variables

NUTSPIBUS spiBus0At91
 AT91 SPI bus driver implementation structure.

Detailed Description

Primary AT91 SPI bus controller.

May be configured as an interrupt driven or polling driver. The interrupt driven version may use single or double buffering.

 * $Id: spibus0at91.c 2467 2009-02-17 09:30:02Z haraldkipp $
 * 

Definition in file spibus0at91.c.


Function Documentation

int At91Spi0ChipSelect ( uint_fast8_t  cs,
uint_fast8_t  hi 
)

Set the specified chip select to a given level.

Definition at line 121 of file spibus0at91.c.

References EIO, and errno.

Referenced by At91SpiBus0Deselect(), At91SpiBus0Select(), and At91SpiBusNodeInit().

int At91SpiBus0Select ( NUTSPINODE *  node,
uint32_t  tmo 
)

Select a device on the first SPI bus.

Locks and activates the bus for the specified node.

Parameters:
node Specifies the SPI bus node.
tmo Timeout in milliseconds. To disable timeout, set this parameter to NUT_WAIT_INFINITE.
Returns:
0 on success. In case of an error, -1 is returned and the bus is not locked.

Definition at line 185 of file spibus0at91.c.

References _BV, At91Spi0ChipSelect(), At91SpiSetup(), EIO, errno, NUTASSERT, NutEventPost(), NutEventWait(), outr, PIO_PDR_OFF, PMC_PCER, SPI0_ID, SPI0_PINS, SPI0_PIO_BASE, SPI0_PSR_OFF, SPI_MODE_CSHIGH, SPI_MODE_UPDATE, and SPI_SPIEN.

int At91SpiBus0Deselect ( NUTSPINODE *  node  ) 

Deselect a device on the first SPI bus.

Deactivates the chip select and unlocks the bus.

Parameters:
node Specifies the SPI bus node.
Returns:
Always 0.

Definition at line 236 of file spibus0at91.c.

References At91Spi0ChipSelect(), At91SpiBusWait(), NUT_WAIT_INFINITE, NUTASSERT, NutEventPost(), and SPI_MODE_CSHIGH.

void At91SpiBus0Interrupt ( void *  arg  ) 

Definition at line 260 of file spibus0at91.c.

References inb, NutEventPostFromIrq, and outb.

Referenced by At91SpiBusNodeInit().

int At91SpiBus0Transfer ( NUTSPINODE *  node,
CONST void *  txbuf,
void *  rxbuf,
int  xlen 
)

Transfer data on the SPI bus using single buffered interrupt mode.

A device must have been selected by calling At91SpiSelect().

Parameters:
node Specifies the SPI bus node.
txbuf Pointer to the transmit buffer. If NULL, undetermined byte values are transmitted.
rxbuf Pointer to the receive buffer. If NULL, then incoming data is discarded.
xlen Number of bytes to transfer.
Returns:
Always 0.

Definition at line 296 of file spibus0at91.c.

References NUT_WAIT_INFINITE, NUTASSERT, NutEventWait(), outr, SPI_IDR_OFF, SPI_IER_OFF, SPI_RDRF, and SPI_TDR_OFF.


Variable Documentation

NUTSPIBUS spiBus0At91
Initial value:

AT91 SPI bus driver implementation structure.

Definition at line 328 of file spibus0at91.c.


© 2000-2010 by contributors - visit http://www.ethernut.de/