请教各位大虾:本人刚接触驱动开发,目前需要写一个PCI驱动加一个串口驱动
PCI驱动目前已经能正确获取基址,但是怎么加串口驱动比较合理?
1.可不可以通过一个驱动程序在AddDevice函数中通过IoCreateDevice来创建2个设备(PCI和COM),相当于2个驱动合在一起(读取PCI资源来配置COM相关寄存器)?
2.按2个驱动来做,先PCI驱动并创建串口设备,再把串口驱动挂在PCI上,这样就是2个驱动,我还不太了解怎么来分层调用驱动,希望各位高人给小弟一点指点,最好能详细一点,谢谢……
我现在很疑惑的一个问题
我在AddDevice函数内,创建了多个设备,我怎样在PC的设备管理器内体现出来???
我刚建了一个QQ群,希望有兴趣的朋友一起进来交流交流
QQ群号:3296443
你是要PCI中操作串口吗?
你用什么开发的DDK?DS?还是WDK啊?
PCI驱动获得PCI配置空间比较容易。
我认为在驱动里直接去打开Serial0,然后操作串口就可以了
建议你看看ddk的帮助。
Serial Device Control Requests
[This is preliminary documentation and subject to change.]
This section describes the following device control requests that Serial supports:
IOCTL_SERIAL_CLEAR_STATS
IOCTL_SERIAL_CLR_DTR
IOCTL_SERIAL_CLR_RTS
IOCTL_SERIAL_CONFIG_SIZE
IOCTL_SERIAL_GET_BAUD_RATE
IOCTL_SERIAL_GET_CHARS
IOCTL_SERIAL_GET_COMMSTATUS
IOCTL_SERIAL_GET_DTRRTS
IOCTL_SERIAL_GET_HANDFLOW
IOCTL_SERIAL_GET_LINE_CONTROL
IOCTL_SERIAL_GET_MODEM_CONTROL
IOCTL_SERIAL_GET_MODEMSTATUS
IOCTL_SERIAL_GET_PROPERTIES
IOCTL_SERIAL_GET_STATS
IOCTL_SERIAL_GET_TIMEOUTS
IOCTL_SERIAL_GET_WAIT_MASK
IOCTL_SERIAL_IMMEDIATE_CHAR
IOCTL_SERIAL_LSRMST_INSERT
IOCTL_SERIAL_PURGE
IOCTL_SERIAL_RESET_DEVICE
IOCTL_SERIAL_SET_BAUD_RATE
IOCTL_SERIAL_SET_BREAK_OFF
IOCTL_SERIAL_SET_BREAK_ON
IOCTL_SERIAL_SET_CHARS
IOCTL_SERIAL_SET_DTR
IOCTL_SERIAL_SET_FIFO_CONTROL
IOCTL_SERIAL_SET_HANDFLOW
IOCTL_SERIAL_SET_LINE_CONTROL
IOCTL_SERIAL_SET_MODEM_CONTROL
IOCTL_SERIAL_SET_QUEUE_SIZE
IOCTL_SERIAL_SET_RTS
IOCTL_SERIAL_SET_TIMEOUTS
IOCTL_SERIAL_SET_WAIT_MASK
IOCTL_SERIAL_SET_XOFF
IOCTL_SERIAL_SET_XON
IOCTL_SERIAL_WAIT_ON_MASK
IOCTL_SERIAL_XOFF_COUNTER
No other device control codes are supported.
I/O Status Block
The Information member is set to a request-specific value or to zero.
The Status member is set to a request-specific status value or to one of the following generic status values:
STATUS_SUCCESS
STATUS_BUFFER_SIZE_TOO_SMALL
The input or the output buffer is too small to hold the required information.
STATUS_CANCELLED
The client canceled the request. For all control codes other than IOCTL_SERIAL_GET_COMMSTATUS, Serial also cancels a request if a device error occurs and Serial is configured to cancel a request if there is a device error.
STATUS_DELETE_PENDING
There was an unrecoverable hardware error, or a Plug and Play remove or surprise remove operation is in progress.
STATUS_INVALID_DEVICE_REQUEST
The COM port is not open.
STATUS_INVALID_PARAMETER
The request parameters are not valid.
STATUS_PENDING
Serial queued the request for later processing.
STATUS_Xxx
An internal operation returned an NTSTATUS error status value.
If Serial does not support a device control request, it sets the Information member to zero and the Status member to STATUS_INVALID_PARAMETER.
感谢楼上的回答
我用WDK开发的,买了一块MCS9835的卡(2串口1并口)自己写一些驱动在上面操作!
现在是获取PCI配置空间读写串口寄存器没有什么问题,目前的问题是:
1.这2个串口怎么添加到设备管理器内?(例如设备管理器里出现COM3,COM4),我在AddDevice 内创建的3个设备用DeviceTree可以看到,但设备管理器里面没有,这个是怎么添加的,是利用INF文件内的[.RegHW]吗?
2.如果把2个串口和1个并口设备挂到PCI驱动上,那么IRP怎样转发,怎么获取PCI 配置空间并返回供串并口使用?这个是不是利用的“分层调用”,具体怎么来实现的?
希望各位高手能给我一点提示和一些解决方法,谢谢
没有研究这个卡
google上找到它的驱动和资料啊
我对PCI转串并口也比较感兴趣
能留个QQ 咱们交流
刚刚看了下我机器上的COM1口,你可以研究一下msports.inf 文件,然后把你的inf再相应改写一下,重新更新下设备看看.
帮你顶...