Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tammo Jan Dijkema
dt_ctrl
Commits
8450f2f0
Commit
8450f2f0
authored
Jun 03, 2013
by
Jeroen Vreeken
Browse files
First batch of cherry picks from the vitsch branch.
parent
6dcea292
Changes
21
Hide whitespace changes
Inline
Side-by-side
common/include/dynarg.h
View file @
8450f2f0
...
...
@@ -20,7 +20,7 @@
#define _INCLUDE_DYNARG_H_
#include
<stdarg.h>
#include
<
malloc
.h>
#include
<
stdlib
.h>
...
...
common/utils/tcp_listen.c
View file @
8450f2f0
...
...
@@ -25,6 +25,8 @@
#include
<netinet/in.h>
#include
<string.h>
#include
<sys/ioctl.h>
#include
<sys/socket.h>
#include
<sys/types.h>
#include
"tcp_listen.h"
...
...
controller/Makefile
View file @
8450f2f0
...
...
@@ -7,11 +7,16 @@ CFLAGS= -Wall -O3 \
-I
../common/trace
\
-I
../common/include
\
-Idt_azimuth
-Idt_elevation
-Iec
-Ishell
-Ilog
LDFLAGS
=
-lpthread
-lrt
-lm
-ldl
-Wl
,-E
-L
../common/lib
-L
./lib
LDFLAGS
=
-lpthread
-lrt
-lm
-Wl
,-E
-L
../common/lib
-L
./lib
CFLAGS_SIM
=
-DUSE_AZ_SIM
-DUSE_EL_SIM
OS
=
$(
shell
uname
-s
)
ifneq
($(OS), FreeBSD)
LDFLAGS
+=
-ldl
endif
dt_ctrl_LDFLAGS
=
`
controller/block_list.sh lib/
*
.a
`
\
dt_ctrl_LDFLAGS
=
`
./controller/block_list.sh lib/
*
.a
`
\
-lcontroller
-lethercat
-llog
-lshell
-ldt_azimuth
-ldt_elevation
all
:
dt_ctrl
\
...
...
controller/build.mk
View file @
8450f2f0
...
...
@@ -8,6 +8,13 @@ VPATH= /lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib
LIBTOOL
=
libtool
OS
=
$(
shell
uname
-s
)
ifneq
($(OS), FreeBSD)
FLEX
=
flex
else
FLEX
=
/usr/local/bin/flex
endif
%.o
:
%.c
@
echo
"LT CC
$<
"
@
${LIBTOOL}
--quiet
--mode
=
compile
--tag
=
CC
$(CC)
-MMD
$(CFLAGS)
-c
$<
...
...
@@ -22,7 +29,11 @@ LIBTOOL=libtool
%.lo
:
%.c
@
echo
"LT CC
$<
"
@
${LIBTOOL}
--quiet
--mode
=
compile
--tag
=
CC
$(CC)
-MMD
$(CFLAGS)
-c
$<
@
sed
-i
-e
"s:
\.
libs/::"
-e
"s:
\.
o:
\.
lo:"
.libs/
$*
.d
# compatibility hack: Linux's sed doesn't have a separate argument to '-i',
# while on FreeBSD, '-i' takes a non-optional extension argument. With
# '-i -i' we'll specify '-i' twice on Linux and let FreeBSD use '[filename]-i'
# as intermediate file for in-place editing.
@sed -e "s
:
\.
libs/::" -e "s:
\.
o:
\.
lo:" -i -i .libs/$*.d
%.la
:
@
echo
"LIBTOOL
$@
"
...
...
@@ -38,7 +49,8 @@ LIBTOOL=libtool
%.yy.c %.yy.h
:
%.l %.tab.h
@
echo
" FLEX
$<
"
@
flex
--header-file
=
$*
.yy.h
-o
$*
.yy.c
$<
@
echo
$(FLEX)
--header-file
=
$*
.yy.h
-o
$*
.yy.c
$<
@
$(FLEX)
--header-file
=
$*
.yy.h
-o
$*
.yy.c
$<
# il2c: instruction list 2 c 'compiler'
%.c %.h
:
%.il
...
...
controller/controller/Makefile
View file @
8450f2f0
...
...
@@ -14,7 +14,6 @@ BLOCKSRCS= \
block_friction.c
\
block_gain.c
\
block_gain_var.c
\
block_joystick.c
\
block_limit.c
\
block_limit_dyn.c
\
block_limit_2nd.c
\
...
...
@@ -43,6 +42,13 @@ BLOCKSRCS= \
block_value_bool.c
\
block_value_uint32.c
OS
=
$(
shell
uname
-s
)
ifneq
($(OS), FreeBSD)
BLOCKSRCS
+=
\
block_joystick.c
endif
CONTROLLERSRCS
=
\
controller_block.c
\
controller_block_param.c
\
...
...
controller/controller/block_list.sh
View file @
8450f2f0
#!/bin/
ba
sh
#!/bin/sh
for
lib
in
$@
;
do
SYMBOLS
=
`
nm
$lib
|grep
"block_.*_create"
|cut
-d
' '
-f3
`
...
...
controller/controller/controller_block_param.c
View file @
8450f2f0
...
...
@@ -25,7 +25,7 @@
*/
#include
<string.h>
#include
<
malloc
.h>
#include
<
stdlib
.h>
#include
"controller_block.h"
#include
"controller_sample.h"
...
...
controller/controller/controller_block_trace.c
View file @
8450f2f0
...
...
@@ -22,7 +22,7 @@
This module takes care of tracing block outputs.
*/
#include
<
malloc
.h>
#include
<
stdlib
.h>
#include
<string.h>
#include
"controller_block.h"
...
...
controller/controller/controller_dumpdot.c
View file @
8450f2f0
...
...
@@ -18,7 +18,7 @@
#include
<stdio.h>
#include
<string.h>
#include
<
malloc
.h>
#include
<
stdlib
.h>
#include
<controller/controller_block.h>
#include
<controller/controller_trace.h>
...
...
controller/controller/controller_load.c
View file @
8450f2f0
...
...
@@ -19,7 +19,7 @@
#include
<stdio.h>
#include
<string.h>
#include
<
malloc
.h>
#include
<
stdlib
.h>
#include
<stdbool.h>
#include
"controller_load_parser.tab.h"
#include
"controller_load_parser.yy.h"
...
...
controller/controller/il2c/il2c.c
View file @
8450f2f0
...
...
@@ -19,7 +19,7 @@
#include
<stdio.h>
#include
<string.h>
#include
<
malloc
.h>
#include
<
stdlib
.h>
#include
<stdbool.h>
#include
"il.tab.h"
#include
"il2c.h"
...
...
controller/dt_azimuth/dt_az_stoeber_sim.c
View file @
8450f2f0
...
...
@@ -19,7 +19,7 @@
#include
<string.h>
#include
<stdio.h>
#include
<
malloc
.h>
#include
<
stdlib
.h>
#include
"controller_block.h"
...
...
controller/dt_elevation/dt_el_stoeber_l_sim.c
View file @
8450f2f0
...
...
@@ -20,7 +20,7 @@
#include
<string.h>
#include
<stdio.h>
#include
<
malloc
.h>
#include
<
stdlib
.h>
#include
"controller_block.h"
#include
"log.h"
...
...
controller/dt_elevation/dt_el_stoeber_r_sim.c
View file @
8450f2f0
...
...
@@ -20,7 +20,7 @@
#include
<string.h>
#include
<stdio.h>
#include
<
malloc
.h>
#include
<
stdlib
.h>
#include
"controller_block.h"
...
...
controller/ec/Makefile
View file @
8450f2f0
...
...
@@ -33,6 +33,8 @@ BLOCKSRCS= \
block_beckhoff_el7031.c
\
block_stoeber.c
# block_beckhoff_ax5xxx.c \
BLOCKS
=
$(BLOCKSRCS:.c=.lo)
SRCS
=
$(BLOCKSRCS)
$(LIBSRCS)
...
...
controller/ec/canopen.c
View file @
8450f2f0
...
...
@@ -21,6 +21,12 @@
#include
<stdio.h>
#include
<pthread.h>
#if defined(__linux__)
#include
<endian.h>
#else
#include
<sys/endian.h>
#endif
#include
"canopen.h"
#include
"log.h"
...
...
controller/ec/esc_coe.c
View file @
8450f2f0
...
...
@@ -32,12 +32,6 @@
#include
"esc_coe.h"
#include
"log.h"
#define ESC_MAILBOX_TYPE_ADS 0x1
#define ESC_MAILBOX_TYPE_EOE 0x2
#define ESC_MAILBOX_TYPE_COE 0x3
#define ESC_MAILBOX_TYPE_FOE 0x4
#define ESC_MAILBOX_TYPE_SOE 0x5
#define ESC_MAILBOX_TYPE_VOE 0xf
struct
canopen_dev_priv
{
...
...
controller/ec/esc_id.h
View file @
8450f2f0
...
...
@@ -133,6 +133,8 @@
#define ESC_ESI_PRODUCTCODE_BECKHOFF_EL7031 0x1b773052
#define ESC_ESI_PRODUCTCODE_BECKHOFF_AX5203 0x14536012
struct
esc_vendor
{
uint32_t
vendorid
;
char
*
name
;
...
...
controller/ec/esc_mailbox.h
View file @
8450f2f0
...
...
@@ -35,5 +35,12 @@ void esc_mailbox_destroy(struct esc_mailbox *mailbox);
int
esc_syncmanager_claim
(
struct
ec_dgram_addr
*
addr
);
#define ESC_MAILBOX_TYPE_ADS 0x1
#define ESC_MAILBOX_TYPE_EOE 0x2
#define ESC_MAILBOX_TYPE_COE 0x3
#define ESC_MAILBOX_TYPE_FOE 0x4
#define ESC_MAILBOX_TYPE_SOE 0x5
#define ESC_MAILBOX_TYPE_VOE 0xf
#endif
/* _INCLUDE_EC_ESC_MAILBOX_H_ */
controller/ec/eth_bsd.c
View file @
8450f2f0
...
...
@@ -28,8 +28,8 @@ struct sockaddr_ll {
size_t
sll_halen
;
};
static
struct
tx_timeout
;
static
struct
rx_timeout
;
static
struct
timeval
tx_timeout
;
static
struct
timeval
rx_timeout
;
static
struct
sockaddr_ll
sockaddr_ll
;
int
eth_timeout_set
(
int
ec_sock
,
struct
timeval
*
tx
,
struct
timeval
*
rx
)
...
...
@@ -151,7 +151,7 @@ int eth_recv(int ec_sock, void *frame, int max_len)
while
(
1
)
{
// TODO: kqueue?
memcpy
(
&
timeout
,
rx_timeout
,
sizeof
(
timeout
));
memcpy
(
&
timeout
,
&
rx_timeout
,
sizeof
(
timeout
));
FD_ZERO
(
&
fdr
);
FD_SET
(
ec_sock
,
&
fdr
);
...
...
@@ -226,7 +226,7 @@ struct ethercat_pkt tx_pkt;
int
eth_send
(
int
ec_sock
,
void
*
frame
,
int
len
)
{
struct
sockaddr_ll
*
addr
=
(
struct
sockaddr_ll
*
)
sockaddr_ll
;
struct
sockaddr_ll
*
addr
=
(
struct
sockaddr_ll
*
)
&
sockaddr_ll
;
int
result
;
uint8_t
*
ptr
;
...
...
@@ -244,6 +244,18 @@ int eth_send(int ec_sock, void *frame, int len)
memcpy
(
tx_pkt
.
data
,
frame
,
len
);
ptr
=
(
uint8_t
*
)
&
tx_pkt
;
//TODO: do this once during start-up, in ec_init()
// destination address
ptr
[
0
]
=
0xff
;
ptr
[
1
]
=
0xff
;
ptr
[
2
]
=
0xff
;
ptr
[
3
]
=
0xff
;
ptr
[
4
]
=
0xff
;
ptr
[
5
]
=
0xff
;
// protocol
ptr
[
2
*
6
+
0
]
=
ETH_P_ETHERCAT
>>
8
;
ptr
[
2
*
6
+
1
]
=
ETH_P_ETHERCAT
&
0xff
;
#if 0
printf("tx:");
for (result = 0; result < ETHER_HDR_LEN + len; result++) {
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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