cordic API add scale parameter

Signed-off-by: xiajizhong <xiajizhong@xiaomi.com>
This commit is contained in:
xiajizhong 2023-07-05 15:02:09 +08:00 committed by Mateusz Szafoni
parent ece146a229
commit 1c860f38e7
3 changed files with 18 additions and 0 deletions

View File

@ -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

View File

@ -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 */

View File

@ -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
};
/****************************************************************************