Commit 925c676e authored by Pfeiffer, Götz's avatar Pfeiffer, Götz
Browse files

The new functions vcanDrvpar and vcan4Drvpar allow to specify the IRQ level.


These new functions are more generic that vcanDrvp and vcan4Drvp since they
allow to set the interrupt level, too. If any of the parameters of these
functions is 0, a default is taken instead.

Specifying the IRQ level may be useful when 2 CPUs in a single rack access
two different CAN bus cards. In this case, each CPU should handle a different
interrupt level in order to avoid interrupt conflicts. Note that having
different interrupt vectors of the cards is not sufficient, they must (also)
be distinguished by the level.
parent 2255a8eb
......@@ -208,6 +208,15 @@ Version 2.1
Date: 2011-07-21
Some left overs from the HP-RT support were removed.
Date: 2011-07-21
New functions, vcanDrvpar and vcan4Drvpar were added. In contrast to vcanDrvp
and vcan4Drvp they have an additional parameter that allows to specify the
interrupt level. This may be useful when 2 CPUs in a single rack access two
different CAN bus cards. In this case, each CPU should handle a different
interrupt level in order to avoid interrupt conflicts. Note that having
different interrupt vectors of the cards is not sufficient, they must (also)
be distinguished by the level.
*/
/*----------------------------------------------------*/
......@@ -325,10 +334,12 @@ Version 2.1
/*@PS(1)*/
#ifndef VCAN4
#define VCANDRVP vcanDrvp
#define VCANDRVPAR vcanDrvpar
#define VCANDRV vcanDrv
#define VCANREGADDRMAP vcanRegAddrMap
#else
#define VCANDRVP vcan4Drvp
#define VCANDRVPAR vcan4Drvpar
#define VCANDRV vcan4Drv
#define VCANREGADDRMAP vcan4RegAddrMap
#endif
......@@ -1036,23 +1047,37 @@ static boolean ui_map_card(int card,
#ifdef B_VXWORKS /*@IL*/
/* VxWorks-Complient Driver installation routine with parameters */
/*@EM("extern vcanDrvp(long genaddrbase, long genintbase, long maxcards);\n")*/
/*@EM("extern vcan4Drvp(long genaddrbase, long genintbase, long maxcards);\n")*/
STATUS VCANDRVP(long genaddrbase, long genintbase, long maxcards)
/* most generic driver initialization routine, the interrupt level can be
specifed, too. If any of the given parameters is 0, a default value is
taken. */
/*@EM("extern vcanDrvpar(long genaddrbase, long genintbase, long maxcards, long intlevel);\n")*/
/*@EM("extern vcan4Drvpar(long genaddrbase, long genintbase, long maxcards, long intlevel);\n")*/
STATUS VCANDRVPAR(long genaddrbase, long genintbase, long maxcards, long intlevel)
{ byte *area; byte *io_area;
int vectors[CARD_MAX_NUMBER*(1<<CAN_IRQ_SHIFT)];
int c,i,l,size,vec;
boolean card_found[CARD_MAX_NUMBER];
boolean any_card_found= FALSE;
long addr_offset= genaddrbase- CARD_ADDR_GENBASE_DEF;
long int_offset = genintbase - CARD_INT_GENBASE_DEF;
long addr_offset;
long int_offset;
if (gptr!=NULL)
{ /* already initialized */
return(drv_ret_code);
};
if (genaddrbase==0)
genaddrbase= CARD_ADDR_GENBASE_DEF;
if (genintbase==0)
genintbase= CARD_INT_GENBASE_DEF;
if (maxcards==0)
maxcards= 4;
if (intlevel==0)
intlevel= CARD_INT_LEVEL;
addr_offset= genaddrbase- CARD_ADDR_GENBASE_DEF;
int_offset = genintbase - CARD_INT_GENBASE_DEF;
/*************** parameter error-checking *****************/
#ifdef VCAN4
if (genaddrbase & 0x1FFFFFL)/* only the first 3 bits of the addr
......@@ -1192,7 +1217,7 @@ STATUS VCANDRVP(long genaddrbase, long genintbase, long maxcards)
/* see CARD_MAX_NUMBER, currently only one card supported */
/* initialize the vector-structure, note: only one card is currently
supported, no array boundary check !!! */
UI_2_PRINTF(("vcan: enabling VME-interrupt <%d>:\n", CARD_INT_LEVEL));
UI_2_PRINTF(("vcan: enabling VME-interrupt <%d>:\n", intlevel));
UI_2_PRINTF(("vcan: registering ISR\n"));
l=0; /* length of array */
for (c=0; c<CARD_MAX_NUMBER; c++)
......@@ -1214,11 +1239,11 @@ STATUS VCANDRVP(long genaddrbase, long genintbase, long maxcards)
};
#if 0
/* enable VME-Interrupts: */
sysIntEnable(CARD_INT_LEVEL);
sysIntEnable(intlevel);
#endif
/******************* initialize the card ******************/
UI_2_PRINTF(("vcan: initialize the VME-CAN2 card..."));
if (!ci_init(&(gptr->ci_area), CARD_INT_LEVEL, genintbase))
if (!ci_init(&(gptr->ci_area), intlevel, genintbase))
{
UI_1_PRINTF(("\nvcan: ci_init failed\n"));
return(ERROR);
......@@ -1226,7 +1251,7 @@ STATUS VCANDRVP(long genaddrbase, long genintbase, long maxcards)
#if 1
/* enable VME-Interrupts: */
sysIntEnable(CARD_INT_LEVEL);
sysIntEnable(intlevel);
#endif
UI_2_PRINTF(("done\n"));
/* from here on. interrupts on the card are enabled !! */
......@@ -1235,11 +1260,20 @@ STATUS VCANDRVP(long genaddrbase, long genintbase, long maxcards)
return(OK);
}
/* VxWorks-Complient Driver installation routine with parameters */
/*@EM("extern vcanDrvp(long genaddrbase, long genintbase, long maxcards);\n")*/
/*@EM("extern vcan4Drvp(long genaddrbase, long genintbase, long maxcards);\n")*/
STATUS VCANDRVP(long genaddrbase, long genintbase, long maxcards)
{
return(VCANDRVPAR(genaddrbase, genintbase, maxcards, 0));
}
/* VxWorks-Complient Driver installation routine without parameters*/
/*@EM("extern STATUS vcanDrv(void);\n")*/
/*@EM("extern STATUS vcan4Drv(void);\n")*/
STATUS VCANDRV(void)
{ return(VCANDRVP(CARD_ADDR_GENBASE_DEF, CARD_INT_GENBASE_DEF, 4)); }
{ return(VCANDRVPAR(0, 0, 0, 0)); }
/*
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment