| 193 | } |
| 194 | |
| 195 | static void PADTypeAndStatusCallback(s32 chan, u32 type) |
| 196 | { |
| 197 | u32 chanBit; |
| 198 | u32 recalibrate; |
| 199 | BOOL rc = TRUE; |
| 200 | u32 error; |
| 201 | chanBit = PAD_CHAN0_BIT >> ResettingChan; |
| 202 | error = type & 0xFF; |
| 203 | recalibrate = RecalibrateBits & chanBit; |
| 204 | RecalibrateBits &= ~chanBit; |
| 205 | |
| 206 | if (error & |
| 207 | (SI_ERROR_UNDER_RUN | SI_ERROR_OVER_RUN | SI_ERROR_NO_RESPONSE | SI_ERROR_COLLISION)) |
| 208 | { |
| 209 | DoReset(); |
| 210 | return; |
| 211 | } |
| 212 | |
| 213 | type &= ~0xFF; |
| 214 | |
| 215 | Type[ResettingChan] = type; |
| 216 | |
| 217 | if ((type & SI_TYPE_MASK) != SI_TYPE_GC || !(type & SI_GC_STANDARD)) |
| 218 | { |
| 219 | DoReset(); |
| 220 | return; |
| 221 | } |
| 222 | |
| 223 | if (Spec < PAD_SPEC_2) |
| 224 | { |
| 225 | PADEnable(ResettingChan); |
| 226 | DoReset(); |
| 227 | return; |
| 228 | } |
| 229 | |
| 230 | if (!(type & SI_GC_WIRELESS) || (type & SI_WIRELESS_IR)) |
| 231 | { |
| 232 | if (recalibrate) |
| 233 | { |
| 234 | rc = SITransfer(ResettingChan, &CmdCalibrate, 3, &Origin[ResettingChan], 10, |
| 235 | PADOriginCallback, 0); |
| 236 | } |
| 237 | else |
| 238 | { |
| 239 | rc = SITransfer(ResettingChan, &CmdReadOrigin, 1, &Origin[ResettingChan], 10, |
| 240 | PADOriginCallback, 0); |
| 241 | } |
| 242 | } |
| 243 | else if ((type & SI_WIRELESS_FIX_ID) && (type & SI_WIRELESS_CONT_MASK) == SI_WIRELESS_CONT && |
| 244 | !(type & SI_WIRELESS_LITE)) |
| 245 | { |
| 246 | if (type & SI_WIRELESS_RECEIVED) |
| 247 | { |
| 248 | rc = SITransfer(ResettingChan, &CmdReadOrigin, 1, &Origin[ResettingChan], 10, |
| 249 | PADOriginCallback, 0); |
| 250 | } |
| 251 | else |
| 252 | { |
nothing calls this directly
no test coverage detected