From 5ccee17d09ccac2842a055a66f12bb5468e359b2 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Wed, 26 Apr 1995 03:01:02 +0000 Subject: [PATCH] ANSI C changes --- src/dev/devAt5Vxi.c | 50 ++++++++++++++++++++++++----------- src/dev/devHpe1368a.c | 16 +++++------ src/dev/devMz8310.c | 6 +++-- src/dev/devTimerMz8310.c | 57 ++++++++++++++++++++++++++-------------- 4 files changed, 85 insertions(+), 44 deletions(-) diff --git a/src/dev/devAt5Vxi.c b/src/dev/devAt5Vxi.c index 5120b1565..eb8a750ca 100644 --- a/src/dev/devAt5Vxi.c +++ b/src/dev/devAt5Vxi.c @@ -127,12 +127,14 @@ AT5VXIDSET_TM devTmAt5Vxi={6, NULL, NULL, NULL, NULL, read_timer, write_timer}; * Values are converted to seconds. */ static double constants[] = {1e3,1e6,1e9,1e12}; + +static void localPostEvent (void *pParam); static long read_timer(struct timerRecord *ptimer) { struct vmeio *pvmeio; - int source; - int ptst; + unsigned source; + unsigned ptst; double time_pulse[2]; /* delay and width */ double constant; @@ -164,22 +166,40 @@ static long read_timer(struct timerRecord *ptimer) static long write_timer(struct timerRecord *ptimer) { - struct vmeio *pvmeio; + struct vmeio *pvmeio; + void (*pCB)(void *); pvmeio = (struct vmeio *)(&ptimer->out.value); + if (ptimer->tevt) { + pCB = localPostEvent; + } + else { + pCB = NULL; + } + /* put the value to the ao driver */ return at5vxi_one_shot( - (int)ptimer->ptst, /* pre-trigger state */ - ptimer->t1dl, /* pulse offset */ - ptimer->t1wd, /* pulse width */ - (int)pvmeio->card, /* card number */ - (int)pvmeio->signal, /* signal number */ - (int)ptimer->tsrc, /* trigger source */ - ((ptimer->tevt == 0)?0:post_event), /* addr of event post routine */ - (int)ptimer->tevt); /* event to post on trigger */ + ptimer->ptst, /* pre-trigger state */ + ptimer->t1dl, /* pulse offset */ + ptimer->t1wd, /* pulse width */ + pvmeio->card, /* card number */ + pvmeio->signal, /* signal number */ + ptimer->tsrc, /* trigger source */ + pCB, /* addr of event post routine */ + ptimer); /* event to post on trigger */ } + +static void localPostEvent (void *pParam) +{ + struct timerRecord *ptimer = pParam; + + if (ptimer->tevt) { + post_event(ptimer->tevt); + } +} + static long init_ai( struct aiRecord *pai) { @@ -342,7 +362,7 @@ static long read_bi(struct biRecord *pbi) { struct vmeio *pvmeio; long status; - long value; + unsigned long value; pvmeio = (struct vmeio *)&(pbi->inp.value); @@ -357,9 +377,9 @@ static long read_bi(struct biRecord *pbi) static long init_bo(struct boRecord *pbo) { - unsigned int value; - long status=0; - struct vmeio *pvmeio; + unsigned long value; + long status=0; + struct vmeio *pvmeio; /* bo.out must be an VME_IO */ switch (pbo->out.type) { diff --git a/src/dev/devHpe1368a.c b/src/dev/devHpe1368a.c index 10b0d0b0b..58585c2ac 100644 --- a/src/dev/devHpe1368a.c +++ b/src/dev/devHpe1368a.c @@ -115,9 +115,9 @@ static long bi_ioinfo( static long read_bi(struct biRecord *pbi) { - struct vmeio *pvmeio; + struct vmeio *pvmeio; long status; - long value; + unsigned value; pvmeio = (struct vmeio *)&(pbi->inp.value); @@ -198,7 +198,7 @@ static long read_mbbi(struct mbbiRecord *pmbbi) { struct vmeio *pvmeio; long status; - unsigned long value; + unsigned value; pvmeio = (struct vmeio *)&(pmbbi->inp.value); @@ -213,9 +213,9 @@ static long read_mbbi(struct mbbiRecord *pmbbi) static long init_mbbo(struct mbboRecord *pmbbo) { - unsigned long value; - struct vmeio *pvmeio; - long status = 0; + unsigned value; + struct vmeio *pvmeio; + long status = 0; /* mbbo.out must be an VME_IO */ switch (pmbbo->out.type) { @@ -238,9 +238,9 @@ static long init_mbbo(struct mbboRecord *pmbbo) static long write_mbbo(struct mbboRecord *pmbbo) { - struct vmeio *pvmeio; + struct vmeio *pvmeio; long status; - unsigned long value; + unsigned value; pvmeio = &(pmbbo->out.value.vmeio); diff --git a/src/dev/devMz8310.c b/src/dev/devMz8310.c index 2714dc17e..82f2f10bd 100644 --- a/src/dev/devMz8310.c +++ b/src/dev/devMz8310.c @@ -74,6 +74,8 @@ #include #include #include +#include + /* Create the dsets for devMz8310 */ static long report(); static long init(); @@ -303,7 +305,7 @@ static long init(after) if(after)return(0); if(sysBusToLocalAdrs(VME_AM_SUP_SHORT_IO, 0, (void *)&shortaddr)) { - logMsg("devMz8310: sysBusToLocalAdrs failed\n",0); + epicsPrintf ("devMz8310: sysBusToLocalAdrs failed\n",0); exit(1); } memset((char *)&mz8310_info[0],0,MAXCARDS*sizeof(struct mz8310_info)); @@ -344,7 +346,7 @@ static long init(after) } if(rebootHookAdd(Mz8310_shutdown)<0) - logMsg("Mz8310_shutdown: reboot hook add failed\n"); + epicsPrintf ("Mz8310_shutdown: reboot hook add failed\n"); return(0); } diff --git a/src/dev/devTimerMz8310.c b/src/dev/devTimerMz8310.c index 747d3c7d6..dce6c9396 100644 --- a/src/dev/devTimerMz8310.c +++ b/src/dev/devTimerMz8310.c @@ -63,6 +63,8 @@ static long read_timer(); static long write_timer(); +static void localPostEvent (void *pParam); + struct tmdset { long number; DEVSUPFUN dev_report; @@ -83,22 +85,22 @@ static double constants[] = {1e3,1e6,1e9,1e12}; static long read_timer(struct timerRecord *ptimer) { - struct vmeio *pvmeio; - int source; - int ptst; - double time_pulse[2]; /* delay and width */ - double constant; + struct vmeio *pvmeio; + unsigned source; + unsigned ptst; + double time_pulse[2]; /* delay and width */ + double constant; /* only supports a one channel VME timer module !!!! */ pvmeio = (struct vmeio *)(&ptimer->out.value); if (mz8310_one_shot_read( - &ptst, /* pre-trigger state */ - &(time_pulse[0]), /* offset of pulse */ - &(time_pulse[1]), /* width of pulse */ - (int)pvmeio->card, /* card number */ - (int)pvmeio->signal, /* signal number */ - &source) != 0) { /* trigger source */ + &ptst, /* pre-trigger state */ + &(time_pulse[0]), /* offset of pulse */ + &(time_pulse[1]), /* width of pulse */ + pvmeio->card, /* card number */ + pvmeio->signal, /* signal number */ + &source) != 0) { /* trigger source */ return 1; } @@ -117,19 +119,36 @@ static long read_timer(struct timerRecord *ptimer) static long write_timer(struct timerRecord *ptimer) { struct vmeio *pvmeio; + void (*pCB)(void *); /* put the value to the ao driver */ pvmeio = (struct vmeio *)(&ptimer->out.value); + if (ptimer->tevt) { + pCB = localPostEvent; + } + else { + pCB = NULL; + } + /* put the value to the ao driver */ return mz8310_one_shot( - (int)ptimer->ptst, /* pre-trigger state */ - ptimer->t1dl, /* pulse offset */ - ptimer->t1wd, /* pulse width */ - (int)pvmeio->card, /* card number */ - (int)pvmeio->signal, /* signal number */ - (int)ptimer->tsrc, /* trigger source */ - ((ptimer->tevt == 0)?0:post_event), /* addr of event post routine */ - (int)ptimer->tevt); /* event to post on trigger */ + ptimer->ptst, /* pre-trigger state */ + ptimer->t1dl, /* pulse offset */ + ptimer->t1wd, /* pulse width */ + pvmeio->card, /* card number */ + pvmeio->signal, /* signal number */ + ptimer->tsrc, /* trigger source */ + pCB, /* addr of event post routine */ + ptimer); /* event to post on trigger */ +} + +static void localPostEvent (void *pParam) +{ + struct timerRecord *ptimer = pParam; + + if (ptimer->tevt) { + post_event (ptimer->tevt); + } }