亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? pubmem.cpp

?? VHPD1394 V1.15驅動程序源碼
?? CPP
字號:
/************************************************************************
 *  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
 *  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 *  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
 *  PURPOSE.
 ************************************************************************/

/************************************************************************
 *
 *  Module:       pubmem.cpp
 *  Long name:    VHPD1394 memory publisher example
 *  Description:  This sample demonstrates how to use the VHPD1394
 *                device driver to publish a portion of the IEEE 1394
 *                address space of the local node (PC) and to receive
 *                notifications for access on this address space.
 *                This sample is based on the VHPDLib C++ class library.
 *                It mainly demonstrates the usage of the class CVhpdNotifySlave.
 *
 *  Runtime Env.: implemented as Win32 console application
 *  Used link libraries:
 *                vhpdlib.lib, setupapi.lib, user32.lib
 *  Author(s):    Frank Senf
 *  Company:      Thesycon GmbH, Ilmenau
 ************************************************************************/

// standard includes
#include <stdio.h>
#include <conio.h>

// definitions of used classes
#include "NotifySlave.h"


// print prefixes
#define PFX   "PUBMEM: "
#define PFXERR  "PUBMEM Error: "
// standard help message
static const char g_UseHelp[] = "For help, use PUBMEM -h.";


// GLOBAL VARIABLES

// notify slave instance
CNotifySlave g_NotifySlave;

// zero-based index of the peer device within the Windows-internal
// device list
// not related to the device's node ID, see the "SCAN" example for
// further details
// (default 0)
int g_DevNumber =0;

// IEEE 1394 start address of address space that will be published
// (no default, always has to be specified)
__int64 g_StartAddress;

// size, in bytes, of the address space that will be published
// (default 2048)
// NOTE: do not set to a multiple of 64*1024 bytes (see also "Problems.txt")
unsigned long g_MemoryLength =2048;

// set to zero to disable notifications for all accesses to the published
// address space
int g_Notify =1;

// parameters of the buffer pool used for access notifications
// number of buffers in pool
unsigned long g_NumberOfBuffers =4;




/*******************************************************************/
// support functions
/*******************************************************************/

//
// display usage information
//
void
PrintHelp(void)
{

  fprintf(stdout,
    "\n"
    "usage: PUBMEM Address <Options>\n"
    "\n"
    " Address (hexadecimal, required)\n"
    "  IEEE 1394 start address of address space that will be published\n"
    "\n"
    " Options:\n"
    "  -dDevNumber:   zero-based index of the device (optional, default %d)\n"
    "                 (use the SCAN example to display a list of available devices)\n"
    "  -sMemorySize:  size, in bytes, of the address space to publish\n"
    "                 (do not set to a multiple of 64*1024 bytes, see problems.txt\n"
    "                  for details)\n"
    "                 (optional, default %d)\n"
    "  -eEnabled:     enable notifications for all accesses to the\n"
    "                 published address space\n"
    "                 (optional, 1 -> enabled, 0 -> disabled, default %s)\n"
    "  -nBufferCount: number of buffers used for access notifications\n"
    "                 (optional, default %d)\n"
    ,g_DevNumber, g_MemoryLength, (g_Notify==1) ? "enabled" : "disabled",g_NumberOfBuffers);

  fprintf(stdout,"\nPress any key to continue\n");
  getch();

} // PrintHelp


/*******************************************************************/
// main function
/*******************************************************************/
int __cdecl main(int argc, char *argv[])
{

  // used for synchronisation of notification processing
  HANDLE hNotifyEvt; hNotifyEvt = NULL;
  HANDLE hNotifyCompletedEvt; hNotifyCompletedEvt = NULL;


/*******************************************************************/
// fixed command line argument

  // check for required arguments
  if ( argc < 2 ) {
    // at least Address has to be specified
    PrintHelp();
    return 1;
  }

  // store values for required arguments
  __int64 val64;
  if ( 1==sscanf(argv[1]," %I64x ",&val64) ) {
    // store value
    g_StartAddress = val64;
  } else {
    // invalid Address parameter, we cannot continue
    fprintf(stderr, PFXERR"Invalid Address argument '%s'\n",argv[1]);
    return 4;
  }


/*******************************************************************/
// optional command line options

  int i;
  int val;
  char* p;
  for ( i=1; i<argc; i++ ) {
    p = argv[i];
    if ( (*p) == '-' ) {
      p++;
      switch ( *p ) {
        case 'h':
        case 'H':
        case '?':
          // help
          PrintHelp();
          return 0;
                
        // device number
        case 'd':
          // read number
          if ( 1==sscanf(p+1," %i ",&val) ) {
            if ( val>=0 && val<=62 ) {
              // store value
              g_DevNumber = val;
            } else {
              // invalid device number, ignore it
              fprintf(stderr, PFXERR"Invalid device number %d ignored\n",val);
            }
          } else {
            // invalid option format, ignore it
            fprintf(stderr, PFXERR"Invalid argument '%s' ignored\n",argv[i]);
          }
          break;

        // size of published memory space
        case 's':
          // read number
          if ( 1==sscanf(p+1," %i ",&val) ) {
            // check for a multiple of 64*1024 bytes, this will cause problems
            if ( val % (64*1024) == 0 ) {
              fprintf(stderr, PFXERR"Invalid argument '%s'\n",argv[i]);
              fprintf(stderr, PFXERR"Multiples of 64*1024 bytes will cause serious problems\n");
              return 5;
            } else {
              // store value
              g_MemoryLength = val;
            }
          } else {
            // invalid option format, ignore it
            fprintf(stderr, PFXERR"Invalid argument '%s' ignored\n",argv[i]);
          }
          break;

        // notifications enabled ?
        case 'e':
          // read number
          if ( 1==sscanf(p+1," %i ",&val) ) {
            // store value
            g_Notify = val;
          } else {
            // invalid option format, ignore it
            fprintf(stderr, PFXERR"Invalid argument '%s' ignored\n",argv[i]);
          }
          break;

        // buffer count
        case 'n':
          // read number
          if ( 1==sscanf(p+1," %i ",&val) ) {
            // store value
            g_NumberOfBuffers = val;
          } else {
            // invalid option format, ignore it
            fprintf(stderr, PFXERR"Invalid argument '%s' ignored\n",argv[i]);
          }
          break;

        // unknown options
        default:
          fprintf(stderr, PFXERR"Unrecognized option '%s' ignored. %s\n",argv[i],g_UseHelp);
          break;
      } // switch
    }
  } // for


/*******************************************************************/
// open a device handle

  // prepare an OS-internal device list used for the open call
  HDEVINFO DevList; DevList = NULL;
  // device list will contain devices that provide the VHPD_IID interface
  // please refer to to the documentation (chapter 7.4) for details on how 
  // to define your private interface (strongly recommended)
  const GUID VhpdDefaultIID = VHPD_IID;
  DevList = CVhpd::CreateDeviceList(&VhpdDefaultIID);
  if ( DevList == NULL ) {
    // ERROR !!!
    fprintf(stderr, PFXERR"CreateDeviceList failed\n");
    return 10;
  }
  // open a handle to the device
  unsigned long Status;
  Status = g_NotifySlave.Open(g_DevNumber,DevList,&VhpdDefaultIID);
  if ( Status != VHPD_STATUS_SUCCESS ) {
    // ERROR !!!
    fprintf(stderr, PFXERR"Failed to open device %d (0x%08X)\n",g_DevNumber,Status);
    goto Exit;
  }
  // device opened, destroy the device list, we don't need it anymore
  CVhpd::DestroyDeviceList(DevList);
  DevList = NULL;


/*******************************************************************/
// setup g_NotifySlave

  // fill given start address to interface structure
  VHPD_UINT64 StartAddress;
  StartAddress.QuadPart = g_StartAddress;
  // initialize the g_NotifySlave instance
  // this creates an AddressRange object at the device driver
  // AddressRange object is created in BufferStoreMode
  Status = g_NotifySlave.Setup(
                          StartAddress,     // start address of address space
                          g_MemoryLength,   // size in bytes of address space
                          StartAddress,     // trigger address (not used in BufferStoreMode)
                          VHPD_FLAG_ADRRNG_ACCESS_READ
                          | VHPD_FLAG_ADRRNG_ACCESS_WRITE
                          | VHPD_FLAG_ADRRNG_ACCESS_LOCK,   // allowed access options
                          VHPD_FLAG_ADRRNG_NOTIFY_READ
                          | VHPD_FLAG_ADRRNG_NOTIFY_WRITE
                          | VHPD_FLAG_ADRRNG_NOTIFY_LOCK,   // requested notification options
                          g_NumberOfBuffers,                // number of notification buffers
                          sizeof(VHPD_ADRRNG_NOTIFICATION)  // size in bytes of a notification buffer
                          );
  if ( Status != VHPD_STATUS_SUCCESS ) {
    // ERROR !!!
    fprintf(stderr, PFXERR"Failed to initialize g_NotifySlave (0x%08X)\n",Status);
    goto Exit;
  }
  // AddressRange object is configured now, but access to address space is not possible
  // before EnableAddressRange is called

  // configure notification processing if notifications are enabled
  if ( g_Notify != 0 ) {
    // create synchronization events
    hNotifyEvt = ::CreateEvent(NULL,FALSE,FALSE,NULL);
    if ( hNotifyEvt == NULL ) {
      // ERROR !!!
      fprintf(stderr, PFXERR"CreateEvent(hNotifyEvt) failed (0x%08X)\n",::GetLastError());
      goto Exit;
    }
    hNotifyCompletedEvt = ::CreateEvent(NULL,FALSE,FALSE,NULL);
    if ( hNotifyCompletedEvt == NULL ) {
      // ERROR !!!
      fprintf(stderr, PFXERR"CreateEvent(hNotifyCompletedEvt) failed (0x%08X)\n",::GetLastError());
      goto Exit;
    }

    // init synchronisation events of g_NotifySlave worker thread
    g_NotifySlave.SetNotifyEvents(hNotifyEvt,hNotifyCompletedEvt);

    // start g_NotifySlave worker thread
    if ( !g_NotifySlave.StartThread() ) {
      // ERROR !!!
      fprintf(stderr, PFXERR"Failed to start worker thread\n");
      goto Exit;
    }
  }

  // enable access to the address space
  Status = g_NotifySlave.EnableAddressRange();
  if ( Status != VHPD_STATUS_SUCCESS ) {
    // ERROR !!!
    fprintf(stderr, PFXERR"Failed to enable address space access (0x%08X)\n",Status);
    goto Exit;
  }
  // access to address space is possible now


/*******************************************************************/
// now wait for notifications until we are told to exit

  fprintf(stdout, PFX"Address space 0x%012I64X to 0x%012I64X published\n",
    g_StartAddress,g_StartAddress+g_MemoryLength);
  fprintf(stdout, PFX"Waiting for access ... press any key to exit\n");

  for(;;) {
    if ( g_Notify != 0 ) {
      // wait for a address space access notification, loop sometimes to give
      // the user a chance to exit
      unsigned long res;
      res = ::WaitForSingleObject(hNotifyEvt,500);
      if ( res == WAIT_TIMEOUT ) {
        // wait timed out, just check keyboard input and enter wait again
      }
      if ( res == WAIT_OBJECT_0 ) {
        // notification received, get pointer to current address space access description
        VHPD_ADRRNG_NOTIFICATION* access = g_NotifySlave.GetCurrentAccess();
        if ( access != NULL ) {
          // print access description on screen
          fprintf(stdout, PFX"Access on monitored address space detected\n");
          fprintf(stdout, "   Address 0x%012I64X\n",access->StartAddress.QuadPart + access->Offset);
          fprintf(stdout, "   Length  %d bytes\n",access->Length);
          fprintf(stdout, "   Tye    %s \n",
            (access->NotificationEvent&VHPD_FLAG_ADRRNG_NOTIFY_READ)?"READ":
            (access->NotificationEvent&VHPD_FLAG_ADRRNG_NOTIFY_WRITE)?"WRITE":
            (access->NotificationEvent&VHPD_FLAG_ADRRNG_NOTIFY_LOCK)?"LOCK":"UNKNOWN"
            );
          // print data to screen for WRITE and LOCK access
          if ( (access->NotificationEvent&VHPD_FLAG_ADRRNG_NOTIFY_WRITE)
              || (access->NotificationEvent&VHPD_FLAG_ADRRNG_NOTIFY_LOCK) ) {
            fprintf(stdout, "   Data");
            for (unsigned long i=0; i<access->Length; i++) {
              if ( (i%4) == 0 ) {
                fprintf(stdout,"\n    ");
              }
              fprintf(stdout,"0x%02X ",access->Data[i]);
            }
            fprintf(stdout,"\n");
          }
        }
        // notification completely processed, continue worker thread
        ::SetEvent(hNotifyCompletedEvt);
      }
      if ( res == WAIT_FAILED ) {
        // ERROR !!!
        fprintf(stderr,PFX"WaitForSingleObject failed (0x%08X), aborting ...\n",::GetLastError());
        break;
      }
    } else {
      // nothing to do, check for errors
      if ( g_NotifySlave.GetErrorCount() != 0 ) {
        fprintf(stderr, PFX"Avg. rate is %I64d Bytes/s  %d buffer errors (last 0x%08X)\n",
          g_NotifySlave.GetErrorCount(), g_NotifySlave.GetLastError());
      }
      // check if thread is still running
      // worker thread may terminate itself, even if ShutdownThread was not called
      // (e.g. because ProcessNotification returns false or an internal error was detected)
      if ( g_NotifySlave.ThreadExited() ) {
        fprintf(stdout,"\n"PFX"Worker thread has terminated ... aborting.\n");
        break;
      }
      // suspend some time
      Sleep(500);
    }

    // check for user break
    if ( kbhit() ) {
      getch();
      break;
    }
  } // for  

  fprintf(stdout, PFX"Exiting ...\n");


/*******************************************************************/
// ERROR!!! or normal exit

// release claimed resources
Exit:
  if ( !g_NotifySlave.ShutdownThread() ) {
    // ERROR !!!
    fprintf(stderr, PFXERR"FATAL: Failed to stop worker thread\n");
  }
  g_NotifySlave.SetNotifyEvents(NULL,NULL);
  g_NotifySlave.DisableAddressRange();
  g_NotifySlave.DeleteSlave();
  g_NotifySlave.Close();

  if ( hNotifyEvt != NULL ) {
    ::CloseHandle(hNotifyEvt);
    hNotifyEvt = NULL;
  }

  if ( hNotifyCompletedEvt != NULL ) {
    ::CloseHandle(hNotifyCompletedEvt);
    hNotifyCompletedEvt = NULL;
  }

  return 0;

} // main

/*************************** EOF **************************************/

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩中文欧美在线| 亚洲私人黄色宅男| 精品99久久久久久| 中文字幕欧美国产| 日韩精彩视频在线观看| 欧美日韩电影在线| 国产精品视频免费| 麻豆精品久久久| 一本一本大道香蕉久在线精品| 91精品国产91久久久久久最新毛片 | 日韩一区二区三| 亚洲欧洲日本在线| 久久99精品一区二区三区三区| 99精品热视频| 精品国产乱码久久久久久图片 | 亚洲日穴在线视频| 在线看不卡av| 自拍视频在线观看一区二区| 欧美专区亚洲专区| 美女被吸乳得到大胸91| 国产日产精品1区| 久久99久久精品| 国产精品美日韩| 欧美日韩国产系列| 亚洲人成精品久久久久久| 日韩国产一区二| 欧美日本一区二区三区四区| 久久精品国产亚洲5555| 欧美电视剧免费全集观看| 亚洲午夜电影网| 欧美视频三区在线播放| 亚洲精品日日夜夜| 91小视频在线| 夜夜嗨av一区二区三区四季av| 色综合中文字幕国产 | 国产午夜亚洲精品不卡| 蜜桃精品在线观看| 国产精品久久久久婷婷| 成人性生交大片免费看中文网站| 26uuu欧美日本| 国产一区二区在线观看视频| 久久久久久久久久久电影| 国产一区二区中文字幕| 亚洲韩国一区二区三区| 国产三级精品三级| 欧美丰满少妇xxxxx高潮对白 | 91美女精品福利| 精品亚洲aⅴ乱码一区二区三区| 国产精品久久久久精k8| 精品国产乱码久久| 精品视频在线免费看| 免费观看久久久4p| 精品国产三级电影在线观看| 欧美中文字幕久久| 国产成人精品影视| 精品成人私密视频| 3d动漫精品啪啪| 人人狠狠综合久久亚洲| 国产精品久久久久久久久动漫| 欧美在线观看视频一区二区| 狠狠v欧美v日韩v亚洲ⅴ| 久久久久久久一区| 欧美视频中文字幕| 91美女蜜桃在线| 国产自产v一区二区三区c| 香港成人在线视频| 日韩欧美国产一二三区| 一本一道久久a久久精品 | 精品一区在线看| 亚洲在线免费播放| 国产成人综合在线播放| 亚洲成av人片一区二区| 最新国产の精品合集bt伙计| 日韩欧美国产1| 欧美日韩午夜在线| 91免费观看视频在线| 国产一区二区三区香蕉| 首页国产欧美久久| 樱花草国产18久久久久| 国产欧美一区二区在线观看| 久久久99免费| 精品久久久久av影院| 麻豆视频一区二区| 亚洲成人免费电影| 亚洲一区二区三区四区在线免费观看| 国产精品免费人成网站| 国产性做久久久久久| 欧美不卡激情三级在线观看| 欧美福利电影网| 8x8x8国产精品| 欧美疯狂做受xxxx富婆| 欧美美女一区二区| 色8久久人人97超碰香蕉987| 91亚洲精品久久久蜜桃| 99精品久久只有精品| 91麻豆视频网站| 色菇凉天天综合网| 色系网站成人免费| 欧洲国产伦久久久久久久| 99这里只有精品| 亚洲欧美一区二区三区久本道91| 久久影院午夜片一区| 精品国内片67194| 精品国产精品一区二区夜夜嗨| 欧美一区中文字幕| 日韩欧美在线不卡| 国产夜色精品一区二区av| 日本一区二区三区四区在线视频| 欧美国产一区二区| 中文字幕中文字幕一区| 亚洲免费伊人电影| 性欧美疯狂xxxxbbbb| 老司机一区二区| 麻豆精品一区二区三区| 久久av中文字幕片| 免费精品99久久国产综合精品| 激情综合网天天干| 国产99久久久精品| 免费观看日韩av| 国产在线精品视频| 在线观看日韩电影| 精品国内片67194| 国产精品午夜春色av| 一区二区三区高清不卡| 视频一区二区不卡| 国产一区999| 97久久精品人人爽人人爽蜜臀| 欧洲一区二区av| 在线综合视频播放| 日韩欧美的一区| 亚洲欧美日韩国产手机在线| 青青草国产成人av片免费| 国产激情一区二区三区桃花岛亚洲| 成人免费视频免费观看| 欧美色综合网站| 亚洲精品一区二区三区在线观看| 日本一区二区三区dvd视频在线| 一区二区三区中文字幕| 久久99精品久久久久久| 91精品办公室少妇高潮对白| 精品毛片乱码1区2区3区| 亚洲区小说区图片区qvod| 首页国产丝袜综合| 91丝袜高跟美女视频| 欧美成人vr18sexvr| 亚洲精品国久久99热| 久久精品国产**网站演员| 91性感美女视频| 久久精品欧美一区二区三区麻豆| 亚洲福利一二三区| 91在线观看地址| 精品久久久久久久久久久院品网 | 国产亚洲一二三区| 亚洲午夜一区二区三区| 国产一区二区三区黄视频| 欧美午夜精品久久久久久超碰| 久久精品亚洲乱码伦伦中文| 亚洲一区二区欧美激情| 国产精品77777| 欧美写真视频网站| 亚洲欧洲无码一区二区三区| 国产一区二区三区精品欧美日韩一区二区三区 | 奇米综合一区二区三区精品视频| 99久久久无码国产精品| 日韩亚洲欧美综合| 午夜私人影院久久久久| 色综合久久久久网| 国产精品人人做人人爽人人添| 水蜜桃久久夜色精品一区的特点| 色综合天天综合网天天狠天天| 亚洲精品在线观看网站| 亚洲在线视频网站| 91蝌蚪porny成人天涯| 国产精品国产自产拍在线| 国产黄色成人av| 久久天天做天天爱综合色| 久久国产剧场电影| 欧美一区二区三区四区视频| 亚洲午夜一区二区三区| 欧美色综合网站| 午夜精品久久久久久久蜜桃app| 91国偷自产一区二区开放时间 | 亚洲免费伊人电影| 欧美性生交片4| 亚洲一区在线观看免费| 欧美在线免费视屏| 亚洲高清免费视频| 8x8x8国产精品| 免费在线观看不卡| 欧美一区二区三区日韩视频| 日本不卡一区二区三区| 日韩视频免费观看高清完整版| 日韩高清一区在线| 亚洲精品一区二区三区香蕉| 国内精品视频一区二区三区八戒 | 亚洲五码中文字幕| 911精品国产一区二区在线| 亚洲国产成人精品视频| 欧美放荡的少妇| 捆绑调教美女网站视频一区|