選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

bitbash.h 1.2KB

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