📄 usbh_hcds_common.c
字号:
/*
* description : USBH HCD Common(static)
* Maker : Hiromichi Kondo
* Copyright : (C)2005,SEIKO EPSON Corp. All Rights Reserved.
*/
#include <usbh_hcd.h>
#include <usbh_hcds_common.h>
#include <SPRDEF.h>
#include <SPRSTS.h>
/*****************************************
* Define definition
*****************************************/
/*****************************************
* Structure definition
*****************************************/
/*****************************************
* Function prototype declaration
*****************************************/
/*****************************************
* Variable definition
*****************************************/
/*=============================================================================================
// Function_Name: USBH_HCDS_InitListHead
//
// description : Initialize the list header
//
// argument : psListHead Pointer of list header
//
// return : None
===============================================================================================*/
void USBH_HCDS_InitListHead( USBH_HCD_LIST_HEAD *psListHead )
{
psListHead->psPrev = psListHead->psNext = psListHead;
}
/*=============================================================================================
// Function_Name: USBH_HCDS_ListAdd
//
// description : Add list
//
// argument : psNew Pointer of list header to add
// psListHead Pointer of list header
//
// return : None
===============================================================================================*/
void USBH_HCDS_ListAdd( USBH_HCD_LIST_HEAD *psNew, USBH_HCD_LIST_HEAD *psListHead )
{
psListHead->psNext->psPrev = psNew;
psNew->psNext = psListHead->psNext;
psNew->psPrev = psListHead;
psListHead->psNext = psNew;
}
/*=============================================================================================
// Function_Name: USBH_HCDS_ListAddTail
//
// description : The list is added to the tail
//
// argument : psNew Pointer of list header to add
// psListHead Pointer of list header
//
// return : None
===============================================================================================*/
void USBH_HCDS_ListAddTail( USBH_HCD_LIST_HEAD *psNew, USBH_HCD_LIST_HEAD *psListHead )
{
psNew->psNext = psListHead;
psNew->psPrev = psListHead->psPrev;
psListHead->psPrev->psNext = psNew;
psListHead->psPrev = psNew;
}
/*=============================================================================================
// Function_Name: USBH_HCDS_ListDel
//
// description : Delete list
//
// argument : psDel Pointer of list header to delete
//
// return : None
===============================================================================================*/
void USBH_HCDS_ListDel( USBH_HCD_LIST_HEAD *psDel )
{
psDel->psNext->psPrev = psDel->psPrev;
psDel->psPrev->psNext = psDel->psNext;
}
/*=============================================================================================
// Function_Name: USBH_HCDS_ListEmpty
//
// description : Check whether the list is empty.
//
// argument : psListHead Pointer of list header to check
//
// return : 0 The list is not empty
// 1 The list is empty
===============================================================================================*/
int USBH_HCDS_ListEmpty( USBH_HCD_LIST_HEAD *psListHead )
{
return (psListHead->psNext == psListHead);
}
/*=============================================================================================
// Function_Name: USBH_HCDS_ExecCallback
//
// description : Execution part of callback function
//
// argument : pfnFunc Pointer of callback function
// param0 Argument1 passed to callback function
// param1 Argument2 passed to callback function
// *pParam Argument3 passed to callback function
//
// return : STATUS_SUCCESS Processing is completed successfully
// STATUS_XXX Depends on the callback function
===============================================================================================*/
long USBH_HCDS_ExecCallback(CALLBACK_PROC pfnFunc, unsigned long param0, unsigned long param1, void *pParam)
{
if( pfnFunc != NULL ){
/* The callback function is registered */
/* The callback function is called */
return (pfnFunc)(param0, param1, pParam);
}
return STATUS_SUCCESS;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -