[contrib] Allow Network Protocol header to display in rom-o-matic
[gpxe.git] / src / include / gpxe / bitbash.h
blobf2ba9f7a4e77538260e15b5989f2da010bc30913
1 #ifndef _GPXE_BITBASH_H
2 #define _GPXE_BITBASH_H
4 /** @file
6 * Bit-bashing interfaces
8 */
10 FILE_LICENCE ( GPL2_OR_LATER );
12 struct bit_basher;
14 /** Bit-bashing operations */
15 struct bit_basher_operations {
16 /**
17 * Set/clear output bit
19 * @v basher Bit-bashing interface
20 * @v bit_id Bit number
21 * @v data Value to write
23 * @c data will be 0 if a logic 0 should be written (i.e. the
24 * bit should be cleared), or -1UL if a logic 1 should be
25 * written (i.e. the bit should be set). This is done so that
26 * the method may simply binary-AND @c data with the
27 * appropriate bit mask.
29 void ( * write ) ( struct bit_basher *basher, unsigned int bit_id,
30 unsigned long data );
31 /**
32 * Read input bit
34 * @v basher Bit-bashing interface
35 * @v bit_id Bit number
36 * @ret zero Input is a logic 0
37 * @ret non-zero Input is a logic 1
39 int ( * read ) ( struct bit_basher *basher, unsigned int bit_id );
42 /** A bit-bashing interface */
43 struct bit_basher {
44 /** Bit-bashing operations */
45 struct bit_basher_operations *op;
48 extern void write_bit ( struct bit_basher *basher, unsigned int bit_id,
49 unsigned long data );
50 extern int read_bit ( struct bit_basher *basher, unsigned int bit_id );
52 #endif /* _GPXE_BITBASH_H */