Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages | Examples

at91_spi.h File Reference


Detailed Description

AT91 peripherals.

 *
 * $Log: at91_spi.h,v $
 * 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.
 *
 *
 * 


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, u_long rate)
 Configure the SPI rate.
u_long At91SpiGetModeFlags (u_int base, u_int cs)
int At91SpiSetModeFlags (u_int base, u_int cs, u_long 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)


Function Documentation

int At91Spi0InitChipSelects u_int  mask  ) 
 

Initialize specified SPI0 chip selects on the AT91 MCU.

Parameters:
mask Chip selects to use. Set bit 0 for NPCS0, bit 1 for NPCS1 and so on.
Returns:
0 on success or -1 if any of the specified chip selects is not available.

int At91SpiInit u_int  base  ) 
 

Initialize serial peripheral interface on the AT91 MCU.

Parameters:
base Interface base address, either SPI_BASE, SPI0_BASE or SPI1_BASE.
Returns:
0 on success or -1 if SPI is not available.

int At91SpiReset u_int  base  ) 
 

Reset serial peripheral interface on the AT91 MCU.

Parameters:
base Interface base address, either SPI_BASE, SPI0_BASE or SPI1_BASE.
Returns:
0 on success or -1 if SPI is not available.

int At91SpiInitChipSelects u_int  base,
u_int  mask
 

Initialize specified SPI chip selects on the AT91 MCU.

Parameters:
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.
Returns:
0 on success or -1 if any of the specified chip selects is not available.

int At91SpiSetRate u_int  base,
u_int  cs,
u_long  rate
 

Configure the SPI rate.

Parameters:
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.

int At91SpiSetModeFlags u_int  base,
u_int  cs,
u_long  mode
 

Configure the SPI operation mode.

Parameters:
base SPI register base.
cs Chip select line.
mode Any of the following
  • SPIMF_MASTER Master mode.
  • SPIMF_PCSDEC Decoded chip selects.
  • SPIMF_MFDETECT Mode fault detection.
  • SPIMF_LOOPBACK Loopback mode.
  • SPIMF_SCKIAHI Clock is high when inactive.
  • SPIMF_CAPRISE Data cpatured on rising edge.
  • SPIMF_KEEPCS Chip select remains active after transfer.


© 2000-2006 by egnite Software GmbH - visit http://www.ethernut.de/