Initial revision
This commit is contained in:
157
src/drv/drvAb.c
Normal file
157
src/drv/drvAb.c
Normal file
@ -0,0 +1,157 @@
|
||||
|
||||
/* drvAb.c */
|
||||
/* share/src/drv $Id$ */
|
||||
|
||||
/* drvAb.c - Driver Support Routines for Alleb Bradley */
|
||||
#include <vxWorks.h>
|
||||
#include <stdioLib.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <drvSup.h>
|
||||
#include <module_types.h>
|
||||
#include <ab_driver.h>
|
||||
/* AllenBradley serial link and ai,ao,bi and bo cards */
|
||||
|
||||
extern struct ab_region *p6008s[]; /* AllenBradley serial io link */
|
||||
|
||||
extern short ab_link_to[AB_MAX_LINKS];
|
||||
extern short ab_comm_to[AB_MAX_LINKS];
|
||||
extern short ab_bad_response[AB_MAX_LINKS];
|
||||
extern short ab_or_scaling_error[AB_MAX_LINKS][AB_MAX_ADAPTERS][AB_MAX_CARDS];
|
||||
extern short ab_scaling_error[AB_MAX_LINKS][AB_MAX_ADAPTERS][AB_MAX_CARDS];
|
||||
extern short ab_data_to[AB_MAX_LINKS][AB_MAX_ADAPTERS][AB_MAX_CARDS];
|
||||
extern short ab_cmd_to[AB_MAX_LINKS][AB_MAX_ADAPTERS][AB_MAX_CARDS];
|
||||
/* Allen-Bradley cards which have been addressed */
|
||||
extern unsigned short ab_config[AB_MAX_LINKS][AB_MAX_ADAPTERS][AB_MAX_CARDS];
|
||||
|
||||
/* If any of the following does not exist replace it with #define <> NULL */
|
||||
int report();
|
||||
int init();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DRVSUPFUN report;
|
||||
DRVSUPFUN init
|
||||
} drvAb={
|
||||
2,
|
||||
report,
|
||||
init};
|
||||
|
||||
|
||||
|
||||
static long report(fp)
|
||||
FILE *fp;
|
||||
{
|
||||
register short i,card,adapter;
|
||||
|
||||
/* report all of the Allen-Bradley Serial Links present */
|
||||
for (i = 0; i < AB_MAX_LINKS; i++){
|
||||
if (p6008s[i])
|
||||
printf("AB-6008SV: Card %d\tcto: %d lto: %d badres: %d\n"
|
||||
,i,ab_comm_to[i],ab_link_to[i],ab_bad_response[i]);
|
||||
else continue;
|
||||
|
||||
/* report all cards to which the database has interfaced */
|
||||
/* as there is no way to poll the Allen-Bradley IO to */
|
||||
/* determine which card is there we assume that any interface */
|
||||
/* which is successful implies the card type is correct */
|
||||
/* since all binaries succeed and some analog inputs will */
|
||||
/* succeed for either type this is a shakey basis */
|
||||
for (adapter = 0; adapter < AB_MAX_ADAPTERS; adapter++){
|
||||
for (card = 0; card < AB_MAX_CARDS; card++){
|
||||
switch (ab_config[i][adapter][card] & AB_INTERFACE_TYPE){
|
||||
case (AB_BI_INTERFACE):
|
||||
printf("\tAdapter %d Card %d:\tBI",adapter,card);
|
||||
break;
|
||||
case (AB_BO_INTERFACE):
|
||||
printf("\tAdapter %d Card %d:\tBO",adapter,card);
|
||||
break;
|
||||
case (AB_AI_INTERFACE):
|
||||
if ((ab_config[i][adapter][card]&AB_CARD_TYPE)==AB1771IXE)
|
||||
printf("\tAdapter %d Card %d:\tAB1771IXE\tcto: %d dto: %d sclerr: %d %d",
|
||||
adapter,card,ab_cmd_to[i][adapter][card],
|
||||
ab_data_to[i][adapter][card],
|
||||
ab_scaling_error[i][adapter][card],
|
||||
ab_or_scaling_error[i][adapter][card]);
|
||||
else if ((ab_config[i][adapter][card] & AB_CARD_TYPE) == AB1771IL)
|
||||
printf("\tAdapter %d Card %d:\tAB1771IL\tcto: %d dto: %d sclerr: %d %d",
|
||||
adapter,card,ab_cmd_to[i][adapter][card],
|
||||
ab_data_to[i][adapter][card],
|
||||
ab_scaling_error[i][adapter][card],
|
||||
ab_or_scaling_error[i][adapter][card]);
|
||||
else if ((ab_config[i][adapter][card] & AB_CARD_TYPE) == AB1771IFE_SE)
|
||||
printf("\tAdapter %d Card %d:\tAB1771IFE_SE\tcto: %d dto: %d sclerr: %d %d",
|
||||
adapter,card,ab_cmd_to[i][adapter][card],
|
||||
ab_data_to[i][adapter][card],
|
||||
ab_scaling_error[i][adapter][card],
|
||||
ab_or_scaling_error[i][adapter][card]);
|
||||
else if ((ab_config[i][adapter][card] & AB_CARD_TYPE) == AB1771IFE_4to20MA)
|
||||
printf("\tAdapter %d Card %d:\tAB1771IFE_4to20MA\tcto: %d dto: %d sclerr: %d %d",
|
||||
adapter,card,ab_cmd_to[i][adapter][card],
|
||||
ab_data_to[i][adapter][card],
|
||||
ab_scaling_error[i][adapter][card],
|
||||
ab_or_scaling_error[i][adapter][card]);
|
||||
else if ((ab_config[i][adapter][card] & AB_CARD_TYPE) == AB1771IFE)
|
||||
printf("\tAdapter %d Card %d:\tAB1771IFE\tcto: %d dto: %d sclerr: %d %d",
|
||||
adapter,card,ab_cmd_to[i][adapter][card],
|
||||
ab_data_to[i][adapter][card],
|
||||
ab_scaling_error[i][adapter][card],
|
||||
ab_or_scaling_error[i][adapter][card]);
|
||||
break;
|
||||
case (AB_AO_INTERFACE):
|
||||
printf("\tAdapter %d Card %d:\tAB1771OFE\tcto: %d dto: %d",
|
||||
adapter,card,ab_cmd_to[i][adapter][card],
|
||||
ab_data_to[i][adapter][card]);
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
if ((ab_config[i][adapter][card] & AB_INIT_BIT) == 0)
|
||||
printf(" NOT INITIALIZED\n");
|
||||
else printf("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* forward reference for ioc_reboot */
|
||||
int ioc_reboot();
|
||||
|
||||
static long init()
|
||||
{
|
||||
int status;
|
||||
|
||||
rebootHookAdd(ioc_reboot);
|
||||
ab_driver_init();
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* ioc_reboot - routine to call when IOC is rebooted with a control-x */
|
||||
|
||||
extern int abScanId;
|
||||
short ab_disable=0;
|
||||
|
||||
int ioc_reboot(boot_type)
|
||||
int boot_type;
|
||||
{
|
||||
short i;
|
||||
static char wait_msg[] = {"I Hate to WAIT"};
|
||||
register char *pmsg = &wait_msg[0];
|
||||
|
||||
/* Stop communication to the Allen-Bradley Scanner Cards */
|
||||
if (abScanId != 0){
|
||||
/* flag the analog output and binary IO routines to stop */
|
||||
ab_disable = 1;
|
||||
|
||||
/* delete the scan task stops analog input communication */
|
||||
taskDelete(abScanId);
|
||||
|
||||
/* this seems to be necessary for the AB card to stop talking */
|
||||
printf("\nReboot: delay ");
|
||||
for(i = 0; i <= 14; i++){
|
||||
printf("%c",*(pmsg+i));
|
||||
taskDelay(20);
|
||||
}
|
||||
}
|
||||
}
|
42
src/drv/drvAt5Vxi.c
Normal file
42
src/drv/drvAt5Vxi.c
Normal file
@ -0,0 +1,42 @@
|
||||
|
||||
/* drvAt5Vxi.c */
|
||||
/* share/src/drv $Id$ */
|
||||
|
||||
/* drvAt5Vxi.c - Driver Support Routines for At5Vxi */
|
||||
#include <vxWorks.h>
|
||||
#include <stdioLib.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <drvSup.h>
|
||||
#include <module_types.h>
|
||||
|
||||
|
||||
/* If any of the following does not exist replace it with #define <> NULL */
|
||||
int report();
|
||||
int init();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DRVSUPFUN report;
|
||||
DRVSUPFUN init
|
||||
} drvAt5Vxi={
|
||||
2,
|
||||
report,
|
||||
init};
|
||||
|
||||
|
||||
static long report(fp)
|
||||
FILE *fp;
|
||||
{
|
||||
register int i;
|
||||
|
||||
vxi_io_report();
|
||||
}
|
||||
|
||||
static long init()
|
||||
{
|
||||
int status;
|
||||
|
||||
at5vxi_init();
|
||||
return(0);
|
||||
}
|
43
src/drv/drvCompuSm.c
Normal file
43
src/drv/drvCompuSm.c
Normal file
@ -0,0 +1,43 @@
|
||||
|
||||
/* drvCompuSm.c */
|
||||
/* share/src/drv $Id$ */
|
||||
|
||||
/* drvCompuSm.c - Driver Support Routines for CompuSm */
|
||||
#include <vxWorks.h>
|
||||
#include <stdioLib.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <drvSup.h>
|
||||
#include <module_types.h>
|
||||
#include <compu_sm_driver.h>
|
||||
|
||||
extern struct compumotor *pcompu_motors[]; /* stepper motor - CM1830 */
|
||||
|
||||
/* If any of the following does not exist replace it with #define <> NULL */
|
||||
int report();
|
||||
int init();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DRVSUPFUN report;
|
||||
DRVSUPFUN init
|
||||
} drvCompuSm={
|
||||
2,
|
||||
report,
|
||||
init};
|
||||
|
||||
static long report(fp)
|
||||
FILE *fp;
|
||||
{
|
||||
register int i;
|
||||
|
||||
for (i = 0; i < MAX_COMPU_MOTORS; i++)
|
||||
if (pcompu_motors[i]) fprintf(fp,"SM: CM1830: card %d\n",i);
|
||||
}
|
||||
|
||||
static long init()
|
||||
{
|
||||
int status;
|
||||
|
||||
return(0);
|
||||
}
|
41
src/drv/drvDvx.c
Normal file
41
src/drv/drvDvx.c
Normal file
@ -0,0 +1,41 @@
|
||||
|
||||
/* drvDvx.c */
|
||||
/* share/src/drv $Id$ */
|
||||
|
||||
/* drvDvx.c - Driver Support Routines for Dvx */
|
||||
#include <vxWorks.h>
|
||||
#include <stdioLib.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <drvSup.h>
|
||||
#include <module_types.h>
|
||||
#include <dvx_driver.h>
|
||||
|
||||
|
||||
/* If any of the following does not exist replace it with #define <> NULL */
|
||||
int report();
|
||||
int init();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DRVSUPFUN report;
|
||||
DRVSUPFUN init
|
||||
} drvDvx={
|
||||
2,
|
||||
report,
|
||||
init};
|
||||
|
||||
static long report(fp)
|
||||
FILE *fp;
|
||||
{
|
||||
register int i;
|
||||
|
||||
fprintf(fp,"dvx report not implemented\n");
|
||||
}
|
||||
|
||||
static long init()
|
||||
{
|
||||
int status;
|
||||
|
||||
return(0);
|
||||
}
|
41
src/drv/drvJgvtr1.c
Normal file
41
src/drv/drvJgvtr1.c
Normal file
@ -0,0 +1,41 @@
|
||||
|
||||
/* drvJgvtr1.c */
|
||||
/* share/src/drv $Id$ */
|
||||
|
||||
/* drvJgvtr1.c - Driver Support Routines for Jgvtr1 */
|
||||
#include <vxWorks.h>
|
||||
#include <stdioLib.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <drvSup.h>
|
||||
#include <module_types.h>
|
||||
|
||||
|
||||
/* If any of the following does not exist replace it with #define <> NULL */
|
||||
int report();
|
||||
int init();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DRVSUPFUN report;
|
||||
DRVSUPFUN init
|
||||
} drvJgvtr1={
|
||||
2,
|
||||
report,
|
||||
init};
|
||||
|
||||
static long report(fp)
|
||||
FILE *fp;
|
||||
{
|
||||
register int i;
|
||||
|
||||
jgvtr1_io_report();
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long init()
|
||||
{
|
||||
int status;
|
||||
|
||||
return(0);
|
||||
}
|
41
src/drv/drvMz8310.c
Normal file
41
src/drv/drvMz8310.c
Normal file
@ -0,0 +1,41 @@
|
||||
|
||||
/* drvMz8310.c */
|
||||
/* share/src/drv $Id$ */
|
||||
|
||||
/* drvMz8310.c - Driver Support Routines for Mz8310 */
|
||||
#include <vxWorks.h>
|
||||
#include <stdioLib.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <drvSup.h>
|
||||
#include <module_types.h>
|
||||
|
||||
|
||||
/* If any of the following does not exist replace it with #define <> NULL */
|
||||
int report();
|
||||
int init();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DRVSUPFUN report;
|
||||
DRVSUPFUN init
|
||||
} drvMz8310={
|
||||
2,
|
||||
report,
|
||||
init};
|
||||
|
||||
static long report(fp)
|
||||
FILE *fp;
|
||||
{
|
||||
int card;
|
||||
|
||||
for(card=0; card<tm_num_cards[MZ8310]; card++)
|
||||
mz8310_io_report(card);
|
||||
}
|
||||
|
||||
static long init()
|
||||
{
|
||||
int status;
|
||||
|
||||
return(0);
|
||||
}
|
44
src/drv/drvOms.c
Normal file
44
src/drv/drvOms.c
Normal file
@ -0,0 +1,44 @@
|
||||
|
||||
/* drvOms.c */
|
||||
/* share/src/drv $Id$ */
|
||||
|
||||
/* drvOms.c - Driver Support Routines for Oms */
|
||||
#include <vxWorks.h>
|
||||
#include <stdioLib.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <drvSup.h>
|
||||
#include <module_types.h>
|
||||
#include <oms_sm_driver.h>
|
||||
|
||||
extern struct vmex_motor *oms_motor_present[]; /* stepper motor - OMS */
|
||||
|
||||
/* If any of the following does not exist replace it with #define <> NULL */
|
||||
int report();
|
||||
int init();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DRVSUPFUN report;
|
||||
DRVSUPFUN init
|
||||
} drvOms={
|
||||
2,
|
||||
report,
|
||||
init};
|
||||
|
||||
static long report(fp)
|
||||
FILE *fp;
|
||||
{
|
||||
register int i;
|
||||
|
||||
for (i = 0; i < MAX_OMS_CARDS; i++)
|
||||
if (oms_motor_present[i]) printf("SM: OMS: card %d\n",i);
|
||||
}
|
||||
|
||||
static long init()
|
||||
{
|
||||
int status;
|
||||
|
||||
ai_init();
|
||||
return(0);
|
||||
}
|
39
src/drv/drvStc.c
Normal file
39
src/drv/drvStc.c
Normal file
@ -0,0 +1,39 @@
|
||||
|
||||
/* drvStc.c */
|
||||
/* share/src/drv $Id$ */
|
||||
|
||||
/* drvStc.c - Driver Support Routines for Stc */
|
||||
#include <vxWorks.h>
|
||||
#include <stdioLib.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <drvSup.h>
|
||||
#include <module_types.h>
|
||||
|
||||
|
||||
/* If any of the following does not exist replace it with #define <> NULL */
|
||||
int report();
|
||||
int init();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DRVSUPFUN report;
|
||||
DRVSUPFUN init
|
||||
} drvStc={
|
||||
2,
|
||||
report,
|
||||
init};
|
||||
|
||||
static long report(fp)
|
||||
FILE *fp;
|
||||
{
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long init()
|
||||
{
|
||||
int status;
|
||||
|
||||
return(0);
|
||||
}
|
42
src/drv/drvTime.c
Normal file
42
src/drv/drvTime.c
Normal file
@ -0,0 +1,42 @@
|
||||
|
||||
/* drvTime.c */
|
||||
/* share/src/drv $Id$ */
|
||||
|
||||
/* drvTime.c - Driver Support Routines for Time */
|
||||
#include <vxWorks.h>
|
||||
#include <stdioLib.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <drvSup.h>
|
||||
#include <module_types.h>
|
||||
|
||||
|
||||
/* If any of the following does not exist replace it with #define <> NULL */
|
||||
int report();
|
||||
int init();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DRVSUPFUN report;
|
||||
DRVSUPFUN init
|
||||
} drvTime={
|
||||
2,
|
||||
report,
|
||||
init};
|
||||
|
||||
static long report(fp)
|
||||
FILE *fp;
|
||||
{
|
||||
register int i;
|
||||
|
||||
time_io_report();
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long init()
|
||||
{
|
||||
int status;
|
||||
|
||||
time_driver_init();
|
||||
return(0);
|
||||
}
|
37
src/drv/drvXy566.c
Normal file
37
src/drv/drvXy566.c
Normal file
@ -0,0 +1,37 @@
|
||||
|
||||
/* drvXy566.c */
|
||||
/* share/src/drv $Id$ */
|
||||
|
||||
/* drvXy566.c - Driver Support Routines for xy566 */
|
||||
#include <vxWorks.h>
|
||||
#include <stdioLib.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <drvSup.h>
|
||||
#include <module_types.h>
|
||||
|
||||
|
||||
/* If any of the following does not exist replace it with #define <> NULL */
|
||||
int report();
|
||||
int init();
|
||||
struct {
|
||||
long number;
|
||||
DRVSUPFUN report;
|
||||
DRVSUPFUN init
|
||||
} drvXy566={
|
||||
2,
|
||||
report,
|
||||
init};
|
||||
|
||||
static long report(fp)
|
||||
FILE *fp;
|
||||
{
|
||||
xy566_io_report();
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int init()
|
||||
{
|
||||
|
||||
return(0);
|
||||
}
|
67
src/drv/steppermotor.h
Normal file
67
src/drv/steppermotor.h
Normal file
@ -0,0 +1,67 @@
|
||||
|
||||
/* steppermotor.h */
|
||||
/* share/src/drv $Id$ */
|
||||
|
||||
/*
|
||||
* steppermotor.h
|
||||
*
|
||||
* header file to support database library interface to motor drivers
|
||||
*
|
||||
* Author: Bob Dalesio
|
||||
* Date: 12-11-89
|
||||
* @(#)ai_driver.h 1.1 9/22/88
|
||||
*
|
||||
* Control System Software for the GTA Project
|
||||
*
|
||||
* Copyright 1988, 1989, the Regents of the University of California.
|
||||
*
|
||||
* This software was produced under a U.S. Government contract
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory, which is
|
||||
* operated by the University of California for the U.S. Department
|
||||
* of Energy.
|
||||
*
|
||||
* Developed by the Controls and Automation Group (AT-8)
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Direct inqueries to:
|
||||
* Bob Dalesio, AT-8, Mail Stop H820
|
||||
* Los Alamos National Laboratory
|
||||
* Los Alamos, New Mexico 87545
|
||||
* Phone: (505) 667-3414
|
||||
* E-mail: dalesio@luke.lanl.gov
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
*/
|
||||
|
||||
/* readback data passed to the database library routine from the motor driver */
|
||||
struct motor_data{
|
||||
short cw_limit;
|
||||
short ccw_limit;
|
||||
short moving;
|
||||
short direction;
|
||||
short constant_velocity;
|
||||
long velocity;
|
||||
long encoder_position;
|
||||
long motor_position;
|
||||
long accel;
|
||||
};
|
||||
|
||||
/*
|
||||
* Sets values for the database library based on the value flag:
|
||||
* 0 - set the mode of the motor (position/velocity)
|
||||
* 1 - set the velocity of the motor
|
||||
* 2 - set the poistion of the motor
|
||||
* 3 - start motor rotating
|
||||
* 4 - set the callback routine for a motor
|
||||
*/
|
||||
#define SM_MODE 0
|
||||
#define SM_VELOCITY 1
|
||||
#define SM_MOVE 2
|
||||
#define SM_MOTION 3
|
||||
#define SM_CALLBACK 4
|
||||
#define SM_SET_HOME 5
|
||||
#define SM_ENCODER_RATIO 6
|
||||
#define SM_MOTOR_RESOLUTION 7
|
||||
#define SM_READ 8
|
Reference in New Issue
Block a user