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
a1fce7e8
Commit
a1fce7e8
authored
Nov 05, 2014
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
general: is_new_state is a flag (makes it larger)
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
80b4fd6b
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
26 additions
and
24 deletions
+26
-24
main-loop.c
arch-sim/main-loop.c
+2
-2
main-loop.c
arch-unix/main-loop.c
+2
-2
main-loop.c
arch-wrs/main-loop.c
+2
-2
fsm.c
fsm.c
+3
-3
pp-instance.h
include/ppsi/pp-instance.h
+3
-1
main-loop.c
lib-bare/main-loop.c
+1
-1
state-wr-calibrated.c
proto-ext-whiterabbit/state-wr-calibrated.c
+1
-1
state-wr-calibration.c
proto-ext-whiterabbit/state-wr-calibration.c
+1
-1
state-wr-locked.c
proto-ext-whiterabbit/state-wr-locked.c
+1
-1
state-wr-m-lock.c
proto-ext-whiterabbit/state-wr-m-lock.c
+1
-1
state-wr-present.c
proto-ext-whiterabbit/state-wr-present.c
+1
-1
state-wr-resp-calib-req.c
proto-ext-whiterabbit/state-wr-resp-calib-req.c
+1
-1
state-wr-s-lock.c
proto-ext-whiterabbit/state-wr-s-lock.c
+2
-2
state-faulty.c
proto-standard/state-faulty.c
+1
-1
state-listening.c
proto-standard/state-listening.c
+1
-1
state-master.c
proto-standard/state-master.c
+1
-1
state-passive.c
proto-standard/state-passive.c
+1
-1
state-slave.c
proto-standard/state-slave.c
+1
-1
No files found.
arch-sim/main-loop.c
View file @
a1fce7e8
...
@@ -49,7 +49,7 @@ void sim_main_loop(struct pp_globals *ppg)
...
@@ -49,7 +49,7 @@ void sim_main_loop(struct pp_globals *ppg)
/* Initialize each link's state machine */
/* Initialize each link's state machine */
for
(
j
=
0
;
j
<
ppg
->
nlinks
;
j
++
)
{
for
(
j
=
0
;
j
<
ppg
->
nlinks
;
j
++
)
{
ppi
=
INST
(
ppg
,
j
);
ppi
=
INST
(
ppg
,
j
);
ppi
->
is_new_state
=
1
;
ppi
->
flags
|=
PPI_FLAG_IS_NEW_STATE
;
}
}
delay_ns
=
run_all_state_machines
(
ppg
)
*
1000LL
*
1000LL
;
delay_ns
=
run_all_state_machines
(
ppg
)
*
1000LL
*
1000LL
;
...
@@ -67,7 +67,7 @@ void sim_main_loop(struct pp_globals *ppg)
...
@@ -67,7 +67,7 @@ void sim_main_loop(struct pp_globals *ppg)
new_state
=
bmc
(
ppi
);
new_state
=
bmc
(
ppi
);
if
(
new_state
!=
ppi
->
state
)
{
if
(
new_state
!=
ppi
->
state
)
{
ppi
->
state
=
new_state
;
ppi
->
state
=
new_state
;
ppi
->
is_new_state
=
1
;
ppi
->
flags
|=
PPI_FLAG_IS_NEW_STATE
;
}
}
}
}
ppg
->
ebest_updated
=
0
;
ppg
->
ebest_updated
=
0
;
...
...
arch-unix/main-loop.c
View file @
a1fce7e8
...
@@ -60,7 +60,7 @@ void unix_main_loop(struct pp_globals *ppg)
...
@@ -60,7 +60,7 @@ void unix_main_loop(struct pp_globals *ppg)
* doing anything else but the protocol, this allows extra stuff
* doing anything else but the protocol, this allows extra stuff
* to fit.
* to fit.
*/
*/
ppi
->
is_new_state
=
1
;
ppi
->
flags
|=
PPI_FLAG_IS_NEW_STATE
;
}
}
delay_ms
=
run_all_state_machines
(
ppg
);
delay_ms
=
run_all_state_machines
(
ppg
);
...
@@ -80,7 +80,7 @@ void unix_main_loop(struct pp_globals *ppg)
...
@@ -80,7 +80,7 @@ void unix_main_loop(struct pp_globals *ppg)
new_state
=
bmc
(
ppi
);
new_state
=
bmc
(
ppi
);
if
(
new_state
!=
ppi
->
state
)
{
if
(
new_state
!=
ppi
->
state
)
{
ppi
->
state
=
new_state
;
ppi
->
state
=
new_state
;
ppi
->
is_new_state
=
1
;
ppi
->
flags
|=
PPI_FLAG_IS_NEW_STATE
;
}
}
}
}
ppg
->
ebest_updated
=
0
;
ppg
->
ebest_updated
=
0
;
...
...
arch-wrs/main-loop.c
View file @
a1fce7e8
...
@@ -96,7 +96,7 @@ void wrs_main_loop(struct pp_globals *ppg)
...
@@ -96,7 +96,7 @@ void wrs_main_loop(struct pp_globals *ppg)
* doing anything else but the protocol, this allows extra stuff
* doing anything else but the protocol, this allows extra stuff
* to fit.
* to fit.
*/
*/
ppi
->
is_new_state
=
1
;
ppi
->
flags
|=
PPI_FLAG_IS_NEW_STATE
;
}
}
delay_ms
=
run_all_state_machines
(
ppg
);
delay_ms
=
run_all_state_machines
(
ppg
);
...
@@ -118,7 +118,7 @@ void wrs_main_loop(struct pp_globals *ppg)
...
@@ -118,7 +118,7 @@ void wrs_main_loop(struct pp_globals *ppg)
new_state
=
bmc
(
ppi
);
new_state
=
bmc
(
ppi
);
if
(
new_state
!=
ppi
->
state
)
{
if
(
new_state
!=
ppi
->
state
)
{
ppi
->
state
=
new_state
;
ppi
->
state
=
new_state
;
ppi
->
is_new_state
=
1
;
ppi
->
flags
|=
PPI_FLAG_IS_NEW_STATE
;
}
}
}
}
ppg
->
ebest_updated
=
0
;
ppg
->
ebest_updated
=
0
;
...
...
fsm.c
View file @
a1fce7e8
...
@@ -108,7 +108,7 @@ int pp_state_machine(struct pp_instance *ppi, uint8_t *packet, int plen)
...
@@ -108,7 +108,7 @@ int pp_state_machine(struct pp_instance *ppi, uint8_t *packet, int plen)
/* found: handle this state */
/* found: handle this state */
ppi
->
next_state
=
state
;
ppi
->
next_state
=
state
;
ppi
->
next_delay
=
0
;
ppi
->
next_delay
=
0
;
if
(
pp
i
->
is_new_state
)
if
(
pp
_is_new_state
(
ppi
)
)
pp_diag_fsm
(
ppi
,
ip
->
name
,
STATE_ENTER
,
plen
);
pp_diag_fsm
(
ppi
,
ip
->
name
,
STATE_ENTER
,
plen
);
err
=
ip
->
f1
(
ppi
,
packet
,
plen
);
err
=
ip
->
f1
(
ppi
,
packet
,
plen
);
if
(
err
)
if
(
err
)
...
@@ -118,11 +118,11 @@ int pp_state_machine(struct pp_instance *ppi, uint8_t *packet, int plen)
...
@@ -118,11 +118,11 @@ int pp_state_machine(struct pp_instance *ppi, uint8_t *packet, int plen)
/* done: if new state mark it, and enter it now (0 ms) */
/* done: if new state mark it, and enter it now (0 ms) */
if
(
ppi
->
state
!=
ppi
->
next_state
)
{
if
(
ppi
->
state
!=
ppi
->
next_state
)
{
ppi
->
state
=
ppi
->
next_state
;
ppi
->
state
=
ppi
->
next_state
;
ppi
->
is_new_state
=
1
;
ppi
->
flags
|=
PPI_FLAG_IS_NEW_STATE
;
pp_diag_fsm
(
ppi
,
ip
->
name
,
STATE_LEAVE
,
0
);
pp_diag_fsm
(
ppi
,
ip
->
name
,
STATE_LEAVE
,
0
);
return
0
;
/* next_delay unused: go to new state now */
return
0
;
/* next_delay unused: go to new state now */
}
}
ppi
->
is_new_state
=
0
;
ppi
->
flags
&=
~
PPI_FLAG_IS_NEW_STATE
;
pp_diag_fsm
(
ppi
,
ip
->
name
,
STATE_LOOP
,
0
);
pp_diag_fsm
(
ppi
,
ip
->
name
,
STATE_LOOP
,
0
);
return
ppi
->
next_delay
;
return
ppi
->
next_delay
;
}
}
...
...
include/ppsi/pp-instance.h
View file @
a1fce7e8
...
@@ -137,7 +137,7 @@ struct pp_instance_cfg {
...
@@ -137,7 +137,7 @@ struct pp_instance_cfg {
*/
*/
struct
pp_instance
{
struct
pp_instance
{
int
state
;
int
state
;
int
next_state
,
next_delay
,
is_new_state
;
/* set by state processing */
int
next_state
,
next_delay
;
/* set by state processing */
void
*
arch_data
;
/* if arch needs it */
void
*
arch_data
;
/* if arch needs it */
void
*
ext_data
;
/* if protocol ext needs it */
void
*
ext_data
;
/* if protocol ext needs it */
unsigned
long
d_flags
;
/* diagnostics, ppi-specific flags */
unsigned
long
d_flags
;
/* diagnostics, ppi-specific flags */
...
@@ -195,6 +195,8 @@ struct pp_instance {
...
@@ -195,6 +195,8 @@ struct pp_instance {
#define PPI_FLAG_MASTER_ONLY 0x0020
#define PPI_FLAG_MASTER_ONLY 0x0020
#define PPI_FLAG_FROM_CURRENT_PARENT 0x0100
#define PPI_FLAG_FROM_CURRENT_PARENT 0x0100
#define PPI_FLAG_WAITING_FOR_F_UP 0x0200
#define PPI_FLAG_WAITING_FOR_F_UP 0x0200
#define PPI_FLAG_IS_NEW_STATE 0x0400
#define pp_is_new_state(ppi) ((ppi)->flags & PPI_FLAG_IS_NEW_STATE)
struct
pp_globals_cfg
{
struct
pp_globals_cfg
{
...
...
lib-bare/main-loop.c
View file @
a1fce7e8
...
@@ -30,7 +30,7 @@ void bare_main_loop(struct pp_instance *ppi)
...
@@ -30,7 +30,7 @@ void bare_main_loop(struct pp_instance *ppi)
* doing anything else but the protocol, this allows extra stuff
* doing anything else but the protocol, this allows extra stuff
* to fit.
* to fit.
*/
*/
ppi
->
is_new_state
=
1
;
ppi
->
flags
|=
PPI_FLAG_IS_NEW_STATE
;
delay_ms
=
pp_state_machine
(
ppi
,
NULL
,
0
);
delay_ms
=
pp_state_machine
(
ppi
,
NULL
,
0
);
while
(
1
)
{
while
(
1
)
{
struct
bare_fd_set
set
;
struct
bare_fd_set
set
;
...
...
proto-ext-whiterabbit/state-wr-calibrated.c
View file @
a1fce7e8
...
@@ -18,7 +18,7 @@ int wr_calibrated(struct pp_instance *ppi, unsigned char *pkt, int plen)
...
@@ -18,7 +18,7 @@ int wr_calibrated(struct pp_instance *ppi, unsigned char *pkt, int plen)
struct
wr_dsport
*
wrp
=
WR_DSPOR
(
ppi
);
struct
wr_dsport
*
wrp
=
WR_DSPOR
(
ppi
);
MsgSignaling
wrsig_msg
;
MsgSignaling
wrsig_msg
;
if
(
pp
i
->
is_new_state
)
if
(
pp
_is_new_state
(
ppi
)
)
pp_timeout_set
(
ppi
,
PP_TO_EXT_0
,
wrp
->
wrStateTimeout
);
pp_timeout_set
(
ppi
,
PP_TO_EXT_0
,
wrp
->
wrStateTimeout
);
if
(
pp_timeout_z
(
ppi
,
PP_TO_EXT_0
))
{
if
(
pp_timeout_z
(
ppi
,
PP_TO_EXT_0
))
{
...
...
proto-ext-whiterabbit/state-wr-calibration.c
View file @
a1fce7e8
...
@@ -19,7 +19,7 @@ int wr_calibration(struct pp_instance *ppi, unsigned char *pkt, int plen)
...
@@ -19,7 +19,7 @@ int wr_calibration(struct pp_instance *ppi, unsigned char *pkt, int plen)
int
e
=
0
,
sendmsg
=
0
;
int
e
=
0
,
sendmsg
=
0
;
uint32_t
delta
;
uint32_t
delta
;
if
(
pp
i
->
is_new_state
)
{
if
(
pp
_is_new_state
(
ppi
)
)
{
wrp
->
wrStateRetry
=
WR_STATE_RETRY
;
wrp
->
wrStateRetry
=
WR_STATE_RETRY
;
sendmsg
=
1
;
sendmsg
=
1
;
}
else
if
(
pp_timeout_z
(
ppi
,
PP_TO_EXT_0
))
{
}
else
if
(
pp_timeout_z
(
ppi
,
PP_TO_EXT_0
))
{
...
...
proto-ext-whiterabbit/state-wr-locked.c
View file @
a1fce7e8
...
@@ -19,7 +19,7 @@ int wr_locked(struct pp_instance *ppi, unsigned char *pkt, int plen)
...
@@ -19,7 +19,7 @@ int wr_locked(struct pp_instance *ppi, unsigned char *pkt, int plen)
MsgSignaling
wrsig_msg
;
MsgSignaling
wrsig_msg
;
struct
wr_dsport
*
wrp
=
WR_DSPOR
(
ppi
);
struct
wr_dsport
*
wrp
=
WR_DSPOR
(
ppi
);
if
(
pp
i
->
is_new_state
)
{
if
(
pp
_is_new_state
(
ppi
)
)
{
wrp
->
wrStateRetry
=
WR_STATE_RETRY
;
wrp
->
wrStateRetry
=
WR_STATE_RETRY
;
sendmsg
=
1
;
sendmsg
=
1
;
}
else
if
(
pp_timeout_z
(
ppi
,
PP_TO_EXT_0
))
{
}
else
if
(
pp_timeout_z
(
ppi
,
PP_TO_EXT_0
))
{
...
...
proto-ext-whiterabbit/state-wr-m-lock.c
View file @
a1fce7e8
...
@@ -19,7 +19,7 @@ int wr_m_lock(struct pp_instance *ppi, unsigned char *pkt, int plen)
...
@@ -19,7 +19,7 @@ int wr_m_lock(struct pp_instance *ppi, unsigned char *pkt, int plen)
MsgSignaling
wrsig_msg
;
MsgSignaling
wrsig_msg
;
struct
wr_dsport
*
wrp
=
WR_DSPOR
(
ppi
);
struct
wr_dsport
*
wrp
=
WR_DSPOR
(
ppi
);
if
(
pp
i
->
is_new_state
)
{
if
(
pp
_is_new_state
(
ppi
)
)
{
wrp
->
wrStateRetry
=
WR_STATE_RETRY
;
wrp
->
wrStateRetry
=
WR_STATE_RETRY
;
sendmsg
=
1
;
sendmsg
=
1
;
}
else
if
(
pp_timeout_z
(
ppi
,
PP_TO_EXT_0
))
{
}
else
if
(
pp_timeout_z
(
ppi
,
PP_TO_EXT_0
))
{
...
...
proto-ext-whiterabbit/state-wr-present.c
View file @
a1fce7e8
...
@@ -23,7 +23,7 @@ int wr_present(struct pp_instance *ppi, unsigned char *pkt, int plen)
...
@@ -23,7 +23,7 @@ int wr_present(struct pp_instance *ppi, unsigned char *pkt, int plen)
MsgSignaling
wrsig_msg
;
MsgSignaling
wrsig_msg
;
if
(
pp
i
->
is_new_state
)
{
if
(
pp
_is_new_state
(
ppi
)
)
{
wrp
->
wrStateRetry
=
WR_STATE_RETRY
;
wrp
->
wrStateRetry
=
WR_STATE_RETRY
;
sendmsg
=
1
;
sendmsg
=
1
;
}
else
if
(
pp_timeout_z
(
ppi
,
PP_TO_EXT_0
))
{
}
else
if
(
pp_timeout_z
(
ppi
,
PP_TO_EXT_0
))
{
...
...
proto-ext-whiterabbit/state-wr-resp-calib-req.c
View file @
a1fce7e8
...
@@ -16,7 +16,7 @@ int wr_resp_calib_req(struct pp_instance *ppi, unsigned char *pkt, int plen)
...
@@ -16,7 +16,7 @@ int wr_resp_calib_req(struct pp_instance *ppi, unsigned char *pkt, int plen)
int
e
=
0
,
enable
=
0
;
int
e
=
0
,
enable
=
0
;
int
send_pattern
=
(
wrp
->
otherNodeCalSendPattern
!=
0
);
int
send_pattern
=
(
wrp
->
otherNodeCalSendPattern
!=
0
);
if
(
pp
i
->
is_new_state
)
{
if
(
pp
_is_new_state
(
ppi
)
)
{
wrp
->
wrStateRetry
=
WR_STATE_RETRY
;
wrp
->
wrStateRetry
=
WR_STATE_RETRY
;
enable
=
1
;
enable
=
1
;
}
else
if
(
pp_timeout_z
(
ppi
,
PP_TO_EXT_0
))
{
}
else
if
(
pp_timeout_z
(
ppi
,
PP_TO_EXT_0
))
{
...
...
proto-ext-whiterabbit/state-wr-s-lock.c
View file @
a1fce7e8
...
@@ -14,8 +14,8 @@ int wr_s_lock(struct pp_instance *ppi, unsigned char *pkt, int plen)
...
@@ -14,8 +14,8 @@ int wr_s_lock(struct pp_instance *ppi, unsigned char *pkt, int plen)
struct
wr_dsport
*
wrp
=
WR_DSPOR
(
ppi
);
struct
wr_dsport
*
wrp
=
WR_DSPOR
(
ppi
);
int
enable
=
0
;
int
enable
=
0
;
if
(
pp
i
->
is_new_state
)
{
if
(
pp
_is_new_state
(
ppi
)
)
{
wrp
->
wrStateRetry
=
WR_STATE_RETRY
;
wrp
->
wrStateRetry
=
WR_STATE_RETRY
;
enable
=
1
;
enable
=
1
;
}
else
if
(
pp_timeout_z
(
ppi
,
PP_TO_EXT_0
))
{
}
else
if
(
pp_timeout_z
(
ppi
,
PP_TO_EXT_0
))
{
wrp
->
ops
->
locking_disable
(
ppi
);
wrp
->
ops
->
locking_disable
(
ppi
);
...
...
proto-standard/state-faulty.c
View file @
a1fce7e8
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
int
pp_faulty
(
struct
pp_instance
*
ppi
,
unsigned
char
*
pkt
,
int
plen
)
int
pp_faulty
(
struct
pp_instance
*
ppi
,
unsigned
char
*
pkt
,
int
plen
)
{
{
if
(
pp
i
->
is_new_state
)
{
if
(
pp
_is_new_state
(
ppi
)
)
{
pp_timeout_set
(
ppi
,
PP_TO_FAULTY
,
4000
);
pp_timeout_set
(
ppi
,
PP_TO_FAULTY
,
4000
);
}
}
...
...
proto-standard/state-listening.c
View file @
a1fce7e8
...
@@ -18,7 +18,7 @@ int pp_listening(struct pp_instance *ppi, unsigned char *pkt, int plen)
...
@@ -18,7 +18,7 @@ int pp_listening(struct pp_instance *ppi, unsigned char *pkt, int plen)
if
(
e
)
if
(
e
)
goto
out
;
goto
out
;
if
(
pp
i
->
is_new_state
)
if
(
pp
_is_new_state
(
ppi
)
)
pp_timeout_restart_annrec
(
ppi
);
pp_timeout_restart_annrec
(
ppi
);
if
(
plen
==
0
)
if
(
plen
==
0
)
...
...
proto-standard/state-master.c
View file @
a1fce7e8
...
@@ -15,7 +15,7 @@ int pp_master(struct pp_instance *ppi, unsigned char *pkt, int plen)
...
@@ -15,7 +15,7 @@ int pp_master(struct pp_instance *ppi, unsigned char *pkt, int plen)
int
msgtype
,
d1
,
d2
;
int
msgtype
,
d1
,
d2
;
int
e
=
0
;
/* error var, to check errors in msg handling */
int
e
=
0
;
/* error var, to check errors in msg handling */
if
(
pp
i
->
is_new_state
)
{
if
(
pp
_is_new_state
(
ppi
)
)
{
pp_timeout_rand
(
ppi
,
PP_TO_SYNC
,
DSPOR
(
ppi
)
->
logSyncInterval
);
pp_timeout_rand
(
ppi
,
PP_TO_SYNC
,
DSPOR
(
ppi
)
->
logSyncInterval
);
pp_timeout_rand
(
ppi
,
PP_TO_ANN_INTERVAL
,
pp_timeout_rand
(
ppi
,
PP_TO_ANN_INTERVAL
,
DSPOR
(
ppi
)
->
logAnnounceInterval
);
DSPOR
(
ppi
)
->
logAnnounceInterval
);
...
...
proto-standard/state-passive.c
View file @
a1fce7e8
...
@@ -13,7 +13,7 @@ int pp_passive(struct pp_instance *ppi, unsigned char *pkt, int plen)
...
@@ -13,7 +13,7 @@ int pp_passive(struct pp_instance *ppi, unsigned char *pkt, int plen)
{
{
int
e
=
0
;
/* error var, to check errors in msg handling */
int
e
=
0
;
/* error var, to check errors in msg handling */
if
(
pp
i
->
is_new_state
)
if
(
pp
_is_new_state
(
ppi
)
)
pp_timeout_restart_annrec
(
ppi
);
pp_timeout_restart_annrec
(
ppi
);
if
(
plen
==
0
)
if
(
plen
==
0
)
...
...
proto-standard/state-slave.c
View file @
a1fce7e8
...
@@ -16,7 +16,7 @@ int pp_slave(struct pp_instance *ppi, unsigned char *pkt, int plen)
...
@@ -16,7 +16,7 @@ int pp_slave(struct pp_instance *ppi, unsigned char *pkt, int plen)
MsgDelayResp
resp
;
MsgDelayResp
resp
;
int
d1
,
d2
;
int
d1
,
d2
;
if
(
pp
i
->
is_new_state
)
{
if
(
pp
_is_new_state
(
ppi
)
)
{
pp_servo_init
(
ppi
);
pp_servo_init
(
ppi
);
if
(
pp_hooks
.
new_slave
)
if
(
pp_hooks
.
new_slave
)
...
...
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