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. |
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.
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.
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.
node | Specifies the SPI bus node. | |
tmo | Timeout in milliseconds. To disable timeout, set this parameter to NUT_WAIT_INFINITE. |
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.
node | Specifies the SPI bus node. |
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().
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. |
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.
NUTSPIBUS spiBus0At91 |
{ NULL, NULL, SPI0_BASE, &sig_SPI0, At91SpiBusNodeInit, At91SpiBus0Select, At91SpiBus0Deselect, At91SpiBus0Transfer, NutSpiBusWait, NutSpiBusSetMode, NutSpiBusSetRate, NutSpiBusSetBits }
AT91 SPI bus driver implementation structure.
Definition at line 328 of file spibus0at91.c.