From 26f1abed77d14ae721edc2a4407aec00e1e61cc1 Mon Sep 17 00:00:00 2001 From: Bertho Stultiens Date: Thu, 20 Feb 2025 20:11:52 +0100 Subject: [PATCH] Fix unused parameters, signed/unsigned warnings and missing initialization. --- src/emc/kinematics/5axiskins.c | 4 + src/emc/kinematics/corexykins.c | 4 + src/emc/kinematics/cubic.c | 1 + src/emc/kinematics/genhexkins.c | 7 +- src/emc/kinematics/kinematics.h | 2 +- src/emc/kinematics/kins_util.c | 5 + src/emc/kinematics/lineardeltakins.c | 4 + src/emc/kinematics/maxkins.c | 4 + src/emc/kinematics/pentakins.c | 6 +- src/emc/kinematics/pumakins.c | 2 + src/emc/kinematics/rosekins.c | 4 + src/emc/kinematics/rotarydeltakins.c | 4 + src/emc/kinematics/rotatekins.c | 4 + src/emc/kinematics/scarakins.c | 2 + src/emc/kinematics/scorbot-kins.c | 4 + src/emc/kinematics/tripodkins.c | 2 + src/emc/kinematics/trtfuncs.c | 8 ++ src/emc/motion/command.c | 1 + src/emc/motion/control.c | 3 +- src/emc/tp/blendmath.c | 13 +++ src/emc/tp/spherical_arc.c | 1 + src/emc/tp/tp.c | 13 ++- src/hal/classicladder/arrays.c | 1 + src/hal/classicladder/module_hal.c | 1 + src/hal/components/boss_plc.c | 5 +- src/hal/components/counter.c | 1 + src/hal/components/debounce.c | 1 + src/hal/components/encoder.c | 1 + src/hal/components/encoder_ratio.c | 3 + src/hal/components/enum.c | 2 + src/hal/components/lcd.c | 3 +- src/hal/components/matrix_kb.c | 35 +++--- src/hal/components/modmath.c | 1 + src/hal/components/mux_generic.c | 10 +- src/hal/components/pwmgen.c | 3 +- src/hal/components/sampler.c | 1 + src/hal/components/sim_encoder.c | 1 + src/hal/components/stepgen.c | 1 + src/hal/components/streamer.c | 1 + src/hal/components/supply.c | 1 + src/hal/components/watchdog.c | 3 + src/hal/components/weighted_sum.c | 1 + src/hal/drivers/hal_bb_gpio.c | 2 + src/hal/drivers/hal_gm.c | 18 +-- src/hal/drivers/hal_parport.c | 2 + src/hal/drivers/hal_pi_gpio.c | 4 + src/hal/drivers/hal_ppmc.c | 4 +- src/hal/drivers/hal_speaker.c | 1 + src/hal/drivers/mesa-hostmot2/abs_encoder.c | 2 + src/hal/drivers/mesa-hostmot2/bitfile.c | 8 +- src/hal/drivers/mesa-hostmot2/bitfile.h | 2 +- src/hal/drivers/mesa-hostmot2/bspi.c | 6 +- src/hal/drivers/mesa-hostmot2/dpll.c | 1 + src/hal/drivers/mesa-hostmot2/encoder.c | 1 + src/hal/drivers/mesa-hostmot2/hm2_7i43.c | 7 +- src/hal/drivers/mesa-hostmot2/hm2_7i90.c | 7 +- src/hal/drivers/mesa-hostmot2/hm2_eth.c | 4 +- src/hal/drivers/mesa-hostmot2/hm2_pci.c | 6 +- src/hal/drivers/mesa-hostmot2/hm2_rpspi.c | 6 +- src/hal/drivers/mesa-hostmot2/hm2_spix.c | 12 +- src/hal/drivers/mesa-hostmot2/hm2_test.c | 7 ++ .../drivers/mesa-hostmot2/hostmot2-lowlevel.h | 4 +- src/hal/drivers/mesa-hostmot2/hostmot2.c | 18 +-- src/hal/drivers/mesa-hostmot2/inmux.c | 21 ++-- src/hal/drivers/mesa-hostmot2/ioport.c | 18 +-- src/hal/drivers/mesa-hostmot2/llio_info.c | 7 +- src/hal/drivers/mesa-hostmot2/outm.c | 2 +- src/hal/drivers/mesa-hostmot2/pins.c | 5 +- src/hal/drivers/mesa-hostmot2/pktuart.c | 4 +- src/hal/drivers/mesa-hostmot2/resolver.c | 2 + src/hal/drivers/mesa-hostmot2/setsserial.c | 18 +-- src/hal/drivers/mesa-hostmot2/spix_rpi3.c | 2 +- src/hal/drivers/mesa-hostmot2/sserial.c | 15 ++- src/hal/drivers/mesa-hostmot2/sserial.h | 106 +++++++++--------- src/hal/drivers/mesa-hostmot2/ssr.c | 2 +- src/hal/drivers/mesa-hostmot2/stepgen.c | 3 +- src/hal/drivers/mesa-hostmot2/uart.c | 2 + src/hal/drivers/mesa-hostmot2/xy2mod.c | 4 +- src/hal/hal_lib.c | 4 +- src/hal/utils/scope_rt.c | 6 +- src/rtapi/rtapi_device.h | 2 +- 81 files changed, 330 insertions(+), 189 deletions(-) diff --git a/src/emc/kinematics/5axiskins.c b/src/emc/kinematics/5axiskins.c index 565f41abe4b..8f29969c3c5 100644 --- a/src/emc/kinematics/5axiskins.c +++ b/src/emc/kinematics/5axiskins.c @@ -101,6 +101,8 @@ static int fiveaxis_KinematicsForward(const double *joints, const KINEMATICS_FORWARD_FLAGS * fflags, KINEMATICS_INVERSE_FLAGS * iflags) { + (void)fflags; + (void)iflags; PmCartesian r = s2r(*(haldata->pivot_length) + joints[JW], joints[JC], 180.0 - joints[JB]); @@ -126,6 +128,8 @@ static int fiveaxis_KinematicsInverse(const EmcPose * pos, const KINEMATICS_INVERSE_FLAGS * iflags, KINEMATICS_FORWARD_FLAGS * fflags) { + (void)iflags; + (void)fflags; PmCartesian r = s2r(*(haldata->pivot_length) + pos->w, pos->c, 180.0 - pos->b); diff --git a/src/emc/kinematics/corexykins.c b/src/emc/kinematics/corexykins.c index ea3510b6987..acead1d061e 100644 --- a/src/emc/kinematics/corexykins.c +++ b/src/emc/kinematics/corexykins.c @@ -22,6 +22,8 @@ int kinematicsForward(const double *joints ,const KINEMATICS_FORWARD_FLAGS *fflags ,KINEMATICS_INVERSE_FLAGS *iflags ) { + (void)fflags; + (void)iflags; pos->tran.x = 0.5 * (joints[0] + joints[1]); pos->tran.y = 0.5 * (joints[0] - joints[1]); pos->tran.z = joints[2]; @@ -40,6 +42,8 @@ int kinematicsInverse(const EmcPose *pos ,const KINEMATICS_INVERSE_FLAGS *iflags ,KINEMATICS_FORWARD_FLAGS *fflags ) { + (void)iflags; + (void)fflags; joints[0] = pos->tran.x + pos->tran.y; joints[1] = pos->tran.x - pos->tran.y; joints[2] = pos->tran.z; diff --git a/src/emc/kinematics/cubic.c b/src/emc/kinematics/cubic.c index c3d4a322cc4..54ce4eb6bde 100644 --- a/src/emc/kinematics/cubic.c +++ b/src/emc/kinematics/cubic.c @@ -88,6 +88,7 @@ static double interpolateAccel(CUBIC_COEFF coeff, double t) */ static double interpolateJerk(CUBIC_COEFF coeff, double t) { + (void)t; return 6.0 * coeff.a; } diff --git a/src/emc/kinematics/genhexkins.c b/src/emc/kinematics/genhexkins.c index 105027ca2f7..b4f08116371 100644 --- a/src/emc/kinematics/genhexkins.c +++ b/src/emc/kinematics/genhexkins.c @@ -329,6 +329,8 @@ static int genhexKinematicsForward(const double * joints, const KINEMATICS_FORWARD_FLAGS * fflags, KINEMATICS_INVERSE_FLAGS * iflags) { + (void)fflags; + (void)iflags; PmCartesian aw; PmCartesian InvKinStrutVect,InvKinStrutVectUnit; PmCartesian q_trans, RMatrix_a, RMatrix_a_cross_Strut; @@ -345,7 +347,7 @@ static int genhexKinematicsForward(const double * joints, int iterate = 1; int i; - int iteration = 0; + unsigned iteration = 0; genhex_read_hal_pins(); @@ -491,6 +493,8 @@ static int genhexKinematicsInverse(const EmcPose * pos, const KINEMATICS_INVERSE_FLAGS * iflags, KINEMATICS_FORWARD_FLAGS * fflags) { + (void)iflags; + (void)fflags; PmCartesian aw, temp; PmCartesian InvKinStrutVect, InvKinStrutVectUnit; @@ -541,6 +545,7 @@ int genhexKinematicsSetup(const int comp_id, const char* coordinates, kparms* kp) { + (void)coordinates; int i,res=0; haldata = hal_malloc(sizeof(struct haldata)); diff --git a/src/emc/kinematics/kinematics.h b/src/emc/kinematics/kinematics.h index 1564ea90b53..87ce7aaf3bc 100644 --- a/src/emc/kinematics/kinematics.h +++ b/src/emc/kinematics/kinematics.h @@ -165,7 +165,7 @@ extern int kinematicsSwitch(int switchkins_type); #define KINS_NOT_SWITCHABLE \ extern int kinematicsSwitchable() {return 0;} \ -extern int kinematicsSwitch(int switchkins_type) {return 0;} \ +extern int kinematicsSwitch(int switchkins_type) { (void)switchkins_type; return 0;} \ EXPORT_SYMBOL(kinematicsSwitchable); \ EXPORT_SYMBOL(kinematicsSwitch); diff --git a/src/emc/kinematics/kins_util.c b/src/emc/kinematics/kins_util.c index a53e4958234..19f37d6317c 100644 --- a/src/emc/kinematics/kins_util.c +++ b/src/emc/kinematics/kins_util.c @@ -283,6 +283,7 @@ int identityKinematicsSetup(const int comp_id, const char* coordinates, kparms* kp) { + (void)comp_id; int axis_idx_for_jno[EMCMOT_MAX_JOINTS]; int jno; int show=0; @@ -330,6 +331,8 @@ int identityKinematicsForward(const double *joints, const KINEMATICS_FORWARD_FLAGS * fflags, KINEMATICS_INVERSE_FLAGS * iflags) { + (void)fflags; + (void)iflags; if (!identity_kinematics_initialized) { rtapi_print_msg(RTAPI_MSG_ERR, "identityKinematicsForward: not initialized\n"); @@ -346,6 +349,8 @@ int identityKinematicsInverse(const EmcPose * pos, const KINEMATICS_INVERSE_FLAGS * iflags, KINEMATICS_FORWARD_FLAGS * fflags) { + (void)iflags; + (void)fflags; if (!identity_kinematics_initialized) { rtapi_print_msg(RTAPI_MSG_ERR, "identityKinematicsInverse: not initialized\n"); diff --git a/src/emc/kinematics/lineardeltakins.c b/src/emc/kinematics/lineardeltakins.c index ab0fd7098e2..32e00385c9a 100644 --- a/src/emc/kinematics/lineardeltakins.c +++ b/src/emc/kinematics/lineardeltakins.c @@ -32,6 +32,8 @@ int kinematicsForward(const double * joints, EmcPose * pos, const KINEMATICS_FORWARD_FLAGS * fflags, KINEMATICS_INVERSE_FLAGS * iflags) { + (void)fflags; + (void)iflags; set_geometry(*haldata->r, *haldata->l); return kinematics_forward(joints, pos); } @@ -39,6 +41,8 @@ int kinematicsForward(const double * joints, int kinematicsInverse(const EmcPose *pos, double *joints, const KINEMATICS_INVERSE_FLAGS *iflags, KINEMATICS_FORWARD_FLAGS *fflags) { + (void)iflags; + (void)fflags; set_geometry(*haldata->r, *haldata->l); return kinematics_inverse(pos, joints); } diff --git a/src/emc/kinematics/maxkins.c b/src/emc/kinematics/maxkins.c index 6f7b82a0164..d538f7acca6 100644 --- a/src/emc/kinematics/maxkins.c +++ b/src/emc/kinematics/maxkins.c @@ -39,6 +39,8 @@ int kinematicsForward(const double *joints, const KINEMATICS_FORWARD_FLAGS * fflags, KINEMATICS_INVERSE_FLAGS * iflags) { + (void)fflags; + (void)iflags; // B correction double zb = (*(haldata->pivot_length) + joints[8]) * cos(d2r(joints[4])); double xb = (*(haldata->pivot_length) + joints[8]) * sin(d2r(joints[4])); @@ -72,6 +74,8 @@ int kinematicsInverse(const EmcPose * pos, const KINEMATICS_INVERSE_FLAGS * iflags, KINEMATICS_FORWARD_FLAGS * fflags) { + (void)iflags; + (void)fflags; // B correction double zb = (*(haldata->pivot_length) + pos->w) * cos(d2r(pos->b)); double xb = (*(haldata->pivot_length) + pos->w) * sin(d2r(pos->b)); diff --git a/src/emc/kinematics/pentakins.c b/src/emc/kinematics/pentakins.c index 544309c40f9..a1dcd9923e0 100644 --- a/src/emc/kinematics/pentakins.c +++ b/src/emc/kinematics/pentakins.c @@ -242,6 +242,8 @@ int kinematicsForward(const double * joints, const KINEMATICS_FORWARD_FLAGS * fflags, KINEMATICS_INVERSE_FLAGS * iflags) { + (void)fflags; + (void)iflags; // PmCartesian aw; // PmCartesian InvKinStrutVect,InvKinStrutVectUnit; @@ -260,7 +262,7 @@ int kinematicsForward(const double * joints, int iterate = 1; int i, j; - int iteration = 0; + unsigned iteration = 0; pentakins_read_hal_pins(); @@ -372,6 +374,8 @@ int kinematicsInverse(const EmcPose * pos, const KINEMATICS_INVERSE_FLAGS * iflags, KINEMATICS_FORWARD_FLAGS * fflags) { + (void)iflags; + (void)fflags; double coord[NUM_STRUTS]; diff --git a/src/emc/kinematics/pumakins.c b/src/emc/kinematics/pumakins.c index 4517951c55e..1ec29dd43e0 100644 --- a/src/emc/kinematics/pumakins.c +++ b/src/emc/kinematics/pumakins.c @@ -40,6 +40,7 @@ static int pumaKinematicsForward(const double * joint, const KINEMATICS_FORWARD_FLAGS * fflags, KINEMATICS_INVERSE_FLAGS * iflags) { + (void)fflags; double s1, s2, s3, s4, s5, s6; double c1, c2, c3, c4, c5, c6; double s23; @@ -328,6 +329,7 @@ int pumaKinematicsSetup(const int comp_id, const char* coordinates, kparms* kp) { + (void)coordinates; int res=0; haldata = hal_malloc(sizeof(*haldata)); diff --git a/src/emc/kinematics/rosekins.c b/src/emc/kinematics/rosekins.c index 4ee181d1ba2..63ed5bf7850 100644 --- a/src/emc/kinematics/rosekins.c +++ b/src/emc/kinematics/rosekins.c @@ -44,6 +44,8 @@ int kinematicsForward(const double *joints, const KINEMATICS_FORWARD_FLAGS * fflags, KINEMATICS_INVERSE_FLAGS * iflags) { + (void)fflags; + (void)iflags; double radius,z,theta; radius = joints[0]; @@ -68,6 +70,8 @@ int kinematicsInverse(const EmcPose * pos, const KINEMATICS_INVERSE_FLAGS * iflags, KINEMATICS_FORWARD_FLAGS * fflags) { + (void)iflags; + (void)fflags; // There is a potential problem when accumulating bigtheta -- loss of // precision based on size of mantissa -- but in practice, it is probably ok diff --git a/src/emc/kinematics/rotarydeltakins.c b/src/emc/kinematics/rotarydeltakins.c index fb73f830135..3ab93723114 100644 --- a/src/emc/kinematics/rotarydeltakins.c +++ b/src/emc/kinematics/rotarydeltakins.c @@ -36,6 +36,8 @@ int kinematicsForward(const double * joints, EmcPose * pos, const KINEMATICS_FORWARD_FLAGS * fflags, KINEMATICS_INVERSE_FLAGS * iflags) { + (void)fflags; + (void)iflags; set_geometry(*haldata->pfr, *haldata->tl, *haldata->sl, *haldata->fr); return kinematics_forward(joints, pos); } @@ -43,6 +45,8 @@ int kinematicsForward(const double * joints, int kinematicsInverse(const EmcPose *pos, double *joints, const KINEMATICS_INVERSE_FLAGS *iflags, KINEMATICS_FORWARD_FLAGS *fflags) { + (void)iflags; + (void)fflags; set_geometry(*haldata->pfr, *haldata->tl, *haldata->sl, *haldata->fr); return kinematics_inverse(pos, joints); } diff --git a/src/emc/kinematics/rotatekins.c b/src/emc/kinematics/rotatekins.c index af11f7450c3..2bee81eccc9 100644 --- a/src/emc/kinematics/rotatekins.c +++ b/src/emc/kinematics/rotatekins.c @@ -20,6 +20,8 @@ int kinematicsForward(const double *joints, const KINEMATICS_FORWARD_FLAGS * fflags, KINEMATICS_INVERSE_FLAGS * iflags) { + (void)fflags; + (void)iflags; double c_rad = -joints[5]*M_PI/180; pos->tran.x = joints[0] * cos(c_rad) - joints[1] * sin(c_rad); pos->tran.y = joints[0] * sin(c_rad) + joints[1] * cos(c_rad); @@ -39,6 +41,8 @@ int kinematicsInverse(const EmcPose * pos, const KINEMATICS_INVERSE_FLAGS * iflags, KINEMATICS_FORWARD_FLAGS * fflags) { + (void)iflags; + (void)fflags; double c_rad = pos->c*M_PI/180; joints[0] = pos->tran.x * cos(c_rad) - pos->tran.y * sin(c_rad); joints[1] = pos->tran.x * sin(c_rad) + pos->tran.y * cos(c_rad); diff --git a/src/emc/kinematics/scarakins.c b/src/emc/kinematics/scarakins.c index 023ede2c29c..c2e2a1e6dae 100644 --- a/src/emc/kinematics/scarakins.c +++ b/src/emc/kinematics/scarakins.c @@ -77,6 +77,7 @@ int scaraKinematicsForward(const double * joint, const KINEMATICS_FORWARD_FLAGS * fflags, KINEMATICS_INVERSE_FLAGS * iflags) { + (void)fflags; double a0, a1, a3; double x, y, z, c; @@ -181,6 +182,7 @@ static int scaraKinematicsSetup(const int comp_id, const char* coordinates, kparms* kp) { + (void)coordinates; int res=0; haldata = hal_malloc(sizeof(*haldata)); diff --git a/src/emc/kinematics/scorbot-kins.c b/src/emc/kinematics/scorbot-kins.c index ff67fdde2c7..ee00c709ac4 100644 --- a/src/emc/kinematics/scorbot-kins.c +++ b/src/emc/kinematics/scorbot-kins.c @@ -79,6 +79,8 @@ int kinematicsForward( const KINEMATICS_FORWARD_FLAGS *fflags, KINEMATICS_INVERSE_FLAGS *iflags ) { + (void)fflags; + (void)iflags; EmcPose j1_vector; // the vector from j0 ("base") to joint 1 ("shoulder", end of link 0) EmcPose j2_vector; // the vector from j1 ("shoulder") to joint 2 ("elbow", end of link 1) EmcPose j3_vector; // the vector from j2 ("elbow") to joint 3 ("wrist", end of link 2) @@ -136,6 +138,8 @@ int kinematicsInverse( const KINEMATICS_INVERSE_FLAGS *iflags, KINEMATICS_FORWARD_FLAGS *fflags ) { + (void)iflags; + (void)fflags; // EmcPose j1_cart; double distance_to_cp, distance_to_center; double r_j1, z_j1; // (r_j1, z_j1) is the location of J1 in the RZ plane diff --git a/src/emc/kinematics/tripodkins.c b/src/emc/kinematics/tripodkins.c index 41463df70c0..415e56cf36c 100644 --- a/src/emc/kinematics/tripodkins.c +++ b/src/emc/kinematics/tripodkins.c @@ -128,6 +128,7 @@ int kinematicsForward(const double * joints, const KINEMATICS_FORWARD_FLAGS * fflags, KINEMATICS_INVERSE_FLAGS * iflags) { + (void)iflags; #define AD (joints[0]) #define BD (joints[1]) #define CD (joints[2]) @@ -184,6 +185,7 @@ int kinematicsInverse(const EmcPose * pos, const KINEMATICS_INVERSE_FLAGS * iflags, KINEMATICS_FORWARD_FLAGS * fflags) { + (void)iflags; #define AD (joints[0]) #define BD (joints[1]) #define CD (joints[2]) diff --git a/src/emc/kinematics/trtfuncs.c b/src/emc/kinematics/trtfuncs.c index 64aba667179..ccb63b162d8 100644 --- a/src/emc/kinematics/trtfuncs.c +++ b/src/emc/kinematics/trtfuncs.c @@ -153,6 +153,8 @@ int xyzacKinematicsForward(const double *joints, const KINEMATICS_FORWARD_FLAGS * fflags, KINEMATICS_INVERSE_FLAGS * iflags) { + (void)fflags; + (void)iflags; double x_rot_point = *(haldata->x_rot_point); double y_rot_point = *(haldata->y_rot_point); double z_rot_point = *(haldata->z_rot_point); @@ -199,6 +201,8 @@ int xyzacKinematicsInverse(const EmcPose * pos, const KINEMATICS_INVERSE_FLAGS * iflags, KINEMATICS_FORWARD_FLAGS * fflags) { + (void)iflags; + (void)fflags; double x_rot_point = *(haldata->x_rot_point); double y_rot_point = *(haldata->y_rot_point); double z_rot_point = *(haldata->z_rot_point); @@ -257,6 +261,8 @@ int xyzbcKinematicsForward(const double *joints, const KINEMATICS_FORWARD_FLAGS * fflags, KINEMATICS_INVERSE_FLAGS * iflags) { + (void)fflags; + (void)iflags; // Note: 'principal' joints are used double x_rot_point = *(haldata->x_rot_point); double y_rot_point = *(haldata->y_rot_point); @@ -303,6 +309,8 @@ int xyzbcKinematicsInverse(const EmcPose * pos, const KINEMATICS_INVERSE_FLAGS * iflags, KINEMATICS_FORWARD_FLAGS * fflags) { + (void)iflags; + (void)fflags; double x_rot_point = *(haldata->x_rot_point); double y_rot_point = *(haldata->y_rot_point); double z_rot_point = *(haldata->z_rot_point); diff --git a/src/emc/motion/command.c b/src/emc/motion/command.c index 2c1ac852707..6ff4a26bba3 100644 --- a/src/emc/motion/command.c +++ b/src/emc/motion/command.c @@ -386,6 +386,7 @@ STATIC int is_feed_type(int motion_type) */ void emcmotCommandHandler_locked(void *arg, long servo_period) { + (void)arg; int joint_num, spindle_num; int n,s0,s1; emcmot_joint_t *joint; diff --git a/src/emc/motion/control.c b/src/emc/motion/control.c index fdf293ca24e..174ae5ac97e 100644 --- a/src/emc/motion/control.c +++ b/src/emc/motion/control.c @@ -206,6 +206,7 @@ static void handle_kinematicsSwitch(void); */ void emcmotController(void *arg, long period) { + (void)arg; static int do_once = 1; if (do_once) { pcmd_p[0] = &(emcmotStatus->carte_pos_cmd.tran.x); @@ -236,7 +237,7 @@ void emcmotController(void *arg, long period) /* calculate servo period as a double - period is in integer nsec */ servo_period = period * 0.000000001; - if(period != last_period) { + if(period != (long)last_period) { emcmotSetCycleTime(period); last_period = period; } diff --git a/src/emc/tp/blendmath.c b/src/emc/tp/blendmath.c index c876bacda64..e1956ad92eb 100644 --- a/src/emc/tp/blendmath.c +++ b/src/emc/tp/blendmath.c @@ -267,6 +267,7 @@ static inline double findTrimAngle(PmCartesian const * const P, */ int checkTangentAngle(PmCircle const * const circ, SphericalArc const * const arc, BlendGeom3 const * const geom, BlendParameters const * const param, double cycle_time, int at_end) { + (void)geom; // Debug Information to diagnose tangent issues PmCartesian u_circ, u_arc; arcTangent(arc, &u_arc, at_end); @@ -1283,6 +1284,9 @@ int blendLineArcPostProcess(BlendPoints3 * const points, BlendPoints3 const * co BlendParameters * const param, BlendGeom3 const * const geom, PmCartLine const * const line1, PmCircle const * const circ2) { + (void)points_in; + (void)line1; + (void)circ2; // Define distances from actual center to circle centers double d2 = negate(param->R_plan, param->convex2) + geom->radius2; @@ -1375,6 +1379,9 @@ int blendArcLinePostProcess(BlendPoints3 * const points, PmCircle const * const circ1, PmCartLine const * const line2) { + (void)points_in; + (void)circ1; + (void)line2; // Define distance from actual arc center to circle center double d1 = negate(param->R_plan, param->convex1) + geom->radius1; @@ -1462,6 +1469,9 @@ int blendArcArcPostProcess(BlendPoints3 * const points, BlendPoints3 const * con BlendParameters * const param, BlendGeom3 const * const geom, PmCircle const * const circ1, PmCircle const * const circ2) { + (void)points_in; + (void)circ1; + (void)circ2; // Create "shifted center" approximation of spiral circles // TODO refers to u1 instead of utan? @@ -1598,6 +1608,7 @@ int arcFromBlendPoints3(SphericalArc * const arc, BlendPoints3 const * const poi int blendGeom3Print(BlendGeom3 const * const geom) { + (void)geom; tp_debug_print("u1 = %f %f %f\n", geom->u1.x, geom->u1.y, @@ -1612,6 +1623,7 @@ int blendGeom3Print(BlendGeom3 const * const geom) int blendPoints3Print(BlendPoints3 const * const points) { + (void)points; tp_debug_print("arc_start = %f %f %f\n", points->arc_start.x, points->arc_start.y, @@ -1735,6 +1747,7 @@ static int pmCircleAngleFromParam(PmCircle const * const circle, static void printSpiralArcLengthFit(SpiralArcLengthFit const * const fit) { + (void)fit; tp_debug_print("Spiral fit: b0 = %.12f, b1 = %.12f, length = %.12f, spiral_in = %d\n", fit->b0, fit->b1, diff --git a/src/emc/tp/spherical_arc.c b/src/emc/tp/spherical_arc.c index 626db560d16..2c347dcb211 100644 --- a/src/emc/tp/spherical_arc.c +++ b/src/emc/tp/spherical_arc.c @@ -120,6 +120,7 @@ int arcLength(SphericalArc const * const arc, double * const length) int arcFromLines(SphericalArc * const arc, PmCartLine const * const line1, PmCartLine const * const line2, double radius, double blend_dist, double center_dist, PmCartesian * const start, PmCartesian * const end, int consume) { + (void)radius; PmCartesian center, normal, binormal; diff --git a/src/emc/tp/tp.c b/src/emc/tp/tp.c index 6ab96ce5033..1bfdfa1e1ef 100644 --- a/src/emc/tp/tp.c +++ b/src/emc/tp/tp.c @@ -403,6 +403,7 @@ static int makepins(int id) { int tpCreate(TP_STRUCT * const tp, int _queueSize,int id) { + (void)id; if (0 == tp) { return TP_ERR_FAIL; } @@ -467,7 +468,7 @@ int tpClear(TP_STRUCT * const tp) // Clear out status ID's tp->nextId = 0; tp->execId = 0; - struct state_tag_t tag = {{0}}; + struct state_tag_t tag = {}; tp->execTag = tag; tp->motionType = 0; tp->done = 1; @@ -633,7 +634,7 @@ int tpGetExecId(TP_STRUCT * const tp) struct state_tag_t tpGetExecTag(TP_STRUCT * const tp) { if (0 == tp) { - struct state_tag_t empty = {{0}}; + struct state_tag_t empty = {}; return empty; } @@ -2376,6 +2377,11 @@ STATIC void tpDebugCycleInfo(TP_STRUCT const * const tp, TC_STRUCT const * const if (tc->on_final_decel) { rtapi_print(" on final decel\n"); } +#else + (void)tp; + (void)tc; + (void)nexttc; + (void)acc; #endif } @@ -3406,6 +3412,7 @@ STATIC int tpHandleRegularCycle(TP_STRUCT * const tp, */ int tpRunCycle(TP_STRUCT * const tp, long period) { + (void)period; //Pointers to current and next trajectory component TC_STRUCT *tc; TC_STRUCT *nexttc; @@ -3612,6 +3619,7 @@ int tpActiveDepth(TP_STRUCT * const tp) } int tpSetAout(TP_STRUCT * const tp, unsigned char index, double start, double end) { + (void)end; if (0 == tp) { return TP_ERR_FAIL; } @@ -3622,6 +3630,7 @@ int tpSetAout(TP_STRUCT * const tp, unsigned char index, double start, double en } int tpSetDout(TP_STRUCT * const tp, int index, unsigned char start, unsigned char end) { + (void)end; if (0 == tp) { return TP_ERR_FAIL; } diff --git a/src/hal/classicladder/arrays.c b/src/hal/classicladder/arrays.c index 17600bcac47..ddb1a20b890 100644 --- a/src/hal/classicladder/arrays.c +++ b/src/hal/classicladder/arrays.c @@ -327,6 +327,7 @@ return TRUE; void ClassicLadder_FreeAll(char CleanAndRemoveTmpDir) { + (void)CleanAndRemoveTmpDir; #ifdef GTK_INTERFACE if (EditArithmExpr) free(EditArithmExpr); diff --git a/src/hal/classicladder/module_hal.c b/src/hal/classicladder/module_hal.c index 80d832736f4..00b9ab6ae93 100644 --- a/src/hal/classicladder/module_hal.c +++ b/src/hal/classicladder/module_hal.c @@ -133,6 +133,7 @@ void HalWriteFloatOutputs(void) { // and HAL pins take (it is displayed in the 'section display' GUI (in microseconds). static void hal_task(void *arg, long period) { + (void)arg; unsigned long t0, t1,milliseconds; static unsigned long leftover=0; leftover += period; diff --git a/src/hal/components/boss_plc.c b/src/hal/components/boss_plc.c index 85cb7ceec12..5c27c2d65bb 100644 --- a/src/hal/components/boss_plc.c +++ b/src/hal/components/boss_plc.c @@ -354,7 +354,7 @@ static Component component; int rtapi_app_main(void) { - int i; + unsigned i; Plc *pComp; // Connect to the HAL. @@ -787,6 +787,7 @@ Plc_Refresh(void *arg, long period) static void Plc_RefreshFeed(Plc *this, long period) { + (void)period; BOOL riseCycleStart; riseCycleStart = !this->lastCycleStart && *this->pCycleStartIn; @@ -824,6 +825,7 @@ Plc_RefreshFeed(Plc *this, long period) static void Plc_RefreshLimits(Plc *this, long period) { + (void)period; Limit_Refresh(&this->xLimit, *this->pLimitOverrideIn); Limit_Refresh(&this->yLimit, *this->pLimitOverrideIn); @@ -950,6 +952,7 @@ Plc_RefreshSpindle(Plc *this, long period) static void Plc_RefreshJog(Plc *this, long period) { + (void)period; int i; // Jog scale. diff --git a/src/hal/components/counter.c b/src/hal/components/counter.c index 8e9d565b1c5..5ad7499eb39 100644 --- a/src/hal/components/counter.c +++ b/src/hal/components/counter.c @@ -179,6 +179,7 @@ void rtapi_app_exit(void) static void update(void *arg, long period) { + (void)period; counter_t *cntr; int n; diff --git a/src/hal/components/debounce.c b/src/hal/components/debounce.c index eda1edb5a99..0c07fc68667 100644 --- a/src/hal/components/debounce.c +++ b/src/hal/components/debounce.c @@ -185,6 +185,7 @@ void rtapi_app_exit(void) static void debounce(void *arg, long period) { + (void)period; debounce_group_t *group; debounce_t *filter; int n; diff --git a/src/hal/components/encoder.c b/src/hal/components/encoder.c index 36b2e91a733..165d2a293ae 100644 --- a/src/hal/components/encoder.c +++ b/src/hal/components/encoder.c @@ -405,6 +405,7 @@ static void update(void *arg, long period) static void capture(void *arg, long period) { + (void)period; counter_t *cntr; atomic *buf; int n; diff --git a/src/hal/components/encoder_ratio.c b/src/hal/components/encoder_ratio.c index 9b87485b7e5..eda6e52d676 100644 --- a/src/hal/components/encoder_ratio.c +++ b/src/hal/components/encoder_ratio.c @@ -276,6 +276,7 @@ void rtapi_app_exit(void) static void sample(void *arg, long period) { + (void)period; encoder_pair_t *pair; int n; unsigned char state; @@ -333,6 +334,7 @@ static void sample(void *arg, long period) static void update(void *arg, long period) { + (void)period; encoder_pair_t *pair; int n; @@ -359,6 +361,7 @@ static void update(void *arg, long period) static int export_encoder_pair(int num, encoder_pair_t * addr, char* prefix) { + (void)num; int retval, msg; /* This function exports a lot of stuff, which results in a lot of diff --git a/src/hal/components/enum.c b/src/hal/components/enum.c index e4313ab215c..6b18f377f9e 100644 --- a/src/hal/components/enum.c +++ b/src/hal/components/enum.c @@ -185,6 +185,7 @@ int rtapi_app_main(void){ } static void decode(void *v_inst, long period){ + (void)period; int i; enum_inst_t *inst = v_inst; for (i = 1; i <= inst->num_pins; i++){ @@ -196,6 +197,7 @@ static void decode(void *v_inst, long period){ } } static void encode(void *v_inst, long period){ + (void)period; int i; enum_inst_t *inst = v_inst; *(inst->hal[0].en) = 0; diff --git a/src/hal/components/lcd.c b/src/hal/components/lcd.c index acfc7d67d21..995ebffc776 100644 --- a/src/hal/components/lcd.c +++ b/src/hal/components/lcd.c @@ -47,7 +47,7 @@ typedef struct { typedef struct { lcd_page_t *pages; - int num_pages; + unsigned num_pages; hal_u32_t *page_num; hal_u32_t last_page; hal_u32_t *out; @@ -255,6 +255,7 @@ int rtapi_app_main(void){ } void write(void *arg, long period){ + (void)period; lcd_t *lcd; int i; diff --git a/src/hal/components/matrix_kb.c b/src/hal/components/matrix_kb.c index 7ecdde4382e..c013c6b7880 100644 --- a/src/hal/components/matrix_kb.c +++ b/src/hal/components/matrix_kb.c @@ -46,11 +46,11 @@ typedef struct { char name[HAL_NAME_LEN + 1]; struct input_dev *key_dev; hal_u32_t index; - int keydown; - int keyup; - int rowshift; - int row; - int num_keys; + unsigned keydown; + unsigned keyup; + unsigned rowshift; + unsigned row; + unsigned num_keys; hal_bit_t scan; hal_bit_t keystroke; }kb_inst_t; @@ -69,15 +69,13 @@ char *names[MAX_CHAN]; RTAPI_MP_ARRAY_STRING(names, MAX_CHAN, "component names") void keyup(kb_inst_t *inst){ - int r, c; - int keycode = *inst->hal.keycode & ~(inst->keydown | inst->keyup); + unsigned r, c; + unsigned keycode = *inst->hal.keycode & ~(inst->keydown | inst->keyup); r = keycode >> inst->rowshift; c = keycode & ~(0xFFFFFFFF << inst->rowshift); - if (r < 0 - || c < 0 - || r >= inst->nrows + if ( r >= inst->nrows || c >= inst->ncols || inst->hal.key[r * inst->ncols + c] == NULL){ return; @@ -88,15 +86,13 @@ void keyup(kb_inst_t *inst){ *inst->hal.key[r * inst->ncols + c] = 0; } void keydown(kb_inst_t *inst){ - int r, c; - int keycode = *inst->hal.keycode & ~(inst->keydown | inst->keyup); + unsigned r, c; + unsigned keycode = *inst->hal.keycode & ~(inst->keydown | inst->keyup); r = keycode >> inst->rowshift; c = keycode & ~(0xFFFFFFFF << inst->rowshift); - if (r < 0 - || c < 0 - || r >= inst->nrows + if ( r >= inst->nrows || c >= inst->ncols || inst->hal.key[r * inst->ncols + c] == NULL){ return; @@ -108,8 +104,9 @@ void keydown(kb_inst_t *inst){ *inst->hal.key[r * inst->ncols + c] = 1; } - void loop(void *arg, long period){ - int c; +void loop(void *arg, long period){ + (void)period; + unsigned c; hal_u32_t scan = 0; kb_inst_t *inst = arg; @@ -196,7 +193,7 @@ int rtapi_app_main(void){ for (i = 0; i < kb->num_insts; i++){ int a = 0; - int c, r; + unsigned c, r; kb_inst_t *inst = &kb->insts[i]; inst->index = i; @@ -235,7 +232,7 @@ int rtapi_app_main(void){ return -1; } - for (inst->rowshift = 1; inst->ncols > (1 << inst->rowshift); inst->rowshift++); + for (inst->rowshift = 1; inst->ncols > (1u << inst->rowshift); inst->rowshift++); for (inst->keydown = 0xC0, inst->keyup = 0x80 ; (inst->nrows << inst->rowshift) > inst->keydown ; inst->keydown <<= 1, inst->keyup <<= 1); diff --git a/src/hal/components/modmath.c b/src/hal/components/modmath.c index d43643be2b6..1af80195cb3 100644 --- a/src/hal/components/modmath.c +++ b/src/hal/components/modmath.c @@ -115,6 +115,7 @@ void rtapi_app_exit(void) static void mod_dir_funct(void *arg, long period) { + (void)period; mod_dir_t *mod; int range, act, des, to_go; diff --git a/src/hal/components/mux_generic.c b/src/hal/components/mux_generic.c index a39e4ce0d5c..a2df99ca00e 100644 --- a/src/hal/components/mux_generic.c +++ b/src/hal/components/mux_generic.c @@ -271,7 +271,8 @@ int rtapi_app_main(void){ void write_fp(void *arg, long period) { mux_inst_t *inst = arg; - int i = 0, s = 0; + int i = 0; + unsigned s = 0; if (inst->num_bits > 0) { while (i < inst->num_bits) { s += (*inst->sel_bit[i] != 0) << i; @@ -291,7 +292,7 @@ void write_fp(void *arg, long period) { inst->selection = s; inst->timer = 0; - if (s >= inst->size) + if ((int)s >= inst->size) s = inst->size - 1; switch (inst->in_type * 8 + inst->out_type) { @@ -334,7 +335,8 @@ void write_fp(void *arg, long period) { void write_nofp(void *arg, long period) { mux_inst_t *inst = arg; - int i = 0, s = 0; + int i = 0; + unsigned s = 0; if (inst->num_bits > 0) { while (i < inst->num_bits) { s += (*inst->sel_bit[i] != 0) << i; @@ -354,7 +356,7 @@ void write_nofp(void *arg, long period) { inst->selection = s; inst->timer = 0; - if (s >= inst->size) + if ((int)s >= inst->size) s = inst->size - 1; switch (inst->in_type * 8 + inst->out_type) { case 011: //HAL_BIT => HAL_BIT diff --git a/src/hal/components/pwmgen.c b/src/hal/components/pwmgen.c index 9acccec3bc2..b4f652bcba6 100644 --- a/src/hal/components/pwmgen.c +++ b/src/hal/components/pwmgen.c @@ -330,7 +330,8 @@ static void make_pulses(void *arg, long period) static void update(void *arg, long period) { - static long oldperiodns=-1; + (void)period; + static long oldperiodns=-1; pwmgen_t *pwmgen; int n, high_periods; diff --git a/src/hal/components/sampler.c b/src/hal/components/sampler.c index bf17b66b5cd..4e62a4dffef 100644 --- a/src/hal/components/sampler.c +++ b/src/hal/components/sampler.c @@ -152,6 +152,7 @@ void rtapi_app_exit(void) static void sample(void *arg, long period) { + (void)period; sampler_t *samp; pin_data_t *pptr; int n; diff --git a/src/hal/components/sim_encoder.c b/src/hal/components/sim_encoder.c index 0b5572fcffc..1360c69bc6e 100644 --- a/src/hal/components/sim_encoder.c +++ b/src/hal/components/sim_encoder.c @@ -317,6 +317,7 @@ static void make_pulses(void *arg, long period) static void update_speed(void *arg, long period) { + (void)period; sim_enc_t *sim_enc; int n; double rev_sec, freq; diff --git a/src/hal/components/stepgen.c b/src/hal/components/stepgen.c index f924fb2f84c..d901406c0d0 100644 --- a/src/hal/components/stepgen.c +++ b/src/hal/components/stepgen.c @@ -713,6 +713,7 @@ static void make_pulses(void *arg, long period) static void update_pos(void *arg, long period) { + (void)period; long long int accum_a, accum_b; stepgen_t *stepgen; int n; diff --git a/src/hal/components/streamer.c b/src/hal/components/streamer.c index 8c746951afe..f18f07783ae 100644 --- a/src/hal/components/streamer.c +++ b/src/hal/components/streamer.c @@ -167,6 +167,7 @@ void rtapi_app_exit(void) static void update(void *arg, long period) { + (void)period; streamer_t *str; pin_data_t *pptr; int n, doclk; diff --git a/src/hal/components/supply.c b/src/hal/components/supply.c index 4b915c1a91e..9dcca158ec4 100644 --- a/src/hal/components/supply.c +++ b/src/hal/components/supply.c @@ -140,6 +140,7 @@ void rtapi_app_exit(void) static void update_supply(void *arg, long l) { + (void)l; hal_supply_t *supply; /* point to the data */ diff --git a/src/hal/components/watchdog.c b/src/hal/components/watchdog.c index e597deb269f..262360c2ebb 100644 --- a/src/hal/components/watchdog.c +++ b/src/hal/components/watchdog.c @@ -190,6 +190,7 @@ void rtapi_app_exit(void) */ static void process(void *arg, long period) { + (void)arg; int i, fault=0; // set_timeouts has to turn on the output when it detects a valid // transition on enable @@ -217,6 +218,8 @@ static void process(void *arg, long period) static void set_timeouts(void *arg, long period) { + (void)arg; + (void)period; int i; hal_float_t temp; diff --git a/src/hal/components/weighted_sum.c b/src/hal/components/weighted_sum.c index 89f0dfb5ff2..4838bbc5e34 100644 --- a/src/hal/components/weighted_sum.c +++ b/src/hal/components/weighted_sum.c @@ -171,6 +171,7 @@ void rtapi_app_exit(void) */ static void process_wsums(void *arg, long period) { + (void)period; wsum_t *wsums, *thissum; int n, b, running_total; diff --git a/src/hal/drivers/hal_bb_gpio.c b/src/hal/drivers/hal_bb_gpio.c index e51931bae12..86ec0013781 100644 --- a/src/hal/drivers/hal_bb_gpio.c +++ b/src/hal/drivers/hal_bb_gpio.c @@ -385,6 +385,7 @@ void rtapi_app_exit(void) { } static void write_port(void *arg, long period) { + (void)period; int i; port_data_t *port = (port_data_t *)arg; @@ -424,6 +425,7 @@ static void write_port(void *arg, long period) { static void read_port(void *arg, long period) { + (void)period; int i; port_data_t *port = (port_data_t *)arg; diff --git a/src/hal/drivers/hal_gm.c b/src/hal/drivers/hal_gm.c index 8376a37a6e8..a1c85a62e70 100644 --- a/src/hal/drivers/hal_gm.c +++ b/src/hal/drivers/hal_gm.c @@ -421,7 +421,8 @@ rtapi_pci_device_id gm_pci_tbl[] = { static int gm_pci_probe(struct rtapi_pci_dev *dev, const struct rtapi_pci_device_id *id) -{ +{ + (void)id; int error=0; card *pCard = NULL; gm_device_t *pDevice; @@ -1466,10 +1467,11 @@ card_mgr(void *arg, long period) static void encoder(void *arg, long period) { - gm_device_t *device = (gm_device_t *)arg; - card *pCard = device->pCard; + (void)period; + gm_device_t *device = (gm_device_t *)arg; + card *pCard = device->pCard; - int i; + int i; hal_s32_t temp1 = 0, temp2; hal_float_t vel; @@ -1701,8 +1703,9 @@ stepgenCheckParameters(void *arg, long period, unsigned int channel) static void stepgenControl(void *arg, long period, unsigned int channel) { - gm_device_t *device = (gm_device_t *)arg; - card *pCard = device->pCard; + (void)period; + gm_device_t *device = (gm_device_t *)arg; + card *pCard = device->pCard; hal_s32_t stepgen_fb, stepgen_fb_int, last_count_fb_LS16_bits, last_count_fb_MS16_bits, last_count_fb; hal_float_t ref_vel = 0, match_acc, match_time, avg_v, est_out, est_cmd, est_err, dp; @@ -1816,6 +1819,7 @@ stepgenControl(void *arg, long period, unsigned int channel) static void RS485(void *arg, long period) { + (void)period; gm_device_t *device = (gm_device_t *)arg; card *pCard = device->pCard; @@ -2075,7 +2079,7 @@ RS485_OrderDataRead(hal_u32_t* dataIn32, hal_u32_t* dataOut8, hal_u32_t length) static void RS485_OrderDataWrite(hal_u32_t* dataIn8, hal_u32_t* dataOut32, hal_u32_t length) { - int i, j; + unsigned i, j; /* Byte order: RS485DataOut32[0]=0x28293031; RS485DataOut32[1]=0x24252627; diff --git a/src/hal/drivers/hal_parport.c b/src/hal/drivers/hal_parport.c index 91ae1843bd2..7fdff4ba002 100644 --- a/src/hal/drivers/hal_parport.c +++ b/src/hal/drivers/hal_parport.c @@ -315,6 +315,7 @@ void rtapi_app_exit(void) static void read_port(void *arg, long period) { + (void)period; parport_t *port; int b; unsigned char indata, mask; @@ -384,6 +385,7 @@ static void reset_port(void *arg, long period) { static void write_port(void *arg, long period) { + (void)period; parport_t *port; int b; unsigned char outdata, mask; diff --git a/src/hal/drivers/hal_pi_gpio.c b/src/hal/drivers/hal_pi_gpio.c index 4abc0df3248..33d8b681706 100644 --- a/src/hal/drivers/hal_pi_gpio.c +++ b/src/hal/drivers/hal_pi_gpio.c @@ -364,6 +364,8 @@ void rtapi_app_exit(void) static void write_port(void *arg, long period) { + (void)arg; + (void)period; int n; for (n = 0; n < npins; n++) { @@ -381,6 +383,8 @@ static void write_port(void *arg, long period) static void read_port(void *arg, long period) { + (void)arg; + (void)period; int n; for (n = 0; n < npins; n++) { diff --git a/src/hal/drivers/hal_ppmc.c b/src/hal/drivers/hal_ppmc.c index c3b1caf2f67..3f86f53f1a4 100644 --- a/src/hal/drivers/hal_ppmc.c +++ b/src/hal/drivers/hal_ppmc.c @@ -890,6 +890,7 @@ static void read_all(void *arg, long period) static void write_all(void *arg, long period) { + (void)period; bus_data_t *bus; slot_data_t *slot; int slotnum, functnum, addr_ok; @@ -1245,7 +1246,7 @@ static void write_encoders(slot_data_t *slot) value in 10MHz clock pulses. */ static unsigned int ns2cp( hal_u32_t *pns, unsigned int min_ns ) { - int ns, cp; + unsigned ns, cp; ns = *pns; if ( ns < min_ns ) ns = min_ns; @@ -2295,6 +2296,7 @@ static int export_extra_dac(slot_data_t *slot, bus_data_t *bus) int export_timestamp(slot_data_t *slot, bus_data_t *bus) { + (void)bus; int n; /* does the board have the timestamp feature? */ diff --git a/src/hal/drivers/hal_speaker.c b/src/hal/drivers/hal_speaker.c index f790598249d..8fd3f68e04e 100644 --- a/src/hal/drivers/hal_speaker.c +++ b/src/hal/drivers/hal_speaker.c @@ -117,6 +117,7 @@ static int num_ports; /* number of ports configured */ static void write_port(void *arg, long period) { + (void)period; uint8_t v = 0; uint8_t oldval; int i; diff --git a/src/hal/drivers/mesa-hostmot2/abs_encoder.c b/src/hal/drivers/mesa-hostmot2/abs_encoder.c index 94bed41d803..87552e419d5 100644 --- a/src/hal/drivers/mesa-hostmot2/abs_encoder.c +++ b/src/hal/drivers/mesa-hostmot2/abs_encoder.c @@ -16,6 +16,7 @@ static bool funct_flag = false; static void hm2_absenc_trigger(void *void_hm2, long period){ + (void)period; hostmot2_t *hm2 = void_hm2; rtapi_u32 buff = 0xFFFFFFFF; if (hm2->absenc.ssi_global_start_addr){ @@ -485,6 +486,7 @@ int hm2_absenc_parse_md(hostmot2_t *hm2, int md_index) { } void hm2_absenc_process_tram_read(hostmot2_t *hm2, long period) { + (void)period; int i; static int err_count[MAX_ABSENCS]; static int err_tag[MAX_ABSENCS]; diff --git a/src/hal/drivers/mesa-hostmot2/bitfile.c b/src/hal/drivers/mesa-hostmot2/bitfile.c index 9b6582fe1f2..ea8d786f0f3 100644 --- a/src/hal/drivers/mesa-hostmot2/bitfile.c +++ b/src/hal/drivers/mesa-hostmot2/bitfile.c @@ -37,7 +37,7 @@ -static int bitfile_do_small_chunk(const struct rtapi_firmware *fw, bitfile_chunk_t *chunk, int *i) { +static int bitfile_do_small_chunk(const struct rtapi_firmware *fw, bitfile_chunk_t *chunk, size_t *i) { if (*i + 2 > fw->size) { HM2_PRINT_NO_LL("bitfile chunk extends past end of firmware\n"); return -EFAULT; @@ -66,7 +66,7 @@ static int bitfile_do_small_chunk(const struct rtapi_firmware *fw, bitfile_chunk -static int bitfile_do_big_chunk(const struct rtapi_firmware *fw, bitfile_chunk_t *chunk, int *i) { +static int bitfile_do_big_chunk(const struct rtapi_firmware *fw, bitfile_chunk_t *chunk, size_t *i) { if (*i + 4 > fw->size) { HM2_PRINT_NO_LL("bitfile chunk extends past end of firmware\n"); return -EFAULT; @@ -89,7 +89,7 @@ static int bitfile_do_big_chunk(const struct rtapi_firmware *fw, bitfile_chunk_t -static int bitfile_parse_and_verify_chunk(const struct rtapi_firmware *fw, bitfile_t *bitfile, int *i) { +static int bitfile_parse_and_verify_chunk(const struct rtapi_firmware *fw, bitfile_t *bitfile, size_t *i) { char tag; tag = fw->data[*i]; @@ -136,7 +136,7 @@ static int bitfile_parse_and_verify_chunk(const struct rtapi_firmware *fw, bitfi #define BITFILE_HEADERLEN 13 int bitfile_parse_and_verify(const struct rtapi_firmware *fw, bitfile_t *bitfile) { - int i; + size_t i; int r; const unsigned char bitfile_header[BITFILE_HEADERLEN] = { diff --git a/src/hal/drivers/mesa-hostmot2/bitfile.h b/src/hal/drivers/mesa-hostmot2/bitfile.h index b8cda8d73f7..a8fb21a5936 100644 --- a/src/hal/drivers/mesa-hostmot2/bitfile.h +++ b/src/hal/drivers/mesa-hostmot2/bitfile.h @@ -34,7 +34,7 @@ typedef struct { - int size; + size_t size; const unsigned char *data; // a pointer into the "parent" struct firmware } bitfile_chunk_t; diff --git a/src/hal/drivers/mesa-hostmot2/bspi.c b/src/hal/drivers/mesa-hostmot2/bspi.c index 1b9a4914745..3a49735912f 100644 --- a/src/hal/drivers/mesa-hostmot2/bspi.c +++ b/src/hal/drivers/mesa-hostmot2/bspi.c @@ -87,7 +87,7 @@ int hm2_bspi_parse_md(hostmot2_t *hm2, int md_index) hm2_bspi_instance_t *chan = &hm2->bspi.instance[i]; chan->clock_freq = md->clock_freq; r = snprintf(chan->name, sizeof(chan->name), "%s.bspi.%01d", hm2->llio->name, i); - if (r >= sizeof(chan->name)) {r = -EINVAL ; goto fail0;} + if (r >= (int)sizeof(chan->name)) {r = -EINVAL ; goto fail0;} HM2_PRINT("created Buffered SPI function %s.\n", chan->name); chan->base_address = md->base_address + i * md->instance_stride; chan->register_stride = md->register_stride; @@ -352,6 +352,7 @@ int hm2_bspi_set_write_function(char *name, int (*func)(void *subdata), void *su void hm2_bspi_process_tram_read(hostmot2_t *hm2, long period) { + (void)period; int i, r; int (*func)(void *subdata); for (i = 0 ; i < hm2->bspi.num_instances ; i++ ){ @@ -367,6 +368,7 @@ void hm2_bspi_process_tram_read(hostmot2_t *hm2, long period) void hm2_bspi_prepare_tram_write(hostmot2_t *hm2, long period) { + (void)period; int i, r; int (*func)(void *subdata); for (i = 0 ; i < hm2->bspi.num_instances ; i++ ){ @@ -384,10 +386,12 @@ void hm2_bspi_prepare_tram_write(hostmot2_t *hm2, long period) void hm2_bspi_cleanup(hostmot2_t *hm2) { + (void)hm2; } void hm2_bspi_write(hostmot2_t *hm2) { + (void)hm2; } diff --git a/src/hal/drivers/mesa-hostmot2/dpll.c b/src/hal/drivers/mesa-hostmot2/dpll.c index e66af301929..cb3fc0d7360 100644 --- a/src/hal/drivers/mesa-hostmot2/dpll.c +++ b/src/hal/drivers/mesa-hostmot2/dpll.c @@ -221,5 +221,6 @@ void hm2_dpll_write(hostmot2_t *hm2, long period) { } } void hm2_dpll_cleanup(hostmot2_t *hm2) { + (void)hm2; // Should all be handled by the HAL housekeeping } diff --git a/src/hal/drivers/mesa-hostmot2/encoder.c b/src/hal/drivers/mesa-hostmot2/encoder.c index 24665989171..a46b24585fa 100644 --- a/src/hal/drivers/mesa-hostmot2/encoder.c +++ b/src/hal/drivers/mesa-hostmot2/encoder.c @@ -1117,6 +1117,7 @@ static void hm2_encoder_instance_process_tram_read(hostmot2_t *hm2, int instance void hm2_encoder_process_tram_read(hostmot2_t *hm2, long l_period_ns) { + (void)l_period_ns; int i; if (hm2->encoder.num_instances <= 0) return; diff --git a/src/hal/drivers/mesa-hostmot2/hm2_7i43.c b/src/hal/drivers/mesa-hostmot2/hm2_7i43.c index 60add081b0f..5d4bd694b82 100644 --- a/src/hal/drivers/mesa-hostmot2/hm2_7i43.c +++ b/src/hal/drivers/mesa-hostmot2/hm2_7i43.c @@ -179,7 +179,7 @@ static int hm2_7i43_epp_clear_timeout(hm2_7i43_t *board) { // FIXME: this is bogus static void hm2_7i43_nanosleep(unsigned long int nanoseconds) { - long int max_ns_delay; + long unsigned int max_ns_delay; max_ns_delay = rtapi_delay_max(); @@ -262,7 +262,6 @@ int hm2_7i43_program_fpga(hm2_lowlevel_io_t *this, const bitfile_t *bitfile) { int orig_debug_epp = debug_epp; // we turn off EPP debugging for this part... hm2_7i43_t *board = this->private; int64_t start_time, end_time; - int i; const rtapi_u8 *firmware = bitfile->e.data; @@ -276,7 +275,7 @@ int hm2_7i43_program_fpga(hm2_lowlevel_io_t *this, const bitfile_t *bitfile) { // select the CPLD's data address hm2_7i43_epp_addr8(0, board); - for (i = 0; i < bitfile->e.size; i ++, firmware ++) { + for (unsigned i = 0; i < bitfile->e.size; i ++, firmware ++) { hm2_7i43_epp_write(bitfile_reverse_bits(*firmware), board); } @@ -302,7 +301,7 @@ int hm2_7i43_program_fpga(hm2_lowlevel_io_t *this, const bitfile_t *bitfile) { if (duration_ns != 0) { THIS_INFO( - "%d bytes of firmware sent (%u KB/s)\n", + "%zu bytes of firmware sent (%u KB/s)\n", bitfile->e.size, (uint32_t)(((double)bitfile->e.size / ((double)duration_ns / (double)(1000 * 1000 * 1000))) / 1024) ); diff --git a/src/hal/drivers/mesa-hostmot2/hm2_7i90.c b/src/hal/drivers/mesa-hostmot2/hm2_7i90.c index 64be532eb01..dbfe475f49d 100644 --- a/src/hal/drivers/mesa-hostmot2/hm2_7i90.c +++ b/src/hal/drivers/mesa-hostmot2/hm2_7i90.c @@ -175,7 +175,7 @@ static int hm2_7i90_epp_clear_timeout(hm2_7i90_t *board) { // FIXME: this is bogus static void hm2_7i90_nanosleep(unsigned long int nanoseconds) { - long int max_ns_delay; + long unsigned int max_ns_delay; max_ns_delay = rtapi_delay_max(); @@ -258,7 +258,6 @@ int hm2_7i90_program_fpga(hm2_lowlevel_io_t *this, const bitfile_t *bitfile) { int orig_debug_epp = debug_epp; // we turn off EPP debugging for this part... hm2_7i90_t *board = this->private; int64_t start_time, end_time; - int i; const rtapi_u8 *firmware = bitfile->e.data; @@ -272,7 +271,7 @@ int hm2_7i90_program_fpga(hm2_lowlevel_io_t *this, const bitfile_t *bitfile) { // select the CPLD's data address hm2_7i90_epp_addr8(0, board); - for (i = 0; i < bitfile->e.size; i ++, firmware ++) { + for (unsigned i = 0; i < bitfile->e.size; i ++, firmware ++) { hm2_7i90_epp_write(bitfile_reverse_bits(*firmware), board); } @@ -298,7 +297,7 @@ int hm2_7i90_program_fpga(hm2_lowlevel_io_t *this, const bitfile_t *bitfile) { if (duration_ns != 0) { THIS_INFO( - "%d bytes of firmware sent (%u KB/s)\n", + "%zu bytes of firmware sent (%u KB/s)\n", bitfile->e.size, (uint32_t)(((double)bitfile->e.size / ((double)duration_ns / (double)(1000 * 1000 * 1000))) / 1024) ); diff --git a/src/hal/drivers/mesa-hostmot2/hm2_eth.c b/src/hal/drivers/mesa-hostmot2/hm2_eth.c index f18bd7ac243..629f5b330af 100644 --- a/src/hal/drivers/mesa-hostmot2/hm2_eth.c +++ b/src/hal/drivers/mesa-hostmot2/hm2_eth.c @@ -875,7 +875,7 @@ static int hm2_eth_receive_queued_reads(hm2_lowlevel_io_t *this) { hm2_eth_t *board = this->private; int recv, i = 0; rtapi_u8 tmp_buffer[board->queue_buff_size]; - long long t1, t2; + unsigned long long t1, t2; t1 = rtapi_get_time(); // an error occurred in the past but the user has reset the io_error @@ -1450,7 +1450,7 @@ static int hm2_eth_probe(hm2_eth_t *board) { board->llio.num_ioport_connectors = idrom.io_ports; board->llio.pins_per_connector = idrom.port_width; - int i; + unsigned i; for(i=0; illio.num_ioport_connectors; i++) board->llio.ioport_connector_name[i] = "??"; board->llio.fpga_part_number = "??"; diff --git a/src/hal/drivers/mesa-hostmot2/hm2_pci.c b/src/hal/drivers/mesa-hostmot2/hm2_pci.c index 816ed361e55..fcca513475d 100644 --- a/src/hal/drivers/mesa-hostmot2/hm2_pci.c +++ b/src/hal/drivers/mesa-hostmot2/hm2_pci.c @@ -242,7 +242,6 @@ static int hm2_pci_write(hm2_lowlevel_io_t *this, rtapi_u32 addr, const void *bu static int hm2_plx9030_program_fpga(hm2_lowlevel_io_t *this, const bitfile_t *bitfile) { hm2_pci_t *board = this->private; - int i; rtapi_u32 status, control; // set /WRITE low for data transfer, and turn on LED @@ -251,7 +250,7 @@ static int hm2_plx9030_program_fpga(hm2_lowlevel_io_t *this, const bitfile_t *bi rtapi_outl(control, board->ctrl_base_addr + CTRL_STAT_OFFSET); // program the FPGA - for (i = 0; i < bitfile->e.size; i ++) { + for (unsigned i = 0; i < bitfile->e.size; i ++) { rtapi_outb(bitfile_reverse_bits(bitfile->e.data[i]), board->data_base_addr); } @@ -362,7 +361,7 @@ static void hm2_plx9030_fixup_LASxBRD_READY(hm2_pci_t *board) { static int hm2_plx9054_program_fpga(hm2_lowlevel_io_t *this, const bitfile_t *bitfile) { hm2_pci_t *board = this->private; - int i; + unsigned i; rtapi_u32 status; // program the FPGA @@ -428,6 +427,7 @@ static int hm2_plx9054_reset(hm2_lowlevel_io_t *this) { static int hm2_pci_probe(struct rtapi_pci_dev *dev, const struct rtapi_pci_device_id *id) { + (void)id; int r; hm2_pci_t *board; hm2_lowlevel_io_t *this; diff --git a/src/hal/drivers/mesa-hostmot2/hm2_rpspi.c b/src/hal/drivers/mesa-hostmot2/hm2_rpspi.c index 3ba7b0ba0e5..4dc0b9cba64 100644 --- a/src/hal/drivers/mesa-hostmot2/hm2_rpspi.c +++ b/src/hal/drivers/mesa-hostmot2/hm2_rpspi.c @@ -792,7 +792,7 @@ static uint32_t read_spiclkbase(void) close(fd); - if(err >= sizeof(buf)-1) { + if(err >= (int)sizeof(buf)-1) { // There are probably too many digits in the number // 250000000 (250 MHz) has 9 digits and there is a newline // following the number @@ -907,7 +907,7 @@ static inline void gpio_fsel(uint32_t pin, uint32_t func) } /*************************************************/ -static void inline gpio_pull(unsigned pin, uint32_t pud) +static inline void gpio_pull(unsigned pin, uint32_t pud) { // Enable/disable pullups on the pins on request reg_wr(&gpio->gppudclk0, 0); // We are not sure about the previous state, make sure @@ -1053,7 +1053,7 @@ static uint8_t *read_file(const char *fname, size_t maxsize, size_t minsize) return NULL; } - nn = sb.st_size > maxsize ? maxsize : sb.st_size; + nn = sb.st_size > (ssize_t)maxsize ? maxsize : (size_t)sb.st_size; if(!(buf = rtapi_kmalloc(nn+1, RTAPI_GFP_KERNEL))) { rtapi_print_msg(RPSPI_ERR, "hm2_rpspi: No dynamic memory\n"); return NULL; diff --git a/src/hal/drivers/mesa-hostmot2/hm2_spix.c b/src/hal/drivers/mesa-hostmot2/hm2_spix.c index d5d2dd7c4ac..5ca49384d38 100644 --- a/src/hal/drivers/mesa-hostmot2/hm2_spix.c +++ b/src/hal/drivers/mesa-hostmot2/hm2_spix.c @@ -527,7 +527,6 @@ ssize_t spix_read_file(const char *fname, void *buffer, size_t bufsize) static int spix_setup(void) { - int i, j; char buf[256]; ssize_t buflen; char *cptr; @@ -536,7 +535,7 @@ static int spix_setup(void) // Setup the clock rate settings from the arguments. // The driver is responsible for actual checking min/max clock frequency. - for(i = 0; i < SPIX_MAX_BOARDS; i++) { + for(unsigned i = 0; i < SPIX_MAX_BOARDS; i++) { if(spiclk_rate[i] < 1) // If not specified spiclk_rate[i] = spiclk_rate[0]; // use first @@ -574,9 +573,10 @@ static int spix_setup(void) // Decompose the device-tree buffer into a string-list with the pointers to // each string in dtcs. Don't go beyond the buffer's size. memset(dtcs, 0, sizeof(dtcs)); - for(i = 0, cptr = buf; i < DTC_MAX && cptr; i++) { + cptr = buf; + for(unsigned i = 0; i < DTC_MAX && cptr; i++) { dtcs[i] = cptr; - j = strlen(cptr); + int j = strlen(cptr); if((cptr - buf) + j + 1 < buflen) cptr += j + 1; else @@ -585,6 +585,7 @@ static int spix_setup(void) // If the driver is forced, check if it actually exists if(force_driver) { + unsigned i; for(i = 0; i < NELEM(drivers); i++) { if(!strcmp(force_driver, drivers[i]->name)) break; @@ -596,7 +597,7 @@ static int spix_setup(void) } // Let each driver do a detect and stop when a match is found. - for(i = 0; i < NELEM(drivers); i++) { + for(unsigned i = 0; i < NELEM(drivers); i++) { if(force_driver && strcmp(force_driver, drivers[i]->name)) continue; if(!drivers[i]->detect(dtcs)) { @@ -614,6 +615,7 @@ static int spix_setup(void) return -ENODEV; } + int i, j; if((i = hwdriver->setup(spi_probe)) < 0) { // Let the hardware driver do its thing LL_INFO("Failed to initialize hardware driver\n"); return i; diff --git a/src/hal/drivers/mesa-hostmot2/hm2_test.c b/src/hal/drivers/mesa-hostmot2/hm2_test.c index 359597ef24e..2c17fa44864 100644 --- a/src/hal/drivers/mesa-hostmot2/hm2_test.c +++ b/src/hal/drivers/mesa-hostmot2/hm2_test.c @@ -83,16 +83,23 @@ static int hm2_test_read(hm2_lowlevel_io_t *this, rtapi_u32 addr, void *buffer, static int hm2_test_write(hm2_lowlevel_io_t *this, rtapi_u32 addr, const void *buffer, int size) { + (void)this; + (void)addr; + (void)buffer; + (void)size; return 1; // success } static int hm2_test_program_fpga(hm2_lowlevel_io_t *this, const bitfile_t *bitfile) { + (void)this; + (void)bitfile; return 0; } static int hm2_test_reset(hm2_lowlevel_io_t *this) { + (void)this; return 0; } diff --git a/src/hal/drivers/mesa-hostmot2/hostmot2-lowlevel.h b/src/hal/drivers/mesa-hostmot2/hostmot2-lowlevel.h index e592bce3c09..383bc127d87 100644 --- a/src/hal/drivers/mesa-hostmot2/hostmot2-lowlevel.h +++ b/src/hal/drivers/mesa-hostmot2/hostmot2-lowlevel.h @@ -144,8 +144,8 @@ struct hm2_lowlevel_io_struct { int needs_reset, needs_soft_reset; // the pin-count and names of the io port connectors on this board - int num_ioport_connectors; - int pins_per_connector; + unsigned num_ioport_connectors; + unsigned pins_per_connector; const char *ioport_connector_name[ANYIO_MAX_IOPORT_CONNECTORS]; // If the llio driver sets this pointer to a non-NULL value, it diff --git a/src/hal/drivers/mesa-hostmot2/hostmot2.c b/src/hal/drivers/mesa-hostmot2/hostmot2.c index ed31eb7ae96..1d13fb1e225 100644 --- a/src/hal/drivers/mesa-hostmot2/hostmot2.c +++ b/src/hal/drivers/mesa-hostmot2/hostmot2.c @@ -178,6 +178,7 @@ static void hm2_write(void *void_hm2, long period) { static void hm2_read_gpio(void *void_hm2, long period) { + (void)period; hostmot2_t *hm2 = void_hm2; // if there are comm problems, wait for the user to fix it @@ -214,7 +215,7 @@ const char *hm2_hz_to_mhz(rtapi_u32 freq_hz) { freq_mhz = freq_hz / (1000*1000); freq_mhz_fractional = (freq_hz / 1000) % 1000; r = snprintf(mhz_str, sizeof(mhz_str), "%d.%03d", freq_mhz, freq_mhz_fractional); - if (r >= sizeof(mhz_str)) { + if (r >= (int)sizeof(mhz_str)) { HM2_ERR_NO_LL("too many MHz!\n"); return "(unpresentable)"; } @@ -1195,6 +1196,7 @@ void hm2_print_modules(hostmot2_t *hm2) { static void hm2_release_device(struct rtapi_device *dev) { + (void)dev; // nothing to do here } @@ -1261,29 +1263,27 @@ int hm2_register(hm2_lowlevel_io_t *llio, char *config_string) { } { - int port; - - for (port = 0; port < llio->num_ioport_connectors; port ++) { + for (unsigned port = 0; port < llio->num_ioport_connectors; port ++) { int i; if (llio->ioport_connector_name[port] == NULL) { - HM2_ERR_NO_LL("llio ioport connector name %d is NULL\n", port); + HM2_ERR_NO_LL("llio ioport connector name %u is NULL\n", port); return -EINVAL; } for (i = 0; i < HAL_NAME_LEN+1; i ++) { if (llio->ioport_connector_name[port][i] == '\0') break; if (!isprint(llio->ioport_connector_name[port][i])) { - HM2_ERR_NO_LL("invalid llio ioport connector name %d passed in (contains non-printable character)\n", port); + HM2_ERR_NO_LL("invalid llio ioport connector name %u passed in (contains non-printable character)\n", port); return -EINVAL; } } if (i == HAL_NAME_LEN+1) { - HM2_ERR_NO_LL("invalid llio ioport connector name %d passed in (not NULL terminated)\n", port); + HM2_ERR_NO_LL("invalid llio ioport connector name %u passed in (not NULL terminated)\n", port); return -EINVAL; } if (i == 0) { - HM2_ERR_NO_LL("invalid llio ioport connector name %d passed in (zero length)\n", port); + HM2_ERR_NO_LL("invalid llio ioport connector name %u passed in (zero length)\n", port); return -EINVAL; } } @@ -1403,7 +1403,7 @@ int hm2_register(hm2_lowlevel_io_t *llio, char *config_string) { HM2_INFO("firmware %s:\n", hm2->config.firmware); HM2_INFO(" %s %s %s\n", bitfile.a.data, bitfile.c.data, bitfile.d.data); HM2_INFO(" Part Name: %s\n", bitfile.b.data); - HM2_INFO(" FPGA Config: %d bytes\n", bitfile.e.size); + HM2_INFO(" FPGA Config: %zu bytes\n", bitfile.e.size); if (llio->fpga_part_number == NULL) { HM2_ERR("llio did not provide an FPGA part number, cannot verify firmware part number\n"); diff --git a/src/hal/drivers/mesa-hostmot2/inmux.c b/src/hal/drivers/mesa-hostmot2/inmux.c index ef87d02fa55..0028bd99f78 100644 --- a/src/hal/drivers/mesa-hostmot2/inmux.c +++ b/src/hal/drivers/mesa-hostmot2/inmux.c @@ -217,39 +217,39 @@ int hm2_inmux_parse_md(hostmot2_t *hm2, int md_index) { } { - int j = 0; + unsigned j = 0; for (j = 0; j < hm2->inmux.instance[i].scanwidth; j++){ - rtapi_snprintf(name, sizeof(name), "%s.inmux.%02d.input-%02d", hm2->llio->name, i, j); + rtapi_snprintf(name, sizeof(name), "%s.inmux.%02d.input-%02u", hm2->llio->name, i, j); r = hal_pin_bit_new(name, HAL_OUT, &(hm2->inmux.instance[i].hal.pin.filt_data[j]), hm2->llio->comp_id); if (r < 0) { HM2_ERR("error adding pin '%s', aborting\n", name); r = -ENOMEM; goto fail1; } - rtapi_snprintf(name, sizeof(name), "%s.inmux.%02d.raw-input-%02d", hm2->llio->name, i, j); + rtapi_snprintf(name, sizeof(name), "%s.inmux.%02d.raw-input-%02u", hm2->llio->name, i, j); r = hal_pin_bit_new(name, HAL_OUT, &(hm2->inmux.instance[i].hal.pin.raw_data[j]), hm2->llio->comp_id); if (r < 0) { HM2_ERR("error adding pin '%s', aborting\n", name); r = -ENOMEM; goto fail1; } - rtapi_snprintf(name, sizeof(name), "%s.inmux.%02d.input-%02d-not", hm2->llio->name, i, j); + rtapi_snprintf(name, sizeof(name), "%s.inmux.%02d.input-%02u-not", hm2->llio->name, i, j); r = hal_pin_bit_new(name, HAL_OUT, &(hm2->inmux.instance[i].hal.pin.filt_data_not[j]), hm2->llio->comp_id); if (r < 0) { HM2_ERR("error adding pin '%s', aborting\n", name); r = -ENOMEM; goto fail1; } - rtapi_snprintf(name, sizeof(name), "%s.inmux.%02d.raw-input-%02d-not", hm2->llio->name, i, j); + rtapi_snprintf(name, sizeof(name), "%s.inmux.%02d.raw-input-%02u-not", hm2->llio->name, i, j); r = hal_pin_bit_new(name, HAL_OUT, &(hm2->inmux.instance[i].hal.pin.raw_data_not[j]), hm2->llio->comp_id); if (r < 0) { HM2_ERR("error adding pin '%s', aborting\n", name); r = -ENOMEM; goto fail1; } - rtapi_snprintf(name, sizeof(name), "%s.inmux.%02d.input-%02d-slow", hm2->llio->name, i, j); + rtapi_snprintf(name, sizeof(name), "%s.inmux.%02d.input-%02u-slow", hm2->llio->name, i, j); r = hal_pin_bit_new(name, HAL_IN, &(hm2->inmux.instance[i].hal.pin.slow[j]), hm2->llio->comp_id); if (r < 0) { HM2_ERR("error adding pin '%s', aborting\n", name); @@ -411,7 +411,6 @@ void hm2_inmux_force_write(hostmot2_t *hm2) { void hm2_inmux_write(hostmot2_t *hm2) { int divisor; int i; - int j; int size; double muxrate; @@ -462,7 +461,7 @@ void hm2_inmux_write(hostmot2_t *hm2) { // HM2_PRINT(" Debug: updating inmux control reg to = 0x%08X\n", hm2->inmux.control_reg[i]); } hm2->inmux.filter_reg[i] = 0; - for (j = 0; j < hm2->inmux.instance[i].scanwidth; j ++) { + for (unsigned j = 0; j < hm2->inmux.instance[i].scanwidth; j ++) { hm2->inmux.filter_reg[i] |= (*hm2->inmux.instance[i].hal.pin.slow[j] << j); } if (hm2->inmux.filter_reg[i] != hm2->inmux.instance[i].written_filter_reg) { @@ -487,12 +486,11 @@ void hm2_inmux_write(hostmot2_t *hm2) { void hm2_inmux_prepare_tram_write(hostmot2_t *hm2) { int i; - int j; // Set register values from HAL pin values. for (i = 0; i < hm2->inmux.num_instances; i ++) { hm2->inmux.filter_reg[i] = 0; - for (j = 0; j < hm2->inmux.instance[i].scanwidth; j ++) { + for (unsigned j = 0; j < hm2->inmux.instance[i].scanwidth; j ++) { hm2->inmux.filter_reg[i] |= (*hm2->inmux.instance[i].hal.pin.slow[j] << j); } } @@ -500,7 +498,6 @@ void hm2_inmux_prepare_tram_write(hostmot2_t *hm2) { void hm2_inmux_process_tram_read(hostmot2_t *hm2) { int i; - int j; int count_diff; int raw_count; @@ -508,7 +505,7 @@ void hm2_inmux_process_tram_read(hostmot2_t *hm2) { return; } for (i = 0; i < hm2->inmux.num_instances; i ++) { - for (j = 0; j < hm2->inmux.instance[i].scanwidth; j ++) { + for (unsigned j = 0; j < hm2->inmux.instance[i].scanwidth; j ++) { *hm2->inmux.instance[i].hal.pin.filt_data[j] = (hm2->inmux.filt_data_reg[i] >> j) &1; *hm2->inmux.instance[i].hal.pin.raw_data[j] = (hm2->inmux.raw_data_reg[i] >> j) &1; *hm2->inmux.instance[i].hal.pin.filt_data_not[j] = !((hm2->inmux.filt_data_reg[i] >> j) &1); diff --git a/src/hal/drivers/mesa-hostmot2/ioport.c b/src/hal/drivers/mesa-hostmot2/ioport.c index 406bdce2699..4e27240765c 100644 --- a/src/hal/drivers/mesa-hostmot2/ioport.c +++ b/src/hal/drivers/mesa-hostmot2/ioport.c @@ -458,10 +458,9 @@ static void hm2_ioport_force_write_open_drain(hostmot2_t *hm2) { void hm2_ioport_initialize_ddr(hostmot2_t *hm2) { int port; - int port_pin; for (port = 0; port < hm2->ioport.num_instances; port ++) { - for (port_pin = 0; port_pin < hm2->idrom.port_width; port_pin ++) { + for (unsigned port_pin = 0; port_pin < hm2->idrom.port_width; port_pin ++) { int io_pin = (port * hm2->idrom.port_width) + port_pin; hm2->pin[io_pin].direction = hm2->pin[io_pin].direction_at_start; } @@ -471,10 +470,9 @@ void hm2_ioport_initialize_ddr(hostmot2_t *hm2) { void hm2_ioport_update(hostmot2_t *hm2) { int port; - int port_pin; for (port = 0; port < hm2->ioport.num_instances; port ++) { - for (port_pin = 0; port_pin < hm2->idrom.port_width; port_pin ++) { + for (unsigned port_pin = 0; port_pin < hm2->idrom.port_width; port_pin ++) { int io_pin = (port * hm2->idrom.port_width) + port_pin; if (hm2->pin[io_pin].gtag == HM2_GTAG_IOPORT) { @@ -576,14 +574,13 @@ void hm2_ioport_gpio_tram_write_init(hostmot2_t *hm2) { void hm2_ioport_gpio_process_tram_read(hostmot2_t *hm2) { int port; - int port_pin; // // parse it out to the HAL pins // for (port = 0; port < hm2->ioport.num_instances; port ++) { - for (port_pin = 0; port_pin < hm2->idrom.port_width; port_pin ++) { + for (unsigned port_pin = 0; port_pin < hm2->idrom.port_width; port_pin ++) { int io_pin = (port * hm2->idrom.port_width) + port_pin; hal_bit_t bit; @@ -604,14 +601,13 @@ void hm2_ioport_gpio_process_tram_read(hostmot2_t *hm2) { void hm2_ioport_gpio_prepare_tram_write(hostmot2_t *hm2) { int port; - int port_pin; // // copy HAL pins to HM2 pins // for (port = 0; port < hm2->ioport.num_instances; port ++) { - for (port_pin = 0; port_pin < hm2->idrom.port_width; port_pin ++) { + for (unsigned port_pin = 0; port_pin < hm2->idrom.port_width; port_pin ++) { int io_pin = (port * hm2->idrom.port_width) + port_pin; if (hm2->pin[io_pin].gtag != HM2_GTAG_IOPORT) continue; @@ -626,7 +622,6 @@ void hm2_ioport_gpio_prepare_tram_write(hostmot2_t *hm2) { void hm2_ioport_gpio_read(hostmot2_t *hm2) { int port; - int port_pin; // this should never happen - what's an AnyIO board without IO? if (hm2->ioport.num_instances <= 0) return; @@ -641,7 +636,7 @@ void hm2_ioport_gpio_read(hostmot2_t *hm2) { // FIXME: this block duplicates code in hm2_ioport_gpio_process_tram_read() for (port = 0; port < hm2->ioport.num_instances; port ++) { - for (port_pin = 0; port_pin < hm2->idrom.port_width; port_pin ++) { + for (unsigned port_pin = 0; port_pin < hm2->idrom.port_width; port_pin ++) { int io_pin = (port * hm2->idrom.port_width) + port_pin; hal_bit_t bit; @@ -657,7 +652,6 @@ void hm2_ioport_gpio_read(hostmot2_t *hm2) { void hm2_ioport_gpio_write(hostmot2_t *hm2) { int port; - int port_pin; // this should never happen - what's an AnyIO board without IO? if (hm2->ioport.num_instances <= 0) return; @@ -666,7 +660,7 @@ void hm2_ioport_gpio_write(hostmot2_t *hm2) { // FIXME: this block duplicates code in hm2_ioport_gpio_prepare_tram_write() for (port = 0; port < hm2->ioport.num_instances; port ++) { - for (port_pin = 0; port_pin < hm2->idrom.port_width; port_pin ++) { + for (unsigned port_pin = 0; port_pin < hm2->idrom.port_width; port_pin ++) { int io_pin = (port * hm2->idrom.port_width) + port_pin; if (hm2->pin[io_pin].gtag != HM2_GTAG_IOPORT) continue; diff --git a/src/hal/drivers/mesa-hostmot2/llio_info.c b/src/hal/drivers/mesa-hostmot2/llio_info.c index 8e6a506ce91..da8dbcea08a 100644 --- a/src/hal/drivers/mesa-hostmot2/llio_info.c +++ b/src/hal/drivers/mesa-hostmot2/llio_info.c @@ -219,16 +219,15 @@ static const info_entry_t spiboards[] = { const char *set_llio_info_spi(hm2_lowlevel_io_t *llio, const hm2_idrom_t *idrom) { - int i, j; char buf[sizeof(idrom->board_name)+1]; /* In the far future, when there are too many boards, use bsearch */ /* With few boards, linear search is faster */ - for(i = 0; i < NELEM(spiboards); i++) { + for(unsigned i = 0; i < NELEM(spiboards); i++) { if(!memcmp(idrom->board_name, spiboards[i].board_name, sizeof(idrom->board_name))) { llio->num_ioport_connectors = spiboards[i].num_ioport_connectors; llio->pins_per_connector = spiboards[i].pins_per_connector; - for(j = 0; j < ANYIO_MAX_IOPORT_CONNECTORS; j++) + for(unsigned j = 0; j < ANYIO_MAX_IOPORT_CONNECTORS; j++) llio->ioport_connector_name[j] = spiboards[i].ioport_connector_name[j]; llio->io_connector_pin_names = spiboards[i].io_connector_pin_names; llio->num_leds = spiboards[i].num_leds; @@ -245,7 +244,7 @@ const char *set_llio_info_spi(hm2_lowlevel_io_t *llio, const hm2_idrom_t *idrom) memcpy(buf, idrom->board_name, sizeof(idrom->board_name)); buf[sizeof(idrom->board_name)] = 0; - for(i = 0; i < sizeof(idrom->board_name); i++) { + for(unsigned i = 0; i < sizeof(idrom->board_name); i++) { if(!isprint(buf[i])) buf[i] = '?'; } diff --git a/src/hal/drivers/mesa-hostmot2/outm.c b/src/hal/drivers/mesa-hostmot2/outm.c index 782504ae167..72eee9afc60 100644 --- a/src/hal/drivers/mesa-hostmot2/outm.c +++ b/src/hal/drivers/mesa-hostmot2/outm.c @@ -89,7 +89,7 @@ int hm2_outm_parse_md(hostmot2_t *hm2, int md_index) { { int inst; for (inst = 0; inst < hm2->outm.num_instances; inst ++) { - int out; + unsigned out; for ( out = 0; out < sizeof(hm2->outm.instance[0].hal.pin.out)/sizeof(hm2->outm.instance[0].hal.pin.out[0]); diff --git a/src/hal/drivers/mesa-hostmot2/pins.c b/src/hal/drivers/mesa-hostmot2/pins.c index 62be96025b1..af605a7ab78 100644 --- a/src/hal/drivers/mesa-hostmot2/pins.c +++ b/src/hal/drivers/mesa-hostmot2/pins.c @@ -768,8 +768,7 @@ int hm2_read_pin_descriptors(hostmot2_t *hm2) { pin->port_num = i / hm2->idrom.port_width; - if ((pin->port_num < 0 ) - || (pin->port_num >= hm2->llio->num_ioport_connectors)){ + if (pin->port_num >= hm2->llio->num_ioport_connectors) { HM2_ERR("hm2_read_pin_descriptors: Calculated port number (%d) is " "invalid\n", pin->port_pin ); return -EINVAL; @@ -777,7 +776,7 @@ int hm2_read_pin_descriptors(hostmot2_t *hm2) { pin->bit_num = i % hm2->idrom.port_width; - if ((pin->bit_num < 0 ) || (pin->bit_num > 31)){ + if (pin->bit_num > 31) { HM2_ERR("hm2_read_pin_descriptors: Calculated bit number (%d) is " "invalid\n", pin->bit_num ); return -EINVAL; diff --git a/src/hal/drivers/mesa-hostmot2/pktuart.c b/src/hal/drivers/mesa-hostmot2/pktuart.c index cf2b2302fac..4234b01e826 100644 --- a/src/hal/drivers/mesa-hostmot2/pktuart.c +++ b/src/hal/drivers/mesa-hostmot2/pktuart.c @@ -746,7 +746,7 @@ int hm2_pktuart_queue_get_frame_sizes(char *name, rtapi_u32 fsizes[]){ return -EINVAL; } - for (j = 0; j < ((hm2->pktuart.rx_status_reg[inst] >> 16) & 0x1F); j++ ){ + for (j = 0; j < (int)((hm2->pktuart.rx_status_reg[inst] >> 16) & 0x1F); j++ ){ rtapi_print_msg(RTAPI_MSG_INFO, "j = %i\n", j); r = hm2->llio->queue_read(hm2->llio, hm2->pktuart.instance[inst].rx_fifo_count_addr, &fsizes[j], sizeof(rtapi_u32)); @@ -850,9 +850,11 @@ void hm2_pktuart_print_module(hostmot2_t *hm2){ void hm2_pktuart_cleanup(hostmot2_t *hm2) { + (void)hm2; } void hm2_pktuart_write(hostmot2_t *hm2) { + (void)hm2; } diff --git a/src/hal/drivers/mesa-hostmot2/resolver.c b/src/hal/drivers/mesa-hostmot2/resolver.c index 98bce0f99dc..1f12839bd15 100644 --- a/src/hal/drivers/mesa-hostmot2/resolver.c +++ b/src/hal/drivers/mesa-hostmot2/resolver.c @@ -34,6 +34,7 @@ #include "hal/drivers/mesa-hostmot2/hostmot2.h" int hm2_resolver_get_param(int param){ + (void)param; // This function will eventually return parameters from the 7i49 // but for now, it just returns the number 6 return 6; @@ -326,6 +327,7 @@ int hm2_resolver_parse_md(hostmot2_t *hm2, int md_index) { } void hm2_resolver_process_tram_read(hostmot2_t *hm2, long period) { + (void)period; int i; hm2_resolver_instance_t *res; double scale; diff --git a/src/hal/drivers/mesa-hostmot2/setsserial.c b/src/hal/drivers/mesa-hostmot2/setsserial.c index e749ed2a1b8..d4cba085019 100644 --- a/src/hal/drivers/mesa-hostmot2/setsserial.c +++ b/src/hal/drivers/mesa-hostmot2/setsserial.c @@ -122,6 +122,7 @@ int set_nvram_param(rtapi_u32 addr, rtapi_u32 value){ } static void setsserial_release(struct rtapi_device *dev) { + (void)dev; // nothing to do here } @@ -301,7 +302,7 @@ int sslbp_flash(char *fname){ const struct rtapi_firmware *fw; struct rtapi_device dev; int r; - int write_sz, erase_sz; + unsigned write_sz, erase_sz; if (strstr("8i20", remote->name)){ if (hm2->sserial.version < 37){ @@ -347,21 +348,20 @@ int sslbp_flash(char *fname){ if (setup_start() < 0) goto fail0; flash_start(); - write_sz = 1 << sslbp_read_byte(LBPFLASHWRITESIZELOC); - erase_sz = 1 << sslbp_read_byte(LBPFLASHERASESIZELOC); + write_sz = 1u << sslbp_read_byte(LBPFLASHWRITESIZELOC); + erase_sz = 1u << sslbp_read_byte(LBPFLASHERASESIZELOC); HM2_PRINT("Write Size = %x, Erase Size = %x\n", write_sz, erase_sz); flash_stop(); //Programming Loop { - int ReservedBlock = 0; - int StartBlock = ReservedBlock + 1; + unsigned ReservedBlock = 0; + unsigned StartBlock = ReservedBlock + 1; - int blocknum = StartBlock; - int block_start; - int i, j, t; + unsigned blocknum = StartBlock; + unsigned i, j, t; while (blocknum * erase_sz < fw->size){ - block_start = blocknum * erase_sz; + unsigned block_start = blocknum * erase_sz; for (t = 0; t < erase_sz && fw->data[block_start + t] == 0 ; t++){ } if (t < erase_sz){ // found a non-zero byte flash_start(); diff --git a/src/hal/drivers/mesa-hostmot2/spix_rpi3.c b/src/hal/drivers/mesa-hostmot2/spix_rpi3.c index 61160ed5fdf..1a77c061ee0 100644 --- a/src/hal/drivers/mesa-hostmot2/spix_rpi3.c +++ b/src/hal/drivers/mesa-hostmot2/spix_rpi3.c @@ -599,7 +599,7 @@ static uint32_t read_spiclkbase(void) } } - if(err >= sizeof(buf)-1) { + if(err >= (int)sizeof(buf)-1) { // There are probably too many digits in the number // 250000000 (250 MHz) has 9 digits and there is a newline // following the number diff --git a/src/hal/drivers/mesa-hostmot2/sserial.c b/src/hal/drivers/mesa-hostmot2/sserial.c index 7259da4a72a..121bf9ad9d2 100644 --- a/src/hal/drivers/mesa-hostmot2/sserial.c +++ b/src/hal/drivers/mesa-hostmot2/sserial.c @@ -219,7 +219,7 @@ int check_set_baudrate(hostmot2_t *hm2, hm2_sserial_instance_t *inst){ baudaddr = getlocal8(hm2, inst, SSLBPCHANNELSTARTLOC) + (c * lbpstride) + 42; baudrate = getlocal32(hm2, inst, baudaddr); HM2_PRINT("Chan %i baudrate = %i\n", c, baudrate); - if (baudrate != hm2->sserial.baudrate) { + if (baudrate != (unsigned)hm2->sserial.baudrate) { if (setlocal32(hm2, inst, baudaddr, hm2->sserial.baudrate) < 0) { HM2_ERR("Problem setting new baudrate, power-off reset may be needed to" " recover from this.\n"); @@ -326,6 +326,7 @@ void config_8i20(hostmot2_t *hm2, hm2_sserial_remote_t *chan){ } void config_7i64(hostmot2_t *hm2, hm2_sserial_remote_t *chan){ + (void)hm2; chan->num_modes=0; chan->num_confs = sizeof(hm2_7i64_params) / sizeof(hm2_sserial_data_t); chan->confs = rtapi_kzalloc(sizeof(hm2_7i64_params), RTAPI_GFP_KERNEL); @@ -559,7 +560,7 @@ int hm2_sserial_parse_md(hostmot2_t *hm2, int md_index){ hm2_module_descriptor_t *md = &hm2->md[md_index]; int i, c; int pin = -1; - int port_pin, port; + int port; rtapi_u32 ddr_reg, src_reg, buff; int r = -EINVAL; int count = 0; @@ -638,7 +639,7 @@ int hm2_sserial_parse_md(hostmot2_t *hm2, int md_index){ for (port = 0; port < hm2->ioport.num_instances; port ++) { ddr_reg = 0; src_reg = 0; - for (port_pin = 0 ; port_pin < hm2->idrom.port_width; port_pin ++){ + for (unsigned port_pin = 0 ; port_pin < hm2->idrom.port_width; port_pin ++){ pin++; if (hm2->pin[pin].sec_tag == HM2_GTAG_SMARTSERIAL || hm2->pin[pin].sec_tag == HM2_GTAG_SMARTSERIALB) { @@ -1708,9 +1709,9 @@ int hm2_sserial_register_tram(hostmot2_t *hm2, hm2_sserial_remote_t *chan){ break; case 2: *inst->state2 = 1; - if (++inst->g_index >= inst->remotes[inst->r_index].num_globals){ + if ((int)++inst->g_index >= inst->remotes[inst->r_index].num_globals){ inst->g_index = 0; - if (++inst->r_index >= inst->num_remotes){//checked them all + if ((int)++inst->r_index >= inst->num_remotes){//checked them all *inst->state2 = 0; } } @@ -2032,7 +2033,7 @@ int hm2_sserial_read_pins(hm2_sserial_remote_t *chan){ if (*pin->boolean && ppr > 0){ // index-enable set rtapi_div_s64_rem(previous, ppr, &rem1); rtapi_div_s64_rem(pin->accum, ppr, &rem2); - if (abs(rem1 - rem2) > ppr / 2 + if ((unsigned)abs(rem1 - rem2) > ppr / 2 || (rem1 >= 0 && rem2 < 0) || (rem1 < 0 && rem2 >= 0)){ if (pin->accum > previous){ @@ -2089,6 +2090,7 @@ int hm2_sserial_read_pins(hm2_sserial_remote_t *chan){ } void hm2_sserial_process_tram_read(hostmot2_t *hm2, long period){ + (void)period; int i, c; for (i = 0 ; i < hm2->sserial.num_instances ; i++){ hm2_sserial_instance_t *inst = &hm2->sserial.instance[i]; @@ -2256,6 +2258,7 @@ int hm2_sserial_check_remote_errors(hostmot2_t *hm2, hm2_sserial_instance_t *ins } void hm2_sserial_force_write(hostmot2_t *hm2){ + (void)hm2; // there's nothing to do here, because hm2_sserial_prepare_tram_write takes // charge of recovering after communication error. } diff --git a/src/hal/drivers/mesa-hostmot2/sserial.h b/src/hal/drivers/mesa-hostmot2/sserial.h index dbf1ba01221..e6391f30eb4 100644 --- a/src/hal/drivers/mesa-hostmot2/sserial.h +++ b/src/hal/drivers/mesa-hostmot2/sserial.h @@ -223,65 +223,65 @@ typedef struct { // The 8i20 and 7i64 pre-date parameter discovery static const hm2_sserial_data_t hm2_8i20_params[] = { - {LBP_DATA,0x10,LBP_UNSIGNED,LBP_OUT,0.0,1.0,0,"degrees","angle"}, - {LBP_DATA,0x10,LBP_SIGNED,LBP_OUT,-10.0,10.0,0,"amps","current"}, - {LBP_DATA,0x10,LBP_UNSIGNED,LBP_IN,0,65535,0,"Deg C","card-temp"}, - {LBP_DATA,0x10,LBP_UNSIGNED,LBP_IN,0,655.35,0,"volts","bus-voltage"}, - {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","status.current-lim"}, - {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","status.brake-on"}, - {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","status.brake-old"}, - {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","status.bus-underv"}, - {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","status.wd-reset"}, - {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","status.sw-reset"}, - {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","status.ext-reset"}, - {LBP_DATA,0x01,LBP_PAD,LBP_IN,0,0,0,"pad","pad"}, - {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","status.no-enable"}, - {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","status.pid-on"}, - {LBP_DATA,0x06,LBP_PAD,LBP_IN,0,0,0,"pad","pad"}, + {LBP_DATA,0x10,LBP_UNSIGNED,LBP_OUT,0.0,1.0,0,"degrees","angle",0}, + {LBP_DATA,0x10,LBP_SIGNED,LBP_OUT,-10.0,10.0,0,"amps","current",0}, + {LBP_DATA,0x10,LBP_UNSIGNED,LBP_IN,0,65535,0,"Deg C","card-temp",0}, + {LBP_DATA,0x10,LBP_UNSIGNED,LBP_IN,0,655.35,0,"volts","bus-voltage",0}, + {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","status.current-lim",0}, + {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","status.brake-on",0}, + {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","status.brake-old",0}, + {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","status.bus-underv",0}, + {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","status.wd-reset",0}, + {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","status.sw-reset",0}, + {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","status.ext-reset",0}, + {LBP_DATA,0x01,LBP_PAD,LBP_IN,0,0,0,"pad","pad",0}, + {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","status.no-enable",0}, + {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","status.pid-on",0}, + {LBP_DATA,0x06,LBP_PAD,LBP_IN,0,0,0,"pad","pad",0}, - {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","fault.watchdog"}, - {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","fault.no-enable"}, - {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","fault.overtemp"}, - {LBP_DATA,0x01,LBP_PAD,LBP_IN,0,0,0,"pad","pad"}, - {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","fault.overcurrent"}, - {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","fault.U-current"}, - {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","fault.V-current"}, - {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","fault.W-current"}, - {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","fault.bus-underv"}, - {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","fault.bus-high"}, - {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","fault.bus-overv"}, - {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","fault.module"}, - {LBP_DATA,0x01,LBP_PAD,LBP_IN,0,0,0,"pad","pad"}, - {LBP_DATA,0x01,LBP_PAD,LBP_IN,0,0,0,"pad","pad"}, - {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","fault.overrun"}, - {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","fault.framingr"} + {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","fault.watchdog",0}, + {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","fault.no-enable",0}, + {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","fault.overtemp",0}, + {LBP_DATA,0x01,LBP_PAD,LBP_IN,0,0,0,"pad","pad",0}, + {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","fault.overcurrent",0}, + {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","fault.U-current",0}, + {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","fault.V-current",0}, + {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","fault.W-current",0}, + {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","fault.bus-underv",0}, + {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","fault.bus-high",0}, + {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","fault.bus-overv",0}, + {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","fault.module",0}, + {LBP_DATA,0x01,LBP_PAD,LBP_IN,0,0,0,"pad","pad",0}, + {LBP_DATA,0x01,LBP_PAD,LBP_IN,0,0,0,"pad","pad",0}, + {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","fault.overrun",0}, + {LBP_DATA,0x01,LBP_BOOLEAN,LBP_IN,0,0,0,"none","fault.framingr",0} }; static const hm2_sserial_data_t hm2_8i20_globals[] = { - {LBP_DATA,0x10,LBP_UNSIGNED,LBP_IN,0,0,2164,"none","swrevision"}, - {LBP_DATA,0x20,LBP_UNSIGNED,LBP_IN,0,0,2344,"none","unitnumber"}, - {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,32.768,2,"amps","nvmaxcurrent"}, - {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,0,36,"volts","nvbusundervmax"}, - {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,0,34,"volts","nvbusundervmin"}, - {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,0,38,"volts","nvbusoverv"}, - {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,0,40,"volts","nvbrakeonv"}, - {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,0,42,"volts","nvbrakeoffv"}, - {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,0,6,"bps","nvrembaudrate"}, - {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,0,10,"none","nvkqp"}, - {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,0,14,"none","nvkqihi"}, - {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,0,12,"none","nvkqilo"}, - {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,0,16,"none","nvkqil"}, - {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,0,18,"none","nvkdp"}, - {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,0,22,"none","nvkdihi"}, - {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,0,20,"none","nvkdilo"}, - {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,0,24,"none","nvkdil"} + {LBP_DATA,0x10,LBP_UNSIGNED,LBP_IN,0,0,2164,"none","swrevision",0}, + {LBP_DATA,0x20,LBP_UNSIGNED,LBP_IN,0,0,2344,"none","unitnumber",0}, + {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,32.768,2,"amps","nvmaxcurrent",0}, + {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,0,36,"volts","nvbusundervmax",0}, + {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,0,34,"volts","nvbusundervmin",0}, + {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,0,38,"volts","nvbusoverv",0}, + {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,0,40,"volts","nvbrakeonv",0}, + {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,0,42,"volts","nvbrakeoffv",0}, + {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,0,6,"bps","nvrembaudrate",0}, + {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,0,10,"none","nvkqp",0}, + {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,0,14,"none","nvkqihi",0}, + {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,0,12,"none","nvkqilo",0}, + {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,0,16,"none","nvkqil",0}, + {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,0,18,"none","nvkdp",0}, + {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,0,22,"none","nvkdihi",0}, + {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,0,20,"none","nvkdilo",0}, + {LBP_DATA,0x10,LBP_NONVOL_UNSIGNED,LBP_OUT,0,0,24,"none","nvkdil",0} }; static const hm2_sserial_data_t hm2_7i64_params[] = { - {LBP_DATA,0x18,LBP_BITS,LBP_OUT,0,0,0,"none","output"}, - {LBP_DATA,0x18,LBP_BITS,LBP_IN,0,0,0,"none","input"}, - {LBP_DATA,0x08,LBP_PAD,LBP_IN,0,0,0,"pad","pad"}, - {LBP_DATA,0x10,LBP_UNSIGNED,LBP_IN,0,3.3,0,"volts","analog0"}, - {LBP_DATA,0x10,LBP_UNSIGNED,LBP_IN,0,3.3,0,"volts","analog1"} + {LBP_DATA,0x18,LBP_BITS,LBP_OUT,0,0,0,"none","output",0}, + {LBP_DATA,0x18,LBP_BITS,LBP_IN,0,0,0,"none","input",0}, + {LBP_DATA,0x08,LBP_PAD,LBP_IN,0,0,0,"pad","pad",0}, + {LBP_DATA,0x10,LBP_UNSIGNED,LBP_IN,0,3.3,0,"volts","analog0",0}, + {LBP_DATA,0x10,LBP_UNSIGNED,LBP_IN,0,3.3,0,"volts","analog1",0} }; #endif diff --git a/src/hal/drivers/mesa-hostmot2/ssr.c b/src/hal/drivers/mesa-hostmot2/ssr.c index aa57eac1424..4ddd29ef20f 100644 --- a/src/hal/drivers/mesa-hostmot2/ssr.c +++ b/src/hal/drivers/mesa-hostmot2/ssr.c @@ -94,7 +94,7 @@ int hm2_ssr_parse_md(hostmot2_t *hm2, int md_index) { { int inst; for (inst = 0; inst < hm2->ssr.num_instances; inst ++) { - int out; + unsigned out; for ( out = 0; out < sizeof(hm2->ssr.instance[0].hal.pin.out)/sizeof(hm2->ssr.instance[0].hal.pin.out[0]); diff --git a/src/hal/drivers/mesa-hostmot2/stepgen.c b/src/hal/drivers/mesa-hostmot2/stepgen.c index 8eb43d9a7d8..11e44870822 100644 --- a/src/hal/drivers/mesa-hostmot2/stepgen.c +++ b/src/hal/drivers/mesa-hostmot2/stepgen.c @@ -38,6 +38,7 @@ // void hm2_stepgen_process_tram_read(hostmot2_t *hm2, long l_period_ns) { + (void)l_period_ns; int i; rtapi_u32 mode = 0; rtapi_u32 latch = 0; @@ -543,7 +544,7 @@ void hm2_stepgen_write(hostmot2_t *hm2) { } if (hm2->stepgen.num_instances > 0 && hm2->dpll_module_present) { - if (*hm2->stepgen.hal->pin.dpll_timer_num != hm2->stepgen.written_dpll_timer_num) { + if (*hm2->stepgen.hal->pin.dpll_timer_num != (int)hm2->stepgen.written_dpll_timer_num) { hm2_stepgen_set_dpll_timer(hm2); } } diff --git a/src/hal/drivers/mesa-hostmot2/uart.c b/src/hal/drivers/mesa-hostmot2/uart.c index 0b24cab957d..e072f82feef 100644 --- a/src/hal/drivers/mesa-hostmot2/uart.c +++ b/src/hal/drivers/mesa-hostmot2/uart.c @@ -367,9 +367,11 @@ void hm2_uart_print_module(hostmot2_t *hm2){ void hm2_uart_cleanup(hostmot2_t *hm2) { + (void)hm2; } void hm2_uart_write(hostmot2_t *hm2) { + (void)hm2; } diff --git a/src/hal/drivers/mesa-hostmot2/xy2mod.c b/src/hal/drivers/mesa-hostmot2/xy2mod.c index 63f1bb9b4bf..844ad35dc7e 100644 --- a/src/hal/drivers/mesa-hostmot2/xy2mod.c +++ b/src/hal/drivers/mesa-hostmot2/xy2mod.c @@ -289,10 +289,10 @@ void hm2_xy2mod_write(hostmot2_t *hm2) { hm2_xy2mod_instance_write(hm2, i); } if (hm2->xy2mod.num_instances > 0 && hm2->dpll_module_present) { - if (*hm2->xy2mod.hal->pin.dpll_rtimer_num != hm2->xy2mod.written_dpll_rtimer_num) { + if (*hm2->xy2mod.hal->pin.dpll_rtimer_num != (int)hm2->xy2mod.written_dpll_rtimer_num) { hm2_xy2mod_set_dpll_rtimer(hm2); } - if (*hm2->xy2mod.hal->pin.dpll_wtimer_num != hm2->xy2mod.written_dpll_wtimer_num) { + if (*hm2->xy2mod.hal->pin.dpll_wtimer_num != (int)hm2->xy2mod.written_dpll_wtimer_num) { hm2_xy2mod_set_dpll_wtimer(hm2); } } diff --git a/src/hal/hal_lib.c b/src/hal/hal_lib.c index 33a9815e6ce..3ddf62251c9 100644 --- a/src/hal/hal_lib.c +++ b/src/hal/hal_lib.c @@ -2109,7 +2109,7 @@ int hal_create_thread(const char *name, unsigned long period_nsec, int uses_fp) } } /* make sure period <= desired period (allow 1% roundoff error) */ - if (curr_period > (period_nsec + (period_nsec / 100))) { + if (curr_period > (long)(period_nsec + (period_nsec / 100))) { rtapi_mutex_give(&(hal_data->mutex)); rtapi_print_msg(RTAPI_MSG_ERR, "HAL_LIB: ERROR: clock period too long: %ld\n", curr_period); @@ -2131,7 +2131,7 @@ int hal_create_thread(const char *name, unsigned long period_nsec, int uses_fp) prev_period = tptr->period; prev_priority = tptr->priority; } - if ( period_nsec < hal_data->base_period) { + if ( (long)period_nsec < hal_data->base_period) { rtapi_mutex_give(&(hal_data->mutex)); rtapi_print_msg(RTAPI_MSG_ERR, "HAL_LIB: ERROR: new thread period %ld is less than clock period %ld\n", diff --git a/src/hal/utils/scope_rt.c b/src/hal/utils/scope_rt.c index 70e814ba9ac..65f103bd001 100644 --- a/src/hal/utils/scope_rt.c +++ b/src/hal/utils/scope_rt.c @@ -145,6 +145,8 @@ void rtapi_app_exit(void) static void sample(void *arg, long period) { + (void)arg; + (void)period; int n; ctrl_shm->watchdog = 0; @@ -391,7 +393,7 @@ static void init_rt_control_struct(void *shmem) /* first clear entire struct to all zeros */ cp = (char *) ctrl_rt; - for (n = 0; n < sizeof(scope_rt_control_t); n++) { + for (n = 0; n < (int)sizeof(scope_rt_control_t); n++) { cp[n] = 0; } /* save pointer to shared control structure */ @@ -413,7 +415,7 @@ static void init_shm_control_struct(void) /* first clear entire struct to all zeros */ cp = (char *) ctrl_shm; - for (n = 0; n < sizeof(scope_shm_control_t); n++) { + for (n = 0; n < (int)sizeof(scope_shm_control_t); n++) { cp[n] = 0; } /* round size of shared struct up to a multiple of 4 for alignment */ diff --git a/src/rtapi/rtapi_device.h b/src/rtapi/rtapi_device.h index dfe1db14978..28d9735eeaf 100644 --- a/src/rtapi/rtapi_device.h +++ b/src/rtapi/rtapi_device.h @@ -57,7 +57,7 @@ rtapi_dev_set_name(struct rtapi_device *dev, const char *name, ...) } -static __inline__ int rtapi_device_register(struct rtapi_device *dev) {return 0;} +static __inline__ int rtapi_device_register(struct rtapi_device *dev) { (void)dev; return 0;} static __inline__ void rtapi_device_unregister(struct rtapi_device *dev) { dev->release(dev); }; RTAPI_END_DECLS