Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
32
Issues
32
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
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
Software for White Rabbit PTP Core
Commits
3bec63dd
Commit
3bec63dd
authored
Oct 01, 2018
by
li hongming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add CONFIG parameters CONFIG_DUALPORT
parent
d6a1db54
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
95 additions
and
70 deletions
+95
-70
.config
.config
+1
-0
Kconfig
Kconfig
+9
-0
Makefile
Makefile
+1
-0
devel_build_test_defconfig
configs/devel_build_test_defconfig
+1
-0
gsi_defconfig
configs/gsi_defconfig
+1
-0
gsi_pdelay_defconfig
configs/gsi_pdelay_defconfig
+1
-0
spec_defconfig
configs/spec_defconfig
+1
-0
spec_pdelay_defconfig
configs/spec_pdelay_defconfig
+1
-0
wrnic_defconfig
configs/wrnic_defconfig
+1
-0
wrpc_sim_defconfig
configs/wrpc_sim_defconfig
+1
-0
devicelist.c
dev/devicelist.c
+5
-4
endpoint.c
dev/endpoint.c
+0
-2
minic.h
include/minic.h
+1
-1
ptpd_netif.h
include/ptpd_netif.h
+1
-1
storage.h
include/storage.h
+1
-1
wrc.h
include/wrc.h
+5
-1
ipv4.c
lib/ipv4.c
+9
-8
net.c
lib/net.c
+5
-1
ppsi
ppsi
+1
-1
cmd_ptp.c
shell/cmd_ptp.c
+10
-0
wrc_main.c
wrc_main.c
+37
-48
wrc_main_sim.c
wrc_main_sim.c
+2
-2
No files found.
.config
View file @
3bec63dd
...
@@ -44,6 +44,7 @@ CONFIG_GENSDBFS=y
...
@@ -44,6 +44,7 @@ CONFIG_GENSDBFS=y
# CONFIG_WR_DIAG is not set
# CONFIG_WR_DIAG is not set
# CONFIG_WR_NODE_SIM is not set
# CONFIG_WR_NODE_SIM is not set
# CONFIG_ABSCAL is not set
# CONFIG_ABSCAL is not set
CONFIG_DUALPORT
=
y
# CONFIG_LLDP is not set
# CONFIG_LLDP is not set
#
#
...
...
Kconfig
View file @
3bec63dd
...
@@ -297,6 +297,15 @@ config ABSCAL
...
@@ -297,6 +297,15 @@ config ABSCAL
using a loop-back SFP adapter, according to the procedure
using a loop-back SFP adapter, according to the procedure
described and documented by Peter Jansweijer.
described and documented by Peter Jansweijer.
config DUALPORT
depends on WR_NODE
default y
boolean "Support dualport function"
help
If you select this, the node could support second WR port and a
cascaded WR link could be built. In future, the second WR port
could act as back up port.
config LLDP
config LLDP
depends on WR_NODE
depends on WR_NODE
boolean "Include LLDP protocol transmit-only"
boolean "Include LLDP protocol transmit-only"
...
...
Makefile
View file @
3bec63dd
...
@@ -9,6 +9,7 @@ endif
...
@@ -9,6 +9,7 @@ endif
export
CROSS_COMPILE
export
CROSS_COMPILE
export
CONFIG_ABSCAL
export
CONFIG_ABSCAL
export
CONFIG_DUALPORT
CC
=
$(CROSS_COMPILE)
gcc
CC
=
$(CROSS_COMPILE)
gcc
LD
=
$(CROSS_COMPILE)
ld
LD
=
$(CROSS_COMPILE)
ld
...
...
configs/devel_build_test_defconfig
View file @
3bec63dd
...
@@ -46,6 +46,7 @@ CONFIG_GENSDBFS=y
...
@@ -46,6 +46,7 @@ CONFIG_GENSDBFS=y
# CONFIG_WR_DIAG is not set
# CONFIG_WR_DIAG is not set
# CONFIG_WR_NODE_SIM is not set
# CONFIG_WR_NODE_SIM is not set
CONFIG_ABSCAL=y
CONFIG_ABSCAL=y
CONFIG_DUALPORT=y
#
#
# wrpc-sw is tainted if you change the following options
# wrpc-sw is tainted if you change the following options
...
...
configs/gsi_defconfig
View file @
3bec63dd
...
@@ -45,6 +45,7 @@ CONFIG_GENSDBFS=y
...
@@ -45,6 +45,7 @@ CONFIG_GENSDBFS=y
# CONFIG_WR_DIAG is not set
# CONFIG_WR_DIAG is not set
# CONFIG_WR_NODE_SIM is not set
# CONFIG_WR_NODE_SIM is not set
CONFIG_ABSCAL=y
CONFIG_ABSCAL=y
CONFIG_DUALPORT=y
#
#
# wrpc-sw is tainted if you change the following options
# wrpc-sw is tainted if you change the following options
...
...
configs/gsi_pdelay_defconfig
View file @
3bec63dd
...
@@ -45,6 +45,7 @@ CONFIG_GENSDBFS=y
...
@@ -45,6 +45,7 @@ CONFIG_GENSDBFS=y
# CONFIG_WR_DIAG is not set
# CONFIG_WR_DIAG is not set
# CONFIG_WR_NODE_SIM is not set
# CONFIG_WR_NODE_SIM is not set
CONFIG_ABSCAL=y
CONFIG_ABSCAL=y
CONFIG_DUALPORT=y
#
#
# wrpc-sw is tainted if you change the following options
# wrpc-sw is tainted if you change the following options
...
...
configs/spec_defconfig
View file @
3bec63dd
...
@@ -42,6 +42,7 @@ CONFIG_GENSDBFS=y
...
@@ -42,6 +42,7 @@ CONFIG_GENSDBFS=y
CONFIG_WR_DIAG=y
CONFIG_WR_DIAG=y
# CONFIG_WR_NODE_SIM is not set
# CONFIG_WR_NODE_SIM is not set
CONFIG_ABSCAL=y
CONFIG_ABSCAL=y
CONFIG_DUALPORT=y
CONFIG_LLDP=y
CONFIG_LLDP=y
#
#
...
...
configs/spec_pdelay_defconfig
View file @
3bec63dd
...
@@ -42,6 +42,7 @@ CONFIG_GENSDBFS=y
...
@@ -42,6 +42,7 @@ CONFIG_GENSDBFS=y
CONFIG_WR_DIAG=y
CONFIG_WR_DIAG=y
# CONFIG_WR_NODE_SIM is not set
# CONFIG_WR_NODE_SIM is not set
CONFIG_ABSCAL=y
CONFIG_ABSCAL=y
CONFIG_DUALPORT=y
CONFIG_LLDP=y
CONFIG_LLDP=y
#
#
...
...
configs/wrnic_defconfig
View file @
3bec63dd
...
@@ -41,6 +41,7 @@ CONFIG_GENSDBFS=y
...
@@ -41,6 +41,7 @@ CONFIG_GENSDBFS=y
# CONFIG_WR_DIAG is not set
# CONFIG_WR_DIAG is not set
# CONFIG_WR_NODE_SIM is not set
# CONFIG_WR_NODE_SIM is not set
CONFIG_ABSCAL=y
CONFIG_ABSCAL=y
CONFIG_DUALPORT=y
#
#
# wrpc-sw is tainted if you change the following options
# wrpc-sw is tainted if you change the following options
...
...
configs/wrpc_sim_defconfig
View file @
3bec63dd
...
@@ -41,6 +41,7 @@ CONFIG_GENSDBFS=y
...
@@ -41,6 +41,7 @@ CONFIG_GENSDBFS=y
# CONFIG_WR_DIAG is not set
# CONFIG_WR_DIAG is not set
CONFIG_WR_NODE_SIM=y
CONFIG_WR_NODE_SIM=y
CONFIG_ABSCAL=y
CONFIG_ABSCAL=y
CONFIG_DUALPORT=y
#
#
# wrpc-sw is tainted if you change the following options
# wrpc-sw is tainted if you change the following options
...
...
dev/devicelist.c
View file @
3bec63dd
...
@@ -6,13 +6,12 @@
...
@@ -6,13 +6,12 @@
*
*
* Released according to the GNU GPL, version 2 or any later version.
* Released according to the GNU GPL, version 2 or any later version.
*/
*/
#include <wrc.h>
#define SDBFS_BIG_ENDIAN
#define SDBFS_BIG_ENDIAN
#include <libsdbfs.h>
#include <libsdbfs.h>
/* The following pointers are exported */
/* The following pointers are exported */
unsigned
char
*
BASE_MINIC
[
wr_num_ports
];
unsigned
char
*
BASE_MINIC
[
2
];
unsigned
char
*
BASE_EP
[
wr_num_ports
];
unsigned
char
*
BASE_EP
[
2
];
unsigned
char
*
BASE_SOFTPLL
;
unsigned
char
*
BASE_SOFTPLL
;
unsigned
char
*
BASE_PPS_GEN
;
unsigned
char
*
BASE_PPS_GEN
;
unsigned
char
*
BASE_SYSCON
;
unsigned
char
*
BASE_SYSCON
;
...
@@ -66,9 +65,11 @@ struct wrc_device {
...
@@ -66,9 +65,11 @@ struct wrc_device {
struct
wrc_device
devs
[]
=
{
struct
wrc_device
devs
[]
=
{
{
&
BASE_MINIC
[
0
],
VID_CERN
,
0xab28633a
},
{
&
BASE_MINIC
[
0
],
VID_CERN
,
0xab28633a
},
{
&
BASE_MINIC
[
1
],
VID_CERN
,
0xa224633b
},
{
&
BASE_EP
[
0
],
VID_CERN
,
0x650c2d4f
},
{
&
BASE_EP
[
0
],
VID_CERN
,
0x650c2d4f
},
#ifdef CONFIG_DUALPORT
{
&
BASE_MINIC
[
1
],
VID_CERN
,
0xa224633b
},
{
&
BASE_EP
[
1
],
VID_CERN
,
0x650c2d4e
},
{
&
BASE_EP
[
1
],
VID_CERN
,
0x650c2d4e
},
#endif
{
&
BASE_SOFTPLL
,
VID_CERN
,
0x65158dc0
},
{
&
BASE_SOFTPLL
,
VID_CERN
,
0x65158dc0
},
{
&
BASE_PPS_GEN
,
VID_CERN
,
0xde0d8ced
},
{
&
BASE_PPS_GEN
,
VID_CERN
,
0xde0d8ced
},
{
&
BASE_SYSCON
,
VID_CERN
,
0xff07fc47
},
{
&
BASE_SYSCON
,
VID_CERN
,
0xff07fc47
},
...
...
dev/endpoint.c
View file @
3bec63dd
...
@@ -72,9 +72,7 @@ void get_mac_addr(uint8_t dev_addr[], int port)
...
@@ -72,9 +72,7 @@ void get_mac_addr(uint8_t dev_addr[], int port)
void
ep_init
(
uint8_t
mac_addr
[],
int
port
)
void
ep_init
(
uint8_t
mac_addr
[],
int
port
)
{
{
EP
[
port
]
=
(
volatile
struct
EP_WB
*
)
BASE_EP
[
port
];
EP
[
port
]
=
(
volatile
struct
EP_WB
*
)
BASE_EP
[
port
];
pp_printf
(
"Port %d address is %x"
,
port
,
EP
[
port
]);
set_mac_addr
(
mac_addr
,
port
);
set_mac_addr
(
mac_addr
,
port
);
pp_printf
(
"Port %d address is %x"
,
port
,
EP
[
port
]);
ep_sfp_enable
(
1
,
port
);
ep_sfp_enable
(
1
,
port
);
if
(
!
IS_WR_NODE_SIM
){
if
(
!
IS_WR_NODE_SIM
){
...
...
include/minic.h
View file @
3bec63dd
...
@@ -44,7 +44,7 @@ struct wr_minic {
...
@@ -44,7 +44,7 @@ struct wr_minic {
int
tx_count
,
rx_count
;
int
tx_count
,
rx_count
;
};
};
extern
struct
wr_minic
minic
[
2
];
extern
struct
wr_minic
minic
[
wr_num_ports
];
int
minic_rx_frame
(
struct
wr_ethhdr
*
hdr
,
uint8_t
*
payload
,
uint32_t
buf_size
,
int
minic_rx_frame
(
struct
wr_ethhdr
*
hdr
,
uint8_t
*
payload
,
uint32_t
buf_size
,
struct
hw_timestamp
*
hwts
,
int
port
);
struct
hw_timestamp
*
hwts
,
int
port
);
...
...
include/ptpd_netif.h
View file @
3bec63dd
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
#define PTPD_SOCK_UDP 0
/* wrong name, it should be "WRPC" */
#define PTPD_SOCK_UDP 0
/* wrong name, it should be "WRPC" */
#define PTPD_SOCK_RAW_ETHERNET 1
/* but used in ppsi, which I won't change */
#define PTPD_SOCK_RAW_ETHERNET 1
/* but used in ppsi, which I won't change */
extern
uint8_t
link_status
[
2
];
extern
uint8_t
link_status
[
wr_num_ports
];
#define LINK_DOWN 0
#define LINK_DOWN 0
#define LINK_WENT_UP 1
#define LINK_WENT_UP 1
#define LINK_WENT_DOWN 2
#define LINK_WENT_DOWN 2
...
...
include/storage.h
View file @
3bec63dd
...
@@ -52,7 +52,7 @@
...
@@ -52,7 +52,7 @@
#define HAS_GENSDBFS 0
#define HAS_GENSDBFS 0
#endif
#endif
extern
uint32_t
cal_phase_transition
[
2
];
extern
uint32_t
cal_phase_transition
[
wr_num_ports
];
extern
uint8_t
has_eeprom
;
extern
uint8_t
has_eeprom
;
struct
s_sfpinfo
{
struct
s_sfpinfo
{
...
...
include/wrc.h
View file @
3bec63dd
...
@@ -80,6 +80,10 @@ void rtipc_action(void);
...
@@ -80,6 +80,10 @@ void rtipc_action(void);
extern
uint32_t
__div64_32
(
uint64_t
*
n
,
uint32_t
base
);
extern
uint32_t
__div64_32
(
uint64_t
*
n
,
uint32_t
base
);
// CUTE DP
// CUTE DP
#ifdef CONFIG_DUALPORT
#define wr_num_ports 2
#define wr_num_ports 2
#else
#define wr_num_ports 1
#endif
#endif
/* __WRC_H__ */
#endif
/* __WRC_H__ */
lib/ipv4.c
View file @
3bec63dd
...
@@ -85,12 +85,13 @@ unsigned int ipv4_checksum(unsigned short *buf, int shorts)
...
@@ -85,12 +85,13 @@ unsigned int ipv4_checksum(unsigned short *buf, int shorts)
static
void
ipv4_init
(
void
)
static
void
ipv4_init
(
void
)
{
{
struct
wr_sockaddr
saddr
;
struct
wr_sockaddr
saddr
;
int
port
;
/* Bootp: use UDP engine activated by function arguments */
/* Bootp: use UDP engine activated by function arguments */
bootp_socket
[
0
]
=
ptpd_netif_create_socket
(
&
__static_bootp_socket
[
0
],
NULL
,
for
(
port
=
0
;
port
<
wr_num_ports
;
++
port
)
{
PTPD_SOCK_UDP
,
68
/* bootpc */
,
0
);
bootp_socket
[
port
]
=
ptpd_netif_create_socket
(
&
__static_bootp_socket
[
0
],
NULL
,
bootp_socket
[
1
]
=
ptpd_netif_create_socket
(
&
__static_bootp_socket
[
1
],
NULL
,
PTPD_SOCK_UDP
,
68
/* bootpc */
,
port
);
PTPD_SOCK_UDP
,
68
/* bootpc */
,
1
);
}
/* time (rdate): UDP */
/* time (rdate): UDP */
rdate_socket
=
ptpd_netif_create_socket
(
&
__static_rdate_socket
,
NULL
,
rdate_socket
=
ptpd_netif_create_socket
(
&
__static_rdate_socket
,
NULL
,
...
@@ -103,10 +104,10 @@ static void ipv4_init(void)
...
@@ -103,10 +104,10 @@ static void ipv4_init(void)
/* ICMP: specify raw (not UDP), with IPV4 ethtype */
/* ICMP: specify raw (not UDP), with IPV4 ethtype */
memset
(
&
saddr
,
0
,
sizeof
(
saddr
));
memset
(
&
saddr
,
0
,
sizeof
(
saddr
));
saddr
.
ethertype
=
htons
(
0x0800
);
saddr
.
ethertype
=
htons
(
0x0800
);
icmp_socket
[
0
]
=
ptpd_netif_create_socket
(
&
__static_icmp_socket
[
0
],
&
saddr
,
for
(
port
=
0
;
port
<
wr_num_ports
;
++
port
)
{
PTPD_SOCK_RAW_ETHERNET
,
0
,
0
);
icmp_socket
[
port
]
=
ptpd_netif_create_socket
(
&
__static_icmp_socket
[
0
],
&
saddr
,
icmp_socket
[
1
]
=
ptpd_netif_create_socket
(
&
__static_icmp_socket
[
1
],
&
saddr
,
PTPD_SOCK_RAW_ETHERNET
,
0
,
port
);
PTPD_SOCK_RAW_ETHERNET
,
0
,
1
);
}
syslog_init
();
syslog_init
();
}
}
...
...
lib/net.c
View file @
3bec63dd
...
@@ -66,7 +66,11 @@ struct wrpc_socket *ptpd_netif_create_socket(struct wrpc_socket *sock,
...
@@ -66,7 +66,11 @@ struct wrpc_socket *ptpd_netif_create_socket(struct wrpc_socket *sock,
sock
,
ntohs
(
bind_addr
->
ethertype
),
sock
,
ntohs
(
bind_addr
->
ethertype
),
udpport
,
i
);
udpport
,
i
);
port_name
=
(
port
)
?
"wr0"
:
"wr1"
;
switch
(
port
){
case
0
:
port_name
=
"wr0"
;
break
;
case
1
:
port_name
=
"wr1"
;
break
;
default:
port_name
=
"wr0"
;
};
if
(
wrpc_get_port_state
(
&
pstate
,
port_name
)
<
0
)
if
(
wrpc_get_port_state
(
&
pstate
,
port_name
)
<
0
)
return
NULL
;
return
NULL
;
...
...
ppsi
@
f13b2ae9
Subproject commit
61d931c09fc567f374621bc624f29ba2cd78c543
Subproject commit
f13b2ae9628ca46cd20efc8bbf42657baeee511a
shell/cmd_ptp.c
View file @
3bec63dd
...
@@ -17,6 +17,10 @@ struct subcmd {
...
@@ -17,6 +17,10 @@ struct subcmd {
}
subcmd
[]
=
{
}
subcmd
[]
=
{
{
"start"
,
wrc_ptp_run
,
1
},
{
"start"
,
wrc_ptp_run
,
1
},
{
"stop"
,
wrc_ptp_run
,
0
},
{
"stop"
,
wrc_ptp_run
,
0
},
#ifdef CONFIG_DUALPORT
{
"start1"
,
wrc_ptp_run
,
3
},
{
"stop1"
,
wrc_ptp_run
,
2
},
#endif
{
"e2e"
,
wrc_ptp_sync_mech
,
PP_E2E_MECH
},
{
"e2e"
,
wrc_ptp_sync_mech
,
PP_E2E_MECH
},
{
"delay"
,
wrc_ptp_sync_mech
,
PP_E2E_MECH
},
{
"delay"
,
wrc_ptp_sync_mech
,
PP_E2E_MECH
},
#ifdef CONFIG_P2P
#ifdef CONFIG_P2P
...
@@ -31,7 +35,13 @@ struct subcmd {
...
@@ -31,7 +35,13 @@ struct subcmd {
#endif
#endif
};
};
#ifdef CONFIG_DUALPORT
static
char
*
is_run
[]
=
{
"Port 0&1 stopped"
,
"Port 0 running, Port 1 stopped"
,
"Port 0 stopped, Port 1 running"
,
"Port 0&1 running"
};
#else
static
char
*
is_run
[]
=
{
"stopped"
,
"running"
};
static
char
*
is_run
[]
=
{
"stopped"
,
"running"
};
#endif
static
char
*
is_mech
[]
=
{[
PP_E2E_MECH
]
=
"e2e"
,
[
PP_P2P_MECH
]
=
"p2p"
};
static
char
*
is_mech
[]
=
{[
PP_E2E_MECH
]
=
"e2e"
,
[
PP_P2P_MECH
]
=
"p2p"
};
static
char
*
is_mode
[]
=
{[
WRC_MODE_GM
]
=
"gm"
,
[
WRC_MODE_MASTER
]
=
"master"
,
static
char
*
is_mode
[]
=
{[
WRC_MODE_GM
]
=
"gm"
,
[
WRC_MODE_MASTER
]
=
"master"
,
[
WRC_MODE_SLAVE
]
=
"slave"
[
WRC_MODE_SLAVE
]
=
"slave"
...
...
wrc_main.c
View file @
3bec63dd
...
@@ -99,18 +99,15 @@ static void wrc_initialize(void)
...
@@ -99,18 +99,15 @@ static void wrc_initialize(void)
mac_addr
[
1
][
5
]
=
mac_addr
[
0
][
5
];
mac_addr
[
1
][
5
]
=
mac_addr
[
0
][
5
];
}
}
pp_printf
(
"PORT 0 Local MAC address: %02x:%02x:%02x:%02x:%02x:%02x
\n
"
,
mac_addr
[
0
][
0
],
mac_addr
[
0
][
1
],
mac_addr
[
0
][
2
],
mac_addr
[
0
][
3
],
mac_addr
[
0
][
4
],
mac_addr
[
0
][
5
]);
pp_printf
(
"PORT 1 Local MAC address: %02x:%02x:%02x:%02x:%02x:%02x
\n
"
,
mac_addr
[
1
][
0
],
mac_addr
[
1
][
1
],
mac_addr
[
1
][
2
],
mac_addr
[
1
][
3
],
mac_addr
[
1
][
4
],
mac_addr
[
1
][
5
]);
net_rst
();
net_rst
();
//Duplicate the configuration for both ports.
//Duplicate the configuration for both ports.
for
(
port
=
0
;
port
<
wr_num_ports
;
port
++
)
for
(
port
=
0
;
port
<
wr_num_ports
;
port
++
)
{
{
pp_printf
(
"PORT %d Local MAC address: %02x:%02x:%02x:%02x:%02x:%02x
\n
"
,
port
,
mac_addr
[
port
][
0
],
mac_addr
[
port
][
1
],
mac_addr
[
port
][
2
],
mac_addr
[
port
][
3
],
mac_addr
[
port
][
4
],
mac_addr
[
port
][
5
]);
ep_init
(
mac_addr
[
port
],
port
);
ep_init
(
mac_addr
[
port
],
port
);
/* Sleep for 1s to make sure WRS v4.2 always realizes that
/* Sleep for 1s to make sure WRS v4.2 always realizes that
* the link is down */
* the link is down */
...
@@ -133,8 +130,9 @@ static void wrc_initialize(void)
...
@@ -133,8 +130,9 @@ static void wrc_initialize(void)
_endram
=
ENDRAM_MAGIC
;
_endram
=
ENDRAM_MAGIC
;
wrc_ptp_set_mode
(
WRC_MODE_SLAVE
);
wrc_ptp_set_mode
(
WRC_MODE_SLAVE
);
wrc_ptp_start
(
0
);
for
(
port
=
0
;
port
<
wr_num_ports
;
port
++
)
{
wrc_ptp_start
(
1
);
wrc_ptp_start
(
port
);
}
shw_pps_gen_get_time
(
NULL
,
&
prev_nanos_for_profile
);
shw_pps_gen_get_time
(
NULL
,
&
prev_nanos_for_profile
);
/* get tics */
/* get tics */
prev_ticks_for_profile
=
timer_get_tics
();
prev_ticks_for_profile
=
timer_get_tics
();
...
@@ -149,50 +147,41 @@ uint8_t link_status[wr_num_ports];
...
@@ -149,50 +147,41 @@ uint8_t link_status[wr_num_ports];
static
int
wrc_check_link
(
void
)
static
int
wrc_check_link
(
void
)
{
{
static
int
prev_state
[
wr_num_ports
]
=
{
-
1
,
-
1
};
static
int
prev_state
[]
=
{
-
1
,
-
1
};
int
state
[
wr_num_ports
];
int
state
[
wr_num_ports
];
int
rv
=
0
;
int
rv
=
0
;
int
port
;
int
port
;
for
(
port
=
0
;
port
<
wr_num_ports
;
port
++
)
for
(
port
=
0
;
port
<
wr_num_ports
;
port
++
)
{
state
[
port
]
=
ep_link_up
(
NULL
,
port
);
state
[
port
]
=
ep_link_up
(
NULL
,
port
);
if
(
!
prev_state
[
0
]
&&
state
[
0
])
{
if
(
!
prev_state
[
port
]
&&
state
[
port
])
{
wrc_verbose
(
"Port 0 Link up.
\n
"
);
wrc_verbose
(
"Port 0 Link up.
\n
"
);
if
(
port
==
0
)
gpio_out
(
GPIO_LED_LINK
,
1
);
gpio_out
(
GPIO_LED_LINK
,
1
);
sfp_match
(
0
);
else
wrc_ptp_start
(
0
);
gpio_out
(
GPIO_DP_LED_LINK
,
1
);
link_status
[
0
]
=
LINK_WENT_UP
;
sfp_match
(
port
);
wrc_ptp_start
(
port
);
link_status
[
port
]
=
LINK_WENT_UP
;
rv
=
1
;
rv
=
1
;
}
else
if
(
prev_state
[
0
]
&&
!
state
[
0
])
{
}
else
if
(
prev_state
[
port
]
&&
!
state
[
port
])
{
wrc_verbose
(
"Port 0 Link down.
\n
"
);
wrc_verbose
(
"Port %d Link down.
\n
"
,
port
);
if
(
port
==
0
)
gpio_out
(
GPIO_LED_LINK
,
0
);
gpio_out
(
GPIO_LED_LINK
,
0
);
link_status
[
0
]
=
LINK_WENT_DOWN
;
else
wrc_ptp_stop
(
0
);
gpio_out
(
GPIO_DP_LED_LINK
,
0
);
link_status
[
port
]
=
LINK_WENT_DOWN
;
wrc_ptp_stop
(
port
);
rv
=
1
;
rv
=
1
;
/* special case */
/* special case */
if
(
port
==
0
)
{
spll_init
(
SPLL_MODE_FREE_RUNNING_MASTER
,
0
,
1
);
spll_init
(
SPLL_MODE_FREE_RUNNING_MASTER
,
0
,
1
);
shw_pps_gen_enable_output
(
0
);
shw_pps_gen_enable_output
(
0
);
}
}
else
}
else
link_status
[
0
]
=
(
state
[
0
]
?
LINK_UP
:
LINK_DOWN
);
link_status
[
port
]
=
(
state
[
port
]
?
LINK_UP
:
LINK_DOWN
);
prev_state
[
0
]
=
state
[
0
];
prev_state
[
port
]
=
state
[
port
];
}
if
(
!
prev_state
[
1
]
&&
state
[
1
])
{
wrc_verbose
(
"Port 1 Link up.
\n
"
);
gpio_out
(
GPIO_DP_LED_LINK
,
1
);
sfp_match
(
1
);
wrc_ptp_start
(
1
);
link_status
[
1
]
=
LINK_WENT_UP
;
rv
=
1
;
}
else
if
(
prev_state
[
1
]
&&
!
state
[
1
])
{
wrc_verbose
(
"Port 1 Link down.
\n
"
);
gpio_out
(
GPIO_DP_LED_LINK
,
1
);
link_status
[
1
]
=
LINK_WENT_DOWN
;
wrc_ptp_stop
(
1
);
rv
=
1
;
}
else
link_status
[
1
]
=
(
state
[
1
]
?
LINK_UP
:
LINK_DOWN
);
prev_state
[
1
]
=
state
[
1
];
return
rv
;
return
rv
;
}
}
...
...
wrc_main_sim.c
View file @
3bec63dd
...
@@ -84,8 +84,8 @@ static void wrc_sim_initialize(void)
...
@@ -84,8 +84,8 @@ static void wrc_sim_initialize(void)
// uncomment the following line to perform a dynamic search
// uncomment the following line to perform a dynamic search
// at runtime.
// at runtime.
//sdb_find_devices();
//sdb_find_devices();
BASE_MINIC
=
(
void
*
)
0x20000
;
BASE_MINIC
[
0
]
=
(
void
*
)
0x20000
;
BASE_EP
=
(
void
*
)
0x20100
;
BASE_EP
[
0
]
=
(
void
*
)
0x20100
;
BASE_SOFTPLL
=
(
void
*
)
0x20200
;
BASE_SOFTPLL
=
(
void
*
)
0x20200
;
BASE_PPS_GEN
=
(
void
*
)
0x20300
;
BASE_PPS_GEN
=
(
void
*
)
0x20300
;
BASE_SYSCON
=
(
void
*
)
0x20400
;
BASE_SYSCON
=
(
void
*
)
0x20400
;
...
...
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