drvVmic2534.c doesn't compile, so removed.
This commit is contained in:
@@ -11,7 +11,6 @@ TOP = ../../../..
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
SRCS.c += ../devAoVmiVme4100.c
|
||||
SRCS.c += ../devVmic2534.c
|
||||
|
||||
PROD = $(SRCS.c:../%.c=%.o)
|
||||
|
||||
|
||||
@@ -1,298 +0,0 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 Lawrence Berkeley Laboratory, Advanced Light Source,
|
||||
* Control System Group
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* devVmic2534.c */
|
||||
/* share/src/dev @(#)devVmic2534.c 1.2 6/3/93 */
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] =
|
||||
"@(#) /babar/CVSROOT/epics/base/src/dev/devVmic2534.c,v 1.1 1996/01/09 19:54:24 lewis Exp(LBL)";
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* device suppoer routines for V.M.I.C. VMIVME-2534
|
||||
* digital i/o module
|
||||
*
|
||||
* Author: Bill Brown
|
||||
* Date: 03/22/94
|
||||
*
|
||||
* NOTES:
|
||||
* This code is/was cloned from "devXy240.c" of EPICS R3.11
|
||||
*
|
||||
*
|
||||
* This code is initially designed to work with boards equipped
|
||||
* the "I/O true data" option. It _may_ be possible to determine
|
||||
* the presence or absence of this option at initialization time
|
||||
* and provide appropriate bit-flipping at run-time.
|
||||
*
|
||||
* Bits 0-15 are "hard-wired" as outputs.
|
||||
* Bits 16-31 are "hard-wired" as inputs.
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <cvtTable.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <dbScan.h>
|
||||
#include <link.h>
|
||||
#include <module_types.h>
|
||||
#include <biRecord.h>
|
||||
#include <boRecord.h>
|
||||
#include <mbbiRecord.h>
|
||||
#include <mbboRecord.h>
|
||||
|
||||
|
||||
static long init_bi();
|
||||
static long init_bo();
|
||||
static long init_mbbi();
|
||||
static long init_mbbo();
|
||||
static long bi_ioinfo();
|
||||
static long mbbi_ioinfo();
|
||||
static long read_bi();
|
||||
static long write_bo();
|
||||
static long read_mbbi();
|
||||
static long write_mbbo();
|
||||
|
||||
|
||||
typedef struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_write;
|
||||
} BINARYDSET;
|
||||
|
||||
|
||||
BINARYDSET devBiVmic2534= {6,NULL,NULL,init_bi, bi_ioinfo, read_bi};
|
||||
BINARYDSET devBoVmic2534= {6,NULL,NULL,init_bo, NULL, write_bo};
|
||||
BINARYDSET devMbbiVmic2534={6,NULL,NULL,init_mbbi,mbbi_ioinfo,read_mbbi};
|
||||
BINARYDSET devMbboVmic2534={6,NULL,NULL,init_mbbo, NULL,write_mbbo};
|
||||
|
||||
static long init_bi( struct biRecord *pbi)
|
||||
{
|
||||
struct vmeio *pvmeio;
|
||||
|
||||
|
||||
/* bi.inp must be an VME_IO */
|
||||
switch (pbi->inp.type) {
|
||||
case (VME_IO) :
|
||||
pvmeio = (struct vmeio *)&(pbi->inp.value);
|
||||
pbi->mask=1;
|
||||
pbi->mask <<= pvmeio->signal;
|
||||
#ifdef DEBUG_2534
|
||||
printf("Input: signal = %x, mask = %08x\n", pvmeio->signal, pbi->mask);
|
||||
#endif /*DEBUG_2534*/
|
||||
if ( vmic2534_setIOBitDirection( pvmeio->card, pbi->mask, 0 ) != 0 )
|
||||
{
|
||||
pbi->mask = 0;
|
||||
recGblRecordError(S_db_badField,(void *)pbi,
|
||||
"devBiVmic2534 (init_record) Data Direction Conflict");
|
||||
return(S_db_badField);
|
||||
}
|
||||
break;
|
||||
default :
|
||||
recGblRecordError(S_db_badField,(void *)pbi,
|
||||
"devBiVmic2534 (init_record) Illegal INP field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long bi_ioinfo(
|
||||
int cmd,
|
||||
struct biRecord *pbi,
|
||||
IOSCANPVT *ppvt)
|
||||
{
|
||||
vmic2534_getioscanpvt(pbi->inp.value.vmeio.card,ppvt);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long read_bi(struct biRecord *pbi)
|
||||
{
|
||||
struct vmeio *pvmeio;
|
||||
int status;
|
||||
long value;
|
||||
|
||||
|
||||
pvmeio = (struct vmeio *)&(pbi->inp.value);
|
||||
status = vmic2534_bi_driver(pvmeio->card,pbi->mask,&value);
|
||||
if(status==0) {
|
||||
pbi->rval = value;
|
||||
return(0);
|
||||
} else {
|
||||
recGblSetSevr(pbi,READ_ALARM,INVALID_ALARM);
|
||||
return(2);
|
||||
}
|
||||
}
|
||||
|
||||
static long init_bo(struct boRecord *pbo)
|
||||
{
|
||||
unsigned int value;
|
||||
int status=0;
|
||||
struct vmeio *pvmeio;
|
||||
|
||||
/* bo.out must be an VME_IO */
|
||||
switch (pbo->out.type) {
|
||||
case (VME_IO) :
|
||||
pvmeio = (struct vmeio *)&(pbo->out.value);
|
||||
pbo->mask = 1;
|
||||
pbo->mask <<= pvmeio->signal;
|
||||
#ifdef DEBUG_2534
|
||||
printf("Output: signal = 0x%x, mask = %08x\n", pvmeio->signal, pbo->mask);
|
||||
#endif /*DEBUG_2534*/
|
||||
if ( vmic2534_setIOBitDirection( pvmeio->card, pbo->mask, 1 ) != 0 )
|
||||
{
|
||||
pbo->mask = 0;
|
||||
status = S_db_badField;
|
||||
recGblRecordError(status,(void *)pbo,
|
||||
"devBoVmic2534 (init_record) Data Direction Conflict");
|
||||
}
|
||||
else
|
||||
{
|
||||
status = vmic2534_bo_read(pvmeio->card,pbo->mask,&value);
|
||||
if(status == 0) pbo->rbv = pbo->rval = value;
|
||||
else status = 2;
|
||||
}
|
||||
break;
|
||||
default :
|
||||
status = S_db_badField;
|
||||
recGblRecordError(status,(void *)pbo,
|
||||
"devBoVmic2534 (init_record) Illegal OUT field");
|
||||
}
|
||||
return(status);
|
||||
}
|
||||
|
||||
static long write_bo(struct boRecord *pbo)
|
||||
{
|
||||
struct vmeio *pvmeio;
|
||||
int status;
|
||||
|
||||
|
||||
pvmeio = (struct vmeio *)&(pbo->out.value);
|
||||
status = vmic2534_bo_driver(pvmeio->card,pbo->rval,pbo->mask);
|
||||
if(status!=0) {
|
||||
recGblSetSevr(pbo,WRITE_ALARM,INVALID_ALARM);
|
||||
}
|
||||
return(status);
|
||||
}
|
||||
|
||||
static long init_mbbi(struct mbbiRecord *pmbbi)
|
||||
{
|
||||
struct vmeio *pvmeio;
|
||||
|
||||
/* mbbi.inp must be an VME_IO */
|
||||
switch (pmbbi->inp.type) {
|
||||
case (VME_IO) :
|
||||
pvmeio = (struct vmeio *)&(pmbbi->inp.value);
|
||||
pmbbi->shft = pmbbi->inp.value.vmeio.signal;
|
||||
pmbbi->mask <<= pmbbi->shft;
|
||||
if ( vmic2534_setIOBitDirection( pvmeio->card, pmbbi->mask, 0 ) != 0 )
|
||||
{
|
||||
pmbbi->mask = 0;
|
||||
recGblRecordError(S_db_badField,(void *)pmbbi,
|
||||
"devMbbiVmic2534 (init_record) Data Direction Conflict");
|
||||
return(S_db_badField);
|
||||
}
|
||||
break;
|
||||
default :
|
||||
recGblRecordError(S_db_badField,(void *)pmbbi,
|
||||
"devMbbiVmic2534 (init_record) Illegal INP field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long mbbi_ioinfo(
|
||||
int cmd,
|
||||
struct mbbiRecord *pmbbi,
|
||||
IOSCANPVT *ppvt)
|
||||
{
|
||||
vmic2534_getioscanpvt(pmbbi->inp.value.vmeio.card,ppvt);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long read_mbbi(struct mbbiRecord *pmbbi)
|
||||
{
|
||||
struct vmeio *pvmeio;
|
||||
int status;
|
||||
unsigned long value;
|
||||
|
||||
|
||||
pvmeio = (struct vmeio *)&(pmbbi->inp.value);
|
||||
status = vmic2534_bi_driver(pvmeio->card,pmbbi->mask,&value);
|
||||
if(status==0) {
|
||||
pmbbi->rval = value;
|
||||
} else {
|
||||
recGblSetSevr(pmbbi,READ_ALARM,INVALID_ALARM);
|
||||
}
|
||||
return(status);
|
||||
}
|
||||
|
||||
static long init_mbbo(struct mbboRecord *pmbbo)
|
||||
{
|
||||
unsigned long value;
|
||||
struct vmeio *pvmeio;
|
||||
int status = 0;
|
||||
|
||||
/* mbbo.out must be an VME_IO */
|
||||
switch (pmbbo->out.type) {
|
||||
case (VME_IO) :
|
||||
pvmeio = &(pmbbo->out.value.vmeio);
|
||||
pmbbo->shft = pvmeio->signal;
|
||||
pmbbo->mask <<= pmbbo->shft;
|
||||
if ( vmic2534_setIOBitDirection( pvmeio->card, pmbbo->mask, 1 ) != 0 )
|
||||
{
|
||||
pmbbo->mask = 0;
|
||||
recGblRecordError(S_db_badField,(void *)pmbbo,
|
||||
"devMbbiVmic2534 (init_record) Data Direction Conflict");
|
||||
return(S_db_badField);
|
||||
}
|
||||
status = vmic2534_bo_read(pvmeio->card,pmbbo->mask,&value);
|
||||
if(status==0) pmbbo->rbv = pmbbo->rval = value;
|
||||
else status = 2;
|
||||
break;
|
||||
default :
|
||||
status = S_db_badField;
|
||||
recGblRecordError(status,(void *)pmbbo,
|
||||
"devMbboVmic2534 (init_record) Illegal OUT field");
|
||||
}
|
||||
return(status);
|
||||
}
|
||||
|
||||
static long write_mbbo(struct mbboRecord *pmbbo)
|
||||
{
|
||||
struct vmeio *pvmeio;
|
||||
int status;
|
||||
unsigned long value;
|
||||
|
||||
|
||||
pvmeio = &(pmbbo->out.value.vmeio);
|
||||
status = vmic2534_bo_driver(pvmeio->card,pmbbo->rval,pmbbo->mask);
|
||||
if(status==0) {
|
||||
status = vmic2534_bo_read(pvmeio->card,pmbbo->mask,&value);
|
||||
if(status==0) pmbbo->rbv = value;
|
||||
else recGblSetSevr(pmbbo,READ_ALARM,INVALID_ALARM);
|
||||
} else {
|
||||
recGblSetSevr(pmbbo,WRITE_ALARM,INVALID_ALARM);
|
||||
}
|
||||
return(status);
|
||||
}
|
||||
|
||||
@@ -32,8 +32,7 @@ SRCS.c += ../drvHpe1445a.c
|
||||
SRCS.c += ../drvKscV215.c
|
||||
SRCS.c += ../drvMz8310.c
|
||||
SRCS.c += ../drvStc.c
|
||||
#SRCS.c += ../drvCaenV265.c
|
||||
#SRCS.c += ../drvVmic2534.c
|
||||
SRCS.c += ../drvCaenV265.c
|
||||
|
||||
PROD = $(SRCS.c:../%.c=%.o)
|
||||
|
||||
|
||||
@@ -1,642 +0,0 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* drvVmi2534.c */
|
||||
/* share/src/drv @(#)drvVmic2534.c 1.1 003/22/94 */
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] =
|
||||
"@(#) /babar/CVSROOT/epics/base/src/drv/old/drvVmi2534.c,v 1.1 1996/01/09 19:54:35 lewis Exp(LBL)";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* routines used to test and interface with V.M.I.C. VMIVME-2534
|
||||
* digital i/o module
|
||||
*
|
||||
* Author: Bill Brown
|
||||
* Date: 03/22/94
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* NOTES:
|
||||
* This code is/was cloned from "drvXy240.c" of EPICS R3.11
|
||||
*
|
||||
* Data direction is dynamically assigned at ioInit() time.
|
||||
* The definition of the first bit(s) in a given byte will
|
||||
* determine the data direction of all bits within that byte.
|
||||
*/
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <taskLib.h>
|
||||
#include <types.h>
|
||||
#include <vme.h>
|
||||
|
||||
#include "dbDefs.h"
|
||||
#include "errlog.h"
|
||||
#include "errlog.h"
|
||||
#include "module_types.h"
|
||||
#include "task_params.h"
|
||||
#include "drvSup.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbScan.h"
|
||||
#include "taskwd.h"
|
||||
|
||||
#define VMIC_2534_ADDR0 (bi_addrs[VMIC_2534_BI])
|
||||
#define VMIC_2534_MAX_CARDS (bi_num_cards[VMIC_2534_BI])
|
||||
#define VMIC_2534_MAX_CHANS (bi_num_channels[VMIC_2534_BI])
|
||||
|
||||
/* control-status register
|
||||
bit definiitions */
|
||||
|
||||
#define BYTE_0_OUT_ENA 1<<0
|
||||
#define BYTE_1_OUT_ENA 1<<1
|
||||
#define BYTE_2_OUT_ENA 1<<2
|
||||
#define BYTE_3_OUT_ENA 1<<3
|
||||
|
||||
#define FAIL_LED_OFF 1<<5
|
||||
#define TM1_ENABLE 1<<7
|
||||
#define TM2_ENABLE 1<<6
|
||||
|
||||
/* Refer to VMIVME-2534 manual for hardware options */
|
||||
/* These boards are available in two configurations; */
|
||||
/* "POSITIVE-TRUE Option" - writing a "1" to the output register */
|
||||
/* "TURNS ON the output driver, ie pulls the output LOW */
|
||||
/* "NEGATIVE-TRUE Option" - writing a "1" to the output register */
|
||||
/* "TURNS OFF" the output driver, allowing the load to pull */
|
||||
/* the output HIGH. */
|
||||
|
||||
/* The initialization routine recognizes which type of board is */
|
||||
/* installed and generates a mask which is used by the device- */
|
||||
/* driver to cause BOTH board types to appear to have the */
|
||||
/* POSITIVE-TRUE Option installed. */
|
||||
|
||||
#define FAIL_FLAG 1<<5
|
||||
/* Test Mode */
|
||||
#define TM2 1<<6 /* TM2 - "1" = disable test buffers */
|
||||
#define TM1 1<<7 /* TM1 - "1" = enable output drivers */
|
||||
|
||||
#define masks( K ) ((1<<K))
|
||||
|
||||
|
||||
/* VMIVME-2534 memory structure */
|
||||
|
||||
/* Data direction is dynamically assigned at ioInit() time. */
|
||||
/* The definition of the first bit(s) in a given byte will */
|
||||
/* determine the data direction of all bits within that byte. */
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u_long pioData;
|
||||
u_char brdIdReg;
|
||||
u_char ctlStatReg;
|
||||
u_char endPad[2];
|
||||
} VMIC_2534 ;
|
||||
|
||||
|
||||
/* VMIVME-2534 control structure record */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
VMIC_2534 *vmicDevice; /* pointer to the hardware */
|
||||
short deviceNr; /* device number */
|
||||
u_long savedInputs; /* previous input value */
|
||||
u_long outputCorrector; /* polarity correction factor */
|
||||
u_long inputMask; /* and-mask for input bytes */
|
||||
u_long outputMask; /* and-mask for output bytes */
|
||||
IOSCANPVT ioscanpvt;
|
||||
} VMIC_2534_REC ;
|
||||
|
||||
|
||||
VMIC_2534_REC *vmic2534Rec; /* points to control structures */
|
||||
|
||||
static long report( );
|
||||
static long init( );
|
||||
|
||||
|
||||
struct
|
||||
{
|
||||
long number;
|
||||
DRVSUPFUN report;
|
||||
DRVSUPFUN init;
|
||||
} drvVmi2534 =
|
||||
{
|
||||
2,
|
||||
report,
|
||||
init
|
||||
} ;
|
||||
|
||||
static
|
||||
long report( int level)
|
||||
{
|
||||
vmic2534_io_report( level );
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
|
||||
void vmic2534BiReport( int card );
|
||||
void vmic2534BoReport( int card );
|
||||
|
||||
static long init( )
|
||||
{
|
||||
vmic2534Init( );
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* This hardware does not support interrupts
|
||||
*
|
||||
* NO interrupt service routine is applicable
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* vmic2534IOScan
|
||||
*
|
||||
* task to check of a change of state
|
||||
* (used to simulate "change-of-state" interrupts)
|
||||
*
|
||||
*/
|
||||
|
||||
vmic2534IOScan( )
|
||||
{
|
||||
int i;
|
||||
int firstScan = TRUE;
|
||||
long temp;
|
||||
|
||||
for ( ; ; )
|
||||
{
|
||||
if ( interruptAccept ) break;
|
||||
taskDelay( vxTicksPerSecond/30 );
|
||||
}
|
||||
|
||||
for ( ; ; )
|
||||
{
|
||||
for ( i = 0; i < VMIC_2534_MAX_CARDS; i++ )
|
||||
{
|
||||
if ( vmic2534Rec[ i ].vmicDevice )
|
||||
{
|
||||
temp = ( vmic2534Rec[ i ].vmicDevice->pioData )
|
||||
& ( vmic2534Rec[ i ].inputMask );
|
||||
|
||||
if ( (temp ^ vmic2534Rec[ i ].savedInputs) || firstScan )
|
||||
{
|
||||
scanIoRequest( vmic2534Rec[ i ].ioscanpvt );
|
||||
vmic2534Rec[ i ].savedInputs = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( firstScan )
|
||||
firstScan = FALSE;
|
||||
|
||||
taskDelay( vxTicksPerSecond/30 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* DIO DRIVER INIT
|
||||
*
|
||||
*/
|
||||
|
||||
vmic2534Init( )
|
||||
{
|
||||
u_long dummy;
|
||||
register short i;
|
||||
VMIC_2534 *theHardware;
|
||||
int tid;
|
||||
int status;
|
||||
int atLeastOnePresent = FALSE;
|
||||
|
||||
/*
|
||||
* allow for runtime reconfiguration of the addr map
|
||||
*/
|
||||
|
||||
vmic2534Rec = (VMIC_2534_REC *)calloc(
|
||||
VMIC_2534_MAX_CARDS, sizeof( VMIC_2534_REC ) );
|
||||
if ( !vmic2534Rec )
|
||||
{
|
||||
logMsg("Attempt to calloc \"VMIC_2534_REC\" failed\n");
|
||||
return( ERROR );
|
||||
}
|
||||
status = sysBusToLocalAdrs( VME_AM_SUP_SHORT_IO, (VMIC_2534_ADDR0),
|
||||
&theHardware );
|
||||
if ( status != OK )
|
||||
{
|
||||
logMsg("%s: Unable to map VMIC_2534 base addr\n", __FILE__);
|
||||
return( ERROR );
|
||||
}
|
||||
|
||||
for ( i = 0; i < VMIC_2534_MAX_CARDS; i++, theHardware++ )
|
||||
{
|
||||
if ( (vxMemProbe( theHardware, READ, 2 ,&dummy )) != OK )
|
||||
{
|
||||
vmic2534Rec[i].vmicDevice = NULL;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
/* initialize hardware */
|
||||
{
|
||||
/* Outputs/Inputs are undetermined at this time */
|
||||
/* Disable output drivers in case of no SYS_RESET* */
|
||||
theHardware->ctlStatReg = 0;
|
||||
|
||||
/* determine "sense" of output and save correction factor */
|
||||
theHardware->pioData = 0;
|
||||
vmic2534Rec[i].outputCorrector = theHardware->pioData;
|
||||
|
||||
/* clear input & output masks, (malloc'ed mem may != 0) */
|
||||
vmic2534Rec[i].inputMask = 0;
|
||||
vmic2534Rec[i].outputMask = 0;
|
||||
|
||||
/* insure that outputs are initially "OFF", i.e. HIGH */
|
||||
theHardware->pioData = vmic2534Rec[i].outputCorrector;
|
||||
theHardware->ctlStatReg = TM1 | TM2 | FAIL_LED_OFF;
|
||||
|
||||
/*
|
||||
* record structure initalization
|
||||
*/
|
||||
|
||||
vmic2534Rec[ i ].vmicDevice = theHardware;
|
||||
atLeastOnePresent = TRUE;
|
||||
scanIoInit( &(vmic2534Rec[ i ].ioscanpvt) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( atLeastOnePresent)
|
||||
{
|
||||
if ( (tid = taskNameToId( VMIC_2534_NAME )) != ERROR )
|
||||
{
|
||||
taskwdRemove( tid );
|
||||
taskDelete( tid );
|
||||
}
|
||||
|
||||
if ( (status = taskSpawn(
|
||||
VMIC_2534_NAME, VMIC_2534_PRI, VMIC_2534_OPT,
|
||||
VMIC_2534_STACK, vmic2534IOScan )) == ERROR )
|
||||
logMsg("Unable to spawn \"vmic2534IOScan( )\" task\n");
|
||||
else
|
||||
taskwdInsert( status, NULL, NULL );
|
||||
}
|
||||
return( OK );
|
||||
}
|
||||
|
||||
/*
|
||||
* Set data direction control for specified data bits
|
||||
* Note:
|
||||
* Data direction is controlled on a "per-byte" basis.
|
||||
* The first bit defined within a byte sets the direction for the entire
|
||||
* byte. Any attempt to define conflicting bits after the direction
|
||||
* for a byte is set will return an error (-1) response.)
|
||||
* Permmissable values for "direction" are:
|
||||
* direction == 0 indicates input
|
||||
* direction != 0 indicates output
|
||||
*
|
||||
*/
|
||||
vmic2534_setIOBitDirection( short card, u_int mask, u_int direction )
|
||||
{
|
||||
int status = 0;
|
||||
u_long work, j;
|
||||
|
||||
static u_long maskTbl[ ] =
|
||||
{ 0x000000ff,
|
||||
0x0000ff00,
|
||||
0x00ff0000,
|
||||
0xff000000
|
||||
};
|
||||
|
||||
if ( (card >= VMIC_2534_MAX_CARDS) || !(vmic2534Rec[ card ].vmicDevice) )
|
||||
status = -1 ;
|
||||
else
|
||||
{
|
||||
if ( direction == 0)
|
||||
{
|
||||
/* INPUT */
|
||||
#ifdef DEBUG_2534
|
||||
printf("Mask = %08x, outPutMask =%08x\n",
|
||||
mask, vmic2534Rec[ card ].outputMask);
|
||||
#endif DEBUG_2534
|
||||
if ( ((u_long)mask & vmic2534Rec[ card ].outputMask) == 0 )
|
||||
{
|
||||
for ( j = 0; j < 4; j++ )
|
||||
{
|
||||
|
||||
if ( ( (u_long)mask & maskTbl[ j ] ) != 0 )
|
||||
{
|
||||
vmic2534Rec[ card ].inputMask |= maskTbl[ j ];
|
||||
#ifdef DEBUG_2534
|
||||
printf("inputMask = %08x\n",
|
||||
vmic2534Rec[ card ].inputMask);
|
||||
#endif DEBUG_2534
|
||||
vmic2534Rec[ card ].vmicDevice->ctlStatReg
|
||||
&= (u_char) ~(1 << j);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* OUTPUT */
|
||||
#ifdef DEBUG_2534
|
||||
printf("Mask = %08x, inputMask =%08x\n",
|
||||
mask, vmic2534Rec[ card ].inputMask);
|
||||
#endif DEBUG_2534
|
||||
if ( ((u_long)mask & vmic2534Rec[ card ].inputMask) == 0 )
|
||||
{
|
||||
for ( j = 0; j < 4; j++ )
|
||||
{
|
||||
if ( ( (u_long)mask & maskTbl[ j ] ) != 0 )
|
||||
{
|
||||
vmic2534Rec[ card ].outputMask |= maskTbl[ j ];
|
||||
#ifdef DEBUG_2534
|
||||
printf("outputMask = %08x\n",
|
||||
vmic2534Rec[ card ].outputMask);
|
||||
#endif DEBUG_2534
|
||||
vmic2534Rec[ card ].vmicDevice->ctlStatReg
|
||||
|= (u_char)(1 << j);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return( status );
|
||||
}
|
||||
|
||||
vmic2534_getioscanpvt( short card, IOSCANPVT *scanpvt )
|
||||
{
|
||||
if ( (card >= VMIC_2534_MAX_CARDS) || !(vmic2534Rec[ card ].vmicDevice) )
|
||||
return( -1 );
|
||||
*scanpvt = vmic2534Rec[ card ].ioscanpvt;
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* VMEVMIC_BI_DRIVER
|
||||
*
|
||||
* interface binary inputs
|
||||
*/
|
||||
|
||||
vmic2534_bi_driver( register short card,
|
||||
u_int mask,
|
||||
register u_int * prval )
|
||||
{
|
||||
if ( (card >= VMIC_2534_MAX_CARDS) || !(vmic2534Rec[ card ].vmicDevice) )
|
||||
return( -1 );
|
||||
|
||||
*prval = (u_int)( (vmic2534Rec[ card ].vmicDevice->pioData)
|
||||
& (vmic2534Rec[ card ].inputMask) )
|
||||
& mask;
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* vmic2534_bo_read
|
||||
*
|
||||
* (read) interface to binary outputs
|
||||
*
|
||||
*/
|
||||
|
||||
vmic2534_bo_read( register short card,
|
||||
u_int mask,
|
||||
register u_int * prval )
|
||||
{
|
||||
if ( (card >= VMIC_2534_MAX_CARDS) || !(vmic2534Rec[ card ].vmicDevice) )
|
||||
return( -1 );
|
||||
|
||||
*prval = (u_int)(~( ( (vmic2534Rec[ card ].vmicDevice->pioData)
|
||||
& (vmic2534Rec[ card ].outputMask) )
|
||||
^ vmic2534Rec[card].outputCorrector) ) & mask;
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* vmic2534_bo_driver
|
||||
*
|
||||
* (write) interface to binary outputs
|
||||
*/
|
||||
|
||||
vmic2534_bo_driver( register short card,
|
||||
register u_int val,
|
||||
u_int mask )
|
||||
{
|
||||
u_long work;
|
||||
|
||||
if ( (card >= VMIC_2534_MAX_CARDS) || !(vmic2534Rec[ card ].vmicDevice) )
|
||||
return( ERROR );
|
||||
|
||||
#ifndef DEBUGTHIS
|
||||
|
||||
|
||||
vmic2534Rec[ card ].vmicDevice->pioData =
|
||||
( ( ( ~(vmic2534Rec[ card ].vmicDevice->pioData) & (u_long)~mask)
|
||||
| (u_long)(val & mask) ) ^ vmic2534Rec[card].outputCorrector )
|
||||
& vmic2534Rec[ card ].outputMask;
|
||||
#else
|
||||
printf("Data = 0x%x, mask = 0x%x, corrector = 0x%x\n",
|
||||
val, mask, vmic2534Rec[card].outputCorrector);
|
||||
|
||||
work = vmic2534Rec[ card ].vmicDevice->pioData;
|
||||
printf("Current raw i/o data = 0x%x, output mask = 0x%x\n",
|
||||
work, vmic2534Rec[ card ].outputMask);
|
||||
work = ~work;
|
||||
printf("Corrected output data = 0x%x\n", work);
|
||||
work &= ( (u_long)~mask );
|
||||
printf("Masked data = 0x%x\n", work);
|
||||
work |= ( (u_long)(val & mask) );
|
||||
printf("New output data = 0x%x\n", work);
|
||||
work ^= vmic2534Rec[card].outputCorrector;
|
||||
printf("Polarity-corrected output data = 0x%x\n", work);
|
||||
work &= vmic2534Rec[ card ].outputMask;
|
||||
printf("Output data masked to output bits only = 0x%x\n", work);
|
||||
vmic2534Rec[ card ].vmicDevice->pioData = work;
|
||||
printf("*\n");
|
||||
#undef DEBUGTHIS
|
||||
#endif DEBUGTHIS
|
||||
return( OK );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* vmiv2534Out
|
||||
*
|
||||
* test routine for vm1c2534 output
|
||||
*/
|
||||
|
||||
vmiv2534Out( short card,
|
||||
u_long val )
|
||||
{
|
||||
/* check for valid card nr */
|
||||
if ( card >= VMIC_2534_MAX_CARDS )
|
||||
{
|
||||
logMsg("card # out of range/n");
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
/* check for card actually installed */
|
||||
if ( !(vmic2534Rec[ card ].vmicDevice) )
|
||||
{
|
||||
logMsg("card #%d not found\n", card);
|
||||
return( -2 );
|
||||
}
|
||||
|
||||
/* set the physical output */
|
||||
vmic2534Rec[ card ].vmicDevice->pioData
|
||||
= vmic2534Rec[ card ].outputCorrector ^ val;
|
||||
return( OK );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* vmic2534Write
|
||||
*
|
||||
* command line interface to test bo driver
|
||||
*/
|
||||
|
||||
vmic2534Write( short card,
|
||||
u_int val )
|
||||
{
|
||||
return( vmic2534_bo_driver( card, val, 0xffff ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
long
|
||||
vmic2534_io_report( short level )
|
||||
{
|
||||
int card;
|
||||
|
||||
for ( card = 0; card < VMIC_2534_MAX_CARDS; card++ )
|
||||
{
|
||||
if ( vmic2534Rec[ card ].vmicDevice )
|
||||
{
|
||||
printf("B*: vmic2534:\tcard%d\n", card);
|
||||
if( level >= 1 )
|
||||
{
|
||||
vmic2534_bi_io_report( card );
|
||||
vmic2534_bo_io_report( card );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
vmic2534_bi_io_report( int card )
|
||||
{
|
||||
short int num_chans,j,k,l,m,status;
|
||||
int ival,jval,kval,lval,mval;
|
||||
unsigned int *prval;
|
||||
|
||||
num_chans = VMIC_2534_MAX_CHANS;
|
||||
|
||||
if( !vmic2534Rec[card].vmicDevice )
|
||||
return;
|
||||
|
||||
printf("\tVMEVMI-2534 BINARY IN CHANNELS:\n");
|
||||
for( j=0, k=1, l=2, m=3;
|
||||
j < num_chans, k < num_chans, l< num_chans, m < num_chans;
|
||||
j+=IOR_MAX_COLS, k+= IOR_MAX_COLS, l+= IOR_MAX_COLS,
|
||||
m += IOR_MAX_COLS )
|
||||
{
|
||||
if( j < num_chans )
|
||||
{
|
||||
vmic2534_bi_driver( card, masks( j ), &jval );
|
||||
if ( jval != 0 )
|
||||
jval = 1;
|
||||
printf("\tChan %d = %x\t ", j, jval);
|
||||
}
|
||||
|
||||
if( k < num_chans )
|
||||
{
|
||||
vmic2534_bi_driver( card, masks( k ), &kval );
|
||||
if ( kval != 0)
|
||||
kval = 1;
|
||||
printf("Chan %d = %x\t ", k, kval);
|
||||
}
|
||||
|
||||
if( l < num_chans )
|
||||
{
|
||||
vmic2534_bi_driver( card, masks( l ), &lval );
|
||||
if ( lval != 0 )
|
||||
lval = 1;
|
||||
printf("Chan %d = %x \t", l, lval);
|
||||
}
|
||||
if( m < num_chans)
|
||||
{
|
||||
vmic2534_bi_driver( card, masks( m ), &mval );
|
||||
if ( mval != 0 )
|
||||
mval = 1;
|
||||
printf("Chan %d = %x \n", m, mval);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
vmic2534_bo_io_report( int card )
|
||||
{
|
||||
short int num_chans,j,k,l,m,status;
|
||||
int ival,jval,kval,lval,mval;
|
||||
unsigned int *prval;
|
||||
|
||||
num_chans = VMIC_2534_MAX_CHANS;
|
||||
|
||||
if( !vmic2534Rec[card].vmicDevice )
|
||||
return;
|
||||
|
||||
printf("\tVMEVMI-2534 BINARY OUT CHANNELS:\n");
|
||||
for( j=0, k=1, l=2, m=3;
|
||||
j < num_chans, k < num_chans, l< num_chans, m < num_chans;
|
||||
j+=IOR_MAX_COLS, k+= IOR_MAX_COLS, l+= IOR_MAX_COLS,
|
||||
m += IOR_MAX_COLS )
|
||||
{
|
||||
if( j < num_chans )
|
||||
{
|
||||
vmic2534_bo_read( card, masks( j ), &jval );
|
||||
if ( jval != 0 )
|
||||
jval = 1;
|
||||
printf("\tChan %d = %x\t ", j, jval);
|
||||
}
|
||||
|
||||
if( k < num_chans )
|
||||
{
|
||||
vmic2534_bo_read( card, masks( k ), &kval );
|
||||
if ( kval != 0)
|
||||
kval = 1;
|
||||
printf("Chan %d = %x\t ", k, kval);
|
||||
}
|
||||
|
||||
if( l < num_chans )
|
||||
{
|
||||
vmic2534_bo_read( card, masks( l ), &lval );
|
||||
if ( lval != 0 )
|
||||
lval = 1;
|
||||
printf("Chan %d = %x \t", l, lval);
|
||||
}
|
||||
if( m < num_chans)
|
||||
{
|
||||
vmic2534_bo_read( card, masks( m ), &mval );
|
||||
if ( mval != 0 )
|
||||
mval = 1;
|
||||
printf("Chan %d = %x \n", m, mval);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user