Initial revision
This commit is contained in:
167
src/drv/drvBb910.c
Normal file
167
src/drv/drvBb910.c
Normal file
@@ -0,0 +1,167 @@
|
||||
/* bb910_driver.c */
|
||||
/* share/src/drv $Id$ */
|
||||
/*
|
||||
* subroutines that are used to interface to the binary input cards
|
||||
*
|
||||
* Author: Bob Dalesio
|
||||
* Date: 6-13-88
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 02-09-89 lrd moved I/O addresses to module_types.h
|
||||
* .02 11-20-89 joh added call to at5vxi driver
|
||||
* .03 09-11-91 bg added bb910_io_report
|
||||
* .04 10-31-91 bg broke bb910 code out of bi_driver.c
|
||||
* .05 02-04-92 bg added the argument level to
|
||||
* bb910_io_report() and gave it the ability
|
||||
* to read raw values from card if level > 0
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code Portions:
|
||||
*
|
||||
* bi_driver_init Finds and initializes all binary input cards present
|
||||
* bi_driver Interfaces to the binary input cards present
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <vme.h>
|
||||
#include <module_types.h>
|
||||
#include <bi_driver.h>
|
||||
#include <drvsubs.h>
|
||||
|
||||
static char SccsId[] = "@(#)bb910_driver.c 1.1\t9/22/88";
|
||||
|
||||
/* pointers to the binary input cards */
|
||||
struct bi_bb910 *pbi_bb910s[MAX_BB_BI_CARDS]; /* Burr-Brown 910s */
|
||||
|
||||
/* test word for forcing bi_driver */
|
||||
int bi_test;
|
||||
|
||||
static char *bb910_shortaddr;
|
||||
|
||||
|
||||
/*
|
||||
* BI_DRIVER_INIT
|
||||
*
|
||||
* intialization for the binary input cards
|
||||
*/
|
||||
|
||||
bb910_driver_init(){
|
||||
int bimode;
|
||||
int status;
|
||||
register short i;
|
||||
struct bi_bb910 *pbi_bb910;
|
||||
|
||||
/* intialize the Burr-Brown 910 binary input cards */
|
||||
/* base address of the burr-brown 910 binary input cards */
|
||||
|
||||
status=sysBusToLocalAdrs(VME_AM_SUP_SHORT_IO,bi_addrs[BB910],&bb910_shortaddr);
|
||||
if (status != OK){
|
||||
printf("Addressing error in bb910 driver\n");
|
||||
return ERROR;
|
||||
}
|
||||
pbi_bb910 = (struct bi_bb910 *)bb910_shortaddr;
|
||||
|
||||
/* determine which cards are present */
|
||||
for (i = 0; i < bi_num_cards[BB910]; i++,pbi_bb910++){
|
||||
if (vxMemProbe(pbi_bb910,READ,sizeof(short),&bimode) == OK){
|
||||
pbi_bb910s[i] = pbi_bb910;
|
||||
}
|
||||
else {
|
||||
pbi_bb910s[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
bb910_driver(card,mask,prval)
|
||||
|
||||
register unsigned short card;
|
||||
unsigned int mask;
|
||||
register unsigned int *prval;
|
||||
{
|
||||
register unsigned int work;
|
||||
|
||||
if (card < 0 || !pbi_bb910s[card])
|
||||
return (-1);
|
||||
|
||||
/* read */
|
||||
|
||||
work = (pbi_bb910s[card]->high_value << 16) /* high */
|
||||
+ pbi_bb910s[card]->low_value; /* low */
|
||||
/* apply mask */
|
||||
*prval = work & mask;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
void bb910_io_report(level)
|
||||
short int level;
|
||||
{
|
||||
register short i,j,k,l,m,num_chans;
|
||||
unsigned int jval,kval,lval,mval;
|
||||
extern masks[];
|
||||
|
||||
for (i = 0; i < bi_num_cards[BB910]; i++){
|
||||
if (pbi_bb910s[i]){
|
||||
printf("BI: BB910: card %d\n",i);
|
||||
if (level > 0){
|
||||
num_chans = bi_num_channels[BB910];
|
||||
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){
|
||||
bb910_driver(i,masks[j],BB910,&jval);
|
||||
if (jval != 0)
|
||||
jval = 1;
|
||||
printf("Chan %d = %x\t ",j,jval);
|
||||
}
|
||||
if(k < num_chans){
|
||||
bb910_driver(i,masks[k],BB910,&kval);
|
||||
if (kval != 0)
|
||||
kval = 1;
|
||||
printf("Chan %d = %x\t ",k,kval);
|
||||
}
|
||||
if(l < num_chans){
|
||||
bb910_driver(i,masks[l],BB910,&lval);
|
||||
if (lval != 0)
|
||||
lval = 1;
|
||||
printf("Chan %d = %x \t",l,lval);
|
||||
}
|
||||
if(m < num_chans){
|
||||
bb910_driver(i,masks[m],BB910,&mval);
|
||||
if (mval != 0)
|
||||
mval = 1;
|
||||
printf("Chan %d = %x \n",m,mval);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
184
src/drv/drvXy210.c
Normal file
184
src/drv/drvXy210.c
Normal file
@@ -0,0 +1,184 @@
|
||||
/* xy210_driver.c */
|
||||
/* share/src/drv $Id$ */
|
||||
/*
|
||||
* subroutines that are used to interface to the binary input cards
|
||||
*
|
||||
* Author: Bob Dalesio
|
||||
* Date: 6-13-88
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 02-09-89 lrd moved I/O addresses to module_types.h
|
||||
* .02 11-20-89 joh added call to at5vxi driver
|
||||
* .03 09-11-91 bg added bi_io_report
|
||||
* .04 03-09-92 bg added levels to xy210_io_report. Gave
|
||||
* xy210_io_report the ability to read raw
|
||||
* values from card if level > 1
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code Portions:
|
||||
*
|
||||
* bi_driver_init Finds and initializes all binary input cards present
|
||||
* bi_driver Interfaces to the binary input cards present
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <vme.h>
|
||||
#include <module_types.h>
|
||||
#include <bi_driver.h>
|
||||
#include <drvsubs.h>
|
||||
|
||||
static char SccsId[] = "@(#)xy210_driver.c 1.1\t9/22/88";
|
||||
|
||||
/* pointers to the binary input cards */
|
||||
struct bi_xy210 *pbi_xy210s[MAX_XY_BI_CARDS]; /* Xycom 210s */
|
||||
|
||||
/* test word for forcing bi_driver */
|
||||
int bi_test;
|
||||
|
||||
static char *xy210_addr;
|
||||
|
||||
|
||||
/*
|
||||
* BI_DRIVER_INIT
|
||||
*
|
||||
* intialization for the binary input cards
|
||||
*/
|
||||
xy210_driver_init(){
|
||||
int bimode;
|
||||
int status;
|
||||
register short i;
|
||||
struct bi_xy210 *pbi_xy210;
|
||||
|
||||
|
||||
/* initialize the Xycom 210 binary input cards */
|
||||
/* base address of the xycom 210 binary input cards */
|
||||
if ((status = sysBusToLocalAdrs(VME_AM_SUP_SHORT_IO,bi_addrs[XY210],&xy210_addr)) != OK){
|
||||
printf("Addressing error in xy210 driver\n");
|
||||
return ERROR;
|
||||
}
|
||||
pbi_xy210 = (struct bi_xy210 *)xy210_addr;
|
||||
/* determine which cards are present */
|
||||
for (i = 0; i <bi_num_cards[XY210]; i++,pbi_xy210++){
|
||||
if (vxMemProbe(pbi_xy210,READ,sizeof(short),&bimode) == OK){
|
||||
pbi_xy210s[i] = pbi_xy210;
|
||||
} else {
|
||||
pbi_xy210s[i] = 0;
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* XY210_DRIVER
|
||||
*
|
||||
* interface to the xy210 binary inputs
|
||||
*/
|
||||
xy210_driver(card, mask, prval)
|
||||
register unsigned short card;
|
||||
unsigned int mask;
|
||||
register unsigned int *prval;
|
||||
{
|
||||
register unsigned int work;
|
||||
|
||||
/* verify card exists */
|
||||
if (card < 0 || !pbi_xy210s[card]){
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* read */
|
||||
work = (pbi_xy210s[card]->high_value << 16) /* high */
|
||||
+ pbi_xy210s[card]->low_value; /* low */
|
||||
|
||||
/* apply mask */
|
||||
|
||||
*prval = work & mask;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
void xy210_io_report(level)
|
||||
short int level;
|
||||
{
|
||||
register short i,j,k,l,m,num_chans;
|
||||
unsigned int jval,kval,lval,mval;
|
||||
extern long masks[];
|
||||
struct bi_xy210 *pbi_xy210;
|
||||
int bimode;
|
||||
int status;
|
||||
|
||||
|
||||
pbi_xy210 = (struct bi_xy210 *)xy210_addr;
|
||||
for (i = 0; i < bi_num_cards[XY210]; i++,pbi_xy210++){
|
||||
|
||||
if (pbi_xy210s[i]){
|
||||
printf("BI: XY210: card %d\n",i);
|
||||
if (level == 1){
|
||||
num_chans = bi_num_channels[XY210];
|
||||
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){
|
||||
status = bi_driver(i,masks[j],XY210,&jval);
|
||||
if (jval != 0)
|
||||
jval = 1;
|
||||
if(status >= 0)
|
||||
printf("Chan %d = %x\t ",j,jval);
|
||||
else
|
||||
printf("Driver error for channel %d \n",j);
|
||||
}
|
||||
if(k < num_chans){
|
||||
status = bi_driver(i,masks[k],XY210,&kval);
|
||||
if (kval != 0)
|
||||
kval = 1;
|
||||
if(status >= 0)
|
||||
printf("Chan %d = %x\t ",k,kval);
|
||||
else
|
||||
printf("Driver error for channel %d \n",k);
|
||||
}
|
||||
if(l < num_chans){
|
||||
status = bi_driver(i,masks[l],XY210,&lval);
|
||||
if (lval != 0)
|
||||
lval = 1;
|
||||
if(status >= 0)
|
||||
printf("Chan %d = %x\t ",l,lval);
|
||||
else
|
||||
printf("Driver error for channel %d \n",l);
|
||||
}
|
||||
if(m < num_chans){
|
||||
status = bi_driver(i,masks[m],XY210,&mval);
|
||||
if (mval != 0)
|
||||
mval = 1;
|
||||
if(status >= 0)
|
||||
printf("Chan %d = %x \n",m,mval);
|
||||
else
|
||||
printf("Driver error for channel %d \n",m);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user