Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
46
Issues
46
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
White Rabbit Switch - Software
Commits
b6a2e5c4
Commit
b6a2e5c4
authored
Mar 19, 2012
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
on-switch-tests: removed most of them as obsolete
parent
719b76b7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
108 changed files
with
8 additions
and
8295 deletions
+8
-8295
wrs-software.in
doc/wrs-software.in
+3
-6
README
on-switch-tests/README
+5
-9
Makefile
on-switch-tests/ad9516_pll_test/Makefile
+0
-19
ad9516_test.c
on-switch-tests/ad9516_pll_test/ad9516_test.c
+0
-95
build.sh
on-switch-tests/ad9516_pll_test/build.sh
+0
-11
regs.txt
on-switch-tests/ad9516_pll_test/regs.txt
+0
-72
util.h
on-switch-tests/ad9516_pll_test/util.h
+0
-0
Makefile
on-switch-tests/blink_leds/Makefile
+0
-22
blink_leds.c
on-switch-tests/blink_leds/blink_leds.c
+0
-28
build.sh
on-switch-tests/blink_leds/build.sh
+0
-9
fpgaboot.h
on-switch-tests/blink_leds/fpgaboot.h
+0
-0
Makefile
on-switch-tests/calibrator_test/Makefile
+0
-26
build.sh
on-switch-tests/calibrator_test/build.sh
+0
-6
calibrator_test.c
on-switch-tests/calibrator_test/calibrator_test.c
+0
-85
term.c
on-switch-tests/calibrator_test/term.c
+0
-63
Makefile
on-switch-tests/dmtd_pll_test/Makefile
+0
-26
build.sh
on-switch-tests/dmtd_pll_test/build.sh
+0
-5
convert_meas.c
on-switch-tests/dmtd_pll_test/convert_meas.c
+0
-41
dmpll_test.c
on-switch-tests/dmtd_pll_test/dmpll_test.c
+0
-180
plot.sh
on-switch-tests/dmtd_pll_test/plot.sh
+0
-15
term.c
on-switch-tests/dmtd_pll_test/term.c
+0
-58
Makefile
on-switch-tests/ep_stats/Makefile
+0
-26
ep_stats.c
on-switch-tests/ep_stats/ep_stats.c
+0
-92
term.c
on-switch-tests/ep_stats/term.c
+0
-58
.emacs_slayer
on-switch-tests/fpgaboot_old/.emacs_slayer
+0
-5
Makefile
on-switch-tests/fpgaboot_old/Makefile
+0
-20
at91_pio.h
on-switch-tests/fpgaboot_old/at91/at91_pio.h
+0
-49
at91_pmc.h
on-switch-tests/fpgaboot_old/at91/at91_pmc.h
+0
-132
at91sam9263.h
on-switch-tests/fpgaboot_old/at91/at91sam9263.h
+0
-127
build.sh
on-switch-tests/fpgaboot_old/build.sh
+0
-5
cpu_io.c
on-switch-tests/fpgaboot_old/cpu_io.c
+0
-124
cpu_io.h
on-switch-tests/fpgaboot_old/cpu_io.h
+0
-36
fpgaboot
on-switch-tests/fpgaboot_old/fpgaboot
+0
-0
main.c
on-switch-tests/fpgaboot_old/main.c
+0
-70
mb_io.c
on-switch-tests/fpgaboot_old/mb_io.c
+0
-71
mb_io.h
on-switch-tests/fpgaboot_old/mb_io.h
+0
-36
mblaster.c
on-switch-tests/fpgaboot_old/mblaster.c
+0
-372
Makefile
on-switch-tests/fpgaboot_old/old/Makefile
+0
-17
at91_pio.h
on-switch-tests/fpgaboot_old/old/at91/at91_pio.h
+0
-49
at91_pmc.h
on-switch-tests/fpgaboot_old/old/at91/at91_pmc.h
+0
-132
at91sam9263.h
on-switch-tests/fpgaboot_old/old/at91/at91sam9263.h
+0
-127
build.sh
on-switch-tests/fpgaboot_old/old/build.sh
+0
-6
cpu_io.c
on-switch-tests/fpgaboot_old/old/cpu_io.c
+0
-124
cpu_io.h
on-switch-tests/fpgaboot_old/old/cpu_io.h
+0
-36
fpgaboot
on-switch-tests/fpgaboot_old/old/fpgaboot
+0
-0
main.c
on-switch-tests/fpgaboot_old/old/main.c
+0
-60
mb_io.c
on-switch-tests/fpgaboot_old/old/mb_io.c
+0
-71
mb_io.h
on-switch-tests/fpgaboot_old/old/mb_io.h
+0
-34
mblaster.c
on-switch-tests/fpgaboot_old/old/mblaster.c
+0
-373
Makefile
on-switch-tests/gen_pll_coefs/Makefile
+0
-11
ad9516_default_regs.h
on-switch-tests/gen_pll_coefs/ad9516_default_regs.h
+0
-75
gen_pll_coefs
on-switch-tests/gen_pll_coefs/gen_pll_coefs
+0
-0
gen_pll_coefs.c
on-switch-tests/gen_pll_coefs/gen_pll_coefs.c
+0
-70
regs.txt
on-switch-tests/gen_pll_coefs/regs.txt
+0
-72
Makefile
on-switch-tests/hal_client/Makefile
+0
-26
hal_client.c
on-switch-tests/hal_client/hal_client.c
+0
-26
Makefile
on-switch-tests/hello/Makefile
+0
-18
aconnect
on-switch-tests/hello/aconnect
+0
-0
build.sh
on-switch-tests/hello/build.sh
+0
-11
hello
on-switch-tests/hello/hello
+0
-0
hello.c
on-switch-tests/hello/hello.c
+0
-1
Makefile
on-switch-tests/hpll_wishbone_test/Makefile
+0
-22
build.sh
on-switch-tests/hpll_wishbone_test/build.sh
+0
-5
convert_meas.c
on-switch-tests/hpll_wishbone_test/convert_meas.c
+0
-36
hpll_wishbone_test.c
on-switch-tests/hpll_wishbone_test/hpll_wishbone_test.c
+0
-27
plot.sh
on-switch-tests/hpll_wishbone_test/plot.sh
+0
-13
term.c
on-switch-tests/hpll_wishbone_test/term.c
+0
-58
Makefile
on-switch-tests/minic_test/Makefile
+0
-24
build.sh
on-switch-tests/minic_test/build.sh
+0
-14
gigaspy.c
on-switch-tests/minic_test/gigaspy.c
+0
-212
gigaspy.h
on-switch-tests/minic_test/gigaspy.h
+0
-37
minic_test.c
on-switch-tests/minic_test/minic_test.c
+0
-287
Makefile
on-switch-tests/minic_test/ptpd_netif/Makefile
+0
-23
build.sh
on-switch-tests/minic_test/ptpd_netif/build.sh
+0
-5
ptpd_netif.h
on-switch-tests/minic_test/ptpd_netif/ptpd_netif.h
+0
-105
ptpd_netif_mch.c
on-switch-tests/minic_test/ptpd_netif/ptpd_netif_mch.c
+0
-413
ptpd_netif_test.c
on-switch-tests/minic_test/ptpd_netif/ptpd_netif_test.c
+0
-87
term.c
on-switch-tests/minic_test/term.c
+0
-63
timestamping.c
on-switch-tests/minic_test/timestamping.c
+0
-497
Makefile
on-switch-tests/rtu_test2/Makefile
+0
-27
rtu_test.c
on-switch-tests/rtu_test2/rtu_test.c
+0
-158
rtu_testunit.h
on-switch-tests/rtu_test2/rtu_testunit.h
+0
-261
wrsw_rtu.h
on-switch-tests/rtu_test2/wrsw_rtu.h
+0
-469
Makefile
on-switch-tests/spi_test/Makefile
+0
-27
spi_test.c
on-switch-tests/spi_test/spi_test.c
+0
-114
Makefile
on-switch-tests/sync_test/Makefile
+0
-27
hal_client.c
on-switch-tests/sync_test/hal_client.c
+0
-60
hal_client.h
on-switch-tests/sync_test/hal_client.h
+0
-10
ptpd_netif.h
on-switch-tests/sync_test/ptpd_netif.h
+0
-97
ptpd_netif_mch.c
on-switch-tests/sync_test/ptpd_netif_mch.c
+0
-372
sync_test.c
on-switch-tests/sync_test/sync_test.c
+0
-581
Makefile
on-switch-tests/test_DACs/Makefile
+0
-18
build.sh
on-switch-tests/test_DACs/build.sh
+0
-11
fpgaboot.h
on-switch-tests/test_DACs/fpgaboot.h
+0
-0
test_dacs.c
on-switch-tests/test_DACs/test_dacs.c
+0
-46
Makefile
on-switch-tests/test_PHYs/Makefile
+0
-18
build.sh
on-switch-tests/test_PHYs/build.sh
+0
-12
fpgaboot.h
on-switch-tests/test_PHYs/fpgaboot.h
+0
-0
term.c
on-switch-tests/test_PHYs/term.c
+0
-58
test_phys.c
on-switch-tests/test_PHYs/test_phys.c
+0
-337
Makefile
on-switch-tests/vic_test/Makefile
+0
-23
build.sh
on-switch-tests/vic_test/build.sh
+0
-13
term.c
on-switch-tests/vic_test/term.c
+0
-58
vic_test.c
on-switch-tests/vic_test/vic_test.c
+0
-93
Makefile
on-switch-tests/zbt_test/Makefile
+0
-22
build.sh
on-switch-tests/zbt_test/build.sh
+0
-5
term.c
on-switch-tests/zbt_test/term.c
+0
-58
zbt_test.c
on-switch-tests/zbt_test/zbt_test.c
+0
-54
No files found.
doc/wrs-software.in
View file @
b6a2e5c4
...
...
@@ -133,12 +133,9 @@ editing this file, please add your name in all the proper places.
@item on-switch-tests/
Tests that are meant to be run on the switch itself.
The directory has been copied from @code
{
software/tests
}
as it appeared in the @i
{
svn
}
repository; it has not been
recompiled or verified in any way. In this version, only
wr
_
mon had been made to compile, the other tests still include
@code
{
build.sh
}
that sources @code
{
../../settings
}
, in the old
way that is now deprecated.
As of March 2012 only a few tests remain, as older ones
only applied to V2, and the switch testing is not a
different project.
@item robustness/
The robustness demo program, copied from @i
{
svn
}
and
...
...
on-switch-tests/README
View file @
b6a2e5c4
This directory includes tests that are meant to be run on the switch
itself.
This directory used to include tests that are meant to be run on the
switch itself. Now only rtu_test remains, even though it's not
included in the Makefile rules.
The directory has been copied from @code{software/tests} as it
appeared in the @i{svn} repository; it has not been recompiled or
verified in any way. In this version, only wr_mon had been made to
compile, the other tests still include @code{build.sh} that sources
@code{../../settings}, in the old way that is now deprecated.
If you "make" here, only libwripc and wr_mon is compiled.
\ No newline at end of file
If you "make" here, only libwripc and wr_mon are compiled, but
wr_mon must be ported to V3.
on-switch-tests/ad9516_pll_test/Makefile
deleted
100644 → 0
View file @
719b76b7
CC
=
$(CROSS_COMPILE)
gcc
OBJS
=
ad9516_test.o
LDFLAGS
=
-lswitchhw
-L
../../libswitchhw
CFLAGS
=
-I
.
-O2
-I
../../include
-DDEBUG
OUTPUT
=
ad9516_test
EXTRAFILES
=
regs.txt
all
:
$(OBJS)
${
CC
}
-o
$(OUTPUT)
$(OBJS)
$(LDFLAGS)
%.o
:
%.c
${
CC
}
-c
$^
$(CFLAGS)
run
::
all
scp
$(OUTPUT)
$(EXTRAFILES)
root@
$(T)
:/tmp
-
ssh
-t
root@
$(T)
"/tmp/
$(OUTPUT)
"
clean
:
rm
-f
$(OUTPUT)
$(OBJS)
\ No newline at end of file
on-switch-tests/ad9516_pll_test/ad9516_test.c
deleted
100644 → 0
View file @
719b76b7
#include <stdio.h>
#include <hw/switch_hw.h>
#define NUM_LEDS 4
uint32_t
clkgen_rval
(
void
*
clkctl
,
unsigned
int
addr
);
#define AD9516_MAX_REGS 1024
struct
ad9516_regs
{
struct
{
uint16_t
addr
;
uint8_t
value
;
}
regs
[
AD9516_MAX_REGS
];
int
nregs
;
};
int
ad9516_load_regset
(
const
char
*
filename
,
struct
ad9516_regs
*
regs
)
{
FILE
*
f
;
char
str
[
1024
],
tmp
[
100
];
int
start_read
=
0
,
n
=
0
;
uint32_t
addr
,
val
;
f
=
fopen
(
filename
,
"rb"
);
if
(
!
f
)
{
TRACE
(
TRACE_ERROR
,
"can't open AD9516 regset file: %s"
,
filename
);
return
-
1
;
}
while
(
!
feof
(
f
))
{
fgets
(
str
,
1024
,
f
);
// printf("%s\n",str);
if
(
!
strncmp
(
str
,
"Addr(Hex)"
,
8
))
start_read
=
1
;
if
(
start_read
)
{
if
(
sscanf
(
str
,
"%04x %08s %02x
\n
"
,
&
addr
,
tmp
,
&
val
)
==
3
)
{
TRACE
(
TRACE_INFO
,
" -> ad9516_reg[0x%x]=0x%x"
,
addr
,
val
);
regs
->
regs
[
n
].
addr
=
addr
;
regs
->
regs
[
n
].
value
=
val
;
n
++
;
}
}
}
regs
->
nregs
=
n
;
fclose
(
f
);
return
0
;
}
int
ad9516_set_state
(
struct
ad9516_regs
*
regs
)
{
int
i
;
TRACE
(
TRACE_INFO
,
"Loading AD9516 state (%d registers)"
,
regs
->
nregs
);
for
(
i
=
0
;
i
<
regs
->
nregs
;
i
++
)
clkgen_write
(
NULL
,
regs
->
regs
[
i
].
addr
,
regs
->
regs
[
i
].
value
);
clkgen_write
(
NULL
,
0x232
,
1
);
for
(
i
=
0
;
i
<
regs
->
nregs
;
i
++
)
{
uint8_t
v
=
clkgen_rval
(
NULL
,
regs
->
regs
[
i
].
addr
);
if
(
regs
->
regs
[
i
].
value
!=
v
)
printf
(
"%x:%x/%x
\n
"
,
regs
->
regs
[
i
].
addr
,
regs
->
regs
[
i
].
value
,
v
);
}
}
main
()
{
char
s
[
2000
];
int
addr
;
int
val
;
unsigned
int
i
=
1
;
trace_log_stderr
();
shw_init
();
ad9516_spi_init
();
struct
ad9516_regs
r
;
// shw_pio_set0(PIN_ad9516_refsel);
ad9516_load_regset
(
"/tmp/regs.txt"
,
&
r
);
ad9516_set_state
(
&
r
);
}
on-switch-tests/ad9516_pll_test/build.sh
deleted
100755 → 0
View file @
719b76b7
#!/bin/sh
.
../../../settings
t
=
`
pwd
`
cd
../../libswitchhw
./build.sh clean
./build.sh
cd
$t
make
CROSS_COMPILE
=
$CC_CPU
$1
$2
$3
$4
on-switch-tests/ad9516_pll_test/regs.txt
deleted
100644 → 0
View file @
719b76b7
AD9516/17/18 Register Map File, Rev 1.0
Addr(Hex) Value(Bin) Value(Hex)
0000 00011000 18
0001 00000000 00
0002 00010000 10
0003 11000011 C3
0004 00000000 00
0010 01111100 7C
0011 00000001 01
0012 00000000 00
0013 00000110 06
0014 00001000 08
0015 00000000 00
0016 00000100 04
0017 00000000 00
0018 00000111 07
0019 00000000 00
001A 00000000 00
001B 00000000 00
001C 00000110 06
001D 00000000 00
001E 00000000 00
001F 00001110 0E
00A0 00000001 01
00A1 00000000 00
00A2 00000000 00
00A3 00000001 01
00A4 00000000 00
00A5 00000000 00
00A6 00000001 01
00A7 00000000 00
00A8 00000000 00
00A9 00000001 01
00AA 00000000 00
00AB 00000000 00
00F0 00001010 0A
00F1 00001010 0A
00F2 00001010 0A
00F3 00001010 0A
00F4 00001010 0A
00F5 00001000 08
0140 01000010 42
0141 01000010 42
0142 01000010 42
0143 01011010 5A
0190 00000000 00
0191 10000000 80
0192 00000000 00
0193 00110010 32
0194 00000000 00
0195 00000000 00
0196 00110010 32
0197 00000000 00
0198 00000000 00
0199 00110010 32
019A 00000000 00
019B 00010001 11
019C 00100000 20
019D 00000000 00
019E 00110010 32
019F 00000000 00
01A0 00010001 11
01A1 00100000 20
01A2 00000000 00
01A3 00000000 00
01E0 00000000 00
01E1 00000010 02
0230 00000000 00
0231 00000000 00
0232 00000000 00
on-switch-tests/ad9516_pll_test/util.h
deleted
100644 → 0
View file @
719b76b7
on-switch-tests/blink_leds/Makefile
deleted
100644 → 0
View file @
719b76b7
CC
=
$(CROSS_COMPILE)
gcc
OBJS
=
blink_leds.o
LDFLAGS
=
-lswitchhw
-L
../../libswitchhw
CFLAGS
=
-I
.
-O2
-I
../../include
-DDEBUG
OUTPUT
=
blink_leds
all
:
$(OBJS)
${
CC
}
-o
$(OUTPUT)
$(OBJS)
$(LDFLAGS)
%.o
:
%.c
${
CC
}
-c
$^
$(CFLAGS)
run
:
all
scp
$(OUTPUT)
root@
$(T)
:/tmp
-
ssh
-t
root@
$(T)
"/tmp/
$(OUTPUT)
"
install
:
all
mkdir
-p
../../rootfs_override/root/tests
cp
$(OUTPUT)
../../rootfs_override/root/tests
clean
:
rm
-f
$(OUTPUT)
$(OBJS)
\ No newline at end of file
on-switch-tests/blink_leds/blink_leds.c
deleted
100644 → 0
View file @
719b76b7
#include <stdio.h>
#include <hw/switch_hw.h>
#define NUM_LEDS 8
main
()
{
unsigned
int
i
=
0
,
di
=
1
,
previ
=
0
;
trace_log_stderr
();
shw_request_fpga_firmware
(
FPGA_ID_MAIN
,
"board_test"
);
shw_init
();
for
(;;)
{
shw_set_fp_led
(
previ
,
LED_OFF
);
shw_set_fp_led
(
i
,
LED_GREEN
);
usleep
(
30000
);
shw_set_fp_led
(
i
,
LED_RED
);
usleep
(
30000
);
previ
=
i
;
i
+=
di
;
if
(
i
==
0
||
i
==
(
NUM_LEDS
-
1
))
di
=-
di
;
}
}
on-switch-tests/blink_leds/build.sh
deleted
100755 → 0
View file @
719b76b7
#!/bin/sh
.
../../../settings
#cd ../../libswitchhw
#./build.sh
#cd ../tests/blink_leds
make
CROSS_COMPILE
=
$CC_CPU
$1
$2
$3
$4
on-switch-tests/blink_leds/fpgaboot.h
deleted
100644 → 0
View file @
719b76b7
on-switch-tests/calibrator_test/Makefile
deleted
100644 → 0
View file @
719b76b7
include
../../../Makedefs
CC
=
$(CROSS_COMPILE_ARM)
gcc
OBJS
=
calibrator_test.o term.o
LDFLAGS
=
-lswitchhw
-L
../../libswitchhw
CFLAGS
=
-I
.
-O2
-I
../../include
-DDEBUG
-I
../../../kernel/include
OUTPUT
=
calibrator_test
all
:
$(OBJS)
make
-C
../../libswitchhw
${
CC
}
-o
$(OUTPUT)
$(OBJS)
$(LDFLAGS)
%.o
:
%.c
${
CC
}
-c
$^
$(CFLAGS)
run
:
all
scp
$(OUTPUT)
../../drivers/bin/
*
.ko root@
$(T)
:/tmp
-
ssh
-t
root@
$(T)
"/tmp/
$(OUTPUT)
"
install
:
all
mkdir
-p
../../rootfs_override/root/tests
cp
$(OUTPUT)
../../rootfs_override/root/tests
clean
:
rm
-f
$(OUTPUT)
$(OBJS)
\ No newline at end of file
on-switch-tests/calibrator_test/build.sh
deleted
100755 → 0
View file @
719b76b7
#!/bin/sh
.
../../../settings
make
CROSS_COMPILE
=
$CROSS_COMPI_CPU
$1
$2
$3
$4
on-switch-tests/calibrator_test/calibrator_test.c
deleted
100644 → 0
View file @
719b76b7
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include <sys/time.h>
#include <signal.h>
#include <hw/switch_hw.h>
#include <hw/clkb_io.h>
#include <hw/minic_regs.h>
#include <hw/endpoint_regs.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
//#include <net/if.h>
#include <asm/types.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
#include <linux/if_arp.h>
#include <linux/net_tstamp.h>
#include <linux/sockios.h>
#include <linux/errqueue.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <errno.h>
#include <hw/dmtd_calibrator_regs.h>
#include <hw/endpoint_regs.h>
#include <hw/phy_calibration.h>
main
()
{
int
i
,
rval
;
system
(
"/sbin/rmmod /tmp/wr_minic.ko"
);
system
(
"/sbin/rmmod /tmp/wr_vic.ko"
);
trace_log_stderr
();
shw_init
();
system
(
"/sbin/insmod /tmp/wr_vic.ko"
);
system
(
"/sbin/insmod /tmp/wr_minic.ko"
);
system
(
"/sbin/ifconfig wru1 hw ether 00:50:fc:96:9b:0e"
);
system
(
"/sbin/ifconfig wru1 up 192.168.100.100"
);
_fpga_writel
(
FPGA_BASE_MINIC_UP0
+
(
1
<<
14
)
+
EP_REG_PHIO
,
EP_PHIO_ENABLE
);
_fpga_writel
(
FPGA_BASE_MINIC_UP1
+
(
1
<<
14
)
+
EP_REG_PHIO
,
EP_PHIO_ENABLE
);
shw_hpll_switch_reference
(
"wru1"
);
while
(
!
shw_hpll_check_lock
());
shw_dmpll_switch_reference
(
"wru1"
);
while
(
!
shw_dmpll_check_lock
());
shw_cal_enable_feedback
(
"wru1"
,
1
,
PHY_CALIBRATE_RX
);
double
phase_rx
;
for
(;;)
{
while
(
!
(
rval
=
shw_cal_measure
(
&
phase_rx
)));
if
(
rval
<
0
)
{
printf
(
"error measuring RX delay
\n
"
);
return
-
1
;
}
printf
(
"rval = %d, deltaRX(uncorrected) = %.3f ns
\n
"
,
rval
,
phase_rx
);
}
}
on-switch-tests/calibrator_test/term.c
deleted
100644 → 0
View file @
719b76b7
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
#include <poll.h>
struct
termios
oldkey
,
newkey
;
int
term_restore
()
{
tcsetattr
(
STDIN_FILENO
,
TCSANOW
,
&
oldkey
);
}
void
term_init
()
{
fcntl
(
STDIN_FILENO
,
F_SETFL
,
O_NONBLOCK
);
tcgetattr
(
STDIN_FILENO
,
&
oldkey
);
memcpy
(
&
newkey
,
&
oldkey
,
sizeof
(
struct
termios
));
newkey
.
c_cflag
=
B9600
|
CRTSCTS
|
CS8
|
CLOCAL
|
CREAD
;
newkey
.
c_iflag
=
IGNPAR
;
newkey
.
c_oflag
=
OPOST
|
ONLCR
;
newkey
.
c_lflag
=
0
;
newkey
.
c_cc
[
VMIN
]
=
1
;
newkey
.
c_cc
[
VTIME
]
=
0
;
tcflush
(
STDIN_FILENO
,
TCIFLUSH
);
tcsetattr
(
STDIN_FILENO
,
TCSANOW
,
&
newkey
);
atexit
(
term_restore
);
}
int
term_poll
()
{
struct
pollfd
pfd
;
pfd
.
fd
=
STDIN_FILENO
;
pfd
.
events
=
POLLIN
|
POLLPRI
;
if
(
poll
(
&
pfd
,
1
,
0
)
>
0
)
return
1
;
return
0
;
}
int
term_get
()
{
unsigned
char
c
;
int
q
;
if
(
read
(
STDIN_FILENO
,
&
c
,
1
)
==
1
)
{
q
=
c
;
}
else
q
=-
1
;
return
q
;
}
void
clear_screen
()
{
printf
(
"
\033
[2J
\033
[1;1H"
);
}
\ No newline at end of file
on-switch-tests/dmtd_pll_test/Makefile
deleted
100644 → 0
View file @
719b76b7
include
../../../Makedefs
CC
=
$(CROSS_COMPILE_ARM)
gcc
OBJS
=
dmpll_test.o term.o
LDFLAGS
=
-lswitchhw
-L
../../libswitchhw
CFLAGS
=
-I
.
-O2
-I
../../include
-DDEBUG
-I
../../../kernel/include
OUTPUT
=
dmpll_test
all
:
$(OBJS)
make
-C
../../libswitchhw
${
CC
}
-o
$(OUTPUT)
$(OBJS)
$(LDFLAGS)
%.o
:
%.c
${
CC
}
-c
$^
$(CFLAGS)
run
:
all
scp
$(OUTPUT)
../../drivers/bin/
*
.ko root@
$(T)
:/tmp
-
ssh
-t
root@
$(T)
"/tmp/
$(OUTPUT)
"
install
:
all
mkdir
-p
../../rootfs_override/root/tests
cp
$(OUTPUT)
../../rootfs_override/root/tests
clean
:
rm
-f
$(OUTPUT)
$(OBJS)
\ No newline at end of file
on-switch-tests/dmtd_pll_test/build.sh
deleted
100755 → 0
View file @
719b76b7
#!/bin/sh
.
../../../settings
make
CROSS_COMPILE
=
$CC_CPU
$1
$2
$3
$4
on-switch-tests/dmtd_pll_test/convert_meas.c
deleted
100644 → 0
View file @
719b76b7
#include <stdio.h>
#include <stdlib.h>
#include <hw/dmpll_regs.h>
int
sign_extend
(
uint32_t
val
,
int
nbits
)
{
if
(
val
&
(
1
<<
(
nbits
-
1
)))
return
(
0xffffffff
^
((
1
<<
nbits
)
-
1
))
|
val
;
else
return
val
;
}
main
(
int
argc
,
char
*
argv
[])
{
if
(
argc
<
3
)
return
-
1
;
FILE
*
fin
,
*
fout
;
uint32_t
r0
,
r1
,
r2
,
r3
;
int
npoints
;
int
i
=
0
;
fin
=
fopen
(
argv
[
1
],
"rb"
);
fout
=
fopen
(
argv
[
2
],
"wb"
);
npoints
=
atoi
(
argv
[
3
]);
while
(
!
feof
(
fin
)
&&
(
++
i
<
npoints
))
{
fread
(
&
r0
,
4
,
1
,
fin
);
fread
(
&
r1
,
4
,
1
,
fin
);
fread
(
&
r2
,
4
,
1
,
fin
);
fread
(
&
r3
,
4
,
1
,
fin
);
fprintf
(
fout
,
"%d %d %d %d
\n
"
,
i
,
sign_extend
(
DMPLL_RFIFO_R0_ERR_VAL_R
(
r0
),
18
),
DMPLL_RFIFO_R3_DAC_VAL_R
(
r3
),
// DMPLL_RFIFO_R1_TAG_REF_R(r1) - DMPLL_RFIFO_R2_TAG_FB_R(r2),
r0
&
DMPLL_RFIFO_R2_FP_MODE
?
60000
:
0
);
}
}
\ No newline at end of file
on-switch-tests/dmtd_pll_test/dmpll_test.c
deleted
100644 → 0
View file @
719b76b7
#include <stdio.h>
#include <inttypes.h>
#include <sys/time.h>
#include <signal.h>
#include <hw/switch_hw.h>
#include <hw/clkb_io.h>
#include <hw/dmpll_regs.h>
#define MAX_MEAS 120000
#define DMPLL_CHANNEL_LOCAL 0
#define DMPLL_CHANNEL_UP0 1
#define DMPLL_CHANNEL_UP1 2
uint32_t
rec_buf
[
MAX_MEAS
*
4
];
int
n_meas
=
0
;
static
void
dmpll_purge_rfifo
()
{
for
(;;)
{
shw_clkb_read_reg
(
CLKB_BASE_DMPLL
+
DMPLL_REG_RFIFO_R0
);
}
}
static
void
dmpll_poll_rfifo
()
{
for
(;;)
{
if
(
shw_clkb_read_reg
(
CLKB_BASE_DMPLL
+
DMPLL_REG_RFIFO_CSR
)
&
DMPLL_RFIFO_CSR_EMPTY
)
return
;
if
(
n_meas
<
MAX_MEAS
)
{
rec_buf
[
4
*
n_meas
]
=
shw_clkb_read_reg
(
CLKB_BASE_DMPLL
+
DMPLL_REG_RFIFO_R0
);
rec_buf
[
4
*
n_meas
+
1
]
=
shw_clkb_read_reg
(
CLKB_BASE_DMPLL
+
DMPLL_REG_RFIFO_R1
);
rec_buf
[
4
*
n_meas
+
2
]
=
shw_clkb_read_reg
(
CLKB_BASE_DMPLL
+
DMPLL_REG_RFIFO_R2
);
rec_buf
[
4
*
n_meas
+
3
]
=
shw_clkb_read_reg
(
CLKB_BASE_DMPLL
+
DMPLL_REG_RFIFO_R3
);
n_meas
++
;
}
}
}
static
void
dmpll_setup_deglitcher
(
uint32_t
reg
,
int
hi
,
int
lo
,
int
glitch
)
{
shw_clkb_write_reg
(
CLKB_BASE_DMPLL
+
reg
,
DMPLL_DGCR_IN0_THR_HI_W
(
hi
)
|
DMPLL_DGCR_IN0_THR_LO_W
(
lo
)
|
DMPLL_DGCR_IN0_THR_GLITCH_W
(
glitch
));
}
static
void
dmpll_set_phase_shift
(
int
channel
,
int
ps_shift
)
{
switch
(
channel
)
{
#if 0
case DMPLL_CHANNEL_LOCAL:
shw_clkb_write_reg(CLKB_BASE_DMPLL + DMPLL_REG_PSCR_LOCAL, ps_shift);
break;
case DMPLL_CHANNEL_UP0:
shw_clkb_write_reg(CLKB_BASE_DMPLL + DMPLL_REG_PSCR_0, ps_shift);
break;
#endif
case
DMPLL_CHANNEL_UP1
:
shw_clkb_write_reg
(
CLKB_BASE_DMPLL
+
DMPLL_REG_PSCR_IN0
,
ps_shift
);
break
;
}
}
static
int
dmpll_shifter_busy
(
int
channel
)
{
switch
(
channel
)
{
/* case DMPLL_CHANNEL_LOCAL:
return shw_clkb_read_reg(CLKB_BASE_DMPLL + DMPLL_REG_PSCR_LOCAL) & (1<<31);
case DMPLL_CHANNEL_UP0:
return shw_clkb_read_reg(CLKB_BASE_DMPLL + DMPLL_REG_PSCR_UP0) & (1<<31);*/
case
DMPLL_CHANNEL_UP1
:
return
shw_clkb_read_reg
(
CLKB_BASE_DMPLL
+
DMPLL_REG_PSCR_IN0
)
&
DMPLL_PSCR_IN0_BUSY
;
}
return
0
;
}
void
sighandler
(
int
sig
)
{
fprintf
(
stderr
,
"Saving: %d"
,
n_meas
);
FILE
*
f
=
fopen
(
"/tmp/dmpll_meas.dat"
,
"wb"
);
fwrite
(
rec_buf
,
8
,
n_meas
,
f
);
fclose
(
f
);
exit
(
0
);
}
main
()
{
int
i
;
int
ps_shift
=
16000
;
int
ps_new_shift
=
0
;
trace_log_stderr
();
shw_init
();
printf
(
"Waiting for Helper PLL lock...
\n
"
);
while
(
!
shw_hpll_check_lock
())
usleep
(
10000
);
/*
for(i=0;i<30;i++)
{
shw_hpll_update(); usleep(100000);
}*/