📄 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"
/* 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 0x2800 /* offset in DPRAM of TBD table */
#define CPM_RBD_BASE 0x2900 /* offset in DPRAM of RBD table */
/* imports */
IMPORT END_OBJ * motCpmEndLoad (char *);
IMPORT int sysBoard;
/******************************************************************************
*
* sysMotCpmEndLoad - load an istance of the motCpmEnd driver
*
* This routine loads the motCpmEnd driver with proper parameters.
*
* The END device load string formed by this routine is in the following
* format.
* <motCpmAddr>:<ivec>:<sccNum>:<txBdNum>:<rxBdNum>:<txBdBase>:<rxBdBase>:
* <bufBase>
*
* .IP <motCpmAddr>
* Internal memory address
* .IP <ivec>
* Interrupt vector
* .IP <sccNum>
* SCC number being used
* .IP <txBdNum>
* number of TBDs or NULL
* .IP <rxBdNum>
* number of RBDs or NULL
* .IP <txBdBase>
* base location of the TBDs
* .IP <rxBdBase>
* base location of the RBDs
* .IP <bufBase>
* 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 */
)
{
EPCFG *cfg = getEpCfg();
/*
* The motCpmEnd driver END_LOAD_STRING should be:
* <motCpmAddr>:<ivec>:<sccNum>:<txBdNum>:<rxBdNum>:<txBdBase>:
* <rxBdBase>:<bufBase>
* 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 *) motCpmEndLoad (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_SCC3;
sccNum = 3;
/* 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 *) motCpmEndLoad (paramStr)) == (END_OBJ *)ERROR)
{
logMsg ("Error: motCpmEndLoad failed to load driver\n",
0, 0, 0, 0, 0, 0);
}
}
return (pEnd);
}
#endif /* INCLUDE_CPM */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -