Nut/OS  4.10.3
API Reference
sppif0.h File Reference

Serial bit banged interface 0. More...

#include <cfg/arch/gpio.h>
#include <stdint.h>
Include dependency graph for sppif0.h:
This graph shows which files directly or indirectly include this file:

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, uint32_t rate)
void Sppi0Enable (ureg_t ix)
void Sppi0ChipReset (ureg_t ix, uint8_t hi)
void Sppi0ChipSelect (ureg_t ix, uint8_t hi)
void Sppi0SelectDevice (ureg_t ix)
void Sppi0DeselectDevice (ureg_t ix)
void Sppi0NegSelectDevice (ureg_t ix)
void Sppi0NegDeselectDevice (ureg_t ix)
uint8_t Sppi0Byte (uint8_t 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.

Detailed Description

Serial bit banged interface 0.

 *
 * $Log$
 * Revision 1.2  2008/08/11 06:59:59  haraldkipp
 * BSD types replaced by stdint types (feature request #1282721).
 *
 * Revision 1.1  2007/04/12 09:07:54  haraldkipp
 * Configurable SPI added.
 *
 *
 * 

Definition in file sppif0.h.


Define Documentation

#define SPPI0_MAX_DEVICES   4

Maximum number of devices (chip selects).

Definition at line 59 of file sppif0.h.

Referenced by Sppi0SetMode().


Function Documentation

int Sppi0SetMode ( ureg_t  ix,
ureg_t  mode 
)
void Sppi0SetSpeed ( ureg_t  ix,
uint32_t  rate 
)
void Sppi0Enable ( ureg_t  ix)
void Sppi0ChipReset ( ureg_t  ix,
uint8_t  hi 
)
void Sppi0ChipSelect ( ureg_t  ix,
uint8_t  hi 
)
void Sppi0SelectDevice ( ureg_t  ix)
void Sppi0DeselectDevice ( ureg_t  ix)
void Sppi0NegSelectDevice ( ureg_t  ix)
void Sppi0NegDeselectDevice ( ureg_t  ix)
uint8_t Sppi0Byte ( uint8_t  data)

Exchange a byte with the currently selected SPI device.

Parameters:
dataByte to transmit.
Returns:
Received byte.

Definition at line 353 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:
wdataPointer to the data to transmit.
rdataPointer 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 377 of file sppif0.c.

References CONST, and Sppi0Byte().

Here is the call graph for this function: