From e505adbbe0519ec779f55cb027e47df977b9c486 Mon Sep 17 00:00:00 2001 From: Ron Sluiter Date: Fri, 3 Mar 2000 22:36:52 +0000 Subject: [PATCH] Fixed stuck DMOV problem when "setting" position. --- motorApp/SoftMotorSrc/devSoft.c | 28 +++++++++++++++++++++++++++- motorApp/SoftMotorSrc/devSoft.h | 6 ++++-- motorApp/SoftMotorSrc/devSoftAux.c | 10 ++++++++-- 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/motorApp/SoftMotorSrc/devSoft.c b/motorApp/SoftMotorSrc/devSoft.c index a059324a..ea670f00 100644 --- a/motorApp/SoftMotorSrc/devSoft.c +++ b/motorApp/SoftMotorSrc/devSoft.c @@ -2,8 +2,9 @@ FILENAME... devSoft.c USAGE... Motor record device level support for Soft channel. +Version: $Revision: 1.2 $ Modified By: $Author: sluiter $ -Last Modified: $Date: 2000-02-08 22:19:25 $ +Last Modified: $Date: 2000-03-03 22:35:49 $ */ /* @@ -116,6 +117,15 @@ STATIC long build(motor_cmnd command, double *parms, struct motorRecord *mr) status = OK; break; + case LOAD_POS: + { + struct soft_private *ptr = (struct soft_private *) mr->dpvt; + + mr->msta = RA_DONE; + callbackRequest(&ptr->callback); + } + break; + default: status = ERROR; } @@ -183,3 +193,19 @@ STATIC void soft_process(struct motorRecord *mr) dbScanUnlock((struct dbCommon *) mr); } + +/* +FUNCTION... void soft_motor_callback(CALLBACK *) +USAGE... Process motor record after the following events: + - LOAD_POS motor command. +LOGIC... +*/ + +void soft_motor_callback(CALLBACK *cbptr) +{ + struct motorRecord *mr; + + callbackGetUser(mr, cbptr); + soft_process(mr); +} + diff --git a/motorApp/SoftMotorSrc/devSoft.h b/motorApp/SoftMotorSrc/devSoft.h index 2575917c..08c7b37c 100644 --- a/motorApp/SoftMotorSrc/devSoft.h +++ b/motorApp/SoftMotorSrc/devSoft.h @@ -4,9 +4,9 @@ FILENAME.. devSoft.h USAGE... This file contains information that is common to all Soft channel device support modules. -Version: $Revision: 1.1 $ +Version: $Revision: 1.2 $ Modified By: $Author: sluiter $ -Last Modified: $Date: 2000-02-08 22:19:26 $ +Last Modified: $Date: 2000-03-03 22:36:52 $ */ /* @@ -37,11 +37,13 @@ extern long soft_init_record(struct motorRecord *); extern void soft_dinp_func(struct motorRecord *, short); extern void soft_rdbl_func(struct motorRecord *, double); extern void soft_rinp_func(struct motorRecord *, long); +extern void soft_motor_callback(CALLBACK *); #define MAXMSGS 20 struct soft_private { + CALLBACK callback; long callback_flag; short dinp_value; /* Value from DINP link. */ BOOLEAN default_done_behavior; /* If the DINP is not programmed, exhibit diff --git a/motorApp/SoftMotorSrc/devSoftAux.c b/motorApp/SoftMotorSrc/devSoftAux.c index e7af9181..0b609737 100644 --- a/motorApp/SoftMotorSrc/devSoftAux.c +++ b/motorApp/SoftMotorSrc/devSoftAux.c @@ -2,9 +2,9 @@ FILENAME... devSoftAux.c USAGE... Motor record device level support for Soft channel. -Version: $Revision: 1.1 $ +Version: $Revision: 1.2 $ Modified By: $Author: sluiter $ -Last Modified: $Date: 2000-02-08 22:19:26 $ +Last Modified: $Date: 2000-03-03 22:36:31 $ */ /* @@ -89,6 +89,7 @@ long soft_init(int after) long soft_init_record(struct motorRecord *mr) { struct soft_private *ptr; + CALLBACK *cbptr; STATUS status; static int count = 0; @@ -102,6 +103,11 @@ long soft_init_record(struct motorRecord *mr) ptr = (struct soft_private *) mr->dpvt; ptr->dinp_value = mr->dmov; /* Must match after initialzation. */ + cbptr = &ptr->callback; + callbackSetCallback((void (*)(struct callbackPvt *)) soft_motor_callback, + cbptr); + callbackSetPriority(priorityMedium, cbptr); + callbackSetUser(mr, cbptr); return ((long) status); }