HDLC WINCE6驱动设计

1、 WINCE的网络驱动结构

1.1  WINCE 网络结构

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

  • miniport 网卡驱动接口
  • 支持802.3(MAC),802.5(RING),IRDA
  • 支持广域网
  • 动态绑定网卡和Plug and Play
  • 支持同一个协议绑定多个网卡
  • 支持网卡的MediaSense

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 of
ProtocolXXXfunctions 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 a
MiniportXXX 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 the
NdisSendor NdisSendPacketsfunction. A protocol driver must call the
NdisRequestfunction 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:

  1. 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.
  2. The kernel‘s interrupt support handler notifies the ISR to disable the specific interrupt until the required handling completes. All other interrupts remain enabled.
  3. The exception handler calls the ISR to determine how to handle the interrupt.

Note   Detailsmay vary depending on the CPU architecture.

  1. 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.

  1. 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.
  2. As needed, the IST calls various I/O routines to access the hardware to do its work.
  3. 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.1  MINIPORT接口介绍

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:

  • Ethernet (802.3)
  • Token Ring (802.5)
  • IrDA
  • WAN

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 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-level drivers:

  • When a transport driver has a packet to transmit, it calls an NdisXXX
    function exported by the NDIS library. NDIS then passes the packet to the miniport by calling the appropriate
    MiniportXXX function exported by the miniport. The miniport driver then forwards the packet to the NIC for transmission by calling the appropriate
    NdisXXX 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 appropriate
    MiniportXXX 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 appropriate
    NdisXXX function.

3) Miniport驱动的加载

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 the
DriverEntry function, which creates an association betweenthe miniport driver and the NDIS library and registers the miniport with NDIS.

The following parameters are passed to the DriverEntry function:

  • A pointer to the driver object, which was created by the I/O system
  • A pointer to the registry path, which specifies where driver-specific parameters are stored

Within the context of DriverEntry, the miniport calls the
NdisMInitializeWrapper function, and then the
NdisMRegisterMiniport function.
DriverEntryfirst calls NdisMInitializeWrapper with the parameters that are 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需要实现的函数


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 that 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 MiniportReconfigure function as an internal driver function.


Not

Applicable


MiniportReset


Issues a hardware reset to the NIC.


Yes


MiniportReturnPacket


Receives a packet from an upper layer that was previously passed by a call to
NdisMIndicateReceivePacket.


No


MiniportSend


Transmits a packet through the NIC onto the network. Required if the driver has no
MiniportSendPackets 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 its initial state when the system is shut down.


No


MiniportSynchronizeISR


Synchronizes access to resources shared with MiniportISR or
MiniportDisableInterrupt.


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

时间: 2024-07-29 23:22:28

HDLC WINCE6驱动设计的相关文章

领域驱动设计-入门

领域驱动设计围绕着对象进行设计,类似于传统的OO,但是还是不同的. 传统的OO更像是贫血的领域对象,它具有数据,很多get set方法,但是缺少业务逻辑.客户端使用时,需要进行一大串的set操作.举个栗子: 这种方式中customer是一个贫血的领域对象,客户端必须进行很多的set,最后调用dao进行保存. --------------- 那么,怎样才是不贫血的领域对象呢?主要看两点:boundedcontext,通用领域语言. 领域对象是通过通用领域语言进行描述的,通用语言是领域专家和开发人员

我的“第一次”,就这样没了:DDD(领域驱动设计)理论结合实践

写在前面 插一句:本人超爱落网-<平凡的世界>这一期,分享给大家. 阅读目录: 关于DDD 前期分析 框架搭建 代码实现 开源-发布 后记 第一次听你,清风吹送,田野短笛:第一次看你,半弯新湖,鱼跃翠堤:第一次念你,燕飞巢冷,释怀记忆:第一次梦你,云翔海岛,轮渡迤逦:第一次认你,怨江别续,草桥知己:第一次怕你,命悬一线,遗憾禁忌:第一次悟你,千年菩提,生死一起. 人生有很多的第一次:小时候第一次牙牙学语.第一次学蹒跚学步...长大后第一次上课.第一次逃课.第一次骑自行车.第一次懂事.第一次和喜

初学DDD-领域驱动设计

