summaryrefslogtreecommitdiff
path: root/include/mat44.h
diff options
context:
space:
mode:
authorYilun Lin <yllin@google.com>2018-10-04 10:19:57 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-10-04 12:55:53 -0700
commit315aaca9467f49bc432ef5f2de9c0e3bb56f0251 (patch)
tree3ea739aca1db340e93b9daee7958d5afc5c9f31f /include/mat44.h
parentece03ab4d09b157c5e6f3c4fe0446678c0d8684b (diff)
downloadchrome-ec-315aaca9467f49bc432ef5f2de9c0e3bb56f0251.tar.gz
mag_cal: Support fixed-point calculation.
Modified from floating point version. This includes changes to vec3, vec4, mat33, mat44, and mag_cal. Now fixed-point type (fp_*) functions is a function wrapper for both fixed-point and floating point version operations: * define CONFIG_FPU to use floating version mag_cal * undef CONFIG_FPU to use fixed-point version mag_cal Also, add tests for both float and fp types operations. TEST=define CONFIG_FPU; flash on reef; See ARC++ magnetmeter app moving. TEST=undef CONFIG_FPU; flash on reef; See ARC++ magnetmeter app moving. TEST=make runtests -j TEST=make buildalltests -j BUG=b:113364863 BRANCH=None Change-Id: Ie695945acb666912babb2a603e09c602a0624d44 Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1260704 Commit-Ready: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Diffstat (limited to 'include/mat44.h')
-rw-r--r--include/mat44.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/include/mat44.h b/include/mat44.h
index d8a8209055..2faa093c8e 100644
--- a/include/mat44.h
+++ b/include/mat44.h
@@ -8,17 +8,18 @@
#define __CROS_EC_MAT_44_H
-#include "vec4.h"
+#include "math_util.h"
#include "util.h"
+#include "vec4.h"
typedef float mat44_float_t[4][4];
+typedef fp_t mat44_fp_t[4][4];
typedef size_t sizev4_t[4];
-void mat44_float_decompose_lup(mat44_float_t LU, sizev4_t pivot);
-
-void mat44_float_swap_rows(mat44_float_t A, const size_t i, const size_t j);
+void mat44_fp_decompose_lup(mat44_fp_t LU, sizev4_t pivot);
-void mat44_float_solve(mat44_float_t A, floatv4_t x, const floatv4_t b,
- const sizev4_t pivot);
+void mat44_fp_swap_rows(mat44_fp_t A, const size_t i, const size_t j);
+void mat44_fp_solve(mat44_fp_t A, fpv4_t x, const fpv4_t b,
+ const sizev4_t pivot);
#endif /* __CROS_EC_MAT_44_H */