csl_usbf.h

来自「dsp在音频处理中的运用」· C头文件 代码 · 共 1,251 行 · 第 1/4 页

H
1,251
字号
    CSL_usbfInit (
	/** Pointer to module-context;  allocated by the user
	 */ 	    
        CSL_UsbfContext * pContext  
);

/** @brief Opens the instance of USBF requested.
 *
 *  The open call sets up the data structures for the particular instance of
 *  USBF 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>
 *  USBF must be successfully initialized via @a CSL_usbfInit() before calling
 *  this function. Memory for the @a CSL_usbfObj must be allocated outside
 *  this call. This object must be retained while usage of this peripheral.
 *
 *  @b Example:
 *  @verbatim

	  CSL_UsbfObj     usbfObj;
	  CSL_Status       status;
 		...
	  hUsbf = CSL_usbfOpen(&usbfObj,
                          CSL_USBF_1,
                          NULL,
                          &status);
   @endverbatim
 *
 * @return returns a handle @a CSL_UsbfHandle to the requested instance of
 * USBF if the call is successful, otherwise, a @a NULL is returned.
 *
 */
CSL_UsbfHandle CSL_usbfOpen (
    /** Pointer to the object that holds reference to the
     *  instance of USBF requested after the call
     */
    CSL_UsbfObj*		    pUsbfObj,
    /** Instance of USBF to which a handle is requested
     */
    CSL_InstNum              usbfNum,
    /** Module specific parameters;
     * Currently there are none; the user should pass 'NULL'
     */
    CSL_UsbfParam          *pUsbfParam,
    /** This returns the status (success/errors) of the call.
     * Could be 'NULL' if the user does not want status information.
     */
    CSL_Status              *pStatus
	);
/**
 *  The Close call releases the resource and appropriate shared pins.
 *
 *  <b> Usage Constraints: </b>
 *  Both @a CSL_usbfInit() and @a CSL_usbfOpen() must be called successfully
 *  in that order before CSL_usbfClose() can be called.
 *
 *  @b Example:
 *  @verbatim

      CSL_UsbfHandle hUsbf;
      ...
      CSL_usbfClose(hUsbf);
    @endverbatim
 *
 * @return returns the status of the operation (see @a CSL_Status)
 *
 */
CSL_Status  CSL_usbfClose(
    /** Pointer to the object that holds reference to the
     *  instance of USBF requested after the call
	 */
    CSL_UsbfHandle                         hUsbf
	);

/**
 * This function initializes the device registers with
 * the appropriate values provided through the HwSetup Data structure.
 * This function needs to be called only if the HwSetup Structure was
 * not previously passed through the Open call.
 * For information passed through the HwSetup Data structure refer
 * @a CSL_UsbfHwSetup.
 *
 * <b> Usage Constraints:</b>
 * Both @a CSL_usbfInit() and @a CSL_usbfOpen() must be called successfully
 * in that order before CSL_usbfHwSetup() can be called. The user has to
 * allocate space for & fill in the main setup structure appropriately before
 * calling this function
 *
 * @b Example:
 * @verbatim


     CSL_UsbfHandle hUsbf;
     CSL_Status status;
     CSL_UsbfHwSetup hwSetup = CSL_USBF_HWSETUP_DEFAULTS;
     status = CSL_usbfHwSetup(hUsbf, &hwSetup);
   @endverbatim
 *
 * @return Returns the status of the setup operation
 *
 */

CSL_Status  CSL_usbfHwSetup(
    /** Pointer to the object that holds reference to the
     *  instance of USBF requested after the call
	 */
    CSL_UsbfHandle                         hUsbf,
    /** Pointer to setup structure which contains the
     *  information to program USBF to a useful state
	 */
    CSL_UsbfHwSetup                        *setup
	);

/** This function initializes the device registers with the register-values
 *  provided through the Config Data structure.  For information passed through
 *  the Config Data structure refer to @a CSL_UsbfConfig.
 *
 *  <b> Usage Constraints: </b>
 *  The user has to allocate space for & fill in the main setup structure
 *  appropriately before calling this function.
 *
 * @b Example:
 * @verbatim
     CSL_UsbfHandle hUsbf;
     CSL_UsbfConfig config;
     config.EPNUM = 0x1234;
     config.CTRL = 0x0078;
     ....
     ....
     ....
     CSL_usbfHwSetupRaw(hUsbf, &config);
  @endverbatim
 *
 * @return Returns the status of the setup operation
 *
 */

 CSL_Status  CSL_usbfHwSetupRaw(
    CSL_UsbfHandle     hUsbf,
    CSL_UsbfConfig *   setup
);

	
/**
 * This function gets the current setup of the USBF.
 * The setup is returned through @a CSL_UsbfHwSetup. The obtaining
 * of status is the reverse operation of @a CSL_usbfHwSetup() function.
 *
 * <b> Usage Constraints: </b>
 * Both @a CSL_usbfInit() and @a CSL_usbfOpen() must be called successfully
 * in that order before @a CSL_usbfGetHwSetup() can be called.
 *
 * @b Example:
 * @verbatim

     CSL_UsbfHandle hUsbf;
     CSL_Status status;
     CSL_UsbfHwSetup *mysetup;
      ...
     status = CSL_usbfGetHwSetup(hUsbf, &mysetup);
   @endverbatim
 *
 * @return returns the status of operation.
 *
 */
