MCPcopy Create free account
hub / github.com/CE-Programming/CEmu / lcd_event

Function lcd_event

core/lcd.c:298–390  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296}
297
298static void lcd_event(enum sched_item_id id) {
299 uint32_t duration;
300 sched_process_pending_dma(0);
301 enum lcd_comp compare = lcd.control >> 12 & 3;
302 switch (lcd.compare) {
303 case LCD_FRONT_PORCH:
304 if (lcd.VFP) {
305 if (compare == LCD_FRONT_PORCH) {
306 lcd.ris |= 1 << 3;
307 }
308 duration = lcd.VFP * (lcd.HSW + lcd.HBP + lcd.CPL + lcd.HFP) * lcd.PCD;
309 lcd.compare = LCD_SYNC;
310 break;
311 }
312 fallthrough;
313 default:
314 fallthrough;
315 case LCD_SYNC:
316 if (compare == LCD_SYNC) {
317 lcd.ris |= 1 << 3;
318 }
319 lcd.PPL = ((lcd.timing[0] >> 2 & 0x3F) + 1) << 4;
320 lcd.HSW = (lcd.timing[0] >> 8 & 0xFF) + 1;
321 lcd.HFP = (lcd.timing[0] >> 16 & 0xFF) + 1;
322 lcd.HBP = (lcd.timing[0] >> 24 & 0xFF) + 1;
323 lcd.LPP = (lcd.timing[1] >> 0 & 0x3FF) + 1;
324 lcd.VSW = (lcd.timing[1] >> 10 & 0x3F) + 1;
325 lcd.VFP = lcd.timing[1] >> 16 & 0xFF;
326 lcd.VBP = lcd.timing[1] >> 24 & 0xFF;
327 lcd.PCD = ((lcd.timing[2] >> 0 & 0x1F) |
328 (lcd.timing[2] >> 27 & 0x1F) << 5) + 2;
329 lcd.CLKSEL = lcd.timing[2] >> 5 & 1;
330 lcd.ACB = (lcd.timing[2] >> 6 & 0x1F) + 1;
331 lcd.IVS = lcd.timing[2] >> 11 & 1;
332 lcd.IHS = lcd.timing[2] >> 12 & 1;
333 lcd.IPC = lcd.timing[2] >> 13 & 1;
334 lcd.IOE = lcd.timing[2] >> 14 & 1;
335 lcd.CPL = (lcd.timing[2] >> 16 & 0x3FF) + 1;
336 if (lcd.timing[2] >> 26 & 1) {
337 lcd.PCD = 1;
338 }
339 lcd.LED = (lcd.timing[3] >> 0 & 0x7F) + 1;
340 lcd.LEE = lcd.timing[3] >> 16 & 1;
341 lcd.LCDBPP = lcd.control >> 1 & 7;
342 lcd.BGR = lcd.control >> 8 & 1;
343 lcd.BEBO = lcd.control >> 9 & 1;
344 lcd.BEPO = lcd.control >> 10 & 1;
345 lcd.WTRMRK = lcd.control >> 16 & 1;
346 lcd.BPP = lcd.LCDBPP <= 5 ? lcd.LCDBPP : 4;
347 lcd.PPF = 1 << (8 + lcd.WTRMRK - lcd.BPP);
348 duration = ((lcd.VSW - 1) * (lcd.HSW + lcd.HBP + lcd.CPL + lcd.HFP) +
349 lcd.HSW) * lcd.PCD + 1;
350 lcd.prefill = true;
351 if (lcd.useDma) {
352 lcd.pos = 0;
353 lcd.curRow = lcd.curCol = 0;
354 panel_vsync();
355 sched_repeat_relative(SCHED_LCD_DMA, SCHED_LCD, duration, 0);

Callers

nothing calls this directly

Calls 6

panel_vsyncFunction · 0.85
sched_repeat_relativeFunction · 0.85
lcd_gui_eventFunction · 0.85
intrpt_setFunction · 0.85
sched_repeatFunction · 0.85

Tested by

no test coverage detected