跳至主要内容

【转】基于VxWorks的网络接口设计(二)

2.2 END设备驱动程序装载过程

  在VxWorks中,END设备驱动程序装载过程可以分为3个步骤,即指定END设备,装载END设备和启动END设备。END设备的指定是通过数组 endDevTbl[ ]来完成的,该数组描述了系统中的所有网络设备的装载人口点及其相关参数。系统调用MUX设备装载函数mux-DevLoad()来装载END设备,调用 MUX设备启动函数muxDevStart()来启动END设备。网络设备驱动程序的装载过程如图4所示。系统通过usrRoot()函数来调用 usrNetInit()函数完成MUX的初始化,装载网络设备表endDevTbl[ ]中描述的所有设备,并将IP协议绑定到网络引导设备上等。

设备驱动程序装载过程

  当网络设备产生中断时,VxWorks调用驱动程序先前注册的中断服务程序。中断服务程序应做尽可能少的工作,以完成将数据包从本地网络设备送出/取出的操作。

  2.3 文件配置

  由于RTL8019兼容NE2000网卡芯片,只需要在其基础上完成必要的修改。首先将Tornado2.2\target\src\drv\end目录下的ne2000End.c和Tornado2.2\target\h\dry\end目录下的ne2000End.h拷贝到bsp目录下,然后修改以下文件。

  (1) 修改ne2000End.C

①修改头文件包含目录;

②sysIntConnect修改为intConnect;
③sysLanIntEnable修改为intEnable,并修改返回类型void为STATUS。

  (2) 修改ne2000End.h

  将寄存器地址左移1位,如:

  #define ENE_RSTART(0x01<<1)

  (3) 修改config.h

  添加网络宏定义:

①#define INCLUDE_NETWORK
②#define INCLUDE_END
③#ifdef INCLUDE_END
#undef INCLUDE_SNGKS32C_END
#define INCLUDE_NE2000_END

评论

此博客中的热门博文

【转】smb协议栈使用示例

/*  * * uncdownload.c  * *  * * Utility for downloading files from SMB shares using libsmbclient  * *  * * Copyright(C) 2006 Sophos Plc, Oxford, England.  * *  * * This program is free software; you can redistribute it and/or modify it under the terms of the  * * GNU General Public License Version 2 as published by the Free Software Foundation.  * *  * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without  * * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  * * See the GNU General Public License for more details.  * *  * * You should have received a copy of the GNU General Public License along with this program; if not,  * * write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA  * *  * */ # include < sys / types . h > # include < sys / time . h > # include ...

【转】Ether Types

Ether Types (last updated 2008-09-09) NOTE: Please see [RFC5342] for current information and registration procedures. This registry will be revised soon and will be replaced with up-to-date information. Many of the networks of all classes are Ethernets (10Mb) or Experimental Ethernets (3Mb). These systems use a message "type" field in much the same way the ARPANET uses the "link" field. If you need an Ether Type, contact: IEEE Registration Authority IEEE Standards Department 445 Hoes Lane Piscataway, NJ 08854 Phone +1 732 562 3813 Fax: +1 732 562 1571 Email: <ieee-registration-authority& ieee.org > http://standards.ieee.org/regauth/index.html The following list of EtherTypes is contributed unverified information from various sources. Another list of EtherTypes is maintained by Michael A. Patton and is accessible at: <URL: http://www.cavebear.com/CaveBear/Ethernet/ > <URL: ftp://ftp.cavebear.com/pub/Ethernet-codes > Assign...

【转】udp编程实例

UDP通讯实例 2008-04-29 15:30:05 / 个人分类: linux C编程 UDP协议的几点好处: 1.UDP不要求保持一个连接; 2.UDP没有因接收方认可收到数据包(或者当数据包没有正确抵达而自动重传)而带来的开销; 3.设计UDP的目的是用于短应用和控制信息; 4.在一个数据包接一个数据包的基础上,UDP要求的 网络 带宽比TCP更小。 UDP的几个缺点: 1.程序员必须创建代码检测传输错误并进行重传(如果应用程序要求这样做); 2.程序员必须把大数据包分片。 code: <1> /* * sender.c--UDP protocol example */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> int port = 6789; int main() {     int socket_descrīptor;     int iter = 0;     char buf[80];     struct sockaddr_in address;     /* Initialize socket address structure for Interner Protocols */     bzero(&address, sizeof(address)); // empty data structure     address.sin_family = AF_INET;     address.sin_addr.s_addr = inet_addr("127.0.0.1");     address...