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
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
25cdc6b2
Commit
25cdc6b2
authored
May 31, 2018
by
hongming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for TCPIP stack.
parent
130b7ff8
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
90 additions
and
17 deletions
+90
-17
dev.mk
dev/dev.mk
+1
-1
devicelist.c
dev/devicelist.c
+2
-2
tcpip_config.c
dev/tcpip_config.c
+45
-0
ext_config.h
include/ext_config.h
+0
-9
memlayout.h
include/hw/memlayout.h
+1
-1
tcpip-config.h
include/hw/tcpip-config.h
+28
-0
tcpip_config.h
include/tcpip_config.h
+9
-0
ipv4.c
lib/ipv4.c
+2
-2
wrc_main.c
wrc_main.c
+2
-2
No files found.
dev/dev.mk
View file @
25cdc6b2
...
...
@@ -13,7 +13,7 @@ obj-$(CONFIG_EMBEDDED_NODE) += \
dev/devicelist.o \
dev/rxts_calibrator.o \
dev/flash.o\
dev/
ext
_config.o
dev/
tcpip
_config.o
obj-$(CONFIG_WR_NODE) += \
dev/temperature.o \
...
...
dev/devicelist.c
View file @
25cdc6b2
...
...
@@ -19,7 +19,7 @@ unsigned char *BASE_SYSCON;
unsigned
char
*
BASE_UART
;
unsigned
char
*
BASE_ONEWIRE
;
unsigned
char
*
BASE_ETHERBONE_CFG
;
unsigned
char
*
BASE_
EXT
_CFG
;
unsigned
char
*
BASE_
TCPIP
_CFG
;
/* The sdb filesystem itself */
static
struct
sdbfs
wrc_fpga_sdb
=
{
...
...
@@ -72,7 +72,7 @@ struct wrc_device devs[] = {
{
&
BASE_SYSCON
,
VID_CERN
,
0xff07fc47
},
{
&
BASE_UART
,
VID_CERN
,
0xe2d13d04
},
{
&
BASE_ONEWIRE
,
VID_CERN
,
0x779c5443
},
{
&
BASE_
EXT_CFG
,
VID_THU
,
0xc0413599
},
{
&
BASE_
TCPIP_CFG
,
VID_THU
,
0xc0413599
},
{
&
BASE_ETHERBONE_CFG
,
VID_GSI
,
0x68202b22
},
};
...
...
dev/
ext
_config.c
→
dev/
tcpip
_config.c
View file @
25cdc6b2
#include <string.h>
#include "endpoint.h"
#include "hw/
ext
-config.h"
#include "
ext
_config.h"
#include "hw/
tcpip
-config.h"
#include "
tcpip
_config.h"
void
ext
_init
(
uint8_t
mac_addr
[])
void
tcpip
_init
(
uint8_t
mac_addr
[])
{
volatile
unsigned
int
*
ext
_tmp
;
volatile
unsigned
int
*
tcpip
_tmp
;
uint32_t
tmp
=
0
;
ext_tmp
=
(
unsigned
int
*
)(
BASE_EXT_CFG
+
EXT
_MAC_HIGH16
);
tcpip_tmp
=
(
unsigned
int
*
)(
BASE_TCPIP_CFG
+
TCPIP
_MAC_HIGH16
);
tmp
=
((
uint32_t
)
mac_addr
[
0
]
<<
8
)
|
((
uint32_t
)
mac_addr
[
1
]);
*
ext
_tmp
=
tmp
;
*
tcpip
_tmp
=
tmp
;
ext_tmp
=
(
unsigned
int
*
)(
BASE_EXT_CFG
+
EXT
_MAC_LOW32
);
tcpip_tmp
=
(
unsigned
int
*
)(
BASE_TCPIP_CFG
+
TCPIP
_MAC_LOW32
);
tmp
=
((
uint32_t
)
mac_addr
[
2
]
<<
24
)
|
((
uint32_t
)
mac_addr
[
3
]
<<
16
)
|
((
uint32_t
)
mac_addr
[
4
]
<<
8
)
|
((
uint32_t
)
mac_addr
[
5
]);
*
ext
_tmp
=
tmp
;
*
tcpip
_tmp
=
tmp
;
}
void
ext
_config
(
unsigned
char
*
IP
)
void
tcpip
_config
(
unsigned
char
*
IP
)
{
unsigned
int
*
ext
_tmp
;
unsigned
int
*
tcpip
_tmp
;
uint32_t
tmp
;
ext_tmp
=
(
unsigned
int
*
)(
BASE_EXT_CFG
+
EXT
_IP_ADDR
);
tcpip_tmp
=
(
unsigned
int
*
)(
BASE_TCPIP_CFG
+
TCPIP
_IP_ADDR
);
tmp
=
(
*
IP
<<
24
)
|
(
*
(
IP
+
1
)
<<
16
)
|
(
*
(
IP
+
2
)
<<
8
)
|
(
*
(
IP
+
3
));
*
ext
_tmp
=
tmp
;
*
tcpip
_tmp
=
tmp
;
ext_tmp
=
(
unsigned
int
*
)(
BASE_EXT_CFG
+
EXT
_GATEWAY
);
tcpip_tmp
=
(
unsigned
int
*
)(
BASE_TCPIP_CFG
+
TCPIP
_GATEWAY
);
tmp
=
(
tmp
&
0xFFFFFF00
)
+
1
;
*
ext
_tmp
=
tmp
;
*
tcpip
_tmp
=
tmp
;
ext_tmp
=
(
unsigned
int
*
)(
BASE_EXT_CFG
+
EXT
_SUBNET_MASK
);
tcpip_tmp
=
(
unsigned
int
*
)(
BASE_TCPIP_CFG
+
TCPIP
_SUBNET_MASK
);
tmp
=
0xFFFFFF00
;
*
ext
_tmp
=
tmp
;
*
tcpip
_tmp
=
tmp
;
ext_tmp
=
(
unsigned
int
*
)(
BASE_EXT_CFG
+
EXT
_TCP_LOCAL_PORT
);
tcpip_tmp
=
(
unsigned
int
*
)(
BASE_TCPIP_CFG
+
TCPIP
_TCP_LOCAL_PORT
);
tmp
=
8000
;
*
ext
_tmp
=
tmp
;
*
tcpip
_tmp
=
tmp
;
}
include/ext_config.h
deleted
100644 → 0
View file @
130b7ff8
#ifndef __EXT_CONFIG_H
#define __EXT_CONFIG_H
#include <stdint.h>
void
ext_init
(
uint8_t
mac_addr
[]);
void
ext_config
(
unsigned
char
*
IP
);
#endif
include/hw/memlayout.h
View file @
25cdc6b2
...
...
@@ -16,7 +16,7 @@ extern unsigned char *BASE_SYSCON;
extern
unsigned
char
*
BASE_UART
;
extern
unsigned
char
*
BASE_ONEWIRE
;
extern
unsigned
char
*
BASE_ETHERBONE_CFG
;
extern
unsigned
char
*
BASE_
EXT
_CFG
;
extern
unsigned
char
*
BASE_
TCPIP
_CFG
;
#define FMC_EEPROM_ADR 0x50
...
...
include/hw/
ext
-config.h
→
include/hw/
tcpip
-config.h
View file @
25cdc6b2
...
...
@@ -3,8 +3,8 @@
*
* Released according to the GNU GPL, version 2 or any later version.
*/
#ifndef
EXT
_CONFIG
#define
EXT
_CONFIG
#ifndef
TCPIP
_CONFIG
#define
TCPIP
_CONFIG
#define ERROR_STATUS_HIGH 0
#define ERROR_STATUS_LOW 4
...
...
@@ -12,17 +12,17 @@
#define SDB_ADDRSES_LOW 12
/* These are implementation specific */
#define
EXT
_MAC_HIGH16 16
#define
EXT
_MAC_LOW32 20
#define
EXT
_IP_ADDR 24
#define
EXT
_GATEWAY 28
#define
EXT
_SUBNET_MASK 32
#define
EXT
_UDP_RX_PORT 36
#define
EXT
_UDP_TX_SRC_PORT 40
#define
EXT
_UDP_TX_DST_PORT 44
#define
EXT
_UDP_TX_DST_IP 48
#define
EXT
_UDP_TX_DST_MAC_HIGH16 52
#define
EXT
_UDP_TX_DST_MAC_LOW32 56
#define
EXT
_TCP_LOCAL_PORT 60
#define
TCPIP
_MAC_HIGH16 16
#define
TCPIP
_MAC_LOW32 20
#define
TCPIP
_IP_ADDR 24
#define
TCPIP
_GATEWAY 28
#define
TCPIP
_SUBNET_MASK 32
#define
TCPIP
_UDP_RX_PORT 36
#define
TCPIP
_UDP_TX_SRC_PORT 40
#define
TCPIP
_UDP_TX_DST_PORT 44
#define
TCPIP
_UDP_TX_DST_IP 48
#define
TCPIP
_UDP_TX_DST_MAC_HIGH16 52
#define
TCPIP
_UDP_TX_DST_MAC_LOW32 56
#define
TCPIP
_TCP_LOCAL_PORT 60
#endif
include/tcpip_config.h
0 → 100644
View file @
25cdc6b2
#ifndef __TCPIP_CONFIG_H
#define __TCPIP_CONFIG_H
#include <stdint.h>
void
tcpip_init
(
uint8_t
mac_addr
[]);
void
tcpip_config
(
unsigned
char
*
IP
);
#endif
lib/ipv4.c
View file @
25cdc6b2
...
...
@@ -16,7 +16,7 @@
#include "pps_gen.h"
#include "hw/memlayout.h"
#include "hw/etherbone-config.h"
#include "
ext
_config.h"
#include "
tcpip
_config.h"
enum
ip_status
ip_status
=
IP_TRAINING
;
static
uint8_t
myIP
[
4
];
...
...
@@ -207,7 +207,7 @@ void setIP(unsigned char *IP)
// while (*eb_ip != ip)
// *eb_ip = ip;
// ext
_config(IP);
tcpip
_config
(
IP
);
bootp_retry
=
0
;
}
...
...
wrc_main.c
View file @
25cdc6b2
...
...
@@ -30,7 +30,7 @@
#include "lib/ipv4.h"
#include "rxts_calibrator.h"
#include "flash.h"
#include "
ext
_config.h"
#include "
tcpip
_config.h"
#include "wrc_ptp.h"
#include "system_checks.h"
...
...
@@ -91,7 +91,7 @@ static void wrc_initialize(void)
net_rst
();
ep_init
(
mac_addr
);
ext
_init
(
mac_addr
);
tcpip
_init
(
mac_addr
);
/* Sleep for 1s to make sure WRS v4.2 always realizes that
* the link is down */
timer_delay_ms
(
200
);
...
...
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