2016-11-09 39 views
0

我試圖在freeRTOS上實現Jpeg編碼設置。主任務初始化捕獲單元。FreeRTOS沒有從ISR進行上下文切換 - ARM926EJ-S核心

void Video_SNAPThread(void* pvParameters) 
{ 
    while (1) 
    { 
     capture_startSNAP();   /* SNAPSHOT Capture - Encode API*/ 
     vTaskSuspend(xHandleSNAP); /* Task Suspend - within context*/ 

    } 
} 

capture_start函數配置傳感器參數,並開始觸發在每個幀(幀結束的中斷)的端部的回調函數捕獲單元。

capture_startSNAP定義如下

int capture_startSNAP() 
{ 
    TickType_t xMaxBlockTime; 
    xMaxBlockTime = pdMS_TO_TICKS(4000); 
#if defined(__1ST_PORT__) && !defined(__2ND_PORT__) 
     sysprintf("Plug in sensor to port 0\n"); 
#endif 
#if !defined(__1ST_PORT__) && defined(__2ND_PORT__) 
     sysprintf("Plug in sensor to port 1\n"); 
#endif 
#if defined(__1ST_PORT__) && defined(__2ND_PORT__) 
     sysprintf("Plug in sensor to port 1 and port 2\n"); 
#endif 
     sysSetInterruptPriorityLevel(IRQ_VIN, 2); 
     sysSetInterruptPriorityLevel(IRQ_VIN1, 1); 
     configASSERT(xTask_Notify == NULL); 
     xTask_Notify = xTaskGetCurrentTaskHandle(); 
     Smpl_NT99141_HD_SNAP(); 

     while((ulTaskNotifyTake(Task_Woken , xMaxBlockTime) == 0));    
     jpegmain(); 
     return 0; 
} 

Smpl_NT99141_HD_SNAP函數設置回調函數,並啓動capture.The ISR通知幀的結束,又應該做上下文切換到Video_SNAPThread給予任務進一步數據處理。我已經使用任務通知方法從ISR切換回Video_snapthread進行編碼,但它不起作用。

void VideoIn_InterruptHandler_SNAP(void) 
{ 
     pVin1->Close(); 
     printf("Interrupt"); 
     Task_Woken = pdFALSE; 
     configASSERT(xTask_Notify != NULL); 
     vTaskNotifyGiveFromISR(xTask_Notify, &Task_Woken); 
     xTask_Notify = NULL; 
     portYIELD_FROM_ISR(Task_Woken);  
} 

請糾正我,如果我錯了某處。仍然是freeRTOS的新手。

回答

0

問題已解決。顯然,中斷內的'Debug'printf()引發了這個問題。