This commit is contained in:
2026-03-14 12:19:36 +08:00
parent 15f5230095
commit d53ab96f53
5 changed files with 86 additions and 15 deletions
+9 -3
View File
@@ -9,7 +9,8 @@ __attribute__((aligned(4))) uint8_t DMA_LineBuf1[BYTES_PER_LINE];
volatile uint8_t Line_Ready_Flag = 0;
volatile uint8_t *Ready_Line_Ptr = NULL;
volatile uint32_t current_line_idx = 0;
static uint32_t frame_count = 0;
volatile uint32_t dvp_frame_count = 0;
volatile uint32_t dvp_row_irq_cnt = 0;
extern u8 socket[];
extern volatile uint32_t sys_tick_ms;
@@ -46,6 +47,10 @@ void DVP_Init(void)
DVP_INTCfg(ENABLE, RB_DVP_IE_STR_FRM | RB_DVP_IE_ROW_DONE);
DVP_Cfg(DVP_DMA_Enable, DVP_FLAG_FIFO_RESET_Disable, DVP_RX_RESET_Disable);
DVP->CR0 |= RB_DVP_ENABLE;
printf("[DVP] Init done CR0=0x%02x CR1=0x%02x ROW=%d COL=%d\r\n",
(int)(DVP->CR0 & 0xFF), (int)(DVP->CR1 & 0xFF),
(int)DVP->ROW_NUM, (int)DVP->COL_NUM);
}
#define PROTOCOL_HEADER_RESERVE 64
@@ -71,7 +76,7 @@ void DVP_Task(void)
if (idx == SENSOR_HEIGHT - 1)
{
Frame_Ready_Flag = 1;
Ready_Frame_Count = frame_count;
Ready_Frame_Count = dvp_frame_count;
}
}
}
@@ -83,12 +88,13 @@ void DVP_IRQHandler(void)
{
DVP->IFR = RB_DVP_IF_STR_FRM;
current_line_idx = 0;
frame_count++;
dvp_frame_count++;
}
if (DVP->IFR & RB_DVP_IF_ROW_DONE)
{
DVP->IFR = RB_DVP_IF_ROW_DONE;
Ready_Line_Ptr = (DVP->CR1 & RB_DVP_BUF_TOG) ? DMA_LineBuf0 : DMA_LineBuf1;
dvp_row_irq_cnt++;
current_line_idx++;
Line_Ready_Flag = 1;
}
+2
View File
@@ -12,6 +12,8 @@
extern volatile uint8_t Line_Ready_Flag;
extern volatile uint8_t *Ready_Line_Ptr;
extern volatile uint32_t current_line_idx;
extern volatile uint32_t dvp_frame_count;
extern volatile uint32_t dvp_row_irq_cnt;
void DVP_Init(void);
void DVP_Task(void);