@@ -329,6 +329,7 @@ static void __isr __time_critical_func(dmaIrqHandler)(void)
329329 if (currentTimingLine + 2 == (vgaParams .params .vSyncParams .syncPixels + vgaParams .params .vSyncParams .backPorchPixels ))
330330 {
331331 multicore_fifo_push_timeout_us (0 , 0 );
332+ multicore_fifo_push_timeout_us (1 , 0 );
332333 }
333334 }
334335 else if (currentTimingLine < (vgaParams .params .vSyncParams .totalPixels - vgaParams .params .vSyncParams .frontPorchPixels ))
@@ -340,7 +341,7 @@ static void __isr __time_critical_func(dmaIrqHandler)(void)
340341 dma_channel_set_read_addr (syncDmaChan , syncDataPorch , true);
341342 if (currentTimingLine == (vgaParams .params .vSyncParams .totalPixels - vgaParams .params .vSyncParams .frontPorchPixels ) + 2 )
342343 {
343- multicore_fifo_push_timeout_us (FRONT_PORCH_MSG | 1 , 0 );
344+ multicore_fifo_push_timeout_us (FRONT_PORCH_MSG , 0 );
344345 }
345346 }
346347#if VGA_SCANLINE_CB_ENABLE
@@ -352,6 +353,7 @@ static void __isr __time_critical_func(dmaIrqHandler)(void)
352353 {
353354 dma_hw -> ints0 = rgbDmaChanMask ;
354355
356+ currentDisplayLine ++ ;
355357#if VGA_HARDCODED_640
356358 uint32_t pxLine = currentDisplayLine >> 1 ;
357359 uint32_t pxLineRpt = currentDisplayLine & 0x01 ;
@@ -362,7 +364,6 @@ static void __isr __time_critical_func(dmaIrqHandler)(void)
362364#endif
363365
364366 uint32_t * currentBuffer = (uint32_t * )rgbDataBuffer [pxLine & 0x01 ];
365- currentDisplayLine ++ ;
366367
367368#if VGA_CRT_EFFECT
368369 if (vgaParams .scanlines && pxLineRpt != 0 )
@@ -382,22 +383,16 @@ static void __isr __time_critical_func(dmaIrqHandler)(void)
382383 }
383384#endif
384385
385- if (currentDisplayLine == VIRTUAL_PIXELS_Y * 2 )
386- {
387- currentBuffer [0 ] = 0 ;
388- currentBuffer [1 ] = 0 ;
389- currentBuffer [2 ] = 0 ;
390- currentBuffer [3 ] = 0 ;
391- currentBuffer [4 ] = 0 ;
392- }
393386 dma_channel_set_read_addr (rgbDmaChan , currentBuffer , true);
394387
395388 // need a new line every X display lines
396- if (( pxLineRpt == 0 ) )
389+ if (pxLineRpt == 0 )
397390 {
398391 uint32_t requestLine = pxLine + 1 ;
399392 if (requestLine < VIRTUAL_PIXELS_Y )
393+ {
400394 multicore_fifo_push_timeout_us (requestLine , 0 );
395+ }
401396
402397#if VGA_SCANLINE_TIME_DEBUG
403398 hasRenderedNext = false;
@@ -449,11 +444,11 @@ void __time_critical_func(vgaLoop)()
449444 {
450445 uint32_t message = multicore_fifo_pop_blocking ();
451446
452- if (( message & ~ 1 ) == FRONT_PORCH_MSG )
447+ if (message == FRONT_PORCH_MSG )
453448 {
454449 if (vgaParams .porchFn )
455450 {
456- vgaParams .porchFn (rgbDataBuffer [ message & 1 ] );
451+ vgaParams .porchFn ();
457452 }
458453 }
459454 else if (message == END_OF_FRAME_MSG )
@@ -476,16 +471,19 @@ void __time_critical_func(vgaLoop)()
476471 else
477472 {
478473 bool doEof = false;
479- while ( multicore_fifo_rvalid ()) // if we dropped a scanline, no point rendering it now
474+ if ( message != 0 )
480475 {
481- uint32_t nextMessage = sio_hw -> fifo_rd ;
482- if (nextMessage == END_OF_FRAME_MSG )
483- {
484- doEof = true;
485- }
486- else
476+ while (multicore_fifo_rvalid ()) // if we dropped a scanline, no point rendering it now
487477 {
488- message = nextMessage ;
478+ uint32_t nextMessage = sio_hw -> fifo_rd ;
479+ if (nextMessage == END_OF_FRAME_MSG )
480+ {
481+ doEof = true;
482+ }
483+ else
484+ {
485+ message = nextMessage ;
486+ }
489487 }
490488 }
491489
0 commit comments