这几天刚开始学习DDD,看了几篇大神的文章,现在只是知道了几个名词,还没有详细的学习.结合自己的工作经历,说说自己的看法,请各位大神多多指点. 最开始用的比较多的是以数据库表建立模型驱动开发.后来发现这种开发方式有很大的弊端:项目开始的时候,对业务分析不够明确,就开始建立数据库表,之后根据建好的表,来设计怎么去实现功能.这就导致开发过程中,经常会有字段冗余,表结构混乱,分工不明确,相似代码太多等问题.接着就会在项目开始之前,有意识的分析业务逻辑,理清楚一个项目的功能模块,拆分不同模块,对每个模块

DDD领域驱动设计基本理论知识总结

领域驱动设计之领域模型 加一个导航,关于如何设计聚合的详细思考,见这篇文章. 2004年Eric Evans 发表Domain-Driven Design –Tackling Complexity in the Heart of Software (领域驱动设计),简称Evans DDD.领域驱动设计分为两个阶段: 以一种领域专家.设计人员.开发人员都能理解的通用语言作为相互交流的工具,在交流的过程中发现领域概念,然后将这些概念设计成一个领域模型:由领域模型驱动软件设计,用代码来实现该领域模型:

(转载)浅谈我对DDD领域驱动设计的理解

原文地址:http://www.cnblogs.com/netfocus/p/5548025.html 从遇到问题开始 当人们要做一个软件系统时,一般总是因为遇到了什么问题,然后希望通过一个软件系统来解决. 比如,我是一家企业,然后我觉得我现在线下销售自己的产品还不够,我希望能够在线上也能销售自己的产品.所以,自然而然就想到要做一个普通电商系统,用于实现在线销售自己企业产品的目的. 再比如,我是一家互联网公司,公司有很多系统对外提供服务,面向很多客户端设备.但是最近由于各种原因,导致服务经常出故

WCF客户端配置以及代理-----基于DDD领域驱动设计的WCF+EF+WPF分层框架(4)

写在最前面:转载请注明出处 目录置顶: 关于项目--------------------基于DDD领域驱动设计的WCF+EF+WPF分层框架(1) 架构搭建--------------------基于DDD领域驱动设计的WCF+EF+WPF分层框架(2) WCF服务端具体实现---------基于DDD领域驱动设计的WCF+EF+WPF分层框架(3) WCF客户端配置以及代理-----基于DDD领域驱动设计的WCF+EF+WPF分层框架(4) Domain具体实现------------基于DD

什么是领域驱动设计(Domain Driven Design)?

本文是从 What is Domain Driven Design? 这篇文章翻译而来. ”…在很多领域,专家的作用体现在他们的专业知识上而不是智力上.“ -- Don Reinertsen 领域驱动设计(Domain Driven Design)是一种软件开发方法,目的是让软件系统在实现时准确的基于对真实业务过程的建模并根据真实业务过程的调整而调整. 传统的开发工作趋向于一种以技术为先导的过程,需求从业务方传递到开发团队,开发人员依据需求上的描述创造出最有可能的假想. 在瀑布开发过程中,这导致

领域驱动设计的面向服务架构

[.NET领域驱动设计实战系列]专题二:结合领域驱动设计的面向服务架构来搭建网上书店 一.前言 在前面专题一中,我已经介绍了我写这系列文章的初衷了.由于dax.net中的DDD框架和Byteart Retail案例并没有对其形成过程做一步步分析,而是把整个DDD的实现案例展现给我们,这对于一些刚刚接触领域驱动设计的朋友可能会非常迷茫,从而觉得领域驱动设计很难,很复杂,因为学习中要消化一个整个案例的知识,这样未免很多人消化不了就打退堂鼓,就不继续研究下去了,所以这样也不利于DDD的推广.然而本系列

DDD领域驱动设计之领域服务

1.DDD领域驱动设计实践篇之如何提取模型 2.DDD领域驱动设计之聚合.实体.值对象 3.DDD领域驱动设计之领域基础设施层 什么是领域服务,DDD书中是说,有些类或者方法,放实体A也不好,放实体B也不好,因为很可能会涉及多个实体或者聚合的交互(也可能是多个相同类型的实体),此时就应该吧这些代码放到领域服务中,领域服务其实就跟传统三层的BLL很相似,只有方法没有属性,也就没有状态,而且最好是用动词命名,service为后缀,但是真正到了实践的时候,很多时候是很难区分是领域实体本身实现还是用领域