Go to the source code of this file.
Functions | |
int | Sppi0SetMode (u_char ix, u_char mode) |
Set mode for a given device at SPI0. | |
void | Sppi0SetSpeed (u_char ix, u_long rate) |
Set transfer rate for a given device at SPI0. | |
void | Sppi0Enable (u_char ix) |
Enable the serial peripheral interface 0. | |
void | Sppi0ChipReset (u_char ix, u_char hi) |
Set or clear a configured reset line for a given device. | |
void | Sppi0ChipSelect (u_char ix, u_char hi) |
Set or clear a configured chip select for a given device. | |
void | Sppi0SelectDevice (u_char ix) |
Select the device at a given chip select. | |
void | Sppi0DeselectDevice (u_char ix) |
Deselect the device at a given chip select. | |
void | Sppi0NegSelectDevice (u_char ix) |
Select the device at a given negated chip select. | |
void | Sppi0NegDeselectDevice (u_char ix) |
Deselect the device at a given negated chip select. | |
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. |
Set mode for a given device at SPI0.
This is typically the first call in order to use the device. It will not directly enable the SPI hardware. This is done when selecting the device.
The transfer rate is set to the lowest possible value and can be adjusted by calling Sppi0SetSpeed().
ix | The device index, starting at 0. | |
mode | The mode to set.
|
Definition at line 73 of file sppif0.c.
References _BV, and SPPI0_MAX_DEVICES.
Set transfer rate for a given device at SPI0.
ix | The device index, starting at 0. | |
rate | Transfer rate in bits per second. |
Definition at line 96 of file sppif0.c.
References _BV, and NutGetCpuClock().
void Sppi0Enable | ( | u_char | ix | ) |
Enable the serial peripheral interface 0.
Enables SPI with the parameters previously set by Sppi0SetMode() and Sppi0SetSpeed().
ix | The device index, starting at 0. The routine will not check if this is valid. |
Set or clear a configured reset line for a given device.
Reset lines must be configured when building the system libraries. This routine silently ignores them, if not configured.
ix | The device index, starting at 0. | |
hi | If 0, the reset line is driven low. Otherwise the line is driven high. |
Set or clear a configured chip select for a given device.
Chip selects must be configured when building the system libraries. This routine silently ignores selects, if they are not configured.
ix | The device index, starting at 0. Same as the chip select number. | |
hi | If 0, the chip select is driven low. Otherwise the line is driven high. |
void Sppi0SelectDevice | ( | u_char | ix | ) |
Select the device at a given chip select.
Enables the serial peripheral interface with the parameters previously set for the given device by Sppi0SetMode() and Sppi0SetSpeed(). Then the configured chip select line is driven high.
ix | The device index, starting at 0. The routine will not check if this is a valid number. |
Definition at line 294 of file sppif0.c.
References Sppi0ChipSelect(), and Sppi0Enable().
void Sppi0DeselectDevice | ( | u_char | ix | ) |
Deselect the device at a given chip select.
The configured chip select line will be driven low.
ix | The device index, starting at 0. The routine will not check if this is a valid number. |
Definition at line 308 of file sppif0.c.
References Sppi0ChipSelect().
void Sppi0NegSelectDevice | ( | u_char | ix | ) |
Select the device at a given negated chip select.
Enables the serial peripheral interface with the parameters previously set for the given device by Sppi0SetMode() and Sppi0SetSpeed(). Then the configured chip select line is driven low.
ix | The device index, starting at 0. The routine will not check if this is a valid number. |
Definition at line 324 of file sppif0.c.
References Sppi0ChipSelect(), and Sppi0Enable().
void Sppi0NegDeselectDevice | ( | u_char | ix | ) |
Deselect the device at a given negated chip select.
The configured chip select line will be driven high.
ix | The device index, starting at 0. The routine will not check if this is a valid number. |
Definition at line 338 of file sppif0.c.
References Sppi0ChipSelect().
Exchange a byte with the currently selected SPI device.
data | Byte to transmit. |
Definition at line 350 of file sppif0.c.
References inb, loop_until_bit_is_set, and outb.
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().
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().