cnhighway的专栏

1、 WINCE的网络驱动结构

1.1WINCE 网络结构

1)WINCE 的NDIS网络接口提供如下能力:

2)WINCE的网络结构图

从该通信结构中可以看到,所有的通信协议都使用NDIS WRAPPER 作为中介和下层的硬件绑定,实现各种不同的通信。

3)NDIS Wrapper的结构

The operating system providesprotocol drivers for TCP/IP, Point-to-Point Protocol (PPP), and Infrared DataAssociation (IrDA). A protocol driver exports a set ofProtocolXXXfunctions at its lower edge. It communicates with NDIS to send and receivenetwork packets and to bind to an underlying miniport network adapter driver orintermediate NDIS driver that exports aMiniportXXX interface atits upper edge.

Protocol drivers that communicate with underlying NDISdrivers call NDIS library functions to send and receive packets. To send apacket to an underlying NDIS driver, a protocol driver must call theNdisSendor NdisSendPacketsfunction. A protocol driver must call theNdisRequestfunction to forward a request to the underlying driver that it queries for thecapabilities or status of its network adapter or that it set the state of itsnetwork adapter.

An NDIS protocol driver can support Transport DriverInterface (TDI) at its upper edge, or it could export a private interface to ahigher-level kernel-mode driver, possibly through a transport stack of drivers,including one that supports TDI at the top of the stack. For example, an NDISprotocol driver can be the lowest module of a multi-module transportimplementation of a standard protocol, such as TCP/IP, with TDI support in thehighest module.

1.2 WINCE 中断结构

典型的中断流程如下:

The following list shows an example interrupt handling sequence:

If the kernel’s exception-trapping code receives a hardware interrupt and then the kernel detects an exception, the kernel handles the hardware interrupt. Otherwise, go to the next step.The kernel’s interrupt support handler notifies the ISR to disable the specific interrupt until the required handling completes. All other interrupts remain enabled.The exception handler calls the ISR to determine how to handle the interrupt.

NoteDetailsmay vary depending on the CPU architecture.

The kernel receives the return value from the ISR, which lets the kernel know what to do about the interrupt. The following table shows the possible responses from the kernel.

Response

Description

SYSINTR_NOP

The kernel does nothing.

SYSINTR_RESCHED

The interrupt was for the thread scheduling timer tick.

SYSINTR_XXX, logical interrupt value for that specific interrupt source.

The kernel triggers its interrupt support handler so the IST wakes up and does its work. Then the IST creates an event and then waits on it.

When the IST wakes up, the IST does whatever work it needs to do to handle the interrupt. This could mean moving data into a buffer or interpreting the data in some meaningful way.As needed, the IST calls various I/O routines to access the hardware to do its work.When the IST finishes its work, it notifies the kernel by calling InterruptDone.Thekernel calls the OAL function OEMInterruptDone to complete all handling for theinterrupt. The OAL notifies the hardware to re-enable the interrupt.

1.1MINIPORT接口介绍

1)MINIPORT 定义

Miniportdrivers directly manage network adapters that are installed on a device. At thelower edge, miniport drivers use NDIS to communicate with the adapter hardware.At the upper edge, miniport drivers present an interface to allow protocoldrivers to configure the adapter and to send and receive packets over thenetwork.

Windows CE currently supports miniport drivers for thefollowing medium types:

2)MINIPORT的主要工作

Typically, an NDIS miniport driver is a miniport NICdriver. An NDIS miniport driver the following two basic functions:

Manages a network interface card (NIC), including sending and receiving data through the NICInterfaces with higher-level drivers, such as intermediate drivers and transport protocol drivers

The following send and receive operations illustrate the interaction ofminiport NIC drivers with NDIS and with higher-level drivers:

When a transport driver has a packet to transmit, it calls an NdisXXXfunction exported by the NDIS library. NDIS then passes the packet to the miniport by calling the appropriateMiniportXXX function exported by the miniport. The miniport driver then forwards the packet to the NIC for transmission by calling the appropriateNdisXXX function. When a NIC receives a packet addressed to the NIC, it can post a hardware interrupt that is handled by NDIS or the NIC’s miniport. NDIS notifies the NIC’s miniport by calling the appropriateMiniportXXX function. The miniport sets up the transfer of data from the NIC and then indicates the presence of the received packet to bound higher-level drivers by calling the appropriateNdisXXX function.

3)Miniport驱动的加载

一个人行走,若是寂寞了,寻一座霓虹灯迷离闪烁,

cnhighway的专栏

相关文章:

你感兴趣的文章:

标签云: