📄 sysne2000end.c
字号:
/* sysNe2000End.c - system configuration module for NE2000 END */ /* Copyright 1999 Wind River Systems, Inc. */ /*modification history--------------------01b,31mar99,sbs corrected ne2000ParamTemplate initialization. (SPR #26208)01a,10mar99,sbs written from sysNE2000End.c*//*DESCRIPTIONThis is the WRS-supplied configuration module for the VxWorks NE2000 (ene) END driver for the ISA/PC104 bus. It performs the dynamic parameterization of the ne2000End driver.This technique of 'just-in-time' parameterization allows driverparameter values to be declared as any other defined constants rather than as static strings. */ /* includes */#include "vxWorks.h"#include "stdio.h"#include "stdlib.h"#include "string.h"#include "end.h"#include "config.h"#ifdef INCLUDE_ENE_END /* defines */#define ENE_BYTE_ACCESS FALSE /* set to enforce 8 bit */#define ENE_USE_ENET_PROM TRUE /* set to use prom enet adrs */#define ENE_OFFSET 0/* globals */char ne2000EnetAddr[8]; /* place holder for driver */ /* imports */IMPORT END_OBJ * ne2000EndLoad (char *);/******************************************************************************** sysNe2000EndLoad - load (create) NE2000 (ene) device** This routine loads the ene device with initial parameters specified by* values given in the BSP configuration files (config.h).** RETURNS: pointer to END object or ERROR.** SEE ALSO: ne2000EndLoad()*/ END_OBJ * sysNe2000EndLoad ( char * pParamStr, /* ptr to initialization parameter string */ void * unused /* unused optional argument */ ) { /* * The ne2000End driver END_LOAD_STRING should be: * "<adrs>:<ivec>:<iLvl>:<byteAccess>:<usePromEnetAddr>:<offset>" * Note that ne2000 unit string is prepended by the mux, so we * don't put it here. */ char * cp; char paramStr [END_INIT_STR_MAX]; /* from end.h */ static char ne2000ParamTemplate [] = "%#x:%#x:%#x:%d:%d:%#x"; END_OBJ * pEnd; if (strlen (pParamStr) == 0) { /* * muxDevLoad() calls us twice. If the string is * zero length, then this is the first time through * this routine, so we just return. */ pEnd = ne2000EndLoad (pParamStr); } else { /* * On the second pass though here, we actually create * the initialization parameter string on the fly. * Note that we will be handed our unit number on the * second pass through and we need to preserve that information. * So we use the unit number handed from the input string. */ cp = strcpy (paramStr, pParamStr); /* cp points to paramStr */ /* Now, we advance cp, by finding the end the string */ cp += strlen (paramStr); /* finish off the initialization parameter string */ sprintf (cp, ne2000ParamTemplate, IO_ADRS_ENE, INT_VEC_ENE, INT_LVL_ENE, ENE_BYTE_ACCESS, ENE_USE_ENET_PROM, ENE_OFFSET); if ((pEnd = ne2000EndLoad (paramStr)) == (END_OBJ *)ERROR) { printf ("Error: NE2000 device failed ne2000EndLoad routine.\n"); } } return (pEnd); } /********************************************************************************* sysLanIntEnable - enable a bus interrupt level** This routine enables a specified bus interrupt level.** RETURNS: Ok or ERROR, if <intLevel> is out of range.** ARGSUSED0*/ STATUS sysLanIntEnable ( int intLevel /* interrupt level to enable */ ) { sysIntEnablePIC (intLevel); return (OK); } #endif /* INCLUDE_ENE_END */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -