Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
PPSi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
50
Issues
50
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
PPSi
Commits
1d2c640d
Commit
1d2c640d
authored
Feb 16, 2016
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'wrpc-changes'
parents
515126b6
c3290dce
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
15 deletions
+30
-15
arch.h
arch-wrpc/include/arch/arch.h
+6
-4
wrc_ptp_ppsi.c
arch-wrpc/wrc_ptp_ppsi.c
+3
-2
wrpc-socket.c
time-wrpc/wrpc-socket.c
+21
-9
No files found.
arch-wrpc/include/arch/arch.h
View file @
1d2c640d
...
...
@@ -6,11 +6,13 @@
/* Architecture-specific defines, included by top-level stuff */
#define htons(x) (x)
#define htonl(x) (x)
#ifndef htons
/* If we build as host process, we have them LE already */
# define htons(x) (x)
# define htonl(x) (x)
#define ntohs htons
#define ntohl htonl
# define ntohs htons
# define ntohl htonl
#endif
#define abs(x) ((x >= 0) ? x : -x)
#endif
/* __ARCH_H__ */
arch-wrpc/wrc_ptp_ppsi.c
View file @
1d2c640d
...
...
@@ -225,6 +225,7 @@ int wrc_ptp_stop()
return
0
;
}
/* this returns whether or not the function did any work */
int
wrc_ptp_update
()
{
int
i
;
...
...
@@ -259,8 +260,8 @@ int wrc_ptp_update()
/* Nothing received, but timeout elapsed */
start_tics
=
timer_get_tics
();
delay_ms
=
pp_state_machine
(
ppi
,
NULL
,
0
);
return
0
;
return
1
;
}
delay_ms
=
pp_state_machine
(
ppi
,
ppi
->
rx_ptp
,
i
);
return
0
;
return
1
;
}
time-wrpc/wrpc-socket.c
View file @
1d2c640d
...
...
@@ -9,18 +9,30 @@
#include <ptpd_netif.h>
/* wrpc-sw */
/*
* we know we create one socket only in wrpc. The buffer size used to be
* 512. Let's keep it unchanged, because we might enqueue a few frames.
* I think this can be decreased to 256, but I'd better play safe
*/
static
uint8_t
__ptp_queue
[
512
];
static
struct
wrpc_socket
__static_ptp_socket
=
{
.
queue
.
buff
=
__ptp_queue
,
.
queue
.
size
=
sizeof
(
__ptp_queue
),
};
/* This function should init the minic and get the mac address */
static
int
wrpc_open_ch
(
struct
pp_instance
*
ppi
)
{
wr_socket_
t
*
sock
;
struct
wrpc_socke
t
*
sock
;
mac_addr_t
mac
;
wr_sockaddr_t
addr
;
struct
wr_sockaddr
addr
;
addr
.
ethertype
=
ETH_P_1588
;
memcpy
(
addr
.
mac
,
PP_MCAST_MACADDRESS
,
sizeof
(
mac_addr_t
));
sock
=
ptpd_netif_create_socket
(
PTPD_SOCK_RAW_ETHERNET
,
0
,
&
addr
);
sock
=
ptpd_netif_create_socket
(
&
__static_ptp_socket
,
&
addr
,
PTPD_SOCK_RAW_ETHERNET
,
0
);
if
(
!
sock
)
return
-
1
;
...
...
@@ -38,9 +50,9 @@ static int wrpc_net_recv(struct pp_instance *ppi, void *pkt, int len,
TimeInternal
*
t
)
{
int
got
;
wr_socket_
t
*
sock
;
wr_timestamp_t
wr_ts
;
wr_sockaddr_t
addr
;
struct
wrpc_socke
t
*
sock
;
struct
wr_timestamp
wr_ts
;
struct
wr_sockaddr
addr
;
sock
=
ppi
->
ch
[
PP_NP_EVT
].
custom
;
got
=
ptpd_netif_recvfrom
(
sock
,
&
addr
,
pkt
,
len
,
&
wr_ts
);
...
...
@@ -70,9 +82,9 @@ static int wrpc_net_send(struct pp_instance *ppi, void *pkt, int len,
TimeInternal
*
t
,
int
chtype
,
int
use_pdelay_addr
)
{
int
snt
;
wr_socket_
t
*
sock
;
wr_timestamp_t
wr_ts
;
wr_sockaddr_t
addr
;
struct
wrpc_socke
t
*
sock
;
struct
wr_timestamp
wr_ts
;
struct
wr_sockaddr
addr
;
sock
=
ppi
->
ch
[
PP_NP_EVT
].
custom
;
addr
.
ethertype
=
ETH_P_1588
;
...
...
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