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
29
Issues
29
List
Board
Labels
Milestones
Merge Requests
7
Merge Requests
7
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
c41204d2
Commit
c41204d2
authored
Mar 19, 2012
by
Grzegorz Daniluk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uncomment ptp stuff, it's now running with new softpll
parent
263b982d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
105 additions
and
99 deletions
+105
-99
Makefile
Makefile
+15
-15
wrc_main.c
wrc_main.c
+90
-84
No files found.
Makefile
View file @
c41204d2
PLATFORM
=
lm32
OBJS_WRC
=
wrc_main.o dev/uart.o dev/endpoint.o dev/
syscon.o dev/softpll_ng.o lib/mprintf
.o dev/ep_pfilter.o dev/dna.o
OBJS_WRC
=
wrc_main.o dev/uart.o dev/endpoint.o dev/
minic.o dev/pps_gen.o dev/syscon.o dev/onewire.o dev/softpll_ng.o lib/mprintf.o monitor/monitor
.o dev/ep_pfilter.o dev/dna.o
D
=
ptp-noposix
PTPD_CFLAGS
=
-ffreestanding
-DPTPD_FREESTANDING
-DWRPC_EXTRA_SLIM
-DPTPD_MSBF
-DPTPD_DBG
...
...
@@ -9,20 +9,20 @@ PTPD_CFLAGS += -Wall -ggdb -I$D/wrsw_hal \
-include
$D
/compat.h
-include
$D
/PTPWRd/dep/trace.h
-include
$D
/libposix/ptpd-wrappers.h
PTPD_CFLAGS
+=
-DPTPD_NO_DAEMON
-DNEW_SINGLE_WRFSM
-DPTPD_TRACE_MASK
=
0
#
OBJS_PTPD = $D/PTPWRd/arith.o
#
OBJS_PTPD += $D/PTPWRd/bmc.o
#
OBJS_PTPD += $D/PTPWRd/dep/msg.o
#
OBJS_PTPD += $D/PTPWRd/dep/net.o
#
OBJS_PTPD += $D/PTPWRd/dep/servo.o
#
OBJS_PTPD += $D/PTPWRd/dep/sys.o
#
OBJS_PTPD += $D/PTPWRd/dep/timer.o
#
OBJS_PTPD += $D/PTPWRd/dep/wr_servo.o
#
OBJS_PTPD += $D/PTPWRd/protocol.o
#
OBJS_PTPD += $D/PTPWRd/wr_protocol.o
#
OBJS_PTPD_FREE = $D/libposix/freestanding-startup.o
#
OBJS_PTPD_FREE += $D/libposix/freestanding-display.o
#
OBJS_PTPD_FREE += $D/libposix/wr_nolibs.o
#
OBJS_PTPD_FREE += $D/libposix/freestanding-wrapper.o
OBJS_PTPD
=
$D
/PTPWRd/arith.o
OBJS_PTPD
+=
$D
/PTPWRd/bmc.o
OBJS_PTPD
+=
$D
/PTPWRd/dep/msg.o
OBJS_PTPD
+=
$D
/PTPWRd/dep/net.o
OBJS_PTPD
+=
$D
/PTPWRd/dep/servo.o
OBJS_PTPD
+=
$D
/PTPWRd/dep/sys.o
OBJS_PTPD
+=
$D
/PTPWRd/dep/timer.o
OBJS_PTPD
+=
$D
/PTPWRd/dep/wr_servo.o
OBJS_PTPD
+=
$D
/PTPWRd/protocol.o
OBJS_PTPD
+=
$D
/PTPWRd/wr_protocol.o
OBJS_PTPD_FREE
=
$D
/libposix/freestanding-startup.o
OBJS_PTPD_FREE
+=
$D
/libposix/freestanding-display.o
OBJS_PTPD_FREE
+=
$D
/libposix/wr_nolibs.o
OBJS_PTPD_FREE
+=
$D
/libposix/freestanding-wrapper.o
ifeq
($(PLATFORM),
zpu)
CFLAGS_PLATFORM
=
-abel
-Wl
,--relax
-Wl
,--gc-sections
...
...
wrc_main.c
View file @
c41204d2
...
...
@@ -6,65 +6,65 @@
#include "syscon.h"
#include "uart.h"
#include "endpoint.h"
//
#include "minic.h"
//
#include "pps_gen.h"
//
#include "ptpd.h"
//
#include "ptpd_netif.h"
#include "minic.h"
#include "pps_gen.h"
#include "ptpd.h"
#include "ptpd_netif.h"
//#include "i2c.h"
//#include "eeprom.h"
//
#include "onewire.h"
//
RunTimeOpts rtOpts = {
//
.announceInterval = DEFAULT_ANNOUNCE_INTERVAL,
//
.syncInterval = DEFAULT_SYNC_INTERVAL,
//
.clockQuality.clockAccuracy = DEFAULT_CLOCK_ACCURACY,
//
.clockQuality.clockClass = DEFAULT_CLOCK_CLASS,
//
.clockQuality.offsetScaledLogVariance = DEFAULT_CLOCK_VARIANCE,
//
.priority1 = DEFAULT_PRIORITY1,
//
.priority2 = DEFAULT_PRIORITY2,
//
.domainNumber = DEFAULT_DOMAIN_NUMBER,
//
.currentUtcOffset = DEFAULT_UTC_OFFSET,
//
.noResetClock = DEFAULT_NO_RESET_CLOCK,
//
.noAdjust = NO_ADJUST,
//
.inboundLatency.nanoseconds = DEFAULT_INBOUND_LATENCY,
//
.outboundLatency.nanoseconds = DEFAULT_OUTBOUND_LATENCY,
//
.s = DEFAULT_DELAY_S,
//
.ap = DEFAULT_AP,
//
.ai = DEFAULT_AI,
//
.max_foreign_records = DEFAULT_MAX_FOREIGN_RECORDS,
//
#ifdef WRPC_SLAVE
//
.slaveOnly = TRUE,
//
#else
//
.slaveOnly = FALSE,
//
#endif
//
//
/**************** White Rabbit *************************/
//
.autoPortDiscovery = FALSE, /*if TRUE: automagically discovers how many ports we have (and how many up-s); else takes from .portNumber*/
//
.portNumber = 1,
//
.calPeriod = WR_DEFAULT_CAL_PERIOD,
//
.E2E_mode = TRUE,
//
.wrStateRetry = WR_DEFAULT_STATE_REPEAT,
//
.wrStateTimeout= WR_DEFAULT_STATE_TIMEOUT_MS,
// .deltasKnown = TRUE, //
WR_DEFAULT_DELTAS_KNOWN,
// .knownDeltaTx = 0,//
WR_DEFAULT_DELTA_TX,
// .knownDeltaRx = 0,//
WR_DEFAULT_DELTA_RX,
/
//
*SLAVE only or MASTER only*/
//
#ifdef WRPC_SLAVE
//
.primarySource = FALSE,
//
.wrConfig = WR_S_ONLY,
//
.masterOnly = FALSE,
//
#endif
//
#ifdef WRPC_MASTER
//
.primarySource = TRUE,
//
.wrConfig = WR_M_ONLY,
//
.masterOnly = TRUE,
//
#endif
//
/********************************************************/
//
};
//
static PtpPortDS *ptpPortDS;
//
static PtpClockDS ptpClockDS;
#include "onewire.h"
RunTimeOpts
rtOpts
=
{
.
announceInterval
=
DEFAULT_ANNOUNCE_INTERVAL
,
.
syncInterval
=
DEFAULT_SYNC_INTERVAL
,
.
clockQuality
.
clockAccuracy
=
DEFAULT_CLOCK_ACCURACY
,
.
clockQuality
.
clockClass
=
DEFAULT_CLOCK_CLASS
,
.
clockQuality
.
offsetScaledLogVariance
=
DEFAULT_CLOCK_VARIANCE
,
.
priority1
=
DEFAULT_PRIORITY1
,
.
priority2
=
DEFAULT_PRIORITY2
,
.
domainNumber
=
DEFAULT_DOMAIN_NUMBER
,
.
currentUtcOffset
=
DEFAULT_UTC_OFFSET
,
.
noResetClock
=
DEFAULT_NO_RESET_CLOCK
,
.
noAdjust
=
NO_ADJUST
,
.
inboundLatency
.
nanoseconds
=
DEFAULT_INBOUND_LATENCY
,
.
outboundLatency
.
nanoseconds
=
DEFAULT_OUTBOUND_LATENCY
,
.
s
=
DEFAULT_DELAY_S
,
.
ap
=
DEFAULT_AP
,
.
ai
=
DEFAULT_AI
,
.
max_foreign_records
=
DEFAULT_MAX_FOREIGN_RECORDS
,
#ifdef WRPC_SLAVE
.
slaveOnly
=
TRUE
,
#else
.
slaveOnly
=
FALSE
,
#endif
/**************** White Rabbit *************************/
.
autoPortDiscovery
=
FALSE
,
/*if TRUE: automagically discovers how many ports we have (and how many up-s); else takes from .portNumber*/
.
portNumber
=
1
,
.
calPeriod
=
WR_DEFAULT_CAL_PERIOD
,
.
E2E_mode
=
TRUE
,
.
wrStateRetry
=
WR_DEFAULT_STATE_REPEAT
,
.
wrStateTimeout
=
WR_DEFAULT_STATE_TIMEOUT_MS
,
.
deltasKnown
=
TRUE
,
WR_DEFAULT_DELTAS_KNOWN
,
.
knownDeltaTx
=
0
,
WR_DEFAULT_DELTA_TX
,
.
knownDeltaRx
=
0
,
WR_DEFAULT_DELTA_RX
,
/*SLAVE only or MASTER only*/
#ifdef WRPC_SLAVE
.
primarySource
=
FALSE
,
.
wrConfig
=
WR_S_ONLY
,
.
masterOnly
=
FALSE
,
#endif
#ifdef WRPC_MASTER
.
primarySource
=
TRUE
,
.
wrConfig
=
WR_M_ONLY
,
.
masterOnly
=
TRUE
,
#endif
/********************************************************/
};
static
PtpPortDS
*
ptpPortDS
;
static
PtpClockDS
ptpClockDS
;
...
...
@@ -147,10 +147,10 @@ uint8_t get_sfp_id(char *sfp_pn)
uint8_t data, sum=0;
uint8_t i;
//
wait until SFP signalizes its presence
//
wait until SFP signalizes its presence
while( gpio_in(GPIO_SFP_DET) );
//
mprintf("wr_core: SFP present\n");
//
mprintf("wr_core: SFP present\n");
mi2c_init(WRPC_SFP_I2C);
mi2c_start(WRPC_SFP_I2C);
...
...
@@ -200,14 +200,23 @@ void wrc_initialize()
mprintf
(
"wr_core: starting up (press G to launch the GUI and D for extra debug messages)....
\n
"
);
//SFP
#if 0
get_sfp_id(sfp_pn);
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
//Generate MAC address
//
ow_init();
//
if( ds18x_read_serial(ds18_id) == 0 )
//
TRACE_DEV("Found DS18xx sensor: %x:%x:%x:%x:%x:%x:%x:%x\n",
//
ds18_id[7], ds18_id[6], ds18_id[5], ds18_id[4],
//
ds18_id[3], ds18_id[2], ds18_id[1], ds18_id[0]);
//
else
//
TRACE_DEV("DS18B20 not found\n");
ow_init
();
if
(
ds18x_read_serial
(
ds18_id
)
==
0
)
TRACE_DEV
(
"Found DS18xx sensor: %x:%x:%x:%x:%x:%x:%x:%x
\n
"
,
ds18_id
[
7
],
ds18_id
[
6
],
ds18_id
[
5
],
ds18_id
[
4
],
ds18_id
[
3
],
ds18_id
[
2
],
ds18_id
[
1
],
ds18_id
[
0
]);
else
TRACE_DEV
(
"DS18B20 not found
\n
"
);
mac_addr
[
0
]
=
0x08
;
//
mac_addr
[
1
]
=
0x00
;
// CERN OUI
...
...
@@ -220,19 +229,19 @@ void wrc_initialize()
ep_init
(
mac_addr
);
ep_enable
(
1
,
1
);
//
minic_init();
//
pps_gen_init();
minic_init
();
pps_gen_init
();
// for(;;);
// rx_test();
//
netStartup();
netStartup
();
//
wr_servo_man_adjust_phase(-11600 + 1700);
wr_servo_man_adjust_phase
(
-
11600
+
1700
);
//
displayConfigINFO(&rtOpts);
displayConfigINFO
(
&
rtOpts
);
//
ptpPortDS = ptpdStartup(0, NULL, &ret, &rtOpts, &ptpClockDS);
//
initDataClock(&rtOpts, &ptpClockDS);
ptpPortDS
=
ptpdStartup
(
0
,
NULL
,
&
ret
,
&
rtOpts
,
&
ptpClockDS
);
initDataClock
(
&
rtOpts
,
&
ptpClockDS
);
}
#define LINK_WENT_UP 1
...
...
@@ -273,7 +282,7 @@ void wrc_debug_printf(int subsys, const char *fmt, ...)
va_start
(
ap
,
fmt
);
if
(
wrc_extra_debug
)
//
|| (!wrc_extra_debug && (subsys & TRACE_SERVO)))
if
(
wrc_extra_debug
||
(
!
wrc_extra_debug
&&
(
subsys
&
TRACE_SERVO
)))
vprintf
(
fmt
,
ap
);
va_end
(
ap
);
...
...
@@ -294,7 +303,7 @@ void wrc_handle_input()
wrc_gui_mode
=
1
-
wrc_gui_mode
;
if
(
!
wrc_gui_mode
)
{
//
m_term_clear();
m_term_clear
();
wrc_debug_printf
(
0
,
"Exiting GUI mode
\n
"
);
}
break
;
...
...
@@ -308,7 +317,7 @@ void wrc_handle_input()
case
't'
:
wrc_enable_tracking
=
1
-
wrc_enable_tracking
;
//
wr_servo_enable_tracking(wrc_enable_tracking);
wr_servo_enable_tracking
(
wrc_enable_tracking
);
wrc_debug_printf
(
0
,
"Phase tracking %s.
\n
"
,
wrc_enable_tracking
?
"enabled"
:
"disabled"
);
break
;
...
...
@@ -317,7 +326,7 @@ void wrc_handle_input()
case
'-'
:
wrc_man_phase
+=
(
x
==
'+'
?
100
:
-
100
);
wrc_debug_printf
(
0
,
"Manual phase adjust: %d
\n
"
,
wrc_man_phase
);
//
wr_servo_man_adjust_phase(wrc_man_phase);
wr_servo_man_adjust_phase
(
wrc_man_phase
);
break
;
...
...
@@ -331,13 +340,12 @@ extern volatile int irq_cnt;
int
main
(
void
)
{
wrc_initialize
();
spll_test
(
);
#if 0
softpll_set_mode
(
0
);
//softpll_enable();
// for(;;);
for
(;;)
{
wrc_handle_input
();
...
...
@@ -369,7 +377,5 @@ int main(void)
protocol_nonblock
(
&
rtOpts
,
ptpPortDS
);
}
#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