nt9856x/code/application/source/cardv/SrcCode/System/SysUsb_CB.c
2023-03-28 15:07:53 +08:00

85 lines
2.1 KiB
C
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
DevMan, Service command function implementation
@file DeviceUsbMan.c
@ingroup mDEVMAN
Copyright Novatek Microelectronics Corp. 2012. All rights reserved.
*/
//global debug level: PRJ_DBG_LVL
#include "PrjInc.h"
//local debug level: THIS_DBGLVL
#define THIS_DBGLVL 2 // 0=FATAL, 1=ERR, 2=WRN, 3=UNIT, 4=FUNC, 5=IND, 6=MSG, 7=VALUE, 8=USER
///////////////////////////////////////////////////////////////////////////////
#define __MODULE__ SysUsbCB
#define __DBGLVL__ ((THIS_DBGLVL>=PRJ_DBG_LVL)?THIS_DBGLVL:PRJ_DBG_LVL)
#define __DBGFLT__ "*" //*=All, [mark]=CustomClass
#include <kwrap/debug.h>
///////////////////////////////////////////////////////////////////////////////
#if (USB_MODE == ENABLE)
/////////////////////////////////////////////////////////////////////////////
// USB
#include "GxUSB.h"
void USB_CB(UINT32 event, UINT32 param1, UINT32 param2);
void USB_CB(UINT32 event, UINT32 param1, UINT32 param2)
{
switch (event) {
case SYSTEM_CB_CONFIG:
//1.設定init值
//2.設定CB值,
//3.註冊SxJob服務 ---------> System Job
//4.註冊SxTimer服務 ---------> Detect Job
//#if (USBINSERT_FUNCTION == ENABLE)
//SX_TIMER_DET_USB_ID = System_AddSxTimer(UI_DetUSB, 5,"GxUSB");
//#endif
break;
case USB_CB_PLUG:
//usb plug in
DBG_IND("USB inserted.\r\n");
Ux_PostEvent(NVTEVT_USB_INSERT, 1, param1);
break;
case USB_CB_UNPLUG:
//usb unplug
DBG_IND("USB removed.\r\n");
Ux_PostEvent(NVTEVT_USB_REMOVE, 1, param1);
break;
case USB_CB_CHARGE:
//usb charging current
DBG_IND("USB charging current.\r\n");
Ux_PostEvent(NVTEVT_USB_CHARGE_CURRENT, 1, param1);
break;
}
}
/*
以下3個USB mode
MSDC
需要固定的 Size 128K Bytes
有個變數就是 Vendor Commands,
有開Vendor Command要 142KB >> check define MSDCNVT_REQUIRE_MIN_SIZE
SIDC
兩塊total需要的buffer公式如下:
2930KB(x 1024) + Object Num x 108 Byte
PCC:
2塊 * M.
M = ((JPEG bitstream + header + 2 )取32 byte align) + 64
JPEG bitstream 在HD mode 必定不小於0x80000B
JPEG bitstream 在其他mode必定不小於0x40000B
*/
#endif