Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit core collection
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
1
Merge Requests
1
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
White Rabbit core collection
Commits
67bda463
Commit
67bda463
authored
Nov 01, 2016
by
Grzegorz Daniluk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minic: add checking HDL i/f version
parent
27cf9155
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
2 deletions
+20
-2
minic.c
dev/minic.c
+20
-2
No files found.
dev/minic.c
View file @
67bda463
...
...
@@ -20,6 +20,8 @@
#include <hw/minic_regs.h>
#define MINIC_HDL_VERSION 1
#define F_COUNTER_BITS 4
#define F_COUNTER_MASK ((1<<F_COUNTER_BITS)-1)
...
...
@@ -37,6 +39,7 @@
fc = (raw >> 28) & 0xf;
struct
wr_minic
minic
;
int
ver_supported
;
static
inline
void
minic_writel
(
uint32_t
reg
,
uint32_t
data
)
{
...
...
@@ -72,12 +75,21 @@ void minic_init()
{
uint32_t
mcr
;
/* before doing anything, check the HDL interface version */
mcr
=
minic_readl
(
MINIC_REG_MCR
);
if
(
MINIC_MCR_VER_R
(
mcr
)
!=
MINIC_HDL_VERSION
)
{
pp_printf
(
"Error: Minic HDL version %d not supported by sw
\n
"
,
MINIC_MCR_VER_R
(
mcr
));
ver_supported
=
0
;
return
;
}
ver_supported
=
1
;
/* disable interrupts, driver does polling */
minic_writel
(
MINIC_REG_EIC_IDR
,
MINIC_EIC_IDR_TX
|
MINIC_EIC_IDR_RX
|
MINIC_EIC_IDR_TXTS
);
/* enable RX path */
mcr
=
minic_readl
(
MINIC_REG_MCR
);
minic_writel
(
MINIC_REG_MCR
,
mcr
|
MINIC_MCR_RX_EN
);
}
...
...
@@ -90,6 +102,9 @@ int minic_poll_rx()
{
uint32_t
mcr
;
if
(
!
ver_supported
)
return
0
;
mcr
=
minic_readl
(
MINIC_REG_MCR
);
return
(
mcr
&
MINIC_MCR_RX_EMPTY
)
?
0
:
1
;
...
...
@@ -111,7 +126,7 @@ int minic_rx_frame(struct wr_ethhdr *hdr, uint8_t * payload, uint32_t buf_size,
/* check if there is something in the Rx FIFO to be retrieved */
if
(
minic_readl
(
MINIC_REG_MCR
)
&
MINIC_MCR_RX_EMPTY
)
if
(
(
minic_readl
(
MINIC_REG_MCR
)
&
MINIC_MCR_RX_EMPTY
)
||
!
ver_supported
)
return
0
;
hdr_size
=
0
;
...
...
@@ -214,6 +229,9 @@ int minic_tx_frame(struct wr_ethhdr_vlan *hdr, uint8_t *payload, uint32_t size,
int
i
,
hsize
;
uint16_t
*
ptr
;
if
(
!
ver_supported
)
return
0
;
if
(
hdr
->
ethtype
==
htons
(
0x8100
))
hsize
=
sizeof
(
struct
wr_ethhdr_vlan
);
else
...
...
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