📄 t8422_fn.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\c5500\d8401_55.h> */
/****************************************************************/
/****************************************************************/
/* ADS8422 Interface Software Version 2.0 for the TMS320C5500 */
/* Copyright (C) 2004- 2006 Texas Instruments Incorporated */
/* All Rights Reserved */
/*--------------------------------------------------------------*/
/* $Revision: 11 $ $JustDate: 6/01/06 $ */
/* $Author: A0746714 $ */
/****************************************************************/
#ifndef __T8422_FN_H
#define __T8422_FN_H
#define __CSL_AVAILABLE
#include "tidc_api.h"
#include <csl.h>
#include <csl_dma.h>
#include <csl_irq.h>
#include <csl_timer.h>
/****************************************************************/
/* #defines used in the code */
/****************************************************************/
#define ADS8422_BUFOBJECT_FREE (0x0000u)
#define ADS8422_BUFOBJECT_INUSE (0x0001u)
#define ADS8422_BUFOBJECT_COMPLETE (0x0002u)
#define ADS8422_DMA_ENDPROG (0x0800)
/****************************************************************/
/* definitions for the DMA channel registers */
/****************************************************************/
/****************************************************************/
/* define for the channel control register DMACCR */
/* operating mode: Input / data transfer */
/* Value: 0x4140 = 0100 0001 0100 0000 */
/* |||| |||| |||| |||| */
/* |||| |||| |||+ ++++- SYNC (set by function) */
/* |||| |||| ||+------- FS (Element) */
/* |||| |||| |+-------- PRIO (high) */
/* |||| |||| +--------- EN (disable) */
/* |||| |||+----------- AUTOINIT (on) */
/* |||| ||+------------ REPEAT (off) */
/* |||| |+------------- RESERVED */
/* |||| +-------------- ENDPROG (off) */
/* ||++---------------- SRCAMODE (constant) */
/* ++------------------ DSTAMODE (autoincr.) */
/****************************************************************/
#define ADS8422_DMACCR_VALUE (0x4140u)
/****************************************************************/
/* define for the channel control register DMACCR */
/* operating mode: Input / dummy transfer */
/* Value: 0x08C0 = 0000 1000 1100 0000 */
/* |||| |||| |||| |||| */
/* |||| |||| |||+ ++++- SYNC (off) */
/* |||| |||| ||+------- FS (Element) */
/* |||| |||| |+-------- PRIO (high) */
/* |||| |||| +--------- EN (enable) */
/* |||| |||+----------- AUTOINIT (off) */
/* |||| ||+------------ REPEAT (off) */
/* |||| |+------------- RESERVED */
/* |||| +-------------- ENDPROG (on) */
/* ||++---------------- SRCAMODE (constant) */
/* ++------------------ DSTAMODE (constant) */
/****************************************************************/
#define ADS8422_DMACCR_VALUE_DUMMY (0x08C0u)
/****************************************************************/
/* define for the channel interrupt control register DMACICR */
/* Value: 0x0020 = 0000 0000 0010 0000 */
/* |||| |||| |||| |||| */
/* |||| |||| |||| |||+- TIMEOUTIE (off) */
/* |||| |||| |||| ||+-- DROPIE (off) */
/* |||| |||| |||| |+--- HALFIE (off) */
/* |||| |||| |||| +---- FRAMIE (off) */
/* |||| |||| |||+------ LASTIE (off) */
/* |||| |||| ||+------- BLOCKIE (on) */
/* ++++ ++++ ++-------- RESERVED */
/****************************************************************/
#define ADS8422_DMACICR_VALUE (0x0020u)
/****************************************************************/
/* define for the channel source destination parameter register */
/* DMACSDP */
/* Value: 0x0009 = 0000 0000 0000 1001 */
/* |||| |||| |||| |||| */
/* |||| |||| |||| ||++- DATATYPE (16 bit) */
/* |||| |||| ||++-++--- SRC (external memory) */
/* |||| |||| |+-------- SRCPACK (off) */
/* |||| |||+-+--------- SRCBEN (off) */
/* |||+ +++------------ DST (set by function) */
/* ||+- --------------- DSTPACK (off) */
/* ++-- --------------- SRCBEN (off) */
/****************************************************************/
#define ADS8422_DMACSDP_VALUE (0x0009u)
/****************************************************************/
/* define values for the different memory areas, as they are */
/* needed for the DMACSDP register at runtime */
/****************************************************************/
/* SRC/ DST = 00 SARAM */
/* = 01 DARAM */
/* = 10 EMIF */
/* = 11 RESERVED */
/****************************************************************/
#define ADS8422_DMACSDP_SARAM_SRC (0x0000)
#define ADS8422_DMACSDP_DARAM_SRC (0x0004)
#define ADS8422_DMACSDP_EMIF_SRC (0x0008)
#define ADS8422_DMACSDP_SARAM_DST (0x0000)
#define ADS8422_DMACSDP_DARAM_DST (0x0200)
#define ADS8422_DMACSDP_EMIF_DST (0x0400)
/****************************************************************/
/** \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 *uiBufPtr
* 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 int *uiBufPtr;
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 hDmaRead
* Handle to the DMA channel for the data transfer from the
* ADS8422 to the memory array. This handle will be created
* by the function InitDma(), which is called during
* ADS8422_configure(). */
/** \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 dmaChanNum
* Number of the DMA channel to be used to collect the data
* from the data converter. This channel will be used to create
* the hDmRead ha le. */
/** \var uiCcrValue
* Backup for the receive DMA Channel Control Register. */
/** \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;
DMA_Handle hDmaRead;
volatile unsigned int *adcReadAdr;
unsigned int busyIntPol;
unsigned int convstTimerPeriod;
int iObjectIndex;
unsigned int busyIntNum;
unsigned int emifSetup;
int iTimerNumber;
unsigned int dmaChanNum;
unsigned int uiCcrValue;
volatile int xferInProgress;
} TADS8422;
/****************************************************************/
/* define external DC object pointer(s) */
/****************************************************************/
extern 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);
interrupt void ADS8422_rblock_finished(void);
#endif /* __T8401_FN_H */
/****************************************************************/
/* END OF t8422_fn.h */
/****************************************************************/
/*TIDC_Wizard Auto Code End}}*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -