📄 evmdsk54dll.h
字号:
/****************************************************************************/
/* File: pci2040dll.h */
/* */
/* Purpose: This is the public header file for the C54x EVM DLL */
/* */
/* Copyright (c) 1998, DNA Enterprises, Inc. */
/****************************************************************************/
#ifndef _PCI2040_DLL_H_
#define _PCI2040_DLL_H_
#include "ddpci2040.h" // board driver header file
#include "ppc54xdll.h" // board driver header file
/****************************************************************************/
/* defines */
/****************************************************************************/
/* Memory space type definition */
#define PROG_MEMORY 0
#define DATA_MEMORY 1
#define FLASH_MEMORY 2
#define NO_FIFO_TIMEOUT 0
#define MAX_PCI2040_DSPS 4
#define HPI_SPACE_SIZE 0x2000
#define HPI_REG_OFFSET 0x800
/***********************************************************************/
/* DEFINE TBC REGISTERS INDICES */
/***********************************************************************/
#define TBC_REG_CNTL0 (0x00>>2)
#define TBC_REG_CNTL1 (0x04>>2)
#define TBC_REG_CNTL2 (0x08>>2)
#define TBC_REG_CNTL3 (0x0C>>2)
#define TBC_REG_CNTL4 (0x10>>2)
#define TBC_REG_CNTL5 (0x14>>2)
#define TBC_REG_CNTL6 (0x18>>2)
#define TBC_REG_CNTL7 (0x1C>>2)
#define TBC_REG_CNTL8 (0x20>>2)
#define TBC_REG_CNTL9 (0x24>>2)
#define TBC_REG_MINOR_CMD (0x28>>2)
#define TBC_REG_MAJOR_CMD (0x2C>>2)
#define TBC_REG_CNT1_LOW (0x30>>2)
#define TBC_REG_CNT1_HIGH (0x34>>2)
#define TBC_REG_CNT2_LOW (0x38>>2)
#define TBC_REG_CNT2_HIGH (0x3C>>2)
#define TBC_REG_STATUS0 (0x40>>2)
#define TBC_REG_STATUS1 (0x44>>2)
#define TBC_REG_STATUS2 (0x48>>2)
#define TBC_REG_STATUS3 (0x4C>>2)
#define TBC_REG_CAPT_LOW (0x50>>2)
#define TBC_REG_CAPT_HIGH (0x54>>2)
#define TBC_REG_SERIAL_RD (0x58>>2)
#define TBC_REG_SERIAL_WR (0x5C>>2)
/***********************************************************************/
/* DEFINE CPLD REGISTERS INDICES */
/***********************************************************************/
#define CPLD_CTRL_OFFSET 0x00
#define CPLD_STAT1_OFFSET 0x04
#define CPLD_STAT2_OFFSET 0x08
#define CPLD_REV_OFFSET 0x0c
#define CPLD_SEM0_OFFSET 0x10
#define CPLD_SEM1_OFFSET 0x14
/***********************************************************************/
/* DEFINE HPI REGISTERS INDICES */
/***********************************************************************/
#define C54X_HPIC 0x00
#define C54X_HPIA 0x08
#define C54X_HPID_AUTOINC 0x04
#define C54X_HPID_NOAUTOINC 0x0c
/* fixup True/False defines */
#undef FALSE
#undef TRUE
#define FALSE ((BOOLEAN)0)
#define TRUE ((BOOLEAN)1)
#define PCI2040_GLOBAL_EVENT_BASE_NAME "Pci2040MsgEventDev"
#ifndef INTDSP0
#define INTDSP0 (1<<0) // Bit set if an interrupt has been generated by a device connected
#endif // to the HPI[0] interface. Software can set this bit for diagnostics.
#ifndef INTDSP1
#define INTDSP1 (1<<1) // Bit set if an interrupt has been generated by a device connected
#endif // to the HPI[1] interface. Software can set this bit for diagnostics.
#ifndef INTDSP2
#define INTDSP2 (1<<2) // Bit set if an interrupt has been generated by a device connected
#endif // to the HPI[2] interface. Software can set this bit for diagnostics.
#ifndef INTDSP3
#define INTDSP3 (1<<3) // Bit set if an interrupt has been generated by a device connected
#endif // to the HPI[3] interface. Software can set this bit for diagnostics.
#ifndef GPINT
#define GPINT (1<<26) // Bit set if an interrupt has been generated by a device connected
#endif // to the GPINT# interface. Software can set this bit for diagnostics.
#ifndef INTGPIO2
#define INTGPIO2 (1<<27) // Set when GPIO2Pin selects GPIO2 as an interrupt event input, and the
#endif // event type selected by the GPIO Interrupt Event Type Register occurs.
#ifndef INTGPIO3
#define INTGPIO3 (1<<28) // Set when GPIO3Pin selects GPIO3 as an interrupt event input, and the
#endif // event type selected by the GPIO Interrupt Event Type Register occurs.
#ifndef GPERROR
#define GPERROR (1<<29) // Bit set upon serious error conditions on the GP interface, and
#endif // allows software to gracefully terminate communication with a GP device.
#ifndef HPIERROR
#define HPIERROR (1<<30) // Bit set upon serious error conditions on the HPI interface, and allows
#endif // software to gracefully terminate communication with an HPI device.
// This bit is the OR combination of the HPI errors in the HPI Error Report
// Register.
/****************************************************************************/
/* Structure used to get HPI mapped addresses */
/****************************************************************************/
// Structure used to write PCI register
typedef struct _PCI2040_MAPPED_ADDRESS {
PULONG Address; // Register to read/write
ULONG length; // Data to read/write
} PCI2040_MAPPED_ADDRESS, *PPCI2040_MAPPED_ADDRESS;
typedef struct _PCI2040_INIT_DATA {
PCI2040_DUMP_CONFIG_REGS pci_regs;
} PCI2040DLL_INIT_DATA, *PPCI2040DLL_INIT_DATA;
typedef struct _MemSpaceConfig {
BOOL ovly;
BOOL drom;
BOOL mp_mc;
} MemSpaceConfig, *PMemSpaceConfig;
/****************************************************************************/
/* Enums */
/****************************************************************************/
// DSP board type definition
typedef enum {
TYPE_UNKNOWN = 0,
TYPE_PCI2040_C5410_EVM,
TYPE_C5402_DSK
} EVMDSK54X_BOARD_TYPE, *PEVMDSK54X_BOARD_TYPE;
//board connection modes
typedef enum {
EVMDSK54X_PCI_OPEN,
EVMDSK54X_PARALLEL_OPEN
} EVMDSK54X_OPEN_TYPE, *PEVMDSK54X_OPEN_TYPEE;
typedef enum {
ERASE_ALL = -1,
} EVMDSK54X_FLASH_CONTROL, *PEVMDSK54X_FLASH_CONTROL;
//DSP-to-HOST events
typedef enum {
DSP0_INT = 0,
DSP1_INT,
DSP2_INT,
DSP3_INT,
GP_INT,
GPIO2_INT,
GPIO3_INT,
HPIERROR_INT,
HPIERROR0_INT,
HPIERROR1_INT,
HPIERROR2_INT,
HPIERROR3_INT
} PCI2040_HOST_EVENT, *PPCI2040_HOST_EVENT;
//HOST-to-DSP events
typedef enum {
NMI_INT = 0,
DSP_INT,
DSP_INT3
} PCI2040_DSP_EVENT, *PPCI2040_DSP_EVENT;
typedef enum {
PCI2040_SEM0,
PCI2040_SEM1
} PCI2040_SEM, PPCI2040_SEM;
typedef enum {
CSR_BAR = 0,
HPI_BAR,
TBC_BAR,
CPLD_BAR
} PCI2040_BAR, *PPCI2040_BAR;
/****************************************************************************/
/* typedefs */
/****************************************************************************/
/* "printf" redirection function definition */
typedef void (PCI2040_PRINTF_FUNC)(char *);
typedef PCI2040_PRINTF_FUNC *PPCI2040_PRINTF_FUNC;
typedef void (PCI2040_INPUT_FUNC)(char *);
typedef PCI2040_INPUT_FUNC *PPCI2040_INPUT_FUNC;
typedef void (*FileIOFunc)(LPVOID hDevice, ULONG dspNum);
#undef DLL32_ENTRY
#ifdef evmdsk54xdll_c
// export function, for building DLL
#define DLL32_ENTRY __declspec(dllexport)
#else
// import function, for using DLL
#define DLL32_ENTRY __declspec(dllimport)
#endif
#ifdef __cplusplus
extern "C" {
#endif
/****************************************************************************/
/* all DLL function definitions */
/****************************************************************************/
/*****************************************************************************
* evmdsk54x_open()
*
* Description:
* Opens the board devices. Some functions included in the API requires an
* exclusive open so be sure to pass in a 1 for the exclusive flag.
*
* Parameters:
* board_index - corresponds to the board number for which the handle is
* requested.
* exclusive_flag - indicates exclusive ownership of the board.
* openType - Specifies either a parallel or PCI connect. Note that the
* 5402 DSK only supports a parallel conect. If a PCI connection
* is specified for the DSK an INVALID_HANDLE_VALUE will be returned
*
* Return:
* A handle to the board.
*
*******************************************************************************/
DLL32_ENTRY HANDLE evmdsk54x_open(int board_index,
EVMDSK54X_BOARD_TYPE boardType,
EVMDSK54X_OPEN_TYPE openType,
BOOL exclusive_flag);
/*****************************************************************************
* evmdsk54x_init()
*
* Description:
* Initializes the board, specifically the montana device.
*
* Parameters:
* hDevice - Board handle returned from the call to evmdsk54x_open.
* requested.
* pInitData - pointer to a PPCI2040DLL_INIT_DATA objects which has the
* configuration information. This can be a NULL, in which case the default
* configuration is used.
*
* Return:
* TRUE - success.
* FALSE - failure
*******************************************************************************/
DLL32_ENTRY BOOL evmdsk54x_pci_init(HANDLE hDevice, PPCI2040DLL_INIT_DATA pInitData);
/*****************************************************************************
* evmdsk54x_close()
*
* Description:
* Closes the handle to the board. No communication with the board is possible
* after a call to this routine.
*
* Parameters:
* hDevice - Board handle returned from the call to evmdsk54x_open.
*
* Return:
* TRUE - success.
* FALSE - failure
*******************************************************************************/
DLL32_ENTRY BOOL evmdsk54x_close(HANDLE hDevice);
/*****************************************************************************
* evmdsk54x_reset_board()
*
* Description:
* Resets the board to a known state.
*
* Parameters:
* hDevice - Board handle returned from the call to evmdsk54x_open.
*
* Return:
* TRUE - success.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -