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
cfb8135c
Commit
cfb8135c
authored
Jul 07, 2011
by
Grzegorz Daniluk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes for running ptpx on WRPC in both Slave and Master mode
parent
4f9e6878
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
19 deletions
+63
-19
Makefile
Makefile
+10
-4
wrc_main.c
wrc_main.c
+53
-15
No files found.
Makefile
View file @
cfb8135c
...
@@ -6,7 +6,7 @@ D = ptp-noposix
...
@@ -6,7 +6,7 @@ D = ptp-noposix
PTPD_CFLAGS
=
-ffreestanding
-DPTPD_FREESTANDING
-DWRPC_EXTRA_SLIM
-DPTPD_MSBF
-DPTPD_DBG
PTPD_CFLAGS
=
-ffreestanding
-DPTPD_FREESTANDING
-DWRPC_EXTRA_SLIM
-DPTPD_MSBF
-DPTPD_DBG
PTPD_CFLAGS
+=
-Wall
-ggdb
-I
$D
/wrsw_hal
\
PTPD_CFLAGS
+=
-Wall
-ggdb
-I
$D
/wrsw_hal
\
-I
$D
/libptpnetif
-I
$D
/PTPWRd
\
-I
$D
/libptpnetif
-I
$D
/PTPWRd
\
-include
$D
/compat.h
-include
$D
/libposix/ptpd-wrappers.h
-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_DBGMSG
PTPD_CFLAGS
+=
-DPTPD_NO_DAEMON
-DNEW_SINGLE_WRFSM
#-DPTPD_DBGMSG
OBJS_PTPD
=
$D
/PTPWRd/arith.o
OBJS_PTPD
=
$D
/PTPWRd/arith.o
...
@@ -30,8 +30,14 @@ LDFLAGS_PLATFORM = -abel -Wl,--relax -Wl,--gc-sections
...
@@ -30,8 +30,14 @@ LDFLAGS_PLATFORM = -abel -Wl,--relax -Wl,--gc-sections
OBJS_PLATFORM
=
OBJS_PLATFORM
=
else
else
CROSS_COMPILE
?=
/opt/gcc-lm32/bin/lm32-elf-
CROSS_COMPILE
?=
/opt/gcc-lm32/bin/lm32-elf-
CFLAGS_PLATFORM
=
-mmultiply-enabled
-mbarrel-shift-enabled
-DPTPD_TRACE_MASK
=
0
CFLAGS_PLATFORM
=
-mmultiply-enabled
-mbarrel-shift-enabled
-DPTPD_TRACE_MASK
=
0x2804
#"(TRACE_SERVO | TRACE_PROTO)"
####################################################################
## Select here WR_MASTER (primary clock) or WR_SLAVE mode of WRPC ##
####################################################################
#CFLAGS_PLATFORM += -DWRPC_MASTER
CFLAGS_PLATFORM
+=
-DWRPC_SLAVE
LDFLAGS_PLATFORM
=
-mmultiply-enabled
-mbarrel-shift-enabled
-nostdlib
-T
target/lm32/ram.ld
LDFLAGS_PLATFORM
=
-mmultiply-enabled
-mbarrel-shift-enabled
-nostdlib
-T
target/lm32/ram.ld
OBJS_PLATFORM
=
target/lm32/crt0.o target/lm32/irq.o
OBJS_PLATFORM
=
target/lm32/crt0.o target/lm32/irq.o
endif
endif
...
@@ -50,7 +56,7 @@ all: $(OBJS)
...
@@ -50,7 +56,7 @@ all: $(OBJS)
$(SIZE)
-t
$(OBJS)
$(SIZE)
-t
$(OBJS)
${
CC
}
-o
$(OUTPUT)
.elf
$(OBJS)
$(LDFLAGS)
${
CC
}
-o
$(OUTPUT)
.elf
$(OBJS)
$(LDFLAGS)
${
OBJCOPY
}
-O
binary
$(OUTPUT)
.elf
$(OUTPUT)
.bin
${
OBJCOPY
}
-O
binary
$(OUTPUT)
.elf
$(OUTPUT)
.bin
${
OBJDUMP
}
-d
$(OUTPUT)
.elf
>
$(OUTPUT)
_disasm.S
#
${OBJDUMP} -d $(OUTPUT).elf > $(OUTPUT)_disasm.S
./tools/genraminit
$(OUTPUT).bin
0
>
$(OUTPUT).ram
./tools/genraminit
$(OUTPUT).bin
0
>
$(OUTPUT).ram
clean
:
clean
:
...
...
wrc_main.c
View file @
cfb8135c
...
@@ -19,7 +19,6 @@ RunTimeOpts rtOpts = {
...
@@ -19,7 +19,6 @@ RunTimeOpts rtOpts = {
.
priority1
=
DEFAULT_PRIORITY1
,
.
priority1
=
DEFAULT_PRIORITY1
,
.
priority2
=
DEFAULT_PRIORITY2
,
.
priority2
=
DEFAULT_PRIORITY2
,
.
domainNumber
=
DEFAULT_DOMAIN_NUMBER
,
.
domainNumber
=
DEFAULT_DOMAIN_NUMBER
,
.
slaveOnly
=
SLAVE_ONLY
,
.
currentUtcOffset
=
DEFAULT_UTC_OFFSET
,
.
currentUtcOffset
=
DEFAULT_UTC_OFFSET
,
.
noResetClock
=
DEFAULT_NO_RESET_CLOCK
,
.
noResetClock
=
DEFAULT_NO_RESET_CLOCK
,
.
noAdjust
=
NO_ADJUST
,
.
noAdjust
=
NO_ADJUST
,
...
@@ -29,17 +28,41 @@ RunTimeOpts rtOpts = {
...
@@ -29,17 +28,41 @@ RunTimeOpts rtOpts = {
.
ap
=
DEFAULT_AP
,
.
ap
=
DEFAULT_AP
,
.
ai
=
DEFAULT_AI
,
.
ai
=
DEFAULT_AI
,
.
max_foreign_records
=
DEFAULT_MAX_FOREIGN_RECORDS
,
.
max_foreign_records
=
DEFAULT_MAX_FOREIGN_RECORDS
,
#ifdef WRPC_SLAVE
.
slaveOnly
=
TRUE
,
#else
.
slaveOnly
=
FALSE
,
#endif
/**************** White Rabbit *************************/
/**************** White Rabbit *************************/
.
portNumber
=
NUMBER_PORTS
,
.
autoPortDiscovery
=
FALSE
,
/*if TRUE: automagically discovers how many ports we have (and how many up-s); else takes from .portNumber*/
.
wrNodeMode
=
NON_WR
,
.
portNumber
=
1
,
.
calibrationPeriod
=
WR_DEFAULT_CAL_PERIOD
,
.
calPeriod
=
WR_DEFAULT_CAL_PERIOD
,
.
calibrationPattern
=
WR_DEFAULT_CAL_PATTERN
,
.
E2E_mode
=
TRUE
,
.
calibrationPatternLen
=
WR_DEFAULT_CAL_PATTERN_LEN
,
.
wrStateRetry
=
WR_DEFAULT_STATE_REPEAT
,
.
E2E_mode
=
TRUE
,
.
wrStateTimeout
=
WR_DEFAULT_STATE_TIMEOUT_MS
,
.
deltasKnown
=
WR_DEFAULT_DELTAS_KNOWN
,
.
knownDeltaTx
=
WR_DEFAULT_DELTA_TX
,
.
knownDeltaRx
=
WR_DEFAULT_DELTA_RX
,
/*by default set something for both Master and Slave modes*/
// .primarySource = FALSE,
// .wrConfig = WR_M_AND_S, //WR_M_ONLY, /*NON_WR, WR_MODE_AUTO, WR_M_ONLY, WR_S_ONLY, WR_M_AND_S*/
// .masterOnly = FALSE,
/*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
PtpClock
*
ptpclock
;
static
PtpPortDS
*
ptpPortDS
;
static
PtpClockDS
ptpClockDS
;
const
uint8_t
mac_addr
[]
=
{
0x00
,
0x50
,
0xde
,
0xad
,
0xba
,
0xbe
};
const
uint8_t
mac_addr
[]
=
{
0x00
,
0x50
,
0xde
,
0xad
,
0xba
,
0xbe
};
const
uint8_t
dst_mac_addr
[]
=
{
0x00
,
0x00
,
0x12
,
0x24
,
0x46
,
0x11
};
const
uint8_t
dst_mac_addr
[]
=
{
0x00
,
0x00
,
0x12
,
0x24
,
0x46
,
0x11
};
...
@@ -129,22 +152,37 @@ int main(void)
...
@@ -129,22 +152,37 @@ int main(void)
gpio_dir
(
GPIO_PIN_BTN1
,
0
);
gpio_dir
(
GPIO_PIN_BTN1
,
0
);
ptpclock
=
ptpdStartup
(
0
,
NULL
,
&
ret
,
&
rtOpts
);
ptpPortDS
=
ptpdStartup
(
0
,
NULL
,
&
ret
,
&
rtOpts
,
&
ptpClockDS
);
toState
(
PTP_INITIALIZING
,
&
rtOpts
,
ptpclock
);
initDataClock
(
&
rtOpts
,
&
ptpClockDS
);
toState
(
PTP_INITIALIZING
,
&
rtOpts
,
ptpPortDS
);
wr_servo_man_adjust_phase
(
-
11600
+
1700
);
wr_servo_man_adjust_phase
(
-
11600
+
1700
);
displayConfigINFO
(
&
rtOpts
);
#ifdef WRPC_SLAVE
mprintf
(
"SLAVE
\n
"
);
#endif
#ifdef WRPC_MASTER
mprintf
(
"MASTER
\n
"
);
#endif
for
(;;)
for
(;;)
{
{
wr_mon_debug
();
//
wr_mon_debug();
if
(
button_pressed
())
if
(
button_pressed
())
{
{
mprintf
(
"button pressed
\n
"
);
enable_tracking
=
1
-
enable_tracking
;
enable_tracking
=
1
-
enable_tracking
;
wr_servo_enable_tracking
(
enable_tracking
);
wr_servo_enable_tracking
(
enable_tracking
);
}
}
protocol_nonblock
(
&
rtOpts
,
ptpclock
);
//mprintf("before state=%d, wrState=%d\n", ptpPortDS->portState, ptpPortDS->wrPortState);
update_rx_queues
();
protocol_nonblock
(
&
rtOpts
,
ptpPortDS
);
timer_delay
(
10
);
//mprintf("after state=%d, wrState=%d\n", ptpPortDS->portState, ptpPortDS->wrPortState);
update_rx_queues
();
timer_delay
(
10
);
}
}
}
}
...
...
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