⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 csl_dmax.h

📁 基于ti tms320c672x下音频开发例子程式
💻 H
📖 第 1 页 / 共 3 页
字号:
 *  any specific parameters.The below declaration is just a place-holder 
 *  for future implementation.
*/
typedef struct {
    /** Context information of DMAX.
     *  The below declaration is just a place-holder for future
     *  implementation.
     */
    Uint16  contextInfo;
} CSL_DmaxContext;

/** @brief This structure defines the overlay for accessing entries in the Hi
*      	   Priority Parameter Table.
*
*/
typedef struct  {
	/** Parameter Table word0 */
    volatile Uint32 word0;
	/** Parameter Table word1 */    
    volatile Uint32 word1;
	/** Parameter Table word2 */    
    volatile Uint32 word2;
	/** Parameter Table word3 */    
    volatile Uint32 word3;
	/** Parameter Table word4 */    
    volatile Uint32 word4;
	/** Parameter Table word5 */    
    volatile Uint32 word5;
	/** Parameter Table word6 */    
    volatile Uint32 word6;
 	/** Parameter Table word7 */   
    volatile Uint32 word7;
	/** Parameter Table word8 */    
    volatile Uint32 word8;
	/** Parameter Table word9 */    
    volatile Uint32 word9;
	/** Parameter Table word10 */    
    volatile Uint32 word10;
} CSL_DmaxParameterEntry;

/** @brief Config structure of DMAX. This is used to configure DMAX
 *  using CSL_HwSetupRaw function
*/

typedef struct  {
	/** Event Control */
    Uint32 					eventCtrl;
    /** DMAX parameter Entry Pointer */
    CSL_DmaxParameterEntry *paramEntry;
    /** Dmax Event Type */
    Uint8 					eventType;
    /** DMAX priority */
    Uint8  					priority;
    /** DMAX Polarity */
	Uint8  					polarity;
} CSL_DmaxConfig;

/** Default Values for Config structure */
#define CSL_DMAX_CONFIG_DEFAULTS {   \
        0x0,     \
		CSL_DMAX_EVENT0_ETYPE_FIFOWRITE, \
		0x0, \
		0x0, \
		0x0, \
		0x0, \
		0x0, \
		0x0, \
		0x0, \
		0x0, \
		0x0, \
		0x0  \
}

/**
 * @brief This data type is used to return the handle to an
 * instance of DMAX
 */

typedef struct CSL_DmaxObj *CSL_DmaxHandle;

/** @brief This has all the fields required to configure DMAX at Power Up
 *  (After a Hardware Reset) or a Soft Reset
 *
 *  This structure is used to setup or obtain existing setup of
 *  DMAX using @a CSL_dmaxHwSetup() & @a CSL_dmaxGetHwSetup() functions
 *  respectively.
 */
typedef struct CSL_DmaxHwSetup {
	/** DMAX Priority */
    Uint8 priority;
    /** DMAX Polarity */
    Uint8 polarity;
    /** Generic Pointer for setup */
    CSL_DmaxEventSetup eventSetup;
}CSL_DmaxHwSetup;

/** 
 * @brief This structure is used to setup the Event Type
 */
typedef struct {
	/** Event Type */
	Uint32 etype;
} CSL_DmaxEtype;

/** @brief Enumeration for queries passed to @a CSL_dmaxGetHwStatus()
 *
 * This is used to get the status of different operations or to get the
 * existing setup of DMAX.
 */
