Initial revision
This commit is contained in:
2398
src/drv/drvEpvxi.c
Normal file
2398
src/drv/drvEpvxi.c
Normal file
File diff suppressed because it is too large
Load Diff
1422
src/drv/drvEpvxiMsg.c
Normal file
1422
src/drv/drvEpvxiMsg.c
Normal file
File diff suppressed because it is too large
Load Diff
144
src/drv/drvHp1404a.c
Normal file
144
src/drv/drvHp1404a.c
Normal file
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
*
|
||||
* HP E1404A VXI bus slot zero translator
|
||||
* device dependent routines
|
||||
*
|
||||
* Author Jeffrey O. Hill
|
||||
* Date 030692
|
||||
*
|
||||
* 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:
|
||||
* -----------------
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include <epvxiLib.h>
|
||||
|
||||
#define TLTRIG(N) (1<<(N))
|
||||
#define ECLTRIG(N) (1<<((N)+8))
|
||||
|
||||
#define LOCAL static
|
||||
|
||||
#define NULL 0
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
/*
|
||||
* enable int when signal register is written
|
||||
*/
|
||||
#define HP1404A_INT_ENABLE 0x0008
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* hpE1404Init
|
||||
*
|
||||
*/
|
||||
int
|
||||
hpE1404Init(la)
|
||||
unsigned la;
|
||||
{
|
||||
return hpE1404SetMsgSelfTestPassed(la);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* hpE1404SetSelfTestPassed
|
||||
*
|
||||
* set the self test status passed for the message based device
|
||||
*
|
||||
*
|
||||
*/
|
||||
LOCAL int
|
||||
hpE1404SetMsgSelfTestPassed(la)
|
||||
unsigned la; /* register based device's la */
|
||||
{
|
||||
struct vxi_csr *pcsr;
|
||||
|
||||
pcsr = VXIBASE(la);
|
||||
|
||||
pcsr->dir.w.dd.reg_s0.ddx1e = VXIPASS<<2;
|
||||
|
||||
/*
|
||||
* enable int when signal register is written
|
||||
*/
|
||||
pcsr->dir.w.dd.reg.ddx1a = HP1404A_INT_ENABLE;
|
||||
|
||||
return VXI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* hpE1404RouteTriggerECL
|
||||
*
|
||||
*/
|
||||
hpE1404RouteTriggerECL(la, enable_map, io_map)
|
||||
unsigned la; /* slot zero device logical address */
|
||||
unsigned enable_map; /* bits 0-5 correspond to trig 0-5 */
|
||||
/* a 1 enables a trigger */
|
||||
/* a 0 disables a trigger */
|
||||
unsigned io_map; /* bits 0-5 correspond to trig 0-5 */
|
||||
/* a 1 sources the front panel */
|
||||
/* a 0 sources the back plane */
|
||||
{
|
||||
struct vxi_csr *pcsr;
|
||||
|
||||
pcsr = VXIBASE(la);
|
||||
|
||||
pcsr->dir.w.dd.reg_s0.ddx2a = (io_map&enable_map)<<8;
|
||||
pcsr->dir.w.dd.reg_s0.ddx22 = ((~io_map)&enable_map)<<8;
|
||||
|
||||
return VXI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
* hpE1404RouteTriggerTTL
|
||||
*
|
||||
*
|
||||
*/
|
||||
hpE1404RouteTriggerTTL(la, enable_map, io_map)
|
||||
unsigned la; /* slot zero device logical address */
|
||||
unsigned enable_map; /* bits 0-5 correspond to trig 0-5 */
|
||||
/* a 1 enables a trigger */
|
||||
/* a 0 disables a trigger */
|
||||
unsigned io_map; /* bits 0-5 correspond to trig 0-5 */
|
||||
/* a 1 sources the front panel */
|
||||
/* a 0 sources the back plane */
|
||||
{
|
||||
struct vxi_csr *pcsr;
|
||||
|
||||
pcsr = VXIBASE(la);
|
||||
|
||||
pcsr->dir.w.dd.reg_s0.ddx2a = io_map&enable_map;
|
||||
pcsr->dir.w.dd.reg_s0.ddx22 = (~io_map)&enable_map;
|
||||
|
||||
return VXI_SUCCESS;
|
||||
}
|
||||
282
src/drv/drvHpe1368a.c
Normal file
282
src/drv/drvHpe1368a.c
Normal file
@@ -0,0 +1,282 @@
|
||||
/*
|
||||
* hpe1368a_driver.c
|
||||
*
|
||||
* driver for hpe1368a and hpe1369a VXI modules
|
||||
*
|
||||
* Author: Jeff Hill
|
||||
* Date: 052192
|
||||
*
|
||||
* 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:
|
||||
* -----------------
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#ifdef V5_vxWorks
|
||||
# include <68k/iv.h>
|
||||
#else
|
||||
# include <iv68k.h>
|
||||
#endif
|
||||
#include <types.h>
|
||||
#include <module_types.h>
|
||||
#include <task_params.h>
|
||||
#include <fast_lock.h>
|
||||
#include <epvxiLib.h>
|
||||
|
||||
|
||||
#define VXI_MODEL_HPE1368A (0xf28)
|
||||
|
||||
#define HPE1368A_PCONFIG(LA) \
|
||||
epvxiPConfig((LA), hpe1368aDriverId, struct hpe1368a_config *)
|
||||
|
||||
#define ChannelEnable(PCSR) ((PCSR)->dir.w.dd.reg.ddx08)
|
||||
#define ModuleStatus(PCSR) ((PCSR)->dir.r.status)
|
||||
|
||||
#define ALL_SWITCHES_OPEN 0
|
||||
|
||||
struct hpe1368a_config{
|
||||
FAST_LOCK lock;
|
||||
unsigned short shadow;
|
||||
int busy;
|
||||
};
|
||||
|
||||
#define HPE1368A_INT_LEVEL 1
|
||||
|
||||
LOCAL
|
||||
int hpe1368aDriverId;
|
||||
|
||||
void hpe1368a_int_service();
|
||||
void hpe1368a_init_card();
|
||||
void hpe1368a_stat();
|
||||
|
||||
|
||||
/*
|
||||
* hpe1368a_init
|
||||
*
|
||||
* initialize all hpe1368a cards
|
||||
*
|
||||
*/
|
||||
hpe1368a_init()
|
||||
{
|
||||
int r0;
|
||||
|
||||
/*
|
||||
* do nothing on crates without VXI
|
||||
*/
|
||||
if(!epvxiResourceMangerOK){
|
||||
return OK;
|
||||
}
|
||||
|
||||
hpe1368aDriverId = vxiUniqueDriverID();
|
||||
|
||||
{
|
||||
epvxiDeviceSearchPattern dsp;
|
||||
|
||||
dsp.flags = VXI_DSP_make | VXI_DSP_model;
|
||||
dsp.make = VXI_MAKE_HP;
|
||||
dsp.model = VXI_MODEL_HPE1368A;
|
||||
r0 = epvxiLookupLA(&dsp, hpe1368a_init_card, (void *)NULL);
|
||||
if(r0<0){
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* HPE1368A_INIT_CARD
|
||||
*
|
||||
* initialize single at5vxi card
|
||||
*
|
||||
*/
|
||||
LOCAL void
|
||||
hpe1368a_init_card(la)
|
||||
unsigned la;
|
||||
{
|
||||
int r0;
|
||||
struct hpe1368a_config *pc;
|
||||
struct vxi_csr *pcsr;
|
||||
|
||||
r0 = vxiOpen(
|
||||
la,
|
||||
hpe1368aDriverId,
|
||||
(unsigned long) sizeof(*pc),
|
||||
hpe1368a_stat);
|
||||
if(r0<0){
|
||||
logMsg("hpe1368a: device open failed %d\n", la);
|
||||
return;
|
||||
}
|
||||
|
||||
pc = HPE1368A_PCONFIG(la);
|
||||
if(pc == NULL){
|
||||
return;
|
||||
}
|
||||
|
||||
pcsr = VXIBASE(la);
|
||||
|
||||
/*
|
||||
* we must reset the device to a known state since
|
||||
* we cant read back the current state
|
||||
*/
|
||||
pc->shadow = ALL_SWITCHES_OPEN;
|
||||
ChannelEnable(pcsr) = ALL_SWITCHES_OPEN;
|
||||
|
||||
FASTLOCKINIT(&pc->lock);
|
||||
|
||||
r0 = intConnect(
|
||||
(unsigned char) INUM_TO_IVEC(la),
|
||||
hpe1368a_int_service,
|
||||
(void *) la);
|
||||
if(r0 == ERROR)
|
||||
return;
|
||||
|
||||
sysIntEnable(HPE1368A_INT_LEVEL);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* hpe1368a_int_service()
|
||||
*
|
||||
*/
|
||||
LOCAL void
|
||||
hpe1368a_int_service(la)
|
||||
unsigned la;
|
||||
{
|
||||
struct hpe1368a_config *pc;
|
||||
|
||||
pc = HPE1368A_PCONFIG(la);
|
||||
if(pc == NULL){
|
||||
return;
|
||||
}
|
||||
|
||||
pc->busy = FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* HPE1368A_STAT
|
||||
*
|
||||
* initialize single at5vxi card
|
||||
*
|
||||
*/
|
||||
LOCAL void
|
||||
hpe1368a_stat(la,level)
|
||||
unsigned la;
|
||||
int level;
|
||||
{
|
||||
struct hpe1368a_config *pc;
|
||||
struct vxi_csr *pcsr;
|
||||
|
||||
pc = HPE1368A_PCONFIG(la);
|
||||
if(pc == NULL){
|
||||
return;
|
||||
}
|
||||
pcsr = VXIBASE(la);
|
||||
|
||||
if(level>0){
|
||||
printf("\tSwitch states %x\n", pc->shadow);
|
||||
printf("\tModule status %x\n", pcsr->dir.r.status);
|
||||
if(pc->busy){
|
||||
printf("\tModule is busy.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* HPE1368A_BO_DRIVER
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
int
|
||||
hpe1368a_bo_driver(la,val,mask)
|
||||
register unsigned short la;
|
||||
register unsigned int val;
|
||||
unsigned int mask;
|
||||
{
|
||||
struct hpe1368a_config *pc;
|
||||
struct vxi_csr *pcsr;
|
||||
unsigned int work;
|
||||
|
||||
pc = HPE1368A_PCONFIG(la);
|
||||
if(pc == NULL){
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
pcsr = VXIBASE(la);
|
||||
|
||||
FASTLOCK(&pc->lock);
|
||||
|
||||
work = pc->shadow;
|
||||
|
||||
/* alter specified bits */
|
||||
work = (work & ~mask) | (val & mask);
|
||||
|
||||
pc->shadow = work;
|
||||
|
||||
ChannelEnable(pcsr) = work;
|
||||
|
||||
FASTUNLOCK(&pc->lock);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* HPE1368A_BI_DRIVER
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
hpe1368a_bi_driver(la,mask,pval)
|
||||
register unsigned short la;
|
||||
unsigned int mask;
|
||||
register unsigned int *pval;
|
||||
{
|
||||
struct hpe1368a_config *pc;
|
||||
|
||||
pc = HPE1368A_PCONFIG(la);
|
||||
if(pc == NULL){
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
FASTLOCK(&pc->lock);
|
||||
|
||||
*pval = pc->shadow & mask;
|
||||
|
||||
FASTUNLOCK(&pc->lock);
|
||||
|
||||
return OK;
|
||||
}
|
||||
Reference in New Issue
Block a user