diff --git a/src/Makefile b/src/Makefile index 5f5c6362b..39238a0d2 100644 --- a/src/Makefile +++ b/src/Makefile @@ -411,7 +411,7 @@ endif ifeq ($(BUILD_SYS),kbuild) modules: - $(PYTHON) modsilent.py $(MAKE) KBUILD_EXTRA_SYMBOLS=$(moduledir)/Module.symvers -C $(KERNELDIR) SUBDIRS=`pwd` CC=$(CC) V=0 modules + $(PYTHON) modsilent.py $(MAKE) KBUILD_EXTRA_SYMBOLS=$(moduledir)/Module.symvers -C $(KERNELDIR) SUBDIRS=`pwd` CC=$(CC) V=1 modules -cp Module.symvers *$(MODULE_EXT) ../rtlib/ endif @@ -669,7 +669,7 @@ EXTRA_CFLAGS = $(filter-out -ffast-math,$(RTFLAGS)) -D__MODULE__ -I$(BASEPWD) -I -I$(BASEPWD)/libnml/os_intf -I$(BASEPWD)/libnml/nml -I$(BASEPWD)/libnml/buffer \ -I$(BASEPWD)/libnml/posemath -I$(BASEPWD)/rtapi -I$(BASEPWD)/hal \ -I$(BASEPWD)/emc/nml_intf -I$(BASEPWD)/emc/kinematics -I$(BASEPWD)/emc/motion \ - -DSEQUENTIAL_SUPPORT -DHAL_SUPPORT -DDYNAMIC_PLCSIZE -DRT_SUPPORT -DOLD_TIMERS_MONOS_SUPPORT -DMODBUS_IO_MASTER \ + -DSEQUENTIAL_SUPPORT -DHAL_SUPPORT -DDYNAMIC_PLCSIZE -DRT_SUPPORT -DOLD_TIMERS_MONOS_SUPPORT -DMODBUS_IO_MASTER \ -fno-fast-math $(call cc-option,-mieee-fp) -fno-unsafe-math-optimizations #not for sim: $(call cc-option,-Wframe-larger-than=2560) @@ -684,7 +684,12 @@ endif # for libwou ifneq ($(WOU_VERSION),) EXTRA_CFLAGS += $(WOU_CFLAGS) -DMOTION_OVER_USB +ifeq ($(BUILD_SYS),sim) LDFLAGS += $(WOU_LIBS) +else +# for kernel module build: +EXTRA_CFLAGS += -I$(BASEPWD)/hal/drivers/ar-usb +endif endif @@ -949,7 +954,7 @@ modules: $(patsubst %.o,../rtlib/%.so,$(obj-m)) $(Q)ld -r -o objects/$*.tmp $^ @if ! $(IS_POWERPC); then objcopy -j .rtapi_export -O binary objects/$*.tmp objects/$*.exp; fi @if ! $(IS_POWERPC); then objcopy -G __i686.get_pc_thunk.bx `xargs -r0n1 echo -G < objects/$*.exp | grep -ve '^-G $$' | sort -u` objects/$*.tmp; fi - $(Q)$(CC) -shared -Bsymbolic -o $@ objects/$*.tmp -lm $(LDFLAGS) + $(Q)$(CC) -shared -Bsymbolic $(LDFLAGS) -o $@ objects/$*.tmp -lm $(sort $(RTDEPS)): depends/rt%.d: %.c @mkdir -p $(dir $@) @@ -982,7 +987,7 @@ $(sort $(RTOBJS)) : objects/rt%.o : %.c ../rtlib/%.o: $(ECHO) Linking $@ - $(Q)ld -r -static -S -Os $(LDFLAGS) -o $@ $^ $(EXTRALINK) $(MATHLIB) + $(Q)ld -r -static -S $(OPT) $(LDFLAGS) -o $@ $^ $(EXTRALINK) $(MATHLIB) endif ifneq "$(filter normal sim,$(BUILD_SYS))" "" diff --git a/src/emc/kinematics/align_gantry_kins.c b/src/emc/kinematics/align_gantry_kins.c index ce41bde53..d2fbe1f98 100644 --- a/src/emc/kinematics/align_gantry_kins.c +++ b/src/emc/kinematics/align_gantry_kins.c @@ -12,8 +12,6 @@ * ********************************************************************/ -#include "string.h" -#include "assert.h" #include "rtapi_math.h" #include "kinematics.h" /* these decls */ @@ -41,17 +39,6 @@ typedef struct { static align_pins_t *align_pins; -// #define THETA (*(align_pins->theta)) -// #define PREV_THETA (align_pins->prev_theta) -// #define PREV_X_OFFSET (align_pins->prev_x_offset) -// #define PREV_Y_OFFSET (align_pins->prev_y_offset) -// #define PREV_X_CENT (align_pins->prev_y_cent) -// #define PREV_Y_CENT (align_pins->prev_x_cent) -// #define X_OFFSET (align_pins->x_offset) -// #define Y_OFFSET (align_pins->y_offset) -// #define X_CENT (align_pins->x_cent) -// #define Y_CENT (align_pins->y_cent) -// #define TOUCH_OFF_CENT (*(align_pins->touch_off_cent)) #define GANTRY_POLARITY (*(align_pins->gantry_polarity)) #define YY_OFFSET (*(align_pins->yy_offset)) @@ -63,48 +50,12 @@ EXPORT_SYMBOL(kinematicsForward); EXPORT_SYMBOL(kinematicsInverse); MODULE_LICENSE("GPL"); -// void cord_change_handler(EmcPose * pos, double * joints) { -// // update XYZ position but keep joint position unchanged -// if (TOUCH_OFF_CENT == 1) { -// X_CENT = joints[0]; -// Y_CENT = joints[1]; -// } -// if (THETA != PREV_THETA || -// TOUCH_OFF_CENT == 1) { -// if (joints[0] == 0 && joints[1] == 0) { -// return; -// } -// // fprintf(stderr, "THETA(%f)\n", THETA); -// // fprintf(stderr, "x-cent(%f) y-cent(%f) x-offset(%f) y-offset(%f)\n", X_CENT, Y_CENT, X_OFFSET, Y_OFFSET); -// // fprintf(stderr, "1:x(%f) y(%f) \nj0(%f) j1(%f)\n", pos->tran.x, pos->tran.y, -// // joints[0], joints[1]); -// pos->tran.x = (joints[0] - X_CENT - X_OFFSET) * cos(THETA) + -// (joints[1] - Y_CENT - Y_OFFSET) * sin(THETA) + X_OFFSET + X_CENT; -// pos->tran.y = -(joints[0] - X_CENT - X_OFFSET)* sin(THETA) + -// (joints[1] - Y_CENT - Y_OFFSET) * cos(THETA) + Y_OFFSET + Y_CENT; -// // fprintf(stderr, "2:x(%f) y(%f) \nj0(%f) j1(%f)\n", pos->tran.x, pos->tran.y, -// // joints[0], joints[1]); -// PREV_THETA = THETA; -// PREV_X_OFFSET = X_OFFSET; -// PREV_Y_OFFSET = Y_OFFSET; -// PREV_X_CENT = X_CENT; -// PREV_Y_CENT = Y_CENT; -// } -// TOUCH_OFF_CENT = 0; -// } - int kinematicsForward(const double *joints, EmcPose * pos, const KINEMATICS_FORWARD_FLAGS * fflags, KINEMATICS_INVERSE_FLAGS * iflags) { - // cord_change_handler((EmcPose *)pos, (double*)joints); - // pos->tran.x = (joints[0] - X_CENT - X_OFFSET) * cos(THETA) + - // (joints[1] - Y_CENT - Y_OFFSET) * sin(THETA) + X_OFFSET + X_CENT; - // pos->tran.y = -(joints[0] - X_CENT - X_OFFSET)* sin(THETA) + - // (joints[1] - Y_CENT - Y_OFFSET) * cos(THETA) + Y_OFFSET + Y_CENT; - pos->tran.x = joints[0]; pos->tran.y = joints[1]; pos->tran.z = joints[3]; @@ -125,31 +76,6 @@ int kinematicsInverse(const EmcPose * pos, const KINEMATICS_INVERSE_FLAGS * iflags, KINEMATICS_FORWARD_FLAGS * fflags) { - // double c_rad = pos->c*M_PI/180; - // double rad, x_cent, y_cent; - // fprintf(stderr,"kI j0(%f) j1(%f) THETA(%f) X_CENT(%f) Y_CENT(%f)\n",joints[0], joints[1], - // THETA, X_CENT, Y_CENT); - // fprintf(stderr,"KI x(%f) y(%f)\n", pos->tran.x, pos->tran.y); - // if (THETA == PREV_THETA) { - // rad = THETA; - // } else { - // rad = PREV_THETA; - // } - // if (X_CENT == PREV_X_CENT) { - // x_cent = X_CENT; - // } else { - // x_cent = PREV_X_CENT; - // } - // if (Y_CENT == PREV_Y_CENT) { - // y_cent = Y_CENT; - // } else { - // y_cent = PREV_Y_CENT; - // } - // joints[0] = (pos->tran.x - x_cent - X_OFFSET) * cos(rad) - - // (pos->tran.y - y_cent - Y_OFFSET) * sin(rad) + X_OFFSET + x_cent; - - // joints[1] = (pos->tran.x - x_cent - X_OFFSET) * sin(rad) + - // (pos->tran.y - y_cent - Y_OFFSET) * cos(rad) + Y_OFFSET + y_cent; joints[0] = pos->tran.x; joints[1] = pos->tran.y; joints[2] = pos->tran.y - (YY_OFFSET * GANTRY_POLARITY); // YY @@ -161,7 +87,6 @@ int kinematicsInverse(const EmcPose * pos, // joints[6] = pos->u; // joints[7] = pos->v; // joints[8] = pos->w; - // fprintf(stderr,"kI j0(%f) j1(%f)\n",joints[0], joints[1]); DP("kINV: x(%f), y(%f), j0(%f), j1(%f), j2(%f), yy_offset(%f)\n", pos->tran.x, pos->tran.y, joints[0], joints[1], joints[2], YY_OFFSET); DP("kINV: s(%f), j5(%f)\n", pos->s, joints[5]); diff --git a/src/emc/kinematics/alignmentkins.c b/src/emc/kinematics/alignmentkins.c index 74d57c2d7..b5a90c929 100644 --- a/src/emc/kinematics/alignmentkins.c +++ b/src/emc/kinematics/alignmentkins.c @@ -60,15 +60,15 @@ void cord_change_handler(EmcPose * pos, double * joints) { Y_OFFSET != PREV_Y_OFFSET || X_CENT != PREV_X_CENT || Y_CENT != PREV_Y_CENT) { - fprintf(stderr, "THETA(%f)\n", THETA); - fprintf(stderr, "x-cent(%f) y-cent(%f) x-offset(%f) y-offset(%f)\n", X_CENT, Y_CENT, X_OFFSET, Y_OFFSET); - fprintf(stderr, "1:x(%f) y(%f) \nj0(%f) j1(%f)\n", pos->tran.x, pos->tran.y, + DP("THETA(%f)\n", THETA); + DP("x-cent(%f) y-cent(%f) x-offset(%f) y-offset(%f)\n", X_CENT, Y_CENT, X_OFFSET, Y_OFFSET); + DP("1:x(%f) y(%f) \nj0(%f) j1(%f)\n", pos->tran.x, pos->tran.y, joints[0], joints[1]); pos->tran.x = (joints[0] - X_CENT - X_OFFSET) * cos(THETA) + (joints[1] - Y_CENT - Y_OFFSET) * sin(THETA) + X_OFFSET + X_CENT; pos->tran.y = -(joints[0] - X_CENT - X_OFFSET)* sin(THETA) + (joints[1] - Y_CENT - Y_OFFSET) * cos(THETA) + Y_OFFSET + Y_CENT; - fprintf(stderr, "2:x(%f) y(%f) \nj0(%f) j1(%f)\n", pos->tran.x, pos->tran.y, + DP("2:x(%f) y(%f) \nj0(%f) j1(%f)\n", pos->tran.x, pos->tran.y, joints[0], joints[1]); PREV_THETA = THETA; PREV_X_OFFSET = X_OFFSET; diff --git a/src/emc/kinematics/dptrace.h b/src/emc/kinematics/dptrace.h index 454d1f929..483c52b51 100644 --- a/src/emc/kinematics/dptrace.h +++ b/src/emc/kinematics/dptrace.h @@ -1,6 +1,9 @@ #ifndef _DPTRACE_H_ #define _DPTRACE_H_ +#ifdef SIM + +// for simulation only: #include #ifndef TRACE @@ -27,4 +30,10 @@ #define DPS(fmt, args...) do {} while(0) #endif +#else +// NOT-SIM +#define DP(fmt, args...) do {} while(0) +#define DPS(fmt, args...) do {} while(0) +#endif // SIM + #endif // _DPTRACE_H_ diff --git a/src/emc/kinematics/tc.c b/src/emc/kinematics/tc.c index bb6bcd196..4a8a90888 100644 --- a/src/emc/kinematics/tc.c +++ b/src/emc/kinematics/tc.c @@ -16,9 +16,16 @@ FIXME-- should include for sizeof(), but conflicts with a bunch of headers */ +#include "config.h" + +#ifdef RTAPI_SIM #include #include #include +#else +#define assert(args...) do {} while(0) +#endif + #include "rtapi.h" /* rtapi_print_msg */ #include "posemath.h" #include "emcpos.h" @@ -150,8 +157,14 @@ void nurbs_basisfun(int i, double u, int p, int j,r, id; double saved, temp, denom; +#ifdef RTAPI_SIM double *left = (double*)malloc(sizeof(double)*(p+1)); double *right = (double*)malloc(sizeof(double)*(p+1)); +#else + #warning "to implement rtai_kmalloc() or static memory chunk for left[] and right[]" + double left[4096]; + double right[4096]; +#endif N[0] = 1.0; for (j = 1; j <= p; j++) @@ -176,8 +189,12 @@ void nurbs_basisfun(int i, double u, int p, N[j] = saved; } +#ifdef RTAPI_SIM free(left); free(right); +#else + #warning "to implement rtai_kmalloc() or static memory chunk for left[] and right[]" +#endif } @@ -608,9 +625,10 @@ int tcqRemove(TC_QUEUE_STRUCT * tcq, int n) (n > tcq->_len)) { /* too many requested */ return -1; } - /* if NURBS ?*/ - for(i=tcq->start;i<(tcq->start+n);i++){ +#ifdef RTAPI_SIM + /* for NURBS only */ + for(i=tcq->start;i<(tcq->start+n);i++){ if(tcq->queue[i].motion_type == TC_NURBS) { //fprintf(stderr,"Remove TCNURBS PARAM\n"); free(tcq->queue[i].nurbs_block.knots_ptr); @@ -619,6 +637,8 @@ int tcqRemove(TC_QUEUE_STRUCT * tcq, int n) } } +#endif + /* update start ptr and reset allFull flag and len */ tcq->start = (tcq->start + n) % tcq->size; tcq->allFull = 0; diff --git a/src/emc/kinematics/tp.c b/src/emc/kinematics/tp.c index d4eda1c0b..4e0208eb2 100644 --- a/src/emc/kinematics/tp.c +++ b/src/emc/kinematics/tp.c @@ -10,6 +10,17 @@ * * Copyright (c) 2004 All rights reserved. ********************************************************************/ +#include "config.h" + +#ifdef RTAPI_SIM +// SIM +#include +#include +#include +#include +#else +#define assert(args...) do {} while(0) +#endif #include "rtapi.h" /* rtapi_print_msg */ #include "rtapi_string.h" /* NULL */ @@ -21,16 +32,12 @@ #include "hal.h" #include "../motion/mot_priv.h" #include "motion_debug.h" -#include -#include -#include // #undef SMLBLND // turn off seamless blending #define SMLBLND // to evaluate seamless blending // to disable DP(): #define TRACE 0 #define TRACE 0 -#include #include "dptrace.h" #if (TRACE!=0) static FILE* dptrace = 0; @@ -712,6 +719,12 @@ int tpAddCircle(TP_STRUCT * tp, EmcPose end, PmCartesian center, // allowed; we are guaranteed to have a move in xyz so target is // always the circle/arc/helical length. +#ifndef RTAPI_SIM +#warning "implement rtai_kmalloc() for nurbs" +static CONTROL_POINT ctrl_pts_array[8192]; +static double knots_array[8192]; +static double N_array[8192]; +#endif int tpAddNURBS(TP_STRUCT *tp, int type, nurbs_block_t nurbs_block, EmcPose pos, unsigned char enables, double vel, double ini_maxvel, @@ -742,15 +755,24 @@ int tpAddNURBS(TP_STRUCT *tp, int type, nurbs_block_t nurbs_block, EmcPose pos, nr_of_ctrl_pts = nurbs_block.nr_of_ctrl_pts; nr_of_knots = nurbs_block.nr_of_knots; - +#ifndef RTAPI_SIM +#warning "implement rtai_kmalloc() for nurbs" + nurbs_to_tc->ctrl_pts_ptr = ctrl_pts_array; + nurbs_to_tc->knots_ptr = knots_array; + nurbs_to_tc->N = N_array; +#else + // SIM nurbs_to_tc->ctrl_pts_ptr = (CONTROL_POINT*) malloc( sizeof(CONTROL_POINT) * nurbs_block.nr_of_ctrl_pts); /* knots array: allocate 'order' of extra knots for THE-NURBS-BOOK-Algorithm */ nurbs_to_tc->knots_ptr = (double*) malloc(sizeof(double) * (nurbs_block.nr_of_knots + nurbs_block.order)); nurbs_to_tc->N = (double*) malloc(sizeof(double) * (order + 1)); +#endif nurbs_to_tc->axis_mask = nurbs_block.axis_mask; + + } if (knots_todo > 0) { diff --git a/src/emc/kinematics/yyzzkins.c b/src/emc/kinematics/yyzzkins.c index 5acc4d3b9..2f8d47343 100644 --- a/src/emc/kinematics/yyzzkins.c +++ b/src/emc/kinematics/yyzzkins.c @@ -9,8 +9,16 @@ * Copyright (c) 2012 All rights reserved. ********************************************************************/ +#ifdef RTAPI_SIM +#include +#include +#include +#include #include "string.h" -#include "assert.h" +#else +#define assert(args...) do {} while(0) +#endif + #include "rtapi_math.h" #include "kinematics.h" /* these decls */ diff --git a/src/emc/motion/control.c b/src/emc/motion/control.c index 2fa83ddaf..09ca08843 100644 --- a/src/emc/motion/control.c +++ b/src/emc/motion/control.c @@ -12,7 +12,17 @@ * * Copyright (c) 2004 All rights reserved. ********************************************************************/ +#include "config.h" + +#ifndef RTAPI_SIM +#define assert(args...) do {} while(0) +#else +// SIM +#include +#include +#include #include +#endif #include "posemath.h" #include "rtapi.h" @@ -25,9 +35,7 @@ #include "tc.h" #include "simple_tp.h" #include "motion_debug.h" -#include "config.h" -#include "assert.h" -#include +#include "sync_cmd.h" // Mark strings for translation, but defer translation to userspace #define _(s) (s) diff --git a/src/emc/motion/motion.c b/src/emc/motion/motion.c index 9de425e4d..55eaafeae 100644 --- a/src/emc/motion/motion.c +++ b/src/emc/motion/motion.c @@ -20,7 +20,7 @@ #include "motion_struct.h" #include "mot_priv.h" #include "rtapi_math.h" -#include +#include "sync_cmd.h" // Mark strings for translation, but defer translation to userspace #define _(s) (s) diff --git a/src/emc/motion/motion.h b/src/emc/motion/motion.h index 174f9da08..644bfc5a0 100644 --- a/src/emc/motion/motion.h +++ b/src/emc/motion/motion.h @@ -71,6 +71,7 @@ to another. #ifndef MOTION_H #define MOTION_H +#include "config.h" #include "posemath.h" /* PmCartesian, PmPose, pmCartMag() */ #include "emcpos.h" /* EmcPose */ #include "cubic.h" /* CUBIC_STRUCT, CUBIC_COEFF */ @@ -81,6 +82,12 @@ to another. #include "rtapi_limits.h" #include +#ifdef RTAPI_SIM +#include +#else +#define uint32_t __u32 +#endif + // define a special value to denote an invalid motion ID // NB: do not ever generate a motion id of MOTION_INVALID_ID diff --git a/src/emc/motion/simple_tp.c b/src/emc/motion/simple_tp.c index ec1d0a373..fb05030fa 100644 --- a/src/emc/motion/simple_tp.c +++ b/src/emc/motion/simple_tp.c @@ -10,12 +10,16 @@ * Copyright (c) 2004 All rights reserved. ********************************************************************/ +#ifdef RTAPI_SIM #include -#include #include +#include +#include #include #include -#include +#else +#define assert(args...) do {} while(0) +#endif #include "simple_tp.h" #include "rtapi_math.h" diff --git a/src/emc/motion/usb_homing.c b/src/emc/motion/usb_homing.c index 2bfb53c08..fcd643058 100644 --- a/src/emc/motion/usb_homing.c +++ b/src/emc/motion/usb_homing.c @@ -11,18 +11,23 @@ * Copyright (c) 2004 All rights reserved. * ********************************************************************/ +#ifdef RTAPI_SIM +#include +#include +#include +#include +#else +#define assert(args...) do {} while(0) +#endif #include "rtapi.h" #include "hal.h" #include "motion.h" #include "mot_priv.h" #include "rtapi_math.h" -#include #include -#include #include -#include -#include +#include "sync_cmd.h" // Mark strings for translation, but defer translation to userspace #define _(s) (s) diff --git a/src/emc/usr_intf/Submakefile b/src/emc/usr_intf/Submakefile index 6990bdad0..ab3ef955a 100644 --- a/src/emc/usr_intf/Submakefile +++ b/src/emc/usr_intf/Submakefile @@ -2,7 +2,7 @@ EMCSHSRCS := emc/usr_intf/emcsh.cc \ emc/usr_intf/shcom.cc EMCRSHSRCS := emc/usr_intf/emcrsh.cc \ emc/usr_intf/shcom.cc -LCOMSRCS := emc/usr_intf/linuxcnc_over_modbus.cc \ +# LCOMSRCS := emc/usr_intf/linuxcnc_over_modbus.cc \ emc/usr_intf/shcom.cc EMCSCHEDSRCS := emc/usr_intf/schedrmt.cc \ emc/usr_intf/emcsched.cc \ @@ -20,7 +20,8 @@ XEMCSRCS := emc/usr_intf/xemc.cc endif TCLSRCS := emc/usr_intf/emcsh.cc emc/usr_intf/iosh.cc -USERSRCS += $(EMCSHSRCS) $(EMCRSHSRCS) $(LCOMSRCS) $(EMCSCHEDSRCS) $(EMCLCDSRCS) $(USRMOTSRCS) $(HALUISRCS) $(KEYSTICKSRCS) +# USERSRCS += $(EMCSHSRCS) $(EMCRSHSRCS) $(LCOMSRCS) $(EMCSCHEDSRCS) $(EMCLCDSRCS) $(USRMOTSRCS) $(HALUISRCS) $(KEYSTICKSRCS) +USERSRCS += $(EMCSHSRCS) $(EMCRSHSRCS) $(EMCSCHEDSRCS) $(EMCLCDSRCS) $(USRMOTSRCS) $(HALUISRCS) $(KEYSTICKSRCS) ifeq "$(HAVE_NCURSES)" "yes" USERSRCS += $(KEYSTICKSRCS) @@ -32,7 +33,7 @@ endif $(call TOOBJSDEPS, $(TCLSRCS)) : EXTRAFLAGS = $(ULFLAGS) $(TCL_CFLAGS) $(call TOOBJSDEPS, $(EMCSHSRCS)) : EXTRAFLAGS = $(ULFLAGS) $(TCL_CFLAGS) -fPIC -$(call TOOBJSDEPS, $(LCOMSRCS)) : EXTRAFLAGS = $(LIBMODBUS_CFLAGS) +# $(call TOOBJSDEPS, $(LCOMSRCS)) : EXTRAFLAGS = $(LIBMODBUS_CFLAGS) ../bin/tooledit: emc/usr_intf/tooledit.tcl cp $< $@ @@ -49,10 +50,10 @@ TARGETS += ../tcl/linuxcnc.so $(Q)$(CXX) $(LDFLAGS) -o $@ $(ULFLAGS) $^ -lpthread TARGETS += ../bin/linuxcncrsh -../bin/linuxcnc_over_modbus: $(call TOOBJS, $(LCOMSRCS)) ../lib/liblinuxcnc.a ../lib/libnml.so.0 ../lib/liblinuxcncini.so.0 - $(ECHO) Linking $(notdir $@) - $(Q)$(CXX) $(LDFLAGS) -o $@ $(ULFLAGS) $^ -lpthread $(LIBMODBUS_LIBS) -lrt -TARGETS += ../bin/linuxcnc_over_modbus +# ../bin/linuxcnc_over_modbus: $(call TOOBJS, $(LCOMSRCS)) ../lib/liblinuxcnc.a ../lib/libnml.so.0 ../lib/liblinuxcncini.so.0 +# $(ECHO) Linking $(notdir $@) +# $(Q)$(CXX) $(LDFLAGS) -o $@ $(ULFLAGS) $^ -lpthread $(LIBMODBUS_LIBS) -lrt +# TARGETS += ../bin/linuxcnc_over_modbus ../bin/schedrmt: $(call TOOBJS, $(EMCSCHEDSRCS)) ../lib/liblinuxcnc.a ../lib/libnml.so.0 ../lib/liblinuxcncini.so.0 $(ECHO) Linking $(notdir $@) diff --git a/src/hal/classicladder/module_hal.c b/src/hal/classicladder/module_hal.c index 74e6cbb96..05ae7e71e 100644 --- a/src/hal/classicladder/module_hal.c +++ b/src/hal/classicladder/module_hal.c @@ -23,9 +23,7 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "unistd.h" -#include "stdio.h" -#include "stdlib.h" + #include "rtapi.h" #include "rtapi_app.h" #include "rtapi_errno.h" @@ -81,7 +79,6 @@ extern StrGeneralParams GeneralParamsMirror; #define TIME_REFRESH_RUNG_NS (1000 * 1000 * (TIME_REFRESH_RUNG_MS)) - void HalReadPhysicalInputs(void) { int i; for( i=0; iGeneralParams.SizesInfos.nbr_phys_inputs; i++) { @@ -134,14 +131,14 @@ void HalWriteFloatOutputs(void) { // your timer are using multiples of 100 microseconds they might not be accurate. // t0 and t1 are for keeping track of how long the refresh of sections, // and HAL pins take (it is displayed in the 'section display' GUI (in microseconds). -static long last_period; + static void hal_task(void *arg, long period) { unsigned long t0, t1,milliseconds; static unsigned long leftover=0; leftover += period; milliseconds= leftover / 1000000; leftover %= 1000000; - last_period = period; + if (milliseconds >= 1) { InfosGene->GeneralParams.PeriodicRefreshMilliSecs=milliseconds; *hal_state = InfosGene->LadderState; diff --git a/src/hal/drivers/ar-usb/wou_stepgen.c b/src/hal/drivers/ar-usb/wou_stepgen.c index 501ca6f5a..a27c4ba9f 100644 --- a/src/hal/drivers/ar-usb/wou_stepgen.c +++ b/src/hal/drivers/ar-usb/wou_stepgen.c @@ -10,10 +10,20 @@ * * Last change: ********************************************************************/ +#include "config.h" -#ifndef RTAPI -#error This is a realtime component only! -#endif +#ifndef RTAPI_SIM +#error "this module for user space simulator only" +#else +// SIM +#include +#include +#include +#include +#include +#include +#include +#include #include "rtapi.h" /* RTAPI realtime OS API */ #include "rtapi_app.h" /* RTAPI realtime module decls */ @@ -22,16 +32,8 @@ #include #include #include -#include -#include #include "rtapi_math.h" #include "motion.h" -#include -#include -#include -#include -#include -#include #include #include @@ -2423,4 +2425,6 @@ static int export_machine_control(machine_control_t * machine_control) return 0; } +#endif // RTAPI_SIM + // vim:sw=4:sts=4:et: