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
51b5432b
Commit
51b5432b
authored
Mar 08, 2012
by
Grzegorz Daniluk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrc_main: cleanup, remove unused stuff
parent
aa9d754d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
87 deletions
+67
-87
wrc_main.c
wrc_main.c
+67
-87
No files found.
wrc_main.c
View file @
51b5432b
...
...
@@ -66,86 +66,74 @@ static PtpClockDS ptpClockDS;
volatile
int
count
=
0
;
uint32_t
tag_prev
;
uint32_t
tics_last
;
void
test_transition
()
{
int
phase
=
0
;
softpll_enable
();
while
(
!
softpll_check_lock
())
timer_delay
(
1000
);
for
(;;)
{
struct
hw_timestamp
hwts
;
uint8_t
buf_hdr
[
18
],
buf
[
128
];
if
(
minic_rx_frame
(
buf_hdr
,
buf
,
128
,
&
hwts
)
>
0
)
{
printf
(
"phase %d ahead %d
\n
"
,
phase
,
hwts
.
ahead
);
phase
+=
100
;
softpll_set_phase
(
phase
);
timer_delay
(
10
);
}
}
}
int
last_btn0
;
int
button_pressed
()
{
int
p
;
int
btn0
=
gpio_in
(
GPIO_BTN1
);
p
=!
btn0
&&
last_btn0
;
last_btn0
=
btn0
;
return
p
;
}
int
enable_tracking
=
1
;
void
rx_test
()
{
uint8_t
mac
[]
=
{
0x1
,
0x1b
,
0x19
,
0
,
0
,
0
};
uint16_t
buf
[
100
];
wr_socket_t
*
sock
;
wr_sockaddr_t
addr
;
memcpy
(
addr
.
mac
,
mac
,
6
);
addr
.
ethertype
=
0x88f7
;
ptpd_netif_init
();
sock
=
ptpd_netif_create_socket
(
PTPD_SOCK_RAW_ETHERNET
,
0
,
&
addr
);
mprintf
(
"Sock @ %x
\n
"
,
sock
);
wrc_extra_debug
=
0
;
for
(;;)
{
update_rx_queues
();
int
n
=
ptpd_netif_recvfrom
(
sock
,
&
addr
,
buf
,
sizeof
(
buf
),
NULL
);
if
(
n
>
0
)
{
uint16_t
sum
=
0
,
i
,
rx
;
rx
=
n
;
n
=
buf
[
0
];
for
(
i
=
1
;
i
<
n
;
i
++
)
sum
+=
buf
[
i
];
mprintf
(
"%x %x
\n
"
,
sum
,
buf
[
n
]);
if
(
sum
!=
buf
[
n
])
{
mprintf
(
"****************** ERR: rxed %d size %d
\n
"
,
rx
,
n
);
}
}
timer_delay
(
10
);
mprintf
(
"."
);
}
}
//void test_transition()
//{
//
// int phase = 0;
//
// softpll_enable();
// while(!softpll_check_lock()) timer_delay(1000);
//
// for(;;)
// { struct hw_timestamp hwts;
// uint8_t buf_hdr[18], buf[128];
//
// if(minic_rx_frame(buf_hdr, buf, 128, &hwts) > 0)
// {
// printf("phase %d ahead %d\n", phase, hwts.ahead);
// phase+=100;
// softpll_set_phase(phase);
// timer_delay(10);
// }
// }
//}
//int last_btn0;
//int button_pressed()
//{
// int p;
// int btn0 = gpio_in(GPIO_BTN1);
// p=!btn0 && last_btn0;
// last_btn0 = btn0;
// return p;
//}
//void rx_test()
//{
// uint8_t mac[]= {0x1, 0x1b, 0x19, 0,0,0};
// uint16_t buf[100];
// wr_socket_t *sock;
// wr_sockaddr_t addr;
//
// memcpy(addr.mac, mac, 6);
// addr.ethertype = 0x88f7;
//
// ptpd_netif_init();
// sock = ptpd_netif_create_socket(PTPD_SOCK_RAW_ETHERNET, 0, &addr);
// mprintf("Sock @ %x\n", sock);
// wrc_extra_debug = 0;
// for(;;)
// {
// update_rx_queues();
// int n = ptpd_netif_recvfrom(sock, &addr, buf, sizeof(buf), NULL);
// if(n>0)
// {
// uint16_t sum = 0 ,i, rx;
// rx=n;
// n= buf[0];
// for(i=1;i<n;i++) sum+=buf[i];
// mprintf("%x %x\n", sum, buf[n]);
// if(sum != buf[n])
// {
// mprintf("****************** ERR: rxed %d size %d\n", rx, n);
// }
//
// }
// timer_delay(10);
// mprintf(".");
// }
//}
void
wrc_initialize
()
...
...
@@ -291,11 +279,6 @@ extern volatile int irq_cnt;
int
main
(
void
)
{
int
rx
,
tx
;
int
link_went_up
,
link_went_down
;
int
prev_link_state
=
0
,
link_state
;
int16_t
ret
;
wrc_initialize
();
for
(;;)
...
...
@@ -325,12 +308,9 @@ int main(void)
softpll_disable
();
break
;
}
// mprintf(".");
protocol_nonblock
(
&
rtOpts
,
ptpPortDS
);
}
}
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