1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 #define SCC_IOP_BASE_IIFX (0x50F04000)
17 #define ISM_IOP_BASE_IIFX (0x50F12000)
18
19 #define SCC_IOP_BASE_QUADRA (0x50F0C000)
20 #define ISM_IOP_BASE_QUADRA (0x50F1E000)
21
22
23
24 #define IOP_BYPASS 0x01
25 #define IOP_AUTOINC 0x02
26 #define IOP_RUN 0x04
27 #define IOP_IRQ 0x08
28 #define IOP_INT0 0x10
29 #define IOP_INT1 0x20
30 #define IOP_HWINT 0x40
31 #define IOP_DMAINACTIVE 0x80
32
33 #define NUM_IOPS 2
34 #define NUM_IOP_CHAN 7
35 #define NUM_IOP_MSGS NUM_IOP_CHAN*8
36 #define IOP_MSG_LEN 32
37
38
39
40 #define IOP_NUM_SCC 0
41 #define IOP_NUM_ISM 1
42
43
44
45 #define IOP_MSG_IDLE 0
46 #define IOP_MSG_NEW 1
47 #define IOP_MSG_RCVD 2
48 #define IOP_MSG_COMPLETE 3
49
50
51
52 #define IOP_MSGSTATUS_UNUSED 0
53 #define IOP_MSGSTATUS_WAITING 1
54 #define IOP_MSGSTATUS_SENT 2
55 #define IOP_MSGSTATUS_COMPLETE 3
56 #define IOP_MSGSTATUS_UNSOL 6
57
58
59
60 #define IOP_ADDR_MAX_SEND_CHAN 0x0200
61 #define IOP_ADDR_SEND_STATE 0x0201
62 #define IOP_ADDR_PATCH_CTRL 0x021F
63 #define IOP_ADDR_SEND_MSG 0x0220
64 #define IOP_ADDR_MAX_RECV_CHAN 0x0300
65 #define IOP_ADDR_RECV_STATE 0x0301
66 #define IOP_ADDR_ALIVE 0x031F
67 #define IOP_ADDR_RECV_MSG 0x0320
68
69 #ifndef __ASSEMBLY__
70
71
72
73
74
75
76
77 struct mac_iop {
78 __u8 ram_addr_hi;
79 __u8 pad0;
80 __u8 ram_addr_lo;
81 __u8 pad1;
82 __u8 status_ctrl;
83 __u8 pad2[3];
84 __u8 ram_data;
85
86 __u8 pad3[23];
87
88
89
90 union {
91 struct {
92 __u8 sccb_cmd;
93 __u8 pad4;
94 __u8 scca_cmd;
95 __u8 pad5;
96 __u8 sccb_data;
97 __u8 pad6;
98 __u8 scca_data;
99 } scc_regs;
100
101 struct {
102 __u8 wdata;
103 __u8 pad7;
104 __u8 wmark;
105 __u8 pad8;
106 __u8 wcrc;
107 __u8 pad9;
108 __u8 wparams;
109 __u8 pad10;
110 __u8 wphase;
111 __u8 pad11;
112 __u8 wsetup;
113 __u8 pad12;
114 __u8 wzeroes;
115 __u8 pad13;
116 __u8 wones;
117 __u8 pad14;
118 __u8 rdata;
119 __u8 pad15;
120 __u8 rmark;
121 __u8 pad16;
122 __u8 rerror;
123 __u8 pad17;
124 __u8 rparams;
125 __u8 pad18;
126 __u8 rphase;
127 __u8 pad19;
128 __u8 rsetup;
129 __u8 pad20;
130 __u8 rmode;
131 __u8 pad21;
132 __u8 rhandshake;
133 } ism_regs;
134 } b;
135 };
136
137
138
139 struct iop_msg {
140 struct iop_msg *next;
141 uint iop_num;
142 uint channel;
143 void *caller_priv;
144 int status;
145 __u8 message[IOP_MSG_LEN];
146 __u8 reply[IOP_MSG_LEN];
147 void (*handler)(struct iop_msg *);
148
149 };
150
151 extern int iop_scc_present,iop_ism_present;
152
153 extern int iop_listen(uint, uint,
154 void (*handler)(struct iop_msg *),
155 const char *);
156 extern int iop_send_message(uint, uint, void *, uint, __u8 *,
157 void (*)(struct iop_msg *));
158 extern void iop_complete_message(struct iop_msg *);
159 extern void iop_upload_code(uint, __u8 *, uint, __u16);
160 extern void iop_download_code(uint, __u8 *, uint, __u16);
161 extern __u8 *iop_compare_code(uint, __u8 *, uint, __u16);
162 extern void iop_ism_irq_poll(uint);
163
164 extern void iop_register_interrupts(void);
165
166 #endif