Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MINP for soft motors #211

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions docs/motorRecord.html
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,13 @@ <h2>Field Descriptions</h2> In addition to fields common to all record types (se
<td>SHORT</td>
<td><br>
</td>
</tr>
<td><a href="#Fields_link">MINP</a></td>
<td>R/W</td>
<td>MSTA Input Link</td>
<td>INLINK</td>
<td><br>
</td>
</tr>
<tr>
<td><a href="#Fields_status">MDEL</a></td>
Expand Down Expand Up @@ -2047,6 +2054,14 @@ <h2>Field Descriptions</h2> In addition to fields common to all record types (se
link is used to set the DONE bit in the MSTA field; which in turn sets the DMOV
field.</td>
</tr>
<tr>
<td>MINP</td>
<td>R/W</td>
<td>MSTA Input Link</td>
<td>INLINK</td>
<td>If Soft Channel device support is specified, the value specified by this
link is used to set most bits of the MSTA field - all except the DONE bit, which comes through DINP</td>
</tr>
<tr>
<td>RINP</td>
<td>R/W</td>
Expand All @@ -2065,11 +2080,11 @@ <h2>Field Descriptions</h2> In addition to fields common to all record types (se
</tr>
<TR nosave="">
<TD colspan="5" nosave=""><H4>Soft Channel Device Driver</H4>
The Soft Channel database links (i.e., DINP, RINP and STOO) are only processed
The Soft Channel database links (i.e., DINP, MINP, RINP and STOO) are only processed
when the Soft Channel device driver is selected.&nbsp; These links are ignored
when using any other Motor Record device driver. <BR>
<BR>
The input links (i.e., DINP, RDBL and RINP) are monitored for value changes by a
The input links (i.e., DINP, MINP, RDBL and RINP) are monitored for value changes by a
CA event task.&nbsp; Users must choose either a dial input link (RDBL) or a raw
input link (RINP), but not both. At this time, the above links are <B>not</B>
dynamically retargetable.&nbsp; <BR>
Expand Down
6 changes: 6 additions & 0 deletions motorApp/MotorSrc/motorRecord.dbd
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,12 @@ recordtype(motor) {
special(SPC_MOD)
interest(1)
}
field(MINP,DBF_INLINK) {
prompt("MSTA Input Link")
promptgroup(GUI_COMMON)
special(SPC_MOD)
interest(1)
}
field(RINP,DBF_INLINK) {
prompt("RMP Input Link")
promptgroup(GUI_COMMON)
Expand Down
17 changes: 17 additions & 0 deletions motorApp/SoftMotorSrc/devSoft.cc
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,23 @@ void soft_dinp_func(struct motorRecord *mr, short newdinp)
}
}

void soft_minp_func(struct motorRecord *mr, long newminp)
{
msta_field status;
unsigned int old_RA_DONE;
if (interruptAccept != TRUE)
return;

status.All = mr->msta;
old_RA_DONE = status.Bits.RA_DONE;
Debug(5, "update(): old msta=0x%04x newminp=0x%04x for %s.\n",
mr->msta, (unsigned)newminp, mr->name);

status.All = newminp;
status.Bits.RA_DONE = old_RA_DONE;
mr->msta = status.All;
soft_process(mr);
}

void soft_rinp_func(struct motorRecord *mr, long newrinp)
{
Expand Down
1 change: 1 addition & 0 deletions motorApp/SoftMotorSrc/devSoft.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ struct motor_node {
extern long soft_init(int);
extern long soft_init_record(void *);
extern void soft_dinp_func(struct motorRecord *, short);
extern void soft_minp_func(struct motorRecord *, long);
extern void soft_rdbl_func(struct motorRecord *, double);
extern void soft_rinp_func(struct motorRecord *, long);
extern void soft_motor_callback(CALLBACK *);
Expand Down
20 changes: 18 additions & 2 deletions motorApp/SoftMotorSrc/devSoftAux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ static inline void Debug(int level, const char *format, ...)
}

STATIC void soft_dinp(struct event_handler_args);
STATIC void soft_minp(struct event_handler_args);
STATIC void soft_rdbl(struct event_handler_args);
STATIC void soft_rinp(struct event_handler_args);
STATIC EPICSTHREADFUNC soft_motor_task(void *);
Expand All @@ -78,6 +79,11 @@ STATIC void soft_dinp(struct event_handler_args args)
soft_dinp_func((struct motorRecord *) args.usr, *((short *) args.dbr));
}

STATIC void soft_minp(struct event_handler_args args)
{
soft_minp_func((struct motorRecord *) args.usr, *((long *) args.dbr));
}


STATIC void soft_rdbl(struct event_handler_args args)
{
Expand Down Expand Up @@ -162,7 +168,7 @@ STATIC EPICSTHREADFUNC soft_motor_task(void *parm)
{
struct motorRecord *mr;
struct motor_node *node;
chid dinp, rdbl, rinp;
chid dinp, minp, rdbl, rinp;
epicsEventId wait_forever;

epicsEventWait(soft_motor_sem); /* Wait for dbLockInitRecords() to execute. */
Expand Down Expand Up @@ -195,7 +201,17 @@ STATIC EPICSTHREADFUNC soft_motor_task(void *parm)
{
ptr->default_done_behavior = true;
}

if (((mr->minp.type == PV_LINK) ||
(mr->minp.type == CA_LINK) ||
(mr->minp.type == DB_LINK)) &&
(mr->minp.value.pv_link.pvname != NULL))
{
Debug(5, "devSoftAux::soft_motor_task: adding minp link for motor %s link=%s\n", mr->name, mr->minp.value.pv_link.pvname);
SEVCHK(ca_search(mr->minp.value.pv_link.pvname, &minp),"ca_search() failure");
SEVCHK(ca_add_event(DBR_SHORT, minp, soft_minp, mr, NULL),"ca_add_event() failure");
SEVCHK(ca_pend_io((float) 5.0), "MINP link failure");
}

if ((mr->urip != 0) &&
((mr->rdbl.type == PV_LINK) ||
(mr->rdbl.type == CA_LINK) ||
Expand Down
Loading