Merge pull request #1358 from openmv/jpeg_mdma_handle

Keep JPEG MDMA handles local.
This commit is contained in:
Ibrahim Abd Elkader 2021-06-09 01:27:18 +02:00 committed by GitHub
commit 8bc5c8cbde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 10 deletions

View File

@ -981,6 +981,7 @@ void bmp_write_subimg(image_t *img, const char *path, rectangle_t *r);
#if (OMV_HARDWARE_JPEG == 1) #if (OMV_HARDWARE_JPEG == 1)
void imlib_jpeg_compress_init(); void imlib_jpeg_compress_init();
void imlib_jpeg_compress_deinit(); void imlib_jpeg_compress_deinit();
void jpeg_mdma_irq_handler();
#endif #endif
bool jpeg_compress(image_t *src, image_t *dst, int quality, bool realloc); bool jpeg_compress(image_t *src, image_t *dst, int quality, bool realloc);
int jpeg_clean_trailing_bytes(int bpp, uint8_t *data); int jpeg_clean_trailing_bytes(int bpp, uint8_t *data);

View File

@ -546,8 +546,8 @@ static void jpeg_get_mcu(image_t *src, int x_offset, int y_offset, int dx, int d
static JPEG_HandleTypeDef JPEG_Handle = {}; static JPEG_HandleTypeDef JPEG_Handle = {};
static JPEG_ConfTypeDef JPEG_Config = {}; static JPEG_ConfTypeDef JPEG_Config = {};
MDMA_HandleTypeDef JPEG_MDMA_Handle_In = {}; static MDMA_HandleTypeDef JPEG_MDMA_Handle_In = {};
MDMA_HandleTypeDef JPEG_MDMA_Handle_Out = {}; static MDMA_HandleTypeDef JPEG_MDMA_Handle_Out = {};
static int JPEG_out_data_length_max = 0; static int JPEG_out_data_length_max = 0;
static volatile int JPEG_out_data_length = 0; static volatile int JPEG_out_data_length = 0;
@ -576,6 +576,12 @@ void JPEG_IRQHandler()
IRQ_EXIT(JPEG_IRQn); IRQ_EXIT(JPEG_IRQn);
} }
void jpeg_mdma_irq_handler()
{
HAL_MDMA_IRQHandler(&JPEG_MDMA_Handle_In);
HAL_MDMA_IRQHandler(&JPEG_MDMA_Handle_Out);
}
void HAL_JPEG_GetDataCallback(JPEG_HandleTypeDef *hjpeg, uint32_t NbDecodedData) void HAL_JPEG_GetDataCallback(JPEG_HandleTypeDef *hjpeg, uint32_t NbDecodedData)
{ {
HAL_JPEG_Pause(hjpeg, JPEG_PAUSE_RESUME_INPUT); HAL_JPEG_Pause(hjpeg, JPEG_PAUSE_RESUME_INPUT);

View File

@ -11,7 +11,7 @@
#include STM32_HAL_H #include STM32_HAL_H
#include "axiqos.h" #include "axiqos.h"
#include "omv_boardconfig.h" #include "omv_boardconfig.h"
#include "imlib.h"
#include "irq.h" #include "irq.h"
/* GPIO struct */ /* GPIO struct */
@ -653,17 +653,11 @@ void HAL_MspDeInit(void)
} }
#if (OMV_HARDWARE_JPEG == 1)
extern MDMA_HandleTypeDef JPEG_MDMA_Handle_In;
extern MDMA_HandleTypeDef JPEG_MDMA_Handle_Out;
#endif
void MDMA_IRQHandler() void MDMA_IRQHandler()
{ {
IRQ_ENTER(MDMA_IRQn); IRQ_ENTER(MDMA_IRQn);
#if (OMV_HARDWARE_JPEG == 1) #if (OMV_HARDWARE_JPEG == 1)
HAL_MDMA_IRQHandler(&JPEG_MDMA_Handle_In); jpeg_mdma_irq_handler();
HAL_MDMA_IRQHandler(&JPEG_MDMA_Handle_Out);
#endif #endif
IRQ_EXIT(MDMA_IRQn); IRQ_EXIT(MDMA_IRQn);
} }