monster204
驱动牛犊
驱动牛犊
  • 注册日期2005-02-24
  • 最后登录2005-08-21
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:836回复:0

pci驱动中的I.IoctlBuffer()问题

楼主#
更多 发布于:2005-03-24 13:25
我需要做一个pci驱动,采用pci9052控制器的PCI板。我一点基础也没有。用driverStudio做。pci板上有seeprom,是空的。我想先在驱动里实现一个功能,即读出PCI configuration register的内容,然后写seeprom。读写都用缓冲方式的ioctl。我找到了一部分实现读控制端口的驱动代码:
NTSTATUS Io_wrDevice::IOCTL_IO_READ_Handler(KIrp I)
{
NTSTATUS status = STATUS_SUCCESS;
t << \"Entering Io_wrDevice::IOCTL_IO_READ_Handler, \" << I << EOL;
// TODO: Verify that the input parameters are correct
// If not, return STATUS_INVALID_PARAMETER
PULONG ByteOffset;
PUCHAR temp;
ByteOffset=(PULONG)I.IoctlBuffer();
temp=(PUCHAR)I.IoctlBuffer(); //两个.IoctlBuffer是怎么区分的?是怎么传递进来的?


*temp=m_IO.inb(*ByteOffset);
// TODO: Handle the the IOCTL_IO_READ request, or
// defer the processing of the IRP (i.e. by queuing) and set
// status to STATUS_PENDING.
// TODO: Assuming that the request was handled here. Set I.Information
// to indicate how much data to copy back to the user.
I.Information() = 4;
return status;
}

对于缓冲的读方式,我有些地方不太懂:为了读PCI configuration register,我需要在应用程序的DeviceIoControl传递输出缓冲区首地址和大小;还有偏移地址,我猜想偏移地址从DeviceIoControl
的输入缓冲区首地址参数传递。我的问题是Kirp类实例I的成员函数IoctlBuffer()怎么同时传递输出缓冲区首地址和和偏移地址?
游客

返回顶部