typedef enum {
      /**
       * @brief   Get status of the Event Flag.
       * @param   ( )
       */
       CSL_DMAX_QUERY_EVENTFLAG = 1,
      /**
       * @brief   Get the status of the Transfer Complete flag.
       * @param   ( )
       */
       CSL_DMAX_QUERY_GET_TCC = 2,
      /**
       * @brief   Get the status of TC.
       * @param   ( )
       */
       CSL_DMAX_QUERY_GET_TC = 3,
      /**
       * @brief   Get the status of FIFO full.
       * @param   ( )
       */
       CSL_DMAX_QUERY_GET_FMSC = 4,
      /**
       * @brief   Get the status of FIFO empty.
       * @param   ( )
       */
       CSL_DMAX_QUERY_GET_EMSC = 5,
      /**
       * @brief   Get the status of the FIFO error Flag/Interrupt.
       * @param   ( )
       */
       CSL_DMAX_QUERY_GET_FIFO_ERROR = 6,
      /**
       * @brief   Get the status of the FIFO error Code.
       * @param   ( )
       */
       CSL_DMAX_QUERY_GET_FIFO_ERROR_CODE = 7,
      /**
       * @brief   Get the status of the Event entry of the specified Event.
       * @param   ( )
       */
       CSL_DMAX_QUERY_GET_EVENT_ENTRY = 8,
      /**
       * @brief   Get the status of the parameter entry of the specified Event.
       * @param   ( )
       */
       CSL_DMAX_QUERY_GET_PARAMETER_ENTRY = 9,
      /**
       * @brief   Get the status of the High dmax.
       * @param   ( )
       */
       CSL_DMAX_QUERY_GET_HBC = 10,
      /**
       * @brief   Get the status of the Low dmax.
       * @param   ( )
       */
       CSL_DMAX_QUERY_GET_LBC = 11,
      /**
       * @brief   Get the status of the FIFO Address.
       * @param   ( )
       */
       CSL_DMAX_QUERY_GET_FIFO_ADDR = 12,
      /**
       * @brief   Get the Event entry Address.
       * @param   ( )
       */
       CSL_DMAX_QUERY_GET_EVENT_ENTRY_ADDR = 13,
      /**
       * @brief   Get the Parameter entry Address.
       * @param   ( )
       */
       CSL_DMAX_QUERY_GET_PARAMETER_ENTRY_ADDR = 14,
      /**
       * @brief   Get the FIFO full status.
       * @param   ( )
       */
       CSL_DMAX_QUERY_GET_FIFO_FULL = 15
      
} CSL_DmaxHwStatusQuery;


/** @brief Enumeration for queries passed to @a CSL_dmaxHwControl()
 *
 * This is used to select the commands to control the operations
 * existing setup of DMAX. The arguments to be passed with each
 * enumeration if any are specified next to the enumeration.
 */
 typedef enum {
      /**
       * @brief   Set Priority of Event.
       * @param   (None)
       */
       CSL_DMAX_CMD_SETPRIORITY = 1,
      /**
       * @brief   Sets Polarity of Event.
       * @param   (None)
       */
       CSL_DMAX_CMD_SETPOLARITY = 2,
      /**
       * @brief   Enables Event.
       * @param   (None)
       */
       CSL_DMAX_CMD_EVENTENABLE = 3,

      /**
       * @brief   Clears TCC Event flag.
       * @param   (None)
       */
       CSL_DMAX_CMD_CLEARTCC = 4,

      /**
       * @brief   Disables Event.
       * @param   (None)
       */
       CSL_DMAX_CMD_EVENTDISABLE = 5,

      /**
       * @brief   Clears the Event Entry.
       * @param   (Uint16 *)
       */
       CSL_DMAX_CMD_CLEAREVENTENTRY = 6,

      /**
       * @brief   Clears Parameter Entry.
       * @param   (Uint16 *)
       */
       CSL_DMAX_CMD_CLEARPARAMENTRY = 7,

      /**
       * @brief   Set the start Sync Transfer.
       * @param   (None)
       */
       CSL_DMAX_CMD_STARTASYNCTRANSFER = 8,

      /**
       * @brief   Set the FIFO status clear bit.
       * @param   (None)
       */
       CSL_DMAX_CMD_CLEARFIFOSTATUS = 9,

      /**
       * @brief   Set the Water Mark Enable.
       * @param   (None)
       */
       CSL_DMAX_CMD_WATERMARK_ENABLE = 10,

      /**
       * @brief   Set the Water Mark Disable.
       * @param   (None)
       */
       CSL_DMAX_CMD_WATERMARK_DISABLE = 11

} CSL_DmaxHwControlCmd;

/**************************************************************************\
* DMAX global function declarations
\**************************************************************************/

/*
 * =============================================================================
 *   @func CSL_dmaxInit
 *
 *   @desc
 *        This function is idempotent in that calling it many times is same as
 *        calling it once. This function initializes the DMAX CSL data structures.
 *
 *   @arg pContext
 *        Context information for DMAX
 *
 *   @ret CSL_Status
 *        CSL_SOK - Always returns
 *
 *   @eg
 *     CSL_dmaxInit (NULL);
 * =============================================================================
 */
CSL_Status  CSL_dmaxInit(
    CSL_DmaxContext * pContext
);


/*
 *============================================================================
 *   @func CSL_dmaxOpen
 *
 *   @desc
 *        This function populates the peripheral data object for the instance
 *        and returns a handle to the instance.
 *        The open call sets up the data structures for the particular instance
 *        of DMAX device. The device can be re-opened anytime after it has been
 *        normally closed if so required. DMAX Hardware setup will be performed
 *        at the end of the open call only if the HwSetup Pointer supplied was
 *        non- NULL. The handle returned by this call is input as an essential
 *        argument for rest of the APIs described for this module.
 *
 *   @arg pDmaxObj
 *        Pointer to the DMAX instance object
 *
 *   @arg dmaxNum
 *        Instance of the DMAX to be opened.
 *
 *   @arg pDmaxParam
 *        Pointer to module specific parameters
 *
 *   @arg pStatus
 *        pointer for returning status of the function call
 *
 *   @ret CSL_DmaxHandle
 *        Valid DMAX instance handle will be returned if status value is
 *        equal to CSL_SOK.
 *
 *   @eg
 *        CSL_status        status;
 *        CSL_DmaxObj       dmaxObj;
 *        CSL_DmaxHandle     hDmax;
 *
 *        hDmax = CSL_DmaxOpen (&dmaxObj,
 *                            CSL_DMAX_PER_CNT,
 *                            NULL,
 *                            &status
 *                            );
 *
 * ===========================================================================
 */
CSL_DmaxHandle CSL_dmaxOpen (
    /** Pointer to the object that holds reference to the
     *  instance of DMAX requested after the call
     */
    CSL_DmaxObj              *hDmaxObj,
    /** Instance of DMAX to which a handle is requested
     */
    CSL_InstNum              dmaxNum,
    /** Specifies if DMAx should be opened with exclusive or
     *  shared access to the associate pins
     */
    CSL_DmaxParam            *pDmaxParam,
    /** This returns the status (success/errors) of the call
     */
    CSL_Status              *status
);


/*
 * =============================================================================
 *   @func CSL_dmaxClose
 *
 *   @b Description
 *   @n This function closes the specified instance of DMAX.
 *
 *   @arg  hDmax
           Handle to the DMAX instance
 *
 *   @ret CSL_Status
 *         CSL_SOK            - Close successful
 *         CSL_ESYS_BADHANDLE - Invalid handle
 *
 *   @eg
 *     CSL_dmaxClose (hDmax);
 * =============================================================================
 */
CSL_Status  CSL_dmaxClose(
    /** Pointer to the object that holds reference to the
     *  instance of DMAX requested after the call
     */
    CSL_DmaxHandle                         hDmax
);


/** 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.
 *  After the Setup is completed, the serial device is ready for data transfer.
 *  For information passed through the HwSetup Data structure refer
 *  @a CSL_DmaxHwSetup.
 *
 *  <b> Usage Constraints: </b>
 *  Both @a CSL_dmaxInit() and @a CSL_dmaxOpen() must be called
 *  successfully in that order before this function 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_DmaxHandle hDmax;
     CSL_DmaxHwSetup hwSetup = CSL_DMAX_HWSETUP_DEFAULTS;
     CSL_dmaxHwSetup(hDmax, &hwSetup);
  @endverbatim
 *
 * @return Returns the status of the setup operation
 *
 */
CSL_Status  CSL_dmaxHwSetup(
    /** Pointer to the object that holds reference to the
     *  instance of DMAX requested after the call
     */
    CSL_DmaxHandle                         hDmax,
    /** Pointer to setup structure which contains the
     *  information to program DMAX to a useful state
     */
    CSL_DmaxHwSetup                        *setup
);

/** This function gets the current setup of the DMAX. The status is
 *  returned through @a CSL_DmaxHwSetup. The obtaining of status
 *  is the reverse operation of @a CSL_dmaxHwSetup() function.
 *
 *  <b> Usage Constraints: </b>
 *  Both @a CSL_dmaxInit() and @a CSL_dmaxOpen() must be called successfully
 *  in that order before @a CSL_dmaxGetHwSetup() can be called.
 *
 * @b Example:
 * @verbatim
      CSL_DmaxHandle hDmax;
      CSL_Status status;
      CSL_DmaxHwSetup *mysetup;
       ...
      status = CSL_dmaxGetHwSetup(hDmax, &mysetup);
   @endverbatim
 *
 * @return returns the status of the operation (see @a CSL_Status)
 *
 */
CSL_Status  CSL_dmaxGetHwSetup(
    /** Pointer to the object that holds reference to the
     *  instance of DMAX requested after the call
     */
    CSL_DmaxHandle                         hDmax,
    /** Pointer to setup structure which contains the
     *  information to program DMAX to a useful state
     */
    CSL_DmaxHwSetup                        *setup
);


/** Control operations for the DMAX.  For a particular control operation, the

⌨️ 快捷键说明

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