| 263 | |
| 264 | |
| 265 | static __fi void _rcntTestOverflow(int i) |
| 266 | { |
| 267 | u64 maxTarget = (i < 3) ? 0xffff : 0xfffffffful; |
| 268 | if (psxCounters[i].count <= maxTarget) |
| 269 | return; |
| 270 | |
| 271 | PSXCNT_LOG("IOP Counter[%d] overflow 0x%I64x >= 0x%I64x (mode: %x)", |
| 272 | i, psxCounters[i].count, maxTarget, psxCounters[i].mode.modeval); |
| 273 | |
| 274 | if (psxCounters[i].mode.overflIntr) |
| 275 | { |
| 276 | // Overflow interrupt |
| 277 | _rcntFireInterrupt(i, true); |
| 278 | } |
| 279 | |
| 280 | psxCounters[i].mode.overflowFlag = true; |
| 281 | |
| 282 | // Update count. |
| 283 | // Count wraps around back to zero, while the target is restored (if not in one shot mode). |
| 284 | // (high bit of the target gets set by rcntWtarget when the target is behind |
| 285 | // the counter value, and thus should not be flagged until after an overflow) |
| 286 | psxCounters[i].count -= maxTarget + 1; |
| 287 | psxCounters[i].target &= maxTarget; |
| 288 | } |
| 289 | |
| 290 | /* |
| 291 | Gate: |
no test coverage detected