From da96794fd2f96ec23d88a51a891110ab72d1fac7 Mon Sep 17 00:00:00 2001 From: ARAIS BOROT TECHNOLOGY Date: Wed, 8 May 2013 07:53:17 -0700 Subject: [PATCH] Modify araisrobo repository for compiling with RTAI --- src/Makefile | 13 +++-- src/emc/kinematics/align_gantry_kins.c | 77 -------------------------- src/emc/kinematics/alignmentkins.c | 8 +-- src/emc/kinematics/dptrace.h | 9 +++ src/emc/kinematics/tc.c | 24 +++++++- src/emc/kinematics/tp.c | 31 +++++++++-- src/emc/kinematics/yyzzkins.c | 11 +++- src/emc/motion/command.c | 14 +++-- src/emc/motion/control.c | 43 ++++---------- src/emc/motion/motion.c | 2 +- src/emc/motion/motion.h | 6 ++ src/emc/motion/simple_tp.c | 9 ++- src/emc/motion/usb_homing.c | 14 +++-- src/emc/nml_intf/nurbs.h | 15 ++--- src/emc/usr_intf/Submakefile | 15 ++--- src/hal/classicladder/module_hal.c | 9 +-- src/hal/drivers/ar-usb/wou_sim.c | 9 ++- src/hal/drivers/ar-usb/wou_stepgen.c | 25 +++++---- 18 files changed, 162 insertions(+), 172 deletions(-) diff --git a/src/Makefile b/src/Makefile index 4a7820b70..b802bcd86 100644 --- a/src/Makefile +++ b/src/Makefile @@ -406,7 +406,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 @@ -664,7 +664,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) @@ -679,7 +679,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 @@ -932,7 +937,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 $@) @@ -965,7 +970,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 62393f9e5..aaf1480eb 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]; @@ -112,8 +63,6 @@ int kinematicsForward(const double *joints, pos->b = joints[5]; pos->c = joints[6]; - // YY_OFFSET = joints[1] - (joints[2] * GANTRY_POLARITY); - DP("kFWD: x(%f), y(%f), j0(%f), j1(%f), j2(%f), yy_offset(%f),POLARITY(%f)\n", pos->tran.x, pos->tran.y, joints[0], joints[1], joints[2], YY_OFFSET, GANTRY_POLARITY); @@ -125,31 +74,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 @@ -160,7 +84,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), POLARITY(%f) \n", pos->tran.x, pos->tran.y, joints[0], joints[1], joints[2], YY_OFFSET, GANTRY_POLARITY); 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 dd74de686..fb9232f21 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 */ + +#ifdef RTAPI +#define assert(args...) do {} while(0) +#else +// SIM #include #include #include +#endif + #include "rtapi.h" /* rtapi_print_msg */ #include "posemath.h" #include "emcpos.h" @@ -62,8 +69,14 @@ void nurbs_basisfun(int i, double u, int p, int j,r; double saved, temp; +#ifndef RTAPI 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++) @@ -82,8 +95,12 @@ void nurbs_basisfun(int i, double u, int p, N[j] = saved; } +#ifndef RTAPI free(left); free(right); +#else + #warning "to implement rtai_kmalloc() or static memory chunk for left[] and right[]" +#endif } @@ -584,9 +601,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++){ +#ifndef RTAPI + /* 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); @@ -595,6 +613,8 @@ int tcqRemove(TC_QUEUE_STRUCT * tcq, int n) } } +#endif //RTAPI + /* 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 505a92fa2..b261f7680 100644 --- a/src/emc/kinematics/tp.c +++ b/src/emc/kinematics/tp.c @@ -11,6 +11,16 @@ * Copyright (c) 2004 All rights reserved. ********************************************************************/ +#ifdef RTAPI +#define assert(args...) do {} while(0) +#else +// SIM +#include +#include +#include +#include +#endif + #include "rtapi.h" /* rtapi_print_msg */ #include "rtapi_string.h" /* NULL */ #include "posemath.h" @@ -21,16 +31,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; @@ -641,6 +647,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. +#ifdef RTAPI +#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, @@ -671,14 +683,23 @@ 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; - +#ifdef RTAPI +#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); nurbs_to_tc->knots_ptr = (double*) malloc(sizeof(double) * nurbs_block.nr_of_knots); nurbs_to_tc->N = (double*) malloc(sizeof(double) * (order + 1)); +#endif nurbs_to_tc->axis_mask = nurbs_block.axis_mask; + + } if (knots_todo > 0) { if (knots_todo > (nr_of_knots - nr_of_ctrl_pts)) { // this part add ctrl pts and knots diff --git a/src/emc/kinematics/yyzzkins.c b/src/emc/kinematics/yyzzkins.c index 5acc4d3b9..41fbdc6b4 100644 --- a/src/emc/kinematics/yyzzkins.c +++ b/src/emc/kinematics/yyzzkins.c @@ -9,8 +9,17 @@ * Copyright (c) 2012 All rights reserved. ********************************************************************/ +#ifdef RTAPI +#define assert(args...) do {} while(0) +#else +// SIM +#include +#include +#include +#include #include "string.h" -#include "assert.h" +#endif + #include "rtapi_math.h" #include "kinematics.h" /* these decls */ diff --git a/src/emc/motion/command.c b/src/emc/motion/command.c index ecc7c6647..dad4fdedd 100644 --- a/src/emc/motion/command.c +++ b/src/emc/motion/command.c @@ -53,6 +53,13 @@ * * Copyright (c) 2004 All rights reserved. ********************************************************************/ +#ifdef RTAPI +#define assert(args...) do {} while(0) +#else +// SIM +#include "stdio.h" +#include "assert.h" +#endif #include #include @@ -66,9 +73,7 @@ #include "mot_priv.h" #include "rtapi_math.h" #include "motion_types.h" -#include "stdio.h" -#include "assert.h" -#include +#include "sync_cmd.h" // Mark strings for translation, but defer translation to userspace #define _(s) (s) @@ -1509,8 +1514,6 @@ void emcmotCommandHandler(void *arg, long period) emcmotStatus->usb_cmd |= PROBE_CMD_TYPE; emcmotStatus->usb_cmd_param[0] = (double) USB_CMD_PROBE_LOW; rtapi_print_msg(RTAPI_MSG_INFO, "USB_CMD_PROBE_LOW"); - printf("USB_CMD_PROBE_LOW\n"); - } else { // G38.2, G38.3 @@ -1518,7 +1521,6 @@ void emcmotCommandHandler(void *arg, long period) emcmotStatus->usb_cmd |= PROBE_CMD_TYPE; emcmotStatus->usb_cmd_param[0] = (double) USB_CMD_PROBE_HIGH; rtapi_print_msg(RTAPI_MSG_INFO, "USB_CMD_PROBE_HIGH"); - printf("USB_CMD_PROBE_HIGH\n"); } rtapi_print_msg(RTAPI_MSG_DBG, "usb_cmd(0x%0x) usb_cmd_param(%f)\n", emcmotStatus->usb_cmd, emcmotStatus->usb_cmd_param[0]); diff --git a/src/emc/motion/control.c b/src/emc/motion/control.c index 3f9afb44c..941653c2c 100644 --- a/src/emc/motion/control.c +++ b/src/emc/motion/control.c @@ -12,7 +12,15 @@ * * Copyright (c) 2004 All rights reserved. ********************************************************************/ +#ifdef RTAPI +#define assert(args...) do {} while(0) +#else +// SIM +#include +#include +#include #include +#endif #include "posemath.h" #include "rtapi.h" @@ -26,8 +34,7 @@ #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) @@ -771,36 +778,8 @@ static void process_probe_inputs(void) static int update_current_pos = 0; static void handle_special_cmd(void) { - if (update_current_pos == 1) { - DP("update_current_pos(%d)\n", update_current_pos); - - /* sync current pos-cmd with pos-fb */ - update_current_pos = 0; - emcmotStatus->update_current_pos_flag = 1; - emcmotDebug->coord_tp.currentPos = emcmotStatus->carte_pos_fb; - - emcmotStatus->special_cmd = SPEC_CMD_ACK; - /* tell USB that we've got the status */ - emcmotStatus->usb_cmd &= ~(0x0008); - emcmotStatus->usb_cmd |= SPECIAL_CMD_TYPE; - emcmotStatus->usb_cmd_param[0] = emcmotStatus->special_cmd; - - printf("ERROR: handle_special_cmd(): update_current_pos(1)\n"); - assert(0); - - } else { - emcmotStatus->update_current_pos_flag = 0; - } - - if (*emcmot_hal_data->req_cmd_sync == 1) { - DP("req_cmd_sync(%d)\n", *emcmot_hal_data->req_cmd_sync); - emcmotStatus->sync_pos_cmd = 1; - update_current_pos = 1; - printf("ERROR: handle_special_cmd(): req_cmd_sync(1)\n"); - assert(0); - } else { - emcmotStatus->sync_pos_cmd = 0; - } + emcmotStatus->update_current_pos_flag = 0; + emcmotStatus->sync_pos_cmd = 0; if (emcmotStatus->depth == 0) { // not at EMCMOT_MOTION_COORD mode diff --git a/src/emc/motion/motion.c b/src/emc/motion/motion.c index d8db91e39..51fb6b487 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 2af900783..5847b71cd 100644 --- a/src/emc/motion/motion.h +++ b/src/emc/motion/motion.h @@ -81,6 +81,12 @@ to another. #include "rtapi_limits.h" #include +#ifdef RTAPI +#define uint32_t __u32 +#else +#include +#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..c4c0ff32c 100644 --- a/src/emc/motion/simple_tp.c +++ b/src/emc/motion/simple_tp.c @@ -10,12 +10,17 @@ * Copyright (c) 2004 All rights reserved. ********************************************************************/ +#ifdef RTAPI +#define assert(args...) do {} while(0) +#else +// SIM #include -#include #include +#include +#include #include #include -#include +#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 8e1f1fc1c..915f492d7 100644 --- a/src/emc/motion/usb_homing.c +++ b/src/emc/motion/usb_homing.c @@ -11,18 +11,24 @@ * Copyright (c) 2004 All rights reserved. * ********************************************************************/ +#ifdef RTAPI +#define assert(args...) do {} while(0) +#else +// SIM +#include +#include +#include +#include +#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/nml_intf/nurbs.h b/src/emc/nml_intf/nurbs.h index 880c6fc4f..bc6fe5dee 100644 --- a/src/emc/nml_intf/nurbs.h +++ b/src/emc/nml_intf/nurbs.h @@ -7,7 +7,8 @@ #ifndef NURBS_H_ #define NURBS_H_ -#include +// #include +#include "rtapi.h" /* RTAPI realtime OS API */ typedef struct { /* type for NURBS control points */ double X, @@ -30,20 +31,20 @@ typedef struct { } PLANE_POINT; /*typedef struct { double uofl_knot; - uint32_t uofl_knot_flag; + __u32 uofl_knot_flag; double uofl_weight; - uint32_t uofl_weight_flag; + __u32 uofl_weight_flag; double uofl_ctrl_pt; - uint32_t uofl_ctrl_pt_flag; + __u32 uofl_ctrl_pt_flag; } uofl_block_t;*/ typedef struct { // NURBS curve paramters CONTROL_POINT *ctrl_pts_ptr; - uint32_t nr_of_ctrl_pts; + __u32 nr_of_ctrl_pts; double *knots_ptr; - uint32_t nr_of_knots; - uint32_t order; + __u32 nr_of_knots; + __u32 order; double curve_len; double curvature; double knot; 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_sim.c b/src/hal/drivers/ar-usb/wou_sim.c index 9942d9a6f..1c4567b45 100644 --- a/src/hal/drivers/ar-usb/wou_sim.c +++ b/src/hal/drivers/ar-usb/wou_sim.c @@ -116,9 +116,10 @@ information, go to www.linuxcnc.org. */ -#ifndef RTAPI -#error This is a realtime component only! -#endif +#ifdef RTAPI +#warning "this for user space only" +#else +// SIM #include "rtapi.h" /* RTAPI realtime OS API */ #include "rtapi_app.h" /* RTAPI realtime module decls */ @@ -2140,5 +2141,7 @@ static int export_machine_control(machine_control_t * machine_control) return 0; } +#endif // else-RTAPI + // vim:sw=4:sts=4:et: diff --git a/src/hal/drivers/ar-usb/wou_stepgen.c b/src/hal/drivers/ar-usb/wou_stepgen.c index 7dacade21..50a5d133b 100644 --- a/src/hal/drivers/ar-usb/wou_stepgen.c +++ b/src/hal/drivers/ar-usb/wou_stepgen.c @@ -11,9 +11,18 @@ * Last change: ********************************************************************/ -#ifndef RTAPI -#error This is a realtime component only! -#endif +#ifdef RTAPI +#warning "this is for user space 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 +31,8 @@ #include #include #include -#include -#include #include "rtapi_math.h" #include "motion.h" -#include -#include -#include -#include -#include -#include #include #include @@ -2500,5 +2501,7 @@ static int export_machine_control(machine_control_t * machine_control) return 0; } +#endif // else-RTAPI + // vim:sw=4:sts=4:et: