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
9db3a2be
Commit
9db3a2be
authored
Mar 13, 2023
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor reformating
parent
0556d165
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
58 deletions
+59
-58
wrs-startup.c
arch-wrs/wrs-startup.c
+5
-5
fsm.c
fsm.c
+9
-7
l1e-hooks.c
proto-ext-l1sync/l1e-hooks.c
+17
-22
l1e-msg.c
proto-ext-l1sync/l1e-msg.c
+1
-1
l1e-state-machine.c
proto-ext-l1sync/l1e-state-machine.c
+27
-23
No files found.
arch-wrs/wrs-startup.c
View file @
9db3a2be
...
...
@@ -313,11 +313,11 @@ int main(int argc, char **argv)
if
(
!
enable_l1Sync
(
ppi
,
TRUE
)
)
goto
exit_out_of_memory
;
/* Force mandatory attributes - Do not take care of the configuration */
L1E_DSPOR_BS
(
ppi
)
->
rxCoherentIsRequired
=
L1E_DSPOR_BS
(
ppi
)
->
txCoherentIsRequired
=
L1E_DSPOR_BS
(
ppi
)
->
congruentIsRequired
=
L1E_DSPOR_BS
(
ppi
)
->
L1SyncEnabled
=
TRUE
;
L1E_DSPOR_BS
(
ppi
)
->
optParamsEnabled
=
FALSE
;
L1E_DSPOR_BS
(
ppi
)
->
rxCoherentIsRequired
=
TRUE
;
L1E_DSPOR_BS
(
ppi
)
->
txCoherentIsRequired
=
TRUE
;
L1E_DSPOR_BS
(
ppi
)
->
congruentIsRequired
=
TRUE
;
L1E_DSPOR_BS
(
ppi
)
->
L1SyncEnabled
=
TRUE
;
L1E_DSPOR_BS
(
ppi
)
->
optParamsEnabled
=
FALSE
;
enable_asymmetryCorrection
(
ppi
,
TRUE
);
#else
...
...
fsm.c
View file @
9db3a2be
...
...
@@ -46,20 +46,22 @@ enum {
static
void
pp_diag_fsm
(
struct
pp_instance
*
ppi
,
const
char
*
name
,
int
sequence
,
int
len
)
{
if
(
sequence
==
STATE_ENTER
)
{
switch
(
sequence
)
{
case
STATE_ENTER
:
/* enter with or without a packet len */
pp_fsm_printf
(
ppi
,
"ENTER %s, packet len %i
\n
"
,
name
,
len
);
return
;
}
if
(
sequence
==
STATE_LOOP
)
{
case
STATE_LOOP
:
pp_fsm_printf
(
ppi
,
"%s: reenter in %i ms
\n
"
,
name
,
ppi
->
next_delay
);
ppi
->
next_delay
);
return
;
case
STATE_LEAVE
:
/* leave has one \n more, so different states are separate */
pp_fsm_printf
(
ppi
,
"LEAVE %s (next: %3i)
\n\n
"
,
name
,
ppi
->
next_state
);
return
;
}
/* leave has one \n more, so different states are separate */
pp_fsm_printf
(
ppi
,
"LEAVE %s (next: %3i)
\n\n
"
,
name
,
ppi
->
next_state
);
}
static
const
struct
pp_state_table_item
*
...
...
proto-ext-l1sync/l1e-hooks.c
View file @
9db3a2be
...
...
@@ -192,37 +192,31 @@ static int l1e_ready_for_slave(struct pp_instance *ppi)
return
1
;
/* Ready for slave */
}
static
void
l1e_state_change
(
struct
pp_instance
*
ppi
)
{
static
void
l1e_state_change
(
struct
pp_instance
*
ppi
)
{
pp_diag
(
ppi
,
ext
,
2
,
"hook: %s
\n
"
,
__func__
);
if
(
ppi
->
extState
==
PP_EXSTATE_PTP
&&
ppi
->
next_state
==
PPS_UNCALIBRATED
)
{
if
(
ppi
->
extState
==
PP_EXSTATE_PTP
&&
ppi
->
next_state
==
PPS_UNCALIBRATED
)
{
// Extension need to be re-enabled
pdstate_enable_extension
(
ppi
);
}
if
(
(
ppi
->
next_state
==
PPS_DISABLED
||
ppi
->
extState
!=
PP_EXSTATE_ACTIVE
)
&&
L1E_DSPOR
(
ppi
)
->
basic
.
L1SyncState
!=
L1SYNC_DISABLED
)
{
if
(
(
ppi
->
next_state
==
PPS_DISABLED
||
ppi
->
extState
!=
PP_EXSTATE_ACTIVE
)
&&
L1E_DSPOR
(
ppi
)
->
basic
.
L1SyncState
!=
L1SYNC_DISABLED
)
{
// Extension not active but the l1sync state is not disable yet.
L1E_DSPOR
(
ppi
)
->
basic
.
next_state
=
L1SYNC_DISABLED
;
/* Force L1Sync DISABLE state */
l1e_run_state_machine
(
ppi
,
NULL
,
0
);
}
else
{
if
(
ppi
->
extState
==
PP_EXSTATE_ACTIVE
&&
ppi
->
next_state
==
PPS_INITIALIZING
)
{
L1E_DSPOR
(
ppi
)
->
basic
.
L1SyncState
=
L1E_DSPOR
(
ppi
)
->
basic
.
next_state
=
L1SYNC_DISABLED
;
}
else
{
if
(
ppi
->
state
==
PPS_SLAVE
&&
ppi
->
next_state
!=
PPS_UNCALIBRATED
&&
L1E_DSPOR
(
ppi
)
->
basic
.
L1SyncState
!=
L1SYNC_DISABLED
)
{
/* Leave SLAVE state : We must stop the PPS generation */
if
(
!
GOPTS
(
GLBS
(
ppi
))
->
forcePpsGen
)
TOPS
(
ppi
)
->
enable_timing_output
(
GLBS
(
ppi
),
0
);
WRH_OPER
()
->
locking_disable
(
ppi
);
WRH_OPER
()
->
locking_reset
(
ppi
);
l1e_servo_reset
(
ppi
);
}
}
}
else
if
(
ppi
->
extState
==
PP_EXSTATE_ACTIVE
&&
ppi
->
next_state
==
PPS_INITIALIZING
)
{
L1E_DSPOR
(
ppi
)
->
basic
.
L1SyncState
=
L1E_DSPOR
(
ppi
)
->
basic
.
next_state
=
L1SYNC_DISABLED
;
}
else
if
(
ppi
->
state
==
PPS_SLAVE
&&
ppi
->
next_state
!=
PPS_UNCALIBRATED
&&
L1E_DSPOR
(
ppi
)
->
basic
.
L1SyncState
!=
L1SYNC_DISABLED
)
{
/* Leave SLAVE state : We must stop the PPS generation */
if
(
!
GOPTS
(
GLBS
(
ppi
))
->
forcePpsGen
)
TOPS
(
ppi
)
->
enable_timing_output
(
GLBS
(
ppi
),
0
);
WRH_OPER
()
->
locking_disable
(
ppi
);
WRH_OPER
()
->
locking_reset
(
ppi
);
l1e_servo_reset
(
ppi
);
}
}
static
int
l1e_new_slave
(
struct
pp_instance
*
ppi
,
void
*
buf
,
int
len
)
{
...
...
@@ -254,7 +248,8 @@ static int l1e_is_correction_field_compliant (struct pp_instance *ppi) {
return
1
;
}
static
int
l1e_extension_state_changed
(
struct
pp_instance
*
ppi
)
{
static
int
l1e_extension_state_changed
(
struct
pp_instance
*
ppi
)
{
if
(
ppi
->
extState
!=
PP_EXSTATE_ACTIVE
&&
L1E_DSPOR
(
ppi
)
->
basic
.
L1SyncState
!=
L1SYNC_DISABLED
)
{
// Extension disabled : Force L1SYNC_DISABLED disable state
L1E_DSPOR
(
ppi
)
->
basic
.
next_state
=
L1SYNC_DISABLED
;
/* Force L1Sync DISABLE state */
...
...
proto-ext-l1sync/l1e-msg.c
View file @
9db3a2be
...
...
@@ -70,7 +70,7 @@ int l1e_pack_signal(struct pp_instance *ppi)
bds
->
congruentIsRequired
);
if
(
bds
->
optParamsEnabled
)
local_config
|=
L1E_OPT_PARAMS
;
local_active
=
l1e_creat_L1Sync_bitmask
(
bds
->
isTxCoherent
,
bds
->
isRxCoherent
,
bds
->
isCongruent
);
...
...
proto-ext-l1sync/l1e-state-machine.c
View file @
9db3a2be
...
...
@@ -26,7 +26,7 @@ static int l1e_handle_state_link_alive(struct pp_instance *ppi, Boolean new_stat
static
int
l1e_handle_state_config_match
(
struct
pp_instance
*
ppi
,
Boolean
new_state
);
static
int
l1e_handle_state_up
(
struct
pp_instance
*
ppi
,
Boolean
new_state
);
static
l1e_state_machine_t
le1_state_actions
[]
=
{
static
const
l1e_state_machine_t
le1_state_actions
[]
=
{
[
0
]
{
/* Not used */
.
action
=
l1e_empty_action
,
},
...
...
@@ -146,7 +146,7 @@ static Boolean le1_evt_STATE_OK(struct pp_instance *ppi) {
case
PPS_UNCALIBRATED
:
pll_state
=
WRH_OPER
()
->
locking_poll
(
ppi
);
/* Get the PPL state */
basicDS
->
isCongruent
=
basicDS
->
isRxCoherent
=
pll_state
==
WRH_SPLL_LOCKED
?
1
:
0
;
basicDS
->
isRxCoherent
=
pll_state
==
WRH_SPLL_LOCKED
?
1
:
0
;
break
;
case
PPS_MASTER
:
basicDS
->
isRxCoherent
=
...
...
@@ -231,7 +231,8 @@ static void l1e_send_sync_msg(struct pp_instance *ppi, Boolean immediatSend) {
}
/* DISABLED state */
static
int
l1e_handle_state_disabled
(
struct
pp_instance
*
ppi
,
Boolean
new_state
){
static
int
l1e_handle_state_disabled
(
struct
pp_instance
*
ppi
,
Boolean
new_state
)
{
l1e_ext_portDS_t
*
l1e_portDS
=
L1E_DSPOR
(
ppi
);
/* State initialization */
...
...
@@ -240,16 +241,15 @@ static int l1e_handle_state_disabled(struct pp_instance *ppi, Boolean new_state)
* All dynamic members of L1SyncBasicPortDS and L1SyncOptPortDS data sets are set
* to initialization values
*/
l1e_portDS
->
basic
.
isTxCoherent
=
l1e_portDS
->
basic
.
isRxCoherent
=
l1e_portDS
->
basic
.
isCongruent
=
l1e_portDS
->
basic
.
peerTxCoherentIsRequired
=
l1e_portDS
->
basic
.
peerRxCoherentIsRequired
=
l1e_portDS
->
basic
.
peerCongruentIsRequired
=
l1e_portDS
->
basic
.
peerIsTxCoherent
=
l1e_portDS
->
basic
.
peerIsRxCoherent
=
l1e_portDS
->
basic
.
peerIsCongruent
=
FALSE
;
l1e_portDS
->
basic
.
isTxCoherent
=
FALSE
;
l1e_portDS
->
basic
.
isRxCoherent
=
FALSE
;
l1e_portDS
->
basic
.
isCongruent
=
FALSE
;
l1e_portDS
->
basic
.
peerTxCoherentIsRequired
=
FALSE
;
l1e_portDS
->
basic
.
peerRxCoherentIsRequired
=
FALSE
;
l1e_portDS
->
basic
.
peerCongruentIsRequired
=
FALSE
;
l1e_portDS
->
basic
.
peerIsTxCoherent
=
FALSE
;
l1e_portDS
->
basic
.
peerIsRxCoherent
=
FALSE
;
l1e_portDS
->
basic
.
peerIsCongruent
=
FALSE
;
}
/* Check if state transition needed */
if
(
le1_evt_L1_SYNC_ENABLED
(
ppi
)
&&
!
le1_evt_L1_SYNC_RESET
(
ppi
)
)
{
...
...
@@ -261,7 +261,8 @@ static int l1e_handle_state_disabled(struct pp_instance *ppi, Boolean new_state)
}
/* IDLE state */
static
int
l1e_handle_state_idle
(
struct
pp_instance
*
ppi
,
Boolean
new_state
){
static
int
l1e_handle_state_idle
(
struct
pp_instance
*
ppi
,
Boolean
new_state
)
{
l1e_ext_portDS_t
*
l1e_portDS
=
L1E_DSPOR
(
ppi
);
/* State initialization */
...
...
@@ -270,12 +271,12 @@ static int l1e_handle_state_idle(struct pp_instance *ppi, Boolean new_state){
* The dynamic members listed in Table 155 are set to initialization
* values when entering this state.
*/
l1e_portDS
->
basic
.
peerTxCoherentIsRequired
=
l1e_portDS
->
basic
.
peerRxCoherentIsRequired
=
l1e_portDS
->
basic
.
peerCongruentIsRequired
=
l1e_portDS
->
basic
.
peerIsTxCoherent
=
l1e_portDS
->
basic
.
peerIsRxCoherent
=
l1e_portDS
->
basic
.
peerIsCongruent
=
FALSE
;
l1e_portDS
->
basic
.
peerTxCoherentIsRequired
=
FALSE
;
l1e_portDS
->
basic
.
peerRxCoherentIsRequired
=
FALSE
;
l1e_portDS
->
basic
.
peerCongruentIsRequired
=
FALSE
;
l1e_portDS
->
basic
.
peerIsTxCoherent
=
FALSE
;
l1e_portDS
->
basic
.
peerIsRxCoherent
=
FALSE
;
l1e_portDS
->
basic
.
peerIsCongruent
=
FALSE
;
l1e_send_sync_msg
(
ppi
,
1
);
/* Send immediately a message */
}
...
...
@@ -296,7 +297,8 @@ static int l1e_handle_state_idle(struct pp_instance *ppi, Boolean new_state){
}
/* LINK_ALIVE state */
static
int
l1e_handle_state_link_alive
(
struct
pp_instance
*
ppi
,
Boolean
new_state
){
static
int
l1e_handle_state_link_alive
(
struct
pp_instance
*
ppi
,
Boolean
new_state
)
{
L1SyncBasicPortDS_t
*
basic
=
L1E_DSPOR_BS
(
ppi
);
/* State initialization */
...
...
@@ -322,7 +324,8 @@ static int l1e_handle_state_link_alive(struct pp_instance *ppi, Boolean new_stat
}
/* CONFIG_MATCH state */
static
int
l1e_handle_state_config_match
(
struct
pp_instance
*
ppi
,
Boolean
new_state
){
static
int
l1e_handle_state_config_match
(
struct
pp_instance
*
ppi
,
Boolean
new_state
)
{
L1SyncBasicPortDS_t
*
basic
=
L1E_DSPOR_BS
(
ppi
);
/* State initialization */
...
...
@@ -365,7 +368,8 @@ static int l1e_handle_state_config_match(struct pp_instance *ppi, Boolean new_st
}
/* UP state */
static
int
l1e_handle_state_up
(
struct
pp_instance
*
ppi
,
Boolean
new_state
){
static
int
l1e_handle_state_up
(
struct
pp_instance
*
ppi
,
Boolean
new_state
)
{
l1e_ext_portDS_t
*
l1e_portDS
=
L1E_DSPOR
(
ppi
);
Enumeration8
next_state
=
0
;
...
...
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