VxWorks5.5 RTL81X9网卡驱动

合集下载

安装网卡驱动的方法

安装网卡驱动的方法

安装网卡驱动的方法安装网卡驱动的方法可以分为以下几个步骤:1. 获取正确的网卡驱动程序。

你可以在电脑网卡的生产商官方网站上下载对应的驱动程序,也可以使用电脑自带的驱动光盘。

2. 打开设备管理器。

在Windows系统中,可以按下Win + X键,选择“设备管理器”打开设备管理器。

3. 找到网卡设备。

在设备管理器中,展开“网络适配器”类别,找到你要安装驱动的网卡设备。

4. 右键点击网卡设备,选择“更新驱动程序”。

在弹出的菜单中,选择“自动搜索更新的驱动程序软件”。

5. 如果驱动程序已经在你的电脑上,系统会自动搜索并安装最新的驱动程序。

如果没有找到合适的驱动程序,你可以选择手动安装驱动程序。

6. 手动安装驱动程序。

当系统无法自动搜索到驱动程序时,你可以选择手动安装驱动程序。

在右键点击网卡设备后,选择“更新驱动程序”,然后选择“浏览我的计算机以查找驱动程序软件”。

7. 在弹出的对话框中,选择“让我从计算机上的可用驱动程序列表中选择”。

然后点击“浏览”按钮,找到你下载好的驱动程序所在的文件夹。

8. 选择正确的驱动程序。

在弹出的可选驱动程序列表中,选择你下载好的驱动程序,点击“下一步”进行安装。

9. 等待驱动程序安装完成。

系统会自动安装驱动程序,你只需要按照提示进行操作。

安装完成后,网卡设备应该被正确识别和驱动。

10. 重启电脑。

驱动程序的安装可能需要重启电脑,以确保驱动程序的正常运行。

安装完成后,你的网卡设备应该能够正常工作了。

如果仍然有问题,可以尝试重新安装驱动程序或者更新系统。

RTL8188CUS驱动程序移植笔记

RTL8188CUS驱动程序移植笔记

RTL8188CUS驱动程序ARM9移植笔记移植背景本人于2015年入手一块周公的AWorks Easy ARM开发板,这块开发板主控为IMX293 ARM9内核,使用的操作系统为Linux 2.35。

前段时间入手了一块全志H3的板子,这个板子带有WiFi网卡,可惜到手时官方并没有完成驱动程序的移植。

由于使用的网卡为RTL8189FTV,该芯片的驱动程序源码在网上怎么都找不到,折腾了几天未果,就从X宝上买了块USB无线网卡,主控为RTL8188CUS,之所以买这块网卡是因为官网有这块网卡的驱动,并且我在本机Ubuntu15.04系统中找到了该网卡的内核模块,所以我相信不管怎么样,它都是可以在linux系统下驱动起来的。

在折腾了两天,各种摸索的情况下终于把这块网卡在ARM9的板子上驱动起来了。

下面就我这次移植过程做个笔记,其中也包括近期的学习总结WiFi模块系统内核配置内核只能编译一次,内核模块要单独编译,否则版本字符串两者配不上就导致内核模块加载不成功。

源码的配置驱动程序测试1)通过网线连接至计算机,把计算机与开发板的IP地址设置为同一个网段计算机IP地址:192.168.1.12开发板IP地址:192.168.1.1002)开发板与计算机直接通过NFS连接并把驱动模块拷贝到开发板3)加载内核模块出现如下如下信息则加载成功rtw_macaddr_cfg MAC Address = 00:13:ef:60:06:19 bDriverStopped:1, bSurpriseRemoved:0, bup:0, hw_init_completed:0 _rtw_drv_register_netdev, MAC Address (if1) = 00:13:ef:60:06:19 usbcore: registered new interface driver rtl8192cu4)查看我们的USB无线网卡是否被系统激活执行:ifconfig发现只有一个网卡,并没有出现我们的USB无线网卡。

打通VxWorks调试环境 Step by Step(X86)

打通VxWorks调试环境 Step by Step(X86)

打通VxWorks调试环境Step by Step1 引言1.1 编写目的概要说明如何建立使用Tornado开发、调试VxWorks的环境(X86版本)。

1.2 背景1.3 定义HOST:主机,运行Tornado集成环境,FTP Server,Target Server,以及编辑、build工程、下载目标文件的各种软件工具;TARGET:目标机,HOST产生的vxWorks映像运行的位置,对于X86版本来说也是一台PC;TORNADO:C:\Tornado,安装Tornado的路径;BSPNAME:C:\Tornado\target\config\pc486,BSP的路径,本例中我们选择pc486;PROJECT:C:\Tornado\proj\Project2,我们自己创建的工程的路径;BIN:C:\Tornado\host\x86-win32\bin,Tornado的可执行程序的路径;HOME:C:\Tornado\host\x86-win32\bin,FTP用户的根目录。

1.4 参考资料Tornado User’s G uide (Windows Version), 2.0, Edition 1VxWorks Programmer’s Guide, 5.4, Edition 12 总体描述2.1 硬件环境HOST与TARGET通过以太网互连,并且位于同一网段;同时,串口通过直连电缆(NULL Modem Cable)连接。

目标机配置有软盘驱动器,网卡为3com 3c905B.2.2 软件环境主机操作系统为Windows 2000简体中文专业版(SP3);安装Tornado Version 2.0和Win 2k 补丁。

(CD No. TDK-12835-ZC-01 & TDK-13127-ZC-00, T2 LM for x86)2.3 预览在VxWorks调试环境中,HOST与TARGET之间连接的方式有多种,比如串口和网络;引导TARGET的方式也有多种,当然对X86平台来说最简单的是软盘引导了。

Linux下8019网卡驱动程序

Linux下8019网卡驱动程序

Linux下8019网卡驱动程序福建鑫诺通信有限公司陈光平(chenggp_fj@)本文以S3C44B0的CPU为例,详细解析了linux下RTL8019网卡驱动程序工作原理,其间知识大多来源互联网络,特别是浙大潘纲的论文,在此不一一列出,此文目的只是让嵌入式linux爱好者得到更多网卡驱动的资料,并获得交流机会,不足之处请指正(一)、硬件相关部份1、CPU与网卡的连接方式(s3c44B0 CPU) (RTL 8019网卡)CPU与网卡接线图上图为S3c44b0CPU和网卡的接线图,此接法并非固定,如接法不同,则牵涉到很多相应的改动,下面会详细分析不同之处从硬件部门得到:网卡在CPU的存储空间上接BANK4,即0x08000000(看44B0手册)外部中断号为:EXTINT3 (irqs.h文件获得值为22)上面两个值可以查CPU手册,或询问硬件设计人员由上图可以知道以下数据:(1)、网卡与CPU地址线连接错开8位(A0接A8)(2)、总共连线,其实4根就足够用了,因为每根线可以译码4个地址空间,总共是16个地址空间,每个地址空间对应一个寄存器地址,而8019总共就是16个寄存器(3)、一般是跳线模式,不使用9346芯片1-1 基地址算法首先8019的基地址是300H(见RTL8019芯片资料:选择IO总线地址),但是有些硬件已在芯片中做过了偏移,比如我们的网卡已做了处理,基址已偏移到0x08000000,那么因为网卡A0接CPU的A8,表示基地址左移8位,下一个寄存器reg0的地址就是:0x08000100(0000,0000,0001 0001,0000,0000)还不理解的话我们看另一种接法:(S3C44B0 CPU ) (RTL8019芯片) 这种接法地址线只错开一位,我们来看(假如仍使用BANK4):A1 A0,为何A0不能接A0,因为8019是共用数据线和地址线的,如果A0接A0的话,无法配置8位和16位方式现在可以看到,基地址为300H 的话,左移一位(A0->A1),就是600H,于是算出基地址为: 0x08000600,下一个寄存器的地址就是0x08000602,因为都左移一位,相当于x2了2、8019网卡的工作原理本节主要讨论一下8019是怎么工作的,如下图:(本地DMA ) (远端DMA )(图2 与DMA 有关的寄存器 )2-1 远端DMA 和本地DMA首先解释一下远端DMA 和本地DMA 的区别,以发送为例,网络发送数据是下面这样一个流程:CPU 将数据先发送到网卡上的16KRAM 中,这之间必须要有一个数据通道,我们称为远端DMA ,而数据从网卡的RAM 中发出给链路,RTL8019控制器与RAM 之间的通道称为本地DMA2-2 CPU 读写数据到网络芯片先解释一下上面提到的几个重要的寄存器,我们从上面分阶段说明:RBCR0,RBCR1:存放要读写数据的长度RSAR0,RSAR1:存放数据到网络芯片(RAM)中存放的起始地址(而不是页号,但通常还是以某页的00为开始,如0x4000)CR:向命令寄存器发出Remote DMA开始指令上面的流程后面会详细解说2-3 网络芯片发数据到以太网CPU把数据用Remote DMA发到网络芯片之后,就可以用让网络芯片用Local DMA向外数据了,需要设置如下的控制器:TPSR:网络芯片要发送的数据在网络芯片RAM中的起始页号,所以发送的数据只能从某页的开头存放。

VxWorks下网卡驱动程序的开发

VxWorks下网卡驱动程序的开发

VxWorks下网卡驱动程序的开发
高超; 郝燕玲; 吴润
【期刊名称】《《微计算机信息》》
【年(卷),期】2004(020)009
【摘要】本文首先从整体上分析VxWorks网卡驱动程序的原理和结构,然后深入地分析Rtl8139C网卡驱动程序的结构以及实现,本文对于VxWorks下的同类开发也有一定参考作用。

