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

📄 t8422_fn.h

📁 F2833x / F2823x C/C++ Header Files and Peripheral Examples.It is very useful.
💻 H
字号:
/*{{TIDC_Wizard Auto Code Start                                 */
/****************************************************************/
/* don't change anything here until you know what you are doing!*/
/* the plug-in will change all text between the code marks      */
/* without user interaction!                                    */
/*                                                              */
/****************************************************************/

/****************************************************************/
/* software generated by Data Converter Plug-in (DCP)           */
/* based on <C:\CCSTUD~1.1\PLUGINS\AAP_DEV\c6000\d8401_62.h> */
/****************************************************************/
/****************************************************************/
/* ADS8422 Interface Software Version 2.0 for the TMS320C6700   */
/* Copyright (C) 2004- 2006 Texas Instruments Incorporated      */
/* All Rights Reserved                                          */
/*--------------------------------------------------------------*/
/* $Revision: 10 $                         $JustDate:  7/12/06 $ */
/* $Author: A0746714 $                                          */
/****************************************************************/
#ifndef __T8422_FN_H
#define __T8422_FN_H


#define __CSL_AVAILABLE
#include "tidc_api.h"


#include <csl.h>
#include <csl_edma.h>
#include <csl_timer.h>


/****************************************************************/
/* #defines used in the code                                    */
/****************************************************************/
#define ADS8422_BUFOBJECT_FREE     (0x00000000u)
#define ADS8422_BUFOBJECT_INUSE    (0x00000001u)
#define ADS8422_BUFOBJECT_COMPLETE (0x00000002u)


/****************************************************************/
/* DEFINITIONS FOR THE DMA CHANNEL REGISTERS                    */
/****************************************************************/
/****************************************************************/
/* define for the channel options parameter register OPT        */
/* operating mode: Input                                        */
/* Value: 0x2830 0002                                           */
/* 0010 1000 0011 0000 0000 0000 0000 0010                      */
/* |||| |||| |||| |||| |||| |||| |||| ||||                      */
/* |||| |||| |||| |||| |||| |||| |||| |||+- FS (no)             */
/* |||| |||| |||| |||| |||| |||| |||| ||+-- LINK (yes)          */
/* |||| |||| |||| |||| ++++ ++++ ++++ ++--- RESERVED            */
/* |||| |||| |||| ++++--------------------- TCC (set by funct)  */
/* |||| |||| |||+-------------------------- TCINT (yes)         */
/* |||| |||| |++--------------------------- DUM (increment)     */
/* |||| |||| +----------------------------- 2DD (no)            */
/* |||| ||++------------------------------- SUM (none)          */
/* |||| |+--------------------------------- 2DS (no)            */
/* |||+-+---------------------------------- ESIZE (16-bit)      */
/* +++------------------------------------- PRI (high)          */
/****************************************************************/
#define ADS8422_EDMAOPT_INPUT_VALUE (0x28300002)


/****************************************************************/
/* define for the channel tranfer count parameter register CNT  */
/* Value: 0x00000000                                            */
/* 0000 0000 0000 0000 0000 0000 0000 0000                      */
/* |||| |||| |||| |||| |||| |||| |||| ||||                      */
/* |||| |||| |||| |||| ++++-++++-++++-++++- ELENCT (by funct)   */
/* ++++-++++-++++-++++--------------------- FRMCNT (0)          */
/****************************************************************/
#define ADS8422_EDMACNT_VALUE_PP (0x00000000)


/****************************************************************/
/** \struct TADS8422BUFOBJ
 *  Definition of the buffer object used for double buffering.
 *  This structure is used in the TADS8422 data converter
 *  object.                                                     */
/****************************************************************/
typedef struct
{
/** \var *ptrCallBack
 *  This is the pointer to the callback function, which will be
 *  called once the transfer is complete. Each submitted transfer
 *  can have its own callback function.                         */
/** \var *usBufPtr
 *  Pointer to the buffer, which is used for the transfer (either
 *  read or write). It is the task of the application to allocate
 *  the buffer itself.                                          */
/** \var uiBufSize
 *  This variable holds the number of samples to transfer. No
 *  verification is performed that the number of samples will fit
 *  into the buffer.                                            */
/** \var uiStatus
 *  Signals the status of the buffer. The following values are
 *  possible:
 *      - ADS8422_BUFOBJECT_FREE: Object is not in use
 *      - ADS8422_BUFOBJECT_INUSE: Object is in use, i.e. the
 *        transfer was submitted
 *      - ADS8422_BUFOBJECT_COMPLETE: Object is complete, i.e. the
 *        buffer has been completely transferred. This state is
 *        only available during the interrupt service routine and
 *        the callback function. The ISR will reset this flag to
 *        ADS8422_BUFOBJECT_FREE, as soon as the callback function
 *        returns.                                              */
/****************************************************************/
    void                   (*ptrCallBack)(void *);
    unsigned short         *usBufPtr;
    unsigned int           uiBufSize;
    volatile unsigned int  uiStatus;
} TADS8422BUFOBJ;


/****************************************************************/
/** \struct TADS8422
 *  Definition of the data converter object. This is the main
 *  object to work with.                                        */
/****************************************************************/
typedef struct
{
/** \var f
 *   Structure for the API function pointers.
 *   They are declared in tidc_api.h and defined in tidc_api.c. */
/** \var xferBuffer[2]
 *  This array holds two structures of the type TADS8422BUFOBJ,
 *  which are used to hold information about the buffers
 *  submitted.                                                  */
/** \var hConvstTimer
 *  Handle to the DSP timer used for the generation of the
 *  CONVST\ signal. This handle will be initializes in the
 *  InitConvstTimer() routine, which is called by the
 *  ADS8422_configure() function.                               */
/** \var hEdmaRead
 *  Handle to the EDMA channel for the data transfer from the
 *  ADS8422 to the memory array. This handle will be created
 *  by the function InitEdma(), which is called during
 *  ADS8422_configure().                                        */
/** \var hEdmaLinkRead
 *  Pointer to the transfer link table of the EDMA. Used, if
 *  a transfer is submitted while another one is ongoing.       */
/** \var hEdmaStop
 *  Pointer to the transfer stop table. Used to bring the EDMA
 *  channel to a halt once a transfer completes (the table
 *  contains all zeroes                                         */
/** \var *adcReadAdr
 *  Pointer to the ADS8422 on the EMIF. Holds the address of the
 *  converter as word address.                                  */
/** \var busyIntPol
 *  Signals the polarity of the BUSY signal when it arrives
 *  at the DSP. It will be 1, if the BUSY signal is connected
 *  directly to the DSP, and 0, if it is inverted.              */
/** \var convstTimerPeriod
 *  This variable holds the value for the timer period register.
 *  Will be used to set the speed of the timer during the
 *  ADS8422_configure() routine.                                */
/** \var iObjectIndex
 *  Holds the index of the last buffer object used.             */
/** \var busyIntNum
 *  This variable holds the number of the interrupt line of the
 *  DSP, where the BUSY line is connected to.                   */
/** \var emifSetup
 *  Is one, if the EMIF should be setup by the ADS8422_configure()
 *  function and zero otherwise. The value will be set at
 *  startup based on the selection made in the graphical user
 *  interface.                                                  */
/** \var iTimerNumber
 *  Holds the number of the timer to be used as selected in the
 *  graphical user interface.                                    */
/** \var xferInProgress
 *  This value indicates if there is a data transfer ongoing and
 *  can have the following values:
 *      - 0: No transfer is ongoing
 *      - 1: One transfer is ongoing
 *      - 2: One transfer is ongoing and another is submitted.  */
/****************************************************************/
    TTIDC3              f;
    TADS8422BUFOBJ      xferBuffer[2];
    TIMER_Handle        hConvstTimer;
    EDMA_Handle         hEdmaRead;
    EDMA_Handle         hEdmaLinkRead;
    EDMA_Handle         hEdmaStop;
    volatile unsigned short *adcReadAdr;
    unsigned int        busyIntPol;
    unsigned int        convstTimerPeriod;
    int                 iObjectIndex;
    unsigned int        busyIntNum;
    unsigned int        emifSetup;
    int                 iTimerNumber;
    volatile int        xferInProgress;
} TADS8422;


/****************************************************************/
/* define external DC object pointer(s)                         */
/****************************************************************/
extern far TADS8422 Ads8422_1;



/****************************************************************/
/* function definitions                                         */
/****************************************************************/
DCPAPI TTIDCSTATUS ADS8422_configure(void *pDC);
DCPAPI TTIDCSTATUS ADS8422_control(void *pDC, int iCmd, void *pValue);
DCPAPI TTIDCSTATUS ADS8422_readsample(void *pDC, long *lData);
DCPAPI TTIDCSTATUS ADS8422_writesample(void *pDC, long lData);
DCPAPI TTIDCSTATUS ADS8422_readblock(void *pDC,
                        void *pData,
                        unsigned long ulCount,
                        void (*callback) (void *));
DCPAPI TTIDCSTATUS ADS8422_writeblock(void *pDC,
                        void *pData,
                        unsigned long ulCount,
                        void (*callback) (void *));
DCPAPI TTIDCSTATUS ADS8422_close(void *pDC);
DCPAPI TTIDCSTATUS ADS8422_rblock_finished(void* pDC);


#endif /* __T8401_FN_H                                          */

/****************************************************************/
/* END OF t8422_fn.h                                             */
/****************************************************************/
/*TIDC_Wizard Auto Code End}}*/

⌨️ 快捷键说明

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