sppif0.h File Reference


Detailed Description

Serial bit banged interface 0.

 *
 * $Log: sppif0.h,v $
 * Revision 1.1  2007/04/12 09:07:54  haraldkipp
 * Configurable SPI added.
 *
 *
 * 

Definition in file sppif0.h.

Go to the source code of this file.

Defines

#define SPPI0_MAX_DEVICES   4
 Maximum number of devices (chip selects).

Functions

int Sppi0SetMode (ureg_t ix, ureg_t mode)
void Sppi0SetSpeed (ureg_t ix, u_long rate)
void Sppi0Enable (ureg_t ix)
void Sppi0ChipReset (ureg_t ix, u_char hi)
void Sppi0ChipSelect (ureg_t ix, u_char hi)
void Sppi0SelectDevice (ureg_t ix)
void Sppi0DeselectDevice (ureg_t ix)
void Sppi0NegSelectDevice (ureg_t ix)
void Sppi0NegDeselectDevice (ureg_t ix)
u_char Sppi0Byte (u_char data)
 Exchange a byte with the currently selected SPI device.
void Sppi0Transact (CONST void *wdata, void *rdata, size_t len)
 Exchange a specified number of bytes with the currently selected SPI device.


Define Documentation

#define SPPI0_MAX_DEVICES   4

Maximum number of devices (chip selects).

Definition at line 55 of file sppif0.h.

Referenced by Sppi0SetMode().


Function Documentation

int Sppi0SetMode ( ureg_t  ix,
ureg_t  mode 
)

void Sppi0SetSpeed ( ureg_t  ix,
u_long  rate 
)

void Sppi0Enable ( ureg_t  ix  ) 

void Sppi0ChipReset ( ureg_t  ix,
u_char  hi 
)

void Sppi0ChipSelect ( ureg_t  ix,
u_char  hi 
)

void Sppi0SelectDevice ( ureg_t  ix  ) 

void Sppi0DeselectDevice ( ureg_t  ix  ) 

void Sppi0NegSelectDevice ( ureg_t  ix  ) 

void Sppi0NegDeselectDevice ( ureg_t  ix  ) 

u_char Sppi0Byte ( u_char  data  ) 

Exchange a byte with the currently selected SPI device.

Parameters:
data Byte to transmit.
Returns:
Received byte.

Definition at line 350 of file sppif0.c.

References inb, loop_until_bit_is_set, and outb.

Referenced by Sppi0Transact().

void Sppi0Transact ( CONST void *  wdata,
void *  rdata,
size_t  len 
)

Exchange a specified number of bytes with the currently selected SPI device.

It is assumed, that the serial peripheral interface has been properly initialized by calling Sppi0SetMode() and optionally Sppi0SetSpeed().

Further it is assumed, that the chip select (if there is one) had been enabled by a previous call to Sppi0SelectDevice() or Sppi0NegSelectDevice().

Parameters:
wdata Pointer to the data to transmit.
rdata Pointer to a buffer that receives the data from the device. Can be set to NULL for transmit only. May also point to the tranmit buffer, in which case the transmitted bytes are replaced by the bytes received.

Definition at line 374 of file sppif0.c.

References CONST, and Sppi0Byte().


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