【总页数】3页(P10-11,18)
【作者】高超; 郝燕玲; 吴润
【作者单位】哈尔滨工程大学
【正文语种】中文
【中图分类】TP311.11
【相关文献】
1.基于VxWorks的SD卡驱动程序的设计与实现 [J], 贺小琳;张善从
2.基于VxWorks的CF卡驱动程序的研究与实现 [J], 高云;王冬;刘广武
3.VxWorks操作系统下CF卡驱动程序的开发 [J], 魏赫颖;钱亮;贾润
4.基于VxWorks的1553-pc104卡驱动程序的开发 [J], 张晓斌;杨伟;郑先成
5.VxWorks下LAN91C111网卡驱动程序的开发与分析 [J], 穆欣侃;李国祯
因版权原因,仅展示原文概要,查看原文内容请购买。

小硕vxworks网络驱动开发笔记(汇编)

小硕vxworks网络驱动开发笔记(汇编)

目录第1章操作系统基本概念 (3)1.1实时操作系统和分时操作系统的区别 (3)1.2嵌入式操作系统VxWorks简介 (4)1.3 VxWorks的特点 (5)1.3.1可靠性 (5)1.3.2实时性 (5)1.3.3 可裁减性 (5)1.3.4对一个实时内核的要求 (6)1.4 VxWorks的整体构架 (7)第2章vxWorks驱动开发预备 (7)2.1 VxWorks映像 (8)2.2 BSP主要文件目录的组成及作用: (11)2.3系统启动顺序 (13)2.4 Vxworks驱动概要 (17)第3章vxWorks 网络驱动开发 (20)3.1驱动类别 (21)3.2 Vxworks 下网络驱动开发 (24)3.3 VxWorks网络驱动配置及分析 (59)第4章VxWorks系统中常见问题 (64)前言在通信,电子领域,目前主流的嵌入式操作系统为linux 和vxworks。

Linux多用于消费电子产品,像大家熟悉的andriod,原始系统就是linux,也就是说andriod也是一种linux系统。

还有大家熟悉的MP3,也是使用linux 操作系统的。

Linux因为价格便宜(开源的,不需要付licence),稳定性好占据了一定的市场份额。

Vxworks是风河系统1983开发的一款嵌入式实时操作系统,多用于通信,导航,航天等领域。

因为这些领域对实时性要求非常高,比如现在LTE 系统就是使用vxworks系统,因为是采用TDD模式,而这种模式,显然对实时性要求非常高。

也就注定了vxwroks 在这些领域的特有优势。

选择linux还是vxworks看自己的专业方向,还有自己的兴趣所有。

每个领域只要研究透彻,都是很有前途的。

既然两者都是主流的嵌入式操作系统,其还是有很多相似性。

小编也初步接触过linux,发现具备一定的linux基础对日后深入学习vxworks很有好处,很多思想都是相似的。

另外,本人系小硕,目前的研究领域是vxworks驱动开发,主攻网络驱动开发。

VxWorks网络驱动配置及分析

VxWorks网络驱动配置及分析

VxWorks网络驱动配置及分析VxWorks支持两种形式的网络驱动,一种是BSD驱动支持通用的BSD4.4网络,API,结构等和大多数BSD网络的驱动类似.另一种是END 网络驱动,是VxWorks独有的,根据VxWorks MUX接口编程,不过END驱动在底层也要转换成BSD的形式.VxWorks网络驱动可参见VxWorks网络驱动1.BSD4.4网络驱动设置.网络设备驱动的调用主要在/target/src/config/usrNetwork.c文件中,下面说明BSD4.4驱动在VxWorks系统调用.主要调用过程如下:VxWorks系统执行的第一个任务target\config\all\usrConfig.c文件中 usrRoot()=======>>target\src\config\usrNetwork.c文件中的usrNetInit( )通过数组表netIf[]初始化相应的BSD网卡驱动.在usrNetwork.c中的调用过程如下:usrNetInit()函数中调用usrNetIfAttach():#ifdef INCLUDE_BSDif (!attached){if ( (usrNetIfAttach (pNetDev, params.unitNum, pBootString) !=OK))return (ERROR);attached = TRUE;}#endif /*INCLUDE_BSD*/usrNetIfAttach ()函数中调用数组表usrNetIfTblfor (pNif = usrNetIfTbl; pNif->ifName != 0; pNif++){if (strcmp (buf, pNif->ifName) == 0)break;}网络BSD驱动数组表usrNetIfTbl在文件/target/src/config/usrNetwork.c中的定义初始化:...LOCAL NETIF netIf [] = /* 网络接口,定义网卡驱动 */{/* 下面是定义包含的各种网络驱动 */#ifdef INCLUDE_DC /* 从DEC 芯片启动,即系统有NVRAM存在,现在已过时*/{ "dc", dcattach, (char*)IO_ADRS_DC, INT_VEC_DC, INT_LVL_DC,DC_POOL_ADRS, DC_POOL_SIZE, DC_DATA_WIDTH, DC_RAM_PCI_ADRS,DC_MODE },#endif /* INCLUDE_DC */#ifdef INCLUDE_FEI /* 如果定义了INCLUDE_FEI,初始化Intel 网卡 */{ "fei", feiattach, (char*)FEI_POOL_ADRS, 0, 0, 0, 0},#endif /* INCLUDE_FEI */#ifdef INCLUDE_EX /* Excelan 网卡 */{ "ex", exattach, (char*)IO_ADRS_EX, INT_VEC_EX, INT_LVL_EX,IO_AM_EX_MASTER, IO_AM_EX },#endif /* INCLUDE_EX */#ifdef INCLUDE_ENP /* CMC 网卡 */{ "enp", enpattach, (char*)IO_ADRS_ENP, INT_VEC_ENP, INT_LVL_ENP, IO_AM_ENP },#endif /* INCLUDE_ENP */...}设置方法:从以上可以看出BSD网络驱动只需在BSP配置文件config.h中将网络(#define INCLUDE_NETWORK)BSD网卡宏定义(#define INCLUDE_xxx)和一些I/O参数(一般不需要)加入,则在文件usrNetwork.c中进行相应的初始化.如: 在VxWorks加入支持intel的网卡驱动.在config.h中加入"#define INCLUDE_FEI".主要网卡定义如下:#define INCLUDE_ENE /* include Eagle/Novell NE2000 interface */#define INCLUDE_ELT /* include 3COM EtherLink III interface */ #define INCLUDE_ESMC /* include SMC 91c9x Ethernet interface */#define INCLUDE_FEI /* include Intel Ether Express PRO100B PCI */#define INCLUDE_ELC /* include SMC Elite16 interface */#define INCLUDE_EEX /* include INTEL EtherExpress interface */#define INCLUDE_EEX32 /* include INTEL EtherExpress flash 32 */#define INCLUDE_EX /* include Excelan Ethernet interface */ #define INCLUDE_ENP /* include CMC Ethernet interface*/#define INCLUDE_SM_NET /* include backplane net interface */ #define INCLUDE_SM_SEQ_ADDR /* shared memory network auto address setup */#define INCLUDE_EL_3C90X_END /* 3com fast etherLink XL PCI */#define INCLUDE_LN_97X_END /* AMD 79C972 END DRIVER */....2.END网络驱动设置.END网络设备的初始化主要通过定义在文件configNet.h中的一个数组表实现.初始化网络时muxDevLoad()会按这个表的定义把end初始化安装到VxWorks 系统.主要调用过程:VxWorks系统执行的第一个任务target\config\all\usrConfig.c文件中 usrRoot()=======>>target\src\config\usrNetwork.c文件(该文件初始化TCP/IP)中 usrNetInit(BOOT_LINE_ADRS)(该函数作用是添加MUX END)========>>pcooki = pCookie =muxDevLoad(pDevTbl->unit,.....)其中pDevTbl在BSP网络配置文件configNet.h中定义.END_TBL_ENTRY endDevTbl[]={...},该表定义了网络设备的具体参数.configNet.h部分定义如下所示:#define DEC_LOAD_FUNC dec21x40EndLoad /* 定义加载网络设备的入口程序*/#define DEC_BUFF_LOAN 1/* 网络设备硬件的物理定义数据串,一般BSP已经定义,不到必要时,无需更改*//** <devAdrs>:<PCIadrs>:<ivec>:<ilevel>:<numRds>:<numTds>:<memBase>: \ * <memSize>:<userFlags>*/# define DEC_LOAD_STRING"0x81020000:0x80000000:0x12:0x12:-1:-1:-1:0:0x80800000"IMPORT END_OBJ* DEC_LOAD_FUNC (char*, void*);/* 网络END设备表 */END_TBL_ENTRY endDevTbl [] ={ 0, DEC_LOAD_FUNC, DEC_LOAD_STRING, DEC_BUFF_LOAN, NULL, FALSE}, { 0, END_TBL_END, NULL, 0, NULL, FALSE},};设置方法:由以上可看出在VxWorks添加END网络驱动1.在文件config.h中添加"#define INCLUDE_NETWORK"和"#defineINCLUDE_END".2.在configNet.h中加入END驱动的入口函数"#definexxx_LOAD_FUNC xxxxxEndLoad"和一些相关的初始化字符串.这样就会在生成BSP包含END/MUX,系统网络初始化调用函数muxDevLoad()会更据这个表初始化END网络.文件configNet.c关于END驱动初始化的主要内容:#ifdef INCLUDE_ENDIMPORT int ipAttach ();IMPORT END_TBL_ENTRY endDevTbl[]; /* 定义这个表 */#endif /* INCLUDE_END */..........#ifdef INCLUDE_ENDint count;END_TBL_ENTRY* pDevTbl; /* END设备列表 */END_OBJ* pCookie = NULL;END_OBJ* pEnd;#endif /* INCLUDE_END */#if defined(INCLUDE_END)muxMaxBinds = MUX_MAX_BINDS; /* 初始化MUX接口 */if (muxLibInit() == ERROR)..........关于DEFAULT_BOOT_LINE 的解释这一行对配置网络,连通Target Server及下载调试程序非常重要DEFAULT_BOOT_LINE的原意是为没有NVRAM的target设计的,这样用户就不需要在每次系统启动是手工输入这些参数了.系统启动网络时xxxEndLoad()会解释这一行并按这一行的定义进行加载.Emac(0,0) : 启动设备,可是是软盘,硬盘,PCMCIA卡等其他的设备名称如:fd为软盘,(0,0)表示第一个软驱,3.5寸盘.dc则表示从DEC 21x4x 芯片启动,即系统有NVRAM存在,这种方式现在已不采用. elpci表示启动设备为3COM EtherLink XL PCI网卡.fei:Intel 82559 EtherExpress网卡.ene: NE2000网卡ELT: 3COM以太网卡EEX: Intel网卡ata: ATA/IDE 硬盘 ............405GP: 主机名vXworks从主机加载的VxWorks文件h=172.16.1.159 主机的IP地址e=172.16.254.52 目标机的IP地址,若网络启动Target Server时,这个IP必须和主机上Target Server配置的Target IP地址一致,且设置Back End选项为wdbrpcu=xxx 用户名,pw=xxx 密码: 若通过网络加载调试时,主机的Ftp服务器和目标机的用户名和密码必须相同tn=vxTarget 目标机名称*/#define DEFAULT_BOOT_LINE \"Emac(0,0)405GP:vxWorks h=172.16.1.159 e=172.16.254.52 \u=xxx pw=xxx tn=vxTarget"高智商学生 ( Thu, 1 Jun 2006 20:32:04 +0800 )Description:某日,老师在课堂上想看看一学生智商有没有问题,问他:“树上有十只鸟,开枪打死一只,还剩几只?”他反问:“是无声手枪或别的无声的枪吗?”“不是。

基于 VxWorks 的网卡驱动程序开发

基于 VxWorks 的网卡驱动程序开发

基于 VxWorks 的网卡驱动程序开发张宇坤;袁冬莉;黄鑫鑫;姚建勋【摘要】VxWorks 是一种运行在目标机上的可剪裁的高性能嵌入式实时操作系统,集成了标准 TCP/ IP 网络功能。

但其支持的网卡型号有限,限制了网络资源的使用,网络驱动开发就显出其重要性。

VxWorks 特有的增强网络驱动(END)包含有一个多路复用层模块(MUX)将驱动程序细化,这个模块赋予了驱动独立性,使得开发者专注于驱动本身的开发,因此选择使用这种驱动模式为 intel82567网卡成功实现驱动。

这种特有的驱动模式在应用的过程中确实体现出其高效性,不用关心底层的转换和协议处理,对需要进行短周期 END 型网络驱动的开发有参考价值。

%VxWorks is a scalable embedded real-time operating system with great performance,which is run in the target. And the stand-ard TCP/ IP protocol is integrated within the system. As only a few network adapters support the system,which limits the use of cyber source,the designing of network driver in VxWorks systems becomes vital. The MUX included in END is able to refine the driver pro-gram,which helps the designer to focus on developing the driver and gives the drive independence,so use this driving mode for successful implementation of intel82567 NIC driver. This special driving mode reflects the efficiency in the application process with no care about the underlying drive conversion and protocol processing,and may have a reference value for the short period designingof END.【期刊名称】《计算机技术与发展》【年(卷),期】2013(000)001【总页数】4页(P18-20,24)【关键词】VxWorks;END 网络驱动;intel82567【作者】张宇坤;袁冬莉;黄鑫鑫;姚建勋【作者单位】西北工业大学自动化学院,陕西西安 710129;西北工业大学自动化学院,陕西西安 710129;西北工业大学自动化学院,陕西西安 710129;西北工业大学自动化学院,陕西西安 710129【正文语种】中文【中图分类】TP316.20 引言VxWorks操作系统有着良好的可靠性和卓越的实时性,经常应用在航天航空等高精尖技术的领域中[1],因此将其作为航空半物理仿真软件平台。

RTL8139 驱动程序解析

