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

📄 sram_interface.c

📁 he Software folder contains the following files :- 1) Sram_Interface.exe ----------> EXE Fil
💻 C
字号:
#include"c:\Plx\PciSdk\Win32\Samples\Common\ConsFunc.h"
#include"c:\Plx\PciSdk\Win32\Samples\Common\PlxInit.h"
#include<stdio.h>
#include<conio.h>
#include<string.h>

int Initialize_pci();
int Close_pci();
int WriteFPGAControlWord(unsigned long cntrl_word,unsigned long address);
int WriteFPGA(unsigned long data);
unsigned long ReadFPGA();
unsigned long FileToMemory(int sram_status,unsigned long initial_address);
unsigned long MemoryToFile(int sram_status,unsigned long initial_address);
long ApplyHexFormat(void);

/*************************************************************/	

//               Definitions
/**********************************************/
#define SIZE_BUFFER         0x100           // Number of bytes to transfer
//*********************************************

	//==============================
	// all variable declerations
   
    S8              DeviceSelected;
    HANDLE          hDevice;
    RETURN_CODE     rc;
    DEVICE_LOCATION Device;
 	RETURN_CODE		wc;				// write code return
	VIRTUAL_ADDRESSES Va;
	U32				PlxChipBase;
	U32				size;
	U32				PciBarNum;
	U16				regvalue;
	U32				buffer[0x5];	// write buffer of 40 data long word
	U32				data;			// data to be write
	U32				temp_add;		// temporary adress
	int		i;
	long int		dly;
//================================
// For the interrupt
	DWORD			EventStatus;
	PLX_INTR		PlxIntr;
	HANDLE			*pINTAEvent;
	PLX_INTR		IntSources;
	RETURN_CODE		tc;

    FILE *fc;
struct SRAM
{
    char inputfilename[50];
	char outputfilename[50];
}ob1;
	
int delay()
{
	for(i=0;i<1000;i++);
}
int Initialize_pci()
{
    DeviceSelected = SelectDevice( &Device );
    if (DeviceSelected == -1)
    {
        ConsoleEnd();
        exit(0);
    }
    rc = PlxPciDeviceOpen( &Device, &hDevice );
    if (rc != ApiSuccess)
    {
       exit(-1);
    } 
	PlxPciBoardReset( hDevice );
	for (PciBarNum = 0; PciBarNum < 6; PciBarNum++)
	{
		rc = PlxPciBarRangeGet(
							hDevice,
							PciBarNum,
							&size
							);
		if (rc != ApiSuccess)
		{
			// ERROR 

⌨️ 快捷键说明

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