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
30
Issues
30
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
Software for White Rabbit PTP Core
Commits
358edecc
Commit
358edecc
authored
Nov 02, 2011
by
Tomasz Wlostowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev/endpoint.c: adapted for the new (wishbonized) endpoint
parent
ed4457e3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
12 deletions
+24
-12
endpoint.c
dev/endpoint.c
+24
-12
No files found.
dev/endpoint.c
View file @
358edecc
#include <stdio.h>
#include "board.h"
#include<endpoint.h>
#include
<endpoint.h>
#include <hw/endpoint_regs.h>
#include <hw/endpoint_mdio.h>
#define UIS_PER_SERIAL_BIT 800
#define DMTD_AVG_SAMPLES 256
static
int
autoneg_enabled
;
...
...
@@ -17,8 +18,8 @@ static volatile struct EP_WB *EP = (volatile struct EP_WB *) BASE_EP;
static
uint16_t
pcs_read
(
int
location
)
{
EP
->
MDIO_CR
=
EP_MDIO_CR_ADDR_W
(
location
>>
2
);
while
((
EP
->
MDIO_
SR
&
EP_MDIO_
SR_READY
)
==
0
);
return
EP_MDIO_
SR_RDATA_R
(
EP
->
MDIO_
SR
)
&
0xffff
;
while
((
EP
->
MDIO_
ASR
&
EP_MDIO_A
SR_READY
)
==
0
);
return
EP_MDIO_
ASR_RDATA_R
(
EP
->
MDIO_A
SR
)
&
0xffff
;
}
static
void
pcs_write
(
int
location
,
...
...
@@ -28,7 +29,7 @@ static void pcs_write(int location,
|
EP_MDIO_CR_DATA_W
(
value
)
|
EP_MDIO_CR_RW
;
while
((
EP
->
MDIO_
SR
&
EP_MDIO_
SR_READY
)
==
0
);
while
((
EP
->
MDIO_
ASR
&
EP_MDIO_A
SR_READY
)
==
0
);
}
static
void
set_mac_addr
(
uint8_t
dev_addr
[])
...
...
@@ -58,11 +59,16 @@ void ep_init(uint8_t mac_addr[])
int
i
;
set_mac_addr
(
mac_addr
);
*
(
unsigned
int
*
)(
0x62000
)
=
0x2
;
// reset network stuff (cleanup!)
*
(
unsigned
int
*
)(
0x62000
)
=
0
;
EP
->
ECR
=
0
;
EP
->
DMCR
=
EP_DMCR_EN
|
EP_DMCR_N_AVG_W
(
DMTD_AVG_SAMPLES
);
EP
->
RFCR
=
3
<<
EP_RFCR_QMODE_SHIFT
;
EP
->
VCR0
=
EP_VCR0_QMODE_W
(
3
);
// disable VLAN unit
EP
->
RFCR
=
EP_RFCR_MRU_W
(
1518
)
;
EP
->
TSCR
=
EP_TSCR_EN_TXTS
|
EP_TSCR_EN_RXTS
;
EP
->
FCR
=
0
;
EP
->
DMCR
=
EP_DMCR_EN
|
EP_DMCR_N_AVG_W
(
DMTD_AVG_SAMPLES
);
}
...
...
@@ -76,7 +82,9 @@ int ep_enable(int enabled, int autoneg)
return
;
}
EP
->
ECR
=
EP_ECR_TX_EN_FRA
|
EP_ECR_RX_EN_FRA
|
EP_ECR_RST_CNT
;
EP
->
ECR
=
0
;
pfilter_init_default
();
EP
->
ECR
=
EP_ECR_TX_EN
|
EP_ECR_RX_EN
|
EP_ECR_RST_CNT
;
autoneg_enabled
=
autoneg
;
#if 1
...
...
@@ -96,7 +104,7 @@ int ep_enable(int enabled, int autoneg)
pcs_write
(
MDIO_REG_MCR
,
mcr
);
}
int
ep_link_up
()
int
ep_link_up
(
uint16_t
*
lpa
)
{
uint16_t
flags
=
MDIO_MSR_LSTATUS
;
volatile
uint16_t
msr
;
...
...
@@ -108,6 +116,8 @@ int ep_link_up()
msr
=
pcs_read
(
MDIO_REG_MSR
);
msr
=
pcs_read
(
MDIO_REG_MSR
);
if
(
lpa
)
*
lpa
=
pcs_read
(
MDIO_REG_LPA
);
return
(
msr
&
flags
)
==
flags
?
1
:
0
;
}
...
...
@@ -129,6 +139,7 @@ void ep_show_counters()
int
ep_get_psval
(
int32_t
*
psval
)
{
uint32_t
val
;
val
=
EP
->
DMSR
;
if
(
val
&
EP_DMSR_PS_RDY
)
...
...
@@ -136,7 +147,8 @@ int ep_get_psval(int32_t *psval)
else
*
psval
=
0
;
return
val
&
EP_DMSR_PS_RDY
;
mprintf
(
"PSVAL:%d RDY:%d
\n
"
,
*
psval
,
val
&
EP_DMSR_PS_RDY
?
1
:
0
);
return
val
&
EP_DMSR_PS_RDY
?
1
:
0
;
}
int
ep_cal_pattern_enable
()
...
...
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