RTL8139 驱动程序解析
return 0;
}
这以前解释过到,当缓冲区用完时必须通知上层不要再送封包下来了。
rtl8139_set_rx_mode
这个函数用来设定接收的模式,8139 提供了 64 组 MAC 位址 filter。只有符合这些 filter 的位址芯片才会用中断通知 CPU 前来处理,一般状态下,我们只接收和 8139 本身 MAC 相符的封包。只有在像 tcpdump 之类的程序中才会想要接收其它的封包。
RTL_W32 (TxStatus0 + (entry * sizeof (u32)),
tp->tx_flag | (skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN));
这一段程序用来设定封包的长度,一个正确的 ethernet 封包必须至少有 64 位元组长。不幸的,8139 不管这件事,你设定多长它就送多少。上面这一行程序就在确定封包的长度至少有 ETH_ZLEN。
举个例说,如果你要调用第 100 号暂存器,你可以使用
unsigned int *ap = (unsigned int *) mmio_start + 0x100;
printf("register 0x100 = %x\n", *ap);
接下来我们一一解释这些函数。
开始装置-- rtl8139_open
接收到封包,呼叫 rtl8139_rx_interrupt
传送完一个封包,呼叫 rtl8收到一个封包时,我们必须通知上层协定前检处理
skb = dev_alloc_skb (pkt_size + 2);
if (skb) {

VxWorks 驱动程序安装指南说明书

VxWorks 驱动程序安装指南说明书

Document: CTI_SIO_Install Revision: 1.01Date: January 4, 2010 VxWorksDriver InstallationVxWorks Driver Installation1.H ISTORY (3)2.H ARDWARE R EQUIREMENTS (4)3.D RIVER F ILES (4)4.C ONFIGURATION (4)4.1. BSP Files (4)4.1.1. config.h (4)4.1.1.1. INCLUDE_CTI_U550 (4)4.1.1.2. INCLUDE_CTI_U650 (5)4.1.1.3. INCLUDE_CTI_U850 (5)4.1.1.4. INCLUDE_CTI_EXAR17XX5XPCI (5)4.1.1.5. CTI_PCI_MAXBOARDS (5)4.1.1.6. CTI_PCI_MAXCHANS (5)4.1.1.7. INCLUDE_CTI_AUTO485POLLER (5)4.1.1.8. CTI_DEFAULT_BAUD (6)4.1.1.9. CTI_AUTO485SWITCHBAUD (6)4.1.1.10. CTI_AUTO485POLLER_DELAY (6)4.1.1.11. CTI_SYS_PCI_INTCONNECT() (6)4.1.1.12. CTI_SYS_INTCONNECT() (6)4.1.1.13. CTI_SYS_INTENABLE() (7)4.1.1.14. CTI_SYS_IN_BYTE() (7)4.1.1.15. CTI_SYS_OUT_BYTE() (7)4.1.1.16. CTI_SYS_IN_WORD() (8)4.1.1.17. CTI_SYS_OUT_WORD() (8)4.1.1.18. CTI_SYS_IN_LONG() (8)4.1.1.19. CTI_SYS_OUT_LONG() (9)4.1.2. sysLib.c (9)4.1.2.1. sysHwInit() (9)4.1.2.2. sysHwInit2() (10)4.2. Driver Files (10)4.2.1. sysCTISerial.c (10)4.2.1.1. Storage (10)4.2.1.2. Configuration (11)4.2.1.3. Interrupts (12)4.2.1.4. Enumeration (13)4.3. Tornado Projects (14)4.3.1. Connect Tech Inc. SIO (14)4.3.2. Use alternate base name (14)5.E XAMPLES (14)5.1. pcP3CTI_1 (14)5.2. pcP3CTI_2 (14)5.3. pcP3CTI_3 (15)6.I NSTALLATION C HECKLIST (16)1. HistoryOriginal draft.Added installation checklist.Added 3rd sample BSP.Fixed minor mistakes.Adapted for both Tornado and Workbench builds.2. Hardware RequirementsThis driver supports the following products:Xtreme/104 switchableXtreme/104 232BlueStorm/LPXtreme/104-Plus3. Driver FilesCopy the following files into your BSP directory (<WIND_INST>\target\config\<BSP_NAME>):00cti.cdfctiSio.cctiSio.hsysCTISerial.cusrCTISerial.c4. Configuration4.1. BSP FilesThe following files should be modified to support the CTI SIO driver. These modifications can be done in any other way as appropriate, but the following are suggestions made based on the Pentium III BSP. For sample modified files, refer to the files (of the same name) located within the driver distribution package. Sample files are from the Pentium III BSP. Note; file names and locations of information may differ in your BSP.<WIND_INST>\target\config\<BSP_NAME>\config.h<WIND_INST>\target\config\<BSP_NAME>\sysLib.cThe sample files included with the driver package should not be copied over any files in your BSP. These sample files are included only so that you can see the required changes in the context of complete files.4.1.1.config.hAdd a section to your config.h file so that there is a place for the driver options. If your config.h has an “if-def” block used to determine when to define INCLUDE_PCI, it is advised that you place this new section above that “if-def” block. This suggestion is made so that the “if-def” section can be modified to define INCLUDE_PCI when needed by any included CTI boards. The section for CTI driver configuration should surrounded by a check forINCLUDE_CTI_SIO being defined.For example:/* Connect Tech Inc. serial driver options */#if defined(INCLUDE_CTI_SIO)#define INCLUDE_CTI_U550/* support for 550 UARTs */#endif/* defined(INCLUDE_CTI_SIO) */A complete list of the available configuration options follows:4.1.1.1.INCLUDE_CTI_U550Define INCLUDE_CTI_U550 to include support for Xtreme/104 products that utilize 550 UARTs. This can be determined by examining the UART chips on the Xtreme/104 board itself, or by contacting CTI support staff.Usage:#define INCLUDE_CTI_U5504.1.1.2.INCLUDE_CTI_U650Define INCLUDE_CTI_U650 to include support for Xtreme/104 products that utilize 650 UARTs. This can be determined by examining the UART chips on the Xtreme/104 board itself, or by contacting CTI support staff.Usage:#define INCLUDE_CTI_U6504.1.1.3.INCLUDE_CTI_U850Define INCLUDE_CTI_U850 to include support for Xtreme/104 products that utilize 850 UARTs. This can be determined by examining the UART chips on the Xtreme/104 board itself, or by contacting CTI support staff.Usage:#define INCLUDE_CTI_U8504.1.1.4.INCLUDE_CTI_EXAR17XX5XPCIDefine INCLUDE_CTI_EXAR17XX5XPCI to include support for BlueStorm/LP and Xtreme/104-Plus products. You should also include you BSP’s PCI support if these pr oducts are to be used.Usage:#define INCLUDE_CTI_EXAR17XX5XPCI4.1.1.5.CTI_PCI_MAXBOARDSCTI_PCI_MAXBOARDS is used to define the maximum number of CTI PCI boards that can be enumerated. If not defined the default is 1.Usage:#define CTI_PCI_MAXBOARDS X/* where X is the maximum number of boards */4.1.1.6.CTI_PCI_MAXCHANSCTI_PCI_MAXCHANS is used to define the maximum number of serial channels that can be used by enumerated CTI PCI devices. This number is not the maximum per CTI PCI device, it is the maximum total number of channels across all CTI PCI devices. If not defined the default is 8.Usage:#define CTI_PCI_MAXCHANS X/* where X is the maximum number of channels */4.1.1.7.INCLUDE_CTI_AUTO485POLLERWhen using half-duplex RS485, the receiver and transmitter need to be toggled on and off depending on whether data is being sent or received. On CTI products that do not utilize UARTs with the capability to do this automatically, the driver must perform the toggling.This can be done in one of two ways; Using the interrupt service routine (ISR) of thechannel; Using a watchdog timer as a poller. In order to use the watchdog timerINCLUDE_CTI_AUTO485POLLER must be defined.Usage:#define INCLUDE_CTI_AUTO485POLLER4.1.1.8.CTI_DEFAULT_BAUDCTI_DEFAULT_BAUD is used to define the default baud rate when the serial channels are initialized. If not defined the default is 9600.Usage:#define CTI_DEFAULT_BAUD X/* where X is the default baud rate in bps */4.1.1.9.CTI_AUTO485SWITCHBAUDWhen using the CTIAUTO485SWITCHED auto 485 direction control method,CTI_AUTO485SWITCHBAUD defines the baud rate used to switch between ISR and poller methods. When the baud rate is less than CTI_AUTO485SWITCHBAUD the ISR method is used, else the poller method is used. If not defined the default is 9600.Usage:#define CTI_AUTO485SWITCHBAUD X/* where X is the baud rate in bps */4.1.1.10.CTI_AUTO485POLLER_DELAYWhen the poller auto 485 direction control method is being used a watchdog timerperforms a polling operation to look for the end of a transmit. This watchdog timer is set to expire every CTI_AUTO485POLLER_DELAY ticks. If not defined the default is 1.Usage:#define CTI_AUTO485POLLER_DELAY X/* where X is the delay in ticks */4.1.1.11.CTI_SYS_PCI_INTCONNECT()The CTI_SYS_PCI_INTCONNECT() macro is used to connect a PCI device interrupt to an interrupt service routine. The default definition of this macro uses pciIntConnect().Usage:/** _intLevel_ - interrupt level to connect _isr_ to* _isr_ - interrupt service routine to connect to _intLevel_* _arg_ - argument to be passed to _isr_* _result_ - STATUS result of the macro*/#define CTI_SYS_PCI_INTCONNECT(_intLevel_, _isr_, _arg_, _result_) \{ \/* place desired code here */ \}4.1.1.12.CTI_SYS_INTCONNECT()The CTI_SYS_INTCONNECT() macro is used to connect a device interrupt to an interrupt service routine. The default definition of this macro uses intConnect().Usage:/** _intLevel_ - interrupt level to connect _isr_ to* _isr_ - interrupt service routine to connect to _intLevel_* _arg_ - argument to be passed to _isr_* _result_ - STATUS result of the macro*/#define CTI_SYS_INTCONNECT(_intLevel_, _isr_, _arg_, _result_) \{ \/* place desired code here */ \}4.1.1.13.CTI_SYS_INTENABLE()The CTI_SYS_INTENABLE() macro is used to enable an interrupt level. The defaultdefinition of this macro uses sysIntEnablePIC().Usage:/** _intLevel_ - interrupt level to enable* _result_ - STATUS result of the macro*/#define CTI_SYS_INTENABLE(_intLevel_, _result_) \{ \/* place desired code here */ \}4.1.1.14.CTI_SYS_IN_BYTE()The CTI_SYS_IN_BYTE() macro is used to read an 8 bit value. The default definition of this macro uses sysInByte() for port I/O and does a direct assignment for memory I/O.Usage:/** _ioMode_ - I/O mode (CTIIOPORT or CTIIOMEM)* _address_ - address to read from* _value_ - receives 8 bit value read from _address_*/#define CTI_SYS_IN_BYTE(_ioMode_, _address_, _value_) \{ \if((_ioMode_) == CTIIOPORT) { \/* place port I/O code here */ \} \else { \/* place memory I/O code here */ \} \}4.1.1.15.CTI_SYS_OUT_BYTE()The CTI_SYS_OUT_BYTE() macro is used to write an 8 bit value. The default definition of this macro uses sysOutByte() for port I/O and does a direct assignment for memory I/O.Usage:/** _ioMode_ - I/O mode (CTIIOPORT or CTIIOMEM)* _address_ - address to write to* _value_ - 8 bit value to write to _address_*/#define CTI_SYS_OUT_BYTE(_ioMode_, _address_, _value_) \{ \if((_ioMode_) == CTIIOPORT) { \/* place port I/O code here */ \} \else { \/* place memory I/O code here */ \} \}4.1.1.16.CTI_SYS_IN_WORD()The CTI_SYS_IN_WORD() macro is used to read a 16 bit value. The default definition of this macro uses sysInWord() for port I/O and does a direct assignment for memory I/O.Usage:/** _ioMode_ - I/O mode (CTIIOPORT or CTIIOMEM)* _address_ - address to read from* _value_ - receives 16 bit value read from _address_*/#define CTI_SYS_IN_WORD(_ioMode_, _address_, _value_) \{ \if((_ioMode_) == CTIIOPORT) { \/* place port I/O code here */ \} \else { \/* place memory I/O code here */ \} \}4.1.1.17.CTI_SYS_OUT_WORD()The CTI_SYS_OUT_WORD() macro is used to write a 16 bit value. The default definition of this macro uses sysOutWord() for port I/O and does a direct assignment for memory I/O.Usage:/** _ioMode_ - I/O mode (CTIIOPORT or CTIIOMEM)* _address_ - address to write to* _value_ - 16 bit value to write to _address_*/#define CTI_SYS_OUT_WORD(_ioMode_, _address_, _value_) \{ \if((_ioMode_) == CTIIOPORT) { \/* place port I/O code here */ \} \else { \/* place memory I/O code here */ \} \}4.1.1.18.CTI_SYS_IN_LONG()The CTI_SYS_IN_LONG() macro is used to read a 32 bit value. The default definition of this macro uses sysInLong() for port I/O and does a direct assignment for memory I/O.Usage:/** _ioMode_ - I/O mode (CTIIOPORT or CTIIOMEM)* _address_ - address to read from* _value_ - receives 32 bit value read from _address_*/#define CTI_SYS_IN_BYTE(_ioMode_, _address_, _value_) \{ \if((_ioMode_) == CTIIOPORT) { \/* place port I/O code here */ \} \else { \/* place memory I/O code here */ \} \}4.1.1.19.CTI_SYS_OUT_LONG()The CTI_SYS_OUT_LONG() macro is used to write a 32 bit value. The default definition of this macro uses sysOutLong() for port I/O and does a direct assignment for memory I/O.Usage:/** _ioMode_ - I/O mode (CTIIOPORT or CTIIOMEM)* _address_ - address to write to* _value_ - 32 bit value to write to _address_*/#define CTI_SYS_OUT_LONG(_ioMode_, _address_, _value_) \{ \if((_ioMode_) == CTIIOPORT) { \/* place port I/O code here */ \} \else { \/* place memory I/O code here */ \} \}4.1.2.sysLib.cAdd a section to your sysLib.c file that includes the file sysCTISerial.c. This file includes the CTI SIO driver and defines routines used to configure the CTI serial channels. This section should come after the PCI configuration files have been included and should be surrounded by a check for INCLUDE_CTI_SIO being defined.For example:#if defined(INCLUDE_CTI_SIO)#include "sysCTISerial.c"#endif/* defined(INCLUDE_CTI_SIO) */In addition to including the driver and driver configuration routines, the routines sysHwInit() and sysHwInit2() need to be modified to call the serial configuration routines defined in sysCTISerial.c.4.1.2.1.sysHwInit()During sysHwInit(), sysCTISerialHwInit() should be called to initially configure the CTIserial channels. This call should be made after any PCI initialization in order for CTI PCI adapters to be configured.For example:#if defined(INCLUDE_CTI_SIO)sysCTISerialHwInit();#endif/* defined(INCLUDE_CTI_SIO) */4.1.2.2.sysHwInit2()During sysHwInit2(), sysCTISerialHwInit2() should be called to connect and enableinterrupts used by the CTI serial channels.For example:#if defined(INCLUDE_CTI_SIO)sysCTISerialHwInit2();#endif/* defined(INCLUDE_CTI_SIO) */4.2. Driver FilesThe file sysCTISerial.c, which is included into sysLib.c, needs to be configured to properly match the setup of your system.4.2.1.sysCTISerial.csysCTISerial.c contains rountines used to configure any CTI serial adapters you have. The configuration includes:storage for board and channel structuresboard/channel configuration and initializationinterrupt connecting and enablingchannel enumerationThe code in this section is only meant to serve as a short example. For a more complete sample refer to the sample BSP’s provided with the driver files. For a description of routine parameters refer to the documentation for that routine.4.2.1.1.StorageEach board and channel must have a corresponding structure allocated for it. This istypically done by declaring local variables in the file sysCTISerial.c.Typically one board structure (CTI_BOARD) is defined for each non-PCI CTI adapter.For example:LOCAL CTI_BOARD ctiXt1Board;LOCAL CTI_BOARD ctiXt2Board;For each of the non-PCI adapters, an array of channel structures should be defined aswell. The size of these arrays depends on the number of channels supported by theadapters.For example:LOCAL CTI_CHAN ctiXt1Chans[8];LOCAL CTI_CHAN ctiXt2Chans[4];For PCI adapters, only one instance of CTI_PCI_DEVICESET need be defined. The maximum number of supported adapters and channels should be defined with CTI_PCI_MAXBOARDS and CTI_PCI_MAXCHANS (see section 4.1.1 - config.h for more information onCTI_PCI_MAXBOARDS and CTI_PCI_MAXCHANS).For example:#if defined(INCLUDE_PCI)LOCAL CTI_PCI_DEVICESET ctiPciDevset;#endif/* defined(INCLUDE_PCI) */4.2.1.2.ConfigurationDuring sysHwInit() sysCTISerialHwInit() should be called. This is where the board andchannels structures declared in the previous section are configured and initialized.Each non-PCI board structure should be configured using ctiBoardConfig() and initialized using ctiBoardHrdInit().PCI adapters should be enumerated and initialized using ctiPciConfig() and ctiPciHrdInit().For example:void sysCTISerialHwInit(void){if(OK == ctiBoardConfig(&ctiXt1Board,CTIU650,CTIIOPORT,0x300,0x340, /* 0 if status port not being used */0x05,7372800,4, /* 1 if using extended baud rates */ctiXt1Chans,8,NULL,NULL,0xFF)){if(sysBp) {ctiBoardHrdInit(&ctiXt1Board);}}if(OK == ctiBoardConfig(&ctiXt2Board,CTIU850,CTIIOPORT,0x200,0x240, /* 0 if status port not being used */0x0A,7372800,4, /* 1 if using extended baud rates */ctiXt2Chans,4,NULL,NULL,0xF)){if(sysBp) {ctiBoardHrdInit(&ctiXt2Board);}}#if defined(INCLUDE_PCI)if(OK == ctiPciConfig(&ctiPciDevset, NULL, NULL)) {if(sysBp) {ctiPciHrdInit(&ctiPciDevset);}}#endif/* defined(INCLUDE_PCI) */}4.2.1.3.InterruptssysCTISerialHwInit2() should be called during sysHwInit2() and is responsible for connecting and enabling interrupts used by the CTI adapters.The operations of connecting an interrupt to an interrupt service routine as well asenabling the interrupt have been encapsulated into driver rountines ctiBoardIntConnect() and ctiPciIntConnect(). The behaviour of these routines is controlled by the macrosCTI_SYS_INTCONNECT(), CTI_SYS_PCI_INTCONNECT(), and CTI_SYS_INTENABLE(). These macros can be redefined from their default behaviour. See section 4.1.1 - config.h formore information on CTI_SYS_INTCONNECT(), CTI_SYS_PCI_INTCONNECT(), andCTI_SYS_INTENABLE(). These routines do not have to be used and in some cases may not be sufficient. The specifics of their operation can be seen in ctiSio.c.For example:void sysCTISerialHwInit2(void){ctiBoardIntConnect(&ctiXt1Board);ctiBoardIntConnect(&ctiXt2Board);#if defined(INCLUDE_PCI)ctiPciIntConnect(&ctiPciDevset);#endif/* defined(INCLUDE_PCI) */}4.2.1.4.EnumerationEach serial channel must be associated with a device. The CTI serial channels areenumerated using sysCTISerialChanGet(). This routine takes an index value specifyingwhich channel structure to retrieve, and effectively acts as a look-up table for thechannels. The order in which the channels are returned determines the order in which the channels are associated with device names.For example:SIO_CHAN* sysCTISerialChanGet(int channel/* serial channel */){if((channel >= 0) && (channel < 8)) {return((SIO_CHAN*)&ctiXt1Chans[channel]);}else if((channel >= 8) && (channel < (8 + 4))) {return((SIO_CHAN*)&ctiXt2Chans[channel - 8]);}#if defined(INCLUDE_PCI)else if((channel >= (8 + 4)) &&(channel < (8 + 4 + hans))){return((SIO_CHAN*)&(ctiPciDevset.pChans[channel - 8 - 4]));}#endif/* defined(INCLUDE_PCI) */return((SIO_CHAN*)ERROR);}The total number of channels needs to be reported using sysCTISerialGetNumChans(). This routine simply needs to return the total number of channels being used across all CTIadapters.For example:UINT16sysCTISerialGetNumChans(void){UINT16retVal = 0;retVal += 8;retVal += 4;#if defined(INCLUDE_PCI)retVal += hans;#endif/* defined(INCLUDE_PCI) */return(retVal);}4.3. Tornado/WorkBench ProjectsBootable VxWorks image projects based on a BSP containing the CTI driver files will have a new folder available under hardware\peripherals\serial called “Connect Tech Inc.”. This folder contains components for controlling the CTI serial driver. A description of the components follows:4.3.1.Connect Tech Inc. SIOThis component controls INCLUDE_CTI_SIO (used earlier when including the CTI serial driver in the BSP).e alternate base nameIf this component is not included, the CTI serial channels will be named “/tyCo/X” where X is the channel index value and is based on the defined NUM_TTY value so that the names do not collide with other serial devices. However, it may be desireable to use a different base name. By including the Use alternate base name component, the default behaviour is to name the CTI serial channels “/tyCTI/X” where X is the channel index value starting at 0.The Use alternate base name component has a parameter called CTI_TY_NAME_BASE which can be used to set a base name other than “/tyCTI/”.5. ExamplesIncluded with the driver files are three example BSP’s. These example BSP’s are based on the Pentium III BSP from WindRiver. A description of each of the example BSP’s follows:5.1. pcP3CTI_1This example is based on the following CTI serial adapters:Xtreme/104 RS-2328 channels.Base I/O address is 0x300.IRQ is 10.Status port is in use.Extended baud rates not in use.BlueStorm/LP RS-2324 channels.5.2. pcP3CTI_2This example is based on the following CTI serial adapters:Xtreme/104 14 RS-232 channels.Base I/O address is 0x300.IRQ is 10.Status port is in use.Extended baud rates not in use.Xtreme/104 28 channels.Base I/O address is 0x200.Channels 1, 3, 5, and 7 are on IRQ 5, channels 2, 4, 6, and 8 are on IRQ 9. SeeMode 2 in the Interrupt Selection section of the Xtreme/104 manual.Status port is not in use.Extended baud rates in use.Channels 1 and 2 are RS-232, channels 3, 4, and 5 are RS-485 full-duplex,channels 6, 7, and 8 are RS-485 half-duplex.Xtreme/104-Plus Switchable4 channels.Channels 1 and 2 are RS-485 full-duplex, channels 3 and 4 are RS-232.5.3. pcP3CTI_3This example is based on the following CTI serial adapters:BlueStorm/LP8 RS-232 channels.6. Installation Checklist。

VxWorks下网卡驱动设计

VxWorks下网卡驱动设计

基于VxWorks的网卡驱动设计摘要:随着嵌入式技术在军工、信息家电中的应用,如何在嵌入式实时系统下对网卡进行驱动程序的设计以及实现网络通信和管理,成为非常重要的技术。

本文首先从整体上VxWorks网络系统得基本原理和与结构,然后以Intel82557网卡驱动为例,着重介绍网络设备驱动程序设计与实现过程。

本文对所有基于MUX机制下的VxWorks网络设备驱动程序开发者具有参考价值.关键词:网卡驱动程序;VxWorks; END;MUX中图分类号:文献标识码:A 文章编号:1006-7043 (2006)Abstract:As Embedded system are the most popular technology applied in war industry, information appliances ,it has become an important technology how to design the device drivers and implement network communications and management under embedded system. At first, this article analyzes the base principle of network driver in VxWorks and its architecture. Then it mainly illustrates how to develop the enhanced network device driver by example of Intel82557 the enhanced network driver 。

It has a reference value for other network device driver developers.Keywords:Network Driver; VxWorks; END;MUX引言VxWorks 是一个具有微内核、可裁剪的高性能强实时操作系统,它以其良好的可靠性和卓越的实时性被广泛地应用在通信、军事、航空、航天等高精尖技术及实时性要求极高的领域中。

RTL8139网卡驱动数据包接收流程

RTL8139网卡驱动数据包接收流程

网卡驱动数据包接收流程基于RTL8139网卡目录网卡驱动数据包接收流程 (1)1. 中断函数 (1)2. 发送完成事件处理 (4)3. 软中断处理函数 (5)4. 8139 poll函数实现 (8)5. rtl8139_rx的实现 (9)6. netif_receive_skb (12)1. 中断函数static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance)所有有网卡产生的中断都会引起该中断函数的调用,这是在static int rtl8139_open (struct net_device *dev){struct rtl8139_private *tp = netdev_priv(dev);int retval;void __iomem *ioaddr = tp->mmio_addr;/* 注册中断处理函数,中断号为共享*/retval = request_irq (dev->irq, rtl8139_interrupt, IRQF_SHARED, dev->name, dev);完成的。

中断函数处理的事件可以大致分为几类:A 数据包到达产生的中断(RxAckBits = RxFIFOOver | RxOverflow | RxOK);B 异常事件,通常都是出错的情况(RxAckBits = RxFIFOOver | RxOverflow | RxOK)C发送完成事件(TxOK | TxErr)下面我们看看具体的代码static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance){/* 参数dev_instance是在上面注册中断处理函数的时候传入的*/struct net_device *dev = (struct net_device *) dev_instance;/* tp 为网卡驱动自定义的驱动特有的数据,和dev一起分配的*/struct rtl8139_private *tp = netdev_priv(dev);void __iomem *ioaddr = tp->mmio_addr;u16 status, ackstat;int link_changed = 0; /* avoid bogus "uninit" warning */int handled = 0;/* 对驱动数据加锁*/spin_lock (&tp->lock);/*读中断状态寄存器,获取中断状态*/status = RTL_R16 (IntrStatus);/* 这时由共享此中断号的其它设备产生的中断*/if (unlikely((status & rtl8139_intr_mask) == 0))goto out;handled = 1;/* 硬件错误*/if (unlikely(status == 0xFFFF))goto out;/* 设备已关闭*/if (unlikely(!netif_running(dev))) {/* 屏蔽所有中断*/RTL_W16 (IntrMask, 0);goto out;}/* Acknowledge all of the current interrupt sources ASAP, butan first get an additional status bit from CSCR. */if (unlikely(status & RxUnderrun))link_changed = RTL_R16 (CSCR) & CSCR_LinkChangeBit;ackstat = status & ~(RxAckBits | TxErr);if (ackstat)RTL_W16 (IntrStatus, ackstat);下一步处理数据包到达事件/* Receive packets are processed by poll routine.If not running start it now. */if (status & RxAckBits){if (netif_rx_schedule_prep(dev, &tp->napi)) {RTL_W16_F (IntrMask, rtl8139_norx_intr_mask);__netif_rx_schedule(dev, &tp->napi);}}先强调下8139网卡驱动的数据接收方式采用的是Linux内核的NAPI新机制。

vxworks安装方法

vxworks安装方法
vxworks的集成开发环境。
安装方法如下:
1。解压
2。拷贝 Tornado2.2SETUPcracklicense.dat 到 cflexlm (没有的话,新建该文件夹)
3。注册环境变量:
在 桌面 点“我的电脑”的右键,选择“属性”,再选择“高级”,再选择“环境变量”,可以选择“系统变量”中的“新建”,变量名:LM_LICENSE_FILE 变量值:cflexlmlicense.dat
1、启动Tornado2.2,选择Build->Build Boot Rom,在弹出的对话框里选择pcPentium3和 bootrom_uncmp、gun,OK等build output里出现done,再将$(WIND_BASE)\target\ pcPentium3下的bootrom_uncmp文件拷贝到$(WIND_BASE)\host\x86-win32\bin,在此目录下运行 mkboot a: bootrom_uncmp就可以创建启动盘
(3)除此之外,还可以在shell底下对程序进行断点设置,单步跟踪等,使用方法于VC类似。
(4) 将D:\test\first\PENTIUM3gnu下的first.out拷贝到映像vxworks所在目录,就可以直接在目标机上看到此文件。在目标机键盘上键入ls,可以看到first.out。再键入 ld < first.out,从主机下载该文件,然后键入函数名first,就可以看到和shell底下一样的结果了。
然后都点确定就可以了。
4。双击 目录下的 Tornado2.2hostx86-win32binTornado.exe,出现一个安装界面,按要求选择即可。
vxworks_install key,:cAQ8i-qP2I&-g$vT6-3&gjw-bEk9g

VxWorks环境下网卡驱动与双网卡冗余设计

VxWorks环境下网卡驱动与双网卡冗余设计

VxWorks环境下网卡驱动与双网卡冗余设计
刘锡祥;徐晓苏
【期刊名称】《工业控制计算机》
【年(卷),期】2008(21)8
【摘要】分析了VxWorks环境下网卡驱动特点与加栽过程,指出了MUX与网卡
句柄在网络通信中的重要作用,详细设计了双网卡冗余备份方案.该方案在网络通信
过程中,放弃MUX层传递的网卡句柄,自动指定网卡进行通讯,并根据网卡故障情况、连接状态以及网络通信稳定性进行冗余之间的切换.测试结果分析表明,该冗余设计
方案稳定可靠,其切换时间可至毫秒级.
【总页数】2页(P57-58)
【作者】刘锡祥;徐晓苏
【作者单位】东南大学仪器科学与工程学院,江苏,南京,210096;东南大学仪器科学
与工程学院,江苏,南京,210096
【正文语种】中文
【中图分类】TP3
【相关文献】
1.VxWorks环境下基于TCP/IP协议的多网卡数据传输与双网卡冗余设计 [J], 刘
锡祥;徐晓苏;刘建娟;冯丹琼
2.浅谈VxWorks环境下双网卡冗余备份技术的实现 [J], 郑猛
3.VxWorks环境下双网卡冗余备份技术的实现 [J], 田炜;刘利强;袁赣南
4.VxWorks环境下的双网卡智能冗余设计 [J], 刘锡祥;徐晓苏
5.VxWorks环境下基于Intel 82559双网卡冗余切换技术的实现 [J], 张原;王云飞因版权原因,仅展示原文概要,查看原文内容请购买。

VxWorks下网卡驱动程序的开发

VxWorks下网卡驱动程序的开发

VxWorks下网卡驱动程序的开发摘要:本文首先从整体上分析VxWorks 网卡驱动程序的原理和结构,然后深入地分析Rtl8139C网卡驱动程序的结构以及实现,本文对于VxWorks下的同类开发也有一定参考作用。

关键词:网卡驱动程序;VxWorks;嵌入式系统;Tornado1引言VxWorks是当前应用十分广泛的嵌入式实时操作系统,而网卡在基于VxWorks的开发中有着极其重要的作用。

Tornado 是VxWorks的开发工具,它本身支持的网卡不多。

本文涉及到的网卡是Realtek 公司的8139C PCI网卡,相关的硬件资料有:RTL8139C(L) data sheet 和Rtl8139 Programming Guide 。

需要实现的是RTL8139C END driver 。

2 VxWorks简介VxWorks是由WRS(Wind River System Inc.)公司开发的一套具有微内核、高性能、可伸缩的实时操作系统,支持广泛的网络通信协议,并能够根据用户的需求进行组合。

其开放式的结构和对工业标准的支持使开发者只需做最少的工作即可设计出有效的适合于不同用户要求的系统。

VxWorks是一种功能强大而且比较复杂的操作系统,VxWorks只占用了很小的存储空间,并可高度裁减,保证了系统能以较高的效率运行。

所以仅仅依靠人工编程调试,很难发挥它的功能并设计出可靠、高效的嵌入式系统,必须要有与之相适应的开发工具。

TornadoII是为开发VxWorks应用系统提供的集成开发环境。

VxWorks的优秀特性为编写应用程序和设备驱动程序提供了极大的便利。

在VxWorks下,设备驱动程序既可以嵌入到内核中随系统一起启动,也可以作为可加载模块在系统启动之后运行。

网卡驱动程序一般采用前一种方式。

3 VxWorks的网络模型网卡在VxWorks开发中是极其重要的。

在开发机-目标机模式中,通过网线进行下载调试是Tornado调试器最常用最方便的方式。

VxWorks系统下的RTL8139驱动程序改进

VxWorks系统下的RTL8139驱动程序改进

VxWorks系统下的RTL8139驱动程序改进RTL8139是台湾Realtek半导体公司生产的一种快速以太网控制器,提供符合PCI2.2标准的接口,兼容IEEE802.3u 100BASE-T规范,支持IEEE-802.3x全双工流量控制,支持1 0Mbit.s-1/100Mbit.s-1全双工、半双工自适应,价格便宜,性能稳定,是PC机、电信终端产品中应用最多的以太网控制器之一。

RTL8139在各种操作系统下的驱动都能从Realtek公司网页下载,其中包括VxWorks系统下的驱动,而且提供C源代码。

但是在嵌入式系统下,针对不同的硬件平台,往往需要修改该驱动程序以提高其稳定性和效率。

基于MPC8241 CPU 的硬件平台,本文提出RTL8139在VxWorks系统下驱动程序的改进措施。

1 硬件平台简介图1所示为某交换机终端设备的部分硬件框图。

CPU采用Motorola公司的PowerPC系列处理器之一的MPC8241,该芯片除嵌入32位Po werPC处理器内核外,还集成了MPC107桥,提供PCI接口与RTL8139连接,桥上有内存控制器,挂16MB SDRAM和4 MBFlash。

CPU时钟是166MHz,SDRAM时钟是66MHz,PCI时钟是33MHz,RTL8139工作在10Mbit/s,半双工方式,通过集线器(HUB)连入Int ernet,其作用是转发由话音信号打成的数据包,要求1200pps(每秒数据包),且CPU占用率不高于50%。

VxWorks支持END(增加型网络驱动)格式的以太网控制器驱动,提供MUX层作为网络协议和以太网控制器驱动间的接口,MUX规定了驱动的接口函数,RTL8139驱动程序Rtl8139End.c是完全按照END格式编写的代码,提供了所有MUX层规定的接口函数,只要写好RTL8139 PCI配制空间寄存器,在sysRtl8139End.c中传入PCI空间首地址、中断向量号和中断优先级参数,按照END格式驱动装载程序,装载成功后RTL8139就能顺利运行。

网卡驱动 (CS8900A,RTL8019,DM9000)

网卡驱动 (CS8900A,RTL8019,DM9000)

1.CS8900ACS8900芯片是Cirrus Logic公司生产的一种局域网处理芯片,在嵌入式领域中使用非常常见。

它的封装是100-pin TQFP,内部集成了在片RA M、10BASE-T收发滤波器,并且提供8位和16位两种接口。

CS8900与ARM芯片按照16位方式连接,网卡芯片复位后默认工作方式为I/O连接,基址是300H。

CS8900A还提供其它性能和配置选择.它独特的Packet Page结构可自动适应网络通信量模式的改变和现有系统资源,从而提高系统效率。

MCU与CS8900A的数据传输有三种模式:I/O模式,存储器模式和DMA模式.本设计采用CS8900A默认的I/O模式,因为I/O模式简单易用. 在I/O模式下,通过访问8个16位的寄存器来访问PacketPage结构,这8个寄存器被映射到2410地址空间的16个连续地址。

当CS8900A上电后,寄存器默认的基址为0x300h。

电路连接如下:CS8900A的IO模式特点就是这个PacketPage结构,使用PacketP agePointer和PacketPageData Port这两个寄存器对CS8900A的内部寄存器进行配置,非常方便。

#de fine CS8900_PPT R *(volatileCS8900_REG*) (CS8900_B ASE+0x05*CS8900_O FF)//Packet PagePointe r的定义#de fine CS8900_P DATA *(volatile CS8900_RE G *)(CS8900_BASE+0x06*CS8900_OFF)//Packet Page Data P ort通过如下函数对cs8900a设置ge t_reg(int regno) //32位模式,读寄存器的数据{CS8900_PPT R = regno; // regno为要读的寄存器偏移地址re tu rn (un signed sho rt) CS8900_P DATA; //返回要读寄存器的数据}st ati c void pu t_reg(int regno, un signed sho rt val) //写寄存器{CS8900_PPT R = regno;CS8900_P DATA = val; //写寄存器}其中CS8900_BASE为基址与硬件连接有关。

VxWorks系统下的RTL8139驱动程序改进

VxWorks系统下的RTL8139驱动程序改进

全双工流量控制 , 支持 l b - ~ l0M i- 一全 OM i s /O b s t t 双工 、 双工 自适应 , 半 价格便 宜, 能稳 定 , P 性 是 c机 、 电信 终端 产 品 中应 用 最 多 的 以太 网 控 制 器 之 一 。
包 )且 C U占用率不高于 5% 。 , P 0
R L 19 T S3 在各种操作系统下的驱动都 能从 R a e 公 el k t 司网页下载 , 中包 括 V Wo s 其 x r 系统下 的驱动 , k 而且 提供 c源代码。但是在嵌入式 系统下 , 针对不同的硬
件平台, 往往需要修改该驱动程序以提 高其稳定性和 效率。基 于 M C 2 1C U 的硬 件 平 台, 文 提 出 P 84 P 本 R L 19 V Wo s T S3 在 x r 系统下驱动程序的改进措施 。 k
收稿 日期 : 0 51 - 修 回 日期 : 0 51.0 20 -01 4; 20 .23 。

性能不高的重要原因 , 但这种包处理方式 是 由硬件决 定的, 驱动程序不能改变 。 事实上 , 在突发包很多的情
口函数 , 只要写好 R L 19P I 制空间寄存器 , T S3 C 配 在 sst 19 n . 中传人 P I yRl 3 E d C 8 C 空间首地址 、 中断向量号 和中断优先级参数 , 按照 E D格式驱动装载程 序, N 装
载成功后 R L 19就能顺利运行 。 T 83
容 IE 0 .u 10 A ET规 范 , 持 IE 0 . x E E82 3 0 B S — 支 E E 82 3
连接 , 上有内存控 制器 , 1 B S R 桥 挂 6M D AM和 4M B
F s。C U时钟是 16M zS R M时钟是 6 H , lh P a 6 H ,D A 6M z PI C 时钟是 3 H 。R L 19工作在 l b / , 3M z T 83 0M i s半双 t 工方式 , 通过集线器 ( U ) H B 连入 Itnt其作用是转 nr , ee 发 由话音信号打成的数据包 , 要求 10 p s 每秒数据 20 p (

VxWorks5.5RTL81X9网卡驱动

VxWorks5.5RTL81X9网卡驱动

VxWorks5.5RTL81X9网卡驱动VxWorks Torando2.2 RTL81X9网卡驱动添加过程Step 1.下载RTL81X9驱动源代码。

Step 2.复制一个BSP包,并且修改名称,例如,我复制了一个PC486的BSP包,改名为i486bsp,如图所示:Step 3.修改复制的BSP里面的Makefile文件,修改文件内容的如下:TARGET_DIR = i486bspMACH_EXTRA =rtl81x9.o ;添加rtl81x9.o到系统中Step 4.复制RTL81X9的驱动代码rtl81x9.h、rtl81x9.c、sysRtl81x9End.c文件到你的bsp包中。

Step 5.修改BSP包中的Config.h文件。

在文件如下部分添加黄色标记的内容#define INCLUDE_PCI/* Network driver options */#define INCLUDE_END /* Enhanced Network Driver Support */#undef INCLUDE_DEC21X40_END /* (END) DEC 21x4x PCI interface */#undef INCLUDE_EL_3C90X_END /* (END) 3Com Fast EtherLink XL PCI */#undef INCLUDE_ELT_3C509_END /* (END) 3Com EtherLink III interface */#undef INCLUDE_ENE_END /* (END) Eagle/Novell NE2000 interface */ #undef INCLUDE_FEI_END /* (END) Intel 8255[7/8/9] PCI interface */ #undef INCLUDE_GEI8254X_END /* (END) Intel82543/82544 PCI interface */ #undef INCLUDE_LN_97X_END /* (END) AMD 79C97x PCI interface */#undef INCLUDE_ULTRA_END /* (END) SMC Elite16 Ultra interface */#define INCLUDE_RTL_81X9_ENDStep 6.修改ConfigNet.h文件,在文件如下部分添加黄色标记的部分添加:/* Intel 82543/82544 PCI (gei) driver defines */#ifdef INCLUDE_GEI8254X_END#define GEI8254X_LOAD_FUNC sysGei8254xEndLoad#define GEI8254X_BUFF_LOAN TRUE#define GEI8254X_LOAD_STR ""IMPORT END_OBJ * GEI8254X_LOAD_FUNC (char *, void *);#endif /* INCLUDE_GEI8254X_END */#ifdef INCLUDE_RTL_81X9_END#define RTL_81X9_LOAD_FUNC sysRtl81x9EndLoad#define RTL_81X9_LOAD_LOAN TRUE#define RTL_81X9_LOAD_STRING ""IMPORT END_OBJ * RTL_81X9_LOAD_FUNC (char *, void *);#endif /* INCLUDE_RTL_81X9_END */END_TBL_ENTRY endDevTbl [] ={#ifdef INCLUDE_EL_3C90X_END{0, EL_3C90X_LOAD_FUNC, EL_3C90X_LOAD_STR, EL_3C90X_BUFF_LOAN,NULL, FALSE},#endif /* INCLUDE_EL_3C90X_END */#ifdef INCLUDE_LN_97X_END{0, LN_97X_LOAD_FUNC, LN_97X_LOAD_STR,NULL, FALSE},#endif /* INCLUDE_LN_97X_END */#ifdef INCLUDE_FEI_END{0, FEI82557_LOAD_FUNC, FEI82557_LOAD_STRING, FEI82557_BUFF_LOAN,NULL, FALSE},#endif /* INCLUDE_FEI_END */#ifdef INCLUDE_DEC21X40_END{0, END_DC_LOAD_FUNC, END_DC_LOAD_STRING, END_DC_BUFF_LOAN,NULL, FALSE},#endif /* INCLUDE_DEC21X40_END */#ifdef INCLUDE_ELT_3C509_END{0, END_3C509_LOAD_FUNC, END_3C509_LOAD_STRING, END_3C509_BUFF_LOAN,NULL, FALSE},#endif /* INCLUDE_ELT_3C509_END */#ifdef INCLUDE_ULTRA_END{0, END_ULTRA_LOAD_FUNC, END_ULTRA_LOAD_STRING, END_ULTRA_BUFF_LOAN,NULL, FALSE},#endif /* INCLUDE_ULTRA_END */#ifdef INCLUDE_ENE_END{0, END_ENE_LOAD_FUNC, END_ENE_LOAD_STRING, END_ENE_BUFF_LOAN,NULL, FALSE},#endif /* INCLUDE_ENE_END */#ifdef INCLUDE_GEI8254X_END{0, GEI8254X_LOAD_FUNC, GEI8254X_LOAD_STR,NULL, FALSE},#endif /* INCLUDE_GEI8254X_END */#ifdef INCLUDE_RTL_81X9_END{0, RTL_81X9_LOAD_FUNC, RTL_81X9_LOAD_STRING, RTL_81X9_LOAD_LOAN,NULL, FALSE},#endif /* INCLUDE_RTL_81X9_END */{0, END_TBL_END, NULL, 0, NULL, FALSE}};Step 7.最后,修改sysLib.c文件,在文件中如下部分中添加黄色标示的部分:/* imports */IMPORT char end; /* linker defined end-of-image */ IMPORT GDT sysGdt[]; /* the global descriptor table */ IMPORT void elcdetach (int unit);IMPORT VOIDFUNCPTR intEoiGet; /* BOI/EOI function pointer */ IMPORT void intEnt (void);IMPORT int sysCpuProbe (void); /* set a type of CPU family */ IMPORT VOID sysUsbOhciPciInit (void); /* USB OHCI Init */ /* include rtl81x9End driver support routines */#ifdef INCLUDE_RTL_81X9_ENDIMPORT STATUS sysRtl81x9PciInit (void);#endif /* INCLUDE_RTL_81X9_END */#ifdef INCLUDE_PCI /* BSP PCI bus & config support */# include "pciCfgStub.c" /* customize pciConfigLib for BSP */ # include "pci/pciConfigLib.c"# include "pciCfgIntStub.c" /* customize pciIntLib for BSP */ # include "pci/pciIntLib.c"# if (defined(INCLUDE_PCI_CFGSHOW) && !defined(PRJ_BUILD))# include "pci/pciConfigShow.c"# endif /* (defined(INCLUDE_PCI_CFGSHOW) && !defined(PRJ_BUILD)) */#if (PCI_CFG_TYPE == PCI_CFG_AUTO)# include "pci/pciAutoConfigLib.c"# include "sysBusPci.c"#endif /* (PCI_CFG_TYPE == PCI_CFG_AUTO) */#endif /* INCLUDE_PCI */#ifdef INCLUDE_PCMCIA# include "pcmcia/pccardLib.c"# include "pcmcia/pccardShow.c"#endif /* INCLUDE_PCMCIA */#ifdef INCLUDE_NETWORK# include "sysNet.c" /* network driver support */#endif /* INCLUDE_NETWORK */#ifdef INCLUDE_RTL_81X9_END#include "sysRtl81x9End.c"#endif /* INCLUDE_RTL_81X9_END */#ifdef INCLUDE_PCIpciConfigLibInit (PCI_MECHANISM_1, PCI_CONFIG_ADDR, PCI_CONFIG_DATA, NONE); sysPciIntInit (); /* it does pciIntLibInit() */#ifdef INCLUDE_RTL_81X9_ENDsysRtl81x9PciInit ();#endif /* INCLUDE_RTL_81X9_END */#endif /* INCLUDE_PCI *//* initialize the PIC (Programmable Interrupt Controller) */sysIntInitPIC (); /* should be after the PCI init for IOAPIC */intEoiGet = sysIntEoiGet; /* function pointer used in intConnect () */ /* initialize PCI devices */#ifdef INCLUDE_PCI到此,RTL81X9的驱动程序就添加到你的BSP中去了。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

VxWorks Torando2.2 RTL81X9网卡驱动添加过程Step 1.下载RTL81X9驱动源代码。

Step 2.复制一个BSP包,并且修改名称,例如,我复制了一个PC486的BSP包,改名为i486bsp,如图所示:Step 3.修改复制的BSP里面的Makefile文件,修改文件内容的如下:TARGET_DIR = i486bspMACH_EXTRA =rtl81x9.o ;添加rtl81x9.o到系统中Step 4.复制RTL81X9的驱动代码rtl81x9.h、 rtl81x9.c、sysRtl81x9End.c文件到你的bsp包中。

Step 5.修改BSP包中的Config.h文件。

在文件如下部分添加黄色标记的内容#define INCLUDE_PCI/* Network driver options */#define INCLUDE_END /* Enhanced Network Driver Support */#undef INCLUDE_DEC21X40_END /* (END) DEC 21x4x PCI interface */#undef INCLUDE_EL_3C90X_END /* (END) 3Com Fast EtherLink XL PCI */#undef INCLUDE_ELT_3C509_END /* (END) 3Com EtherLink III interface */#undef INCLUDE_ENE_END /* (END) Eagle/Novell NE2000 interface */ #undef INCLUDE_FEI_END /* (END) Intel 8255[7/8/9] PCI interface */ #undef INCLUDE_GEI8254X_END /* (END) Intel 82543/82544 PCI interface */ #undef INCLUDE_LN_97X_END /* (END) AMD 79C97x PCI interface */#undef INCLUDE_ULTRA_END /* (END) SMC Elite16 Ultra interface */#define INCLUDE_RTL_81X9_ENDStep 6.修改ConfigNet.h文件,在文件如下部分添加黄色标记的部分添加:/* Intel 82543/82544 PCI (gei) driver defines */#ifdef INCLUDE_GEI8254X_END#define GEI8254X_LOAD_FUNC sysGei8254xEndLoad#define GEI8254X_BUFF_LOAN TRUE#define GEI8254X_LOAD_STR ""IMPORT END_OBJ * GEI8254X_LOAD_FUNC (char *, void *);#endif /* INCLUDE_GEI8254X_END */#ifdef INCLUDE_RTL_81X9_END#define RTL_81X9_LOAD_FUNC sysRtl81x9EndLoad#define RTL_81X9_LOAD_LOAN TRUE#define RTL_81X9_LOAD_STRING ""IMPORT END_OBJ * RTL_81X9_LOAD_FUNC (char *, void *);#endif /* INCLUDE_RTL_81X9_END */END_TBL_ENTRY endDevTbl [] ={#ifdef INCLUDE_EL_3C90X_END{0, EL_3C90X_LOAD_FUNC, EL_3C90X_LOAD_STR, EL_3C90X_BUFF_LOAN,NULL, FALSE},#endif /* INCLUDE_EL_3C90X_END */#ifdef INCLUDE_LN_97X_END{0, LN_97X_LOAD_FUNC, LN_97X_LOAD_STR, LN_97X_BUFF_LOAN,NULL, FALSE},#endif /* INCLUDE_LN_97X_END */#ifdef INCLUDE_FEI_END{0, FEI82557_LOAD_FUNC, FEI82557_LOAD_STRING, FEI82557_BUFF_LOAN,NULL, FALSE},#endif /* INCLUDE_FEI_END */#ifdef INCLUDE_DEC21X40_END{0, END_DC_LOAD_FUNC, END_DC_LOAD_STRING, END_DC_BUFF_LOAN,NULL, FALSE},#endif /* INCLUDE_DEC21X40_END */#ifdef INCLUDE_ELT_3C509_END{0, END_3C509_LOAD_FUNC, END_3C509_LOAD_STRING, END_3C509_BUFF_LOAN,NULL, FALSE},#endif /* INCLUDE_ELT_3C509_END */#ifdef INCLUDE_ULTRA_END{0, END_ULTRA_LOAD_FUNC, END_ULTRA_LOAD_STRING, END_ULTRA_BUFF_LOAN,NULL, FALSE},#endif /* INCLUDE_ULTRA_END */#ifdef INCLUDE_ENE_END{0, END_ENE_LOAD_FUNC, END_ENE_LOAD_STRING, END_ENE_BUFF_LOAN,NULL, FALSE},#endif /* INCLUDE_ENE_END */#ifdef INCLUDE_GEI8254X_END{0, GEI8254X_LOAD_FUNC, GEI8254X_LOAD_STR, GEI8254X_BUFF_LOAN,NULL, FALSE},#endif /* INCLUDE_GEI8254X_END */#ifdef INCLUDE_RTL_81X9_END{0, RTL_81X9_LOAD_FUNC, RTL_81X9_LOAD_STRING, RTL_81X9_LOAD_LOAN,NULL, FALSE},#endif /* INCLUDE_RTL_81X9_END */{0, END_TBL_END, NULL, 0, NULL, FALSE}};Step 7.最后,修改sysLib.c文件,在文件中如下部分中添加黄色标示的部分:/* imports */IMPORT char end; /* linker defined end-of-image */ IMPORT GDT sysGdt[]; /* the global descriptor table */ IMPORT void elcdetach (int unit);IMPORT VOIDFUNCPTR intEoiGet; /* BOI/EOI function pointer */ IMPORT void intEnt (void);IMPORT int sysCpuProbe (void); /* set a type of CPU family */ IMPORT VOID sysUsbOhciPciInit (void); /* USB OHCI Init *//* include rtl81x9End driver support routines */#ifdef INCLUDE_RTL_81X9_ENDIMPORT STATUS sysRtl81x9PciInit (void);#endif /* INCLUDE_RTL_81X9_END */#ifdef INCLUDE_PCI /* BSP PCI bus & config support */# include "pciCfgStub.c" /* customize pciConfigLib for BSP */# include "pci/pciConfigLib.c"# include "pciCfgIntStub.c" /* customize pciIntLib for BSP */# include "pci/pciIntLib.c"# if (defined(INCLUDE_PCI_CFGSHOW) && !defined(PRJ_BUILD))# include "pci/pciConfigShow.c"# endif /* (defined(INCLUDE_PCI_CFGSHOW) && !defined(PRJ_BUILD)) */#if (PCI_CFG_TYPE == PCI_CFG_AUTO)# include "pci/pciAutoConfigLib.c"# include "sysBusPci.c"#endif /* (PCI_CFG_TYPE == PCI_CFG_AUTO) */#endif /* INCLUDE_PCI */#ifdef INCLUDE_PCMCIA# include "pcmcia/pccardLib.c"# include "pcmcia/pccardShow.c"#endif /* INCLUDE_PCMCIA */#ifdef INCLUDE_NETWORK# include "sysNet.c" /* network driver support */#endif /* INCLUDE_NETWORK */#ifdef INCLUDE_RTL_81X9_END#include "sysRtl81x9End.c"#endif /* INCLUDE_RTL_81X9_END */#ifdef INCLUDE_PCIpciConfigLibInit (PCI_MECHANISM_1, PCI_CONFIG_ADDR, PCI_CONFIG_DATA, NONE); sysPciIntInit (); /* it does pciIntLibInit() */#ifdef INCLUDE_RTL_81X9_ENDsysRtl81x9PciInit ();#endif /* INCLUDE_RTL_81X9_END */#endif /* INCLUDE_PCI *//* initialize the PIC (Programmable Interrupt Controller) */sysIntInitPIC (); /* should be after the PCI init for IOAPIC */intEoiGet = sysIntEoiGet; /* function pointer used in intConnect () */ /* initialize PCI devices */#ifdef INCLUDE_PCI到此,RTL81X9的驱动程序就添加到你的BSP中去了。

相关文档
最新文档