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

📄 csl_mcbsp.h

📁 SEED的VPM642测试程序-板级支持库
💻 H
📖 第 1 页 / 共 2 页
字号:
/******************************************************************************\

*           Copyright (C) 1999-2000 Texas Instruments Incorporated.

*                           All Rights Reserved

*------------------------------------------------------------------------------

* FILENAME...... csl_mcbsp.h

* DATE CREATED.. 06/11/1999 

* LAST MODIFIED. 09/24/2001

*                      - MCBSP_read32 / MCBSP_write32

\******************************************************************************/

#ifndef _CSL_MCBSP_H_

#define _CSL_MCBSP_H_



#include <csl_chip.h>

#include <csl_irq.h>

#include <csl_mcbsphal.h>





#if (MCBSP_SUPPORT)

/******************************************************************************\

* scope and inline control macros

\******************************************************************************/

#ifdef __cplusplus

#define CSLAPI extern "C" far

#else

#define CSLAPI extern far

#endif



#undef  USEDEFS

#undef  IDECL

#undef  IDEF



#ifdef  _MCBSP_MOD_

  #define IDECL CSLAPI

  #define USEDEFS

  #define IDEF

#else

  #ifdef  _INLINE

    #define IDECL static inline

    #define USEDEFS

    #define IDEF  static inline

  #else

    #define IDECL CSLAPI

  #endif

#endif





/******************************************************************************\

* global macro declarations

\******************************************************************************/



/* MCBSP_open() flags */

#define MCBSP_OPEN_RESET     (0x00000001)



/* Renaming MCBSP_read/write  */

#define MCBSP_read32 MCBSP_read 

#define MCBSP_write32 MCBSP_write 





/* pin identifiers used with MCBSP_getPins() and MCBSP_setPins() */

#define MCBSP_PIN_CLKX       _MCBSP_PCR_CLKXP_MASK

#define MCBSP_PIN_FSX        _MCBSP_PCR_FSXP_MASK

#define MCBSP_PIN_DX         _MCBSP_PCR_DXSTAT_MASK

#define MCBSP_PIN_CLKR       _MCBSP_PCR_CLKRP_MASK

#define MCBSP_PIN_FSR        _MCBSP_PCR_FSRP_MASK

#define MCBSP_PIN_DR         _MCBSP_PCR_DRSTAT_MASK

#define MCBSP_PIN_CLKS       _MCBSP_PCR_CLKSSTAT_MASK



/* device identifiers for MCBSP_open() */

#define MCBSP_DEV0    (0)

#define MCBSP_DEV1    (1)

#if (_MCBSP_PORT_CNT == 3)

  #define MCBSP_DEV2  (2)

#endif



/* device identifiers for MCBSP_open() */

#define MCBSP_PORT0    MCBSP_DEV0

#define MCBSP_PORT1    MCBSP_DEV1

#if (_MCBSP_PORT_CNT == 3)

  #define MCBSP_PORT2  MCBSP_DEV2

#endif



/* Constants for MCBSP_start */

#define MCBSP_RCV_START       (1u)

#define MCBSP_XMIT_START      (2u)

#define MCBSP_SRGR_START      (4u)

#define MCBSP_SRGR_FRAMESYNC  (8u)

#define MCBSP_SRGR_DEFAULT_DELAY  (0xFFFFFFFFu)



/******************************************************************************\

* global typedef declarations

\******************************************************************************/



/* device handle object */

typedef struct {

  Uint32 allocated;

  Uint32 xmtEventId;

  Uint32 rcvEventId;

  volatile Uint32 *baseAddr;

  Uint32 drrAddr;

  Uint32 dxrAddr;

} MCBSP_Obj, *MCBSP_Handle;



/* device configuration structure */

#if (!C64_SUPPORT)

typedef struct {

  Uint32 spcr;

  Uint32 rcr;

  Uint32 xcr;

  Uint32 srgr;

  Uint32 mcr;

  Uint32 rcer; 

  Uint32 xcer;

  Uint32 pcr;

} MCBSP_Config;

#else

typedef struct {

  Uint32 spcr;

  Uint32 rcr;

  Uint32 xcr;

  Uint32 srgr;

  Uint32 mcr;

  Uint32 rcere0;

  Uint32 rcere1;

  Uint32 rcere2;

  Uint32 rcere3;

  Uint32 xcere0;

  Uint32 xcere1;

  Uint32 xcere2;

  Uint32 xcere3;

  Uint32 pcr;

} MCBSP_Config;

#endif



/******************************************************************************\

* global variable declarations

\******************************************************************************/



/* predefined deviced handles for legacy - should not be used*/

extern far MCBSP_Handle _MCBSP_hDev0;

extern far MCBSP_Handle _MCBSP_hDev1;

#if (_MCBSP_PORT_CNT == 3)

  extern far MCBSP_Handle _MCBSP_hDev2;

#endif







/******************************************************************************\

* global function declarations

\******************************************************************************/

CSLAPI void MCBSP_reset(MCBSP_Handle hMcbsp);

CSLAPI void MCBSP_resetAll();

CSLAPI void MCBSP_start(MCBSP_Handle hMcbsp, Uint32 startMask, Uint32 sampleratedelay); 



CSLAPI MCBSP_Handle MCBSP_open(int devNum, Uint32 flags);

CSLAPI void MCBSP_close(MCBSP_Handle hMcbsp);



CSLAPI Uint32 MCBSP_getPins(MCBSP_Handle hMcbsp);

CSLAPI void MCBSP_setPins(MCBSP_Handle hMcbsp, Uint32 pins);





/******************************************************************************\

* inline function declarations

\******************************************************************************/

IDECL Uint32 MCBSP_getXmtAddr(MCBSP_Handle hMcbsp);

IDECL Uint32 MCBSP_getRcvAddr(MCBSP_Handle hMcbsp);

IDECL Uint32 MCBSP_getXmtEventId(MCBSP_Handle hMcbsp);

IDECL Uint32 MCBSP_getRcvEventId(MCBSP_Handle hMcbsp);



IDECL Uint32 MCBSP_read(MCBSP_Handle hMcbsp);

IDECL void   MCBSP_write(MCBSP_Handle hMcbsp, Uint32 val);



IDECL void   MCBSP_enableXmt(MCBSP_Handle hMcbsp);

IDECL void   MCBSP_enableRcv(MCBSP_Handle hMcbsp);

IDECL void   MCBSP_enableFsync(MCBSP_Handle hMcbsp);

IDECL void   MCBSP_enableSrgr(MCBSP_Handle hMcbsp);



IDECL Uint32 MCBSP_xrdy(MCBSP_Handle hMcbsp);

IDECL Uint32 MCBSP_rrdy(MCBSP_Handle hMcbsp);

IDECL Uint32 MCBSP_xempty(MCBSP_Handle hMcbsp);

IDECL Uint32 MCBSP_rfull(MCBSP_Handle hMcbsp);

IDECL Uint32 MCBSP_xsyncerr(MCBSP_Handle hMcbsp);

IDECL Uint32 MCBSP_rsyncerr(MCBSP_Handle hMcbsp);



IDECL void MCBSP_config(MCBSP_Handle hMcbsp, MCBSP_Config *config);



#if (!C64_SUPPORT) /* ?? added C64_SUPPORT */

IDECL void MCBSP_configArgs(MCBSP_Handle hMcbsp, Uint32 spcr, Uint32 rcr, 

  Uint32 xcr, Uint32 srgr, Uint32 mcr, Uint32 rcer, Uint32 xcer, Uint32 pcr);

#else /* (C64_SUPPORT) */

IDECL void MCBSP_configArgs(MCBSP_Handle hMcbsp, Uint32 spcr, Uint32 rcr, 

  Uint32 xcr, Uint32 srgr, Uint32 mcr, Uint32 rcere0, Uint32 rcere1, 

  Uint32 rcere2, Uint32 rcere3, Uint32 xcere0, Uint32 xcere1, Uint32 xcere2, 

  Uint32 xcere3, Uint32 pcr);

#endif



IDECL void MCBSP_getConfig(MCBSP_Handle hMcbsp, MCBSP_Config *config);





/******************************************************************************\

* inline function definitions

\******************************************************************************/

#ifdef USEDEFS

/*----------------------------------------------------------------------------*/

IDEF Uint32 MCBSP_getXmtAddr(MCBSP_Handle hMcbsp) {

  return (Uint32)(hMcbsp->dxrAddr);

}

/*----------------------------------------------------------------------------*/

IDEF Uint32 MCBSP_getRcvAddr(MCBSP_Handle hMcbsp) {

  return (Uint32)(hMcbsp->drrAddr);

}

/*----------------------------------------------------------------------------*/

IDEF Uint32 MCBSP_getXmtEventId(MCBSP_Handle hMcbsp) {

  return (hMcbsp->xmtEventId);

}

/*----------------------------------------------------------------------------*/

IDEF Uint32 MCBSP_getRcvEventId(MCBSP_Handle hMcbsp) {

  return (hMcbsp->rcvEventId);

}

/*----------------------------------------------------------------------------*/

IDEF Uint32 MCBSP_read(MCBSP_Handle hMcbsp) {

  return (*(volatile Uint32 *)(hMcbsp->drrAddr));

}

/*----------------------------------------------------------------------------*/

IDEF void MCBSP_write(MCBSP_Handle hMcbsp, Uint32 val) {

  (*(volatile Uint32 *)(hMcbsp->dxrAddr)) = val;

}

/*----------------------------------------------------------------------------*/

IDEF Uint32 MCBSP_xrdy(MCBSP_Handle hMcbsp) {

  return MCBSP_FGETH(hMcbsp,SPCR,XRDY);

}

/*----------------------------------------------------------------------------*/

IDEF Uint32 MCBSP_rrdy(MCBSP_Handle hMcbsp) {

  return MCBSP_FGETH(hMcbsp,SPCR,RRDY);

}

/*----------------------------------------------------------------------------*/

IDEF Uint32 MCBSP_xempty(MCBSP_Handle hMcbsp) {

  return MCBSP_FGETH(hMcbsp,SPCR,XEMPTY);

}

/*----------------------------------------------------------------------------*/

IDEF Uint32 MCBSP_rfull(MCBSP_Handle hMcbsp) {

  return MCBSP_FGETH(hMcbsp,SPCR,RFULL);

}

/*----------------------------------------------------------------------------*/

IDEF Uint32 MCBSP_xsyncerr(MCBSP_Handle hMcbsp) {

⌨️ 快捷键说明

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