VxWorks網(wǎng)絡(luò)驅(qū)動配置及分析
VxWorks支持兩種形式的網(wǎng)絡(luò)驅(qū)動,一種是BSD驅(qū)動支持通用的BSD4.4網(wǎng)絡(luò),API,結(jié)構(gòu)等和大多數(shù)BSD網(wǎng)絡(luò)的驅(qū)動類似.另一種是END網(wǎng)絡(luò)驅(qū)動,是VxWorks獨(dú)有的,根據(jù)VxWorksMUX接口編程,不過END驅(qū)動在底層也要轉(zhuǎn)換成BSD的形式.
本文引用地址:http://www.ex-cimer.com/article/149105.htmVxWorks網(wǎng)絡(luò)驅(qū)動可參見VxWorks網(wǎng)絡(luò)驅(qū)動
1.BSD4.4網(wǎng)絡(luò)驅(qū)動設(shè)置.
網(wǎng)絡(luò)設(shè)備驅(qū)動的調(diào)用主要在/target/src/config/usrNetwork.c文件中,下面說明BSD4.4驅(qū)動在VxWorks系統(tǒng)調(diào)用.
主要調(diào)用過程如下:
VxWorks系統(tǒng)執(zhí)行的第一個任務(wù)targetconfigallusrConfig.c文件中usrRoot()=======>>targetsrcconfigusrNetwork.c文件中的usrNetInit
()通過數(shù)組表netIf[]初始化相應(yīng)的BSD網(wǎng)卡驅(qū)動.
在usrNetwork.c中的調(diào)用過程如下:
usrNetInit()函數(shù)中調(diào)用usrNetIfAttach():
#ifdefINCLUDE_BSD
if(!attached)
{
if((usrNetIfAttach(pNetDev,params.unitNum,pBootString)!=OK))
return(ERROR);
attached=TRUE;
}
#endif/*INCLUDE_BSD*/
usrNetIfAttach()函數(shù)中調(diào)用數(shù)組表usrNetIfTbl
for(pNif=usrNetIfTbl;pNif->ifName!=0;pNif++)
{
if(strcmp(buf,pNif->ifName)==0)
break;
}
網(wǎng)絡(luò)BSD驅(qū)動數(shù)組表usrNetIfTbl在文件/target/src/config/usrNetwork.c中的定義初始化:
...
LOCALNETIFnetIf[]=/*網(wǎng)絡(luò)接口,定義網(wǎng)卡驅(qū)動*/
{
/*下面是定義包含的各種網(wǎng)絡(luò)驅(qū)動*/
#ifdefINCLUDE_DC/*從DEC芯片啟動,即系統(tǒng)有NVRAM存在,現(xiàn)在已過時*/
{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*/
#ifdefINCLUDE_FEI/*如果定義了INCLUDE_FEI,初始化Intel網(wǎng)卡*/
{fei,feiattach,(char*)FEI_POOL_ADRS,0,0,0,0},
#endif/*INCLUDE_FEI*/
#ifdefINCLUDE_EX/*Excelan網(wǎng)卡*/
{ex,exattach,(char*)IO_ADRS_EX,INT_VEC_EX,INT_LVL_EX,
IO_AM_EX_MASTER,IO_AM_EX},
#endif/*INCLUDE_EX*/
#ifdefINCLUDE_ENP/*CMC網(wǎng)卡*/
{enp,enpattach,(char*)IO_ADRS_ENP,INT_VEC_ENP,INT_LVL_ENP,
IO_AM_ENP},
#endif/*INCLUDE_ENP*/
...
}
設(shè)置方法:
從以上可以看出BSD網(wǎng)絡(luò)驅(qū)動只需在BSP配置文件config.h中將網(wǎng)絡(luò)(#defineINCLUDE_NETWORK)BSD網(wǎng)卡宏定義(#defineINCLUDE_xxx)和一些I/O參數(shù)(一般不需要)加入,則在文件usrNetwork.c中進(jìn)行相應(yīng)的初始化.
如:在VxWorks加入支持intel的網(wǎng)卡驅(qū)動.在config.h中加入#defineINCLUDE_FEI.
主要網(wǎng)卡定義如下:
#defineINCLUDE_ENE/*includeEagle/NovellNE2000interface*/
#defineINCLUDE_ELT/*include3COMEtherLinkIIIinterface*/
#defineINCLUDE_ESMC/*includeSMC91c9xEthernetinterface*/
#defineINCLUDE_FEI/*includeIntelEtherExpressPRO100BPCI*/
#defineINCLUDE_ELC/*includeSMCElite16interface*/
#defineINCLUDE_EEX/*includeINTELEtherExpressinterface*/
#defineINCLUDE_EEX32/*includeINTELEtherExpressflash32*/
#defineINCLUDE_EX/*includeExcelanEthernetinterface*/
#defineINCLUDE_ENP/*includeCMCEthernetinterface*/
#defineINCLUDE_SM_NET/*includebackplanenetinterface*/
#defineINCLUDE_SM_SEQ_ADDR/*sharedmemorynetworkautoaddresssetup*/
#defineINCLUDE_EL_3C90X_END/*3comfastetherLinkXLPCI*/
#defineINCLUDE_LN_97X_END/*AMD79C972ENDDRIVER*/
....
2.END網(wǎng)絡(luò)驅(qū)動設(shè)置.
END網(wǎng)絡(luò)設(shè)備的初始化主要通過定義在文件configNet.h中的一個數(shù)組表實現(xiàn).初始化網(wǎng)絡(luò)時muxDevLoad()會按這個表的定義把end初始化安裝到VxWorks系統(tǒng).
主要調(diào)用過程:
VxWorks系統(tǒng)執(zhí)行的第一個任務(wù)targetconfigallusrConfig.c文件中usrRoot()=======>>targetsrcconfigusrNetwork.c文件(該文件初始化TCP/IP)中usrNetInit(BOOT_LINE_ADRS)(該函數(shù)作用是添加MUXEND)========>>pcooki=pCookie=muxDevLoad(pDevTbl->unit,.....)其中pDevTbl在BSP網(wǎng)絡(luò)配置文件configNet.h中定義.END_TBL_ENTRYendDevTbl[]={...},該表定義了網(wǎng)絡(luò)設(shè)備的具體參數(shù).
configNet.h部分定義如下所示:
#defineDEC_LOAD_FUNCdec21x40EndLoad/*定義加載網(wǎng)絡(luò)設(shè)備的入口程序*/
#defineDEC_BUFF_LOAN1
/*網(wǎng)絡(luò)設(shè)備硬件的物理定義數(shù)據(jù)串,一般BSP已經(jīng)定義,不到必要時,無需更改*/
/*
*
*
*/
#defineDEC_LOAD_STRING
0x81020000:0x80000000:0x12:0x12:-1:-1:-1:0:0x80800
000
IMPORTEND_OBJ*DEC_LOAD_FUNC(char*,void*);
/*網(wǎng)絡(luò)END設(shè)備表*/
END_TBL_ENTRYendDevTbl[]=
{0,DEC_LOAD_FUNC,DEC_LOAD_STRING,DEC_BUFF_LOAN,NULL,FALSE},
{0,END_TBL_END,NULL,0,NULL,FALSE},
};
設(shè)置方法:
由以上可看出在VxWorks添加END網(wǎng)絡(luò)驅(qū)動
在文件config.h中添加#defineINCLUDE_NETWORK和#defineINCLUDE_END.
在configNet.h中加入END驅(qū)動的入口函數(shù)#definexxx_LOAD_FUNCxxxxxEndLoad和一些相關(guān)的初始化字符串.
評論