现在的位置: 首页 > 综合 > 正文

WinCE5.0 SMDK2410 BSP在GEC2410开发板上的移植(16)-CS8900 NDIS Miniport driver简析(2)

2013年10月12日 ⁄ 综合 ⁄ 共 16186字 ⁄ 字号 评论关闭

4.NDIS51_MINIPORT_CHARACTERISTICS结构的其他handler
在DriverEntry里注册了其他一些handler,如CS8900Halt,CS8900HandleInterrupt等,下面来一一介绍:
(1)HaltHandler: CS8900Halt
MiniportHalt函数的入口:当网卡去除或者停止时该函数进行资源的释放.必须实现.
MiniportHalt is a required function that de-allocates resources when the network adapter is removed and halts the network adapter.):
因为我们的网卡一直存在,因此该函数没有做任何处理.

(2)HandleInterruptHandler:CS8900HandleInterrupt(在interrupt.c中实现)
中断服务线程IST,读取CS8900中断状态寄存器获取中断类型,当是接收中断时调用CS8900ReceiveEvent进一步处理.

(3)ISRHandler:CS8900Isr
中断服务例程ISR,这里只是一个空函数,具体处理由HandleInterruptHandler完成.
当中断发生时首先调用CS8900Isr,然后调用CS8900HandleInterrupt

(4)QueryInformationHandler:CS8900QueryInformation
MiniportQueryInformation函数的入口,必须实现,返回网卡及其驱动的状态及性能信息(如输入输出缓冲区大小,帧大小,传输速度等).
This function is a required function that returns information about the capabilities and status of the driver and/or its network adapter
支持的查询信息OID列表定义为:

CS8900QueryInformation代码如下:

(5)SetInformationHandler:CS8900SetInformation
MiniportSetInformation的入口函数,同MiniportQueryInformation相反,是协议驱动,NDIS要求改变miniport驱动为特殊对象保存的状态信息,比如多播地址的改变,也必须实现.
MiniportSetInformation is a required function that allows bound protocol drivers, or NDIS, to request changes in the state information that the miniport maintains for particular object identifiers, such as changes in multicast addresses.
这里实现了OID_802_3_MULTICAST_LIST,OID_GEN_CURRENT_PACKET_FILTER,OID_GEN_CURRENT_LOOKAHEAD这三个OID对象的重新设置.
代码如下:

(6)ResetHandler:CS8900Reset
MiniportReset的入口函数,网卡软硬件复位时指向的函数.
这里进行网卡的复位和初始化(resetCS,initCS)

(7)TransferDataHandler:CS8900TransferData
MiniportTransferData的入口函数,用在不支持WAN Media不使用NdisMIndicateReceivePacket来通知多包接收或者特定媒体信息的网卡驱动.必须实现.
This function is a required function in network adapter drivers that do not indicate multipacket receives and/or media-specific information with NdisMIndicateReceivePacket and in those that do not support WAN media.
这里我们也不需要,简单返回即可.

(8)CancelSendPacketsHandler:CS8900CancelSendPackets
     AdapterShutdownHandler:CS8900AdapterShutdown
     PnPEventNotifyHandler:CS8900DevicePnPEvent
这三个函数都只有一个框架,没有具体实现.具体内容可参考MS帮助.
其中PnPEventNotifyHandler是在NDIS51_MINIPORT_CHARACTERISTICS新增的,NDIS_MINIPORT_CHARACTERISTICS中没有.

 
   

抱歉!评论已关闭.