📄 csl_usbotg.h
字号:
typedef struct {
volatile Uint32 OTG_SYSCON_1; /**< OTG_SYSCON_1 register **/
volatile Uint32 OTG_SYSCON_2; /**< OTG_SYSCON_2 register **/
volatile Uint32 OTG_CTRL; /**< OTG_CTRL register **/
volatile Uint32 OTG_IRQ_EN; /**< OTG_IRQ_EN register **/
volatile Uint32 OTG_IRQ_SRC; /**< OTG_IRQ_SRC register **/
volatile Uint32 OTG_OUTCTRL; /**< OTG_OUTCTRL register **/
volatile Uint32 OTG_TEST; /**< OTG_TEST register **/
}CSL_UsbotgConfig;
/**
* Default values for the config-structure
*/
#define CSL_USBOTG_CONFIG_DEFAULTS { \
CSL_USBOTG_OTG_SYSCON_1_RESETVAL, \
CSL_USBOTG_OTG_SYSCON_2_RESETVAL, \
CSL_USBOTG_OTG_CTRL_RESETVAL, \
CSL_USBOTG_OTG_IRQ_EN_RESETVAL, \
CSL_USBOTG_OTG_IRQ_SRC_RESETVAL, \
CSL_USBOTG_OTG_OUTCTRL_RESETVAL, \
CSL_USBOTG_OTG_TEST_RESETVAL \
}
/** @brief This object contains the reference to the instance of USBOTG opened
* using the @a CSL_usbotgOpen().
*
* The pointer to this, is passed to all USBOTG CSL APIs.
*/
typedef struct CSL_UsbotgObj {
/** This is a pointer to the registers of the instance of USBOTG
* referred to by this object
*/
CSL_UsbotgRegsOvly regs;
/** This is the instance of USBOTG being referred to by this object */
CSL_InstNum perNum;
} CSL_UsbotgObj;
typedef struct CSL_UsbotgObj *CSL_UsbotgHandle;
/** @brief This will have the base-address information for the peripheral
* instance
*/
typedef struct {
/** Base-address of the Configuration registers of the peripheral
*/
CSL_UsbotgRegsOvly regs;
} CSL_UsbotgBaseAddress;
/** @brief Module specific parameters. Present implementation doesn't have
* any module specific parameters.
*/
typedef struct{
/** Bit mask to be used for module specific parameters.
* The below declaration is just a place-holder for future
* implementation.
*/
CSL_BitMask16 flags;
} CSL_UsbotgParam;
/** @brief Module specific context information. Present implementation doesn't have
* any Context information.
*/
typedef struct {
/** Context information of USBOTG.
* The below declaration is just a place-holder for future
* implementation.
*/
Uint16 contextInfo;
} CSL_UsbotgContext;
/** @brief Opens the instance of USBOTG requested.
*
* The open call sets up the data structures for the particular instance of
* USBOTG device. The device can be re-opened anytime after it has been normally
* closed if so required. The handle returned by this call is input as an
* essential argument for rest of the APIs described for this module.
*
* <b> Usage Constraints: </b>
* USBOTG must be successfully initialized via @a CSL_usbotgInit() before calling
* this function. Memory for the @a CSL_usbotgObj must be allocated outside
* this call. This object must be retained while usage of this peripheral.
*
* @b Example:
* @verbatim
CSL_UsbotgObj usbotgObj;
CSL_Status status;
...
hUsbotg = CSL_usbotgOpen(&usbotgObj,
CSL_USBOTG_1,
NULL,
&status);
@endverbatim
*
* @return returns a handle @a CSL_UsbotgHandle to the requested instance of
* USBOTG if the call is successful, otherwise, a @a NULL is returned.
*
*/
CSL_UsbotgHandle CSL_usbotgOpen (
/** Pointer to the object that holds reference to the
* instance of USBOTG requested after the call
*/
CSL_UsbotgObj* pUsbotgObj,
/** Instance of USBOTG to which a handle is requested
*/
CSL_InstNum usbotgNum,
/** Module specific parameters;
* Currently there are none; the user should pass 'NULL'
*/
CSL_UsbotgParam *pUsbotgParam,
/** This returns the status (success/errors) of the call.
* Could be 'NULL' if the user does not want status information.
*/
CSL_Status *pStatus
);
/** @brief Closes the instance of USBOTG requested */
CSL_Status CSL_usbotgClose
(
/** Pointer to the object that holds reference to the
* instance of USBOTG requested after the call */
CSL_UsbotgHandle hUsbotg
);
/** @brief Programs the USBOTG with the setup configuration as specified in the arguments */
CSL_Status CSL_usbotgHwSetup
(
/** Pointer to the object that holds reference to the
* instance of USBOTG requested after the call */
CSL_UsbotgHandle hUsbotg,
/** Pointer to setup structure which contains the
* information to program USBOTG to a useful state
* IMPORTANT: The "ctrlFlag" field must be passed appropriately by
* software after reading the transceiver status.
* If not the behavior of the module is unpredictable.
*/
CSL_UsbotgHwSetup *setup
);
/** @brief Controls the different operations that can be performed by USBOTG
*/
CSL_Status CSL_usbotgHwControl
(
/** Pointer to the object that holds reference to the
* instance of USBOTG requested after the call */
CSL_UsbotgHandle hUsbotg,
/** The command to this API which indicates the action to be taken */
CSL_UsbotgHwControlCmd cmd,
/** Optional argument @a void* casted */
void *cmdArg
);
/** @brief Peripheral specific initialization function.
*
* This is the peripheral specific intialization function. This function is
* idempotent in that calling it many times is same as calling it once.
* This function initializes the CSL data structures, and doesn't touches
* the hardware.
*
* <b> Usage Constraints: </b>
* This function should be called before using any of the CSL APIs in the USBOTG
* module.
*
* Note: As USBOTG doesn't have any context based information, currently, the function
* just returns CSL_SOK. User is expected to pass NULL in the function call.
*
* @b Example:
* @verbatim
...
if (CSL_SOK != CSL_usbotgInit(NULL)) {
return;
}
@endverbatim
*
* @return returns the status of the operation
*
*/
CSL_Status CSL_usbotgInit(
/** USBOTG specific context information
*/
CSL_UsbotgContext * pContext
);
/** @brief Returns the status of the requested operation/parameter of USBOTG */
CSL_Status CSL_usbotgGetHwStatus
(
/** Pointer to the object that holds reference to the
* instance of USBOTG requested after the call */
CSL_UsbotgHandle hUsbotg,
/** The query to this API which indicates the status/setup
* to be returned */
CSL_UsbotgHwStatusQuery myQuery,
/** Placeholder to return the status; @a void* casted */
void *response
);
/** @brief Function to get the Base-address of the peripheral instance.
*
* This function is used for getting the base-address of the peripheral
* instance. This function will be called inside the @ CSL_usbotgOpen()
* function call.
*
* Note: This function is open for re-implementing if the user wants to modify
* the base address of the peripheral object to point to a different
* location and there by allow CSL initiated write/reads into peripheral
* MMR's go to an alternate location. Please refer the documentation for
* more details.
*
* @b Example:
* @verbatim
CSL_Status status;
CSL_UsbotgBaseAddress baseAddress;
...
status = CSL_usbotgGetBaseAddress(CSL_UART_1, NULL, &baseAddress);
@endverbatim
*
* @return Returns the status of the operation (see @a CSL_Status)
*
*/
CSL_Status CSL_usbotgGetBaseAddress(
/** Instance number
*/
CSL_InstNum usbotgNum,
/** Module specific parameters
*/
CSL_UsbotgParam * pUsbotgParam,
/** Base address details
*/
CSL_UsbotgBaseAddress * pBaseAddress
);
/*
* ============================================================================
* @func CSL_usbotgHwSetupRaw
* @desc
* Configures a USBOTG instance using the register values specified in config
* structure.The function will return an error if it cannot complete
* the request.
*
* @arg hUsbotg
* Handle to the USBOGT instance
* @arg config
* Pointer to USBOTG's config structure
* @ret CSL_Status
* CSL_SOK : Successful, desired operation is done.
* CSL_ESYS_INVPARAMS : Parameters passed is NULL.
* @eg
* status = CSL_usbotgHwSetupRaw (hUsbotg, &usbotgConfig);
*
* ============================================================================
*/
CSL_Status CSL_usbotgHwSetupRaw(
CSL_UsbotgHandle hUsbotg,
CSL_UsbotgConfig * setup
);
/*
* ============================================================================
* @func CSL_usbotgGetHwSetup
* @desc
* Retrieves USBOTG instance's current register field value configuration.
* The function will return an error if cannot complete the request
*
* @arg hUsbotg
* Handle to the USBOTG instance
* @arg hwSetup
* Pointer to place holder for the USBOTG
* hwsetup structure
* @ret CSL_Status
* CSL_SOK : Successful, desired operation is done.
* CSL_ESYS_INVPARAMS : Parameters passed is NULL.
* @eg
* status = CSL_usbotgGetHwSetup (hUsbotg, &usbotgHwSetup);
*
* ============================================================================
*/
CSL_Status CSL_usbotgGetHwSetup(
CSL_UsbotgHandle hUsbotg,
CSL_UsbotgHwSetup *hwSetup
);
#ifdef __cplusplus
}
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -