mac_iop.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:5k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * I/O Processor (IOP) defines and structures, mostly snagged from A/UX
  3.  * header files.
  4.  *
  5.  * The original header from which this was taken is copyrighted. I've done some
  6.  * rewriting (in fact my changes make this a bit more readable, IMHO) but some
  7.  * more should be done.
  8.  */
  9. /*
  10.  * This is the base address of the IOPs. Use this as the address of
  11.  * a "struct iop" (see below) to see where the actual registers fall.
  12.  */
  13. #define SCC_IOP_BASE_IIFX (0x50F04000)
  14. #define ISM_IOP_BASE_IIFX (0x50F12000)
  15. #define SCC_IOP_BASE_QUADRA (0x50F0C000)
  16. #define ISM_IOP_BASE_QUADRA (0x50F1E000)
  17. /* IOP status/control register bits: */
  18. #define IOP_BYPASS 0x01 /* bypass-mode hardware access */
  19. #define IOP_AUTOINC 0x02 /* allow autoincrement of ramhi/lo */
  20. #define IOP_RUN 0x04 /* set to 0 to reset IOP chip */
  21. #define IOP_IRQ 0x08 /* generate IRQ to IOP if 1 */
  22. #define IOP_INT0 0x10 /* intr priority from IOP to host */
  23. #define IOP_INT1 0x20 /* intr priority from IOP to host */
  24. #define IOP_HWINT 0x40 /* IRQ from hardware; bypass mode only */
  25. #define IOP_DMAINACTIVE 0x80 /* no DMA request active; bypass mode only */
  26. #define NUM_IOPS 2
  27. #define NUM_IOP_CHAN 7
  28. #define NUM_IOP_MSGS NUM_IOP_CHAN*8
  29. #define IOP_MSG_LEN 32
  30. /* IOP reference numbers, used by the globally-visible iop_xxx functions */
  31. #define IOP_NUM_SCC 0
  32. #define IOP_NUM_ISM 1
  33. /* IOP channel states */
  34. #define IOP_MSG_IDLE 0       /* idle                         */
  35. #define IOP_MSG_NEW 1       /* new message sent             */
  36. #define IOP_MSG_RCVD 2       /* message received; processing */
  37. #define IOP_MSG_COMPLETE 3       /* message processing complete  */
  38. /* IOP message status codes */
  39. #define IOP_MSGSTATUS_UNUSED 0 /* Unusued message structure       */
  40. #define IOP_MSGSTATUS_WAITING 1 /* waiting for channel             */
  41. #define IOP_MSGSTATUS_SENT 2 /* message sent, awaiting reply    */
  42. #define IOP_MSGSTATUS_COMPLETE 3 /* message complete and reply rcvd */
  43. #define IOP_MSGSTATUS_UNSOL 6 /* message is unsolicited          */
  44. /* IOP memory addresses of the members of the mac_iop_kernel structure. */
  45. #define IOP_ADDR_MAX_SEND_CHAN 0x0200
  46. #define IOP_ADDR_SEND_STATE 0x0201
  47. #define IOP_ADDR_PATCH_CTRL 0x021F
  48. #define IOP_ADDR_SEND_MSG 0x0220
  49. #define IOP_ADDR_MAX_RECV_CHAN 0x0300
  50. #define IOP_ADDR_RECV_STATE 0x0301
  51. #define IOP_ADDR_ALIVE 0x031F
  52. #define IOP_ADDR_RECV_MSG 0x0320
  53. #ifndef __ASSEMBLY__
  54. /*
  55.  * IOP Control registers, staggered because in usual Apple style they were
  56.  * too lazy to decode the A0 bit. This structure is assumed to begin at
  57.  * one of the xxx_IOP_BASE addresses given above.
  58.  */
  59. struct mac_iop {
  60.     __u8 ram_addr_hi; /* shared RAM address hi byte */
  61.     __u8 pad0;
  62.     __u8 ram_addr_lo; /* shared RAM address lo byte */
  63.     __u8 pad1;
  64.     __u8 status_ctrl; /* status/control register */
  65.     __u8 pad2[3];
  66.     __u8 ram_data; /* RAM data byte at ramhi/lo */
  67.     __u8 pad3[23];
  68.     /* Bypass-mode hardware access registers */
  69.     union {
  70. struct { /* SCC registers */
  71.     __u8 sccb_cmd; /* SCC B command reg */
  72.     __u8 pad4;
  73.     __u8 scca_cmd; /* SCC A command reg */
  74.     __u8 pad5;
  75.     __u8 sccb_data; /* SCC B data */
  76.     __u8 pad6;
  77.     __u8 scca_data; /* SCC A data */
  78. } scc_regs;
  79. struct { /* ISM registers */
  80.     __u8 wdata; /* write a data byte */
  81.     __u8 pad7;
  82.     __u8 wmark; /* write a mark byte */
  83.     __u8 pad8;
  84.     __u8 wcrc; /* write 2-byte crc to disk */
  85.     __u8 pad9;
  86.     __u8 wparams; /* write the param regs */
  87.     __u8 pad10;
  88.     __u8 wphase; /* write the phase states & dirs */
  89.     __u8 pad11;
  90.     __u8 wsetup; /* write the setup register */
  91.     __u8 pad12;
  92.     __u8 wzeroes; /* mode reg: 1's clr bits, 0's are x */
  93.     __u8 pad13;
  94.     __u8 wones; /* mode reg: 1's set bits, 0's are x */
  95.     __u8 pad14;
  96.     __u8 rdata; /* read a data byte */
  97.     __u8 pad15;
  98.     __u8 rmark; /* read a mark byte */
  99.     __u8 pad16;
  100.     __u8 rerror; /* read the error register */
  101.     __u8 pad17;
  102.     __u8 rparams; /* read the param regs */
  103.     __u8 pad18;
  104.     __u8 rphase; /* read the phase states & dirs */
  105.     __u8 pad19;
  106.     __u8 rsetup; /* read the setup register */
  107.     __u8 pad20;
  108.     __u8 rmode; /* read the mode register */
  109.     __u8 pad21;
  110.     __u8 rhandshake; /* read the handshake register */
  111. } ism_regs;
  112.     } b;
  113. };
  114. /* This structure is used to track IOP messages in the Linux kernel */
  115. struct iop_msg {
  116. struct iop_msg *next; /* next message in queue or NULL     */
  117. uint iop_num; /* IOP number                        */
  118. uint channel; /* channel number                    */
  119. void *caller_priv; /* caller private data               */
  120. int status; /* status of this message            */
  121. __u8 message[IOP_MSG_LEN]; /* the message being sent/received   */
  122. __u8 reply[IOP_MSG_LEN]; /* the reply to the message          */
  123. void (*handler)(struct iop_msg *, struct pt_regs *);
  124. /* function to call when reply recvd */
  125. };
  126. extern int iop_scc_present,iop_ism_present;
  127. extern int iop_listen(uint, uint,
  128. void (*handler)(struct iop_msg *, struct pt_regs *),
  129. const char *);
  130. extern int iop_send_message(uint, uint, void *, uint, __u8 *,
  131.     void (*)(struct iop_msg *, struct pt_regs *));
  132. extern void iop_complete_message(struct iop_msg *);
  133. extern void iop_upload_code(uint, __u8 *, uint, __u16);
  134. extern void iop_download_code(uint, __u8 *, uint, __u16);
  135. extern __u8 *iop_compare_code(uint, __u8 *, uint, __u16);
  136. #endif /* __ASSEMBLY__ */