?? vendor.c
字號:
/**
* ven.c
*/
#include <windows.h>
#include <conio.h>
#include "Vendor.h"
#include "FlashCard/FlashDll.h"
int dms_lVendorSetupBasePointer(void);
static WORD *lpFlashBasePointer = NULL;
/*
* dms_VendorMapChip
*
* This function translates the address into the
* starting address of the flash chip.
*/
void *dms_VendorMapChip(DWORD dwAddress)
{
/*
* The flash card only supports one flash chip.
*/
return dms_VendorMapPage(0);
}
/**
* dms_VendorMapPage
*
* DESCRIPTION
* This function maps region on the DL-Demo board into
* DRAM and returns a pointer to that region.
*/
void *dms_VendorMapPage(DWORD dwAddress)
{
if(lpFlashBasePointer == NULL && !dms_lVendorSetupBasePointer()){
return NULL;
}
return (void*) (((BYTE*)lpFlashBasePointer) + dwAddress);
}
int dms_lVendorSetupBasePointer(void)
{
int iErrorCode;
char buffer[200];
if(lpFlashBasePointer == NULL)
{
iErrorCode = InitPCIDataSpace();
if (iErrorCode != 0){
FormatMessage(
FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
iErrorCode % 1000,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
buffer,
200,
NULL
);
return 0;
}
SetWordMode();
iErrorCode = GetDeviceID(0);
if (iErrorCode < 0){
return 0;
}
lpFlashBasePointer = GetBaseFlashWordPointer();
}
return 1;
}
/**
* dms_VendorFinalize
*/
void dms_VendorFinalize(void)
{
if (lpFlashBasePointer == NULL){
FreePCIDataSpace();
lpFlashBasePointer = NULL;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -