/*
* @file hv_drv_UsbComm.h
* @brief Header file of usb common driver for host and device.
*
* @author HiView SoC Software Team
* @version 1.0.0
* @date 2022-06-15
*/

#ifndef __HV_DRV_USB_COMMON_H
#define __HV_DRV_USB_COMMON_H

#include "hv_comm_DataType.h"
#include "hv_vos_Comm.h"


//#define USB_TRACKED_FILE_POSITION

/**
 * @brief driver层获取mw层队列消息的回调函数定义
 */
typedef HV_VOS_QUEUE_S* (*GetUsbOtaQueue)(void);

#ifdef USB_TRACKED_FILE_POSITION
VOID* HV_Drv_USB_TrackedMalloc(UINT32 size, const char* file, UINT32 line);
#else
VOID* HV_Drv_USB_TrackedMalloc(UINT32 size);
#endif
VOID HV_Drv_USB_TrackedFree(VOID* ptr);
VOID HV_Drv_USB_GlobalFreeAll(VOID);


/**
 * @brief 注册获取mw层usb消息队列的回调函数.
 * @param[in] CbFunc callback function.
 * @return NONE
 */
VOID Hv_Drv_USB_RegisterGetQueueCb(VOID *CbFunc);

/**
 * @brief Send the event to queue of usb.
 * @param[in] usEventId  the event id to send.
 * @param[in] usValue  the value to send.
 * @return  Status, 0:HV_SUCCESS, 1:HV_FAILURE.
 */
Status Hv_Drv_USB_SendEventToUsbQueue(USHORT16 usEventId, USHORT16 usValue);

/**
 * @brief Send the event to queue of usb from ISR.
 * @param[in] usEventId  the event id to send.
 * @param[in] usValue  the value to send.
 * @return Status, 0:HV_SUCCESS, 1:HV_FAILURE.
 */
Status Hv_Drv_USB_SendEventToUsbQueueFromISR(USHORT16 usEventId, USHORT16 usValue);

#endif 
