Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sequencer-2-2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
epics-modules
sequencer-2-2
Commits
a4a18b2b
Commit
a4a18b2b
authored
11 years ago
by
benjamin.franksen
Browse files
Options
Downloads
Patches
Plain Diff
seq: add pvSys to globals, add createOrAttachPvSystem, remove pvSys code from addProg
parent
b06bfcb7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/seq/seqPvt.h
+1
-0
1 addition, 0 deletions
src/seq/seqPvt.h
src/seq/seq_cmd.c
+17
-0
17 additions, 0 deletions
src/seq/seq_cmd.c
src/seq/seq_prog.c
+3
-19
3 additions, 19 deletions
src/seq/seq_prog.c
src/seq/seq_task.c
+4
-3
4 additions, 3 deletions
src/seq/seq_task.c
with
25 additions
and
22 deletions
src/seq/seqPvt.h
+
1
−
0
View file @
a4a18b2b
...
@@ -247,6 +247,7 @@ void seqAddProg(SPROG *sp);
...
@@ -247,6 +247,7 @@ void seqAddProg(SPROG *sp);
/* seqCommands.c */
/* seqCommands.c */
typedef
int
sequencerProgramTraversee
(
SPROG
**
sprog
,
seqProgram
*
pseq
,
void
*
param
);
typedef
int
sequencerProgramTraversee
(
SPROG
**
sprog
,
seqProgram
*
pseq
,
void
*
param
);
int
traverseSequencerPrograms
(
sequencerProgramTraversee
*
traversee
,
void
*
param
);
int
traverseSequencerPrograms
(
sequencerProgramTraversee
*
traversee
,
void
*
param
);
void
createOrAttachPvSystem
(
SPROG
*
sp
);
/* seq_main.c */
/* seq_main.c */
void
seq_free
(
SPROG
*
sp
);
void
seq_free
(
SPROG
*
sp
);
...
...
This diff is collapsed.
Click to expand it.
src/seq/seq_cmd.c
+
17
−
0
View file @
a4a18b2b
...
@@ -30,6 +30,7 @@ static struct
...
@@ -30,6 +30,7 @@ static struct
{
{
epicsMutexId
lock
;
epicsMutexId
lock
;
struct
sequencerProgram
*
programs
;
struct
sequencerProgram
*
programs
;
pvSystem
pvSys
;
}
globals
;
}
globals
;
static
void
seqInitPvt
(
void
*
arg
)
static
void
seqInitPvt
(
void
*
arg
)
...
@@ -47,6 +48,22 @@ static void seqLazyInit()
...
@@ -47,6 +48,22 @@ static void seqLazyInit()
epicsThreadOnce
(
&
seqOnceFlag
,
seqInitPvt
,
NULL
);
epicsThreadOnce
(
&
seqOnceFlag
,
seqInitPvt
,
NULL
);
}
}
void
createOrAttachPvSystem
(
struct
program_instance
*
sp
)
{
seqLazyInit
();
epicsMutexMustLock
(
globals
.
lock
);
if
(
!
pvSysIsDefined
(
globals
.
pvSys
))
{
pvStat
status
=
pvSysCreate
(
&
globals
.
pvSys
);
if
(
status
!=
pvStatOK
)
{
errlogPrintf
(
"getPvSystem: pvSysCreate() failure
\n
"
);
}
}
else
{
pvSysAttach
(
globals
.
pvSys
);
}
sp
->
pvSys
=
globals
.
pvSys
;
epicsMutexUnlock
(
globals
.
lock
);
}
epicsShareFunc
void
seqRegisterSequencerProgram
(
seqProgram
*
prog
)
epicsShareFunc
void
seqRegisterSequencerProgram
(
seqProgram
*
prog
)
{
{
struct
sequencerProgram
*
sp
=
NULL
;
struct
sequencerProgram
*
sp
=
NULL
;
...
...
This diff is collapsed.
Click to expand it.
src/seq/seq_prog.c
+
3
−
19
View file @
a4a18b2b
...
@@ -46,7 +46,7 @@ static int findStateSet(SPROG *sp, void *param)
...
@@ -46,7 +46,7 @@ static int findStateSet(SPROG *sp, void *param)
}
}
/*
/*
* seqFindStateSet() - find a state set in the
state
program list from thread id.
* seqFindStateSet() - find a state set in the program list from thread id.
*/
*/
SSCB
*
seqFindStateSet
(
epicsThreadId
threadId
)
SSCB
*
seqFindStateSet
(
epicsThreadId
threadId
)
{
{
...
@@ -93,23 +93,8 @@ static int addProg(SPROG **ppInstances, seqProgram *pseq, void *param)
...
@@ -93,23 +93,8 @@ static int addProg(SPROG **ppInstances, seqProgram *pseq, void *param)
SPROG
*
sp
=
(
SPROG
*
)
param
;
SPROG
*
sp
=
(
SPROG
*
)
param
;
if
(
!
ppInstances
||
!
pseq
)
{
if
(
!
ppInstances
||
!
pseq
)
{
if
(
!
pvSysIsDefined
(
sp
->
pvSys
))
{
pvStat
status
=
pvSysCreate
(
&
sp
->
pvSys
);
if
(
status
!=
pvStatOK
)
{
errlogPrintf
(
"pvSysCreate() failure
\n
"
);
}
}
return
FALSE
;
return
FALSE
;
}
}
if
(
!
pvSysIsDefined
(
sp
->
pvSys
))
{
SPROG
*
curSP
;
foreach
(
curSP
,
*
ppInstances
)
{
if
(
pvSysIsDefined
(
curSP
->
pvSys
))
{
sp
->
pvSys
=
curSP
->
pvSys
;
}
break
;
}
}
/* same program name */
/* same program name */
if
(
strcmp
(
sp
->
progName
,
pseq
->
progName
)
==
0
)
{
if
(
strcmp
(
sp
->
progName
,
pseq
->
progName
)
==
0
)
{
SPROG
*
curSP
,
*
lastSP
=
NULL
;
SPROG
*
curSP
,
*
lastSP
=
NULL
;
...
@@ -130,10 +115,9 @@ static int addProg(SPROG **ppInstances, seqProgram *pseq, void *param)
...
@@ -130,10 +115,9 @@ static int addProg(SPROG **ppInstances, seqProgram *pseq, void *param)
}
}
DEBUG
(
"Added program %p, instance %d to instance list.
\n
"
,
DEBUG
(
"Added program %p, instance %d to instance list.
\n
"
,
sp
,
sp
->
instance
);
sp
,
sp
->
instance
);
if
(
pvSysIsDefined
(
sp
->
pvSys
))
return
TRUE
;
/* terminate traversal */
return
TRUE
;
}
}
return
FALSE
;
return
FALSE
;
/* continue traversal */
}
}
/*
/*
...
...
This diff is collapsed.
Click to expand it.
src/seq/seq_task.c
+
4
−
3
View file @
a4a18b2b
...
@@ -28,10 +28,11 @@ void sequencer (void *arg) /* ptr to original (global) state program table */
...
@@ -28,10 +28,11 @@ void sequencer (void *arg) /* ptr to original (global) state program table */
/* Get this thread's id */
/* Get this thread's id */
sp
->
ss
->
threadId
=
epicsThreadGetIdSelf
();
sp
->
ss
->
threadId
=
epicsThreadGetIdSelf
();
/* Add the program to the state program list
/* Add the program to the program list */
and if necessary create pvSys */
seqAddProg
(
sp
);
seqAddProg
(
sp
);
createOrAttachPvSystem
(
sp
);
if
(
!
pvSysIsDefined
(
sp
->
pvSys
))
if
(
!
pvSysIsDefined
(
sp
->
pvSys
))
{
{
sp
->
die
=
TRUE
;
sp
->
die
=
TRUE
;
...
@@ -262,7 +263,7 @@ static void ss_entry(void *arg)
...
@@ -262,7 +263,7 @@ static void ss_entry(void *arg)
if
(
ss
!=
sp
->
ss
)
if
(
ss
!=
sp
->
ss
)
{
{
ss
->
threadId
=
epicsThreadGetIdSelf
();
ss
->
threadId
=
epicsThreadGetIdSelf
();
pvSysAttach
(
sp
->
pvSys
);
createOrAttachPvSystem
(
sp
);
}
}
/* Register this thread with the EPICS watchdog (no callback func) */
/* Register this thread with the EPICS watchdog (no callback func) */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment