|
|
@@ -63,6 +63,8 @@
|
|
|
#define ITUFRAME_MAX_WIDTH VIN_WIDTH
|
|
|
#define ITUFRAME_MAX_HEIGHT VIN_HEIGHT
|
|
|
|
|
|
+#define ITU_TIMEOUT_TIMER TIMER_ID3
|
|
|
+
|
|
|
typedef struct {
|
|
|
uint32_t yaddr;
|
|
|
uint32_t uvaddr;
|
|
|
@@ -76,6 +78,7 @@ static SemaphoreHandle_t itu_mutex = NULL;
|
|
|
static void *itu_buf = NULL;
|
|
|
static int itu_enable = 0;
|
|
|
static int itu_take_video = 0;
|
|
|
+static unsigned int itu_int_status = 0;
|
|
|
|
|
|
|
|
|
static unsigned int itu_get_frame_yadde(unsigned int itu_id)
|
|
|
@@ -105,38 +108,49 @@ static unsigned int itu_get_frame_uvadde(unsigned int itu_id)
|
|
|
static void itu_interupt_handler(void *param)
|
|
|
{
|
|
|
unsigned int status = readl(itubase + ITU_INT_STATUS);
|
|
|
- unsigned int height = 0, wide = 0;
|
|
|
+
|
|
|
+ writel(0x0, itubase + ITU_INT_EN);
|
|
|
+ itu_int_status = status;
|
|
|
+ vTimerEnable(ITU_TIMEOUT_TIMER);
|
|
|
+}
|
|
|
+
|
|
|
+static void itu_timeout_callback(void *param)
|
|
|
+{
|
|
|
+ unsigned int height = 0, wide = 0;
|
|
|
unsigned int totheight = 0, totwide = 0;
|
|
|
unsigned int curr_handle_frame_id = 0;
|
|
|
|
|
|
- mdelay(2);
|
|
|
+ writel(0x2, itubase + ITU_INT_EN);
|
|
|
|
|
|
- //clear inter
|
|
|
- writel(status & 0xf0, itubase + ITU_INT_STATUS);
|
|
|
+ //clear inter
|
|
|
+ writel(itu_int_status & 0xf0, itubase + ITU_INT_STATUS);
|
|
|
|
|
|
- if ((status >> 4) & 0x1) {
|
|
|
- unsigned int val;
|
|
|
- val = readl(itubase + ITU_DET_REG3) ;
|
|
|
- height = (val >> 12) & 0xFFF;
|
|
|
- wide = val & 0xFFF;
|
|
|
+ if ((itu_int_status >> 4) & 0x1) {
|
|
|
+ unsigned int val;
|
|
|
+ val = readl(itubase + ITU_DET_REG3) ;
|
|
|
+ height = (val >> 12) & 0xFFF;
|
|
|
+ wide = val & 0xFFF;
|
|
|
|
|
|
- val = readl(itubase + ITU_DET_REG2) ;
|
|
|
- totheight = (val >> 12) & 0xFFF;
|
|
|
- totwide = val & 0xFFF;
|
|
|
- printf(">>>>height = %d, wide= %d, totheight = %d, totwide= %d\n", height, wide, totheight, totwide);
|
|
|
- }
|
|
|
+ val = readl(itubase + ITU_DET_REG2) ;
|
|
|
+ totheight = (val >> 12) & 0xFFF;
|
|
|
+ totwide = val & 0xFFF;
|
|
|
+ printf(">>>>height = %d, wide= %d, totheight = %d, totwide= %d\n", height, wide, totheight, totwide);
|
|
|
+ }
|
|
|
|
|
|
- if ((status >> 6) & 0x1) {
|
|
|
- unsigned int itu_dis_id = 1;
|
|
|
+ if ((itu_int_status >> 6) & 0x1) {
|
|
|
+ unsigned int itu_dis_id = 1;
|
|
|
|
|
|
- curr_handle_frame_id = readl(itubase + ITU_WR_STATUS) & 0x3;
|
|
|
- if (curr_handle_frame_id != 0)
|
|
|
- itu_dis_id = curr_handle_frame_id - 1;
|
|
|
- else
|
|
|
- itu_dis_id = 3;
|
|
|
+ curr_handle_frame_id = readl(itubase + ITU_WR_STATUS) & 0x3;
|
|
|
+ if (curr_handle_frame_id != 0)
|
|
|
+ itu_dis_id = curr_handle_frame_id - 1;
|
|
|
+ else
|
|
|
+ itu_dis_id = 3;
|
|
|
|
|
|
- xTaskNotifyFromISR(itu_task, itu_dis_id, eSetValueWithOverwrite, 0);
|
|
|
- }
|
|
|
+ xTaskNotifyFromISR(itu_task, itu_dis_id, eSetValueWithOverwrite, 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ vTimerClrInt(ITU_TIMEOUT_TIMER);
|
|
|
+ vTimerDisable(ITU_TIMEOUT_TIMER);
|
|
|
}
|
|
|
|
|
|
void itu_clear_addr_for_hwuse(void)
|
|
|
@@ -519,6 +533,11 @@ int itu_init(void)
|
|
|
printf("create itu display task fail.\n");
|
|
|
return -1;
|
|
|
}
|
|
|
+
|
|
|
+ request_irq(TIMER3_IRQn, 0, itu_timeout_callback, NULL);
|
|
|
+ vTimerInit(ITU_TIMEOUT_TIMER, 1, 0, 500);
|
|
|
+
|
|
|
request_irq(ITU_IRQn, 0, itu_interupt_handler, NULL);
|
|
|
+
|
|
|
return 0;
|
|
|
}
|