• 大小: 1.61MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-09-01
  • 语言: 其他
  • 标签: CPCI驱动  

资源简介

CPCI驱动开发例程,我找了好长时间,这也是网上找的,希望对大家有帮助!

资源截图

代码片段和文件信息

// Test.cpp
//
// Generated by DriverWizard version DriverStudio 2.6.0 (Build 336)
//
// This console application demonstrates how to open a handle
// to a device in your driver and communicate with the driver
// using Read Write and DeviceIoControl calls as appropriate.
//
// This test program attempts to open the device with link name
// PCI9054Device which corresponds to Unit 0 of the 
// PCI9054Device device class in the driver.

//
// You can build this application using the command line compiler with
// the following command:
//
// cl Test.cpp
//


#include 
#include 
#include 


#include 
#include “..\PCI9054ioctl.h“


typedef void VOIDFUNC();

// Prototypes
void Usage(void);
void ShowIoctlValues(void);

// TODO:
// You can redefine the IOCTL handler prototypes as needed adding
// appropriate parameters that can be collected from the command line.
// To do this you must modify the command line parsing logic.  An
// example of this is shown in comments throughout the test application.
//
//=== Parameterized IOCTL Example ===
// void Test_IOCTL_PARAMETERIZED(int nVal ULONG dwVal);
void Test_PCI9054_IOCTL_800_Readbase0(void);
void Test_PCI9054_IOCTL_801_Writebase0(void);
void Test_PCI9054_IOCTL_802_Readbase2(void);
void Test_PCI9054_IOCTL_803_Writebase2(void);
void Test_PCI9054_IOCTL_804_Readbase3(void);
void Test_PCI9054_IOCTL_805_Writebase3(void);

void CloseIfOpen(void);
void doRead(int i);
void doWrite(int i);

// Global data


#define N_IOCODES 6

// Names of IOCTL codes
//
char *IOnames[N_IOCODES+1] =
{

//=== Parameterized IOCTL Example ===
// “IOCTL_PARAMETERIZED“
“PCI9054_IOCTL_800_Readbase0“
“PCI9054_IOCTL_801_Writebase0“
“PCI9054_IOCTL_802_Readbase2“
“PCI9054_IOCTL_803_Writebase2“
“PCI9054_IOCTL_804_Readbase3“
“PCI9054_IOCTL_805_Writebase3“
““
};

// IOCTL codes
//
int IOcodes[N_IOCODES+1] =
{

//=== Parameterized IOCTL Example ===
// IOCTL_PARAMETERIZED
PCI9054_IOCTL_800_Readbase0
PCI9054_IOCTL_801_Writebase0
PCI9054_IOCTL_802_Readbase2
PCI9054_IOCTL_803_Writebase2
PCI9054_IOCTL_804_Readbase3
PCI9054_IOCTL_805_Writebase3
0
};


// Handle to device opened in driver.
//
HANDLE hDevice = INVALID_HANDLE_VALUE;

// Name used to open device
//
char *slinkName = “\\\\.\\PCI9054Device0“;

////////////////////////////////////////////////////////////////////////
// OpenByName
//
// Open a handle to the requested device
//
HANDLE OpenByName(void)
{
// Create a handle to the driver
return CreateFile(slinkName
  GENERIC_READ | GENERIC_WRITE
  FILE_SHARE_READ
  NULL
  OPEN_EXISTING
  0
  NULL);
}



////////////////////////////////////////////////////////////////////////
// Exit
//
// Print a message and exit   
//
   void Exit(int res)
{
printf(“Exiting...\n\n“);
CloseIfOpen();
exit(res);
}


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件         15  2003-10-18 14:30  PCI9054\dirs

     文件        427  2003-10-18 14:30  PCI9054\PCI9054.dsw

     文件      99328  2007-08-02 17:34  PCI9054\PCI9054.ncb

     文件        796  2003-10-18 14:30  PCI9054\PCI9054ioctl.h

     文件       1444  2003-10-18 14:30  PCI9054\readme.txt

    ..A.SH.         9  2006-10-09 09:27  PCI9054\_desktop.ini

     文件        448  2003-10-18 14:30  PCI9054\sys\function.h

     文件        291  2003-10-18 14:30  PCI9054\sys\makefile

     文件      39176  2007-08-02 17:32  PCI9054\sys\PCI9054.APS

     文件       4730  2003-10-18 14:30  PCI9054\sys\PCI9054.cpp

     文件       6712  2003-10-18 14:30  PCI9054\sys\PCI9054.dsp

     文件        649  2003-10-18 14:30  PCI9054\sys\PCI9054.h

     文件       3189  2003-10-18 18:14  PCI9054\sys\PCI9054.inf

     文件        250  2003-10-29 19:54  PCI9054\sys\PCI9054.plg

     文件       2005  2003-10-18 14:30  PCI9054\sys\PCI9054.rc

     文件      33127  2003-10-29 17:27  PCI9054\sys\PCI9054Device.cpp

     文件       2677  2003-10-18 14:30  PCI9054\sys\PCI9054Device.h

     文件        971  2003-10-18 14:30  PCI9054\sys\sources

    ..A.SH.         9  2006-10-09 09:27  PCI9054\sys\_desktop.ini

    ..A.SH.         9  2006-10-09 09:27  PCI9054\sys\objchk\_desktop.ini

     文件       3189  2003-10-18 18:14  PCI9054\sys\objchk\i386\PCI9054.inf

     文件     837820  2003-10-29 17:54  PCI9054\sys\objchk\i386\PCI9054.NMS

     文件      71258  2003-10-29 17:54  PCI9054\sys\objchk\i386\PCI9054.sys

    ..A.SH.         9  2006-10-09 09:27  PCI9054\sys\objchk\i386\_desktop.ini

     文件     282624  2007-08-02 17:33  PCI9054\sys\objchk\i386\pci9054.pdb

     文件     224256  2007-08-02 17:33  PCI9054\sys\objchk\i386\pci9054.idb

    ...D..R         0  2007-06-06 08:33  PCI9054\sys\objchk\i386

    ...D..R         0  2007-06-06 08:33  PCI9054\sys\objchk

     文件      55579  2003-10-29 17:54  PCI9054\sys\Checked\PCI9054.map

    ..A.SH.         9  2006-10-09 09:27  PCI9054\sys\Checked\_desktop.ini

............此处省略32个文件信息

评论

共有 条评论

相关资源