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
30
Issues
30
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
ffa85d1b
Commit
ffa85d1b
authored
Apr 30, 2012
by
Grzegorz Daniluk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrc_main: clean up
parent
da20ab13
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
88 additions
and
110 deletions
+88
-110
Makefile
Makefile
+1
-1
wrc_main.c
wrc_main.c
+87
-109
No files found.
Makefile
View file @
ffa85d1b
PLATFORM
=
lm32
OBJS_WRC
=
wrc_main.o dev/uart.o dev/endpoint.o dev/minic.o dev/pps_gen.o dev/syscon.o dev/softpll_ng.o lib/mprintf.o dev/ep_pfilter.o dev/dna.o dev/i2c.o monitor/monitor.o
#dev/onewire.o dev/i2c
.o #dev/eeprom.o
OBJS_WRC
=
wrc_main.o dev/uart.o dev/endpoint.o dev/minic.o dev/pps_gen.o dev/syscon.o dev/softpll_ng.o lib/mprintf.o dev/ep_pfilter.o dev/dna.o dev/i2c.o monitor/monitor.o
dev/onewire
.o
#dev/eeprom.o
D
=
ptp-noposix
PTPD_CFLAGS
=
-ffreestanding
-DPTPD_FREESTANDING
-DWRPC_EXTRA_SLIM
-DPTPD_MSBF
-DPTPD_DBG
...
...
wrc_main.c
View file @
ffa85d1b
...
...
@@ -10,7 +10,7 @@
#include "pps_gen.h"
#include "ptpd.h"
#include "ptpd_netif.h"
//
#include "i2c.h"
#include "i2c.h"
//#include "eeprom.h"
#include "onewire.h"
#include "softpll_ng.h"
...
...
@@ -173,7 +173,6 @@ int get_sfp_id(char *sfp_pn)
mi2c_get_byte
(
WRPC_SFP_I2C
,
&
data
,
1
);
mi2c_stop
(
WRPC_SFP_I2C
);
//mprintf("SFP: id=0x%x\n", data);
sum
=
data
;
mi2c_start
(
WRPC_SFP_I2C
);
...
...
@@ -188,10 +187,6 @@ int get_sfp_id(char *sfp_pn)
mi2c_get_byte
(
WRPC_SFP_I2C
,
&
data
,
1
);
//final word, checksum
mi2c_stop
(
WRPC_SFP_I2C
);
//mprintf("SFP: vendor PN: ");
//for(i=0; i<=15; ++i)
// mprintf("%c", sfp_pn[i]);
if
(
sum
==
data
)
return
0
;
...
...
@@ -207,29 +202,30 @@ void wrc_initialize()
uart_init
();
//
uart_write_string(__FILE__ " is up (compiled on "
//
__DATE__ " " __TIME__ ")\n");
uart_write_string
(
__FILE__
" is up (compiled on "
__DATE__
" "
__TIME__
")
\n
"
);
mprintf
(
"wr_core: starting up (press G to launch the GUI and D for extra debug messages)....
\n
"
);
//SFP
#if 1
// mprintf("Detecting transceiver...");
if
(
get_sfp_id
(
sfp_pn
)
>=
0
)
{
//
mprintf("Found SFP transceiver ID: ");
//
mprintf("Found SFP transceiver ID: ");
for
(
i
=
0
;
i
<
16
;
i
++
)
mprintf
(
"%c"
,
sfp_pn
[
i
]);
mprintf
(
"
\n
"
);
/* if( !access_eeprom(sfp_pn, &sfp_alpha, &sfp_deltaTx, &sfp_deltaRx) )
{
mprintf("SFP: alpha=%d, deltaTx=%d, deltaRx=%d\n", sfp_alpha, sfp_deltaTx, sfp_deltaRx);
}*/
/*
* if( !access_eeprom(sfp_pn, &sfp_alpha, &sfp_deltaTx, &sfp_deltaRx) )
* {
* mprintf("SFP: alpha=%d, deltaTx=%d, deltaRx=%d\n", sfp_alpha, sfp_deltaTx, sfp_deltaRx);
* }
*/
}
#endif
#if 1
//Generate MAC address
#if 0
ow_init
();
if
(
ds18x_read_serial
(
ds18_id
)
==
0
)
TRACE_DEV
(
"Found DS18xx sensor: %x:%x:%x:%x:%x:%x:%x:%x
\n
"
,
...
...
@@ -246,16 +242,12 @@ void wrc_initialize()
mac_addr
[
4
]
=
ds18_id
[
2
];
// APPLICATION NOTE 186
mac_addr
[
5
]
=
ds18_id
[
1
];
// Creating Global Identifiers Using 1-Wire® Devices
//
TRACE_DEV("wr_core: local MAC address: %x:%x:%x:%x:%x:%x\n", mac_addr[0],mac_addr[1],mac_addr[2],mac_addr[3],mac_addr[4],mac_addr[5]);
TRACE_DEV
(
"wr_core: local MAC address: %x:%x:%x:%x:%x:%x
\n
"
,
mac_addr
[
0
],
mac_addr
[
1
],
mac_addr
[
2
],
mac_addr
[
3
],
mac_addr
[
4
],
mac_addr
[
5
]);
ep_init
(
mac_addr
);
ep_enable
(
1
,
1
);
// for(;;);
minic_init
();
pps_gen_init
();
// for(;;);
// rx_test();
netStartup
();
...
...
@@ -271,6 +263,12 @@ void wrc_initialize()
return
;
}
ptpPortDS
->
linkUP
=
FALSE
;
//initialize SoftPLL
//spll_init(SPLL_MODE_GRAND_MASTER, 0, 1);
//spll_init(SPLL_MODE_FREE_RUNNING_MASTER, 0, 1);
spll_init
(
SPLL_MODE_SLAVE
,
0
,
1
);
}
#define LINK_WENT_UP 1
...
...
@@ -289,7 +287,8 @@ int wrc_check_link()
TRACE_DEV
(
"Link up.
\n
"
);
gpio_out
(
GPIO_LED_LINK
,
1
);
rv
=
LINK_WENT_UP
;
}
else
if
(
prev_link_state
&&
!
link_state
)
}
else
if
(
prev_link_state
&&
!
link_state
)
{
TRACE_DEV
(
"Link down.
\n
"
);
gpio_out
(
GPIO_LED_LINK
,
0
);
...
...
@@ -340,7 +339,7 @@ void wrc_handle_input()
case
'd'
:
wrc_extra_debug
=
1
-
wrc_extra_debug
;
//
wrc_debug_printf(0,"Verbose debug %s.\n", wrc_extra_debug ? "enabled" : "disabled");
wrc_debug_printf
(
0
,
"Verbose debug %s.
\n
"
,
wrc_extra_debug
?
"enabled"
:
"disabled"
);
break
;
...
...
@@ -371,18 +370,14 @@ int main(void)
{
wrc_initialize
();
//spll_init(SPLL_MODE_GRAND_MASTER, 0, 1);
spll_init
(
SPLL_MODE_FREE_RUNNING_MASTER
,
0
,
1
);
//for(;;)
//{
// //mprintf("%d\n", timer_get_tics());
// spll_show_stats();
//}
// test_transition();
// wr_servo_rollover_test(1);
//test_transition();
//wr_servo_rollover_test(1);
for
(;;)
{
...
...
@@ -395,22 +390,7 @@ int main(void)
switch
(
l_status
)
{
case
LINK_WENT_UP
:
{
uint32_t
delta_tx
,
delta_rx
,
ret
=
0
;
// mprintf("**********************************S\n");
/* kill_sockets();
netStartup();
ptpPortDS = ptpdStartup(0, NULL, &ret, &rtOpts, &ptpClockDS);
initDataClock(&rtOpts, &ptpClockDS);
protocol_restart(&rtOpts, &ptpClockDS);*/
// ptpPortDS = ptpdStartup(0, NULL, &ret, &rtOpts, &ptpClockDS);
// initDataClock(&rtOpts, &ptpClockDS);
break
;
}
case
LINK_UP
:
// softpll_check_lock();
...
...
@@ -419,7 +399,6 @@ int main(void)
case
LINK_WENT_DOWN
:
spll_init
(
SPLL_MODE_FREE_RUNNING_MASTER
,
0
,
1
);
break
;
}
...
...
@@ -427,8 +406,7 @@ int main(void)
sharedPortsLoop
(
ptpPortDS
);
delay
(
100000
);
// protocol_nonblock(&rtOpts, ptpPortDS);
#endif
#endif
}
}
...
...
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