Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
wrpc-sw
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
hdl-core-lib
wr-cores
wrpc-sw
Commits
0e8b222a
Commit
0e8b222a
authored
9 years ago
by
Grzegorz Daniluk
Browse files
Options
Downloads
Patches
Plain Diff
adding shell command to disable the SFP transmitting laser
parent
0376b6f1
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
dev/endpoint.c
+14
-0
14 additions, 0 deletions
dev/endpoint.c
include/endpoint.h
+1
-0
1 addition, 0 deletions
include/endpoint.h
include/hw/endpoint_mdio.h
+26
-1
26 additions, 1 deletion
include/hw/endpoint_mdio.h
shell/cmd_sfp.c
+6
-0
6 additions, 0 deletions
shell/cmd_sfp.c
with
47 additions
and
1 deletion
dev/endpoint.c
+
14
−
0
View file @
0e8b222a
...
...
@@ -74,6 +74,7 @@ void ep_init(uint8_t mac_addr[])
{
EP
=
(
volatile
struct
EP_WB
*
)
BASE_EP
;
set_mac_addr
(
mac_addr
);
ep_sfp_enable
(
1
);
*
(
unsigned
int
*
)(
0x62000
)
=
0x2
;
// reset network stuff (cleanup required!)
*
(
unsigned
int
*
)(
0x62000
)
=
0
;
...
...
@@ -193,3 +194,16 @@ int ep_timestamper_cal_pulse()
timer_delay_ms
(
1
);
return
EP
->
TSCR
&
EP_TSCR_RX_CAL_RESULT
?
1
:
0
;
}
int
ep_sfp_enable
(
int
ena
)
{
uint32_t
val
;
val
=
pcs_read
(
MDIO_REG_ECTRL
);
if
(
ena
)
val
&=
(
~
MDIO_ECTRL_SFP_TX_DISABLE
);
else
val
|=
MDIO_ECTRL_SFP_TX_DISABLE
;
pcs_write
(
MDIO_REG_ECTRL
,
val
);
return
0
;
}
This diff is collapsed.
Click to expand it.
include/endpoint.h
+
1
−
0
View file @
0e8b222a
...
...
@@ -28,6 +28,7 @@ int ep_get_psval(int32_t * psval);
int
ep_cal_pattern_enable
(
void
);
int
ep_cal_pattern_disable
(
void
);
int
ep_timestamper_cal_pulse
(
void
);
int
ep_sfp_enable
(
int
ena
);
void
pfilter_init_default
(
void
);
...
...
This diff is collapsed.
Click to expand it.
include/hw/endpoint_mdio.h
+
26
−
1
View file @
0e8b222a
...
...
@@ -3,7 +3,7 @@
* File : endpoint_mdio.h
* Author : auto-generated by wbgen2 from pcs_regs.wb
* Created : T
ue Jan 14
10:2
4:03
201
4
* Created : T
hu Aug 6
10:2
7:26
201
5
* Standard : ANSI C
THIS FILE WAS GENERATED BY wbgen2 FROM SOURCE FILE pcs_regs.wb
...
...
@@ -366,6 +366,29 @@
#define MDIO_WR_SPEC_BSLIDE_SHIFT 4
#define MDIO_WR_SPEC_BSLIDE_W(value) WBGEN2_GEN_WRITE(value, 4, 5)
#define MDIO_WR_SPEC_BSLIDE_R(reg) WBGEN2_GEN_READ(reg, 4, 5)
/* definitions for register: MDIO Extended Control Register */
/* definitions for field: Loopback - detailed in reg: MDIO Extended Control Register */
#define MDIO_ECTRL_LPBCK_VEC_MASK WBGEN2_GEN_MASK(0, 3)
#define MDIO_ECTRL_LPBCK_VEC_SHIFT 0
#define MDIO_ECTRL_LPBCK_VEC_W(value) WBGEN2_GEN_WRITE(value, 0, 3)
#define MDIO_ECTRL_LPBCK_VEC_R(reg) WBGEN2_GEN_READ(reg, 0, 3)
/* definitions for field: SFP TX Fault Status in reg: MDIO Extended Control Register */
#define MDIO_ECTRL_SFP_TX_FAULT WBGEN2_GEN_MASK(3, 1)
/* definitions for field: SFP LOS in reg: MDIO Extended Control Register */
#define MDIO_ECTRL_SFP_LOSS WBGEN2_GEN_MASK(4, 1)
/* definitions for field: SFP TX Disable in reg: MDIO Extended Control Register */
#define MDIO_ECTRL_SFP_TX_DISABLE WBGEN2_GEN_MASK(5, 1)
/* definitions for field: tx_prbs_sel in reg: MDIO Extended Control Register */
#define MDIO_ECTRL_TX_PRBS_SEL_MASK WBGEN2_GEN_MASK(8, 3)
#define MDIO_ECTRL_TX_PRBS_SEL_SHIFT 8
#define MDIO_ECTRL_TX_PRBS_SEL_W(value) WBGEN2_GEN_WRITE(value, 8, 3)
#define MDIO_ECTRL_TX_PRBS_SEL_R(reg) WBGEN2_GEN_READ(reg, 8, 3)
/* [0x0]: REG MDIO Control Register */
#define MDIO_REG_MCR 0x00000000
/* [0x4]: REG MDIO Status Register */
...
...
@@ -384,4 +407,6 @@
#define MDIO_REG_ESTATUS 0x0000003c
/* [0x40]: REG WhiteRabbit-specific Configuration Register */
#define MDIO_REG_WR_SPEC 0x00000040
/* [0x44]: REG MDIO Extended Control Register */
#define MDIO_REG_ECTRL 0x00000044
#endif
This diff is collapsed.
Click to expand it.
shell/cmd_sfp.c
+
6
−
0
View file @
0e8b222a
...
...
@@ -22,11 +22,13 @@
#include
<string.h>
#include
<stdlib.h>
#include
<errno.h>
#include
<wrc.h>
#include
"shell.h"
#include
"storage.h"
#include
"syscon.h"
#include
"endpoint.h"
#include
"sfp.h"
...
...
@@ -107,6 +109,10 @@ static int cmd_sfp(const char *args[])
}
else
mprintf
(
"Could not match to DB
\n
"
);
return
0
;
}
else
if
(
args
[
0
]
&&
!
strcasecmp
(
args
[
0
],
"ena"
))
{
if
(
!
args
[
1
])
return
-
EINVAL
;
ep_sfp_enable
(
atoi
(
args
[
1
]));
}
return
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment