/**
 * @file hv_mw_UrgentTask.c
 * @brief urgent task source file
 * @details This file provides the following functions: \n
 *          (1) event dispatch \n
 *          (2) task handle \n
 *          (3) Feed functions \n
 *
 * @author HiView SoC Software Team
 * @version 1.0.0
 * @date 2022-08-25
 * @copyright Copyright(c),2022-8, Hiview Software. All rights reserved.
 * @par History:
 * <table>
 * <tr><th>Author                         <th>Date         <th>Change Description
 * <tr><td>Hiview SoC Software Team       <td>2022-08-25   <td>init
 * </table>
*/

#include "hv_comm_Assert.h"
#include "hv_comm_Event.h"
#include "hv_vos_Comm.h"

#include "hv_mw_UrgentTask.h"
#include "hv_mw_Hdcp.h"
#include "hv_mw_SystemManager.h"

static VOID UrgentEventDispatch(const UrgentEvent *pstUrgentEvent)
{
    switch (pstUrgentEvent->enEventType)
    {
        case URGENT_REV_EVENT_TYPE_HDCP_HDMI:
        {
            Hv_Mw_Hdcp_ProcHdmiHdcpMessage(pstUrgentEvent);
            break;
        }
        case URGENT_REV_EVENT_TYPE_HDCP_DP:
        {
            Hv_Mw_Hdcp_ProcDpHdcpMessage(pstUrgentEvent);
            break;
        }
        case URGENT_REV_EVENT_TYPE_CONTRAST:
        {
            break;
        }
        case URGENT_REV_EVENT_TYPE_LDC:
        {
            break;
        }
        default:
        {
            break;
        }
    }
    return;
}

VOID Hv_Mw_Urgent_TaskHandle(  VOID *arg  )
{
    HV_VOS_QUEUE_S* ptUrgentQueue = Hv_Mw_System_GetUrgentQueue();
    HV_ASSERT_VALID_PTR_VOID(ptUrgentQueue);
    UrgentEvent stUrgentEvent = {0};

    for (;;)
{
        #ifdef SW_DUMMY_DEBUG
        HV_WT32(SW_DUMMY_URGENT_TASK, (HV_RD32(SW_DUMMY_URGENT_TASK)+1));
        #endif
        if (Hv_Vos_QueueRecv(ptUrgentQueue, ((VOID*)&stUrgentEvent)))
        {
            UrgentEventDispatch(&stUrgentEvent);
        }
    }
    return;
}
