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

📄 vendor.c

📁 AMD公司官方版FLASH文件系统。有详细说明文档和Windows仿真测试环境。
💻 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 + -