You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

bitbash.h 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef _GPXE_BITBASH_H
  2. #define _GPXE_BITBASH_H
  3. /** @file
  4. *
  5. * Bit-bashing interfaces
  6. *
  7. */
  8. /** A bit-bashing interface */
  9. struct bit_basher {
  10. /**
  11. * Set/clear output bit
  12. *
  13. * @v basher Bit-bashing interface
  14. * @v bit_id Bit number
  15. * @v data Value to write
  16. *
  17. * @c data will be 0 if a logic 0 should be written (i.e. the
  18. * bit should be cleared), or -1UL if a logic 1 should be
  19. * written (i.e. the bit should be set). This is done so that
  20. * the method may simply binary-AND @c data with the
  21. * appropriate bit mask.
  22. */
  23. void ( * write ) ( struct bit_basher *basher, unsigned int bit_id,
  24. unsigned long data );
  25. /**
  26. * Read input bit
  27. *
  28. * @v basher Bit-bashing interface
  29. * @v bit_id Bit number
  30. * @ret zero Input is a logic 0
  31. * @ret non-zero Input is a logic 1
  32. */
  33. int ( * read ) ( struct bit_basher *basher, unsigned int bit_id );
  34. };
  35. extern void write_bit ( struct bit_basher *basher, unsigned int bit_id,
  36. unsigned long data );
  37. extern int read_bit ( struct bit_basher *basher, unsigned int bit_id );
  38. #endif /* _GPXE_BITBASH_H */