csl_gpio.h

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

H
518
字号
/** @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 GPIO
 * module.
 *
 *  Note: As GPIO 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_gpioInit(NULL)) {
       return;
   }
   @endverbatim
 *
 * @return returns the status of the operation
 *
 */

CSL_Status CSL_gpioInit(
	/** GPIO specific context information
	 */
	CSL_GpioContext * pContext
	);

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

	  CSL_GpioObj     gpioObj;
	  CSL_Status       status;
 		...
	  hGpio = CSL_gpioOpen(&gpioObj,
                          CSL_GPIO_1,
                          NULL,
                          &status);
   @endverbatim
 *
 * @return returns a handle @a CSL_GpioHandle to the requested instance of
 * GPIO if the call is successful, otherwise, a @a NULL is returned.
 *
 */
CSL_GpioHandle CSL_gpioOpen (
    /** Pointer to the object that holds reference to the
     *  instance of GPIO requested after the call
     */
    CSL_GpioObj*		    pGpioObj,
    /** Instance of GPIO to which a handle is requested
     */
    CSL_InstNum              gpioNum,
    /** Module specific parameters;
     * Currently there are none; the user should pass 'NULL'
     */
    CSL_GpioParam          *pGpioParam,
    /** 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_gpioInit() and @a CSL_gpioOpen() must be called successfully
 * in that order before @a CSL_gpioClose() can be called.
 *
 * @b Example:
 * @verbatim


   CSL_GpioHandle hGpio;
   ...
   CSL_gpioClose(hGpio);
   @endverbatim
 *
 * @return returns the status of the operation (see @a CSL_Status)
 *
 */
CSL_Status  CSL_gpioClose(
    /** Pointer to the object that holds reference to the
     *  instance of GPIO requested after the call
	 */
    CSL_GpioHandle                         hGpio
);

/** 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_GpioConfig.
 *
 *  <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_GpioHandle hGpio;
     CSL_GpioConfig config;
     config.EPNUM = 0x1234;
     config.CTRL = 0x0078;
     ....
     ....
     ....
     CSL_gpioHwSetupRaw(hGpio, &config);
  @endverbatim
 *
 * @return Returns the status of the setup operation
 *
 */

 CSL_Status  CSL_gpioHwSetupRaw(
    CSL_GpioHandle     hGpio,
    CSL_GpioConfig *   setup
);

/** Control operations for the GPIO.  For a particular control operation, the
 *  pointer to the corresponding data type needs to be passed as argument 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_GpioHwControlCmd.
 *
 *  <b> Usage Constraints: </b>
 *  Both @a CSL_gpioInit() and @a CSL_gpioOpen() must be called successfully
 *  in that order before @a CSL_gpioHwControl() can be called. For the
 *  argument type that can be @a void* casted & passed with a particular command
 *  refer to @a CSL_GpioHwControlCmd
 *
 * @b Example:
 * @verbatim
       CSL_GpioHandle hGpio;
       CSL_Status status;
       ...
       status = CSL_gpioHwControl(hGpio,
                                    CSL_GPIO_CMD_RESET,
                                   NULL);
   @endverbatim
 *
 *  @return returns the status of the operation (see @a CSL_Status)
 *
 */
CSL_Status  CSL_gpioHwControl(
    /** Pointer to the object that holds reference to the
     *  instance of GPIO requested after the call
	 */
    CSL_GpioHandle                         hGpio,
    /** The command to this API indicates the action to be taken
	 */
    CSL_GpioHwControlCmd                   cmd,
    /** An optional argument @a void* casted
	 */
    void                                     *arg
	);

/** This function is used to read the current device configuration, status flags
 *  and the value present associated registers. Following table details the various
 *  status queries supported and the associated data structure to record the response.
 *  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_GpioHwStatusQuery
 *
 *  <b> Usage Constraints: </b>
 *  Both @a CSL_gpioInit() and @a CSL_gpioOpen() must be called successfully
 *  in that order before @a CSL_gpioGetHwStatus() can be called. For the
 *  argument type that can be @a void* casted & passed with a particular command
 *  refer to @a CSL_GpioHwStatusQuery
 *
 * @b Example:
 * @verbatim
	  CSL_GpioHandle hGpio;
	  CSL_Status status;
	  CSL_GpioResetStatus response;
	   ...
	  status = CSL_gpioGetHwStatus(hGpio,
                           CSL_GPIO_QUERY_RESET_STATUS,
                                  &response);
   @endverbatim
 *
 * @return Returns the status of the operation (see @a CSL_Status)
 *
 */
CSL_Status  CSL_gpioGetHwStatus(
    /** Pointer to the object that holds reference to the
     *  instance of GPIO requested after the call
	 */
    CSL_GpioHandle                         hGpio,
    /** The query to this API which indicates the status
     *  to be returned
	 */
    CSL_GpioHwStatusQuery                  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_gpioOpen()
 *  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_GpioBaseAddress   baseAddress;

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

CSL_Status CSL_gpioGetBaseAddress(
        /** Instance number
         */
        CSL_InstNum  		gpioNum,
        /** Module specific parameters
         */
        CSL_GpioParam *		pGpioParam,
        /** Base address details
         */
        CSL_GpioBaseAddress *	pBaseAddress
);


#ifdef __cplusplus
}
#endif


#endif

⌨️ 快捷键说明

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