[Xenomai-git] Jorge Ramirez-Ortiz : utils/analogy: calibration - use the analogy' s math utils
Module: xenomai-3 Branch: master Commit: a66aefdeb317df5772f84eeba1468343a9e450c1 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=a66aefdeb317df5772f84eeba1468343a9e450c1 Author: Jorge Ramirez-Ortiz j...@xenomai.org Date: Tue Oct 14 21:03:05 2014 -0400 utils/analogy: calibration - use the analogy's math utils --- include/rtdm/analogy.h| 12 ++ include/rtdm/uapi/analogy.h |2 +- lib/analogy/Makefile.am |5 +- lib/analogy/calibration.c | 22 ++ lib/analogy/calibration.h | 21 ++ lib/analogy/math.c| 418 + utils/analogy/Makefile.am |2 +- utils/analogy/analogy_calibrate.c |6 +- utils/analogy/calibration_ni_m.c | 106 +++--- utils/analogy/calibration_ni_m.h |6 +- 10 files changed, 515 insertions(+), 85 deletions(-) diff --git a/include/rtdm/analogy.h b/include/rtdm/analogy.h index fd26f58..c03d2b1 100644 --- a/include/rtdm/analogy.h +++ b/include/rtdm/analogy.h @@ -236,6 +236,18 @@ void a4l_write_calibration_file(FILE *dst, struct list *l, int a4l_read_calibration_file(char *name, struct a4l_calibration_data *data); +int a4l_math_polyfit(unsigned order, double *r,double orig, +const unsigned dim, double *x, double *y); + +void a4l_math_mean(double *pmean, double *val, unsigned nr); + +void a4l_math_stddev(double *pstddev, +double mean, double *val, unsigned nr); + +void a4l_math_stddev_of_mean(double *pstddevm, +double mean, double *val, unsigned nr); + + #endif /* !DOXYGEN_CPP */ diff --git a/include/rtdm/uapi/analogy.h b/include/rtdm/uapi/analogy.h index 669ded7..a0a1e59 100644 --- a/include/rtdm/uapi/analogy.h +++ b/include/rtdm/uapi/analogy.h @@ -708,9 +708,9 @@ typedef struct a4l_instruction_list a4l_insnlst_t; struct a4l_calibration_subdev { a4l_sbinfo_t *info; + char *name; int slen; int idx; - char *name; }; struct a4l_calibration_subdev_data { diff --git a/lib/analogy/Makefile.am b/lib/analogy/Makefile.am index 500453d..b79d4cb 100644 --- a/lib/analogy/Makefile.am +++ b/lib/analogy/Makefile.am @@ -7,6 +7,7 @@ libanalogy_la_SOURCES = \ descriptor.c\ info.c \ internal.h \ + math.c \ calibration.c \ range.c \ root_leaf.h \ @@ -19,4 +20,6 @@ libanalogy_la_CPPFLAGS = \ -I$(top_srcdir)/lib/boilerplate libanalogy_la_LIBADD = \ - ../boilerplate/libboilerplate.la + ../boilerplate/libboilerplate.la\ + -lm + diff --git a/lib/analogy/calibration.c b/lib/analogy/calibration.c index 74b2789..85860d1 100644 --- a/lib/analogy/calibration.c +++ b/lib/analogy/calibration.c @@ -1,3 +1,25 @@ +/** + * @file + * Analogy for Linux, device, subdevice, etc. related features + * + * @note Copyright (C) 1997-2000 David A. Schleef d...@schleef.org + * @note Copyright (C) 2014 Jorge A. Ramirez-Ortiz j...@xenomai.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * 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 rtdm/analogy.h #include stdio.h #include errno.h diff --git a/lib/analogy/calibration.h b/lib/analogy/calibration.h index 04a7e72..4080c60 100644 --- a/lib/analogy/calibration.h +++ b/lib/analogy/calibration.h @@ -1,3 +1,24 @@ +/** + * @file + * Analogy for Linux, internal calibration declarations + * + * @note Copyright (C) 2014 Jorge A Ramirez-Ortiz j...@xenomai.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + #ifndef __ANALOGY_CALIBRATION_H__
[Xenomai-git] Jorge Ramirez-Ortiz : utils/analogy: calibration - use the analogy' s math utils
Module: xenomai-3 Branch: next Commit: a66aefdeb317df5772f84eeba1468343a9e450c1 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=a66aefdeb317df5772f84eeba1468343a9e450c1 Author: Jorge Ramirez-Ortiz j...@xenomai.org Date: Tue Oct 14 21:03:05 2014 -0400 utils/analogy: calibration - use the analogy's math utils --- include/rtdm/analogy.h| 12 ++ include/rtdm/uapi/analogy.h |2 +- lib/analogy/Makefile.am |5 +- lib/analogy/calibration.c | 22 ++ lib/analogy/calibration.h | 21 ++ lib/analogy/math.c| 418 + utils/analogy/Makefile.am |2 +- utils/analogy/analogy_calibrate.c |6 +- utils/analogy/calibration_ni_m.c | 106 +++--- utils/analogy/calibration_ni_m.h |6 +- 10 files changed, 515 insertions(+), 85 deletions(-) diff --git a/include/rtdm/analogy.h b/include/rtdm/analogy.h index fd26f58..c03d2b1 100644 --- a/include/rtdm/analogy.h +++ b/include/rtdm/analogy.h @@ -236,6 +236,18 @@ void a4l_write_calibration_file(FILE *dst, struct list *l, int a4l_read_calibration_file(char *name, struct a4l_calibration_data *data); +int a4l_math_polyfit(unsigned order, double *r,double orig, +const unsigned dim, double *x, double *y); + +void a4l_math_mean(double *pmean, double *val, unsigned nr); + +void a4l_math_stddev(double *pstddev, +double mean, double *val, unsigned nr); + +void a4l_math_stddev_of_mean(double *pstddevm, +double mean, double *val, unsigned nr); + + #endif /* !DOXYGEN_CPP */ diff --git a/include/rtdm/uapi/analogy.h b/include/rtdm/uapi/analogy.h index 669ded7..a0a1e59 100644 --- a/include/rtdm/uapi/analogy.h +++ b/include/rtdm/uapi/analogy.h @@ -708,9 +708,9 @@ typedef struct a4l_instruction_list a4l_insnlst_t; struct a4l_calibration_subdev { a4l_sbinfo_t *info; + char *name; int slen; int idx; - char *name; }; struct a4l_calibration_subdev_data { diff --git a/lib/analogy/Makefile.am b/lib/analogy/Makefile.am index 500453d..b79d4cb 100644 --- a/lib/analogy/Makefile.am +++ b/lib/analogy/Makefile.am @@ -7,6 +7,7 @@ libanalogy_la_SOURCES = \ descriptor.c\ info.c \ internal.h \ + math.c \ calibration.c \ range.c \ root_leaf.h \ @@ -19,4 +20,6 @@ libanalogy_la_CPPFLAGS = \ -I$(top_srcdir)/lib/boilerplate libanalogy_la_LIBADD = \ - ../boilerplate/libboilerplate.la + ../boilerplate/libboilerplate.la\ + -lm + diff --git a/lib/analogy/calibration.c b/lib/analogy/calibration.c index 74b2789..85860d1 100644 --- a/lib/analogy/calibration.c +++ b/lib/analogy/calibration.c @@ -1,3 +1,25 @@ +/** + * @file + * Analogy for Linux, device, subdevice, etc. related features + * + * @note Copyright (C) 1997-2000 David A. Schleef d...@schleef.org + * @note Copyright (C) 2014 Jorge A. Ramirez-Ortiz j...@xenomai.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * 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 rtdm/analogy.h #include stdio.h #include errno.h diff --git a/lib/analogy/calibration.h b/lib/analogy/calibration.h index 04a7e72..4080c60 100644 --- a/lib/analogy/calibration.h +++ b/lib/analogy/calibration.h @@ -1,3 +1,24 @@ +/** + * @file + * Analogy for Linux, internal calibration declarations + * + * @note Copyright (C) 2014 Jorge A Ramirez-Ortiz j...@xenomai.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + #ifndef __ANALOGY_CALIBRATION_H__
[Xenomai-git] Jorge Ramirez-Ortiz : utils/analogy: calibration - use the analogy' s math utils
Module: xenomai-3 Branch: next Commit: 9d04cc5ee852c064cad2f28002db883d11131299 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=9d04cc5ee852c064cad2f28002db883d11131299 Author: Jorge Ramirez-Ortiz j...@xenomai.org Date: Tue Oct 14 21:03:05 2014 -0400 utils/analogy: calibration - use the analogy's math utils --- include/rtdm/analogy.h| 12 ++ include/rtdm/uapi/analogy.h |2 +- lib/analogy/Makefile.am |5 +- lib/analogy/calibration.c | 22 ++ lib/analogy/calibration.h | 21 ++ lib/analogy/math.c| 418 + utils/analogy/Makefile.am |2 +- utils/analogy/analogy_calibrate.c |6 +- utils/analogy/calibration_ni_m.c | 106 +++--- utils/analogy/calibration_ni_m.h |6 +- 10 files changed, 515 insertions(+), 85 deletions(-) diff --git a/include/rtdm/analogy.h b/include/rtdm/analogy.h index fd26f58..c03d2b1 100644 --- a/include/rtdm/analogy.h +++ b/include/rtdm/analogy.h @@ -236,6 +236,18 @@ void a4l_write_calibration_file(FILE *dst, struct list *l, int a4l_read_calibration_file(char *name, struct a4l_calibration_data *data); +int a4l_math_polyfit(unsigned order, double *r,double orig, +const unsigned dim, double *x, double *y); + +void a4l_math_mean(double *pmean, double *val, unsigned nr); + +void a4l_math_stddev(double *pstddev, +double mean, double *val, unsigned nr); + +void a4l_math_stddev_of_mean(double *pstddevm, +double mean, double *val, unsigned nr); + + #endif /* !DOXYGEN_CPP */ diff --git a/include/rtdm/uapi/analogy.h b/include/rtdm/uapi/analogy.h index 669ded7..a0a1e59 100644 --- a/include/rtdm/uapi/analogy.h +++ b/include/rtdm/uapi/analogy.h @@ -708,9 +708,9 @@ typedef struct a4l_instruction_list a4l_insnlst_t; struct a4l_calibration_subdev { a4l_sbinfo_t *info; + char *name; int slen; int idx; - char *name; }; struct a4l_calibration_subdev_data { diff --git a/lib/analogy/Makefile.am b/lib/analogy/Makefile.am index 500453d..b79d4cb 100644 --- a/lib/analogy/Makefile.am +++ b/lib/analogy/Makefile.am @@ -7,6 +7,7 @@ libanalogy_la_SOURCES = \ descriptor.c\ info.c \ internal.h \ + math.c \ calibration.c \ range.c \ root_leaf.h \ @@ -19,4 +20,6 @@ libanalogy_la_CPPFLAGS = \ -I$(top_srcdir)/lib/boilerplate libanalogy_la_LIBADD = \ - ../boilerplate/libboilerplate.la + ../boilerplate/libboilerplate.la\ + -lm + diff --git a/lib/analogy/calibration.c b/lib/analogy/calibration.c index 74b2789..85860d1 100644 --- a/lib/analogy/calibration.c +++ b/lib/analogy/calibration.c @@ -1,3 +1,25 @@ +/** + * @file + * Analogy for Linux, device, subdevice, etc. related features + * + * @note Copyright (C) 1997-2000 David A. Schleef d...@schleef.org + * @note Copyright (C) 2014 Jorge A. Ramirez-Ortiz j...@xenomai.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * 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 rtdm/analogy.h #include stdio.h #include errno.h diff --git a/lib/analogy/calibration.h b/lib/analogy/calibration.h index 04a7e72..4080c60 100644 --- a/lib/analogy/calibration.h +++ b/lib/analogy/calibration.h @@ -1,3 +1,24 @@ +/** + * @file + * Analogy for Linux, internal calibration declarations + * + * @note Copyright (C) 2014 Jorge A Ramirez-Ortiz j...@xenomai.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + #ifndef __ANALOGY_CALIBRATION_H__
[Xenomai-git] Jorge Ramirez-Ortiz : utils/analogy: calibration - use the analogy' s math utils
Module: xenomai-3 Branch: next Commit: 9425f42a5efce42c08b0f89c8095cb7e23346dad URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=9425f42a5efce42c08b0f89c8095cb7e23346dad Author: Jorge Ramirez-Ortiz j...@xenomai.org Date: Tue Oct 14 21:03:05 2014 -0400 utils/analogy: calibration - use the analogy's math utils --- include/rtdm/analogy.h| 12 ++ include/rtdm/uapi/analogy.h |2 +- lib/analogy/Makefile.am |5 +- lib/analogy/calibration.c | 22 ++ lib/analogy/calibration.h | 21 ++ lib/analogy/math.c| 418 + utils/analogy/Makefile.am |2 +- utils/analogy/analogy_calibrate.c |6 +- utils/analogy/calibration_ni_m.c | 106 +++--- utils/analogy/calibration_ni_m.h |6 +- 10 files changed, 515 insertions(+), 85 deletions(-) diff --git a/include/rtdm/analogy.h b/include/rtdm/analogy.h index fd26f58..c03d2b1 100644 --- a/include/rtdm/analogy.h +++ b/include/rtdm/analogy.h @@ -236,6 +236,18 @@ void a4l_write_calibration_file(FILE *dst, struct list *l, int a4l_read_calibration_file(char *name, struct a4l_calibration_data *data); +int a4l_math_polyfit(unsigned order, double *r,double orig, +const unsigned dim, double *x, double *y); + +void a4l_math_mean(double *pmean, double *val, unsigned nr); + +void a4l_math_stddev(double *pstddev, +double mean, double *val, unsigned nr); + +void a4l_math_stddev_of_mean(double *pstddevm, +double mean, double *val, unsigned nr); + + #endif /* !DOXYGEN_CPP */ diff --git a/include/rtdm/uapi/analogy.h b/include/rtdm/uapi/analogy.h index 669ded7..a0a1e59 100644 --- a/include/rtdm/uapi/analogy.h +++ b/include/rtdm/uapi/analogy.h @@ -708,9 +708,9 @@ typedef struct a4l_instruction_list a4l_insnlst_t; struct a4l_calibration_subdev { a4l_sbinfo_t *info; + char *name; int slen; int idx; - char *name; }; struct a4l_calibration_subdev_data { diff --git a/lib/analogy/Makefile.am b/lib/analogy/Makefile.am index 500453d..b79d4cb 100644 --- a/lib/analogy/Makefile.am +++ b/lib/analogy/Makefile.am @@ -7,6 +7,7 @@ libanalogy_la_SOURCES = \ descriptor.c\ info.c \ internal.h \ + math.c \ calibration.c \ range.c \ root_leaf.h \ @@ -19,4 +20,6 @@ libanalogy_la_CPPFLAGS = \ -I$(top_srcdir)/lib/boilerplate libanalogy_la_LIBADD = \ - ../boilerplate/libboilerplate.la + ../boilerplate/libboilerplate.la\ + -lm + diff --git a/lib/analogy/calibration.c b/lib/analogy/calibration.c index 74b2789..85860d1 100644 --- a/lib/analogy/calibration.c +++ b/lib/analogy/calibration.c @@ -1,3 +1,25 @@ +/** + * @file + * Analogy for Linux, device, subdevice, etc. related features + * + * @note Copyright (C) 1997-2000 David A. Schleef d...@schleef.org + * @note Copyright (C) 2014 Jorge A. Ramirez-Ortiz j...@xenomai.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * 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 rtdm/analogy.h #include stdio.h #include errno.h diff --git a/lib/analogy/calibration.h b/lib/analogy/calibration.h index 04a7e72..4080c60 100644 --- a/lib/analogy/calibration.h +++ b/lib/analogy/calibration.h @@ -1,3 +1,24 @@ +/** + * @file + * Analogy for Linux, internal calibration declarations + * + * @note Copyright (C) 2014 Jorge A Ramirez-Ortiz j...@xenomai.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + #ifndef __ANALOGY_CALIBRATION_H__