display7seg.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. *
  3. * display7seg - Driver interface for the 7-segment display
  4. * present on Sun Microsystems CP1400 and CP1500
  5. *
  6. * Copyright (c) 2000 Eric Brower <ebrower@usa.net>
  7. *
  8. */
  9. #ifndef __display7seg_h__
  10. #define __display7seg_h__
  11. #define D7S_IOC 'p'
  12. #define D7SIOCRD _IOR(D7S_IOC, 0x45, int) /* Read device state */
  13. #define D7SIOCWR _IOW(D7S_IOC, 0x46, int) /* Write device state */
  14. #define D7SIOCTM _IO (D7S_IOC, 0x47) /* Translate mode (FLIP)*/
  15. /*
  16. * ioctl flag definitions
  17. *
  18. * POINT - Toggle decimal point (0=absent 1=present)
  19. * ALARM - Toggle alarm LED (0=green 1=red)
  20. * FLIP - Toggle inverted mode (0=normal 1=flipped)
  21. * bits 0-4 - Character displayed (see definitions below)
  22. *
  23. * Display segments are defined as follows,
  24. * subject to D7S_FLIP register state:
  25. *
  26. * a
  27. * ---
  28. * f| |b
  29. * -g-
  30. * e| |c
  31. * ---
  32. * d
  33. */
  34. #define D7S_POINT (1 << 7) /* Decimal point*/
  35. #define D7S_ALARM (1 << 6) /* Alarm LED */
  36. #define D7S_FLIP (1 << 5) /* Flip display */
  37. #define D7S_0 0x00 /* Numerals 0-9 */
  38. #define D7S_1 0x01
  39. #define D7S_2 0x02
  40. #define D7S_3 0x03
  41. #define D7S_4 0x04
  42. #define D7S_5 0x05
  43. #define D7S_6 0x06
  44. #define D7S_7 0x07
  45. #define D7S_8 0x08
  46. #define D7S_9 0x09
  47. #define D7S_A 0x0A /* Letters A-F, H, L, P */
  48. #define D7S_B 0x0B
  49. #define D7S_C 0x0C
  50. #define D7S_D 0x0D
  51. #define D7S_E 0x0E
  52. #define D7S_F 0x0F
  53. #define D7S_H 0x10
  54. #define D7S_E2 0x11
  55. #define D7S_L 0x12
  56. #define D7S_P 0x13
  57. #define D7S_SEGA 0x14 /* Individual segments */
  58. #define D7S_SEGB 0x15
  59. #define D7S_SEGC 0x16
  60. #define D7S_SEGD 0x17
  61. #define D7S_SEGE 0x18
  62. #define D7S_SEGF 0x19
  63. #define D7S_SEGG 0x1A
  64. #define D7S_SEGABFG 0x1B /* Segment groupings */
  65. #define D7S_SEGCDEG 0x1C
  66. #define D7S_SEGBCEF 0x1D
  67. #define D7S_SEGADG 0x1E
  68. #define D7S_BLANK 0x1F /* Clear all segments */
  69. #define D7S_MIN_VAL 0x0
  70. #define D7S_MAX_VAL 0x1F
  71. #endif /* ifndef __display7seg_h__ */