Initial revision

This commit is contained in:
Gunther
1992-07-01 09:07:17 +00:00
parent e306c8e3fb
commit 0f71c03393
2 changed files with 275 additions and 0 deletions
+157
View File
@@ -0,0 +1,157 @@
/* ao_driver.c */
/* share/src/drv @(#)ao_driver.c 1.2 6/7/91 */
/*
* subroutines that are used to interface to the vme analog output cards
*
* Author: Bob Dalesio
* Date: 9-26-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 11-09-88 lrd add LED light status to Ziomek-085
* .02 02-08-89 lrd addresses from module_types.h
* use 085 structure
* .03 03-17-89 lrd add ao_read routine
* .04 03-29-89 lrd return correct status on write
* .05 11-20-89 joh added call to the at5 vxi driver
* .06 06-08-90 mrk fixed bug (R Daly found) for VMI4100
* .07 10-31-91 bg broke vmi4100 driver out of ao_driver.c
* broke vmi4100 code out of io_report and
* created vmi400_io_report()
* .08 01-10-92 bg Added levels to io_report and warning message
* that raw values cannot be read from vmi4100
* card even it the level is 1.
*/
#include <vxWorks.h>
#include <vme.h>
#include "module_types.h"
#include "ao_driver.h"
unsigned short *pao_vmi4100[MAX_AO_VMI_CARDS];
static int vmi4100_addr;
/*
* vmi4100_init
*
* intialize the VMI analog outputs
*/
vmi4100_init(pcards_present,base_addr)
register unsigned short **pcards_present;
register unsigned short *base_addr;
{
short shval;
int status;
register union aoVMI *pcard;
register short i;
if ((status = sysBusToLocalAdrs(VME_AM_SUP_SHORT_IO,base_addr, &vmi4100_addr)) != OK){
printf("Addressing error in vmi4100 driver\n");
return ERROR;
}
pcard = (union aoVMI *)((int)vmi4100_addr);
/* mark each card present into the card present array */
for (i = 0; i < ao_num_cards[VMI4100]; i++, pcard+= VMI_MAXCHAN, pcards_present += 1) {
if (vxMemProbe(pcard,READ,sizeof(short),&shval) == OK) {
*pcards_present = (unsigned short *)pcard;
pcard->csr = VMI_ENABLE_OUT;
}
else{
*pcards_present = 0;
}
}
}
/*
* vmi4100_driver
*
* VMI4100 analog output driver
*/
vmi4100_driver(card,chan,prval,prbval)
register unsigned short card;
register unsigned short chan;
unsigned short *prval;
unsigned short *prbval;
{
register union aoVMI *paoVMI;
/* check on the card and channel number as kept in module_types.h */
if ((paoVMI= (union aoVMI *)pao_vmi4100[card]) == 0)
return(-1);
paoVMI->data[chan] = *prval;
return (0);
}
/*
* vmi4100_read
*
* VME analog output driver
*/
vmi4100_read(card,chan,pval)
register unsigned short card;
register unsigned short chan;
unsigned short *pval;
{
register unsigned short *pcard;
/* check on the card and channel number as kept in module_types.h */
*pval = 0; /* can't read the VMIC 4100 - good design! */
return (-1);
}
/*
* vmi4100_io_report
*
* VME analog output driver
*/
vmi4100_io_report(level)
short int level;
{
register int i;
for (i = 0; i < MAX_AO_VMI_CARDS; i++){
if (pao_vmi4100[i]){
printf("AO: VMI4100: card %d ",i);
if(level >0){
printf("VMI4100 card cannot be read.\n");
}
else
printf("\n");
}
}
}
+118
View File
@@ -0,0 +1,118 @@
/*
* initialize the Xycom SRM010 bus controller card
*/
/* share/src/drv @(#)drv010.c */
/* Author: Betty Ann Gunther
* Date: 06-30-29
* Initialize xy010 bus controller
*
* 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 mm-dd-yy iii Comment
* ...
*/
#include <vxWorks.h>
#include <vme.h>
#include <drvSup.h>
#include <module_types.h>
/*
* These will hopefully go away
* as the drivers become more autonomous
*/
static long report();
static long init();
long xy010_io_report();
static long xy010_init();
struct {
long number;
DRVSUPFUN report;
DRVSUPFUN init;
} drvXy010={
2,
report,
init};
/*
* VME bus setup
*
*/
static long report()
{
xy010_io_report();
return OK;
}
static long init ()
{
xy010_init();
}
#define CSR_ADDR 0x81
#define SRM010_ADDR 0x0000
static char *xy010_addr;
/*
* initialize the Xycom SRM010 bus controller card
*/
long
xy010_init(){ /*static */
char ctemp;
int stat1;
char *pctlreg;
short id;
if (stat1 = (sysBusToLocalAdrs(VME_AM_SUP_SHORT_IO,SRM010_ADDR, &xy010_addr)) < 0){
printf("Addressing problem for xy010 system controller.\n");
return ERROR;
} else {
pctlreg = xy010_addr + CSR_ADDR; /* Pointer to status control register. */
ctemp = XY_LED;
vxMemProbe(pctlreg,WRITE,1,&ctemp);
}
return(0);
}
long xy010_io_report(){
char id;
if (vxMemProbe(xy010_addr, READ,sizeof(char),&id) != -1) {
printf("SYS CTLR: XY010 \n");
}
}