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
50
Issues
50
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
f834fa97
Commit
f834fa97
authored
May 02, 2018
by
Jean-Claude BAU
Committed by
Adam Wujek
Nov 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WR-EXT: optimization of hooks.c file. Change if/then with switch/case
parent
6868930e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
27 deletions
+33
-27
hooks.c
proto-ext-whiterabbit/hooks.c
+33
-27
No files found.
proto-ext-whiterabbit/hooks.c
View file @
f834fa97
...
...
@@ -161,6 +161,7 @@ static int wr_handle_resp(struct pp_instance *ppi)
static
void
wr_s1
(
struct
pp_instance
*
ppi
,
struct
pp_frgn_master
*
frgn_master
)
{
pp_diag
(
ppi
,
ext
,
2
,
"hook: %s
\n
"
,
__func__
);
WR_DSPOR
(
ppi
)
->
parentIsWRnode
=
((
frgn_master
->
ext_specific
&
WR_NODE_MODE
)
!=
NON_WR
);
...
...
@@ -200,15 +201,16 @@ static int wr_handle_announce(struct pp_instance *ppi)
{
pp_diag
(
ppi
,
ext
,
2
,
"hook: %s
\n
"
,
__func__
);
if
((
ppi
->
state
==
WRS_PRESENT
)
||
(
ppi
->
state
==
WRS_S_LOCK
)
||
(
ppi
->
state
==
WRS_LOCKED
)
||
(
ppi
->
state
==
WRS_CALIBRATION
)
||
(
ppi
->
state
==
WRS_CALIBRATED
)
||
(
ppi
->
state
==
WRS_RESP_CALIB_REQ
)
||
(
ppi
->
state
==
WRS_WR_LINK_ON
))
{
/* reset announce timeout when in the WR slave states */
pp_timeout_set
(
ppi
,
PP_TO_ANN_RECEIPT
);
switch
(
ppi
->
state
)
{
case
WRS_PRESENT
:
case
WRS_S_LOCK
:
case
WRS_LOCKED
:
case
WRS_CALIBRATION
:
case
WRS_CALIBRATED
:
case
WRS_RESP_CALIB_REQ
:
case
WRS_WR_LINK_ON
:
/* reset announce timeout when in the WR slave states */
pp_timeout_set
(
ppi
,
PP_TO_ANN_RECEIPT
);
}
/* handshake is started in slave mode */
...
...
@@ -295,15 +297,17 @@ static int wr_state_decision(struct pp_instance *ppi, int next_state)
* if in one of the WR states stay in them,
* they will eventually go back to the normal states
*/
if
((
ppi
->
state
==
WRS_PRESENT
)
||
(
ppi
->
state
==
WRS_M_LOCK
)
||
(
ppi
->
state
==
WRS_S_LOCK
)
||
(
ppi
->
state
==
WRS_LOCKED
)
||
(
ppi
->
state
==
WRS_CALIBRATION
)
||
(
ppi
->
state
==
WRS_CALIBRATED
)
||
(
ppi
->
state
==
WRS_RESP_CALIB_REQ
)
||
(
ppi
->
state
==
WRS_WR_LINK_ON
))
return
ppi
->
state
;
switch
(
ppi
->
state
)
{
case
WRS_PRESENT
:
case
WRS_M_LOCK
:
case
WRS_S_LOCK
:
case
WRS_LOCKED
:
case
WRS_CALIBRATION
:
case
WRS_CALIBRATED
:
case
WRS_RESP_CALIB_REQ
:
case
WRS_WR_LINK_ON
:
return
ppi
->
state
;
}
/* else do the normal statemachine */
return
next_state
;
...
...
@@ -315,15 +319,17 @@ static void wr_state_change(struct pp_instance *ppi)
pp_diag
(
ppi
,
ext
,
2
,
"hook: %s
\n
"
,
__func__
);
if
((
ppi
->
next_state
==
WRS_PRESENT
)
||
(
ppi
->
next_state
==
WRS_M_LOCK
)
||
(
ppi
->
next_state
==
WRS_S_LOCK
)
||
(
ppi
->
next_state
==
WRS_LOCKED
)
||
(
ppi
->
next_state
==
WRS_CALIBRATION
)
||
(
ppi
->
next_state
==
WRS_CALIBRATED
)
||
(
ppi
->
next_state
==
WRS_RESP_CALIB_REQ
)
||
(
ppi
->
next_state
==
WRS_WR_LINK_ON
))
return
;
switch
(
ppi
->
next_state
)
{
case
WRS_PRESENT
:
case
WRS_M_LOCK
:
case
WRS_S_LOCK
:
case
WRS_LOCKED
:
case
WRS_CALIBRATION
:
case
WRS_CALIBRATED
:
case
WRS_RESP_CALIB_REQ
:
case
WRS_WR_LINK_ON
:
return
;
}
/* if we are leaving the WR locked states reset the WR process */
if
((
ppi
->
next_state
!=
ppi
->
state
)
&&
...
...
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