ANSI C changes

This commit is contained in:
Jeff Hill
1995-04-26 03:01:02 +00:00
parent 5e67b97e89
commit 5ccee17d09
4 changed files with 85 additions and 44 deletions

View File

@@ -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) {

View File

@@ -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);

View File

@@ -74,6 +74,8 @@
#include <choicePulseDelay.h>
#include <pulseTrainRecord.h>
#include <choicePulseTrain.h>
#include <epicsPrint.h>
/* 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);
}

View File

@@ -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);
}
}