Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
86
Issues
86
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
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
White Rabbit Switch - Software
Commits
5eefc005
Commit
5eefc005
authored
Sep 21, 2014
by
Maciej Lipinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added comments
parent
9b2d9103
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
ppsi
userspace/ppsi
+1
-1
hal_ports.c
userspace/wrsw_hal/hal_ports.c
+10
-5
No files found.
ppsi
@
bda685cb
Subproject commit
6958c7129b29c33456538ee5f1651bbef71592bb
Subproject commit
bda685cb87f752a865c7690b382021e6c486ea3f
userspace/wrsw_hal/hal_ports.c
View file @
5eefc005
...
@@ -126,6 +126,9 @@ int any_port_locked()
...
@@ -126,6 +126,9 @@ int any_port_locked()
return
rts_state
.
current_ref
;
return
rts_state
.
current_ref
;
}
}
/*
* return id of the backup channel, if available
*/
int
backup_port
()
int
backup_port
()
{
{
if
(
!
rts_state_valid
)
return
-
1
;
if
(
!
rts_state_valid
)
return
-
1
;
...
@@ -380,24 +383,26 @@ uint32_t pcs_readl(hal_port_state_t *p, int reg)
...
@@ -380,24 +383,26 @@ uint32_t pcs_readl(hal_port_state_t *p, int reg)
static
int
handle_link_down
(
hal_port_state_t
*
p
,
int
link_up
)
static
int
handle_link_down
(
hal_port_state_t
*
p
,
int
link_up
)
{
{
/* If, at any moment, the link goes down, reset the FSM and the port state structure. */
/* If, at any moment, the link goes down, reset the FSM and the port state structure unless
- it is a backup port, in this case don't touch the sPLL
- it has a backup port, in this case switch the timing to backup */
if
(
!
link_up
&&
p
->
state
!=
HAL_PORT_STATE_LINK_DOWN
&&
p
->
state
!=
HAL_PORT_STATE_DISABLED
)
if
(
!
link_up
&&
p
->
state
!=
HAL_PORT_STATE_LINK_DOWN
&&
p
->
state
!=
HAL_PORT_STATE_DISABLED
)
{
{
if
(
p
->
locked
)
if
(
p
->
locked
)
{
{
if
(
hal_get_timing_mode
()
!=
HAL_TIMING_MODE_GRAND_MASTER
)
if
(
hal_get_timing_mode
()
!=
HAL_TIMING_MODE_GRAND_MASTER
)
if
(
backup_port
()
==
REF_NONE
)
if
(
backup_port
()
==
REF_NONE
)
// not a backup & no backup for it
{
{
rts_set_mode
(
RTS_MODE_GM_FREERUNNING
);
rts_set_mode
(
RTS_MODE_GM_FREERUNNING
);
TRACE
(
TRACE_INFO
,
"switching RTS to use local reference"
);
TRACE
(
TRACE_INFO
,
"switching RTS to use local reference"
);
}
}
else
if
(
backup_port
()
==
p
->
hw_index
)
else
if
(
backup_port
()
==
p
->
hw_index
)
// it is backup port
{
{
rts_backup_channel
(
p
->
hw_index
,
RTS_BACKUP_CH_DOWN
);
rts_backup_channel
(
p
->
hw_index
,
RTS_BACKUP_CH_DOWN
);
TRACE
(
TRACE_INFO
,
"switching off backup reference"
);
TRACE
(
TRACE_INFO
,
"switching off backup reference"
);
}
}
else
else
//it has a backup port
{
{
rts_backup_channel
(
p
->
hw_index
,
RTS_BACKUP_CH_ACTIVATE
);
rts_backup_channel
(
p
->
hw_index
,
RTS_BACKUP_CH_ACTIVATE
);
TRACE
(
TRACE_INFO
,
"switching to backup reference"
);
TRACE
(
TRACE_INFO
,
"switching to backup reference"
);
...
@@ -618,7 +623,7 @@ int hal_port_start_lock(const char *port_name, int priority)
...
@@ -618,7 +623,7 @@ int hal_port_start_lock(const char *port_name, int priority)
TRACE
(
TRACE_INFO
,
"Locking to port: %s"
,
port_name
);
TRACE
(
TRACE_INFO
,
"Locking to port: %s"
,
port_name
);
if
(
priority
==
0
)
if
(
priority
==
0
)
// only primary slave port needs that, don't do for backups
rts_set_mode
(
RTS_MODE_BC
);
rts_set_mode
(
RTS_MODE_BC
);
return
rts_lock_channel
(
p
->
hw_index
,
priority
)
<
0
?
PORT_ERROR
:
PORT_OK
;
return
rts_lock_channel
(
p
->
hw_index
,
priority
)
<
0
?
PORT_ERROR
:
PORT_OK
;
...
...
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