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)) ...@@ -5,6 +5,7 @@ $(eval $(call SUBDIR,il2c))
BLOCKS := \ BLOCKS := \
add \ add \
and \
bridge_pwm \ bridge_pwm \
command_bool \ command_bool \
command_float \ command_float \
...@@ -49,7 +50,6 @@ BLOCKS := \ ...@@ -49,7 +50,6 @@ BLOCKS := \
oneshot oneshot
BLOCKS_IL := \ BLOCKS_IL := \
and2 \
not \ not \
or2 \ or2 \
or3 \ or3 \
...@@ -57,6 +57,10 @@ BLOCKS_IL := \ ...@@ -57,6 +57,10 @@ BLOCKS_IL := \
register \ register \
setreset setreset
BLOCKS_NO_C := \
and2 \
and4
ifneq ($(OS), FreeBSD) ifneq ($(OS), FreeBSD)
BLOCKS+= \ BLOCKS+= \
joystick joystick
...@@ -79,7 +83,7 @@ $(LIBDIR)/libblock.la: libcontroller.la liblog.la ...@@ -79,7 +83,7 @@ $(LIBDIR)/libblock.la: libcontroller.la liblog.la
$(LIBDIR)/libblock.la: $(BLOCK_OBJS) $(LIBDIR)/libblock.la: $(BLOCK_OBJS)
$(LIB_LINK) $(LIB_LINK)
CTRL_BLOCKS += $(BLOCKS) $(BLOCKS_IL) CTRL_BLOCKS += $(BLOCKS) $(BLOCKS_IL) $(BLOCKS_NO_C)
CTRL_BLOCK_LIBS += libblock.la CTRL_BLOCK_LIBS += libblock.la
TARGETS += $(BLOCK_TARGETS) TARGETS += $(BLOCK_TARGETS)
......
...@@ -91,10 +91,20 @@ void *controller_mem_calloc(int flags, size_t nmemb, size_t size) ...@@ -91,10 +91,20 @@ void *controller_mem_calloc(int flags, size_t nmemb, size_t size)
return calloc(nmemb, size); return calloc(nmemb, size);
} }
#if defined(__x86_64__)
align = 16;
#else
align = size & 15; align = size & 15;
if (!align) switch (align) {
align = 16; case 0:
align=16;
break;
default:
align=8;
break;
}
#endif
total += sz; total += sz;
if (flags & CONTROLLER_MEM_PERIODIC_WRITE) if (flags & CONTROLLER_MEM_PERIODIC_WRITE)
total_w += sz; total_w += sz;
......
...@@ -35,7 +35,7 @@ import "dt_ctrl_ec_sim.ctrl" ...@@ -35,7 +35,7 @@ import "dt_ctrl_ec_sim.ctrl"
blocks ($(frequency), $(delay)) { blocks ($(frequency), $(delay)) {
{ "setpoint_generator_3d", "azimuth_spg", "Azimuth_Setpoint", "rad" } { "setpoint_generator_3d", "azimuth_spg", "Azimuth_Setpoint", "rad" }
{ "servo_state", "azimuth_servo_state" } { "servo_state", "azimuth_servo_state" }
{ "and2", "azimuth_safe_and" } { "and4", "azimuth_safe_and" }
{ "subtract", "azimuth_setpoint_error" } { "subtract", "azimuth_setpoint_error" }
{ "subtract", "azimuth_error" } { "subtract", "azimuth_error" }
{ "pid_aw", "azimuth_pid" } { "pid_aw", "azimuth_pid" }
...@@ -118,6 +118,8 @@ links { ...@@ -118,6 +118,8 @@ links {
{ "azimuth_spg", "a", "azimuth_servo_state", "spg_a" , true } { "azimuth_spg", "a", "azimuth_servo_state", "spg_a" , true }
{ "azimuth_position_range", "q", "azimuth_safe_and", "a" , true } { "azimuth_position_range", "q", "azimuth_safe_and", "a" , true }
{ "ethercat", "operational","azimuth_safe_and", "b" , 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_safe_and", "q", "azimuth_servo_state", "safe" , true }
{ "azimuth_recover", "value", "azimuth_servo_state", "override" , true } { "azimuth_recover", "value", "azimuth_servo_state", "override" , true }
{ "azimuth_recover", "value", "azimuth_range_limit", "enable", true } { "azimuth_recover", "value", "azimuth_range_limit", "enable", true }
......
Supports Markdown
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