这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 嵌入式开发 » MCU » 高手进!非以太网END驱动编写问题

共16条 1/2 1 2 跳转至

高手进!非以太网END驱动编写问题

菜鸟
2007-03-06 20:56:04     打赏

END驱动发送时,我们从MUX层得到的数据格式是一个完整的MAC帧,帧格式:

| 6字节目的MAC地址 | 6字节源MAC地址 | 1字节类型 | IP数据包 |

我现在新做一个END驱动,数据链路层采用的是HDLC。也就说没有MAC和ARP的概念了,替代是HDLC地址和控制位,也就是说不是以太网了。HDLC地址和控制位可以由驱动来实现。因此我需要从MUX得到的数据仅仅是一个IP数据包。然而我调试的时候,我从MBLK得到的数据始终是带有MAC头的。

如何才能使数据是一个完整的IP包,驱动函数配置的时候那些地方要改呢?




关键词: 高手     以太网     驱动     编写     问题    

菜鸟
2007-03-09 23:46:00     打赏
2楼

可以试试EPT类型的驱动结构


菜鸟
2007-03-12 17:01:00     打赏
3楼
END驱动难道实现不了?

菜鸟
2007-03-13 00:09:00     打赏
4楼
以下是引用fxhskwm在2007-3-9 15:46:00的发言:

可以试试EPT类型的驱动结构

刚才回去重新翻了一下vxworks network programmers guide,如你所说,似乎可以用NPT结构的网络驱动来完成。你说的EPT是不是NPT?但是做过NPT的人好像不过,网上也比较难找资料,看来还是得自己慢慢调试了。


菜鸟
2007-03-15 06:34:00     打赏
5楼

可以手动把包头去掉呀


菜鸟
2007-03-15 20:31:00     打赏
6楼

对的,就是NPT,NPT类型的驱动已经帮你把MAC去掉了,NPT存在的原因就是为了满足类似你那样的需要,好让你自己操控链路层的协议


菜鸟
2007-03-15 23:27:00     打赏
7楼

我看了一下似乎没有NPT的驱动模板,网络编程指南里说NPT驱动和END一样,就差这三个函数接口:
endAddressForm()
endAddrGet()
endPacketDataGet()

我已经实现了END,现在我想把它改到NPT。我在endDevTbl[ ]里把这些去掉就可以了?另外我还有哪些要改的?fxhskwm兄


菜鸟
2007-03-16 17:29:00     打赏
8楼

我也没弄过,只是知道有那么会事,帮不上了啦,兄弟


院士
2007-03-16 17:54:00     打赏
9楼
等待回复帖

菜鸟
2007-03-16 23:20:00     打赏
10楼

刚查了下资料:

The END is the original MUX network driver interface. ENDs are frame-oriented drivers that exchange frames with the MUX. The NPT-style drivers are packet-oriented drivers that exchange packets with the MUX. These packets are stripped of all datalink layer information. Currently, all network drivers supplied by Wind River are ENDs, as is the generic driver template defined in templateEnd.c. There is no generic template for an NPT driver.

Support for the NPT-style driver is part of a set of MUX extensions designed to facilitate the implementation of MUX-compatible network services. These extensions include a registration mechanism for an alternative address resolution utility and support for back ends that let you extend the sockets API so that applications can use sockets to access a new network service

END与NPT的收包函数区别:

After a driver is loaded in to the MUX and has been bound to a protocol, it can pass received packets up to the MUX by calling muxReceive( ), if it is an END, or muxTkReceive( ), in NPT drivers.

How ENDs and NPT Drivers Differ:

The NPT driver is a packet-oriented equivalent to the frame-oriented END. Both the NPT driver and the END are organized around the END_OBJ and the NET_FUNC structures, and both driver styles require many of the same entry points:

xLoad( ) - load a device into the MUX and associate a driver with the device

xUnload( ) - release a device, or a port on a device, from the MUX

xSend( ) - accept data from the MUX and send it on towards the physical layer

xMCastAddrDel( ) - delete a multicast address registered for a device

xMCastAddrGet( ) - get a list of multicast addresses registered for a device

xMCastAddrAdd( ) - add a multicast address to those registered for a device

xPollSend( ) - send packets in polled mode rather than interrupt-driven mode

xPollReceive( ) - receive frames in polled rather than interrupt-driven mode

xStart( ) - connect device interrupts and activate the interface

xStop( ) - stop or deactivate a network device or interface

xIoctl( ) - support various ioctl commands2

xBind( ) - exchange data with the protocol layer at bind time (optional)3

For the most part, the prototypes for these entry points are identical. The exceptions are the send and receive entry points.

  • NPT send entry points take these additional parameters:

  • a MAC address character pointer

  • a networks service type value

  • a void* pointer for any network service data the driver might need in order to prepare the packet for transmission on the physical layer

  • NPT receive entry points likewise take additional parameters:

  • a frame type

  • a pointer to the start of the network frame

  • a void* pointer for any addition network service data that is important to the protocol layer

The three END entry points not included in an NPT driver are:4

xAddressForm( ) - add addressing information to a packet

xAddrGet( ) - extract the addressing information from a packet

xPacketDataGet( ) - separate the addressing information and data in a packet

The above functions were removed from the NPT driver because they are frame-oriented and so irrelevant to a packet-oriented driver.

The following registration interface lets you manage an address resolution function for a protocol/interface pair.

muxAddrResFuncAdd( ) - add an address resolution function

muxAddrResFuncGet( ) - get the address resolution function for ifType/protocol

muxAddrResFuncDel( ) - delete an address resolution function

For Ethernet devices, the standard VxWorks implementation automatically assigns arpresolve( ) as the address resolution function. If you are writing an END that does not run over Ethernet, you also need to implement the xAddressForm( ), xAddrGet( ), and xPacketDataGet( ) entry points explicitly. ENDs running over Ethernet typically use the endLib implementations of these functions.


共16条 1/2 1 2 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]