Skip to content

Commit 9cd4be7

Browse files
committed
CES: update example to load from QSPI flash
1 parent 9092d8e commit 9cd4be7

File tree

5 files changed

+7221
-65752
lines changed

5 files changed

+7221
-65752
lines changed

examples/Demo_CES_mjpeg/AVI_parser.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ AVISTATUS __AVI_Init( AVI_CONTEXT * pavi, uint8_t *buf, uint32_t size)
245245

246246
if (strhheader->StreamType != AVI_VIDS_STREAM)
247247
{
248+
printf("Got %d %x strhheader->StreamType\n", strhheader->StreamType, strhheader->StreamType);
248249
return AVI_FORMAT_ERR;
249250
}
250251

examples/Demo_CES_mjpeg/Demo_CES_mjpeg.ino

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ mbed::DigitalOut video_rst(PJ_3);
1414

1515
extern "C" uint32_t JPEG_Decode_DMA(JPEG_HandleTypeDef *hjpeg, uint32_t FrameSourceAddress , uint32_t FrameSize, uint32_t DestAddress);
1616

17-
static uint32_t AVI_FILE_ADDRESS = ((uint32_t)(0x90000000)); // start of qspi flash, correct me later
17+
static uint32_t AVI_FILE_ADDRESS = ((uint32_t)(0x90000000) + (2048 * 4096)); // start of qspi flash, correct me later
1818

1919
/* Private macro -------------------------------------------------------------*/
2020
/* Private variables ---------------------------------------------------------*/
@@ -62,6 +62,7 @@ void setup() {
6262

6363
delay(1000);
6464

65+
/*
6566
QSPIFBlockDevice* block_device = new QSPIFBlockDevice(PD_11, PD_12, PF_7, PD_13,
6667
PF_10, PG_6, QSPIF_POLARITY_MODE_0, MBED_CONF_QSPIF_QSPI_FREQ);
6768
block_device->init();
@@ -74,29 +75,35 @@ void setup() {
7475
7576
printf("QSPIF BD erase size (at address 0): %llu\n", sector_size_at_address_0);
7677
77-
/*
7878
char avi_header[] = {0x52, 0x49, 0x46, 0x46};
7979
char *buffer = (char *) malloc(sector_size_at_address_0);
80-
int i = 2048;
80+
int i = 0;
8181
int res = 0;
82-
while (sector_size_at_address_0 * i < block_device.size()) {
83-
block_device.read(buffer, sector_size_at_address_0 * i, sector_size_at_address_0);
82+
while (sector_size_at_address_0 * i < block_device->size()) {
83+
block_device->read(buffer, i, sector_size_at_address_0);
8484
res = KMP(avi_header, 4, buffer, sector_size_at_address_0);
8585
if (res != -1) {
86-
break;
86+
break;
8787
}
8888
i++;
8989
}
90-
*/
90+
9191
char *buffer = (char *) malloc(sector_size_at_address_0);
92-
block_device->read(buffer, 2048 * 4096, sector_size_at_address_0);
92+
block_device->read(buffer, 0, sector_size_at_address_0);
93+
*/
94+
95+
//AVI_FILE_ADDRESS = (((uint32_t)(ardulogo_avi)));
96+
// DumpHex((void*)buffer, 40);
97+
98+
AVI_FILE_ADDRESS = ((uint32_t)(0x90000000));
99+
//AVI_FILE_ADDRESS = (((uint32_t)(video_envie_avi)));
100+
101+
DumpHex((void*)AVI_FILE_ADDRESS + 0x3210, 40);
93102

94-
AVI_FILE_ADDRESS = (((uint32_t)(EnvieH7V1_0_4_avi))); // + (2048 * 4096))));
95-
//DumpHex((void*)AVI_FILE_ADDRESS, 40);
96103
printf("Address: %x\n", AVI_FILE_ADDRESS);
97104

98105
// Deinitialize the device
99-
block_device->deinit();
106+
//block_device->deinit();
100107

101108
LCD_X_Size = stm32_getXSize();
102109
LCD_Y_Size = stm32_getYSize();
@@ -226,6 +233,11 @@ void loop() {
226233
/*##-7- Get JPEG Info #############################################*/
227234
HAL_JPEG_GetInfo(&JPEG_Handle, &JPEG_Info);
228235

236+
printf("ChromaSubsampling: %x\n", JPEG_Info.ChromaSubsampling);
237+
printf("w/h: %d : %d\n", JPEG_Info.ImageWidth, JPEG_Info.ImageHeight);
238+
printf("ImageQuality: %d\n", JPEG_Info.ImageQuality);
239+
printf("Colorspace: %d\n", JPEG_Info.ColorSpace);
240+
229241
/*##-8- Initialize the DMA2D #######################################*/
230242
DMA2D_Init(JPEG_Info.ImageWidth, JPEG_Info.ImageHeight, JPEG_Info.ChromaSubsampling);
231243
}

examples/Demo_CES_mjpeg/config.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
#define MDMA_INSTANCE MDMA_Channel0
1313

1414
#define LCD_FRAME_BUFFER 0xC0000000
15-
#define JPEG_OUTPUT_DATA_BUFFER0 0xC0400000
16-
#define JPEG_OUTPUT_DATA_BUFFER1 0xC0600000
15+
#define JPEG_OUTPUT_DATA_BUFFER0 0xC0200000
16+
#define JPEG_OUTPUT_DATA_BUFFER1 0xC0500000
1717

1818
/*uncomment this line to regulate the decoding frame rate to the native video frame rate */
19-
//#define USE_FRAMERATE_REGULATION
19+
#define USE_FRAMERATE_REGULATION
2020

2121
#endif /* __MAIN_H */
2222

examples/Demo_CES_mjpeg/decode_dma.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ void HAL_JPEG_DataReadyCallback (JPEG_HandleTypeDef *hjpeg, uint8_t *pDataOut, u
137137
*/
138138
void HAL_JPEG_ErrorCallback(JPEG_HandleTypeDef *hjpeg)
139139
{
140+
printf("HAL_JPEG_ErrorCallback\n");
140141
Jpeg_HWDecodingEnd = 1;
141142
}
142143

0 commit comments

Comments
 (0)