From c659c0b596f94d074e64759e7036965c1d616c90 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Fri, 27 Aug 1993 19:56:09 +0000 Subject: [PATCH] ANSI C/-Wall/std status changes --- src/drv/drvAt5Vxi.c | 464 +++++++++++++++-------------- src/drv/drvEpvxi.c | 103 ++++--- src/drv/drvEpvxiMsg.c | 32 +- src/drv/drvHp1404a.c | 167 +++++------ src/drv/drvHpe1368a.c | 213 ++++++++------ src/drv/drvHpe1445a.c | 659 ++++++++++++++++++++++-------------------- src/drv/drvJgvtr1.c | 282 ++++++++++-------- src/drv/drvKscV215.c | 246 +++++++++------- src/drv/drvMz8310.c | 422 ++++++++++++++++----------- src/drv/drvStc.c | 264 ++++++++--------- src/drv/drvStc.h | 22 +- src/drv/drvTime.c | 4 +- 12 files changed, 1565 insertions(+), 1313 deletions(-) diff --git a/src/drv/drvAt5Vxi.c b/src/drv/drvAt5Vxi.c index e845af92a..36a0ed351 100644 --- a/src/drv/drvAt5Vxi.c +++ b/src/drv/drvAt5Vxi.c @@ -100,6 +100,14 @@ #include #include #include +#include +#include +#include +#include +#include +#include + +#include #include #include #include @@ -107,34 +115,33 @@ #include #include #include +#include +#include static char SccsId[] = "$Id$\t$Date$"; -typedef long (*DRVSUPFUN) (); /* ptr to driver support function*/ +typedef long at5VxiStatus; - -static void at5vxi_int_service( +LOCAL void at5vxi_int_service( int addr ); -static void at5vxi_init_card( +LOCAL void at5vxi_init_card( unsigned addr ); -static void at5vxi_shutdown( - void -); +LOCAL int at5vxi_shutdown(void); -static void at5vxi_shutdown_card( +LOCAL void at5vxi_shutdown_card( unsigned la ); -static int at5vxi_report_timing( +LOCAL at5VxiStatus at5vxi_report_timing( unsigned card, unsigned channel ); -static void at5vxi_stat( +LOCAL void at5vxi_stat( unsigned card, int level ); @@ -142,11 +149,11 @@ static void at5vxi_stat( /* * these should be in a header file */ -static long at5vxi_init( +LOCAL at5VxiStatus at5vxi_init( void ); -int at5vxi_one_shot( +at5VxiStatus at5vxi_one_shot( int preset, /* TRUE or COMPLEMENT logic */ double edge0_delay, /* sec */ double edge1_delay, /* set */ @@ -157,7 +164,7 @@ int at5vxi_one_shot( int event_rtn_param /* parameter to pass to above routine */ ); -int at5vxi_one_shot_read( +at5VxiStatus at5vxi_one_shot_read( int *preset, /* TRUE or COMPLEMENT logic */ double *edge0_delay, /* sec */ double *edge1_delay, /* sec */ @@ -166,37 +173,42 @@ int at5vxi_one_shot_read( int *int_source /* (FALSE)External/(TRUE)Internal src */ ); -int at5vxi_ai_driver( - unsigned short card, - unsigned short chan, +at5VxiStatus at5vxi_ai_driver( + unsigned card, + unsigned chan, unsigned short *prval ); -int at5vxi_ao_driver( - unsigned short card, - unsigned short chan, - unsigned short *prval, +at5VxiStatus at5vxi_ao_driver( + unsigned card, + unsigned chan, + unsigned short *prval, unsigned short *prbval ); -int at5vxi_ao_read( - unsigned short card, - unsigned short chan, +at5VxiStatus at5vxi_ao_read( + unsigned card, + unsigned chan, unsigned short *pval ); -int at5vxi_bi_driver( - unsigned short card, - unsigned long mask, +at5VxiStatus at5vxi_bi_driver( + unsigned card, + unsigned long mask, unsigned long *prval ); -int at5vxi_bo_driver( - unsigned short card, +at5VxiStatus at5vxi_bo_driver( + unsigned card, unsigned long val, unsigned long mask ); +at5VxiStatus at5vxi_getioscanpvt( + unsigned card, + IOSCANPVT *scanpvt +); + struct { long number; DRVSUPFUN report; @@ -362,12 +374,12 @@ struct at5vxi_control{ struct at5vxi_dd{ - unsigned short bio[2]; - unsigned short tdata; - unsigned char pad; - unsigned char tcmd; - unsigned short ai[8]; - unsigned short ao[16]; + vxi16_t bio[2]; + vxi16_t tdata; + vxi8_t pad; + vxi8_t tcmd; + vxi16_t ai[8]; + vxi16_t ao[16]; }; @@ -393,22 +405,22 @@ struct at5vxi_setup{ #define AT5VXI_BUSY_PERIOD 2 -struct bo_val{ - unsigned long val; - unsigned long mask; +struct bo_val { + volatile int32_t val; + volatile int32_t mask; }; -struct ao_val{ - short mdt; - unsigned short val; +struct ao_val { + volatile int16_t mdt; + volatile int16_t val; }; -struct time_val{ - unsigned preset; - unsigned short iedge0_delay; - unsigned short iedge1_delay; - char mdt; - char valid; +struct time_val { + volatile unsigned preset; + volatile int16_t iedge0_delay; + volatile int16_t iedge1_delay; + volatile char mdt; + volatile char valid; }; struct at5vxi_config{ @@ -416,7 +428,7 @@ struct at5vxi_config{ struct bo_val bv; /* binary out values */ struct ao_val av[16]; /* analog out values */ struct time_val tv[10]; /* delayed pulse values */ - char mdt; /* modified data tag */ + volatile char mdt; /* modified data tag */ struct vxi_csr *pcsr; /* vxi device hdr ptr */ struct at5vxi_dd *pdd; /* at5 device dep ptr */ IOSCANPVT ioscanpvt; @@ -424,8 +436,8 @@ struct at5vxi_config{ LOCAL unsigned long at5vxiDriverID; -#define AT5VXI_PCONFIG(CARD) \ -epvxiPConfig((CARD), at5vxiDriverID, struct at5vxi_config *) +#define AT5VXI_PCONFIG(CARD, PTR) \ +epvxiFetchPConfig(CARD, at5vxiDriverID, PTR) #define AT5VXI_CORRECT_MAKE(PCSR) (VXIMAKE(PCSR)==VXI_MAKE_AT5) @@ -478,23 +490,20 @@ struct at5vxi_model at5vxi_models[] = { * initialize all at5vxi cards * */ -long -at5vxi_init( - void -) +at5VxiStatus at5vxi_init(void) { - int r0; + at5VxiStatus r0; /* * do nothing on crates without VXI */ if(!epvxiResourceMangerOK){ - return OK; + return VXI_SUCCESS; } r0 = rebootHookAdd(at5vxi_shutdown); - if(r0<0){ - return ERROR; + if(r0){ + errMessage(S_epvxi_internal, "rebootHookAdd() failed"); } at5vxiDriverID = epvxiUniqueDriverID(); @@ -505,13 +514,12 @@ at5vxi_init( dsp.flags = VXI_DSP_make; dsp.make = VXI_MAKE_AT5; r0 = epvxiLookupLA(&dsp, at5vxi_init_card, (void *)NULL); - if(r0<0){ - return ERROR; + if(r0){ + return r0; } } - return OK; - + return VXI_SUCCESS; } @@ -522,20 +530,19 @@ at5vxi_init( * disable interrupts on at5vxi cards * */ -LOCAL -void at5vxi_shutdown( - void -) +LOCAL int at5vxi_shutdown(void) { - epvxiDeviceSearchPattern dsp; - int s; + epvxiDeviceSearchPattern dsp; + at5VxiStatus s; dsp.flags = VXI_DSP_make; dsp.make = VXI_MAKE_AT5; s = epvxiLookupLA(&dsp, at5vxi_shutdown_card, (void *)NULL); - if(s<0){ - logMsg("AT5VXI module shutdown failed\n"); + if(s){ + errMessage(s,"AT5VXI module shutdown failed"); } + + return OK; } @@ -573,7 +580,7 @@ void at5vxi_init_card( unsigned addr ) { - int r0; + at5VxiStatus r0; struct at5vxi_config *pc; struct time_val *ptv; unsigned chan; @@ -585,13 +592,18 @@ void at5vxi_init_card( at5vxiDriverID, (unsigned long) sizeof(*pc), at5vxi_stat); - if(r0<0){ - logMsg("AT5VXI: device open failed %d\n", addr); + if(r0){ + errPrintf( + r0, + __FILE__, + __LINE__, + "AT5VXI: device open failed %d\n", addr); return; } - pc = AT5VXI_PCONFIG(addr); - if(pc == NULL){ + r0 = AT5VXI_PCONFIG(addr, pc); + if(r0){ + errMessage(r0, NULL); epvxiClose(addr, at5vxiDriverID); return; } @@ -660,12 +672,12 @@ void at5vxi_init_card( * FOUT source (F1) * Time of day disabled */ -# define MASTER_MODE ((unsigned short)0x2000) +# define MASTER_MODE ((uint16_t)0x2000) *PCONTROL(pc->pcsr) = BANK0; r0 = stc_init( &pc->pdd->tcmd, &pc->pdd->tdata, MASTER_MODE); - if(r0 == ERROR){ + if(r0!=STC_SUCCESS){ epvxiClose(addr, at5vxiDriverID); return; } @@ -675,7 +687,7 @@ void at5vxi_init_card( &pc->pdd->tcmd, &pc->pdd->tdata, MASTER_MODE); - if(r0 == ERROR){ + if(r0!=STC_SUCCESS){ epvxiClose(addr, at5vxiDriverID); return; } @@ -690,15 +702,19 @@ void at5vxi_init_card( *PCONTROL(pc->pcsr) = BANK0; } + /* + * casting below discards volatile + * (ok in this case) + */ r0 = stc_one_shot_read( - &ptv->preset, - &ptv->iedge0_delay, - &ptv->iedge1_delay, + (unsigned *)&ptv->preset, + (uint16_t *)&ptv->iedge0_delay, + (uint16_t *)&ptv->iedge1_delay, &pc->pdd->tcmd, &pc->pdd->tdata, chan, &int_source); - if(r0 == OK && int_source == FALSE) + if(r0 == STC_SUCCESS && int_source == FALSE) ptv->valid = TRUE; else ptv->valid = FALSE; @@ -708,7 +724,7 @@ void at5vxi_init_card( r0 = intConnect( INUM_TO_IVEC(addr), at5vxi_int_service, - (void *) addr); + addr); if(r0 == ERROR) return; @@ -728,16 +744,13 @@ void at5vxi_init_card( VXIMAKE(pc->pcsr), model, at5vxi_models[AT5VXI_INDEX_FROM_MODEL(model)].name); - if(r0<0){ - logMsg("%s: failed to register model at init: %x\n", - __FILE__, - model); + if(r0){ + errMessage(r0,NULL); } r0 = epvxiRegisterMakeName(VXI_MAKE_AT5, "LANL AT5"); - if(r0<0){ - logMsg( "%s: unable reg make\n", - __FILE__); + if(r0){ + errMessage(r0,NULL); } } @@ -755,11 +768,18 @@ void at5vxi_int_service( int addr ) { - register struct at5vxi_config *pconfig; + struct at5vxi_config *pconfig; + at5VxiStatus r0; - pconfig = AT5VXI_PCONFIG(addr); - if(!pconfig){ - logMsg("AT5VXI: int before init\n"); + r0 = AT5VXI_PCONFIG(addr, pconfig); + if(r0){ + logMsg( "AT5VXI: int before init\n", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL); return; } @@ -775,16 +795,10 @@ void at5vxi_int_service( struct at5vxi_dd *pdd; struct vxi_csr *pcsr; unsigned chan; - int r0; pcsr = pconfig->pcsr; pdd = pconfig->pdd; - if(!AT5VXI_CORRECT_MAKE(pcsr)){ - logMsg("AT5VXI: int from foreign card\n"); - return; - } - for(chan=0; chantv); chan++){ unsigned chip_chan; @@ -810,8 +824,14 @@ void at5vxi_int_service( &pdd->tdata, chip_chan, FALSE); - if(r0 == ERROR){ - logMsg("AT5 VXI- AMD9513 load fail\n"); + if(r0 != STC_SUCCESS){ + logMsg( "AT5 VXI- AMD9513 load fail\n", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL); } else{ pconfig->tv[chan].valid = TRUE; @@ -833,9 +853,9 @@ void at5vxi_int_service( } if(pconfig->bv.mask){ - unsigned work; + uint32_t work; - work = ((pdd->bio[1]<<(NBBY*sizeof(short))) | + work = ((pdd->bio[1]<<(NBBY*sizeof(uint16_t))) | pdd->bio[0]); /* alter specified bits */ @@ -843,13 +863,19 @@ void at5vxi_int_service( (pconfig->bv.val & pconfig->bv.mask); pdd->bio[0] = work; - pdd->bio[1] = work>>(NBBY*sizeof(short)); + pdd->bio[1] = work>>(NBBY*sizeof(uint16_t)); pconfig->bv.mask = 0; } if(BUSY(pcsr)) - logMsg("AT5 VXI INT- finished with card busy\n"); + logMsg( "AT5 VXI INT- finished with card busy\n", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL); pconfig->mdt = FALSE; } @@ -864,7 +890,7 @@ void at5vxi_int_service( * * setup AMD 9513 STC for a repeated two edge timing signal */ -int at5vxi_one_shot( +at5VxiStatus at5vxi_one_shot( int preset, /* TRUE or COMPLEMENT logic */ double edge0_delay, /* sec */ double edge1_delay, /* set */ @@ -875,39 +901,45 @@ int at5vxi_one_shot( int event_rtn_param /* parameter to pass to above routine */ ) { - int status; + at5VxiStatus status; register struct vxi_csr *pcsr; register struct at5vxi_config *pconfig; - pconfig = AT5VXI_PCONFIG(card); - if(!pconfig) - return ERROR; + status = AT5VXI_PCONFIG(card, pconfig); + if(status){ + return status; + } pcsr = pconfig->pcsr; - if(!AT5VXI_CORRECT_MAKE(pcsr)) - return ERROR; - /* AT5VXI does not support internal source for now -*/ if(int_source) - return ERROR; +*/ if(int_source){ + status = S_dev_badRequest; + errMessage( + status, + "AT5VXI does not support internal trigger source"); + return status; + } /* AT5VXI does not support interrupts on timing channels for now -*/ if(event_rtn) - return ERROR; +*/ if(event_rtn){ + status = S_dev_badRequest; + errMessage(status, "AT5VXI does not support interrupts on timing channels"); + return status; + } if(channel>=AT5VXI_NTIMER_CHANNELS) - return ERROR; + return S_dev_badSignalNumber; /* dont overflow unsigned short in STC -*/ if(edge0_delay >= 0xffff/EXT_TICKS) - return ERROR; - if(edge1_delay >= 0xffff/EXT_TICKS) - return ERROR; +*/ if(edge0_delay >= devCreateMask(NBBY*sizeof(uint16_t))/EXT_TICKS) + return S_dev_highValue; + if(edge1_delay >= devCreateMask(NBBY*sizeof(uint16_t))/EXT_TICKS) + return S_dev_highValue; if(edge0_delay < 0.0) - return ERROR; + return S_dev_lowValue; if(edge1_delay < 0.0) - return ERROR; + return S_dev_lowValue; FASTLOCK(&pconfig->lock); @@ -926,8 +958,8 @@ int at5vxi_one_shot( status = stc_one_shot( preset, - (unsigned short) (edge0_delay * EXT_TICKS), - (unsigned short) (edge1_delay * EXT_TICKS), + (uint16_t) (edge0_delay * EXT_TICKS), + (uint16_t) (edge1_delay * EXT_TICKS), &pdd->tcmd, &pdd->tdata, channel, @@ -950,12 +982,16 @@ int at5vxi_one_shot( pconfig->mdt = TRUE; *PCONTROL(pcsr) = CSRINIT; - status = OK; + status = STC_SUCCESS; # endif FASTUNLOCK(&pconfig->lock); - return status; + if(status!=STC_SUCCESS){ + return status; + } + + return VXI_SUCCESS; } @@ -965,7 +1001,7 @@ int at5vxi_one_shot( * * read back two edge timing from an AMD 9513 STC */ -int at5vxi_one_shot_read( +at5VxiStatus at5vxi_one_shot_read( int *preset, /* TRUE or COMPLEMENT logic */ double *edge0_delay, /* sec */ double *edge1_delay, /* sec */ @@ -975,24 +1011,21 @@ int at5vxi_one_shot_read( ) { #ifdef CONTINUOUS_OPERATION - unsigned short iedge0; - unsigned short iedge1; - unsigned int status; + uint16_t iedge0; + uint16_t iedge1; #endif + at5VxiStatus status; register struct vxi_csr *pcsr; register struct at5vxi_config *pconfig; - pconfig = AT5VXI_PCONFIG(card); - if(!pconfig) - return ERROR; + status = AT5VXI_PCONFIG(card, pconfig); + if(status) + return status; pcsr = pconfig->pcsr; - if(!AT5VXI_CORRECT_MAKE(pcsr)) - return ERROR; - if(channel>=AT5VXI_NTIMER_CHANNELS) - return ERROR; + return S_dev_badSignalNumber; # ifdef CONTINUOUS_OPERATION @@ -1024,13 +1057,13 @@ int at5vxi_one_shot_read( *PCONTROL(pcsr) = CSRINIT; FASTUNLOCK(&pconfig->lock); - if(status==OK){ + if(status==STC_SUCCESS){ /* * AT5VXI does not support external * source for now */ if(int_source) - return ERROR; + return S_dev_badRequest; *edge0_delay = iedge0 / EXT_TICKS; *edge1_delay = iedge1 / EXT_TICKS; @@ -1041,7 +1074,7 @@ int at5vxi_one_shot_read( } # else if(!pconfig->tv[channel].valid) - return ERROR; + return S_dev_badRequest; FASTLOCK(&pconfig->lock); @@ -1054,7 +1087,7 @@ int at5vxi_one_shot_read( FASTUNLOCK(&pconfig->lock); - return OK; + return VXI_SUCCESS; # endif } @@ -1077,7 +1110,7 @@ void at5vxi_stat( register struct at5vxi_dd *pdd; struct at5vxi_status status; unsigned channel; - int r0; + at5VxiStatus r0; struct at5vxi_config *pconfig; static char *busy_status[] = {"","busy"}; @@ -1093,15 +1126,19 @@ void at5vxi_stat( if(level==0) return; - pconfig = AT5VXI_PCONFIG(card); + r0 = AT5VXI_PCONFIG(card, pconfig); + if(r0){ + errMessage(r0,NULL); + return; + } pcsr = VXIBASE(card); pdd = pconfig->pdd; - r0 = vxMemProbe( &pcsr->dir.r.status, + r0 = vxMemProbe( (char *)&pcsr->dir.r.status, READ, sizeof(status), - &status); + (char *)&status); if(r0 != OK) return; @@ -1151,9 +1188,9 @@ void at5vxi_stat( } { - long work; + uint32_t work; - work = ((long)pdd->bio[1]) << (sizeof(short)*NBBY); + work = ((uint32_t)pdd->bio[1]) << (sizeof(uint16_t)*NBBY); work |= pdd->bio[0]; printf("\tBIO: value %x\n", work); } @@ -1174,7 +1211,7 @@ void at5vxi_stat( * diagnostic */ LOCAL -int at5vxi_report_timing( +at5VxiStatus at5vxi_report_timing( unsigned card, unsigned channel ) @@ -1183,7 +1220,7 @@ int at5vxi_report_timing( double edge0_delay; double edge1_delay; int int_source; - int status; + at5VxiStatus status; char *clk_src[] = {"external-clk", "internal-clk"}; status = @@ -1194,9 +1231,9 @@ int at5vxi_report_timing( card, channel, &int_source); - if(status == OK) + if(status == VXI_SUCCESS) printf( - "\tTI: channel %d preset %d delay %lf width %lf %s\n", + "\tTI: channel %d preset %d delay %f width %f %s\n", channel, preset, edge0_delay, @@ -1214,32 +1251,30 @@ int at5vxi_report_timing( * * analog input driver */ -int at5vxi_ai_driver( - unsigned short card, - unsigned short chan, +at5VxiStatus at5vxi_ai_driver( + unsigned card, + unsigned chan, unsigned short *prval ) { + at5VxiStatus s; register struct at5vxi_dd *pdd; register struct vxi_csr *pcsr; register struct at5vxi_config *pconfig; - pconfig = AT5VXI_PCONFIG(card); - if(!pconfig) - return ERROR; + s = AT5VXI_PCONFIG(card, pconfig); + if(s) + return s; pcsr = pconfig->pcsr; pdd = pconfig->pdd; - if(!AT5VXI_CORRECT_MAKE(pcsr)) - return ERROR; - if(chan >= NELEMENTS(pdd->ai)) - return ERROR; + return S_dev_badSignalNumber; *prval = pdd->ai[chan]; - return OK; + return VXI_SUCCESS; } @@ -1250,9 +1285,9 @@ int at5vxi_ai_driver( * * analog output driver */ -int at5vxi_ao_driver( - unsigned short card, - unsigned short chan, +at5VxiStatus at5vxi_ao_driver( + unsigned card, + unsigned chan, unsigned short *prval, unsigned short *prbval ) @@ -1260,19 +1295,17 @@ int at5vxi_ao_driver( struct at5vxi_dd *pdd; register struct vxi_csr *pcsr; register struct at5vxi_config *pconfig; + at5VxiStatus s; - pconfig = AT5VXI_PCONFIG(card); - if(!pconfig) - return ERROR; + s = AT5VXI_PCONFIG(card, pconfig); + if(s) + return s; pcsr = pconfig->pcsr; pdd = pconfig->pdd; - if(!AT5VXI_CORRECT_MAKE(pcsr)) - return ERROR; - if(chan >= NELEMENTS(pdd->ao)) - return ERROR; + return S_dev_badSignalNumber; #ifdef CONTINUOUS_OPERATION pdd->ao[chan] = *prval; @@ -1286,7 +1319,7 @@ int at5vxi_ao_driver( *prbval = *prval; #endif - return OK; + return VXI_SUCCESS; } @@ -1297,32 +1330,31 @@ int at5vxi_ao_driver( * * analog output read back */ -int at5vxi_ao_read( - unsigned short card, - unsigned short chan, +at5VxiStatus at5vxi_ao_read( + unsigned card, + unsigned chan, unsigned short *pval ) { register struct at5vxi_dd *pdd; register struct vxi_csr *pcsr; register struct at5vxi_config *pconfig; + at5VxiStatus s; - pconfig = AT5VXI_PCONFIG(card); - if(!pconfig) - return ERROR; + s = AT5VXI_PCONFIG(card, pconfig); + if(s){ + return s; + } pcsr = pconfig->pcsr; pdd = pconfig->pdd; - if(!AT5VXI_CORRECT_MAKE(pcsr)) - return ERROR; - if(chan >= NELEMENTS(pdd->ao)) - return ERROR; + return S_dev_badSignalNumber; *pval = pdd->ao[chan]; - return OK; + return VXI_SUCCESS; } @@ -1333,33 +1365,31 @@ int at5vxi_ao_read( * * binary input driver */ -int at5vxi_bi_driver( - unsigned short card, +at5VxiStatus at5vxi_bi_driver( + unsigned card, unsigned long mask, unsigned long *prval ) { - register unsigned long work; + register uint32_t work; register struct at5vxi_dd *pdd; register struct vxi_csr *pcsr; register struct at5vxi_config *pconfig; + at5VxiStatus s; - pconfig = AT5VXI_PCONFIG(card); - if(!pconfig) - return ERROR; + s = AT5VXI_PCONFIG(card, pconfig); + if(s) + return s; pcsr = pconfig->pcsr; pdd = pconfig->pdd; - if(!AT5VXI_CORRECT_MAKE(pcsr)) - return ERROR; - FASTLOCK(&pconfig->lock); - work = ((pdd->bio[1]<<(NBBY*sizeof(short))) | pdd->bio[0]); + work = ((pdd->bio[1]<<(NBBY*sizeof(uint16_t))) | pdd->bio[0]); *prval = mask & work; FASTUNLOCK(&pconfig->lock); - return OK; + return VXI_SUCCESS; } @@ -1370,27 +1400,25 @@ int at5vxi_bi_driver( * * binary output driver */ -int at5vxi_bo_driver( - unsigned short card, +at5VxiStatus at5vxi_bo_driver( + unsigned card, unsigned long val, unsigned long mask ) { #ifdef CONTINUOUS_OPERATION - register unsigned long work; + register uint32_t work; #endif register struct vxi_csr *pcsr; register struct at5vxi_config *pconfig; + at5VxiStatus s; - pconfig = AT5VXI_PCONFIG(card); - if(!pconfig) - return ERROR; + s = AT5VXI_PCONFIG(card, pconfig); + if(s) + return s; pcsr = pconfig->pcsr; - if(!AT5VXI_CORRECT_MAKE(pcsr)) - return ERROR; - FASTLOCK(&pconfig->lock); #ifdef CONTINUOUS_OPERATION @@ -1399,13 +1427,13 @@ int at5vxi_bo_driver( pdd = pconfig->pdd; - work = ((pdd->bio[1]<<(NBBY*sizeof(short))) | pdd->bio[0]); + work = ((pdd->bio[1]<<(NBBY*sizeof(uint16_t))) | pdd->bio[0]); /* alter specified bits */ work = (work & ~mask) | (val & mask); pdd->bio[0] = work; - pdd->bio[1] = work>>(NBBY*sizeof(short)); + pdd->bio[1] = work>>(NBBY*sizeof(uint16_t)); } #else *PCONTROL(pcsr) = INTDISABLE; @@ -1417,7 +1445,7 @@ int at5vxi_bo_driver( FASTUNLOCK(&pconfig->lock); - return OK; + return VXI_SUCCESS; } @@ -1427,14 +1455,18 @@ int at5vxi_bo_driver( * * */ -at5vxi_getioscanpvt(card,scanpvt) -unsigned short card; -IOSCANPVT *scanpvt; +at5VxiStatus at5vxi_getioscanpvt( +unsigned card, +IOSCANPVT *scanpvt +) { - register struct at5vxi_config *pconfig; + struct at5vxi_config *pconfig; + at5VxiStatus s; - pconfig = AT5VXI_PCONFIG(card); - if(pconfig) *scanpvt = pconfig->ioscanpvt; - return(0); + s = AT5VXI_PCONFIG(card, pconfig); + if(s == VXI_SUCCESS){ + *scanpvt = pconfig->ioscanpvt; + } + return s; } diff --git a/src/drv/drvEpvxi.c b/src/drv/drvEpvxi.c index db8b6c676..d9180ee4e 100644 --- a/src/drv/drvEpvxi.c +++ b/src/drv/drvEpvxi.c @@ -159,6 +159,7 @@ static char *sccsId = "$Id$\t$Date$"; #define SRCepvxiLib /* allocate externals here */ #include +#include #define NICPU030 @@ -176,9 +177,6 @@ struct { epvxiResman}; -#define VXI_HP_MODEL_E1404 0x110 -#define VXI_HP_MODEL_E1404_SLOT0 0x10 - /* * so setting ECL triggers does not mess with the * RM's address windows @@ -419,14 +417,14 @@ EPVXISTAT epvxiResman(void) * (if we are running under EPICS) */ { - UINT8 type; + SYM_TYPE type; unsigned char *pEPICS_VXI_LA_COUNT = 0; unsigned char *pEPICS_VXI_LA_BASE = 0; status = symFindByName( sysSymTbl, "_EPICS_VXI_LA_BASE", - &pEPICS_VXI_LA_BASE, + (char **)&pEPICS_VXI_LA_BASE, &type); if(status == OK){ EPICS_VXI_LA_BASE = @@ -441,7 +439,7 @@ EPVXISTAT epvxiResman(void) status = symFindByName( sysSymTbl, "_EPICS_VXI_LA_COUNT", - &pEPICS_VXI_LA_COUNT, + (char **)&pEPICS_VXI_LA_COUNT, &type); if(status == OK){ EPICS_VXI_LA_COUNT = @@ -469,8 +467,8 @@ EPVXISTAT epvxiResman(void) */ status = sysBusToLocalAdrs( VME_AM_SUP_SHORT_IO, - VXIBASEADDR, - &epvxi_local_base); + (char *)VXIBASEADDR, + (char **)&epvxi_local_base); if(status != OK){ return S_epvxi_badConfig; } @@ -745,10 +743,10 @@ LOCAL void vxi_unmap_mxi_devices(void) pmxi = VXIBASE(addr); - status = vxMemProbe( pmxi, + status = vxMemProbe( (char *)pmxi, READ, sizeof(id), - &id); + (char *)&id); if(status<0){ continue; } @@ -1126,10 +1124,10 @@ unsigned la pdevice = VXIBASE(la); - status = vxMemProbe( pdevice, + status = vxMemProbe( (char *)pdevice, READ, sizeof(id), - &id); + (char *)&id); if(status<0){ return S_epvxi_internal; } @@ -1371,10 +1369,10 @@ VXIE *pvxie } pcsr = VXIBASE(VXIDYNAMICADDR); - status = vxMemProbe( pcsr, + status = vxMemProbe( (char *)pcsr, READ, sizeof(id), - &id); + (char *)&id); if(status == OK){ errPrintf( S_epvxi_badConfig, @@ -1442,10 +1440,10 @@ VXIE *pvxie SETMODID(pvxisz, slot); status = vxMemProbe( - pcsr, + (char *)pcsr, READ, sizeof(id), - &id); + (char *)&id); if(status<0){ continue; } @@ -1460,9 +1458,9 @@ VXIE *pvxie status, "VXI: DC VXI device doesnt fit"); errPrintf( + status, __FILE__, __LINE__, - status, "VXI: DC VXI device in extender LA=0X%X ignored", pvxie->la); continue; @@ -1531,10 +1529,10 @@ unsigned *pCount } pcsr = VXIBASE(VXIDYNAMICADDR); - status = vxMemProbe( pcsr, + status = vxMemProbe( (char *)pcsr, READ, sizeof(id), - &id); + (char *)&id); if(status == OK){ status = S_epvxi_badConfig; errMessage(status, "SC device at DC address"); @@ -1565,10 +1563,10 @@ unsigned *pCount SETMODID(pvxisz, slot); status = vxMemProbe( - pcsr, + (char *)pcsr, READ, sizeof(id), - &id); + (char *)&id); if(status>=0){ nDC++; } @@ -1650,9 +1648,9 @@ unsigned la status = open_vxi_device(pvxie, la); if(status){ errPrintf( + status, __FILE__, __LINE__, - status, "attempted slot zero device open la=0X%X", la); return; @@ -1920,10 +1918,10 @@ LOCAL EPVXISTAT vxi_la_occupied(unsigned la) pi16 <= (int16_t *) &pcsr->dir.r.dd.reg.ddx2e; pi16++){ - s = vxMemProbe( pi16, + s = vxMemProbe( (char *)pi16, READ, sizeof(i16), - &i16); + (char *)&i16); if(s == OK){ return TRUE; } @@ -2409,7 +2407,8 @@ unsigned la */ LOCAL void vxi_address_config(void) { - EPVXISTAT status; + char *pBase; + EPVXISTAT status; /* * fetch the EPICS address ranges from the global @@ -2449,9 +2448,10 @@ LOCAL void vxi_address_config(void) */ status = sysBusToLocalAdrs( VME_AM_STD_SUP_DATA, - root_extender.A24_base, - &root_extender.A24_base); + (char *)root_extender.A24_base, + &pBase); if(status == OK){ + root_extender.A24_base = (long) pBase; root_extender.A24_ok = TRUE; } else{ @@ -2462,9 +2462,10 @@ LOCAL void vxi_address_config(void) } status = sysBusToLocalAdrs( VME_AM_EXT_SUP_DATA, - root_extender.A32_base, - &root_extender.A32_base); + (char *)root_extender.A32_base, + &pBase); if(status == OK){ + root_extender.A32_base = (long) pBase; root_extender.A32_ok = TRUE; } else{ @@ -2787,7 +2788,7 @@ unsigned addr int i; void *psub; - psub = (void *) intVecGet(INUM_TO_IVEC(addr)); + psub = (void *) intVecGet((FUNCPTR *)INUM_TO_IVEC(addr)); for(i=0; idir.r.status, + status = vxMemProbe( (char *)&pcsr->dir.r.status, READ, sizeof(pcsr->dir.r.status), - &device_status); + (char *)&device_status); if(status != OK){ return S_epvxi_uknDevice; } @@ -3324,8 +3325,8 @@ unsigned io_map /* bits 0-5 correspond to trig 0-5 */ * HP MODEL E1404 trigger routing */ if(VXIMAKE(pcsr)==VXI_MAKE_HP){ - if( VXIMODEL(pcsr)==VXI_HP_MODEL_E1404 || - VXIMODEL(pcsr)==VXI_HP_MODEL_E1404_SLOT0){ + if( VXIMODEL(pcsr)==VXI_HP_MODEL_E1404_REG || + VXIMODEL(pcsr)==VXI_HP_MODEL_E1404_REG_SLOT0){ return hpE1404RouteTriggerECL( la, enable_map, @@ -3449,8 +3450,8 @@ unsigned io_map /* bits 0-5 correspond to trig 0-5 */ * HP MODEL E1404 trigger routing */ if(VXIMAKE(pcsr)==VXI_MAKE_HP){ - if( VXIMODEL(pcsr)==VXI_HP_MODEL_E1404 || - VXIMODEL(pcsr)==VXI_HP_MODEL_E1404_SLOT0){ + if( VXIMODEL(pcsr)==VXI_HP_MODEL_E1404_REG || + VXIMODEL(pcsr)==VXI_HP_MODEL_E1404_REG_SLOT0){ return hpE1404RouteTriggerTTL( la, enable_map, @@ -3500,8 +3501,8 @@ unsigned level if(!epvxi_local_base){ status = sysBusToLocalAdrs( VME_AM_SUP_SHORT_IO, - VXIBASEADDR, - &epvxi_local_base); + (char *)VXIBASEADDR, + (char **)&epvxi_local_base); if(status != OK){ status = S_epvxi_badConfig; errMessage( @@ -3558,10 +3559,10 @@ int level int16_t id; pcsr = VXIBASE(la); - status = vxMemProbe( pcsr, + status = vxMemProbe( (char *)pcsr, READ, sizeof(id), - &id); + (char *)&id); if(status != OK){ return S_epvxi_internal; } @@ -3658,19 +3659,19 @@ int level printf("\tA16=0x%X ", (int) VXIBASE(la)); if(VXIMEMENBL(pcsr)){ long VMEmod = NULL; - void *VMEaddr = NULL; + char *VMEaddr = NULL; char *pname = NULL; - void *pbase; + char *pbase; switch(VXIADDRSPACE(pcsr)){ case VXI_ADDR_EXT_A24: VMEmod = VME_AM_STD_SUP_DATA; - VMEaddr = (void *) (pcsr->dir.w.offset<<8); + VMEaddr = (char *) (pcsr->dir.w.offset<<8); pname = "A24"; break; case VXI_ADDR_EXT_A32: VMEmod = VME_AM_EXT_SUP_DATA; - VMEaddr = (void *) (pcsr->dir.w.offset<<16); + VMEaddr = (char *) (pcsr->dir.w.offset<<16); pname = "A32"; break; } @@ -4029,7 +4030,12 @@ char *pmodel_name strcpy(pcopy, pmodel_name); - status = symAdd(epvxiSymbolTable, name, pcopy, EPVXI_MODEL_NAME_SYMBOL); + status = symAdd( + epvxiSymbolTable, + name, + pcopy, + EPVXI_MODEL_NAME_SYMBOL, + NULL); if(status < 0){ char *pold_model_name; UINT8 type; @@ -4085,7 +4091,12 @@ char *pmake_name strcpy(pcopy, pmake_name); - status = symAdd(epvxiSymbolTable, name, pcopy, EPVXI_MAKE_NAME_SYMBOL); + status = symAdd( + epvxiSymbolTable, + name, + pcopy, + EPVXI_MAKE_NAME_SYMBOL, + NULL); if(status<0){ char *pold_make_name; UINT8 type; diff --git a/src/drv/drvEpvxiMsg.c b/src/drv/drvEpvxiMsg.c index 5aca6b986..7071a16aa 100644 --- a/src/drv/drvEpvxiMsg.c +++ b/src/drv/drvEpvxiMsg.c @@ -57,8 +57,10 @@ static char *sccsId = "$Id$\t$Date$"; #include #include #include + #include #include +#include enum msgDeviceSyncType { syncInt, @@ -88,12 +90,6 @@ struct epvxiMessageDeviceInfo{ LOCAL int msgCommanderLA = (-1); -LOCAL -char vxiMsgSignalInit; - -#define VXI_HP_MODEL_E1404_SLOT0 0x010 -#define VXI_HP_MODEL_E1404_MSG 0x111 -#define VXI_HP_MODEL_E1404 0x110 #define abort(A) taskSuspend(0) @@ -113,7 +109,7 @@ LOCAL void vxiMsgInt( ); LOCAL void signalHandler( - unsigned short signal + int16_t signal ); LOCAL EPVXISTAT epvxiReadSlowHandshake( @@ -124,6 +120,7 @@ LOCAL EPVXISTAT epvxiReadSlowHandshake( unsigned long option ); +#ifdef FASTHANDSHAKE LOCAL EPVXISTAT epvxiReadFastHandshake( unsigned la, char *pbuf, @@ -131,6 +128,7 @@ LOCAL EPVXISTAT epvxiReadFastHandshake( unsigned long *pread_count, unsigned long option ); +#endif LOCAL EPVXISTAT vxiMsgClose( unsigned la @@ -1199,7 +1197,10 @@ void vxiHP1404MsgSignalSetup( } msgCommanderLA = hpMsgLA; - hpE1404SignalConnect(hpRegLA, signalHandler); + status = hpE1404SignalConnect(hpRegLA, signalHandler); + if(status){ + errMessage(status, NULL); + } return; } @@ -1482,7 +1483,6 @@ void vxiMsgInt( ) { VXIMDI *pvximdi; - EPVXISTAT status; /* * verify that this device is open for business @@ -1495,14 +1495,12 @@ void vxiMsgInt( * wakeup pending tasks * */ - status = semGive(pvximdi->syncSem); - if(status){ - errMessage(S_epvxi_internal,"bad sem id"); - } + semGive(pvximdi->syncSem); } else{ - logMsg( "%s: vxiMsgInt(): msg int to ukn or closed dev\n", - __FILE__, + logMsg( + "%s: vxiMsgInt(): msg int to ukn or closed dev\n", + (int)__FILE__, NULL, NULL, NULL, @@ -1518,7 +1516,7 @@ void vxiMsgInt( */ LOCAL void signalHandler( - unsigned short signal +int16_t signal ) { unsigned signal_la; @@ -1527,7 +1525,7 @@ void signalHandler( if(MBE_EVENT_TEST(signal)){ logMsg( "%s: VXI event was ignored %x\n", - __FILE__, + (int)__FILE__, signal, NULL, NULL, diff --git a/src/drv/drvHp1404a.c b/src/drv/drvHp1404a.c index 13428b595..e8ccfa069 100644 --- a/src/drv/drvHp1404a.c +++ b/src/drv/drvHp1404a.c @@ -3,7 +3,7 @@ * HP E1404A VXI bus slot zero translator * device dependent routines * - * share/src/drv @(#)drvHp1404a.c 1.4 8/27/92 + * share/src/drv/$Id$ * * Author Jeffrey O. Hill * Date 030692 @@ -40,25 +40,26 @@ * */ -static char *sccsId = "@(#)drvHp1404a.c 1.4\t8/27/92"; +static char *sccsId = "$Id$\t$Date$"; #include #include +#include +#include + +#include #include +#include LOCAL unsigned long hpE1404DriverID; struct hpE1404_config{ - void (*pSignalCallback)(); + void (*pSignalCallback)(int16_t signal); }; #define TLTRIG(N) (1<<(N)) #define ECLTRIG(N) (1<<((N)+8)) -#define VXI_HP_MODEL_E1404_REG_SLOT0 0x10 -#define VXI_HP_MODEL_E1404_REG 0x110 -#define VXI_HP_MODEL_E1404_MSG 0x111 - /* * enable int when signal register is written */ @@ -75,56 +76,28 @@ struct hpE1404_config{ #define bp_trig_drive dir.w.dd.reg.ddx22 #define signal_read dir.r.dd.reg.ddx10 -#define hpE1404PConfig(LA) \ - epvxiPConfig((LA), hpE1404DriverID, struct hpE1404_config *) +#define hpE1404PConfig(LA, PC) \ + epvxiFetchPConfig((LA), hpE1404DriverID, (PC)) -static void hpE1404InitLA( +LOCAL void hpE1404InitLA( unsigned la ); -static void hpE1404ShutDown( +LOCAL int hpE1404ShutDown( void ); -static void hpE1404ShutDownLA( +LOCAL void hpE1404ShutDownLA( unsigned la ); -/* - * these should be in a header file - */ -int hpE1404SignalConnect( - unsigned la, - void (*pSignalCallback)() +LOCAL void hpE1404IOReport( +unsigned la, +unsigned level ); -static void hpE1404Int( - unsigned la -); - -int hpE1404RouteTriggerECL( -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 */ -); - -int hpE1404RouteTriggerTTL( -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 */ -); - -static void hpE1404IOReport( - unsigned la, - unsigned level +LOCAL void hpE1404Int( +unsigned la ); @@ -134,36 +107,46 @@ static void hpE1404IOReport( * hpE1404Init * */ -int -hpE1404Init( - void -) +hpE1404Stat hpE1404Init(void) { - int status; - + hpE1404Stat status; status = rebootHookAdd(hpE1404ShutDown); if(status<0){ - return ERROR; + status = S_dev_internal; + errMessage(status, "rebootHookAdd() failed"); + return status; } hpE1404DriverID = epvxiUniqueDriverID(); - epvxiRegisterMakeName( + status = epvxiRegisterMakeName( VXI_MAKE_HP, "Hewlett-Packard"); - epvxiRegisterModelName( + if(status){ + errMessage(status, NULL); + } + status = epvxiRegisterModelName( VXI_MAKE_HP, VXI_HP_MODEL_E1404_REG_SLOT0, "Slot Zero Translator (reg)"); - epvxiRegisterModelName( + if(status){ + errMessage(status, NULL); + } + status = epvxiRegisterModelName( VXI_MAKE_HP, VXI_HP_MODEL_E1404_REG, "Translator (reg)"); - epvxiRegisterModelName( + if(status){ + errMessage(status, NULL); + } + status = epvxiRegisterModelName( VXI_MAKE_HP, VXI_HP_MODEL_E1404_MSG, "Translator (msg)"); + if(status){ + errMessage(status, NULL); + } { epvxiDeviceSearchPattern dsp; @@ -172,18 +155,20 @@ hpE1404Init( dsp.make = VXI_MAKE_HP; dsp.model = VXI_HP_MODEL_E1404_REG_SLOT0; status = epvxiLookupLA(&dsp, hpE1404InitLA, (void *)NULL); - if(status<0){ - return ERROR; + if(status){ + errMessage(status, NULL); + return status; } dsp.model = VXI_HP_MODEL_E1404_REG; status = epvxiLookupLA(&dsp, hpE1404InitLA, (void *)NULL); - if(status<0){ - return ERROR; + if(status){ + errMessage(status, NULL); + return status; } } - return OK; + return VXI_SUCCESS; } @@ -193,28 +178,27 @@ hpE1404Init( * * */ -LOCAL -void hpE1404ShutDown( - void -) +LOCAL int hpE1404ShutDown(void) { - int status; + hpE1404Stat status; epvxiDeviceSearchPattern dsp; dsp.flags = VXI_DSP_make | VXI_DSP_model; dsp.make = VXI_MAKE_HP; dsp.model = VXI_HP_MODEL_E1404_REG_SLOT0; status = epvxiLookupLA(&dsp, hpE1404ShutDownLA, (void *)NULL); - if(status<0){ - return; + if(status){ + errMessage(status, NULL); + return ERROR; } dsp.model = VXI_HP_MODEL_E1404_REG; status = epvxiLookupLA(&dsp, hpE1404ShutDownLA, (void *)NULL); - if(status<0){ - return; + if(status){ + errMessage(status, NULL); + return ERROR; } - + return OK; } @@ -249,25 +233,23 @@ void hpE1404InitLA( { struct hpE1404_config *pc; struct vxi_csr *pcsr; - int status; + hpE1404Stat status; status = epvxiOpen( la, hpE1404DriverID, sizeof(*pc), hpE1404IOReport); - if(status<0){ - logMsg( "%s: device open failed (stat=%d) (LA=0X%02X)\n", - __FILE__, - status, - la); + if(status){ + errMessage(status, NULL); return; } pcsr = VXIBASE(la); - pc = hpE1404PConfig(la); - if(!pc){ + status = hpE1404PConfig(la, pc); + if(status){ + errMessage(status, NULL); epvxiClose(la, hpE1404DriverID); return; } @@ -281,7 +263,7 @@ void hpE1404InitLA( intConnect( INUM_TO_IVEC(la), hpE1404Int, - (void *) la); + la); /* * enable int when signal register is written @@ -297,21 +279,22 @@ void hpE1404InitLA( * hpE1404SignalConnect() * */ -int hpE1404SignalConnect( - unsigned la, - void (*pSignalCallback)() +hpE1404Stat hpE1404SignalConnect( +unsigned la, +void (*pSignalCallback)(int16_t signal) ) { + hpE1404Stat s; struct hpE1404_config *pc; - pc = hpE1404PConfig(la); - if(!pc){ - return ERROR; + s = hpE1404PConfig(la, pc); + if(s){ + return s; } pc->pSignalCallback = pSignalCallback; - return OK; + return VXI_SUCCESS; } @@ -325,12 +308,14 @@ void hpE1404Int( unsigned la ) { + hpE1404Stat s; struct vxi_csr *pcsr; unsigned short signal; struct hpE1404_config *pc; - pc = hpE1404PConfig(la); - if(!pc){ + s = hpE1404PConfig(la, pc); + if(s){ + errMessage(s, NULL); return; } @@ -354,7 +339,7 @@ void hpE1404Int( * hpE1404RouteTriggerECL * */ -int hpE1404RouteTriggerECL( +hpE1404Stat hpE1404RouteTriggerECL( unsigned la, /* slot zero device logical address */ unsigned enable_map, /* bits 0-5 correspond to trig 0-5 */ /* a 1 enables a trigger */ @@ -382,7 +367,7 @@ unsigned io_map /* bits 0-5 correspond to trig 0-5 */ * * */ -int hpE1404RouteTriggerTTL( +hpE1404Stat hpE1404RouteTriggerTTL( unsigned la, /* slot zero device logical address */ unsigned enable_map, /* bits 0-5 correspond to trig 0-5 */ /* a 1 enables a trigger */ diff --git a/src/drv/drvHpe1368a.c b/src/drv/drvHpe1368a.c index 498ca53db..de87059ba 100644 --- a/src/drv/drvHpe1368a.c +++ b/src/drv/drvHpe1368a.c @@ -44,6 +44,11 @@ static char *sccsId = "$Id$\t$Date$"; #include #include #include +#include +#include +#include +#include + #include #include #include @@ -51,50 +56,70 @@ static char *sccsId = "$Id$\t$Date$"; #include #include #include - -static long init(); +#include -struct { - long number; - DRVSUPFUN report; - DRVSUPFUN init; -} drvHpe1368a={ - 2, - NULL, /*VXI io report takes care of this */ - init}; - - -static long init() -{ - hpe1368a_init(); - return(0); -} #define VXI_MODEL_HPE1368A (0xf28) -#define HPE1368A_PCONFIG(LA) \ -epvxiPConfig((LA), hpe1368aDriverId, struct hpe1368a_config *) +#define HPE1368A_PCONFIG(LA, PC) \ +epvxiFetchPConfig((LA), hpe1368aDriverId, (PC)) #define ChannelEnable(PCSR) ((PCSR)->dir.w.dd.reg.ddx08) #define ModuleStatus(PCSR) ((PCSR)->dir.r.status) #define ALL_SWITCHES_OPEN 0 +typedef long hpe1368aStat; + struct hpe1368a_config{ FAST_LOCK lock; /* mutual exclusion */ unsigned short pending; /* switch position pending int */ unsigned short shadow; /* shadow of actual switch pos */ int busy; /* relays active */ - IOSCANPVT ioscanpvt; + IOSCANPVT ioscanpvt; }; #define HPE1368A_INT_LEVEL 1 -static int hpe1368aDriverId; +LOCAL int hpe1368aDriverId; -static void hpe1368a_int_service(); -static void hpe1368a_init_card(); -static void hpe1368a_stat(); +/* + * external + */ +hpe1368aStat hpe1368a_init(void); + +hpe1368aStat hpe1368a_getioscanpvt( +unsigned la, +IOSCANPVT *scanpvt +); + +hpe1368aStat hpe1368a_bo_driver( +unsigned la, +unsigned val, +unsigned mask +); + +hpe1368aStat hpe1368a_bi_driver( +unsigned la, +unsigned mask, +unsigned *pval +); + +/* + * internal + */ +LOCAL void hpe1368a_int_service(unsigned la); +LOCAL void hpe1368a_init_card(unsigned la); +LOCAL void hpe1368a_stat(unsigned la, int level); + +struct { + long number; + DRVSUPFUN report; + DRVSUPFUN init; +} drvHpe1368a={ + 2, + NULL, /*VXI io report takes care of this */ + hpe1368a_init}; /* @@ -103,15 +128,15 @@ static void hpe1368a_stat(); * initialize all hpe1368a cards * */ -hpe1368a_init() +hpe1368aStat hpe1368a_init(void) { - int r0; + hpe1368aStat r0; /* * do nothing on crates without VXI */ if(!epvxiResourceMangerOK){ - return OK; + return VXI_SUCCESS; } hpe1368aDriverId = epvxiUniqueDriverID(); @@ -123,12 +148,13 @@ hpe1368a_init() dsp.make = VXI_MAKE_HP; dsp.model = VXI_MODEL_HPE1368A; r0 = epvxiLookupLA(&dsp, hpe1368a_init_card, (void *)NULL); - if(r0<0){ - return ERROR; + if(r0){ + errMessage(r0, NULL); + return r0; } } - return OK; + return VXI_SUCCESS; } @@ -139,11 +165,9 @@ hpe1368a_init() * initialize single at5vxi card * */ -LOCAL void -hpe1368a_init_card(la) -unsigned la; +LOCAL void hpe1368a_init_card(unsigned la) { - int r0; + hpe1368aStat r0; struct hpe1368a_config *pc; struct vxi_csr *pcsr; int model; @@ -153,13 +177,14 @@ unsigned la; hpe1368aDriverId, (unsigned long) sizeof(*pc), hpe1368a_stat); - if(r0<0){ - logMsg("hpe1368a: device open failed %d\n", la); + if(r0){ + errMessage(r0,NULL); return; } - pc = HPE1368A_PCONFIG(la); - if(pc == NULL){ + r0 = HPE1368A_PCONFIG(la, pc); + if(r0){ + errMessage(r0, NULL); return; } @@ -179,9 +204,11 @@ unsigned la; r0 = intConnect( INUM_TO_IVEC(la), hpe1368a_int_service, - (void *) la); - if(r0 == ERROR) + la); + if(r0 == ERROR){ + errMessage(S_dev_vxWorksVecInstlFail, NULL); return; + } sysIntEnable(HPE1368A_INT_LEVEL); @@ -190,14 +217,12 @@ unsigned la; VXIMAKE(pcsr), model, "E 1368A Microwave Switch\n"); - if(r0<0){ - logMsg("%s: failed to register model at init: %x\n", - __FILE__, - model); + if(r0){ + errMessage(r0, NULL); } r0 = epvxiRegisterMakeName(VXIMAKE(pcsr), "Hewlett-Packard"); - if(r0<0){ - logMsg( "%s: failed to register make\n", __FILE__); + if(r0){ + errMessage(r0,NULL); } } @@ -212,13 +237,13 @@ unsigned la; * */ LOCAL void -hpe1368a_int_service(la) -unsigned la; +hpe1368a_int_service(unsigned la) { + hpe1368aStat s; struct hpe1368a_config *pc; - pc = HPE1368A_PCONFIG(la); - if(pc == NULL){ + s = HPE1368A_PCONFIG(la,pc); + if(s){ return; } @@ -242,16 +267,18 @@ unsigned la; * initialize single at5vxi card * */ -LOCAL void -hpe1368a_stat(la,level) -unsigned la; -int level; +LOCAL void hpe1368a_stat( +unsigned la, +int level +) { + hpe1368aStat s; struct hpe1368a_config *pc; struct vxi_csr *pcsr; - pc = HPE1368A_PCONFIG(la); - if(pc == NULL){ + s = HPE1368A_PCONFIG(la, pc); + if(s){ + errMessage(s,NULL); return; } pcsr = VXIBASE(la); @@ -265,44 +292,49 @@ int level; } } - - - -hpe1368a_getioscanpvt(la,scanpvt) -unsigned short la; -IOSCANPVT *scanpvt; + +/* + * hpe1368a_getioscanpvt() + */ +hpe1368aStat hpe1368a_getioscanpvt( +unsigned la, +IOSCANPVT *scanpvt +) { + hpe1368aStat s; struct hpe1368a_config *pc; - pc = HPE1368A_PCONFIG(la); - if(pc != NULL) *scanpvt = pc->ioscanpvt; - return(0); + s = HPE1368A_PCONFIG(la, pc); + if(s){ + errMessage(s, NULL); + return s; + } + *scanpvt = pc->ioscanpvt; + return VXI_SUCCESS; } /* - * * HPE1368A_BO_DRIVER - * - * - * */ -int -hpe1368a_bo_driver(la,val,mask) -register unsigned short la; -register unsigned int val; -unsigned int mask; +hpe1368aStat hpe1368a_bo_driver( +unsigned la, +unsigned val, +unsigned mask +) { + hpe1368aStat s; struct hpe1368a_config *pc; struct vxi_csr *pcsr; unsigned int work; - pc = HPE1368A_PCONFIG(la); - if(pc == NULL){ - return ERROR; - } - - pcsr = VXIBASE(la); + s = HPE1368A_PCONFIG(la, pc); + if(s){ + errMessage(s, NULL); + return s; + } + + pcsr = VXIBASE(la); FASTLOCK(&pc->lock); @@ -317,7 +349,7 @@ unsigned int mask; FASTUNLOCK(&pc->lock); - return OK; + return VXI_SUCCESS; } @@ -329,16 +361,19 @@ unsigned int mask; * * */ -hpe1368a_bi_driver(la,mask,pval) -register unsigned short la; -unsigned int mask; -register unsigned int *pval; +hpe1368aStat hpe1368a_bi_driver( +unsigned la, +unsigned mask, +unsigned *pval +) { + hpe1368aStat s; struct hpe1368a_config *pc; - pc = HPE1368A_PCONFIG(la); - if(pc == NULL){ - return ERROR; + s = HPE1368A_PCONFIG(la, pc); + if(s){ + errMessage(s, NULL); + return s; } FASTLOCK(&pc->lock); @@ -347,5 +382,5 @@ register unsigned int *pval; FASTUNLOCK(&pc->lock); - return OK; + return VXI_SUCCESS; } diff --git a/src/drv/drvHpe1445a.c b/src/drv/drvHpe1445a.c index 0b2479699..bebda334c 100644 --- a/src/drv/drvHpe1445a.c +++ b/src/drv/drvHpe1445a.c @@ -41,8 +41,10 @@ static char *sccsId = "$Id$\t$Date$"; #include #include #include + #include #include +#include #include /* @@ -53,8 +55,7 @@ static char *sccsId = "$Id$\t$Date$"; #define VXI_MODEL_HPE1445A (418) -LOCAL -int hpe1445aDriverId; +LOCAL int hpe1445aDriverId; #define HPE1445A_MAX_POINTS 0x40000 #define HPE1445A_MIN_POINTS 4 @@ -66,28 +67,30 @@ struct hpe1445aConfig { char device_active; double dacPeakAmplitude; double dacOffset; + char buf[256]; }; -#define HPE1445A_PCONFIG(LA) \ -epvxiPConfig((LA), hpe1445aDriverId, struct hpe1445aConfig *) +#define HPE1445A_PCONFIG(LA, PC) \ +epvxiFetchPConfig((LA), hpe1445aDriverId, (PC)) +typedef long hpe1445aStat; /* * * For External Use * */ -long hpe1445aInit(void); -long hpe1445aSetupDAC(unsigned la, double dacPeakAmplitude, double dacOffset); -long hpe1445aSetupFreq(unsigned la, char *pFreqString); -void hpe1445aIoReport(unsigned la, int level); -long hpe1445aLoadWaveform(unsigned la, char *pWaveformName, +hpe1445aStat hpe1445aInit(void); +hpe1445aStat hpe1445aSetupDAC(unsigned la, double dacPeakAmplitude, double dacOffset); +hpe1445aStat hpe1445aSetupFreq(unsigned la, char *pFreqString); +void hpe1445aIoReport(unsigned la, int level); +hpe1445aStat hpe1445aLoadWaveform(unsigned la, char *pWaveformName, double *pdata, unsigned long npoints); -long hpe1445aUnloadWaveform(unsigned la, char *pWaveformName); -long hpe1445aActivateWaveform(unsigned la, char *pWaveformName); -long hpe1445aTest(unsigned la); -long hpe1445aWriteWithLineno(unsigned la, char *pmsg, unsigned lineno); -void hpe1445aLogErrorsWithLineno(unsigned la, int lineno); +hpe1445aStat hpe1445aUnloadWaveform(unsigned la, char *pWaveformName); +hpe1445aStat hpe1445aActivateWaveform(unsigned la, char *pWaveformName); +hpe1445aStat hpe1445aTest(unsigned la); +hpe1445aStat hpe1445aWriteWithLineno(unsigned la, char *pmsg, unsigned lineno); +void hpe1445aLogErrorsWithLineno(unsigned la, int lineno); /* @@ -95,17 +98,19 @@ void hpe1445aLogErrorsWithLineno(unsigned la, int lineno); * For Driver Internal Use * */ -static void hpe1445aInitCard(unsigned la); -static long hpe1445aReset(unsigned la); -static long logEntireError(unsigned la, int lineno); -static long hpe1445aActivateWaveformLocked(unsigned la, char *pWaveformName, +LOCAL void hpe1445aInitCard(unsigned la); +LOCAL hpe1445aStat hpe1445aReset(unsigned la); +LOCAL hpe1445aStat logEntireError(unsigned la, int lineno); +LOCAL hpe1445aStat hpe1445aActivateWaveformLocked(unsigned la, char *pWaveformName, struct hpe1445aConfig *pc); -static long hpe1445aSetupFunction(unsigned la); -static long hpe1445aSetupOutput(unsigned la); -static long hpe1445aArm(unsigned la); -static long hpe1445aUnloadWaveformLocked(unsigned la, char *pWaveformName); -static long hpe1445aLoadWaveformLocked(unsigned la, struct hpe1445aConfig *pc, - char *pWaveformName, double *pdata, unsigned long npoints); +LOCAL hpe1445aStat hpe1445aSetupFunction(unsigned la); +LOCAL hpe1445aStat hpe1445aSetupOutput(unsigned la); +LOCAL hpe1445aStat hpe1445aArm(unsigned la); +LOCAL hpe1445aStat hpe1445aUnloadWaveformLocked(unsigned la, char *pWaveformName); +LOCAL hpe1445aStat hpe1445aLoadWaveformLocked(unsigned la, + struct hpe1445aConfig *pc, + char *pWaveformName, double *pdata, + unsigned long npoints); #define logErrors(LA) hpe1445aLogErrorsWithLineno(LA, __LINE__) @@ -117,7 +122,7 @@ static long hpe1445aLoadWaveformLocked(unsigned la, struct hpe1445aConfig *pc, #define PREFIX_MAX_NAME_LENGTH 3 #define MAX_NAME_LENGTH (HPE1445A_MAX_NAME_LENGTH-PREFIX_MAX_NAME_LENGTH) -#define TEST_FILE_NAME "~hill/hpe1445a.dat" +#define TEST_FILE_NAME "hpe1445a.dat" /* @@ -126,97 +131,102 @@ static long hpe1445aLoadWaveformLocked(unsigned la, struct hpe1445aConfig *pc, * * */ -long -hpe1445aTest(unsigned la) +hpe1445aStat hpe1445aTest(unsigned la) { - int s; - FILE *pf; - char *pfn = TEST_FILE_NAME; - double *pwaveform; - int nsamples; - int i; + hpe1445aStat s; + FILE *pf; + char *pfn = TEST_FILE_NAME; + double *pwaveform; + int nsamples; + int i; - { - int options; - s = taskOptionsGet(taskIdSelf(), &options); - if(s < 0){ - return ERROR; - } - if(!(options&VX_STDIO)){ - logMsg( "%s: task needs SDIO option set\n", - __FILE__, - NULL, - NULL, - NULL, - NULL, - NULL); - return ERROR; - } - } - pf = fopen(pfn, "r"); if(!pf){ - logMsg("%s: file access problems %s\n", __FILE__, pfn); + s = S_dev_internal; + errPrintf( + s, + __FILE__, + __LINE__, + "file access problems %s", + pfn); fclose(pf); - return ERROR; + return s; } s = fscanf(pf, "%d", &nsamples); if(s!=1){ - logMsg("%s: no element count in the file %s\n", __FILE__, pfn); + s = S_dev_internal; + errPrintf( + s, + __FILE__, + __LINE__, + "no element count in the file %s", + pfn); fclose(pf); - return ERROR; + return s; } pwaveform = (double *) calloc(nsamples, sizeof(double)); if(!pwaveform){ - logMsg("%s: unable to allocate enough memory s\n", __FILE__, pfn); + s = S_dev_noMemory; + errPrintf( + s, + __FILE__, + __LINE__, + "specified sample count to large %s", + pfn); fclose(pf); - return ERROR; + return s; } for(i=0; ibuf, + sizeof(pc->buf), &read_count, 0); if(s!=S_epvxi_bufferFull && s!=VXI_SUCCESS){ - logMsg( "%s line=%d LA=0X%X: error fetch problem %d\n", + errPrintf( + s, __FILE__, lineno, - la, - s); - return ERROR; + "error fetch problem at LA=0X%X", + la); + return s; } nreads++; /* @@ -432,25 +457,27 @@ int lineno int val; int n; - n = sscanf(pbuf,"%d",&val); + n = sscanf(pc->buf,"%d",&val); if(n==1){ if(val==0){ - return ERROR; + return S_epvxi_internal; } } } - logMsg( "%s line=%d LA=0X%X: Device Error => %s\n", + errPrintf( + S_epvxi_msgDeviceStatus, __FILE__, lineno, + "LA=0X%X: Error => %s", la, - pbuf); + pc->buf); if(s==VXI_SUCCESS){ break; } } - return OK; + return VXI_SUCCESS; } @@ -461,26 +488,26 @@ int lineno * */ LOCAL -long hpe1445aReset(unsigned la) +hpe1445aStat hpe1445aReset(unsigned la) { - int s; + hpe1445aStat s; s = hpe1445aWrite(la, "*RST"); - if(s<0){ - return ERROR; + if(s){ + return s; } s = hpe1445aWrite(la, "source:list1:ssequence:delete:all"); - if(s<0){ - return ERROR; + if(s){ + return s; } s = hpe1445aWrite(la, "source:list1:segment:delete:all"); - if(s<0){ - return ERROR; + if(s){ + return s; } - return OK; + return VXI_SUCCESS; } @@ -490,23 +517,29 @@ long hpe1445aReset(unsigned la) * * */ -long hpe1445aSetupFreq(unsigned la, char *pFreqString) +hpe1445aStat hpe1445aSetupFreq(unsigned la, char *pFreqString) { - char pbuf[64]; - int s; + hpe1445aStat s; + struct hpe1445aConfig *pc; + + s = HPE1445A_PCONFIG(la, pc); + if(s){ + errMessage(s,NULL); + return s; + } /* * * Set the sample rate * */ - sprintf(pbuf, "source:frequency:fixed %s", pFreqString); - s = hpe1445aWrite(la, pbuf); - if(s<0){ - return ERROR; + sprintf(pc->buf, "source:frequency:fixed %s", pFreqString); + s = hpe1445aWrite(la, pc->buf); + if(s){ + return s; } - return OK; + return VXI_SUCCESS; } @@ -517,9 +550,9 @@ long hpe1445aSetupFreq(unsigned la, char *pFreqString) * */ LOCAL -long hpe1445aSetupFunction(unsigned la) +hpe1445aStat hpe1445aSetupFunction(unsigned la) { - int s; + hpe1445aStat s; /* * @@ -527,11 +560,11 @@ long hpe1445aSetupFunction(unsigned la) * */ s = hpe1445aWrite(la, "source:function:shape user"); - if(s<0){ - return ERROR; + if(s){ + return s; } - return OK; + return VXI_SUCCESS; } @@ -542,9 +575,9 @@ long hpe1445aSetupFunction(unsigned la) * */ LOCAL -long hpe1445aSetupOutput(unsigned la) +hpe1445aStat hpe1445aSetupOutput(unsigned la) { - int s; + hpe1445aStat s; /* @@ -553,8 +586,8 @@ long hpe1445aSetupOutput(unsigned la) * */ s = hpe1445aWrite(la, "output:impedance 50 Ohm"); - if(s<0){ - return ERROR; + if(s){ + return s; } /* @@ -564,11 +597,11 @@ long hpe1445aSetupOutput(unsigned la) * */ s = hpe1445aWrite(la, "output:filter:lpass:state off"); - if(s<0){ - return ERROR; + if(s){ + return s; } - return OK; + return VXI_SUCCESS; } @@ -576,9 +609,9 @@ long hpe1445aSetupOutput(unsigned la) * hpe1445aArm() * */ -long hpe1445aArm(unsigned la) +hpe1445aStat hpe1445aArm(unsigned la) { - int s; + hpe1445aStat s; /* * @@ -590,8 +623,8 @@ long hpe1445aArm(unsigned la) #else s = hpe1445aWrite(la, "arm:start:layer2:source ttltrg0"); #endif - if(s<0){ - return ERROR; + if(s){ + return s; } /* @@ -600,8 +633,8 @@ long hpe1445aArm(unsigned la) * */ s = hpe1445aWrite(la, "arm:start:layer2:slope positive"); - if(s<0){ - return ERROR; + if(s){ + return s; } /* @@ -611,8 +644,8 @@ long hpe1445aArm(unsigned la) * */ s = hpe1445aWrite(la, "arm:start:layer1:count 1"); - if(s<0){ - return ERROR; + if(s){ + return s; } /* @@ -622,11 +655,11 @@ long hpe1445aArm(unsigned la) * */ s = hpe1445aWrite(la, "arm:start:layer2:count infinity"); - if(s<0){ - return ERROR; + if(s){ + return s; } - return OK; + return VXI_SUCCESS; } @@ -638,43 +671,41 @@ long hpe1445aArm(unsigned la) * * */ -long -hpe1445aSetupDAC( +hpe1445aStat hpe1445aSetupDAC( unsigned la, double dacPeakAmplitude, double dacOffset) { - char pbuf[64]; - int s; + hpe1445aStat s; struct hpe1445aConfig *pc; - pc = HPE1445A_PCONFIG(la); - if(!pc){ - logMsg("%s: device offline\n", __FILE__); - return ERROR; + s = HPE1445A_PCONFIG(la,pc); + if(s){ + errMessage(s,NULL); + return s; } - sprintf( pbuf, - "source:voltage:level:immediate:amplitude %lf V", - dacPeakAmplitude); - s = hpe1445aWrite(la, pbuf); - if(s<0){ - return ERROR; + sprintf(pc->buf, + "source:voltage:level:immediate:amplitude %f V", + dacPeakAmplitude); + s = hpe1445aWrite(la, pc->buf); + if(s){ + return s; } pc->dacPeakAmplitude = dacPeakAmplitude; - sprintf( pbuf, - "source:voltage:level:immediate:offset %lf V", - dacOffset); - s = hpe1445aWrite(la, pbuf); - if(s<0){ - return ERROR; + sprintf(pc->buf, + "source:voltage:level:immediate:offset %f V", + dacOffset); + s = hpe1445aWrite(la, pc->buf); + if(s){ + return s; } pc->dacOffset = dacOffset; logErrors(la); - return OK; + return VXI_SUCCESS; } @@ -686,19 +717,18 @@ double dacOffset) * * */ -long -hpe1445aActivateWaveform( +hpe1445aStat hpe1445aActivateWaveform( unsigned la, char *pWaveformName ) { - int s; + hpe1445aStat s; struct hpe1445aConfig *pc; - pc = HPE1445A_PCONFIG(la); - if(!pc){ - logMsg("%s: device offline\n", __FILE__); - return ERROR; + s = HPE1445A_PCONFIG(la, pc); + if(s){ + errMessage(s,NULL); + return s; } FASTLOCK(&pc->lck); @@ -718,20 +748,19 @@ char *pWaveformName * * */ -LOCAL long +LOCAL hpe1445aStat hpe1445aActivateWaveformLocked( unsigned la, char *pWaveformName, struct hpe1445aConfig *pc ) { - char pbuf[64]; int s; if(pc->device_active){ s = hpe1445aWrite(la, "abort"); - if(s<0){ - return ERROR; + if(s){ + return s; } pc->device_active = FALSE; } @@ -741,13 +770,13 @@ struct hpe1445aConfig *pc * select active sequence * */ - sprintf( pbuf, + sprintf( pc->buf, "source:function:user %s%s", SEQUENCE_NAME_PREFIX, pWaveformName); - s = hpe1445aWrite(la, pbuf); - if(s<0){ - return ERROR; + s = hpe1445aWrite(la, pc->buf); + if(s){ + return s; } /* @@ -756,14 +785,14 @@ struct hpe1445aConfig *pc * */ s = hpe1445aWrite(la, "initiate:immediate"); - if(s<0){ - return ERROR; + if(s){ + return s; } pc->device_active = TRUE; logErrors(la); - return OK; + return VXI_SUCCESS; } @@ -775,19 +804,18 @@ struct hpe1445aConfig *pc * * */ -long -hpe1445aUnloadWaveform( +hpe1445aStat hpe1445aUnloadWaveform( unsigned la, char *pWaveformName ) { - int s; + hpe1445aStat s; struct hpe1445aConfig *pc; - pc = HPE1445A_PCONFIG(la); - if(!pc){ - logMsg("%s: device offline\n", __FILE__); - return ERROR; + s = HPE1445A_PCONFIG(la, pc); + if(s){ + errMessage(s, NULL); + return s; } FASTLOCK(&pc->lck); @@ -809,58 +837,59 @@ char *pWaveformName * * */ -LOCAL long -hpe1445aUnloadWaveformLocked( +LOCAL hpe1445aStat hpe1445aUnloadWaveformLocked( unsigned la, char *pWaveformName ) { - char pbuf[64]; - int s; + hpe1445aStat s; + struct hpe1445aConfig *pc; + + s = HPE1445A_PCONFIG(la, pc); + if(s){ + errMessage(s, NULL); + return s; + } sprintf( - pbuf, + pc->buf, "source:list:ssequence:select %s%s", SEQUENCE_NAME_PREFIX, pWaveformName); - s = hpe1445aWrite(la, pbuf); - if(s<0){ - return ERROR; + s = hpe1445aWrite(la, pc->buf); + if(s){ + return s; } s = hpe1445aWrite(la, "source:list:ssequence:delete:selected"); - if(s<0){ - return ERROR; + if(s){ + return s; } sprintf( - pbuf, + pc->buf, "source:list:segment:select %s%s", SEGMENT_NAME_PREFIX, pWaveformName); - s = hpe1445aWrite(la, pbuf); - if(s<0){ - return ERROR; + s = hpe1445aWrite(la, pc->buf); + if(s){ + return s; } s = hpe1445aWrite(la, "source:list:segment:delete:selected"); - if(s<0){ - return ERROR; + if(s){ + return s; } - return OK; + return VXI_SUCCESS; } /* - * * hpe1445aLoadWaveform() - * - * - * */ -long +hpe1445aStat hpe1445aLoadWaveform( unsigned la, char *pWaveformName, @@ -868,23 +897,25 @@ double *pdata, unsigned long npoints ) { - int s; + hpe1445aStat s; struct hpe1445aConfig *pc; - pc = HPE1445A_PCONFIG(la); - if(!pc){ - logMsg("%s: device offline\n", __FILE__); - return ERROR; + s = HPE1445A_PCONFIG(la, pc); + if(s){ + errMessage(s, NULL); + return s; } if(strlen(pWaveformName)>MAX_NAME_LENGTH){ - logMsg("%s: waveform element name to long\n", __FILE__); - return ERROR; + s = S_dev_highValue; + errMessage(s, "waveform element name to long"); + return s; } if(npointslck); @@ -903,8 +934,7 @@ unsigned long npoints * * */ -LOCAL long -hpe1445aLoadWaveformLocked( +LOCAL hpe1445aStat hpe1445aLoadWaveformLocked( unsigned la, struct hpe1445aConfig *pc, char *pWaveformName, @@ -912,37 +942,49 @@ double *pdata, unsigned long npoints ) { - unsigned long read_count; - char pbuf[64]; - int s; + unsigned long read_count; + hpe1445aStat s; s = hpe1445aWrite(la, "source:list:segment:free?"); - if(s<0){ - return ERROR; + if(s){ + return s; } s = epvxiRead( la, - pbuf, - sizeof(pbuf), + pc->buf, + sizeof(pc->buf), &read_count, 0); - if(s!=VXI_SUCCESS){ - logMsg("\"source:list:segment:free?\" query failed\n"); - return ERROR; + if(s){ + errMessage(s, "\"source:list:segment:free?\" query failed"); + return s; } { int nfree; int nused; - s = sscanf(pbuf, "%d,%d", &nfree, &nused); + s = sscanf(pc->buf, "%d,%d", &nfree, &nused); if(s!=2){ - return ERROR; + s = S_dev_internal; + errMessage(s, "bad \"source:list:segment:free?\" resp"); + return s; } if(nfree < npoints){ - logMsg("%s: %d waveform elements available\n", nfree); - logMsg("%s: %d element waveform rejected\n", npoints); - return ERROR; + s = S_dev_internal; + errPrintf( + s, + __FILE__, + __LINE__, + "%d waveform elements available", + nfree); + errPrintf( + s, + __FILE__, + __LINE__, + "%d element waveform rejected", + npoints); + return s; } } @@ -954,29 +996,29 @@ unsigned long npoints * */ sprintf( - pbuf, + pc->buf, "source:list:segment:select %s%s", SEGMENT_NAME_PREFIX, pWaveformName); - s = hpe1445aWrite(la, pbuf); - if(s<0){ - return ERROR; + s = hpe1445aWrite(la, pc->buf); + if(s){ + return s; } - sprintf(pbuf, "source:list:segment:define %u", npoints); - s = hpe1445aWrite(la, pbuf); - if(s<0){ - return ERROR; + sprintf(pc->buf, "source:list:segment:define %u", npoints); + s = hpe1445aWrite(la, pc->buf); + if(s){ + return s; } - sprintf( pbuf, + sprintf( pc->buf, "source:arbitrary:download VXI,%s%s,%d", SEGMENT_NAME_PREFIX, pWaveformName, npoints); - s = hpe1445aWrite(la, pbuf); - if(s<0){ - return ERROR; + s = hpe1445aWrite(la, pc->buf); + if(s){ + return s; } /* @@ -984,18 +1026,18 @@ unsigned long npoints * command prior to the backplane download */ s = hpe1445aWrite(la, "*OPC?"); - if(s<0){ - return ERROR; + if(s){ + return s; } s = epvxiRead( la, - pbuf, - sizeof(pbuf), + pc->buf, + sizeof(pc->buf), &read_count, 0); - if(s!=VXI_SUCCESS){ - logMsg("\"*OPC?\" query failed\n"); - return ERROR; + if(s){ + errMessage(s,"\"*OPC?\" query failed"); + return s; } { @@ -1040,8 +1082,8 @@ unsigned long npoints } s = hpe1445aWrite(la, "source:arbitrary:download:complete"); - if(s<0){ - return ERROR; + if(s){ + return s; } /* @@ -1049,37 +1091,36 @@ unsigned long npoints * install this segment into the sequence * */ - sprintf( pbuf, + sprintf( pc->buf, "source:list:ssequence:select %s%s", SEQUENCE_NAME_PREFIX, pWaveformName); - s = hpe1445aWrite(la, pbuf); - if(s<0){ - return ERROR; + s = hpe1445aWrite(la, pc->buf); + if(s){ + return s; } + /* - * * set the number of segments in this sequence - * */ s = hpe1445aWrite(la, "source:list:ssequence:define 1"); - if(s<0){ - return ERROR; + if(s){ + return s; } - sprintf(pbuf, + sprintf(pc->buf, "source:list:ssequence:sequence %s%s", SEGMENT_NAME_PREFIX, pWaveformName); - s = hpe1445aWrite(la, pbuf); - if(s<0){ - return ERROR; + s = hpe1445aWrite(la, pc->buf); + if(s){ + return s; } s = hpe1445aWrite(la, "source:list:ssequence:dwell:count 1"); - if(s<0){ - return ERROR; + if(s){ + return s; } - return OK; + return VXI_SUCCESS; } @@ -1088,14 +1129,14 @@ unsigned long npoints * hpe1445aWriteWithLineno() * */ -long hpe1445aWriteWithLineno( +hpe1445aStat hpe1445aWriteWithLineno( unsigned la, char *pmsg, unsigned lineno ) { unsigned long nactual; - int s; + hpe1445aStat s; s = epvxiWrite( la, @@ -1103,18 +1144,18 @@ long hpe1445aWriteWithLineno( strlen(pmsg), &nactual, 0); - if(s<0){ - logMsg( "%s: VXI message write failed\n", - __FILE__); - logMsg("%s: LA=0X%02X LINE=%d MSG=%s\n", + if(s){ + errPrintf( + s, __FILE__, - la, lineno, + "LA=0X%02X MSG=%s", + la, pmsg); - return ERROR; + return s; } - return OK; + return VXI_SUCCESS; } @@ -1126,17 +1167,19 @@ long hpe1445aWriteWithLineno( */ void hpe1445aIoReport(unsigned la, int level) { + hpe1445aStat s; struct hpe1445aConfig *pc; char *pStateName[] = {"in",""}; - pc = HPE1445A_PCONFIG(la); - if(!pc){ + s = HPE1445A_PCONFIG(la, pc); + if(s){ + errMessage(s, NULL); return; } if(level>0){ - printf("\tdevice %sactive, DAC peak = %lf V, DAC offset = %lf V\n", - pStateName[pc->device_active], + printf("\tdevice %sactive, DAC peak = %f V, DAC offset = %f V\n", + pStateName[(unsigned)pc->device_active], pc->dacPeakAmplitude, pc->dacOffset); } diff --git a/src/drv/drvJgvtr1.c b/src/drv/drvJgvtr1.c index e2db73ded..3bb74f602 100644 --- a/src/drv/drvJgvtr1.c +++ b/src/drv/drvJgvtr1.c @@ -55,7 +55,7 @@ * 080493 mgb Removed V5/V4 and EPICS_V2 conditionals */ -static char *sccsID = "@(#)drvJgvtr1.c 1.9\t8/27/92"; +static char *sccsID = "$Id$\t$Date$"; /* * Code Portions @@ -72,6 +72,11 @@ static char *sccsID = "@(#)drvJgvtr1.c 1.9\t8/27/92"; /* drvJgvtr1.c - Driver Support Routines for Jgvtr1 */ #include +#include +#include +#include +#include +#include #include #include @@ -79,45 +84,46 @@ static char *sccsID = "@(#)drvJgvtr1.c 1.9\t8/27/92"; #include #include #include -#include -#include +#include -#include +typedef long jgvtr1Stat; +#define JGVTR1_SUCCESS 0 - -static long jgvtr1_io_report( +LOCAL jgvtr1Stat jgvtr1_io_report( unsigned level ); -static long jgvtr1_init( +LOCAL jgvtr1Stat jgvtr1_init( void ); -static void jgvtr1_int_service( +#ifdef INTERRUPT_HARDWARE_FIXED +LOCAL void jgvtr1_int_service( + void +); +#endif + +LOCAL void jgvtr1DoneTask( void ); -static void jgvtr1DoneTask( - void -); - -static int jgvtr1_dump( +LOCAL jgvtr1Stat jgvtr1_dump( unsigned card, unsigned n ); +LOCAL jgvtr1Stat jgvtr1_stat( + unsigned card, + int level +); + /* * should be in a header file */ -int jgvtr1_driver( - unsigned short card, - unsigned int *pcbroutine, - unsigned int *parg /* number of values read */ -); - -static int jgvtr1_stat( - unsigned card, - short int level +jgvtr1Stat jgvtr1_driver( + unsigned card, + unsigned *pcbroutine, + unsigned *parg /* number of values read */ ); struct { @@ -129,16 +135,14 @@ struct { jgvtr1_io_report, jgvtr1_init}; -static char SccsId[] = "@(#)jgvtr1_driver.c 1.4\t11/14/88"; - -static char *stdaddr; -static char *shortaddr; +static volatile char *stdaddr; +static volatile char *shortaddr; #define JGVTR1MAXFREQ 25.0e6 /* NBBY - the number of bits per byte */ -#define JGVTR1SHORTSIZE (1<<(NBBY*sizeof(char))) -#define JGVTR1STDSIZE (1<<(NBBY*sizeof(short))) +#define JGVTR1SHORTSIZE (1<<(NBBY*sizeof(uint8_t))) +#define JGVTR1STDSIZE (1<<(NBBY*sizeof(uint16_t))) #define JGVTR1_INT_LEVEL 5 #define JGVTR1BASE(CARD)\ (shortaddr+wf_addrs[JGVTR1]+(CARD)*JGVTR1SHORTSIZE) @@ -161,13 +165,13 @@ are complemented. !! our compiler allocates bit fields starting from the ms bit !! */ struct jgvtr1_status{ - unsigned pad:8; - unsigned internal_frequency:3; - unsigned internal_clock:1; - unsigned cycle_complete:1; - unsigned interrupt:1; - unsigned active:1; - unsigned memory_full:1; + volatile unsigned pad:8; + volatile unsigned internal_frequency:3; + volatile unsigned internal_clock:1; + volatile unsigned cycle_complete:1; + volatile unsigned interrupt:1; + volatile unsigned active:1; + volatile unsigned memory_full:1; }; struct jgvtr1_config{ @@ -176,20 +180,21 @@ struct jgvtr1_config{ void (*psub)(); /* call back routine */ void *pprm; /* call back parameter */ FAST_LOCK lock; /* mutual exclusion */ - unsigned short *pdata; /* pointer to the data buffer */ + uint16_t *pdata; /* pointer to the data buffer */ }; /* amount of data to make available from the waveform */ #define JRG_MEM_SIZE 2048 -static +LOCAL struct jgvtr1_config *pjgvtr1_config; -static + +LOCAL int jgvtr1_max_card_count; #ifdef INTERRUPT_HARDWARE_FIXED - static - SEM_ID jgvtr1_interrupt; /* interrupt event */ +LOCAL +SEM_ID jgvtr1_interrupt; /* interrupt event */ #endif @@ -200,26 +205,33 @@ int jgvtr1_max_card_count; * intialize the driver for the joerger vtr1 * */ -long jgvtr1_init( - void -) +jgvtr1Stat jgvtr1_init(void) { - register unsigned card; - register unsigned card_count = 0; - register struct jgvtr1_config - *pconfig; - short readback; - int status; + unsigned card; + unsigned card_count = 0; + struct jgvtr1_config *pconfig; + uint16_t readback; + jgvtr1Stat status; - if ((status = sysBusToLocalAdrs(VME_AM_SUP_SHORT_IO,0,&shortaddr)) != OK){ - printf("Addressing error for short address in jgvtr1 driver\n"); - return ERROR; + status = sysBusToLocalAdrs( + VME_AM_SUP_SHORT_IO, + 0, + (char **)&shortaddr); + if (status != OK){ + status = S_dev_badA16; + errMessage(status,NULL); + return status; } - if ((status = sysBusToLocalAdrs(VME_AM_STD_SUP_DATA,0,&stdaddr)) != OK){ - logMsg("Addressing error for standard address in jgvtr1 driver\n"); - return ERROR; + status = sysBusToLocalAdrs( + VME_AM_STD_SUP_DATA, + 0, + (char **)&stdaddr); + if (status != OK){ + status = S_dev_badA24; + errMessage(status,NULL); + return status; } jgvtr1_max_card_count = wf_num_cards[JGVTR1]; @@ -233,9 +245,11 @@ long jgvtr1_init( pjgvtr1_config = (struct jgvtr1_config *) calloc(wf_num_cards[JGVTR1], sizeof(*pjgvtr1_config)); - if(!pjgvtr1_config) - return ERROR; - + if(!pjgvtr1_config){ + status = S_dev_noMemory; + errMessage(status,NULL); + return status; + } for( card=0, pconfig=pjgvtr1_config; card < wf_num_cards[JGVTR1]; @@ -243,16 +257,16 @@ long jgvtr1_init( FASTLOCKINIT(&pconfig->lock); - status = vxMemProbe( JGVTR1BASE(card), + status = vxMemProbe( (char *)JGVTR1BASE(card), READ, sizeof(readback), - &readback); + (char *)&readback); if(status==ERROR) continue; pconfig->pdata = - (unsigned short *)malloc(JRG_MEM_SIZE); + (uint16_t *)malloc(JRG_MEM_SIZE); /* not easy to test for correct addressing in standard address space since the module does @@ -280,10 +294,24 @@ long jgvtr1_init( WFDONE_PRI, WFDONE_OPT, WFDONE_STACK, - (FUNCPTR) jgvtr1DoneTask); - if(status == ERROR) - return ERROR; - taskwdInsert(status,NULL,NULL); + (FUNCPTR) jgvtr1DoneTask, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL); + if(status < 0){ + status = S_dev_internal; + errMessage(status, "vxWorks taskSpawn failed"); + return status; + } + + taskwdInsert(status, NULL, NULL); # ifdef INTERRUPT_HARDWARE_FIXED @@ -291,11 +319,11 @@ long jgvtr1_init( jgvtr1_int_service, NULL); if(status != OK) - return ERROR; + return S_dev_internal; sysIntEnable(JGVTR_INT_LEVEL); # endif - return OK; + return JGVTR1_SUCCESS; } @@ -306,31 +334,31 @@ long jgvtr1_init( * initiate waveform read * */ -int jgvtr1_driver( - unsigned short card, - unsigned int *pcbroutine, - unsigned int *parg /* number of values read */ +jgvtr1Stat jgvtr1_driver( +unsigned card, +unsigned *pcbroutine, +unsigned *parg /* number of values read */ ) { if(card >= jgvtr1_max_card_count) - return ERROR; + return S_dev_badSignalNumber; if(!pjgvtr1_config[card].present) - return ERROR; + return S_dev_noDevice; if(pjgvtr1_config[card].psub) - return ERROR; + return S_dev_badRequest; FASTLOCK(&pjgvtr1_config[card].lock); - *(short *)JGVTR1BASE(card) = JGVTR1ARM; + *(volatile uint16_t *)JGVTR1BASE(card) = JGVTR1ARM; pjgvtr1_config[card].pprm = parg; pjgvtr1_config[card].psub = (void (*)()) pcbroutine; FASTUNLOCK(&pjgvtr1_config[card].lock); - return OK; + return JGVTR1_SUCCESS; } @@ -341,7 +369,7 @@ int jgvtr1_driver( * */ #ifdef INTERRUPT_HARDWARE_FIXED -void jgvtr1_int_service(void) +LOCAL void jgvtr1_int_service(void) { semGive(jgvtr1_interrupt); } @@ -355,16 +383,15 @@ void jgvtr1_int_service(void) * and call back to the database with the waveform size and address * */ -void jgvtr1DoneTask( - void -) +LOCAL void jgvtr1DoneTask(void) { - register unsigned card; - register struct jgvtr1_config *pconfig; - struct jgvtr1_status stat; - static char started = FALSE; - register unsigned short *pdata,*pjgdata; - register long i; + unsigned card; + struct jgvtr1_config *pconfig; + struct jgvtr1_status stat; + static char started = FALSE; + volatile uint16_t *pdata; + volatile uint16_t *pjgdata; + long i; /* dont allow two of this task */ if(started) @@ -379,6 +406,7 @@ void jgvtr1DoneTask( /* ges: changed from 20 ticks to 2 ticks 2/4/91 */ taskDelay(2); # endif + for( card=0, pconfig = pjgvtr1_config; card < jgvtr1_max_card_count; card++, pconfig++){ @@ -412,15 +440,20 @@ void jgvtr1DoneTask( until it has data */ if(!pconfig->std_ok){ - short readback; - int status; + uint16_t readback; + int status; - status = vxMemProbe( JGVTR1DATA(card), - READ, - sizeof(readback), - &readback); + status = vxMemProbe( + (char *)JGVTR1DATA(card), + READ, + sizeof(readback), + (char *)&readback); if(status==ERROR){ - logMsg( "jgvtr1 card %d incorrectly addressed- use std addr %x\n", + errPrintf( + S_dev_badA24, + __FILE__, + __LINE__, + "jgvtr1 card %d incorrectly addressed- use std addr 0X%X", card, JGVTR1DATA(card)); pconfig->present = FALSE; @@ -436,16 +469,18 @@ void jgvtr1DoneTask( for memory full is used for now ) */ if(!stat.memory_full){ - logMsg("jgvtr1 driver: proceeding with partial mem\n"); - logMsg("jgvtr1 driver: beware of bus errors\n"); + errMessage(S_dev_internal, + "jgvtr1 driver: proceeding with partial mem"); + errMessage(S_dev_internal, + "jgvtr1 driver: beware of bus errors"); } /* copy the data into a local memory buffer */ /* this is to avoid any bus errors */ for(i = 0, pdata = pconfig->pdata, - pjgdata = (unsigned short *)JGVTR1DATA(card); - i < JRG_MEM_SIZE/sizeof(unsigned short); + pjgdata = (volatile uint16_t *)JGVTR1DATA(card); + i < JRG_MEM_SIZE/sizeof(uint16_t); i++, pdata++, pjgdata++){ *pdata = *pjgdata; } @@ -471,17 +506,15 @@ void jgvtr1DoneTask( * * */ -long jgvtr1_io_report( - unsigned level -) +LOCAL jgvtr1Stat jgvtr1_io_report(unsigned level) { unsigned card; unsigned nelements; - int status; + jgvtr1Stat status; for(card=0; card < wf_num_cards[JGVTR1]; card++){ status = jgvtr1_stat(card,level); - if(status<0){ + if(status){ continue; } if (level >= 2){ @@ -492,7 +525,7 @@ long jgvtr1_io_report( } } } - return OK; + return JGVTR1_SUCCESS; } @@ -505,13 +538,13 @@ long jgvtr1_io_report( * * */ -int jgvtr1_stat( +jgvtr1Stat jgvtr1_stat( unsigned card, -short int level +int level ) { - struct jgvtr1_status stat; - int status; + struct jgvtr1_status stat; + jgvtr1Stat status; /* internal freq status is bit reversed so I @@ -539,10 +572,10 @@ short int level static char *memory_status[] = {"", "mem-full"}; - status = vxMemProbe( JGVTR1BASE(card), + status = vxMemProbe( (char *)JGVTR1BASE(card), READ, sizeof(stat), - &stat); + (char *)&stat); if(status != OK) return ERROR; if (level == 0) @@ -557,7 +590,7 @@ short int level activity_status[ stat.active ], memory_status[ stat.memory_full ]); - return OK; + return JGVTR1_SUCCESS; } @@ -565,36 +598,35 @@ short int level * jgvtr1_dump * */ -LOCAL -int jgvtr1_dump( - unsigned card, - unsigned n +LOCAL jgvtr1Stat jgvtr1_dump( +unsigned card, +unsigned n ) { - register unsigned short *pjgdata; - unsigned short *pread; - unsigned short *pdata; - unsigned nread; - int status; + volatile uint16_t *pjgdata; + uint16_t *pread; + uint16_t *pdata; + unsigned nread; + jgvtr1Stat status; /* Print out the data if user requests it. */ n = min(JRG_MEM_SIZE,n); - pdata = (unsigned short *)malloc(n * (sizeof(*pdata))); + pdata = (uint16_t *)malloc(n * (sizeof(*pdata))); if(!pdata){ - return ERROR; + return S_dev_noMemory; } pread = pdata; nread = 0; - pjgdata = (unsigned short *)JGVTR1DATA(card); + pjgdata = (volatile uint16_t *)JGVTR1DATA(card); while(nread <= (n>>1)){ status = vxMemProbe( - pjgdata, + (char *)pjgdata, READ, sizeof(*pread), - pread); + (char *)pread); if(status<0){ break; } @@ -616,5 +648,5 @@ int jgvtr1_dump( free(pdata); - return OK; + return JGVTR1_SUCCESS; } diff --git a/src/drv/drvKscV215.c b/src/drv/drvKscV215.c index b898e174a..497c562bd 100644 --- a/src/drv/drvKscV215.c +++ b/src/drv/drvKscV215.c @@ -44,37 +44,26 @@ #include #include #include +#include + #include #include #include #include #include #include - -static long init(); - -struct { - long number; - DRVSUPFUN report; - DRVSUPFUN init; -} drvKscV215={ - 2, - NULL, /* VXI report takes care of this */ - init}; +#include -static long init() -{ - KscV215Init(); - return(0); -} +typedef long kscV215Stat; + #define VXI_MODEL_KSCV215 (0x215) #define MAXTRIES 100 -#define KSCV215_PCONFIG(LA) \ -epvxiPConfig((LA), KscV215DriverId, struct KscV215_config *) +#define KSCV215_PCONFIG(LA, PC) \ +epvxiFetchPConfig((LA), KscV215DriverId, PC) #define ChannelEnable(PCSR) ((PCSR)->dir.w.dd.reg.ddx08) #define ModuleStatus(PCSR) ((PCSR)->dir.r.status) @@ -90,12 +79,7 @@ struct KscV215_config{ #define KscV215Handshake (0x0040) #define KscV215csrInit (0x9000) -static int KscV215DriverId; - -static void KscV215_int_service(); -static void KscV215_init_card(); -static void KscV215_stat(); -static int KscV215WriteSync(); +LOCAL int KscV215DriverId; struct KscV215_A24{ @@ -131,6 +115,49 @@ struct KscV215_A24{ unsigned short pad14; }; +/* + * external + */ +kscV215Stat KscV215Init(void); +kscV215Stat KscV215_ai_driver( +unsigned la, +unsigned chan, +unsigned short *prval +); + +/* + * internal + */ +#ifdef INTERRUPTS +LOCAL void KscV215_int_service(unsigned la); +#endif +LOCAL void KscV215_init_card(unsigned la); + +kscV215Stat KscV215_getioscanpvt( +unsigned la, +IOSCANPVT *scanpvt +); + +LOCAL void KscV215_stat( +unsigned la, +int level +); + +LOCAL kscV215Stat KscV215WriteSync( +struct KscV215_A24 *pA24, +unsigned short *preg, +unsigned val +); + + +struct { + long number; + DRVSUPFUN report; + DRVSUPFUN init; +} drvKscV215={ + 2, + NULL, /* VXI report takes care of this */ + KscV215Init}; /* * KscV215_init @@ -138,15 +165,15 @@ struct KscV215_A24{ * initialize all KscV215 cards * */ -KscV215Init() +kscV215Stat KscV215Init(void) { - int r0; + kscV215Stat r0; /* * do nothing on crates without VXI */ if(!epvxiResourceMangerOK){ - return ERROR; + return VXI_SUCCESS; } KscV215DriverId = epvxiUniqueDriverID(); @@ -158,12 +185,12 @@ KscV215Init() dsp.make = VXI_MAKE_KSC; dsp.model = VXI_MODEL_KSCV215; r0 = epvxiLookupLA(&dsp, KscV215_init_card, (void *)NULL); - if(r0<0){ - return ERROR; + if(r0){ + return r0; } } - return OK; + return VXI_SUCCESS; } @@ -174,11 +201,9 @@ KscV215Init() * initialize single at5vxi card * */ -LOCAL void -KscV215_init_card(la) -unsigned la; +LOCAL void KscV215_init_card(unsigned la) { - int status; + kscV215Stat status; int i; struct KscV215_config *pc; struct KscV215_A24 *pA24; @@ -190,13 +215,20 @@ unsigned la; KscV215DriverId, (unsigned long) sizeof(*pc), KscV215_stat); - if(status<0){ - logMsg("KscV215: device open failed %d\n", la); + if(status){ + errPrintf( + status, + __FILE__, + __LINE__, + "AT5VXI: device open failed %d\n", + la); + return; } - pc = KSCV215_PCONFIG(la); - if(pc == NULL){ + status = KSCV215_PCONFIG(la, pc); + if(status){ + errMessage(status,NULL); epvxiClose(la, KscV215DriverId); return; } @@ -207,9 +239,9 @@ unsigned la; pcsr->dir.w.control = KscV215csrInit; status = KscV215WriteSync(pA24, &pA24->controlMemoryAddr, 0); - if(status<0){ + if(status){ epvxiClose(la, KscV215DriverId); - logMsg("KscV215 init failed\n"); + errMessage(status, "KscV215 init failed\n"); return; } for(i=0; i<(NELEMENTS(pA24->channels)/2); i++){ @@ -217,9 +249,9 @@ unsigned la; pA24, &pA24->controlMemoryDataWrite, 0); - if(status<0){ + if(status){ epvxiClose(la, KscV215DriverId); - logMsg("KscV215 init failed\n"); + errMessage(status, "KscV215 init failed\n"); return; } } @@ -231,9 +263,9 @@ unsigned la; pA24, &pA24->enableContinuousScanning, 0); - if(status<0){ + if(status){ epvxiClose(la, KscV215DriverId); - logMsg("KscV215 init failed- device left open\n"); + errMessage(status, "KscV215 init failed- device left open\n"); return; } @@ -245,15 +277,18 @@ unsigned la; (unsigned char) INUM_TO_IVEC(la), KscV215_int_service, (void *) la); - if(status == ERROR) + if(status == ERROR){ + epvxiClose(la, KscV215DriverId); + errMessage(S_dev_vxWorksVecInstlFail, + "KscV215 init failed- device left open"); return; + } sysIntEnable(KSCV215_INT_LEVEL); #endif status = epvxiRegisterMakeName(VXI_MAKE_KSC, "Kinetic Systems"); - if(status<0){ - logMsg("%s: unable reg make\n", - __FILE__); + if(status){ + errMessage(status, NULL); } model = VXIMODEL(pcsr); @@ -261,10 +296,8 @@ unsigned la; VXIMAKE(pcsr), model, "V215 16 bit 32 channel ADC\n"); - if(status<0){ - logMsg("%s: failed to register model at init: %x\n", - __FILE__, - model); + if(status){ + errMessage(status, NULL); } } @@ -276,25 +309,26 @@ unsigned la; * * */ -LOCAL int -KscV215WriteSync(pA24, preg, val) -struct KscV215_A24 *pA24; -unsigned short *preg; -unsigned short val; +LOCAL kscV215Stat KscV215WriteSync( +struct KscV215_A24 *pA24, +unsigned short *preg, +unsigned val +) { - int i; + kscV215Stat status; + int i; for(i=0; idiag & KscV215Handshake){ - return OK; + return VXI_SUCCESS; } taskDelay(1); } - logMsg("KscV215 timed out\n"); - - return ERROR; + status = S_dev_deviceTMO; + errMessage(status, NULL); + return status; } @@ -308,21 +342,22 @@ unsigned short val; * */ #ifdef INTERRUPTS -LOCAL void -KscV215_int_service(la) -unsigned la; +LOCAL void KscV215_int_service(unsigned la) { + kscV215Stat s; struct KscV215_config *pc; - pc = KSCV215_PCONFIG(la); - if(pc == NULL){ - return; - } - - /* - * operation completed so we can update - * the shadow value - */ + s = KSCV215_PCONFIG(la, pc); + if(s){ + logMsg( "Int to ukn device %s line=%d\n", + __FILE__, + __LINE__, + NULL, + NULL, + NULL, + NULL); + return; + } /* * tell them that the switches have settled @@ -338,18 +373,20 @@ unsigned la; * initialize single at5vxi card * */ -LOCAL void -KscV215_stat(la,level) -unsigned la; -int level; +LOCAL void KscV215_stat( +unsigned la, +int level +) { + kscV215Stat s; struct KscV215_config *pc; struct vxi_csr *pcsr; struct KscV215_A24 *pA24; int i; - pc = KSCV215_PCONFIG(la); - if(pc == NULL){ + s = KSCV215_PCONFIG(la, pc); + if(s){ + errMessage(s, NULL); return; } pcsr = VXIBASE(la); @@ -405,28 +442,30 @@ int level; * * analog input driver */ -int -KscV215_ai_driver(la,chan,prval) -register unsigned short la; -unsigned short chan; -register unsigned short *prval; +kscV215Stat KscV215_ai_driver( +unsigned la, +unsigned chan, +unsigned short *prval +) { struct KscV215_config *pc; struct vxi_csr *pcsr; struct KscV215_A24 *pA24; long tmp; int i; + kscV215Stat s; - pc = KSCV215_PCONFIG(la); - if(pc == NULL){ - return ERROR; + s = KSCV215_PCONFIG(la, pc); + if(s){ + return s; } pcsr = VXIBASE(la); pA24 = epvxiA24Base(la); - if(chan >= NELEMENTS(pA24->channels)/2) - return ERROR; + if(chan >= NELEMENTS(pA24->channels)/2){ + return S_dev_badSignalNumber; + } for(i=0; ichannels[chan<<1]; @@ -435,21 +474,32 @@ register unsigned short *prval; tmp = tmp >> 4; tmp &= 0xfff; *prval = tmp; - return OK; + return VXI_SUCCESS; } taskDelay(1); } - return ERROR; + s = S_dev_deviceTMO; + return s; } + -KscV215_getioscanpvt(la,scanpvt) -unsigned short la; -IOSCANPVT *scanpvt; +/* + * KscV215_getioscanpvt() + */ +kscV215Stat KscV215_getioscanpvt( +unsigned la, +IOSCANPVT *scanpvt +) { + kscV215Stat s; struct KscV215_config *pc; - pc = KSCV215_PCONFIG(la); - if(pc != NULL) *scanpvt = pc->ioscanpvt; - return(0); + s = KSCV215_PCONFIG(la, pc); + if(s){ + errMessage(s, NULL); + return s; + } + *scanpvt = pc->ioscanpvt; + return VXI_SUCCESS; } diff --git a/src/drv/drvMz8310.c b/src/drv/drvMz8310.c index 465178ffd..d086e1fa2 100644 --- a/src/drv/drvMz8310.c +++ b/src/drv/drvMz8310.c @@ -1,8 +1,8 @@ /* drvMz8310.c */ -/* share/src/drv @(#)drvMz8310.c 1.9 8/27/92 */ +/* share/src/drv$Id$*/ /* - * Routines specific to the MZ8310 Low level routines for the AMD STC in + * Routines specific to the MZ8310. Low level routines for the AMD STC in * stc_driver.c * Author: Jeff Hill * Date: Feb 1989 @@ -48,33 +48,29 @@ * bg 06-26-92 Added level to mz8310_io_report. * joh 08-05-92 callable interface now conforms with epics standard * mgb 08-04-93 Removed V5/V4 and EPICS_V2 conditionals + * joh 08-24-93 Include drvStc.h and ANSI C upgrade */ /* drvMz8310.c - Driver Support Routines for Mz8310 */ #include #include +#include +#include +#include +#include +#include #include +#include #include #include #include #include +#include +#include -#include - - -/* If any of the following does not exist replace it with #define <> NULL */ -static long mz8310_io_report(); -static long mz8310_init(); - -struct { - long number; - DRVSUPFUN report; - DRVSUPFUN init; -} drvMz8310={ - 2, - mz8310_io_report, - mz8310_init}; +typedef long mz8310Stat; +#define MZ8310_SUCCESS 0 #define MZ8310CHIPSIZE 0x20 #define MZ8310SIZE 0x00000100 @@ -96,12 +92,12 @@ struct { (CHIP_REVERSE(CHIP)*MZ8310CHIPSIZE)) #define MZ8310_CMD_ADDR(CARD,CHIP)\ -((unsigned char *) CHIP_ADDR(CARD,CHIP) + MZ8310CMD) +((volatile unsigned char *) CHIP_ADDR(CARD,CHIP) + MZ8310CMD) #define MZ8310_DATA_ADDR(CARD,CHIP)\ -((unsigned short *) CHIP_ADDR(CARD,CHIP) + MZ8310DATA) +((volatile unsigned short *) CHIP_ADDR(CARD,CHIP) + MZ8310DATA) #if 0 #define MZ8310VECBASE(CARD,CHIP)\ -((unsigned char *) CHIP_ADDR(CARD,CHIP) + 0x41) +((volatile unsigned char *) CHIP_ADDR(CARD,CHIP) + 0x41) #endif #define MZ8310VECSIZE (0x20) @@ -129,15 +125,15 @@ struct mz8310_conf{ }; struct mz8310_strap_info{ - unsigned char irq; /* the level at which the chan gen ints */ - unsigned char vec_num; /* really a vec offset-see MZ8310INTVEC */ - unsigned char vec_addr; /* offset from card base address */ + unsigned char irq; /* the level at which the chan gen ints */ + unsigned char vec_num; /* really a vec offset-see MZ8310INTVEC */ + unsigned char vec_addr;/* offset from card base address */ }; -static char *shortaddr; +static volatile char *shortaddr; -static struct mz8310_conf *mzconf; -static unsigned int mz8310_card_count; +LOCAL struct mz8310_conf *mzconf; +LOCAL unsigned int mz8310_card_count; /* only 4 unique interrupts per card but any channel can potentially @@ -155,7 +151,7 @@ static unsigned int mz8310_card_count; IRQD 0xa1 */ -static struct mz8310_strap_info mz8310_strap[MZ8310CHANCNT] = +LOCAL struct mz8310_strap_info mz8310_strap[MZ8310CHANCNT] = { { NULL, NULL, NULL }, /* channel 0 */ { NULL, NULL, NULL }, /* channel 1 */ @@ -170,35 +166,90 @@ static struct mz8310_strap_info mz8310_strap[MZ8310CHANCNT] = }; /* forward reference. */ +LOCAL int mz8310_reset(void); +LOCAL mz8310Stat mz8310_io_report_card(unsigned card, int level); +LOCAL mz8310Stat mz8310_init_card(unsigned card); +LOCAL mz8310Stat mz8310_setup_int(unsigned card, unsigned channel); +LOCAL mz8310Stat mz8310_io_report(int level); +LOCAL mz8310Stat mz8310_init(void); +LOCAL mz8310Stat mz8310_read_test(int card, int channel); +LOCAL void mz8310_int_service(struct mz8310_int_conf *icf); -static void mz8310_reset(); -static int mz8310_io_report_card(int card, int level); +/* externals */ +mz8310Stat mz8310_one_shot_read( +int *preset, /* TRUE or COMPLEMENT logic */ +double *edge0_delay, /* sec */ +double *edge1_delay, /* sec */ +int card, /* 0 through ... */ +int channel, /* 0 through channels on a card */ +int *int_source /* (FALSE)External/(TRUE)Internal src */ +); +mz8310Stat mz8310_one_shot( +int preset, /* TRUE or COMPLEMENT logic */ +double edge0_delay, /* sec */ +double edge1_delay, /* set */ +int card, /* 0 through ... */ +int channel, /* 0 through channels on a card */ +int int_source, /* (FALSE)External/ (TRUE)Internal source */ +void *event_rtn, /* subroutine to run on events */ +int event_rtn_param /* parameter to pass to above routine */ +); -long mz8310_io_report(level) -int level; +int mz8310_cmd( +unsigned value, +unsigned card, +unsigned chip +); + +int mz8310_rdata(int card, int chip); + +int mz8310_wdata( +unsigned value, +int card, +int chip +); + +struct { + long number; + DRVSUPFUN report; + DRVSUPFUN init; +} drvMz8310={ + 2, + mz8310_io_report, + mz8310_init}; + + +/* + * mz8310_io_report() + */ +LOCAL mz8310Stat mz8310_io_report(int level) { unsigned card; for(card=0; card= MZ8310CHANONCHIP * MZ8310CHIPCOUNT) - return ERROR; + return S_dev_badSignalNumber; if(card>=mz8310_card_count) - return ERROR; + return S_dev_badA16; if(!mzconf) - return ERROR; + return S_dev_noDevice; FASTLOCK(&mzconf[card].lock); @@ -387,7 +453,7 @@ int *int_source; /* (FALSE)External/(TRUE)Internal src */ MZ8310_DATA_ADDR(card,chip), channel % MZ8310CHANONCHIP, int_source); - if(status==OK){ + if(status==STC_SUCCESS){ ticks = *int_source ? INT_TICKS : EXT_TICKS; *edge0_delay = iedge0 / ticks; *edge1_delay = iedge1 / ticks; @@ -398,15 +464,17 @@ int *int_source; /* (FALSE)External/(TRUE)Internal src */ return status; } -mz8310_read_test(card,channel) -int card; -int channel; + +/* + * mz8310_read_test() + */ +LOCAL mz8310Stat mz8310_read_test(int card, int channel) { int preset; double edge0_delay; double edge1_delay; int int_source; - int status; + mz8310Stat status; static char *pclktype[] = {"external-clk", "internal-clk"}; static char *ppresettype[] = {"preset-FALSE", "preset-TRUE "}; @@ -418,8 +486,8 @@ int channel; card, channel, &int_source); - if(status == OK){ - printf( "\tChannel %d %s delay=%lf width=%lf %s\n", + if(status==MZ8310_SUCCESS){ + printf( "\tChannel %d %s delay=%f width=%f %s\n", channel, ppresettype[preset&1], edge0_delay, @@ -434,47 +502,43 @@ int channel; return status; } - -mz8310_one_shot( preset, - edge0_delay, - edge1_delay, - card, - channel, - int_source, - event_rtn, - event_rtn_param) -int preset; /* TRUE or COMPLEMENT logic */ -double edge0_delay; /* sec */ -double edge1_delay; /* set */ -int card; /* 0 through ... */ -int channel; /* 0 through channels on a card */ -int int_source; /* (FALSE)External/ (TRUE)Internal source */ -void *event_rtn; /* subroutine to run on events */ -int event_rtn_param;/* parameter to pass to above routine */ + +/* + * mz8310_one_shot() + */ +mz8310Stat mz8310_one_shot( +int preset, /* TRUE or COMPLEMENT logic */ +double edge0_delay, /* sec */ +double edge1_delay, /* set */ +int card, /* 0 through ... */ +int channel, /* 0 through channels on a card */ +int int_source, /* (FALSE)External/ (TRUE)Internal source */ +void *event_rtn, /* subroutine to run on events */ +int event_rtn_param /* parameter to pass to above routine */ +) { - int chip = channel/MZ8310CHANONCHIP; - double ticks = int_source?INT_TICKS:EXT_TICKS; - void *old_handler(); - int status; + int chip = channel/MZ8310CHANONCHIP; + double ticks = int_source?INT_TICKS:EXT_TICKS; + mz8310Stat status; if(channel >= MZ8310CHANONCHIP * MZ8310CHIPCOUNT) - return ERROR; + return S_dev_badSignalNumber; if(card>=mz8310_card_count) - return ERROR; + return S_dev_badA16; if(!mzconf) - return ERROR; + return S_dev_noDevice; /* dont overflow unsigned short in STC */ if(edge0_delay >= 0xffff/ticks) - return ERROR; + return S_dev_highValue; if(edge1_delay >= 0xffff/ticks) - return ERROR; + return S_dev_highValue; if(edge0_delay < 0.0) - return ERROR; + return S_dev_lowValue; if(edge1_delay < 0.0) - return ERROR; + return S_dev_lowValue; FASTLOCK(&mzconf[card].lock); @@ -501,50 +565,63 @@ int event_rtn_param;/* parameter to pass to above routine */ } -void mz8310_int_service(icf) -register struct mz8310_int_conf *icf; + +/* + * mz8310_int_service() + */ +LOCAL void mz8310_int_service(struct mz8310_int_conf *icf) { icf->cnt++; if(icf->user_service) (*icf->user_service)(icf->user_param); -/* logMsg("MZINT: level %d cnt %d\n",icf->irq,icf->cnt); */ - return; } /* - The following are provided for mz8310 access from the shell -*/ + * The following are provided for mz8310 access from the shell + */ -unsigned char mz8310_cmd(value, card, chip) -unsigned char value; -int card; -int chip; + +/* + * mz8310_cmd() + */ +int mz8310_cmd( +unsigned value, +unsigned card, +unsigned chip +) { - register unsigned char *cmd = MZ8310_CMD_ADDR(card,chip); + volatile unsigned char *cmd = MZ8310_CMD_ADDR(card,chip); *cmd = value; return *cmd; } -unsigned short mz8310_rdata(card, chip) -int card; -int chip; + +/* + * mz8310_rdata() + */ +int mz8310_rdata(int card, int chip) { - register unsigned short *data = MZ8310_DATA_ADDR(card,chip); + volatile unsigned short *data = MZ8310_DATA_ADDR(card,chip); return *data; } -unsigned short mz8310_wdata(value, card, chip) -unsigned short value; -int card; -int chip; + +/* + * mz8310_wdata() + */ +int mz8310_wdata( +unsigned value, +int card, +int chip +) { - register unsigned short *data = MZ8310_DATA_ADDR(card,chip); + volatile unsigned short *data = MZ8310_DATA_ADDR(card,chip); *data = value; @@ -553,11 +630,15 @@ int chip; } -void mz8310_reset() + +/* + * mz8310_reset + */ +LOCAL int mz8310_reset(void) { - short card,channel,chip; + short card,channel,chip; - for (card = 0;card < mz8310_card_count; card++){ + for (card = 0; card < mz8310_card_count; card++){ FASTLOCK(&mzconf[card].lock); for ( channel = 0; channel < tm_num_channels[MZ8310]; channel++){ if (mzconf[card].icf[channel].cnt){ @@ -576,6 +657,7 @@ void mz8310_reset() FASTUNLOCK(&mzconf[card].lock); } + return OK; } diff --git a/src/drv/drvStc.c b/src/drv/drvStc.c index ba44460f0..615ad49c7 100644 --- a/src/drv/drvStc.c +++ b/src/drv/drvStc.c @@ -44,145 +44,123 @@ * in delayed pulse mode by forcing edge 0 delays of zero to be * a delay of one instead. * joh 010491 force all edge 0 delays less than two to two - * bg 062692 force all edge 0 delays less than two to two + * joh 082493 ANSI C and EPICS return codes */ -/* drvStc.c - Driver Support Routines for Stc */ #include #include +#include #include #include #include +#include +#include -/* If any of the following does not exist replace it with #define <> NULL */ -static long report(); -static long init(); - -struct { - long number; - DRVSUPFUN report; - DRVSUPFUN init; -} drvStc={ - 2, - report, - init}; -static long report(fp) - FILE *fp; +/* + * stc_io_report() + */ +stcStat stc_io_report( +volatile uint8_t *pcmd, +volatile uint16_t *pdata +) { + uint8_t cmd; + uint16_t data; - return(0); + if(vxMemProbe((char *)pcmd, READ, sizeof(cmd), (char *)&cmd) != OK) + return S_dev_noDevice; + if(vxMemProbe((char *)pdata, READ, sizeof(data), (char *)&data) != OK) + return S_dev_noDevice; + + /* + * addd AMD STC status here + */ + + return STC_SUCCESS; } + + -static long init() +/* + * stc_init() + */ +stcStat stc_init( +volatile uint8_t *pcmd, +volatile uint16_t *pdata, +unsigned master_mode +) { - int status; + uint8_t cmd; + uint16_t data; + unsigned channel; - return(0); -} + if(vxMemProbe((char *)pcmd, READ, sizeof(cmd), (char *)&cmd) != OK) + return S_dev_noDevice; + if(vxMemProbe((char *)pdata, READ, sizeof(data), (char *)&data) != OK) + return S_dev_noDevice; -#define CHANONCHIP 5 -#define CHIPCHAN (channel%CHANONCHIP) -#define CHIPNUM (channel/CHANONCHIP) - -#define STC_RESET *pcmd = 0xff -#define STC_BUS16 *pcmd = 0xef -#define STC_SET_MASTER_MODE(D) {*pcmd = 0x17; *pdata=(D);} -#define STC_MASTER_MODE (*pcmd = 0x17, *pdata) - -#define STC_CTR_INIT(MODE,LOAD,HOLD)\ -{*pcmd = CHIPCHAN+1; *pdata = (MODE); *pdata = (LOAD); *pdata= (HOLD);} - -#define STC_CTR_READ(MODE,LOAD,HOLD)\ -{*pcmd = CHIPCHAN+1; (MODE) = *pdata; (LOAD) = *pdata; (HOLD) = *pdata;} - -#define STC_SET_TC(D) *pcmd = 0xe0 | ((D)?8:0)|(CHIPCHAN+1) - -#define STC_LOAD *pcmd = 0x40 | 1<<(CHIPCHAN) -#define STC_STEP *pcmd = 0xf0 | (CHIPCHAN+1) -#define STC_ARM *pcmd = 0x20 | 1<=CHANONCHIP) - return ERROR; + return S_dev_badSignalNumber; STC_CTR_READ(mode, edge0, edge1); /* - Only return values if the counter is in the proper mode - see stc_one_shot() for info on conversions and functions selected - by these bit fields - */ + * Only return values if the counter is in the proper mode + * see stc_one_shot() for info on conversions and functions selected + * by these bit fields + */ if(mode == 0xc16a){ *int_source = FALSE; *preset = TRUE; @@ -208,29 +186,35 @@ unsigned int *int_source; *edge1_count = edge1; } else - return ERROR; + return S_dev_internal; - return OK; + return STC_SUCCESS; } -stc_one_shot(preset, edge0_count, edge1_count, pcmd, pdata, channel,int_source) -unsigned int preset; -unsigned short edge0_count; -unsigned short edge1_count; -unsigned char *pcmd; -unsigned short *pdata; -unsigned int channel; -int int_source; + +/* + * stc_one_shot() + */ +stcStat stc_one_shot( +unsigned preset, +unsigned edge0_count, +unsigned edge1_count, +volatile uint8_t *pcmd, +volatile uint16_t *pdata, +unsigned channel, +unsigned int_source +) { - int dummy; + uint8_t cmd; + uint16_t data; - if(vxMemProbe(pcmd, READ, sizeof(*pcmd), &dummy) != OK) - return ERROR; - if(vxMemProbe(pdata, READ, sizeof(*pdata), &dummy) != OK) - return ERROR; + if(vxMemProbe((char *)pcmd, READ, sizeof(cmd), (char *)&cmd) != OK) + return S_dev_noDevice; + if(vxMemProbe((char *)pdata, READ, sizeof(data), (char *)&data) != OK) + return S_dev_noDevice; if(channel>=CHANONCHIP) - return ERROR; + return S_dev_badSignalNumber; /* * joh 110791 @@ -252,26 +236,26 @@ int int_source; STC_DISARM; /* - active positive going edge (gate input) - count on the rising edge of source - ctr source: (F1- internal) (SRC1- external) - mode L - Hardware triggered delayed pulse one-shot - binary count - count down (count up if preset is TRUE) - TC toggled output - - see chapter 7 of the Am9513 STC tech man concerning count + 1 - - */ + * active positive going edge (gate input) + * count on the rising edge of source + * ctr source: (F1- internal) (SRC1- external) + * mode L - Hardware triggered delayed pulse one-shot + * binary count + * count down (count up if preset is TRUE) + * TC toggled output + * + * see chapter 7 of the Am9513 STC tech man concerning count + 1 + * + */ /* - NOTE: I must be able to read back the state of the preset later - so I encode this information in the count down/up bit. - count up on TRUE preset - count down on FALSE preset - - see stc_one_shot_read() above - */ + * NOTE: I must be able to read back the state of the preset later + * so I encode this information in the count down/up bit. + * count up on TRUE preset + * count down on FALSE preset + * + * see stc_one_shot_read() above + */ if(int_source){ if(preset) STC_CTR_INIT(0xcb6a, ~edge0_count, ~edge1_count+1) @@ -286,21 +270,21 @@ int int_source; STC_LOAD; /* - see chapter 7 of the Am9513 STC tech man concerning this step - */ + *see chapter 7 of the Am9513 STC tech man concerning this step + */ STC_STEP; STC_SET_TC(preset); /* - Only arm counter if the pulse has a finite duration - */ + * Only arm counter if the pulse has a finite duration + */ if(edge1_count != 0){ STC_ARM; } - return OK; + return STC_SUCCESS; } diff --git a/src/drv/drvStc.h b/src/drv/drvStc.h index 8d46a8e20..5b76e2ef5 100644 --- a/src/drv/drvStc.h +++ b/src/drv/drvStc.h @@ -1,5 +1,5 @@ /* drvStc.h */ -/* share/src/drv $Id$ */ +/* share/src/drv/$Id$ */ /* * The following are specific driver routines for the AMD STC * @@ -74,23 +74,23 @@ typedef long stcStat; stcStat stc_io_report( -volatile unsigned char *pcmd, -volatile unsigned short *pdata +volatile uint8_t *pcmd, +volatile uint16_t *pdata ); stcStat stc_init( -volatile unsigned char *pcmd, -volatile unsigned short *pdata, +volatile uint8_t *pcmd, +volatile uint16_t *pdata, unsigned master_mode ); stcStat stc_one_shot_read( unsigned *preset, -unsigned short *edge0_count, -unsigned short *edge1_count, -volatile unsigned char *pcmd, -volatile unsigned short *pdata, +uint16_t *edge0_count, +uint16_t *edge1_count, +volatile uint8_t *pcmd, +volatile uint16_t *pdata, unsigned channel, unsigned *int_source ); @@ -99,8 +99,8 @@ stcStat stc_one_shot( unsigned preset, unsigned edge0_count, unsigned edge1_count, -volatile unsigned char *pcmd, -volatile unsigned short *pdata, +volatile uint8_t *pcmd, +volatile uint16_t *pdata, unsigned channel, unsigned int_source ); diff --git a/src/drv/drvTime.c b/src/drv/drvTime.c index 63685f4a6..b86832b9a 100644 --- a/src/drv/drvTime.c +++ b/src/drv/drvTime.c @@ -229,12 +229,12 @@ time_test() return ERROR; - logMsg( "wrote: preset %x internal-clk %x delay %lf width %lf \n", + logMsg( "wrote: preset %x internal-clk %x delay %f width %f \n", preset, int_source, pulses.offset, pulses.width); - logMsg( "read: preset %x internal-clk %x delay %lf width %lf count %x\n", + logMsg( "read: preset %x internal-clk %x delay %f width %f count %x\n", t_preset, t_int_source, t_pulses.offset,