iPXE
Data Structures | Defines | Enumerations | Functions
spi_bit.h File Reference

SPI bit-bashing interface. More...

#include <ipxe/spi.h>
#include <ipxe/bitbash.h>

Go to the source code of this file.

Data Structures

struct  spi_bit_basher
 A bit-bashing SPI bus. More...

Defines

#define SPI_BIT_SS(slave)   ( SPI_BIT_SS0 + (slave) )
 Determine bit index for a particular slave.
#define SPI_BIT_UDELAY   1
 Delay between SCLK transitions.
#define SPI_BIT_BIG_ENDIAN   0
 SPI bit basher treats data as big-endian.
#define SPI_BIT_LITTLE_ENDIAN   1
 SPI bit basher treats data as little-endian.

Enumerations

enum  { SPI_BIT_SCLK = 0, SPI_BIT_MOSI, SPI_BIT_MISO, SPI_BIT_SS0 }
 Bit indices used for SPI bit-bashing interface. More...

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
void init_spi_bit_basher (struct spi_bit_basher *spibit)
 Initialise SPI bit-bashing interface.

Detailed Description

SPI bit-bashing interface.

Definition in file spi_bit.h.


Define Documentation

#define SPI_BIT_SS (   slave)    ( SPI_BIT_SS0 + (slave) )

Determine bit index for a particular slave.

Parameters:
slaveSlave number
Return values:
indexBit index (i.e. SPI_BIT_SSN, where N=slave)

Definition at line 50 of file spi_bit.h.

Referenced by spi_bit_set_slave_select().

#define SPI_BIT_UDELAY   1

Delay between SCLK transitions.

Definition at line 53 of file spi_bit.h.

Referenced by spi_bit_delay().

#define SPI_BIT_BIG_ENDIAN   0

SPI bit basher treats data as big-endian.

Definition at line 56 of file spi_bit.h.

Referenced by natsemi_init_eeprom(), spi_bit_rw(), and spi_bit_transfer().

#define SPI_BIT_LITTLE_ENDIAN   1

SPI bit basher treats data as little-endian.

Definition at line 59 of file spi_bit.h.

Referenced by natsemi_init_eeprom().


Enumeration Type Documentation

anonymous enum

Bit indices used for SPI bit-bashing interface.

Enumerator:
SPI_BIT_SCLK 

Serial clock.

SPI_BIT_MOSI 

Master Out Slave In.

SPI_BIT_MISO 

Master In Slave Out.

SPI_BIT_SS0 

Slave 0 select.

Definition at line 33 of file spi_bit.h.

     {
        /** Serial clock */
        SPI_BIT_SCLK = 0,
        /** Master Out Slave In */
        SPI_BIT_MOSI,
        /** Master In Slave Out */
        SPI_BIT_MISO,
        /** Slave 0 select */
        SPI_BIT_SS0,
};

Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
void init_spi_bit_basher ( struct spi_bit_basher spibit)

Initialise SPI bit-bashing interface.

Parameters:
spibitSPI bit-bashing interface

Definition at line 235 of file spi_bit.c.

References assert, spi_bit_basher::basher, spi_bit_basher::bus, NULL, bit_basher::op, bit_basher_operations::read, spi_bus::rw, spi_bit_rw(), and bit_basher_operations::write.

Referenced by ifec_init_eeprom(), natsemi_init_eeprom(), realtek_init_eeprom(), and rtl818x_probe().

                                                           {
        assert ( &spibit->basher.op->read != NULL );
        assert ( &spibit->basher.op->write != NULL );
        spibit->bus.rw = spi_bit_rw;
}