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