iPXE
Functions
bitbash.c File Reference

Bit-bashing interfaces. More...

#include <ipxe/bitbash.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
void write_bit (struct bit_basher *basher, unsigned int bit_id, unsigned long data)
 Set/clear output bit. More...
 
int read_bit (struct bit_basher *basher, unsigned int bit_id)
 Read input bit. More...
 

Detailed Description

Bit-bashing interfaces.

Definition in file bitbash.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ write_bit()

void write_bit ( struct bit_basher basher,
unsigned int  bit_id,
unsigned long  data 
)

Set/clear output bit.

Parameters
basherBit-bashing interface
bit_idBit number
dataValue to write

If data is 0, a logic 0 will be written. If data is non-zero, a logic 1 will be written.

Definition at line 44 of file bitbash.c.

45  {
46  basher->op->write ( basher, bit_id, ( data ? -1UL : 0 ) );
47 }
struct bit_basher_operations * op
Bit-bashing operations.
Definition: bitbash.h:57
void(* write)(struct bit_basher *basher, unsigned int bit_id, unsigned long data)
Set/clear output bit.
Definition: bitbash.h:41
uint8_t data[48]
Additional event data.
Definition: ena.h:22

References data, bit_basher::op, and bit_basher_operations::write.

Referenced by mii_bit_rw(), mii_bit_xfer(), setscl(), setsda(), spi_bit_rw(), spi_bit_set_slave_select(), and spi_bit_transfer().

◆ read_bit()

int read_bit ( struct bit_basher basher,
unsigned int  bit_id 
)

Read input bit.

Parameters
basherBit-bashing interface
bit_idBit number
Return values
dataValue read

data will always be either 0 or -1UL. The idea is that the caller can simply binary-AND the returned value with whatever mask it needs to apply.

Definition at line 60 of file bitbash.c.

60  {
61  return ( basher->op->read ( basher, bit_id ) ? -1UL : 0 );
62 }
struct bit_basher_operations * op
Bit-bashing operations.
Definition: bitbash.h:57
int(* read)(struct bit_basher *basher, unsigned int bit_id)
Read input bit.
Definition: bitbash.h:51

References bit_basher::op, and bit_basher_operations::read.

Referenced by getsda(), mii_bit_xfer(), and spi_bit_transfer().