📄 csl_usbotgaux.h
字号:
/**==========================================================================
* @file csl_usbotgAux.h
*
* @path $(CSLPATH)\arm\usbotg\src
*
* @desc API Auxilary header file for USBOTG CSL.
*
*/
/*===========================================================================
* Copyright (c) Texas Instruments Inc 2002, 2003, 2004
*
* Use of this software is controlled by the terms and conditions found in the
* license agreement under which this software has been supplied.
*===========================================================================
*/
#ifndef _CSL_USBOTG_AUX_H_
#define _CSL_USBOTG_AUX_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <cslr_usbotg.h>
#include <csl_usbotg.h>
inline
void
CSL_usbotgIdleEnable (
CSL_UsbotgHandle hUsbotg
)
{
CSL_FINST(hUsbotg->regs->OTG_SYSCON_1,USBOTG_OTG_SYSCON_1_OTG_IDLE_EN,ENABLE);
}
inline
void
CSL_usbotgIdleDisable(
CSL_UsbotgHandle hUsbotg
)
{
CSL_FINST(hUsbotg->regs->OTG_SYSCON_1,USBOTG_OTG_SYSCON_1_OTG_IDLE_EN,DISABLE);
}
inline
void
CSL_usbotgHostIdleEnable (
CSL_UsbotgHandle hUsbotg
)
{
CSL_FINST(hUsbotg->regs->OTG_SYSCON_1,USBOTG_OTG_SYSCON_1_HST_IDLE_EN,ENABLE);
}
inline
void
CSL_usbotgHostIdleDisable (
CSL_UsbotgHandle hUsbotg
)
{
CSL_FINST(hUsbotg->regs->OTG_SYSCON_1,USBOTG_OTG_SYSCON_1_HST_IDLE_EN,DISABLE);
}
inline
void
CSL_usbotgDevidleEnable (
CSL_UsbotgHandle hUsbotg
)
{
CSL_FINST(hUsbotg->regs->OTG_SYSCON_1,USBOTG_OTG_SYSCON_1_DEV_IDLE_EN,ENABLE);
}
inline
void
CSL_usbotgDevidleDisable (
CSL_UsbotgHandle hUsbotg
)
{
CSL_FINST(hUsbotg->regs->OTG_SYSCON_1,USBOTG_OTG_SYSCON_1_DEV_IDLE_EN,DISABLE);
}
inline
void
CSL_usbotgReset (
CSL_UsbotgHandle hUsbotg
)
{
CSL_FINST(hUsbotg->regs->OTG_SYSCON_1,USBOTG_OTG_SYSCON_1_SOFT_RESET,RESET);
}
inline
void
CSL_usbotgEnable (
CSL_UsbotgHandle hUsbotg
)
{
CSL_FINST(hUsbotg->regs->OTG_SYSCON_2,USBOTG_OTG_SYSCON_2_OTG_EN,ENABLE);
}
inline
void
CSL_usbotgDisable (
CSL_UsbotgHandle hUsbotg
)
{
CSL_FINST(hUsbotg->regs->OTG_SYSCON_2,USBOTG_OTG_SYSCON_2_OTG_EN,DISABLE);
}
inline
void
CSL_usbotgHostEnable (
CSL_UsbotgHandle hUsbotg
)
{
CSL_FINST(hUsbotg->regs->OTG_SYSCON_2,USBOTG_OTG_SYSCON_2_UHOST_EN,ACTIVE);
}
inline
void
CSL_usbotgHostDisable (
CSL_UsbotgHandle hUsbotg
)
{
CSL_FINST(hUsbotg->regs->OTG_SYSCON_2,USBOTG_OTG_SYSCON_2_UHOST_EN,RESET);
}
inline
void
CSL_usbotgTllSpeedLow (
CSL_UsbotgHandle hUsbotg
)
{
CSL_FINST(hUsbotg->regs->OTG_SYSCON_2,USBOTG_OTG_SYSCON_2_HMC_TLLSPEED,LOW_SPEED);
}
inline
void
CSL_usbotgTllSpeedFull (
CSL_UsbotgHandle hUsbotg
)
{
CSL_FINST(hUsbotg->regs->OTG_SYSCON_2,USBOTG_OTG_SYSCON_2_HMC_TLLSPEED,FULL_SPEED);
}
inline
void
CSL_usbotgTllAttachDetach (
CSL_UsbotgHandle hUsbotg
)
{
CSL_FINST(hUsbotg->regs->OTG_SYSCON_2,USBOTG_OTG_SYSCON_2_HMC_TLLATTACH,DETACH);
}
inline
void
CSL_usbotgTllAttachAttach (
CSL_UsbotgHandle hUsbotg
)
{
CSL_FINST(hUsbotg->regs->OTG_SYSCON_2,USBOTG_OTG_SYSCON_2_HMC_TLLATTACH,ATTACH);
}
inline
void
CSL_usbotgCtrlSigUpdate (
CSL_UsbotgHandle hUsbotg,
Uint16 number
)
{
CSL_FINSR(hUsbotg->regs->OTG_CTRL,20,16,number);
}
inline
void
CSL_usbotgABhnpEnable (
CSL_UsbotgHandle hUsbotg
)
{
CSL_FINST(hUsbotg->regs->OTG_CTRL,USBOTG_OTG_CTRL_A_SETB_HNPEN,ENABLE);
}
inline
void
CSL_usbotgABhnpDisable (
CSL_UsbotgHandle hUsbotg
)
{
CSL_FINST(hUsbotg->regs->OTG_CTRL,USBOTG_OTG_CTRL_A_SETB_HNPEN,DISABLE);
}
inline
void
CSL_usbotgABusReqNone (
CSL_UsbotgHandle hUsbotg
)
{
CSL_FINST(hUsbotg->regs->OTG_CTRL,USBOTG_OTG_CTRL_A_BUSREQ,DISABLE);
}
inline
void
CSL_usbotgBBhnpEnable (
CSL_UsbotgHandle hUsbotg
)
{
CSL_FINST(hUsbotg->regs->OTG_CTRL,USBOTG_OTG_CTRL_B_HNPEN,ENABLE);
}
inline
void
CSL_usbotgBBhnpDisable (
CSL_UsbotgHandle hUsbotg
)
{
CSL_FINST(hUsbotg->regs->OTG_CTRL,USBOTG_OTG_CTRL_B_HNPEN,DISABLE);
}
inline
void
CSL_usbotgABusReq (
CSL_UsbotgHandle hUsbotg
)
{
CSL_FINST(hUsbotg->regs->OTG_CTRL,USBOTG_OTG_CTRL_A_BUSREQ,ENABLE);
}
inline
void
CSL_usbotgBBusReq (
CSL_UsbotgHandle hUsbotg
)
{
CSL_FINST(hUsbotg->regs->OTG_CTRL,USBOTG_OTG_CTRL_B_BUSREQ,ENABLE);
}
inline
void
CSL_usbotgBBusReqNone (
CSL_UsbotgHandle hUsbotg
)
{
CSL_FINST(hUsbotg->regs->OTG_CTRL,USBOTG_OTG_CTRL_B_BUSREQ,ENABLE);
}
inline
void
CSL_usbotgASessionEnd (
CSL_UsbotgHandle hUsbotg
)
{
CSL_FINST(hUsbotg->regs->OTG_CTRL,USBOTG_OTG_CTRL_OTG_BUSDROP,ENABLE);
}
inline
void
CSL_usbotgInterruptEnable (
CSL_UsbotgHandle hUsbotg,
CSL_BitMask16 bitmask
)
{
CSL_FINSR(hUsbotg->regs->OTG_IRQ_EN,15,0,bitmask);
}
inline
void
CSL_usbotgInterruptClear (
CSL_UsbotgHandle hUsbotg,
CSL_BitMask16 bitmask
)
{
CSL_FINSR(hUsbotg->regs->OTG_IRQ_SRC,15,0,bitmask);
}
inline
Uint16
CSL_usbotgGetVendorCode (
CSL_UsbotgHandle hUsbotg
)
{
return (Uint16) CSL_FEXT(hUsbotg->regs->OTG_VC,USBOTG_OTG_VC_VC);
}
inline
Uint16
CSL_usbotgGetTestFsmState (
CSL_UsbotgHandle hUsbotg
)
{
return (Uint16) CSL_FEXT(hUsbotg->regs->OTG_TEST,USBOTG_OTG_TEST_OTG_FSM_STATE);
}
inline
CSL_BitMask16
CSL_usbotgGetInterruptStatus (
CSL_UsbotgHandle hUsbotg
)
{
return (CSL_BitMask16) CSL_FEXTR(hUsbotg->regs->OTG_IRQ_SRC,15,0);
}
inline
Uint32
CSL_usbotgGetControl(
CSL_UsbotgHandle hUsbotg
)
{
return (Uint32) hUsbotg->regs->OTG_CTRL;
}
inline
Bool
CSL_usbotgGetResetDone(
CSL_UsbotgHandle hUsbotg
)
{
Uint16 tempVal;
tempVal = CSL_FEXT(hUsbotg->regs->OTG_SYSCON_1,USBOTG_OTG_SYSCON_1_RESET_DONE);
if (tempVal)
return TRUE;
else
return FALSE;
}
inline
Bool
CSL_usbotgGetIdle(
CSL_UsbotgHandle hUsbotg
)
{
Uint16 tempVal;
tempVal = CSL_FEXT(hUsbotg->regs->OTG_SYSCON_1,USBOTG_OTG_SYSCON_1_OTG_IDLE_EN);
if (tempVal)
return TRUE;
else
return FALSE;
}
inline
Bool
CSL_usbotgGetHostIdle(
CSL_UsbotgHandle hUsbotg
)
{
Uint16 tempVal;
tempVal = CSL_FEXT(hUsbotg->regs->OTG_SYSCON_1,USBOTG_OTG_SYSCON_1_HST_IDLE_EN);
if (tempVal)
return TRUE;
else
return FALSE;
}
inline
Bool
CSL_usbotgGetDeviIdle(
CSL_UsbotgHandle hUsbotg
)
{
Uint16 tempVal;
tempVal = CSL_FEXT(hUsbotg->regs->OTG_SYSCON_1,USBOTG_OTG_SYSCON_1_DEV_IDLE_EN);
if (tempVal)
return TRUE;
else
return FALSE;
}
inline
Bool
CSL_usbotgGetEnable(
CSL_UsbotgHandle hUsbotg
)
{
Uint16 tempVal;
tempVal = CSL_FEXT(hUsbotg->regs->OTG_SYSCON_2,USBOTG_OTG_SYSCON_2_OTG_EN);
if (tempVal)
return TRUE;
else
return FALSE;
}
inline
Bool
CSL_usbotgGetHostEnable(
CSL_UsbotgHandle hUsbotg
)
{
Uint16 tempVal;
tempVal = CSL_FEXT(hUsbotg->regs->OTG_SYSCON_2,USBOTG_OTG_SYSCON_2_UHOST_EN);
if (tempVal)
return TRUE;
else
return FALSE;
}
inline
CSL_UsbotgTllspeed
CSL_GetTllSpeed(
CSL_UsbotgHandle hUsbotg
)
{
Uint16 tempVal;
tempVal = CSL_FEXT(hUsbotg->regs->OTG_SYSCON_2,USBOTG_OTG_SYSCON_2_HMC_TLLSPEED);
if (tempVal)
return CSL_USBOTG_TLLSPEED_FULL;
else
return CSL_USBOTG_TLLSPEED_LOW;
}
inline
Bool
CSL_GetTllAttach(
CSL_UsbotgHandle hUsbotg
)
{
Uint16 tempVal;
tempVal = CSL_FEXT(hUsbotg->regs->OTG_SYSCON_2,USBOTG_OTG_SYSCON_2_HMC_TLLATTACH);
if (tempVal)
return TRUE;
else
return FALSE;
}
inline
Bool
CSL_GetABhnp(
CSL_UsbotgHandle hUsbotg
)
{
Uint16 tempVal;
tempVal = CSL_FEXT(hUsbotg->regs->OTG_CTRL,USBOTG_OTG_CTRL_A_SETB_HNPEN);
if (tempVal)
return TRUE;
else
return FALSE;
}
inline
Bool
CSL_GetABusReq(
CSL_UsbotgHandle hUsbotg
)
{
Uint16 tempVal;
tempVal = CSL_FEXT(hUsbotg->regs->OTG_CTRL,USBOTG_OTG_CTRL_A_BUSREQ);
if (tempVal)
return TRUE;
else
return FALSE;
}
inline
Bool
CSL_GetBBhnp(
CSL_UsbotgHandle hUsbotg
)
{
Uint16 tempVal;
tempVal = CSL_FEXT(hUsbotg->regs->OTG_CTRL,USBOTG_OTG_CTRL_B_HNPEN);
if (tempVal)
return TRUE;
else
return FALSE;
}
inline
Bool
CSL_GetBBusReq(
CSL_UsbotgHandle hUsbotg
)
{
Uint16 tempVal;
tempVal = CSL_FEXT(hUsbotg->regs->OTG_CTRL,USBOTG_OTG_CTRL_B_BUSREQ);
if (tempVal)
return TRUE;
else
return FALSE;
}
inline
Bool
CSL_GetASession(
CSL_UsbotgHandle hUsbotg
)
{
Uint16 tempVal;
tempVal = CSL_FEXT(hUsbotg->regs->OTG_CTRL,USBOTG_OTG_CTRL_OTG_BUSDROP);
if (tempVal)
return TRUE;
else
return FALSE;
}
inline
CSL_BitMask16
CSL_GetInterruptEnable(
CSL_UsbotgHandle hUsbotg
)
{
return (CSL_BitMask16) CSL_FEXTR(hUsbotg->regs->OTG_IRQ_EN,15,0);
}
#ifdef __cplusplus
}
#endif
#endif /* _CSL_USBOTG_AUX_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -