Skip to content

Commit 33e9021

Browse files
committed
Fix Doom demo on CM7
1 parent 3624077 commit 33e9021

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

examples/Doom/Doom.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#include "SDMMCBlockDevice.h"
1+
#include "QSPIFBlockDevice.h"
22
#include "FATFileSystem.h"
33
#include "doomgeneric.h"
44

5-
SDMMCBlockDevice block_device;
5+
QSPIFBlockDevice block_device(PD_11, PD_12, PF_7, PD_13, PF_10, PG_6, QSPIF_POLARITY_MODE_1, 40000000);
66

77
mbed::FATFileSystem fs("fs");
88

libraries/doom/doomgeneric_arduino.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//doomgeneric for arduino
22

33
#include "Arduino.h"
4-
#include "Envie_video_coreboot.h"
4+
#include "Portenta_Video.h"
55

66
#define sleep _sleep
77

@@ -155,7 +155,9 @@ static void DMA2D_Init(uint16_t xsize, uint16_t ysize)
155155
clut.Size = 0xFF;
156156

157157
#ifdef CORE_CM7
158-
SCB_InvalidateDCache_by_Addr(clut.pCLUT, clut.Size);
158+
SCB_CleanInvalidateDCache();
159+
SCB_InvalidateICache();
160+
//SCB_InvalidateDCache_by_Addr(clut.pCLUT, clut.Size);
159161
#endif
160162

161163
HAL_DMA2D_CLUTLoad(&DMA2D_Handle, clut, 1);
@@ -193,6 +195,9 @@ void DG_Init()
193195
LCD_Y_Size = stm32_getYSize();
194196

195197
SDRAM.begin(getFramebufferEnd());
198+
199+
stm32_LCD_Clear(0);
200+
stm32_LCD_Clear(0);
196201
}
197202

198203
void DG_OnPaletteReload() {
@@ -224,6 +229,7 @@ static void handleKeyInput()
224229
#endif
225230
}
226231

232+
#define DEBUG_CM7_VIDEO
227233

228234
static void DMA2D_CopyBuffer(uint32_t *pSrc, uint32_t *pDst)
229235
{
@@ -235,7 +241,7 @@ static void DMA2D_CopyBuffer(uint32_t *pSrc, uint32_t *pDst)
235241

236242
destination = (uint32_t)pDst; // + ((yPos * stm32_getXSize()) + xPos) * 4;
237243

238-
HAL_DMA2D_PollForTransfer(&DMA2D_Handle, 25); /* wait for the previous DMA2D transfer to ends */
244+
HAL_DMA2D_PollForTransfer(&DMA2D_Handle, 200); /* wait for the previous DMA2D transfer to ends */
239245
/* copy the new decoded frame to the LCD Frame buffer*/
240246
HAL_DMA2D_Start(&DMA2D_Handle, (uint32_t)pSrc, destination, DOOMGENERIC_RESX, DOOMGENERIC_RESY);
241247
#if defined(CORE_CM7) && !defined(DEBUG_CM7_VIDEO)
@@ -247,7 +253,9 @@ void DG_DrawFrame()
247253
{
248254
uint32_t fb = getNextFrameBuffer();
249255
#ifdef CORE_CM7
250-
SCB_InvalidateDCache_by_Addr((uint32_t *)fb, DOOMGENERIC_RESX * DOOMGENERIC_RESY * 4);
256+
SCB_CleanInvalidateDCache();
257+
SCB_InvalidateICache();
258+
//SCB_InvalidateDCache_by_Addr((uint32_t *)fb, DOOMGENERIC_RESX * DOOMGENERIC_RESY * 4);
251259
#endif
252260

253261
DMA2D_CopyBuffer((uint32_t *)DG_ScreenBuffer, (uint32_t *)fb);

libraries/doom/r_plane.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ R_MapPlane
131131
|| x2 >= viewwidth
132132
|| y > viewheight)
133133
{
134-
I_Error ("R_MapPlane: %i, %i at %i",x1,x2,y);
134+
return;
135+
//I_Error ("R_MapPlane: %i, %i at %i",x1,x2,y);
135136
}
136137
#endif
137138

0 commit comments

Comments
 (0)