mc6821.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef _MC6821_H_
  2. #define _MC6821_H_
  3. /*
  4. * This file describes the memery mapping of the MC6821 PIA.
  5. * The unions describe overlayed registers. Which of them is used is
  6. * determined by bit 2 of the corresponding control register.
  7. * this files expects the PIA_REG_PADWIDTH to be defined the numeric
  8. * value of the register spacing.
  9. *
  10. * Data came from MFC-31-Developer Kit (from Ralph Seidel,
  11. * zodiac@darkness.gun.de) and Motorola Data Sheet (from
  12. * Richard Hirst, srh@gpt.co.uk)
  13. *
  14. * 6.11.95 copyright Joerg Dorchain (dorchain@mpi-sb.mpg.de)
  15. *
  16. */
  17. #ifndef PIA_REG_PADWIDTH
  18. #define PIA_REG_PADWIDTH 255
  19. #endif
  20. struct pia {
  21. union {
  22. volatile u_char pra;
  23. volatile u_char ddra;
  24. } ua;
  25. u_char pad1[PIA_REG_PADWIDTH];
  26. volatile u_char cra;
  27. u_char pad2[PIA_REG_PADWIDTH];
  28. union {
  29. volatile u_char prb;
  30. volatile u_char ddrb;
  31. } ub;
  32. u_char pad3[PIA_REG_PADWIDTH];
  33. volatile u_char crb;
  34. u_char pad4[PIA_REG_PADWIDTH];
  35. };
  36. #define ppra ua.pra
  37. #define pddra ua.ddra
  38. #define pprb ub.prb
  39. #define pddrb ub.ddrb
  40. #define PIA_C1_ENABLE_IRQ (1<<0)
  41. #define PIA_C1_LOW_TO_HIGH (1<<1)
  42. #define PIA_DDR (1<<2)
  43. #define PIA_IRQ2 (1<<6)
  44. #define PIA_IRQ1 (1<<7)
  45. #endif