bitbash.c File Reference

Bit-bashing interfaces. More...

#include <gpxe/bitbash.h>

Go to the source code of this file.

Functions

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


Detailed Description

Bit-bashing interfaces.

Definition in file bitbash.c.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER   ) 

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

Set/clear output bit.

Parameters:
basher Bit-bashing interface
bit_id Bit number
data Value 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 39 of file bitbash.c.

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

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

00040                                       {
00041         basher->op->write ( basher, bit_id, ( data ? -1UL : 0 ) );
00042 }

int read_bit ( struct bit_basher basher,
unsigned int  bit_id 
)

Read input bit.

Parameters:
basher Bit-bashing interface
bit_id Bit number
Return values:
data Value 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 55 of file bitbash.c.

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

Referenced by getsda(), and spi_bit_transfer().

00055                                                                 {
00056         return ( basher->op->read ( basher, bit_id ) ? -1UL : 0 );
00057 }


Generated on Tue Apr 6 20:01:15 2010 for gPXE by  doxygen 1.5.7.1