阅读:1242回复:10
50高分奖励能解决我的问题者
各位大虾:本人想用DriverStudio进行并行口EPP模式的WDM编程,选总线(bus)为none生成程序框架,我试图对程序更改,但不知对不对,请指教:
void ParportEppModeDevice::SerialWrite(KIrp I) { t << \"Entering ParportEppModeDevice::SerialWrite, \" << I << EOL; NTSTATUS status = STATUS_SUCCESS; KIoRange m_ParPortIos; NTSTATUS status1 = m_ParPortIos.Initialize( 0x378, // LPT1 Bus address TRUE, //InCpuIoSpace 8, // Device size TRUE // Map to system space ); #define CONTROL 2 //(37A) #define ADDRESS 3 //(37B) #define EDATA 4 //(37C) m_ParPortIos.outb(CONTROL,0x80); // Declare a memory object // KMemory Mem(I.Mdl()); // Use the memory object to create a pointer to the caller\'s buffer // PUCHAR pBuffer = (PUCHAR) Mem.MapToSystemSpace(); ULONG dwTotalSize = I.WriteSize(CURRENT); ULONG dwBytesSent = 0; m_ParPortIos.outb(ADDRESS,addr); //????????????????? m_DeviceIos.outb(EDATA,data); //???????????????????? // TODO: If the write can be satisfied immediately, set the Information // and Status fields now, then call NextIrp to complete this IRP // and start processing the next IRP in the queue. // TODO: If the device cannot accept all of the data yet, initiate a // request to the physical device here, and defer the Information, // Status, and NextIrp handling until the hardware indicates that // the write is complete. Typically, this might be handled in a // DPC that is called after the hardware finishes transferring // the data. // TODO: To satisfy the write now, transfer data to the device // from caller\'s buffer at \"pBuffer\". Then, indicate how much // data was transferred: I.Information() = dwBytesSent; I.Status() = status; // PnpNextIrp completes this IRP and starts processing // for the next IRP in the driver managed queue. // TODO: The Wizard creates a single queue for all Irps. // If you have created additional queues, select // the appropriate queue for this Irp here. m_DriverManagedQueue.PnpNextIrp(I); } 其中的 m_ParPortIos.outb(ADDRESS,addr); //????????????????? m_DeviceIos.outb(EDATA,data); //???????????????????? 部分更不知怎么处理,请指教,高分相谢. |
|
|
沙发#
发布于:2002-07-17 14:53
在本站有一篇相关的文章,在\"专栏文章\"
下 |
|
板凳#
发布于:2002-07-17 14:56
在本站有一篇相关的文章,在\"专栏文章\" 我看过,可就是不理解,你看懂了吗? 若能指教,一定重分奖励. |
|
|
地板#
发布于:2002-07-17 15:06
你说的是地址和数据的输入吧,在KIrp中有writedestsource(具体记不清了),可以将应用层的数据通过irp放到里面,你读里面的数据写到端口就是了.
(一般端口的读写都用Buffer方式) |
|
地下室#
发布于:2002-07-17 15:09
多找贴子看吧,本站上有很多关于并口的贴子,我也是新手
[编辑 - 7/17/02 by i11usi0n] |
|
5楼#
发布于:2002-07-17 15:13
你说的是地址和数据的输入吧,在KIrp中有writedestsource(具体记不清了),可以将应用层的数据通过irp放到里面,你读里面的数据写到端口就是了. 好兄弟,你的并口驱动不是做好了吗,将源码Email给我参考参考吧,先奖你10分,收到后再奖40分如何? |
|
|
6楼#
发布于:2002-07-17 18:56
能否也给我一份?我也给分!
wangxdong@163.net |
|
|
7楼#
发布于:2002-07-18 12:44
t << \"Entering Porttest1Device::Write, \" << I << EOL;
// TODO: Check the incoming request. Replace \"FALSE\" in the following // line with a check that returns TRUE if the request is not valid. if (FALSE) { // Invalid parameter in the Write request I.Information() = 0; return I.PnpComplete(this, STATUS_INVALID_PARAMETER); } // Always ok to write 0 elements. if (I.WriteSize() == 0) { I.Information() = 0; return I.PnpComplete(this, STATUS_SUCCESS); } NTSTATUS status = STATUS_SUCCESS; KMemory Mem(I.Mdl()); // Declare a memory object // Use the memory object to create a pointer to the caller\'s buffer PUCHAR pBuffer = (PUCHAR) Mem.VirtualAddress(); ULONG dwTotalSize = I.WriteSize(CURRENT); ULONG dwBytesSent = 0; KIoRange m_ParPortIos; NTSTATUS status1 = m_ParPortIos.Initialize( 0x378, // LPT1 Bus address TRUE, //InCpuIoSpace 8, // Device size TRUE // Map to system space ); if(status1!=STATUS_SUCCESS) { I.Information() = 0; return I.PnpComplete(this, STATUS_SUCCESS); } #define CONTROL 2 //(37A) #define ADDRESS 3 //(37B) #define EDATA 4 //(37C) m_ParPortIos.outb(CONTROL,0x80); m_ParPortIos.outb(ADDRESS,PUCHAR(pBuffer),dwTotalSize); dwBytesSent=dwTotalSize; // TODO: If the write can be satisfied immediately, set the Information // and Status fields now, then call NextIrp to complete this IRP // and start processing the next IRP in the queue. // TODO: If the device cannot accept all of the data yet, initiate a // request to the physical device here, and defer the Information, // Status, and NextIrp handling until the hardware indicates that // the write is complete. Typically, this might be handled in a // DPC that is called after the hardware finishes transferring // the data. // TODO: To satisfy the write now, transfer data to the device // from caller\'s buffer at \"pBuffer\". Then, indicate how much // data was transferred: I.Information() = dwBytesSent; return I.PnpComplete(this, status); 各位大虾,这样行不行啊 |
|
|
8楼#
发布于:2002-07-18 17:12
我也想知道这样行不行,因为我想改成串口的读写。不知有没有人调试过这个程序?
|
|
|
9楼#
发布于:2002-07-20 15:49
兄弟,你这几条语句不应该放在这里
KIoRange m_ParPortIos; NTSTATUS status1 = m_ParPortIos.Initialize( 0x378, // LPT1 Bus address TRUE, //InCpuIoSpace 8, // Device size TRUE // Map to system space ); 这怎么能够放在 Write()韩树中呢?应该放在OnStartDevice中分配一次就够了,否则每次写的时候都重新分配! |
|
|
10楼#
发布于:2002-07-22 09:56
兄弟,你这几条语句不应该放在这里 你说的有道理,谢谢!可惜没法给你分了,真不好意思. [编辑 - 7/22/02 by yunfangfan] |
|
|