This is an automated email from the ASF dual-hosted git repository.

raiden00 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 1c860f38e7 cordic API add scale parameter
1c860f38e7 is described below

commit 1c860f38e7e901fd800e7fd006988f2856c48e18
Author: xiajizhong <[email protected]>
AuthorDate: Wed Jul 5 15:02:09 2023 +0800

    cordic API add scale parameter
    
    Signed-off-by: xiajizhong <[email protected]>
---
 drivers/math/math.c         | 8 ++++++++
 include/nuttx/math/cordic.h | 2 ++
 include/nuttx/math/math.h   | 8 ++++++++
 3 files changed, 18 insertions(+)

diff --git a/drivers/math/math.c b/drivers/math/math.c
index 9adc6886c0..7e7105028a 100644
--- a/drivers/math/math.c
+++ b/drivers/math/math.c
@@ -127,6 +127,7 @@ static int math_ioctl(FAR struct file *filep, int cmd, 
unsigned long arg)
     {
       /* CORDIC calulcate */
 
+#ifdef CONFIG_MATH_CORDIC
       case MATHIOC_CORDIC_CALC:
         {
           FAR struct cordic_calc_s *calc =
@@ -139,7 +140,9 @@ static int math_ioctl(FAR struct file *filep, int cmd, 
unsigned long arg)
 
           break;
         }
+#endif
 
+#ifdef CONFIG_MATH_FFT
       case MATHIOC_FFT_CALC:
         {
           FAR struct fft_calc_s *calc =
@@ -152,6 +155,7 @@ static int math_ioctl(FAR struct file *filep, int cmd, 
unsigned long arg)
 
           break;
         }
+#endif
     }
 
   leave_critical_section(flags);
@@ -215,6 +219,7 @@ errout:
  *
  ****************************************************************************/
 
+#ifdef CONFIG_MATH_CORDIC
 int cordic_register(FAR const char *path,
                     FAR struct cordic_lowerhalf_s *lower)
 {
@@ -225,6 +230,7 @@ int cordic_register(FAR const char *path,
 
   return math_register(path, &config);
 }
+#endif
 
 /****************************************************************************
  * Name: fft_register
@@ -234,6 +240,7 @@ int cordic_register(FAR const char *path,
  *
  ****************************************************************************/
 
+#ifdef CONFIG_MATH_FFT
 int fft_register(FAR const char *path,
                     FAR struct fft_lowerhalf_s *lower)
 {
@@ -244,3 +251,4 @@ int fft_register(FAR const char *path,
 
   return math_register(path, &config);
 }
+#endif
diff --git a/include/nuttx/math/cordic.h b/include/nuttx/math/cordic.h
index fc83bdfc61..c4c6e40e5d 100644
--- a/include/nuttx/math/cordic.h
+++ b/include/nuttx/math/cordic.h
@@ -119,6 +119,8 @@ struct cordic_calc_s
   /* CORDIC request configuration */
 
   uint8_t func;                 /* CORDIC function */
+  int8_t  input_scale;          /* CORDIC input scale factor */
+  int8_t  output_scale;         /* CORDIC output scale factor */
   bool    res2_incl;            /* Include secondary result if available */
 
   /* Input data */
diff --git a/include/nuttx/math/math.h b/include/nuttx/math/math.h
index a589416e4e..bdd470c501 100644
--- a/include/nuttx/math/math.h
+++ b/include/nuttx/math/math.h
@@ -25,8 +25,12 @@
  * Included Files
  ****************************************************************************/
 
+#ifdef CONFIG_MATH_CORDIC
 #include <nuttx/math/cordic.h>
+#endif
+#ifdef CONFIG_MATH_FFT
 #include <nuttx/math/fft.h>
+#endif
 
 /****************************************************************************
  * Public Types
@@ -39,8 +43,12 @@
 
 struct math_config_s
 {
+#ifdef CONFIG_MATH_CORDIC
   FAR struct cordic_lowerhalf_s *cordic;
+#endif
+#ifdef CONFIG_MATH_FFT
   FAR struct fft_lowerhalf_s    *fft;
+#endif
 };
 
 /****************************************************************************

Reply via email to