bitbash.h

Go to the documentation of this file.
00001 #ifndef _GPXE_BITBASH_H
00002 #define _GPXE_BITBASH_H
00003 
00004 /** @file
00005  *
00006  * Bit-bashing interfaces
00007  *
00008  */
00009 
00010 FILE_LICENCE ( GPL2_OR_LATER );
00011 
00012 struct bit_basher;
00013 
00014 /** Bit-bashing operations */
00015 struct bit_basher_operations {
00016         /**
00017          * Set/clear output bit
00018          *
00019          * @v basher            Bit-bashing interface
00020          * @v bit_id            Bit number
00021          * @v data              Value to write
00022          * 
00023          * @c data will be 0 if a logic 0 should be written (i.e. the
00024          * bit should be cleared), or -1UL if a logic 1 should be
00025          * written (i.e. the bit should be set).  This is done so that
00026          * the method may simply binary-AND @c data with the
00027          * appropriate bit mask.
00028          */
00029         void ( * write ) ( struct bit_basher *basher, unsigned int bit_id,
00030                            unsigned long data );
00031         /**
00032          * Read input bit
00033          *
00034          * @v basher            Bit-bashing interface
00035          * @v bit_id            Bit number
00036          * @ret zero            Input is a logic 0
00037          * @ret non-zero        Input is a logic 1
00038          */
00039         int ( * read ) ( struct bit_basher *basher, unsigned int bit_id );
00040 };
00041 
00042 /** A bit-bashing interface */
00043 struct bit_basher {
00044         /** Bit-bashing operations */
00045         struct bit_basher_operations *op;
00046 };
00047 
00048 extern void write_bit ( struct bit_basher *basher, unsigned int bit_id,
00049                         unsigned long data );
00050 extern int read_bit ( struct bit_basher *basher, unsigned int bit_id );
00051 
00052 #endif /* _GPXE_BITBASH_H */

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