Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
PPSi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
47
Issues
47
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
PPSi
Commits
d2b2c636
Commit
d2b2c636
authored
Jun 15, 2016
by
Davide Ciminaghi
Committed by
Alessandro Rubini
Sep 20, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fsm: cache pointer to current state table item
parent
fa17b6c7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
2 deletions
+12
-2
fsm.c
fsm.c
+8
-1
pp-instance.h
include/ppsi/pp-instance.h
+1
-0
wr-api.h
proto-ext-whiterabbit/wr-api.h
+2
-1
open-close.c
proto-standard/open-close.c
+1
-0
No files found.
fsm.c
View file @
d2b2c636
...
...
@@ -68,10 +68,16 @@ get_current_state_table_item(struct pp_instance *ppi)
struct
pp_state_table_item
*
ip
;
struct
pp_state_table_item
*
out
=
NULL
;
/* Avoid searching if we already know where we are */
if
(
ppi
->
current_state_item
)
return
ppi
->
current_state_item
;
/* a linear search is affordable up to a few dozen items */
for
(
ip
=
pp_state_table
;
ip
->
state
!=
PPS_END_OF_TABLE
&&
!
out
;
ip
++
)
if
(
ip
->
state
==
ppi
->
state
)
if
(
ip
->
state
==
ppi
->
state
)
{
out
=
ip
;
ppi
->
current_state_item
=
ip
;
}
return
out
;
}
...
...
@@ -139,6 +145,7 @@ int pp_state_machine(struct pp_instance *ppi, uint8_t *packet, int plen)
pp_timeout_setall
(
ppi
);
ppi
->
flags
&=
~
PPI_FLAGS_WAITING
;
pp_diag_fsm
(
ppi
,
ip
->
name
,
STATE_LEAVE
,
0
);
ppi
->
current_state_item
=
NULL
;
return
0
;
/* next_delay unused: go to new state now */
}
ppi
->
is_new_state
=
0
;
...
...
include/ppsi/pp-instance.h
View file @
d2b2c636
...
...
@@ -123,6 +123,7 @@ struct pp_instance_cfg {
struct
pp_instance
{
int
state
;
int
next_state
,
next_delay
,
is_new_state
;
/* set by state processing */
struct
pp_state_table_item
*
current_state_item
;
void
*
arch_data
;
/* if arch needs it */
void
*
ext_data
;
/* if protocol ext needs it */
unsigned
long
d_flags
;
/* diagnostics, ppi-specific flags */
...
...
proto-ext-whiterabbit/wr-api.h
View file @
d2b2c636
...
...
@@ -12,7 +12,8 @@
#include <ppsi/lib.h>
#include "wr-constants.h"
#define WRS_PPSI_SHMEM_VERSION 14
/* Many changes since the last incease */
#define WRS_PPSI_SHMEM_VERSION 15
/* added current_state_item the structure
* pp_instance */
/*
* This structure is used as extension-specific data in the DSPort
...
...
proto-standard/open-close.c
View file @
d2b2c636
...
...
@@ -78,6 +78,7 @@ int pp_init_globals(struct pp_globals *ppg, struct pp_runtime_opts *pp_rt_opts)
def
->
slaveOnly
=
0
;
ppi
->
state
=
PPS_INITIALIZING
;
ppi
->
current_state_item
=
NULL
;
ppi
->
port_idx
=
i
;
ppi
->
frgn_rec_best
=
-
1
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment