Commit 451a3008 authored by Jeroen Vreeken's avatar Jeroen Vreeken
Browse files

Change and block from il to C.

Add and4 variant.
Fix memory allocator alignment, it was to enthousiastic.
parent c453e032
(* A simple and port with 2 inputs *)
PROGRAM and2
VAR_INPUT
a: BOOL;
b: BOOL;
END_VAR
VAR_OUTPUT
q: BOOL;
END_VAR
LD a
AND b
ST q
......@@ -5,6 +5,7 @@ $(eval $(call SUBDIR,il2c))
BLOCKS := \
add \
and \
bridge_pwm \
command_bool \
command_float \
......@@ -49,7 +50,6 @@ BLOCKS := \
oneshot
BLOCKS_IL := \
and2 \
not \
or2 \
or3 \
......@@ -57,6 +57,10 @@ BLOCKS_IL := \
register \
setreset
BLOCKS_NO_C := \
and2 \
and4
ifneq ($(OS), FreeBSD)
BLOCKS+= \
joystick
......@@ -79,7 +83,7 @@ $(LIBDIR)/libblock.la: libcontroller.la liblog.la
$(LIBDIR)/libblock.la: $(BLOCK_OBJS)
$(LIB_LINK)
CTRL_BLOCKS += $(BLOCKS) $(BLOCKS_IL)
CTRL_BLOCKS += $(BLOCKS) $(BLOCKS_IL) $(BLOCKS_NO_C)
CTRL_BLOCK_LIBS += libblock.la
TARGETS += $(BLOCK_TARGETS)
......
......@@ -91,10 +91,20 @@ void *controller_mem_calloc(int flags, size_t nmemb, size_t size)
return calloc(nmemb, size);
}
#if defined(__x86_64__)
align = 16;
#else
align = size & 15;
if (!align)
align = 16;
switch (align) {
case 0:
align=16;
break;
default:
align=8;
break;
}
#endif
total += sz;
if (flags & CONTROLLER_MEM_PERIODIC_WRITE)
total_w += sz;
......
......@@ -35,7 +35,7 @@ import "dt_ctrl_ec_sim.ctrl"
blocks ($(frequency), $(delay)) {
{ "setpoint_generator_3d", "azimuth_spg", "Azimuth_Setpoint", "rad" }
{ "servo_state", "azimuth_servo_state" }
{ "and2", "azimuth_safe_and" }
{ "and4", "azimuth_safe_and" }
{ "subtract", "azimuth_setpoint_error" }
{ "subtract", "azimuth_error" }
{ "pid_aw", "azimuth_pid" }
......@@ -118,6 +118,8 @@ links {
{ "azimuth_spg", "a", "azimuth_servo_state", "spg_a" , true }
{ "azimuth_position_range", "q", "azimuth_safe_and", "a" , true }
{ "ethercat", "operational","azimuth_safe_and", "b" , true }
{ $<Azimuth_Drive_Safety_p270>, "azimuth_safe_and", "c" , true }
{ $<Azimuth_Drive_Safety_m270>, "azimuth_safe_and", "d" , true }
{ "azimuth_safe_and", "q", "azimuth_servo_state", "safe" , true }
{ "azimuth_recover", "value", "azimuth_servo_state", "override" , true }
{ "azimuth_recover", "value", "azimuth_range_limit", "enable", true }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment