* * $Log: at91_spi.h,v $ * Revision 1.3 2008/08/11 06:59:59 haraldkipp * BSD types replaced by stdint types (feature request #1282721). * * Revision 1.2 2006/10/08 16:48:09 haraldkipp * Documentation fixed * * Revision 1.1 2006/09/29 12:34:59 haraldkipp * Basic AT91 SPI support added. * * *
Definition in file at91_spi.h.
Go to the source code of this file.
Defines | |
#define | SPI_SETSPEED 0x0401 |
#define | SPI_GETSPEED 0x0402 |
#define | SPI_SETMODE 0x0403 |
#define | SPI_GETMODE 0x0404 |
#define | SPIMF_MASTER 0x00000001 |
#define | SPIMF_PCSDEC 0x00000002 |
#define | SPIMF_MFDETECT 0x00000004 |
#define | SPIMF_LOOPBACK 0x00000008 |
#define | SPIMF_SCKIAHI 0x00000010 |
#define | SPIMF_CAPRISE 0x00000020 |
#define | SPIMF_KEEPCS 0x00000040 |
#define | SPI_SETDATABITS 0x0405 |
#define | SPI_GETDATABITS 0x0406 |
Functions | |
int | At91Spi0Init (void) |
Initialize the first serial peripheral interface on the AT91 MCU. | |
int | At91Spi0InitChipSelects (u_int mask) |
Initialize specified SPI0 chip selects on the AT91 MCU. | |
int | At91Spi0Enable (void) |
Initialize the second serial peripheral interface on the AT91 MCU. | |
int | At91SpiInit (u_int base) |
Initialize serial peripheral interface on the AT91 MCU. | |
int | At91SpiReset (u_int base) |
Reset serial peripheral interface on the AT91 MCU. | |
int | At91SpiInitChipSelects (u_int base, u_int mask) |
Initialize specified SPI chip selects on the AT91 MCU. | |
int | At91SpiSetRate (u_int base, u_int cs, uint32_t rate) |
Configure the SPI rate. | |
uint32_t | At91SpiGetModeFlags (u_int base, u_int cs) |
int | At91SpiSetModeFlags (u_int base, u_int cs, uint32_t mode) |
Configure the SPI operation mode. | |
u_int | At91SpiGetBits (u_int base, u_int cs) |
int | At91SpiSetBits (u_int base, u_int cs, u_int bits) |
u_int | At91SpiGetSckDelay (u_int base, u_int cs) |
int | At91SpiSetSckDelay (u_int base, u_int cs, u_int dly) |
u_int | At91SpiGetTxDelay (u_int base, u_int cs) |
int | At91SpiSetTxDelay (u_int base, u_int cs, u_int dly) |
u_int | At91SpiGetCsDelay (u_int base) |
int | At91SpiSetCsDelay (u_int base, u_int dly) |
int | At91SpiTransfer2 (u_int base, u_int cs, CONST void *txbuf, void *rxbuf, int xlen, CONST void *txnbuf, void *rxnbuf, int xnlen) |
Transfer two SPI buffers. |
#define SPI_SETSPEED 0x0401 |
Definition at line 59 of file at91_spi.h.
#define SPI_GETSPEED 0x0402 |
Definition at line 60 of file at91_spi.h.
#define SPI_SETMODE 0x0403 |
Definition at line 62 of file at91_spi.h.
#define SPI_GETMODE 0x0404 |
Definition at line 63 of file at91_spi.h.
#define SPIMF_MASTER 0x00000001 |
Definition at line 65 of file at91_spi.h.
Referenced by At45dbInit(), At91SpiGetModeFlags(), and At91SpiSetModeFlags().
#define SPIMF_PCSDEC 0x00000002 |
#define SPIMF_MFDETECT 0x00000004 |
Definition at line 67 of file at91_spi.h.
Referenced by At91SpiGetModeFlags(), and At91SpiSetModeFlags().
#define SPIMF_LOOPBACK 0x00000008 |
Definition at line 68 of file at91_spi.h.
Referenced by At91SpiGetModeFlags(), and At91SpiSetModeFlags().
#define SPIMF_SCKIAHI 0x00000010 |
Definition at line 69 of file at91_spi.h.
Referenced by At45dbInit(), At91SpiGetModeFlags(), and At91SpiSetModeFlags().
#define SPIMF_CAPRISE 0x00000020 |
Definition at line 70 of file at91_spi.h.
Referenced by At45dbInit(), At91SpiGetModeFlags(), and At91SpiSetModeFlags().
#define SPIMF_KEEPCS 0x00000040 |
#define SPI_SETDATABITS 0x0405 |
Definition at line 73 of file at91_spi.h.
#define SPI_GETDATABITS 0x0406 |
Definition at line 74 of file at91_spi.h.
int At91Spi0Init | ( | void | ) |
Initialize the first serial peripheral interface on the AT91 MCU.
Definition at line 85 of file at91_spi.c.
Referenced by At91SpiInit().
int At91Spi0InitChipSelects | ( | u_int | mask | ) |
Initialize specified SPI0 chip selects on the AT91 MCU.
mask | Chip selects to use. Set bit 0 for NPCS0, bit 1 for NPCS1 and so on. |
Definition at line 108 of file at91_spi.c.
Referenced by At91SpiInitChipSelects().
int At91Spi0Enable | ( | void | ) |
Initialize the second serial peripheral interface on the AT91 MCU.
Definition at line 144 of file at91_spi.c.
Referenced by At91Spi0Init().
int At91SpiInit | ( | u_int | base | ) |
Initialize serial peripheral interface on the AT91 MCU.
base | Interface base address, either SPI_BASE, SPI0_BASE or SPI1_BASE. |
Definition at line 246 of file at91_spi.c.
Referenced by At45dbInit().
int At91SpiReset | ( | u_int | base | ) |
Reset serial peripheral interface on the AT91 MCU.
base | Interface base address, either SPI_BASE, SPI0_BASE or SPI1_BASE. |
Definition at line 286 of file at91_spi.c.
Referenced by At45dbInit(), and At91Spi0Init().
Initialize specified SPI chip selects on the AT91 MCU.
base | Interface base address, either SPI_BASE, SPI0_BASE or SPI1_BASE. | |
mask | Chip selects to use. Set bit 0 for NPCS0, bit 1 for NPCS1 and so on. |
Definition at line 316 of file at91_spi.c.
Referenced by At45dbInit().
Configure the SPI rate.
base | SPI register base. | |
cs | Chip select line. | |
rate | Baudrate. The maximum is MCK/1 and the minimum is MCK/255. If the specified rate is above the maximum or below the minimum, the maximum or minimum value resp. will be set. |
Definition at line 342 of file at91_spi.c.
Referenced by At45dbInit().
Configure the SPI operation mode.
base | SPI register base. | |
cs | Chip select line. | |
mode | Any of the following
|
Definition at line 425 of file at91_spi.c.
Referenced by At45dbInit().
Definition at line 503 of file at91_spi.c.
Definition at line 550 of file at91_spi.c.
Definition at line 567 of file at91_spi.c.
Definition at line 584 of file at91_spi.c.
int At91SpiTransfer2 | ( | u_int | base, | |
u_int | cs, | |||
CONST void * | txbuf, | |||
void * | rxbuf, | |||
int | xlen, | |||
CONST void * | txnbuf, | |||
void * | rxnbuf, | |||
int | xnlen | |||
) |
Transfer two SPI buffers.
base | SPI port base address. | |
cs | SPI device chip select. | |
txbuf | First transmit buffer. | |
rxbuf | First receive buffer. | |
xlen | Length of first transfer. | |
txnbuf | Second transmit buffer. | |
rxnbuf | Second receive buffer. | |
xnlen | Length of second transfer. |
Definition at line 606 of file at91_spi.c.
Referenced by At45dbGetStatus(), and At45dbSendCmd().