1, WinCE network drive structure
1.1 WINCE Network structure
1) The WINCE NDIS network interface provides the following capabilities:
- Miniport NIC Driver interface
- Support for 802.3 (MAC), 802.5 (RING), IRDA
- Support WAN
- Dynamically binding NIC and Plug and Play
- Supports multiple network adapters with one protocol
- MediaSense to support NIC
2) network structure diagram of wince
From this communication structure, it can be seen that all communication protocols use NDIS WRAPPER as intermediaries and lower-level hardware bindings to achieve various kinds of communication.
3) Structure of the NDIS wrapper
The operating system Providesprotocol drivers for TCP/IP, point-to-point Protocol (PPP), and infrared dataassociation (IrD A). 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 the underlying NDIS driver, a protocol driver must call Thendissendor ndissendpacketsfunction. A protocol driver must call thendisrequestfunction to forward a request to the underlying driver so it queries for Theca Pabilities or status of its network adapter or, 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 interf Ace to Ahigher-level Kernel-mode driver, possibly through a transport stack of drivers,including one and supports TDI at The top of the stack. For example, an NDISPROTOCOL driver can being the lowest module of a multi-module transportimplementation of a standard proto Col, such as TCP/IP, with TDI, Thehighest module.
1.2 WINCE Interrupt Structure
The typical interrupt flow is as follows:
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 comp Letes. All other interrupts remain enabled.
- The exception handler calls the ISR to determine how to handle the interrupt.
Note Detailsmay vary depending on the CPU architecture.
- The kernel receives the return value from the ISR, which lets the kernel know what does about the interrupt. The following table shows the possible responses from the kernel.
Response |
Description |
sysintr_nop |
the kernel does nothing. |
sysintr_resched |
the Interrup T is for the thread scheduling timer tick. |
sysintr_ XXX , logical interrupt value for that specific interrupt source. |
the kernel triggers it interrupt support handler so the IST wakes up and does it work. Then the IST creates a event and then waits on it. |
- When the ist is wakes up, the IST does whatever work it needs to does to handle the interrupt. This could mean moving data to a buffer or interpreting the data in some meaningful.
- As needed, the IST calls various I/O routines to access the hardware-do it work.
- When the IST finishes their work, it notifies the kernel by calling InterruptDone.
Thekernel calls the OAL functionOeminterruptdoneTo complete all handling for theinterrupt. The OAL notifies the hardware to re-enable the interrupt.
1.1 Miniport Interface Introduction
1) Miniport Definition
Miniportdrivers directly manage network adapters that is installed on a device. At Thelower Edge, miniport drivers use NDIS to communicate with the adapter hardware. At the upper edge, miniport drivers present a 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:
- Ethernet (802.3)
- Token Ring (802.5)
- Irda
- WAN
2) main work of miniport
Typically, an NDIS miniport driver is a miniport nicdriver. An NDIS miniport driver the following, basic functions:
- Manages a network interface card (NIC), including sending and receiving data through the NIC
- Interfaces 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-leve L Drivers:
- When a transport driver have a packet to transmit, it calls an NDISXXXfunction exported by the NDIS Libra Ry. NDIS 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's handled by NDIS or the Nic ' s M Iniport. NDIS notifies the NIC ' s miniport by calling the appropriateminiportXXX function. The miniport sets up the transfer's data from the NIC and then indicates the presence of the received packet to bound HIG Her-level drivers by calling the appropriateNdisXXX function.
3) Load of miniport driver
All NDIS miniport and intermediate drivers must provide a driverentry function. When a miniport driver isloaded, the operating system creates a driver object for the miniport Driverand calls theDriv Erentry function, which creates an association Betweenthe miniport driver and the NDIS library and registers the Mini Port with NDIS.
The following parameters is passed to the driverentry function:
- A pointer to the driver object, which is created by the I/O system
- A pointer to the registry path, which specifies where driver-specific parameters is stored
Within the context of DriverEntry, the miniport calls thendisminitializewrapper function, and then the ndismregisterminiport function. driverentryFirst calls Ndisminitializewrapper with the parameters that is passedto DriverEntry , which returns a wrapper handle. DriverEntry thenpasses the handle to Ndismregisterminiport.
The following illustration shows the process for registering a miniportdriver and initializing the NDIS library.
1) Miniport functions that need to be implemented
Function |
Description |
Asynchronous operation |
DriverEntry |
Called by the operating system to activate and initialize the miniport driver. |
Not applicable |
Miniportcheckforhang |
Checks the internal state of the NIC. |
No |
Miniportdisableinterrupt |
Disables the NIC from generating interrupts. |
No |
Miniportenableinterrupt |
Enables the NIC to generate interrupts. |
No |
Miniporthalt |
Deallocates and Deregisters resources for the NIC and halts, the NIC so, it is no longer functioning. |
No |
Miniporthandleinterrupt |
Deferred processing function called to complete interrupt-driven I/O processing. |
No |
Miniportinitialize |
Initializes the NIC. |
No |
Miniportisr |
Runs at a high priority as the interrupt service routine for the NIC. |
No |
Miniportqueryinformation |
Queries the capabilities and status of the miniport driver. |
Yes |
Miniportreconfigure |
Currently, the NDIS library never calls this function, but a miniportinitialize function can call a MINIPORTR Econfigure function as an internal driver function. |
Not Applicable |
Miniportreset |
Issues a hardware reset to the NIC. |
Yes |
Miniportreturnpacket |
Receives a packet from a upper layer is previously passed by a call toNdismindicatereceivepacket. |
No |
Miniportsend |
Transmits a packet through the NIC onto the network. Required if the driver has nominiportsendpackets or miniportwansend function. |
Yes |
Miniportsendpackets |
Transmits an array of packets through the NIC onto the network. |
Yes |
Miniportsetinformation |
Changes information about the miniport driver or its NIC. |
Yes |
Miniportshutdown |
Restores a NIC to it initial state, the system is shut down. |
No |
Miniportsynchronizeisr |
Synchronizes access to resources shared with Miniportisr orminiportdisableinterrupt. |
No |
Miniporttransferdata |
Copies the contents of a packet received by the NIC into a given packet buffer. |
Yes |
Miniportwansend |
Transmits a packet through the NIC onto the network. Required if the driver controls a WAN NIC. |
No |
HDLC WINCE6 Drive Design