csl_usbhc.h
来自「dsp在音频处理中的运用」· C头文件 代码 · 共 1,496 行 · 第 1/4 页
H
1,496 行
@param (Uint32*)
@return CSL_SOK
*/
CSL_USBHC_QUERY_CURRENTED_CTRL,
/**@brief Queries the physical address of the current Endpoint
descriptor on the Periodic list.
@param (Uint32*)
@return CSL_SOK
*/
CSL_USBHC_QUERY_CURRENTED_PER,
/**@brief Queries the physical address of the head of bulk
endpoint descriptor.
@param (Uint32*)
@return CSL_SOK
*/
CSL_USBHC_QUERY_HEADED_BULK,
/**@brief Queries the physical address of the head of control
endpoint descriptor.
@param (Uint32*)
@return CSL_SOK
*/
CSL_USBHC_QUERY_HEADED_CTRL,
/**@brief Queries the physical address of the head of list or
retired transfer descriptors.
@param (Uint32*)
@return CSL_SOK
*/
CSL_USBHC_QUERY_HEAD_DONE,
/**@brief Queries the current interrupt event status.
@param (CSL_BitMask32*)
@return CSL_SOK
*/
CSL_USBHC_QUERY_INTREVENTS,
/**@brief Queries the Host controller functional state.
@param (CSL_UsbhcFuncState*) i.e Enums for USB Host Function States.
@return CSL_SOK
*/
CSL_USBHC_QUERY_HCFUNCSTATE,
/**@brief Queries the Host Controller Soft Reset Status
@param (CSL_Boolean*)
TRUE : Reset Done
FALSE: Reset Ongoing
@return CSL_SOK
*/
CSL_USBHC_QUERY_SOFTRESET,
/**@brief Queries the Host Controller Module Reset Status. This comes
into play at the module init time when the clock is just enabled.
@param (CSL_Boolean*)
TRUE : Reset Done
FALSE: Reset Ongoing
@return CSL_SOK
*/ CSL_USBHC_QUERY_SYSTEMRESET
}CSL_UsbhcHwStatusQuery;
/**
@}*/
/**@defgroup CSL_USBHC_RATIO_ENUM Enums for Control-Bulk Ratio
* @ingroup CSL_USBHC_CONTROL_API
* @{ */
/** @brief Enumeration for USBHC Control-Bulk ratio */
typedef enum {
/** One Control ED per bulk ED */
CSL_USBHC_CTRLBULKRATIO_1CTRL1BULK = 0,
/** Two Control ED per bulk ED */
CSL_USBHC_CTRLBULKRATIO_2CTRL1BULK = 1,
/** Three Control ED per bulk ED */
CSL_USBHC_CTRLBULKRATIO_3CTRL1BULK = 2,
/** Four Control ED per bulk ED */
CSL_USBHC_CTRLBULKRATIO_4CTRL1BULK = 3
}CSL_UsbhcCtrlBulkRatio;
/**
@}*/
/**
* @addtogroup CSL_USBHC_CONTROL_API
* @{ */
/** @brief CSL_UsbhcPortStat has the fields required to set/query the port
control/Status respectively.
*/
typedef struct CSL_UsbhcPortStatCtrl{
/** When used with a Query Command, statusCtrl is a Bitmask of the
different status fields
When used with a Control Command, statusCtrl is a Bitmask of the
different control fields
*/
CSL_BitMask32 statusCtrl;
/** port Num , 1-3 for which the status is desired */
CSL_UsbhcDev portNum;
}CSL_UsbhcPortStatCtrl;
/**
@} */
/** @addtogroup CSL_USBHC_SETUP_API
*
* @{ */
/** @brief CSL_UsbhcHwCtrlSetup is a substructure of the CSL_UsbhcHwSetup.
*
* that has the fields required for configuring parameters required at power-Up
* for the Host Controller. These are in accordance with the OHCI
* Host controller Specification.
*/
typedef struct CSL_UsbhcHwCtrlSetup{
/** Largest data packet allowed for full speed packets in bit times */
Uint16 largestDataPkt;
/** Frame Interval field */
Uint16 frameInterval;
/** Remote wakeup connected. OMAP1610 does not support this setting.
This is here for specification completeness.\n
TRUE : Remote WakeUp connected\n
FALSE: Remote WakeUp not connected
*/
Bool remoteWakeUpConn;
/** This field determines whether the OCPI bus timeout counter is disabled\n
TRUE - Indicates that OCPI timeout is disabled,\n
FALSE - Indicates that OCPI timeout is enabled
*/
Bool ocptimeoutDisable;
}CSL_UsbhcHwCtrlSetup;
/** @brief CSL_UsbhcHwRootHubASetup is a substructure of the CSL_UsbhcHwSetup.
*
* It has the fields required for the configuration of the Root Hub A descriptor
at power Up.
* These values are retained in the registers after a Soft Reset.
*/
typedef struct CSL_UsbhcHwRootHubASetup{
/** This field defines the minimum amount of time between
the host controller turning on power to a downstream port and when
the host can access the downstream device
*/
Uint16 powOntoPowGood;
/** This field determines whether power switching is supported or all
ports are always powered. OMAP1610 does not support this setting.
This is here for specification completeness.\n
TRUE - Indicates that ports are always powered on when the HC is
powered on,\n
FALSE - Indicates that ports are power-switched
*/
Bool noPowerSwitching;
/** This field determines mechanism in which power is supplied to the ports.
OMAP1610 does not support this setting. This is here for specification
completeness.\n
TRUE - Indicates that individual port power switching is supported,\n
FALSE - Indicates that all ports are powered at the same time\n
This field holds good if noPowerSwitching is FALSE
*/
Bool powerSwitchingMode;
/** This field determines how overcurrent status for the Root Hub ports
are reported. OMAP1610 does not support this setting. This is here for
specification completeness. \n
TRUE - Indicates that USB Host Controller does not support
overcurrent protection.\n
FALSE - Indicates that USB Host Controller reports overcurrent status
collectively for all downstream ports.
*/
Bool noOverCurrProtection;
/** This field determines how overcurrent status for the Root Hub ports are
reported. OMAP1610 does not support this setting. This is here for
specification completeness.\n
TRUE - Indicates that over current status is reported on a per port
basis.\n
FALSE - Over current status is reported collectively for all
downstream ports.\n
This field holds good if noOverCurrProtection is FALSE
*/
Bool overCurrProtectionMode;
}CSL_UsbhcHwRootHubASetup;
/** @brief CSL_UsbhcHwRootHubBSetup is a substructure of the CSL_UsbhcHwSetup.
*
* It has the fields required for the configuration of the Root Hub B
* descriptor at power Up.
* These values are retained in the registers after a Soft Reset.
*/
typedef struct CSL_UsbhcHwRootHubBSetup{
/** Bit Mask of the devices that are removable
eg. CSL_USBHC_PORT_1|CSL_USBHC_PORT_2
*/
CSL_BitMask16 nonRemovableDeviceMask;
/** Bit Mask for the port power control Mask
eg. CSL_USBHC_PORT_1|CSL_USBHC_PORT_2
This is only valid if powerSwitchingMode = TRUE
*/
CSL_BitMask16 portPowerCtrlMask;
}CSL_UsbhcHwRootHubBSetup;
/** @brief CSL_usbhcHwSetup has all the fields required to configure USB host
* controller at Power Up(After a Hardware Reset) or a Soft Reset.
*
* This structure has the substructures required to configure UsbHc at
* Power-Up as per the OHCI specification. Please note, as per the specification,
* the calling application/driver needs to wait for a minimum amount of time
* before assertion of reset on the USB i.e before the issuing the CMD_START
* This structure holds all settings for the USBHC at power up/reset alone and an
* additional command (CSL_USBHC_CMD_START) along with the relevant structure
* needs to be issued to setup additional control parameters for the host
* controller as per the OHCI specification. A soft reset does not force the root
* hub registers to take their reset values and they retain the values before the
* soft reset.
*/
typedef struct CSL_UsbhcHwSetup {
/** Configuration parameters at power Up
*/
CSL_UsbhcHwCtrlSetup* hwCtrlSetup;
/** Root Hub A Descriptor configuration parameters
*/
CSL_UsbhcHwRootHubASetup* hwRootHubASetup;
/** Root Hub B Descriptor configuration parameters
*/
CSL_UsbhcHwRootHubBSetup* hwRootHubBSetup;
}CSL_UsbhcHwSetup;
/**
@}*/
/** @addtogroup CSL_USBHC_CONTROL_API
*
* @{ */
/** @brief CSL_UsbhcHwStart has the fields required to do the remaining settings
* required to get the USB Host controller to operational state.
*
* After the hwSetup and elapse of stipulated time(as per the OHCI specification),
* the START command is expected to be issued along with appropriate
* initialisation of this structure to enable sending of SOF's on the bus.
*
*/
typedef struct CSL_UsbhcHwStart {
/** Physical address of the beginning of the HCCA */
Uint32 hcca;
/** Physical queue address of the control head */
Uint32 controlHeadED;
/** Physical queue address of the bulk head */
Uint32 bulkHeadED;
/** OR'd Interrupt Enable masks of those to be enabled */
CSL_BitMask32 interruptEnable;
/** Number of Control packets to the bulk packets */
CSL_UsbhcCtrlBulkRatio ctrlbulkRatio;
/** This defines the number of full speed bit times in a frame beyond
which the USB host controller cannot start an 8-byte low-speed packet
*/
Uint16 lowSpeedThreshold;
/** OR'd List masks of those to be enabled
eg. CSL_USBHC_LIST_BULK|CSL_USBHC_LIST_CTRL
*/
CSL_BitMask16 listEnable;
}CSL_UsbhcHwStart;
/**
@}*/
/** @brief CSL_UsbConfig register is used during the raw configuration
*/
typedef struct
{
/** HC Operating Mode register */
Uint32 HCCONTROL;
/** HC Command and status register */
Uint32 HCCOMMANDSTATUS;
/** HC Interrupt Enable register */
Uint32 HCINTERRUPTENABLE;
/** HC Interrupt Disable register */
Uint32 HCINTERRUPTDISABLE;
/** Physical address of HCCA */
Uint32 HCHCCA;
/** Physical address of head of control endpoint desc., */
Uint32 HCCONTROLHEADED;
/** Physical address of current control endpoint desc., */
Uint32 HCCONTROLCURRENTED;
/** Physical address of head of bulk endpoint desc., */
Uint32 HCBULKHEADED;
/** Physical address of current bulk endpoint desc., */
Uint32 HCBULKCURRENTED;
/** HC Frame interval register */
Uint32 HCFMINTERVAL;
/** HC Frame number register */
Uint32 HCFMNUMBER;
/** HC Periodic start register */
Uint32 HCPERIODICSTART;
/** HC Low Speed Threshold register */
Uint32 HCLSTHRESHOLD;
/** HC Root hub A */
Uint32 HCRHDESCRIPTORA;
/** HC Root hub B */
Uint32 HCRHDESCRIPTORB;
/** Host Time-out control */
Uint32 HOSTTIMEOUTCTRL;
}CSL_UsbhcConfig;
/**
@}*/
/**
* Default values for config structure
*/
#define CSL_USBHC_CONFIG_DEFAULTS { \
CSL_USBHC_HCCONTROL_RESETVAL, \
CSL_USBHC_HCCOMMANDSTATUS_RESETVAL, \
CSL_USBHC_HCINTERRUPTENABLE_RESETVAL, \
CSL_USBHC_HCINTERRUPTDISABLE_RESETVAL, \
CSL_USBHC_HCHCCA_RESETVAL, \
CSL_USBHC_HCCONTROLHEADED_RESETVAL, \
CSL_USBHC_HCCONTROLCURRENTED_RESETVAL, \
CSL_USBHC_HCBULKHEADED_RESETVAL, \
CSL_USBHC_HCBULKCURRENTED_RESETVAL, \
CSL_USBHC_HCFMINTERVAL_RESETVAL, \
CSL_USBHC_HCFMNUMBER_RESETVAL, \
CSL_USBHC_HCPERIODICSTART_RESETVAL, \
CSL_USBHC_HCLSTHRESHOLD_RESETVAL, \
CSL_USBHC_HCRHDESCRIPTORA_RESETVAL, \
CSL_USBHC_HCRHDESCRIPTORB_RESETVAL, \
CSL_USBHC_HOSTTIMEOUTCTRL_RESETVAL \
}
/* Default Configurations */
/** Macros for Default settings of CSL_USBHC_HWCONTROLSETUP_DEFAULTS*/
/** Largest data packet :64bytes * 8 */
#define CSL_USBHC_DEFAULT_LARGESTDATAPKT 0x200
/** Frame inetrval:reset value */
#define CSL_USBHC_DEFAULT_FRAMEINTERVAL 0x2EDF
/** OCP timeout value */
#define CSL_USBHC_DEFAULT_OCPTIMEOUT FALSE
/** Remote wakeup Enable */
#define CSL_USBHC_DEFAULT_REMOTEWAKUPCONN FALSE
/** Macros for Default settings of CSL_USBHC_HWROOTHUBA_SETUP_DEFAULTS */
/** Reset Value */
#define CSL_USBHC_DEFAULT_NPS TRUE
/** Reset Value itself, OMAP1610 does not support this */
#define CSL_USBHC_DEFAULT_PSM FALSE
/** Reset Value itself, OMAP1610 does not support this */
#define CSL_USBHC_DEFAULT_NOCP TRUE
/** OMAP1610 does not support this */
#define CSL_USBHC_DEFAULT_OCPM FALSE
/** Reset Value itself */
#define CSL_USBHC_DEFAULT_POWONTOPOWGOOD 0xA
/** Macros for Default settings of CSL_USBHC_HWROOTHUBB_SETUP_DEFAULTS */
/** Reset value itself */
#define CSL_USBHC_DEFAULT_PORT_NONREMOVEABLEMASK 0x0000
/** Reset Value itself */
#define CSL_USBHC_DEFAULT_PORT_POWERCTRLMASK 0x0000
/** Default values for hwcontrol setup structure*/
#define CSL_USBHC_HWCONTROLSETUP_DEFAULTS { \
(Uint16)CSL_USBHC_DEFAULT_LARGESTDATAPKT, \
(Uint16)CSL_USBHC_DEFAULT_FRAMEINTERVAL, \
(Bool)CSL_USBHC_DEFAULT_REMOTEWAKUPCONN, \
(Bool)CSL_USBHC_DEFAULT_OCPTIMEOUT \
}
/** Default values for roothub A setup structure */
#define CSL_USBHC_HWROOTHUBA_SETUP_DEFAULTS { \
(Uint16)CSL_USBHC_DEFAULT_POWONTOPOWGOOD, \
(Bool)CSL_USBHC_DEFAULT_NPS, \
(Bool)CSL_USBHC_DEFAULT_PSM, \
(Bool)CSL_USBHC_DEFAULT_NOCP, \
(Bool)CSL_USBHC_DEFAULT_OCPM \
}
/** Default values for roothub B setup structure */
#define CSL_USBHC_HWROOTHUBB_SETUP_DEFAULTS { \
(CSL_BitMask16)CSL_USBHC_DEFAULT_PORT_NONREMOVEABLEMASK, \
(CSL_BitMask16)CSL_USBHC_DEFAULT_PORT_POWERCTRLMASK \
}
/** @brief This object contains the reference to the instance of USBHC opened
* using the @a CSL_usbhcOpen().
*
* The pointer to this, is passed to all USBHC CSL APIs.
*/
typedef struct CSL_UsbhcObj {
/** This is a pointer to the registers of the instance of USBHC
* referred to by this object
*/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?