Diagnostic SpaceWire Interface
EtherSpaceLink family User Manual
EtherSpaceLink_EOP
-
te
r
m
i
n
a
te
d pack
et
, r
a
t
h
e
r
t
ha
n ve
r
y
lon
g
pack
et
s
.
Th
e l
a
tte
r
w
oul
d
h
o
g
t
h
e
TC
P/
I
P
c
onne
c
t
i
on
,
f
i
ll
i
n
g
one DS
I p
o
r
t bu
ff
e
r
a
n
d p
r
event
i
n
g
t
h
e ot
h
e
r
DS
I p
o
r
t bu
ff
e
r
s
f
r
om be
i
n
g
f
i
lle
d
i
n
a
t
i
mel
y
m
a
nne
r,
a
n
d
t
h
i
s w
oul
d ca
u
s
e t
h
e t
h
r
ou
g
hp
ut to
d
r
o
p
to ju
s
t t
ha
t o
f
t
h
e
s
i
n
g
le l
i
n
k
be
i
n
g
s
u
pp
l
i
e
d a
t
a
n
y pa
r
t
i
c
ul
a
r
t
i
me;
Th
e DS
I d
i
v
i
d
e
s
r
e
c
e
i
ve
d
S
pac
e
W
ir
e t
r
aff
i
c f
r
om
a
ll o
f
i
t
s p
o
r
t
s
i
nto
s
m
a
ll
pack
et
s a
n
d s
en
ds
t
h
em
b
ack
to t
h
e
app
l
i
ca
t
i
on
p
r
o
gr
a
m
i
n
a
n
i
nte
r
le
a
ve
d fash
i
on.
Th
e
read_packet()
r
out
i
ne
s
r
e
-
c
omb
i
ne t
h
e
s
e
s
m
a
ll
pack
et
s wh
en
p
o
ss
i
ble.
Th
e
4
L
i
n
ks
SpW
ex
a
m
p
le
p
r
o
gr
a
m
d
ri
ve
s
mult
i
p
le S
pac
e
W
ir
e
p
o
r
t
s
i
n
a
DS
I
u
s
i
n
g i
nte
r
le
a
ve
d
pack
et
s
o
f
len
g
t
h 1
500/
n
b
y
te
s
,
wh
e
r
e
n
i
s
t
h
e numbe
r
o
f ac
t
i
ve
p
o
r
t
s
,
s
o t
ha
t one
pack
et
f
o
r
e
ach
DS
I p
o
r
t m
ay
be
ca
rri
e
d
to t
h
e DS
I
i
n e
ach E
t
h
e
r
net
pack
et t
ha
t
i
s
t
r
a
n
s
m
i
tte
d
.
17.5.
6
.
A
n
Adva
nce
d A
P
I
E
xa
mple
Th
e
f
ollo
w
i
n
g
p
r
o
gr
a
m u
s
e
s
t
w
o t
h
r
e
ads
.
O
ne t
h
r
e
ad s
t
r
e
a
m
s
t
h
e
c
ontent
s
o
f a f
i
le to
p
o
r
t
1
o
f a
DS
I
un
i
t.
Th
e
s
e
c
on
d
t
h
r
e
ad
r
e
c
e
i
ve
s
S
pac
e
W
ir
e t
r
aff
i
c f
r
om t
h
e DS
I
un
i
t
,
a
n
d s
to
r
e
s
t
h
e b
y
te
s
r
e
c
e
i
ve
d
f
r
om
a
n
y
o
f
t
h
e DS
I p
o
r
t
s
to
a f
i
le (
i
n
a
n
i
nte
r
le
a
ve
d fash
i
on
, i
f
ne
c
e
ssa
r
y
).
Wh
en t
h
i
s p
r
o
gr
a
m
i
s
r
un on
a
DS
I
un
i
t
,
a
loo
p-
b
ack c
onne
c
t
i
on m
ay
be u
s
e
d
on
p
o
r
t
1
;
a
lte
r
n
a
t
i
vel
y a
S
pac
e
W
ir
e
ca
ble m
ay
be u
s
e
d
to jo
i
n
p
o
r
t
1
to
a
n
y
ot
h
e
r
a
v
a
i
l
a
ble
p
o
r
t.
Th
e t
i
me
s sh
o
w
n
a
r
e
c
olle
c
te
d
i
n t
h
e
r
e
c
e
i
v
i
n
g
t
h
r
e
ad
. S
pac
e
W
ir
e t
i
me
-c
o
d
e
2
i
s s
ent b
y
t
h
e
t
r
a
n
s
m
i
tt
i
n
g
t
h
r
e
ad
to
i
n
i
t
i
a
l
i
s
e t
h
e t
i
me
r,
a
n
d
t
i
me
-c
o
d
e
3
i
s s
ent to
s
to
p
t
h
e t
i
me
r
a
n
d
r
e
p
o
r
t t
h
e
r
e
s
ult
s
.
T
i
me
-c
o
d
e
4
i
s
u
s
e
d
to
s
to
p
t
h
e
p
r
o
gr
a
m.
Th
e
s
e t
i
me
-c
o
d
e
f
e
a
tu
r
e
s
r
e
q
u
ir
e t
h
e
p
r
e
s
en
c
e o
f
t
h
e
DS
I
’
s E
rr
o
r
I
nje
c
t
i
on (
EI
) o
p
t
i
on.
/**************************************************************************/
/* (c) June 2013,
R M A Peel, 4Links Limited
*/
/* */
/* Transmits the file specified on the command line onto port 1 and
*/
/* simultaneously saves the traffic from ports 1 and 2 into a file.
*/
/* Use only port 1 or port 2.
Overwrites file ’file0’.
*/
/* */
/* Requires a loopback connector on port 1 or a SpaceWire cable from
*/
/* port 1 to port 2.
*/
/* */
/* Run as
*/
/* c-api-example2-dsi <IP address of DSI> <input filename>
*/
/* */
/* Compile on Linux:
*/
/* gcc -O2 -o c-api-example2-dsi c-api-example2-dsi.c EtherSpaceLink.c
*/
/* -lm -lpthread */
/* */
/* Compile on Windows:
*/
/* cl /MT /D "_X86_" c-api-example2-dsi.c EtherSpaceLink.c wsock32.lib
*/
/* */
/**************************************************************************/
#include <stdio.h>
#include <sys/timeb.h>
#include "EtherSpaceLink.h"
EtherSpaceLink DSI_unit;
char filename[256];
int total_received = 0;
int total_sent = 0;
int running = 1;
4Links Limited
www.4Links.co.uk
[email protected]
page 56 of 130
T +44 1908 642001; F +44 1908 363463
Milton Keynes MK3 6EB, UK
Suite EU2, Bletchley Park