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
28
Issues
28
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
8b2403ad
Commit
8b2403ad
authored
Apr 08, 2011
by
Tomasz Wlostowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added main module and makefile
parent
6d0101d6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
128 additions
and
0 deletions
+128
-0
Makefile
Makefile
+47
-0
wrc_main.c
wrc_main.c
+81
-0
No files found.
Makefile
0 → 100644
View file @
8b2403ad
PLATFORM
=
lm32
OBJS_WRC
=
wrc_main.o dev/uart.o dev/endpoint.o dev/minic.o dev/pps_gen.o dev/timer.o dev/softpll.o lib/mprintf.o
ifeq
($(PLATFORM),
zpu)
CROSS_COMPILE
?=
/opt/gcc-zpu/bin/zpu-elf-
CFLAGS_PLATFORM
=
-abel
-Wl
,--relax
-Wl
,--gc-sections
LDFLAGS_PLATFORM
=
-abel
-Wl
,--relax
-Wl
,--gc-sections
OBJS_PLATFORM
=
else
CROSS_COMPILE
?=
/opt/gcc-lm32/bin/lm32-elf-
CFLAGS_PLATFORM
=
-mmultiply-enabled
-mbarrel-shift-enabled
LDFLAGS_PLATFORM
=
-mmultiply-enabled
-mbarrel-shift-enabled
-nostdlib
-T
target/lm32/ram.ld
OBJS_PLATFORM
=
target/lm32/crt0.o
endif
CC
=
$(CROSS_COMPILE)
gcc
OBJCOPY
=
$(CROSS_COMPILE)
objcopy
OBJDUMP
=
$(CROSS_COMPILE)
objdump
CFLAGS
=
$(CFLAGS_PLATFORM)
-ffunction-sections
-fdata-sections
-Os
-Iinclude
LDFLAGS
=
$(LDFLAGS_PLATFORM)
-ffunction-sections
-fdata-sections
-Os
-Iinclude
OBJS
=
$(OBJS_PLATFORM)
$(OBJS_WRC)
OUTPUT
=
wrc
all
:
$(OBJS)
${
CC
}
-o
$(OUTPUT)
.elf
$(OBJS)
$(LDFLAGS)
${
OBJCOPY
}
-O
binary
$(OUTPUT)
.elf
$(OUTPUT)
.bin
${
OBJDUMP
}
-d
$(OUTPUT)
.elf
>
$(OUTPUT)
_disasm.S
./tools/genraminit
$(OUTPUT)
.bin 0
>
$(OUTPUT)
.ram
clean
:
rm
-f
$(OBJS)
$(OUTPUT)
.elf
$(OUTPUT)
.bin
$(OUTPUT)
.ram
%.o
:
%.c
${
CC
}
$(CFLAGS)
$(INCLUDE_DIR)
$(LIB_DIR)
-c
$^
-o
$@
load
:
all
./tools/zpu-loader
$(OUTPUT)
.bin
tools
:
make
-C
tools
fpga
:
-
killall
-9
vuart_console
../loadfile ../spec_top.bin
./tools/zpu-loader
$(OUTPUT)
.bin
wrc_main.c
0 → 100644
View file @
8b2403ad
#include <stdio.h>
#include <inttypes.h>
#include "gpio.h"
#include "uart.h"
#include "endpoint.h"
#include "minic.h"
#include "pps_gen.h"
volatile
int
count
=
0
;
uint32_t
tag_prev
;
uint32_t
tics_last
;
void
_irq_entry
()
{
volatile
uint32_t
dummy_tag
;
dummy_tag
=
*
(
volatile
uint32_t
*
)
0x40004
;
// mprintf("tag %d\n", dummy_tag-tag_prev);
count
++
;
if
(
timer_get_tics
()
-
tics_last
>
1000
)
{
tics_last
=
timer_get_tics
();
mprintf
(
"cnt: %d delta %d
\n
"
,
count
,
tag_prev
-
dummy_tag
);
count
=
0
;
}
tag_prev
=
dummy_tag
;
}
int
main
(
void
)
{
int
rx
,
tx
;
const
uint8_t
mac_addr
[]
=
{
0x00
,
0x00
,
0xde
,
0xad
,
0xba
,
0xbe
};
const
uint8_t
dst_mac_addr
[]
=
{
0x00
,
0x00
,
0x12
,
0x24
,
0x46
,
0x11
};
uint8_t
hdr
[
14
];
uart_init
();
mprintf
(
"Starting up
\n
"
);
gpio_dir
(
GPIO_PIN_LED
,
1
);
ep_init
(
mac_addr
);
ep_enable
(
1
,
1
);
while
(
!
ep_link_up
());
ep_get_deltas
(
&
tx
,
&
rx
);
mprintf
(
"delta: tx = %d, rx=%d
\n
"
,
tx
,
rx
);
minic_init
();
pps_gen_init
();
//(unsigned int *)(0x40000) = 0x1;
// *(unsigned int *)(0x40024) = 0x1;
for
(;;)
{
struct
hw_timestamp
hwts
;
uint32_t
utc
,
nsec
;
uint8_t
buf
[
1024
];
memcpy
(
hdr
,
dst_mac_addr
,
6
);
hdr
[
12
]
=
0x88
;
hdr
[
13
]
=
0xf7
;
minic_tx_frame
(
hdr
,
buf
,
500
,
&
hwts
);
mprintf
(
"TxTs: utc %d nsec %d
\n
"
,
hwts
.
utc
,
hwts
.
nsec
);
delay
(
1000000
);
mprintf
(
"cnt:%d
\n
"
,
count
);
}
}
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