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
7
Merge Requests
7
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
0e8b222a
Commit
0e8b222a
authored
Aug 06, 2015
by
Grzegorz Daniluk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding shell command to disable the SFP transmitting laser
parent
0376b6f1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
1 deletion
+47
-1
endpoint.c
dev/endpoint.c
+14
-0
endpoint.h
include/endpoint.h
+1
-0
endpoint_mdio.h
include/hw/endpoint_mdio.h
+26
-1
cmd_sfp.c
shell/cmd_sfp.c
+6
-0
No files found.
dev/endpoint.c
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
;
}
include/endpoint.h
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
);
...
...
include/hw/endpoint_mdio.h
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:24:03 2014
* Created : T
hu Aug 6 10:27:26 2015
* 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
shell/cmd_sfp.c
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
;
...
...
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