+static void fb_thread_pause(void)
+{
+ fb_sync_thread_paused = 1;
+ // wait until it finishes last refresh
+ // that it might be doing now
+ usleep(10000);
+}
+
+static void fb_thread_resume(void)
+{
+ fb_sync_thread_paused = 0;
+}
+
+static u32 xread32_io_cmn(u32 a, u32 *handled)
+{
+ u32 d = 0;
+
+ *handled = 1;
+ switch (a) {
+ // Wiz stuff
+ case 0x402c: // MLCVSTRIDE0
+ case 0x4060: // MLCVSTRIDE1
+ d = pollux.v.stride;
+ break;
+ case 0x4038: // MLCADDRESS0
+ case 0x406c: // MLCADDRESS1
+ d = pollux.mlc_stl_adr;
+ break;
+ // wiz_lib reads:
+ // ???? ???? YXBA DURiLe ???? VdVuMS LR?? ????
+ // | GPIOC[31:16] | GPIOB[31:16] |
+ case 0xa058: // GPIOBPAD
+ d = (pollux.btn_state >> 1) & 0x0100;
+ d |= (pollux.btn_state << 1) & 0x0200;
+ d |= (pollux.btn_state >> 3) & 0x0080;
+ d |= (pollux.btn_state >> 5) & 0x0040;
+ d |= (pollux.btn_state >> 6) & 0x0c00;
+ d <<= 16;
+ d = ~d;
+ break;
+ case 0xa098: // GPIOCPAD
+ pollux.btn_state = host_read_btns();
+ d = (pollux.btn_state >> 8) & 0x00f0;
+ d |= (pollux.btn_state >> 1) & 0x0008;
+ d |= (pollux.btn_state << 2) & 0x0004;
+ d |= (pollux.btn_state >> 5) & 0x0002;
+ d |= (pollux.btn_state >> 2) & 0x0001;
+ d <<= 16;
+ d = ~d;
+ break;
+ default:
+ *handled = 0;
+ break;
+ }
+
+ return d;
+}
+