CSL_Status  CSL_usbfGetHwSetup(
    /** Pointer to the object that holds reference to the
     *  instance of USBF requested after the call
     */
    CSL_UsbfHandle                         hUsbf,
    /** Pointer to setup structure which contains the
     *  information to program USBF to a useful state
     */
    CSL_UsbfHwSetup                        *setup
	);

/*
 *  Control operations for the USBF. For a particular control
 *  operation, the pointer to the corresponding data type needs
 *  to be passed as argument in HwControl function Call. All the
 *  arguments (Structure elements included) passed to  the HwControl
 *  function are inputs. For the list of commands supported and argument
 *  type that can be @a void* casted & passed with a particular command
 *  refer to @a CSL_UsbfHwControlCmd
 *
 *	<b> Usage Constraints:</b>
 *  Both @a CSL_usbfInit() and @a CSL_usbfOpen() must be called successfully
 *  in that order before CSL_usbfHwControl() can be called. For the
 *  argument type that can be @a void* casted & passed with a particular command
 *  refer to @a CSL_UsbfHwControlCmd
 *
 *  @b Example:
 *  @verbatim
      Code snippet to disconnect device from USB bus

      CSL_UsbfHandle hUsbf;
      CSL_Status status;
      ...
      status = CSL_usbfHwControl(hUsbf,
                                   CSL_USBF_CMD_DISCONNECT_DEVICE,
                                   NULL);
    @endverbatim
 *
 * @return Returns the status of the operation
 *
 */
CSL_Status  CSL_usbfHwControl(
    /** Pointer to the object that holds reference to the
     *  instance of USBF requested after the call
	 */
    CSL_UsbfHandle                         hUsbf,
    /** The command to this API, which indicates the action to be taken
	 */
    CSL_UsbfHwControlCmd                     cmd,
    /** An optional argument @a void* casted
	 */
    void                                     *arg
	);

/**
 *  This function is used to read the current device configuration
 *  and the value present in associated registers. User should allocate
 *  memory for the said data type and pass its pointer as an unadorned
 *  void* argument to the status query call. For details about the various
 *  status queries supported and the associated data structure to record the
 *  response, refer to @a CSL_UsbfHwStatusQuery.
 *
 *  <b> Usage Constraints: </b>
 *  Both @a CSL_usbfInit() and @a CSL_usbfOpen() must be called successfully
 *  in that order before @a CSL_usbfGetHwStatus() can be called. For the
 *  argument type that can be void* casted & passed with a particular command,
 *  refer to @a CSL_UsbfHwStatusQuery
 *
 *  @b Example:
 *  @verbatim
     Code snippet to get __irq source
      
     CSL_UsbfHandle hUsbf;
     CSL_Status status;
     CSL_UsbfIntSrc  interruptSource ;
     CSL_UsbfStatus *usbfStatus ;
     usbfStatus->intSrc =  &interruptSource ;
     ...
     
     status = CSL_usbfGetHwStatus(hUsbf,
                                  CSL_USBF_QUERY_STATUS,
                                  usbfStatus);
   @endverbatim
 *
 *  @return Returns the status of the operation
 */
CSL_Status  CSL_usbfGetHwStatus(
    /** Pointer to the object that holds reference to the
     *  instance of USBF requested after the call
	 */
    CSL_UsbfHandle                         hUsbf,
    /** The query to this API, which indicates the status
     *  to be returned
	 */
    CSL_UsbfHwStatusQuery                  query,
    /** 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_usbfOpen()
 *  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_UsbfBaseAddress   baseAddress;

       ...
      status = CSL_usbfGetBaseAddress(CSL_UART_1, NULL, &baseAddress);
   @endverbatim
 *
 * @return Returns the status of the operation (see @a CSL_Status)
 *
 */

CSL_Status CSL_usbfGetBaseAddress(
        /** Instance number
         */
        CSL_InstNum  		usbfNum,
        /** Module specific parameters
         */
        CSL_UsbfParam *		pUsbfParam,
        /** Base address details
         */
        CSL_UsbfBaseAddress *	pBaseAddress
);

#ifdef __cplusplus
}
#endif

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?