Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
mock-turtle
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
hdl-core-lib
mock-turtle
Commits
748944e5
Commit
748944e5
authored
Jul 25, 2018
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sw:fw:ep: dedicated function to build high low MAC
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
22bf789c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
18 deletions
+21
-18
mockturtle-rt-common.c
software/firmware/lib/mockturtle-rt-common.c
+21
-18
No files found.
software/firmware/lib/mockturtle-rt-common.c
View file @
748944e5
...
...
@@ -72,6 +72,21 @@ void pr_message(struct trtl_fw_msg *msg)
pp_printf
(
"%s: data[%d] = 0x%"
PRIx32
"
\n\r
"
,
__func__
,
i
,
d
[
i
]);
}
static
inline
uint32_t
ep_eth_build_mac_hi
(
struct
trtl_ep_eth_address
*
addr
)
{
return
((
uint32_t
)
addr
->
dst_mac
[
0
]
<<
8
)
|
((
uint32_t
)
addr
->
dst_mac
[
1
]
<<
0
);
}
static
inline
uint32_t
ep_eth_build_mac_lo
(
struct
trtl_ep_eth_address
*
addr
)
{
return
((
uint32_t
)
addr
->
dst_mac
[
2
]
<<
24
)
|
((
uint32_t
)
addr
->
dst_mac
[
3
]
<<
16
)
|
((
uint32_t
)
addr
->
dst_mac
[
4
]
<<
8
)
|
((
uint32_t
)
addr
->
dst_mac
[
5
]
<<
0
);
}
static
inline
void
rmq_ep_out_writel
(
int
slot
,
uint32_t
data
,
uint32_t
addr
)
{
mq_writel
(
TRTL_RMQ
,
data
,
addr
+
TRTL_MQ_SLOT_ENDPOINT_CONFIG_START
+
TRTL_MQ_SLOT_OUT
(
slot
)
);
...
...
@@ -82,10 +97,9 @@ static inline void rmq_ep_in_writel(int slot, uint32_t data, uint32_t addr)
mq_writel
(
TRTL_RMQ
,
data
,
addr
+
TRTL_MQ_SLOT_ENDPOINT_CONFIG_START
+
TRTL_MQ_SLOT_IN
(
slot
)
);
}
static
void
rmq_ep_bind_in
(
int
slot
,
struct
trtl_ep_eth_address
*
addr
)
static
void
rmq_ep_bind_in
(
int
slot
,
struct
trtl_ep_eth_address
*
addr
)
{
uint32_t
cfg
=
0
;
uint32_t
cfg
=
0
,
tmp
;
switch
(
addr
->
type
)
{
...
...
@@ -101,16 +115,10 @@ static void rmq_ep_bind_in(int slot, struct
}
cfg
|=
addr
->
filter
;
uint32_t
tmp
;
rmq_ep_in_writel
(
slot
,
cfg
,
TRTL_EP_IN_CONFIG
);
tmp
=
(
(
uint32_t
)
addr
->
dst_mac
[
0
]
<<
8
)
|
addr
->
dst_mac
[
1
];
tmp
=
ep_eth_build_mac_hi
(
addr
);
rmq_ep_in_writel
(
slot
,
tmp
,
TRTL_EP_IN_DST_MAC_HI
);
tmp
=
(
(
uint32_t
)
addr
->
dst_mac
[
2
]
<<
24
)
|
(
(
uint32_t
)
addr
->
dst_mac
[
3
]
<<
16
)
|
(
(
uint32_t
)
addr
->
dst_mac
[
4
]
<<
8
)
|
(
(
uint32_t
)
addr
->
dst_mac
[
5
]
<<
0
);
tmp
=
ep_eth_build_mac_lo
(
addr
);
rmq_ep_in_writel
(
slot
,
tmp
,
TRTL_EP_IN_DST_MAC_LO
);
rmq_ep_in_writel
(
slot
,
addr
->
ethertype
,
TRTL_EP_IN_ETHERTYPE
);
rmq_ep_in_writel
(
slot
,
addr
->
dst_ip
,
TRTL_EP_IN_DST_IP
);
...
...
@@ -124,14 +132,9 @@ static void rmq_ep_bind_out(int slot,
rmq_ep_out_writel
(
slot
,
addr
->
type
==
TRTL_EP_FRAME_UDP
?
1
:
0
,
TRTL_EP_OUT_CONFIG
);
tmp
=
(
(
uint32_t
)
addr
->
dst_mac
[
0
]
<<
8
)
|
addr
->
dst_mac
[
1
]
;
tmp
=
ep_eth_build_mac_hi
(
addr
)
;
rmq_ep_out_writel
(
slot
,
tmp
,
TRTL_EP_OUT_MAC_HI
);
tmp
=
(
(
uint32_t
)
addr
->
dst_mac
[
2
]
<<
24
)
|
(
(
uint32_t
)
addr
->
dst_mac
[
3
]
<<
16
)
|
(
(
uint32_t
)
addr
->
dst_mac
[
4
]
<<
8
)
|
(
(
uint32_t
)
addr
->
dst_mac
[
5
]
<<
0
);
tmp
=
ep_eth_build_mac_lo
(
addr
);
rmq_ep_out_writel
(
slot
,
tmp
,
TRTL_EP_OUT_MAC_LO
);
rmq_ep_out_writel
(
slot
,
addr
->
ethertype
,
TRTL_EP_OUT_ETHERTYPE
);
rmq_ep_out_writel
(
slot
,
addr
->
src_ip
,
TRTL_EP_OUT_SRC_IP
);
...
...
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