www.pudn.com > 860bsp.rar > sysMotCpmEnd.c
/* sysMotCpmEnd.c - system configuration module for motCpmEnd driver */ /* Copyright 1984-1999 Wind River Systems, Inc. */ #include "copyright_wrs.h" /* modification history -------------------- 01a,18mar99, cn created from pc386/sysEl3c90xEnd.c (SPR# 25839). */ /* DESCRIPTION This is the WRS-supplied configuration module for the VxWorks motCpmEnd END driver. It performs the dynamic parameterization of the motCpmEnd driver. This technique of 'just-in-time' parameterization allows driver parameter values to be declared as any other defined constants rather than as static strings. */ #include "vxWorks.h" #include "config.h" #include "vmLib.h" #include "stdio.h" #include "sysLib.h" #include "logLib.h" #include "stdlib.h" #include "string.h" #include "end.h" #include "intLib.h" #include "drv/end/motCpmEnd.h" #include "motCpmEnd.c" /* defines */ #ifdef INCLUDE_CPM #define CPM_TBD_NUM 0x10 /* number of transmit buffer descriptors (TBD)*/ #define CPM_RBD_NUM 0x10 /* number of receive buffer descriptors (RBD)*/ #define CPM_TBD_BASE 0x2e00 /* offset in DPRAM of TBD table */ #define CPM_RBD_BASE 0x2f00 /* offset in DPRAM of RBD table */ /* imports */ IMPORT END_OBJ * motCpmEndLoad1 (char *); /****************************************************************************** * * sysMotCpmEndLoad - load an istance of the motCpmEnd driver * * This routine loads the motCpmEnd driver with proper parameters. It also * reads the BCSR3 to find out which type of processor is being used, and * sets up the load string accordingly. * * The END device load string formed by this routine is in the following * format. *: : : : : : : * * * .IP * Internal memory address * .IP * Interrupt vector * .IP * SCC number being used * .IP * number of TBDs or NULL * .IP * number of RBDs or NULL * .IP * base location of the TBDs * .IP * base location of the RBDs * .IP * address of the shared memory region * * This routine only loads and initializes one instance of the device. * If the user wishes to use more than one motCpmEnd devices, this routine * should be changed. * * RETURNS: pointer to END object or ERROR. * * SEE ALSO: motCpmEndLoad () */ END_OBJ * sysMotCpmEndLoad ( char * pParamStr, /* ptr to initialization parameter string */ void * unused /* unused optional argument */ ) { /* * The motCpmEnd driver END_LOAD_STRING should be: * : : : : : : * : * Note that unit string is prepended by the mux, so we * don't put it here. */ char * pStr = NULL; char paramStr [200]; UINT8 sccNum; int intVec; static char motCpmEndParamTemplate [] = "0x%x:0x%x:%d:0x%x:0x%x:0x%x:0x%x:-1"; 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. */ pEnd = (END_OBJ *) motCpmEndLoad1 (pParamStr); } else { /* * On the second pass through here, we actually create * the initialization parameter string on the fly. * Note that we will be handed our unit number on the * second pass and we need to preserve that information. * So we use the unit number handed from the input string. */ pStr = strcpy (paramStr, pParamStr); /* Now, we get to the end of the string */ pStr += strlen (paramStr); intVec = (int)IV_SCC1; sccNum = 1; /* finish off the initialization parameter string */ sprintf (pStr, motCpmEndParamTemplate, (UINT) vxImmrGet (), intVec, sccNum, CPM_TBD_NUM, CPM_RBD_NUM, CPM_TBD_BASE, CPM_RBD_BASE ); if ((pEnd = (END_OBJ *) motCpmEndLoad1 (paramStr)) == (END_OBJ *)ERROR) { logMsg ("Error: motCpmEndLoad1 failed to load driver\n", 0, 0, 0, 0, 0, 0); } } return (pEnd); } #endif /* INCLUDE_CPM */