MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
POWERQUAD: PowerQuad hardware accelerator

Overview

The MCUXpresso SDK provides driver for the PowerQuad module of MCUXpresso SDK devices.

The PowerQuad hardware accelerator for (fixed/floating point/matrix operation) DSP functions is that idea is to replace some of the CMSIS DSP functionality with the hardware features provided by this IP.

PowerQuad driver provides the following CMSIS DSP compatible functions:

Note
CMSIS DSP compatible functions limitations
  1. PowerQuad FFT engine only looks at the bottom 27 bits of the input word, down scale the input data to avoid saturation.
  2. When use arm_fir_q15/arm_fir_q31/arm_fir_f32 for incremental, the new data should follow the old data. For example the array for input data is inputData[], and the array for output data is outputData[]. The first 32 input data is saved in inputData[0:31], after callling arm_fir_xxx(&fir, inputData, outputData, 32), the output data is saved in outputData[0:31]. The new input data must be saved from inputData[32], then call arm_fir_xxx(&fir, &inputData[32], &outputData[32], 32) for incremental calculation.

The PowerQuad consists of several internal computation engines: Transform engine, Transcendental function engine, Trigonometry function engine, Dual biquad IIR filter engine, Matrix accelerator engine, FIR filter engine, CORDIC engine.

For low level APIs, all function APIs, except using coprocessor instruction and arctan/arctanh API, need to calling wait done API to wait for calculation complete.

Function groups

POWERQUAD functional Operation

This group implements the POWERQUAD functional API.

Data Structures

struct  pq_prescale_t
 Coprocessor prescale. More...
 
struct  pq_config_t
 powerquad data structure format More...
 
struct  pq_biquad_param_t
 Struct to save biquad parameters. More...
 
struct  pq_biquad_state_t
 Struct to save biquad state. More...
 
struct  pq_biquad_cascade_df2_instance
 Instance structure for the direct form II Biquad cascade filter. More...
 
union  pq_float_t
 Conversion between integer and float type. More...
 

Macros

#define PQ_LN_INF   PQ_LN, 1, PQ_TRANS
 Parameter used for vector ln(x)
 
#define PQ_INV_INF   PQ_INV, 0, PQ_TRANS
 Parameter used for vector 1/x.
 
#define PQ_SQRT_INF   PQ_SQRT, 0, PQ_TRANS
 Parameter used for vector sqrt(x)
 
#define PQ_ISQRT_INF   PQ_INVSQRT, 0, PQ_TRANS
 Parameter used for vector 1/sqrt(x)
 
#define PQ_ETOX_INF   PQ_ETOX, 0, PQ_TRANS
 Parameter used for vector e^x.
 
#define PQ_ETONX_INF   PQ_ETONX, 0, PQ_TRANS
 Parameter used for vector e^(-x)
 
#define PQ_SIN_INF   PQ_SIN, 1, PQ_TRIG
 Parameter used for vector sin(x)
 
#define PQ_COS_INF   PQ_COS, 1, PQ_TRIG
 Parameter used for vector cos(x)
 
#define PQ_Initiate_Vector_Func(pSrc, pDst)
 Start 32-bit data vector calculation. More...
 
#define PQ_End_Vector_Func()   __asm volatile("POP {r2-r7}")
 End vector calculation. More...
 
#define PQ_StartVector(PSRC, PDST, LENGTH)
 Start 32-bit data vector calculation. More...
 
#define PQ_StartVectorFixed16(PSRC, PDST, LENGTH)
 Start 16-bit data vector calculation. More...
 
#define PQ_StartVectorQ15(PSRC, PDST, LENGTH)
 Start Q15-bit data vector calculation. More...
 
#define PQ_EndVector()   __asm volatile("POP {r3-r10} \n")
 End vector calculation. More...
 
#define PQ_Vector8F32(BATCH_OPCODE, DOUBLE_READ_ADDERS, BATCH_MACHINE)
 Float data vector calculation. More...
 
#define PQ_Vector8Fixed32(BATCH_OPCODE, DOUBLE_READ_ADDERS, BATCH_MACHINE)
 Fixed 32bits data vector calculation. More...
 
#define PQ_Vector8Fixed16(BATCH_OPCODE, DOUBLE_READ_ADDERS, BATCH_MACHINE)
 Fixed 32bits data vector calculation. More...
 
#define PQ_Vector8Q15(BATCH_OPCODE, DOUBLE_READ_ADDERS, BATCH_MACHINE)
 Q15 data vector calculation. More...
 
#define PQ_DF2_Vector8_FP(middle, last)
 Float data vector biquad direct form II calculation. More...
 
#define PQ_DF2_Vector8_FX(middle, last)
 Fixed data vector biquad direct form II calculation. More...
 
#define PQ_Vector8BiquadDf2F32()
 Float data vector biquad direct form II calculation. More...
 
#define PQ_Vector8BiquadDf2Fixed32()
 Fixed 32-bit data vector biquad direct form II calculation. More...
 
#define PQ_Vector8BiquadDf2Fixed16()
 Fixed 16-bit data vector biquad direct form II calculation. More...
 
#define PQ_DF2_Cascade_Vector8_FP(middle, last)
 Float data vector direct form II biquad cascade filter. More...
 
#define PQ_DF2_Cascade_Vector8_FX(middle, last)
 Fixed data vector direct form II biquad cascade filter. More...
 
#define PQ_Vector8BiqaudDf2CascadeF32()
 Float data vector direct form II biquad cascade filter. More...
 
#define PQ_Vector8BiqaudDf2CascadeFixed32()
 Fixed 32-bit data vector direct form II biquad cascade filter. More...
 
#define PQ_Vector8BiqaudDf2CascadeFixed16()
 Fixed 16-bit data vector direct form II biquad cascade filter. More...
 
#define POWERQUAD_MAKE_MATRIX_LEN(mat1Row, mat1Col, mat2Col)   (((uint32_t)(mat1Row) << 0U) | ((uint32_t)(mat1Col) << 8U) | ((uint32_t)(mat2Col) << 16U))
 Make the length used for matrix functions. More...
 
#define PQ_Q31_2_FLOAT(x)   (((float)(x)) / 2147483648.0f)
 Convert Q31 to float. More...
 
#define PQ_Q15_2_FLOAT(x)   (((float)(x)) / 32768.0f)
 Convert Q15 to float. More...
 

Enumerations

enum  pq_computationengine_t {
  kPQ_CP_PQ = 0,
  kPQ_CP_MTX = 1,
  kPQ_CP_FFT = 2,
  kPQ_CP_FIR = 3,
  kPQ_CP_CORDIC = 5
}
 powerquad computation engine More...
 
enum  pq_format_t {
  kPQ_16Bit = 0,
  kPQ_32Bit = 1,
  kPQ_Float = 2
}
 powerquad data structure format type More...
 
enum  pq_cordic_iter_t {
  kPQ_Iteration_8 = 0,
  kPQ_Iteration_16,
  kPQ_Iteration_24
}
 CORDIC iteration. More...
 

Driver version

#define FSL_POWERQUAD_DRIVER_VERSION   (MAKE_VERSION(2, 0, 1))
 Version 2.0.1. More...
 

POWERQUAD functional Operation

void PQ_GetDefaultConfig (pq_config_t *config)
 Get default configuration. More...
 
void PQ_SetConfig (POWERQUAD_Type *base, const pq_config_t *config)
 Set configuration with format/prescale. More...
 
static void PQ_SetCoprocessorScaler (POWERQUAD_Type *base, const pq_prescale_t *prescale)
 set coprocessor scaler for coprocessor instructions, this function is used to set output saturation and scaleing for input/output. More...
 
void PQ_Init (POWERQUAD_Type *base)
 Initializes the POWERQUAD module. More...
 
void PQ_Deinit (POWERQUAD_Type *base)
 De-initializes the POWERQUAD module. More...
 
void PQ_SetFormat (POWERQUAD_Type *base, pq_computationengine_t engine, pq_format_t format)
 Set format for non-coprecessor instructions. More...
 
static void PQ_WaitDone (POWERQUAD_Type *base)
 Wait for the completion. More...
 
static void PQ_LnF32 (float *pSrc, float *pDst)
 Processing function for the floating-point natural log. More...
 
static void PQ_InvF32 (float *pSrc, float *pDst)
 Processing function for the floating-point reciprocal. More...
 
static void PQ_SqrtF32 (float *pSrc, float *pDst)
 Processing function for the floating-point square-root. More...
 
static void PQ_InvSqrtF32 (float *pSrc, float *pDst)
 Processing function for the floating-point inverse square-root. More...
 
static void PQ_EtoxF32 (float *pSrc, float *pDst)
 Processing function for the floating-point natural exponent. More...
 
static void PQ_EtonxF32 (float *pSrc, float *pDst)
 Processing function for the floating-point natural exponent with negative parameter. More...
 
static void PQ_SinF32 (float *pSrc, float *pDst)
 Processing function for the floating-point sine. More...
 
static void PQ_CosF32 (float *pSrc, float *pDst)
 Processing function for the floating-point cosine. More...
 
static void PQ_BiquadF32 (float *pSrc, float *pDst)
 Processing function for the floating-point biquad. More...
 
static void PQ_DivF32 (float *x1, float *x2, float *pDst)
 Processing function for the floating-point division. More...
 
static void PQ_Biquad1F32 (float *pSrc, float *pDst)
 Processing function for the floating-point biquad. More...
 
static int32_t PQ_LnFixed (int32_t val)
 Processing function for the fixed natural log. More...
 
static int32_t PQ_InvFixed (int32_t val)
 Processing function for the fixed reciprocal. More...
 
static uint32_t PQ_SqrtFixed (uint32_t val)
 Processing function for the fixed square-root. More...
 
static int32_t PQ_InvSqrtFixed (int32_t val)
 Processing function for the fixed inverse square-root. More...
 
static int32_t PQ_EtoxFixed (int32_t val)
 Processing function for the Fixed natural exponent. More...
 
static int32_t PQ_EtonxFixed (int32_t val)
 Processing function for the fixed natural exponent with negative parameter. More...
 
static int32_t PQ_SinQ31 (int32_t val)
 Processing function for the fixed sine. More...
 
static int16_t PQ_SinQ15 (int16_t val)
 Processing function for the fixed sine. More...
 
static int32_t PQ_CosQ31 (int32_t val)
 Processing function for the fixed cosine. More...
 
static int16_t PQ_CosQ15 (int16_t val)
 Processing function for the fixed sine. More...
 
static int32_t PQ_BiquadFixed (int32_t val)
 Processing function for the fixed biquad. More...
 
void PQ_VectorLnF32 (float *pSrc, float *pDst, int32_t length)
 Processing function for the floating-point vectorised natural log. More...
 
void PQ_VectorInvF32 (float *pSrc, float *pDst, int32_t length)
 Processing function for the floating-point vectorised reciprocal. More...
 
void PQ_VectorSqrtF32 (float *pSrc, float *pDst, int32_t length)
 Processing function for the floating-point vectorised square-root. More...
 
void PQ_VectorInvSqrtF32 (float *pSrc, float *pDst, int32_t length)
 Processing function for the floating-point vectorised inverse square-root. More...
 
void PQ_VectorEtoxF32 (float *pSrc, float *pDst, int32_t length)
 Processing function for the floating-point vectorised natural exponent. More...
 
void PQ_VectorEtonxF32 (float *pSrc, float *pDst, int32_t length)
 Processing function for the floating-point vectorised natural exponent with negative parameter. More...
 
void PQ_VectorSinF32 (float *pSrc, float *pDst, int32_t length)
 Processing function for the floating-point vectorised sine. More...
 
void PQ_VectorCosF32 (float *pSrc, float *pDst, int32_t length)
 Processing function for the floating-point vectorised cosine. More...
 
void PQ_VectorLnFixed32 (int32_t *pSrc, int32_t *pDst, int32_t length)
 Processing function for the Q31 vectorised natural log. More...
 
void PQ_VectorInvFixed32 (int32_t *pSrc, int32_t *pDst, int32_t length)
 Processing function for the Q31 vectorised reciprocal. More...
 
void PQ_VectorSqrtFixed32 (int32_t *pSrc, int32_t *pDst, int32_t length)
 Processing function for the 32-bit integer vectorised square-root. More...
 
void PQ_VectorInvSqrtFixed32 (int32_t *pSrc, int32_t *pDst, int32_t length)
 Processing function for the 32-bit integer vectorised inverse square-root. More...
 
void PQ_VectorEtoxFixed32 (int32_t *pSrc, int32_t *pDst, int32_t length)
 Processing function for the 32-bit integer vectorised natural exponent. More...
 
void PQ_VectorEtonxFixed32 (int32_t *pSrc, int32_t *pDst, int32_t length)
 Processing function for the 32-bit integer vectorised natural exponent with negative parameter. More...
 
void PQ_VectorSinQ15 (int16_t *pSrc, int16_t *pDst, int32_t length)
 Processing function for the Q15 vectorised sine. More...
 
void PQ_VectorCosQ15 (int16_t *pSrc, int16_t *pDst, int32_t length)
 Processing function for the Q15 vectorised cosine. More...
 
void PQ_VectorSinQ31 (int32_t *pSrc, int32_t *pDst, int32_t length)
 Processing function for the Q31 vectorised sine. More...
 
void PQ_VectorCosQ31 (int32_t *pSrc, int32_t *pDst, int32_t length)
 Processing function for the Q31 vectorised cosine. More...
 
void PQ_VectorLnFixed16 (int16_t *pSrc, int16_t *pDst, int32_t length)
 Processing function for the 16-bit integer vectorised natural log. More...
 
void PQ_VectorInvFixed16 (int16_t *pSrc, int16_t *pDst, int32_t length)
 Processing function for the 16-bit integer vectorised reciprocal. More...
 
void PQ_VectorSqrtFixed16 (int16_t *pSrc, int16_t *pDst, int32_t length)
 Processing function for the 16-bit integer vectorised square-root. More...
 
void PQ_VectorInvSqrtFixed16 (int16_t *pSrc, int16_t *pDst, int32_t length)
 Processing function for the 16-bit integer vectorised inverse square-root. More...
 
void PQ_VectorEtoxFixed16 (int16_t *pSrc, int16_t *pDst, int32_t length)
 Processing function for the 16-bit integer vectorised natural exponent. More...
 
void PQ_VectorEtonxFixed16 (int16_t *pSrc, int16_t *pDst, int32_t length)
 Processing function for the 16-bit integer vectorised natural exponent with negative parameter. More...
 
void PQ_VectorBiqaudDf2F32 (float *pSrc, float *pDst, int32_t length)
 Processing function for the floating-point vectorised biquad direct form II. More...
 
void PQ_VectorBiqaudDf2Fixed32 (int32_t *pSrc, int32_t *pDst, int32_t length)
 Processing function for the 32-bit integer vectorised biquad direct form II. More...
 
void PQ_VectorBiqaudDf2Fixed16 (int16_t *pSrc, int16_t *pDst, int32_t length)
 Processing function for the 16-bit integer vectorised biquad direct form II. More...
 
void PQ_VectorBiqaudCascadeDf2F32 (float *pSrc, float *pDst, int32_t length)
 Processing function for the floating-point vectorised biquad direct form II. More...
 
void PQ_VectorBiqaudCascadeDf2Fixed32 (int32_t *pSrc, int32_t *pDst, int32_t length)
 Processing function for the 32-bit integer vectorised biquad direct form II. More...
 
void PQ_VectorBiqaudCascadeDf2Fixed16 (int16_t *pSrc, int16_t *pDst, int32_t length)
 Processing function for the 16-bit integer vectorised biquad direct form II. More...
 
int32_t PQ_ArctanFixed (POWERQUAD_Type *base, int32_t x, int32_t y, pq_cordic_iter_t iteration)
 Processing function for the fixed inverse trigonometric. More...
 
int32_t PQ_ArctanhFixed (POWERQUAD_Type *base, int32_t x, int32_t y, pq_cordic_iter_t iteration)
 Processing function for the fixed inverse trigonometric. More...
 
static int32_t PQ_Biquad1Fixed (int32_t val)
 Processing function for the fixed biquad. More...
 
void PQ_TransformCFFT (POWERQUAD_Type *base, uint32_t length, void *pData, void *pResult)
 Processing function for the complex FFT. More...
 
void PQ_TransformRFFT (POWERQUAD_Type *base, uint32_t length, void *pData, void *pResult)
 Processing function for the real FFT. More...
 
void PQ_TransformIFFT (POWERQUAD_Type *base, uint32_t length, void *pData, void *pResult)
 Processing function for the inverse complex FFT. More...
 
void PQ_TransformCDCT (POWERQUAD_Type *base, uint32_t length, void *pData, void *pResult)
 Processing function for the complex DCT. More...
 
void PQ_TransformRDCT (POWERQUAD_Type *base, uint32_t length, void *pData, void *pResult)
 Processing function for the real DCT. More...
 
void PQ_TransformIDCT (POWERQUAD_Type *base, uint32_t length, void *pData, void *pResult)
 Processing function for the inverse complex DCT. More...
 
void PQ_BiquadBackUpInternalState (POWERQUAD_Type *base, int32_t biquad_num, pq_biquad_state_t *state)
 Processing function for backup biquad context. More...
 
void PQ_BiquadRestoreInternalState (POWERQUAD_Type *base, int32_t biquad_num, pq_biquad_state_t *state)
 Processing function for restore biquad context. More...
 
void PQ_BiquadCascadeDf2Init (pq_biquad_cascade_df2_instance *S, uint8_t numStages, pq_biquad_state_t *pState)
 Initialization function for the direct form II Biquad cascade filter. More...
 
void PQ_BiquadCascadeDf2F32 (const pq_biquad_cascade_df2_instance *S, float *pSrc, float *pDst, uint32_t blockSize)
 Processing function for the floating-point direct form II Biquad cascade filter. More...
 
void PQ_BiquadCascadeDf2Fixed32 (const pq_biquad_cascade_df2_instance *S, int32_t *pSrc, int32_t *pDst, uint32_t blockSize)
 Processing function for the Q31 direct form II Biquad cascade filter. More...
 
void PQ_BiquadCascadeDf2Fixed16 (const pq_biquad_cascade_df2_instance *S, int16_t *pSrc, int16_t *pDst, uint32_t blockSize)
 Processing function for the Q15 direct form II Biquad cascade filter. More...
 
void PQ_FIR (POWERQUAD_Type *base, void *pAData, int32_t ALength, void *pBData, int32_t BLength, void *pResult, uint32_t opType)
 Processing function for the FIR. More...
 
void PQ_FIRIncrement (POWERQUAD_Type *base, int32_t ALength, int32_t BLength, int32_t xOffset)
 Processing function for the incremental FIR. More...
 
void PQ_MatrixAddition (POWERQUAD_Type *base, uint32_t length, void *pAData, void *pBData, void *pResult)
 Processing function for the matrix addition. More...
 
void PQ_MatrixSubtraction (POWERQUAD_Type *base, uint32_t length, void *pAData, void *pBData, void *pResult)
 Processing function for the matrix subtraction. More...
 
void PQ_MatrixMultiplication (POWERQUAD_Type *base, uint32_t length, void *pAData, void *pBData, void *pResult)
 Processing function for the matrix multiplication. More...
 
void PQ_MatrixProduct (POWERQUAD_Type *base, uint32_t length, void *pAData, void *pBData, void *pResult)
 Processing function for the matrix product. More...
 
void PQ_VectorDotProduct (POWERQUAD_Type *base, uint32_t length, void *pAData, void *pBData, void *pResult)
 Processing function for the vector dot product. More...
 
void PQ_MatrixInversion (POWERQUAD_Type *base, uint32_t length, void *pData, void *pTmpData, void *pResult)
 Processing function for the matrix inverse. More...
 
void PQ_MatrixTranspose (POWERQUAD_Type *base, uint32_t length, void *pData, void *pResult)
 Processing function for the matrix transpose. More...
 
void PQ_MatrixScale (POWERQUAD_Type *base, uint32_t length, float misc, void *pData, void *pResult)
 Processing function for the matrix scale. More...
 

Data Structure Documentation

struct pq_prescale_t

Data Fields

int8_t inputPrescale
 Input prescale. More...
 
int8_t outputPrescale
 Output prescale. More...
 
int8_t outputSaturate
 Output saturate at n bits, for example 0x11 is 8 bit space, the value will be truncated at +127 or -128. More...
 

Field Documentation

int8_t pq_prescale_t::inputPrescale
int8_t pq_prescale_t::outputPrescale
int8_t pq_prescale_t::outputSaturate
struct pq_config_t

Data Fields

pq_format_t inputAFormat
 Input A format. More...
 
int8_t inputAPrescale
 Input A prescale, for example 1.5 can be 1.5*2^n if you scale by 'shifting' ('scaling' by a factor of n). More...
 
pq_format_t inputBFormat
 Input B format. More...
 
int8_t inputBPrescale
 Input B prescale. More...
 
pq_format_t outputFormat
 Out format. More...
 
int8_t outputPrescale
 Out prescale. More...
 
pq_format_t tmpFormat
 Temp format. More...
 
int8_t tmpPrescale
 Temp prescale. More...
 
pq_format_t machineFormat
 Machine format. More...
 
uint32_t * tmpBase
 Tmp base address. More...
 

Field Documentation

pq_format_t pq_config_t::inputAFormat
int8_t pq_config_t::inputAPrescale
pq_format_t pq_config_t::inputBFormat
int8_t pq_config_t::inputBPrescale
pq_format_t pq_config_t::outputFormat
int8_t pq_config_t::outputPrescale
pq_format_t pq_config_t::tmpFormat
int8_t pq_config_t::tmpPrescale
pq_format_t pq_config_t::machineFormat
uint32_t* pq_config_t::tmpBase
struct pq_biquad_param_t

Data Fields

float v_n_1
 v[n-1], set to 0 when initialization. More...
 
float v_n
 v[n], set to 0 when initialization. More...
 
float a_1
 a[1]
 
float a_2
 a[2]
 
float b_0
 b[0]
 
float b_1
 b[1]
 
float b_2
 b[2]
 

Field Documentation

float pq_biquad_param_t::v_n_1
float pq_biquad_param_t::v_n
struct pq_biquad_state_t

Data Fields

pq_biquad_param_t param
 Filter parameter. More...
 
uint32_t compreg
 Internal register, set to 0 when initialization. More...
 

Field Documentation

pq_biquad_param_t pq_biquad_state_t::param
uint32_t pq_biquad_state_t::compreg
struct pq_biquad_cascade_df2_instance

Data Fields

uint8_t numStages
 
pq_biquad_state_tpState
 

Field Documentation

uint8_t pq_biquad_cascade_df2_instance::numStages

Number of 2nd order stages in the filter.

pq_biquad_state_t* pq_biquad_cascade_df2_instance::pState

Points to the array of state coefficients.

union pq_float_t

Data Fields

float floatX
 Float type. More...
 
uint32_t integerX
 Iterger type. More...
 

Field Documentation

float pq_float_t::floatX
uint32_t pq_float_t::integerX

Macro Definition Documentation

#define FSL_POWERQUAD_DRIVER_VERSION   (MAKE_VERSION(2, 0, 1))
#define PQ_Initiate_Vector_Func (   pSrc,
  pDst 
)
Value:
__asm volatile( \
"MOV r0, %[psrc] \n" \
"MOV r1, %[pdst] \n" \
"PUSH {r2-r7} \n" \
"LDRD r2,r3,[r0],#8 \n" ::[psrc] "r"(pSrc), \
[pdst] "r"(pDst) \
: "r0", "r1")

Start the vector calculation, the input data could be float, int32_t or Q31.

Parameters
PSRCPointer to the source data.
PDSTPointer to the destination data.
#define PQ_End_Vector_Func ( )    __asm volatile("POP {r2-r7}")

This function should be called after vector calculation.

#define PQ_StartVector (   PSRC,
  PDST,
  LENGTH 
)
Value:
__asm volatile( \
"MOV r0, %[psrc] \n" \
"MOV r1, %[pdst] \n" \
"MOV r2, %[length] \n" \
"PUSH {r3-r10} \n" \
"MOV r3, #0 \n" \
"MOV r10, #0 \n" \
"LDRD r4,r5,[r0],#8 \n" ::[psrc] "r"(PSRC), \
[pdst] "r"(PDST), [length] "r"(LENGTH) \
: "r0", "r1", "r2")

Start the vector calculation, the input data could be float, int32_t or Q31.

Parameters
PSRCPointer to the source data.
PDSTPointer to the destination data.
LENGTHNumber of the data, must be multiple of 8.
#define PQ_StartVectorFixed16 (   PSRC,
  PDST,
  LENGTH 
)
Value:
__asm volatile( \
"MOV r0, %[psrc] \n" \
"MOV r1, %[pdst] \n" \
"MOV r2, %[length] \n" \
"PUSH {r3-r10} \n" \
"MOV r3, #0 \n" \
"LDRSH r4,[r0],#2 \n" \
"LDRSH r5,[r0],#2 \n" ::[psrc] "r"(PSRC), \
[pdst] "r"(PDST), [length] "r"(LENGTH) \
: "r0", "r1", "r2")

Start the vector calculation, the input data could be int16_t. This function should be use with PQ_Vector8Fixed16.

Parameters
PSRCPointer to the source data.
PDSTPointer to the destination data.
LENGTHNumber of the data, must be multiple of 8.
#define PQ_StartVectorQ15 (   PSRC,
  PDST,
  LENGTH 
)
Value:
__asm volatile( \
"MOV r0, %[psrc] \n" \
"MOV r1, %[pdst] \n" \
"MOV r2, %[length] \n" \
"PUSH {r3-r10} \n" \
"MOV r3, #0 \n" \
"LDR r5,[r0],#4 \n" \
"LSL r4,r5,#16 \n" \
"BFC r5,#0,#16 \n" ::[psrc] "r"(PSRC), \
[pdst] "r"(PDST), [length] "r"(LENGTH) \
: "r0", "r1", "r2")

Start the vector calculation, the input data could be Q15. This function should be use with PQ_Vector8Q15. This function is dedicate for SinQ15/CosQ15 vector calculation. Because PowerQuad only supports Q31 Sin/Cos fixed function, so the input Q15 data is left shift 16 bits first, after Q31 calculation, the output data is right shift 16 bits.

Parameters
PSRCPointer to the source data.
PDSTPointer to the destination data.
LENGTHNumber of the data, must be multiple of 8.
#define PQ_EndVector ( )    __asm volatile("POP {r3-r10} \n")

This function should be called after vector calculation.

#define PQ_Vector8F32 (   BATCH_OPCODE,
  DOUBLE_READ_ADDERS,
  BATCH_MACHINE 
)

Float data vector calculation, the input data should be float. The parameter could be PQ_LN_INF, PQ_INV_INF, PQ_SQRT_INF, PQ_ISQRT_INF, PQ_ETOX_INF, PQ_ETONX_INF. For example, to calculate sqrt of a vector, use like this:

#define VECTOR_LEN 8
float input[VECTOR_LEN] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0};
float output[VECTOR_LEN];
PQ_StartVector(input, output, VECTOR_LEN);
#define PQ_Vector8Fixed32 (   BATCH_OPCODE,
  DOUBLE_READ_ADDERS,
  BATCH_MACHINE 
)

Float data vector calculation, the input data should be 32-bit integer. The parameter could be PQ_LN_INF, PQ_INV_INF, PQ_SQRT_INF, PQ_ISQRT_INF, PQ_ETOX_INF, PQ_ETONX_INF. PQ_SIN_INF, PQ_COS_INF. When this function is used for sin/cos calculation, the input data should be in the format Q1.31. For example, to calculate sqrt of a vector, use like this:

#define VECTOR_LEN 8
int32_t input[VECTOR_LEN] = {1, 4, 9, 16, 25, 36, 49, 64};
int32_t output[VECTOR_LEN];
PQ_StartVector(input, output, VECTOR_LEN);
#define PQ_Vector8Fixed16 (   BATCH_OPCODE,
  DOUBLE_READ_ADDERS,
  BATCH_MACHINE 
)

Float data vector calculation, the input data should be 16-bit integer. The parameter could be PQ_LN_INF, PQ_INV_INF, PQ_SQRT_INF, PQ_ISQRT_INF, PQ_ETOX_INF, PQ_ETONX_INF. For example, to calculate sqrt of a vector, use like this:

#define VECTOR_LEN 8
int16_t input[VECTOR_LEN] = {1, 4, 9, 16, 25, 36, 49, 64};
int16_t output[VECTOR_LEN];
PQ_StartVector(input, output, VECTOR_LEN);
#define PQ_Vector8Q15 (   BATCH_OPCODE,
  DOUBLE_READ_ADDERS,
  BATCH_MACHINE 
)

Q15 data vector calculation, this function should only be used for sin/cos Q15 calculation, and the coprocessor output prescaler must be set to 31 before this function. This function loads Q15 data and left shift 16 bits, calculate and right shift 16 bits, then stores to the output array. The input range -1 to 1 means -pi to pi. For example, to calculate sin of a vector, use like this:

#define VECTOR_LEN 8
int16_t input[VECTOR_LEN] = {...}
int16_t output[VECTOR_LEN];
const pq_prescale_t prescale =
{
.outputPrescale = 31,
.outputSaturate = 0
};
PQ_SetCoprocessorScaler(POWERQUAD, const pq_prescale_t *prescale);
PQ_StartVectorQ15(pSrc, pDst, length);
#define PQ_DF2_Vector8_FP (   middle,
  last 
)

Biquad filter, the input and output data are float data. Biquad side 0 is used. Example:

#define VECTOR_LEN 16
float input[VECTOR_LEN] = {1024.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
float output[VECTOR_LEN];
{
.param =
{
.a_1 = xxx,
.a_2 = xxx,
.b_0 = xxx,
.b_1 = xxx,
.b_2 = xxx,
},
};
PQ_BiquadRestoreInternalState(POWERQUAD, 0, &state);
PQ_DF2_Vector8_FP(false,false);
PQ_DF2_Vector8_FP(true,true);
#define PQ_DF2_Vector8_FX (   middle,
  last 
)

Biquad filter, the input and output data are fixed data. Biquad side 0 is used. Example:

#define VECTOR_LEN 16
int32_t input[VECTOR_LEN] = {1024, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int32_t output[VECTOR_LEN];
{
.param =
{
.a_1 = xxx,
.a_2 = xxx,
.b_0 = xxx,
.b_1 = xxx,
.b_2 = xxx,
},
};
PQ_BiquadRestoreInternalState(POWERQUAD, 0, &state);
PQ_DF2_Vector8_FX(false,false);
PQ_DF2_Vector8_FX(true,true);
#define PQ_Vector8BiquadDf2F32 ( )

Biquad filter, the input and output data are float data. Biquad side 0 is used. Example:

#define VECTOR_LEN 8
float input[VECTOR_LEN] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0};
float output[VECTOR_LEN];
{
.param =
{
.a_1 = xxx,
.a_2 = xxx,
.b_0 = xxx,
.b_1 = xxx,
.b_2 = xxx,
},
};
PQ_BiquadRestoreInternalState(POWERQUAD, 0, &state);
PQ_StartVector(input, output, VECTOR_LEN);
#define PQ_Vector8BiquadDf2Fixed32 ( )

Biquad filter, the input and output data are Q31 or 32-bit integer. Biquad side 0 is used. Example:

#define VECTOR_LEN 8
int32_t input[VECTOR_LEN] = {1, 2, 3, 4, 5, 6, 7, 8};
int32_t output[VECTOR_LEN];
{
.param =
{
.a_1 = xxx,
.a_2 = xxx,
.b_0 = xxx,
.b_1 = xxx,
.b_2 = xxx,
},
};
PQ_BiquadRestoreInternalState(POWERQUAD, 0, &state);
PQ_StartVector(input, output, VECTOR_LEN);
#define PQ_Vector8BiquadDf2Fixed16 ( )

Biquad filter, the input and output data are Q15 or 16-bit integer. Biquad side 0 is used. Example:

#define VECTOR_LEN 8
int16_t input[VECTOR_LEN] = {1, 2, 3, 4, 5, 6, 7, 8};
int16_t output[VECTOR_LEN];
{
.param =
{
.a_1 = xxx,
.a_2 = xxx,
.b_0 = xxx,
.b_1 = xxx,
.b_2 = xxx,
},
};
PQ_BiquadRestoreInternalState(POWERQUAD, 0, &state);
PQ_StartVector(input, output, VECTOR_LEN);
#define PQ_DF2_Cascade_Vector8_FP (   middle,
  last 
)

The input and output data are float data. The data flow is input -> biquad side 1 -> biquad side 0 -> output.

#define VECTOR_LEN 16
float input[VECTOR_LEN] = {1024.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
float output[VECTOR_LEN];
{
.param =
{
.a_1 = xxx,
.a_2 = xxx,
.b_0 = xxx,
.b_1 = xxx,
.b_2 = xxx,
},
};
{
.param =
{
.a_1 = xxx,
.a_2 = xxx,
.b_0 = xxx,
.b_1 = xxx,
.b_2 = xxx,
},
};
PQ_BiquadRestoreInternalState(POWERQUAD, 0, &state0);
PQ_BiquadRestoreInternalState(POWERQUAD, 1, &state1);
#define PQ_DF2_Cascade_Vector8_FX (   middle,
  last 
)

The input and output data are fixed data. The data flow is input -> biquad side 1 -> biquad side 0 -> output.

#define VECTOR_LEN 16
int32_t input[VECTOR_LEN] = {1024.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int32_t output[VECTOR_LEN];
{
.param =
{
.a_1 = xxx,
.a_2 = xxx,
.b_0 = xxx,
.b_1 = xxx,
.b_2 = xxx,
},
};
{
.param =
{
.a_1 = xxx,
.a_2 = xxx,
.b_0 = xxx,
.b_1 = xxx,
.b_2 = xxx,
},
};
PQ_BiquadRestoreInternalState(POWERQUAD, 0, &state0);
PQ_BiquadRestoreInternalState(POWERQUAD, 1, &state1);
#define PQ_Vector8BiqaudDf2CascadeF32 ( )

The input and output data are float data. The data flow is input -> biquad side 1 -> biquad side 0 -> output.

#define VECTOR_LEN 8
float input[VECTOR_LEN] = {1, 2, 3, 4, 5, 6, 7, 8};
float output[VECTOR_LEN];
{
.param =
{
.a_1 = xxx,
.a_2 = xxx,
.b_0 = xxx,
.b_1 = xxx,
.b_2 = xxx,
},
};
{
.param =
{
.a_1 = xxx,
.a_2 = xxx,
.b_0 = xxx,
.b_1 = xxx,
.b_2 = xxx,
},
};
PQ_BiquadRestoreInternalState(POWERQUAD, 0, &state0);
PQ_BiquadRestoreInternalState(POWERQUAD, 1, &state1);
PQ_StartVector(input, output, VECTOR_LEN);
#define PQ_Vector8BiqaudDf2CascadeFixed32 ( )

The input and output data are fixed 32-bit data. The data flow is input -> biquad side 1 -> biquad side 0 -> output.

#define VECTOR_LEN 8
int32_t input[VECTOR_LEN] = {1, 2, 3, 4, 5, 6, 7, 8};
int32_t output[VECTOR_LEN];
{
.param =
{
.a_1 = xxx,
.a_2 = xxx,
.b_0 = xxx,
.b_1 = xxx,
.b_2 = xxx,
},
};
{
.param =
{
.a_1 = xxx,
.a_2 = xxx,
.b_0 = xxx,
.b_1 = xxx,
.b_2 = xxx,
},
};
PQ_BiquadRestoreInternalState(POWERQUAD, 0, &state0);
PQ_BiquadRestoreInternalState(POWERQUAD, 1, &state1);
PQ_StartVector(input, output, VECTOR_LEN);
#define PQ_Vector8BiqaudDf2CascadeFixed16 ( )

The input and output data are fixed 16-bit data. The data flow is input -> biquad side 1 -> biquad side 0 -> output.

#define VECTOR_LEN 8
int32_t input[VECTOR_LEN] = {1, 2, 3, 4, 5, 6, 7, 8};
int32_t output[VECTOR_LEN];
{
.param =
{
.a_1 = xxx,
.a_2 = xxx,
.b_0 = xxx,
.b_1 = xxx,
.b_2 = xxx,
},
};
{
.param =
{
.a_1 = xxx,
.a_2 = xxx,
.b_0 = xxx,
.b_1 = xxx,
.b_2 = xxx,
},
};
PQ_BiquadRestoreInternalState(POWERQUAD, 0, &state0);
PQ_BiquadRestoreInternalState(POWERQUAD, 1, &state1);
PQ_StartVector(input, output, VECTOR_LEN);
#define POWERQUAD_MAKE_MATRIX_LEN (   mat1Row,
  mat1Col,
  mat2Col 
)    (((uint32_t)(mat1Row) << 0U) | ((uint32_t)(mat1Col) << 8U) | ((uint32_t)(mat2Col) << 16U))
#define PQ_Q31_2_FLOAT (   x)    (((float)(x)) / 2147483648.0f)
#define PQ_Q15_2_FLOAT (   x)    (((float)(x)) / 32768.0f)

Enumeration Type Documentation

Enumerator
kPQ_CP_PQ 

Math engine.

kPQ_CP_MTX 

Matrix engine.

kPQ_CP_FFT 

FFT engine.

kPQ_CP_FIR 

FIR engine.

kPQ_CP_CORDIC 

CORDIC engine.

Enumerator
kPQ_16Bit 

Int16 Fixed point.

kPQ_32Bit 

Int32 Fixed point.

kPQ_Float 

Float point.

Enumerator
kPQ_Iteration_8 

Iterate 8 times.

kPQ_Iteration_16 

Iterate 16 times.

kPQ_Iteration_24 

Iterate 24 times.

Function Documentation

void PQ_GetDefaultConfig ( pq_config_t config)

This function initializes the POWERQUAD configuration structure to a default value. FORMAT register field definitions Bits[15:8] scaler (for scaled 'q31' formats) Bits[5:4] external format. 00b=q15, 01b=q31, 10b=float Bits[1:0] internal format. 00b=q15, 01b=q31, 10b=float POWERQUAD->INAFORMAT = (config->inputAPrescale << 8) | (config->inputAFormat << 4) | config->machineFormat

For all Powerquad operations internal format must be float (with the only exception being the FFT related functions, ie FFT/IFFT/DCT/IDCT which must be set to q31). The default values are: config->inputAFormat = kPQ_Float; config->inputAPrescale = 0; config->inputBFormat = kPQ_Float; config->inputBPrescale = 0; config->outputFormat = kPQ_Float; config->outputPrescale = 0; config->tmpFormat = kPQ_Float; config->tmpPrescale = 0; config->machineFormat = kPQ_Float; config->tmpBase = 0xE0000000;

Parameters
configPointer to "pq_config_t" structure.
void PQ_SetConfig ( POWERQUAD_Type *  base,
const pq_config_t config 
)
Parameters
basePOWERQUAD peripheral base address
configPointer to "pq_config_t" structure.
static void PQ_SetCoprocessorScaler ( POWERQUAD_Type *  base,
const pq_prescale_t prescale 
)
inlinestatic
Parameters
basePOWERQUAD peripheral base address
prescalePointer to "pq_prescale_t" structure.
void PQ_Init ( POWERQUAD_Type *  base)
Parameters
basePOWERQUAD peripheral base address.
void PQ_Deinit ( POWERQUAD_Type *  base)
Parameters
basePOWERQUAD peripheral base address.
void PQ_SetFormat ( POWERQUAD_Type *  base,
pq_computationengine_t  engine,
pq_format_t  format 
)
Parameters
basePOWERQUAD peripheral base address
engineComputation engine
formatData format
static void PQ_WaitDone ( POWERQUAD_Type *  base)
inlinestatic
Parameters
basePOWERQUAD peripheral base address
static void PQ_LnF32 ( float *  pSrc,
float *  pDst 
)
inlinestatic
Parameters
*pSrcpoints to the block of input data. The range of the input value is (0 +INFINITY).
*pDstpoints to the block of output data
static void PQ_InvF32 ( float *  pSrc,
float *  pDst 
)
inlinestatic
Parameters
*pSrcpoints to the block of input data. The range of the input value is non-zero.
*pDstpoints to the block of output data
static void PQ_SqrtF32 ( float *  pSrc,
float *  pDst 
)
inlinestatic
Parameters
*pSrcpoints to the block of input data. The range of the input value is [0 +INFINITY).
*pDstpoints to the block of output data
static void PQ_InvSqrtF32 ( float *  pSrc,
float *  pDst 
)
inlinestatic
Parameters
*pSrcpoints to the block of input data. The range of the input value is (0 +INFINITY).
*pDstpoints to the block of output data
static void PQ_EtoxF32 ( float *  pSrc,
float *  pDst 
)
inlinestatic
Parameters
*pSrcpoints to the block of input data. The range of the input value is (-INFINITY +INFINITY).
*pDstpoints to the block of output data
static void PQ_EtonxF32 ( float *  pSrc,
float *  pDst 
)
inlinestatic
Parameters
*pSrcpoints to the block of input data. The range of the input value is (-INFINITY +INFINITY).
*pDstpoints to the block of output data
static void PQ_SinF32 ( float *  pSrc,
float *  pDst 
)
inlinestatic
Parameters
*pSrcpoints to the block of input data. The input value is in radians, the range is (-INFINITY +INFINITY).
*pDstpoints to the block of output data
static void PQ_CosF32 ( float *  pSrc,
float *  pDst 
)
inlinestatic
Parameters
*pSrcpoints to the block of input data. The input value is in radians, the range is (-INFINITY +INFINITY).
*pDstpoints to the block of output data
static void PQ_BiquadF32 ( float *  pSrc,
float *  pDst 
)
inlinestatic
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
static void PQ_DivF32 ( float *  x1,
float *  x2,
float *  pDst 
)
inlinestatic

Get x1 / x2.

Parameters
x1x1
x2x2
*pDstpoints to the block of output data
static void PQ_Biquad1F32 ( float *  pSrc,
float *  pDst 
)
inlinestatic
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
static int32_t PQ_LnFixed ( int32_t  val)
inlinestatic
Parameters
valvalue to be calculated. The range of the input value is (0 +INFINITY).
Returns
returns ln(val).
static int32_t PQ_InvFixed ( int32_t  val)
inlinestatic
Parameters
valvalue to be calculated. The range of the input value is non-zero.
Returns
returns inv(val).
static uint32_t PQ_SqrtFixed ( uint32_t  val)
inlinestatic
Parameters
valvalue to be calculated. The range of the input value is [0 +INFINITY).
Returns
returns sqrt(val).
static int32_t PQ_InvSqrtFixed ( int32_t  val)
inlinestatic
Parameters
valvalue to be calculated. The range of the input value is (0 +INFINITY).
Returns
returns 1/sqrt(val).
static int32_t PQ_EtoxFixed ( int32_t  val)
inlinestatic
Parameters
valvalue to be calculated. The range of the input value is (-INFINITY +INFINITY).
Returns
returns etox^(val).
static int32_t PQ_EtonxFixed ( int32_t  val)
inlinestatic
Parameters
valvalue to be calculated. The range of the input value is (-INFINITY +INFINITY).
Returns
returns etonx^(val).
static int32_t PQ_SinQ31 ( int32_t  val)
inlinestatic
Parameters
valvalue to be calculated. The input value is [-1, 1] in Q31 format, which means [-pi, pi].
Returns
returns sin(val).
static int16_t PQ_SinQ15 ( int16_t  val)
inlinestatic
Parameters
valvalue to be calculated. The input value is [-1, 1] in Q15 format, which means [-pi, pi].
Returns
returns sin(val).
static int32_t PQ_CosQ31 ( int32_t  val)
inlinestatic
Parameters
valvalue to be calculated. The input value is [-1, 1] in Q31 format, which means [-pi, pi].
Returns
returns cos(val).
static int16_t PQ_CosQ15 ( int16_t  val)
inlinestatic
Parameters
valvalue to be calculated. The input value is [-1, 1] in Q15 format, which means [-pi, pi].
Returns
returns sin(val).
static int32_t PQ_BiquadFixed ( int32_t  val)
inlinestatic
Parameters
valvalue to be calculated
Returns
returns biquad(val).
void PQ_VectorLnF32 ( float *  pSrc,
float *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
lengththe block of input data.
void PQ_VectorInvF32 ( float *  pSrc,
float *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
lengththe block of input data.
void PQ_VectorSqrtF32 ( float *  pSrc,
float *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
lengththe block of input data.
void PQ_VectorInvSqrtF32 ( float *  pSrc,
float *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
lengththe block of input data.
void PQ_VectorEtoxF32 ( float *  pSrc,
float *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
lengththe block of input data.
void PQ_VectorEtonxF32 ( float *  pSrc,
float *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
lengththe block of input data.
void PQ_VectorSinF32 ( float *  pSrc,
float *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
lengththe block of input data.
void PQ_VectorCosF32 ( float *  pSrc,
float *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
lengththe block of input data.
void PQ_VectorLnFixed32 ( int32_t *  pSrc,
int32_t *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
lengththe block of input data.
void PQ_VectorInvFixed32 ( int32_t *  pSrc,
int32_t *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
lengththe block of input data.
void PQ_VectorSqrtFixed32 ( int32_t *  pSrc,
int32_t *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
lengththe block of input data.
void PQ_VectorInvSqrtFixed32 ( int32_t *  pSrc,
int32_t *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
lengththe block of input data.
void PQ_VectorEtoxFixed32 ( int32_t *  pSrc,
int32_t *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
lengththe block of input data.
void PQ_VectorEtonxFixed32 ( int32_t *  pSrc,
int32_t *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
lengththe block of input data.
void PQ_VectorSinQ15 ( int16_t *  pSrc,
int16_t *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
lengththe block of input data.
void PQ_VectorCosQ15 ( int16_t *  pSrc,
int16_t *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
lengththe block of input data.
void PQ_VectorSinQ31 ( int32_t *  pSrc,
int32_t *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
lengththe block of input data.
void PQ_VectorCosQ31 ( int32_t *  pSrc,
int32_t *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
lengththe block of input data.
void PQ_VectorLnFixed16 ( int16_t *  pSrc,
int16_t *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
lengththe block of input data.
void PQ_VectorInvFixed16 ( int16_t *  pSrc,
int16_t *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
lengththe block of input data.
void PQ_VectorSqrtFixed16 ( int16_t *  pSrc,
int16_t *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
lengththe block of input data.
void PQ_VectorInvSqrtFixed16 ( int16_t *  pSrc,
int16_t *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
lengththe block of input data.
void PQ_VectorEtoxFixed16 ( int16_t *  pSrc,
int16_t *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
lengththe block of input data.
void PQ_VectorEtonxFixed16 ( int16_t *  pSrc,
int16_t *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
lengththe block of input data.
void PQ_VectorBiqaudDf2F32 ( float *  pSrc,
float *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
lengththe block size of input data.
void PQ_VectorBiqaudDf2Fixed32 ( int32_t *  pSrc,
int32_t *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
blocksSizethe block size of input data
void PQ_VectorBiqaudDf2Fixed16 ( int16_t *  pSrc,
int16_t *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
blocksSizethe block size of input data
void PQ_VectorBiqaudCascadeDf2F32 ( float *  pSrc,
float *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
blocksSizethe block size of input data
void PQ_VectorBiqaudCascadeDf2Fixed32 ( int32_t *  pSrc,
int32_t *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
blocksSizethe block size of input data
void PQ_VectorBiqaudCascadeDf2Fixed16 ( int16_t *  pSrc,
int16_t *  pDst,
int32_t  length 
)
Parameters
*pSrcpoints to the block of input data
*pDstpoints to the block of output data
blocksSizethe block size of input data
int32_t PQ_ArctanFixed ( POWERQUAD_Type *  base,
int32_t  x,
int32_t  y,
pq_cordic_iter_t  iteration 
)
Parameters
basePOWERQUAD peripheral base address
xvalue of opposite
yvalue of adjacent
iterationiteration times
Returns
The return value is in the range of -2^27 to 2^27, which means -pi to pi.
Note
The sum of x and y should not exceed the range of int32_t.
Larger input number gets higher output accuracy, for example the arctan(0.5), the result of PQ_ArctanFixed(POWERQUAD, 100000, 200000, kPQ_Iteration_24) is more accurate than PQ_ArctanFixed(POWERQUAD, 1, 2, kPQ_Iteration_24).
int32_t PQ_ArctanhFixed ( POWERQUAD_Type *  base,
int32_t  x,
int32_t  y,
pq_cordic_iter_t  iteration 
)
Parameters
basePOWERQUAD peripheral base address
xvalue of opposite
yvalue of adjacent
iterationiteration times
Returns
The return value is in the range of -2^27 to 2^27, which means -1 to 1.
Note
The sum of x and y should not exceed the range of int32_t.
Larger input number gets higher output accuracy, for example the arctanh(0.5), the result of PQ_ArctanhFixed(POWERQUAD, 100000, 200000, kPQ_Iteration_24) is more accurate than PQ_ArctanhFixed(POWERQUAD, 1, 2, kPQ_Iteration_24).
static int32_t PQ_Biquad1Fixed ( int32_t  val)
inlinestatic
Parameters
valvalue to be calculated
Returns
returns biquad(val).
void PQ_TransformCFFT ( POWERQUAD_Type *  base,
uint32_t  length,
void *  pData,
void *  pResult 
)
Parameters
basePOWERQUAD peripheral base address
lengthnumber of input samples
pDatainput data
pResultoutput data.
void PQ_TransformRFFT ( POWERQUAD_Type *  base,
uint32_t  length,
void *  pData,
void *  pResult 
)
Parameters
basePOWERQUAD peripheral base address
lengthnumber of input samples
pDatainput data
pResultoutput data.
void PQ_TransformIFFT ( POWERQUAD_Type *  base,
uint32_t  length,
void *  pData,
void *  pResult 
)
Parameters
basePOWERQUAD peripheral base address
lengthnumber of input samples
pDatainput data
pResultoutput data.
void PQ_TransformCDCT ( POWERQUAD_Type *  base,
uint32_t  length,
void *  pData,
void *  pResult 
)
Parameters
basePOWERQUAD peripheral base address
lengthnumber of input samples
pDatainput data
pResultoutput data.
void PQ_TransformRDCT ( POWERQUAD_Type *  base,
uint32_t  length,
void *  pData,
void *  pResult 
)
Parameters
basePOWERQUAD peripheral base address
lengthnumber of input samples
pDatainput data
pResultoutput data.
void PQ_TransformIDCT ( POWERQUAD_Type *  base,
uint32_t  length,
void *  pData,
void *  pResult 
)
Parameters
basePOWERQUAD peripheral base address
lengthnumber of input samples
pDatainput data
pResultoutput data.
void PQ_BiquadBackUpInternalState ( POWERQUAD_Type *  base,
int32_t  biquad_num,
pq_biquad_state_t state 
)
Parameters
basePOWERQUAD peripheral base address
biquad_numbiquad side
statepoint to states.
void PQ_BiquadRestoreInternalState ( POWERQUAD_Type *  base,
int32_t  biquad_num,
pq_biquad_state_t state 
)
Parameters
basePOWERQUAD peripheral base address
biquad_numbiquad side
statepoint to states.
void PQ_BiquadCascadeDf2Init ( pq_biquad_cascade_df2_instance S,
uint8_t  numStages,
pq_biquad_state_t pState 
)
Parameters
[in,out]*Spoints to an instance of the filter data structure.
[in]numStagesnumber of 2nd order stages in the filter.
[in]*pStatepoints to the state buffer.
void PQ_BiquadCascadeDf2F32 ( const pq_biquad_cascade_df2_instance S,
float *  pSrc,
float *  pDst,
uint32_t  blockSize 
)
Parameters
[in]*Spoints to an instance of the filter data structure.
[in]*pSrcpoints to the block of input data.
[out]*pDstpoints to the block of output data
[in]blockSizenumber of samples to process.
void PQ_BiquadCascadeDf2Fixed32 ( const pq_biquad_cascade_df2_instance S,
int32_t *  pSrc,
int32_t *  pDst,
uint32_t  blockSize 
)
Parameters
[in]*Spoints to an instance of the filter data structure.
[in]*pSrcpoints to the block of input data.
[out]*pDstpoints to the block of output data
[in]blockSizenumber of samples to process.
void PQ_BiquadCascadeDf2Fixed16 ( const pq_biquad_cascade_df2_instance S,
int16_t *  pSrc,
int16_t *  pDst,
uint32_t  blockSize 
)
Parameters
[in]*Spoints to an instance of the filter data structure.
[in]*pSrcpoints to the block of input data.
[out]*pDstpoints to the block of output data
[in]blockSizenumber of samples to process.
void PQ_FIR ( POWERQUAD_Type *  base,
void *  pAData,
int32_t  ALength,
void *  pBData,
int32_t  BLength,
void *  pResult,
uint32_t  opType 
)
Parameters
basePOWERQUAD peripheral base address
pADatathe first input sequence
ALengthnumber of the first input sequence
pBDatathe second input sequence
BLengthnumber of the second input sequence
pResultarray for the output data
opTypeoperation type, could be PQ_FIR_FIR, PQ_FIR_CONVOLUTION, PQ_FIR_CORRELATION.
void PQ_FIRIncrement ( POWERQUAD_Type *  base,
int32_t  ALength,
int32_t  BLength,
int32_t  xOffset 
)
   This function can be used after pq_fir() for incremental FIR
   operation when new x data are available
Parameters
basePOWERQUAD peripheral base address
ALengthnumber of input samples
BLengthnumber of taps
xoffsetoffset for number of input samples
void PQ_MatrixAddition ( POWERQUAD_Type *  base,
uint32_t  length,
void *  pAData,
void *  pBData,
void *  pResult 
)
Parameters
basePOWERQUAD peripheral base address
lengthrows and cols for matrix. LENGTH register configuration: LENGTH[23:16] = M2 cols LENGTH[15:8] = M1 cols LENGTH[7:0] = M1 rows This could be constructed using macro POWERQUAD_MAKE_MATRIX_LEN.
pADatainput matrix A
pBDatainput matrix B
pResultarray for the output data.
void PQ_MatrixSubtraction ( POWERQUAD_Type *  base,
uint32_t  length,
void *  pAData,
void *  pBData,
void *  pResult 
)
Parameters
basePOWERQUAD peripheral base address
lengthrows and cols for matrix. LENGTH register configuration: LENGTH[23:16] = M2 cols LENGTH[15:8] = M1 cols LENGTH[7:0] = M1 rows This could be constructed using macro POWERQUAD_MAKE_MATRIX_LEN.
pADatainput matrix A
pBDatainput matrix B
pResultarray for the output data.
void PQ_MatrixMultiplication ( POWERQUAD_Type *  base,
uint32_t  length,
void *  pAData,
void *  pBData,
void *  pResult 
)
Parameters
basePOWERQUAD peripheral base address
lengthrows and cols for matrix. LENGTH register configuration: LENGTH[23:16] = M2 cols LENGTH[15:8] = M1 cols LENGTH[7:0] = M1 rows This could be constructed using macro POWERQUAD_MAKE_MATRIX_LEN.
pADatainput matrix A
pBDatainput matrix B
pResultarray for the output data.
void PQ_MatrixProduct ( POWERQUAD_Type *  base,
uint32_t  length,
void *  pAData,
void *  pBData,
void *  pResult 
)
Parameters
basePOWERQUAD peripheral base address
lengthrows and cols for matrix. LENGTH register configuration: LENGTH[23:16] = M2 cols LENGTH[15:8] = M1 cols LENGTH[7:0] = M1 rows This could be constructed using macro POWERQUAD_MAKE_MATRIX_LEN.
pADatainput matrix A
pBDatainput matrix B
pResultarray for the output data.
void PQ_VectorDotProduct ( POWERQUAD_Type *  base,
uint32_t  length,
void *  pAData,
void *  pBData,
void *  pResult 
)
Parameters
basePOWERQUAD peripheral base address
lengthlength of vector
pADatainput vector A
pBDatainput vector B
pResultarray for the output data.
void PQ_MatrixInversion ( POWERQUAD_Type *  base,
uint32_t  length,
void *  pData,
void *  pTmpData,
void *  pResult 
)
Parameters
basePOWERQUAD peripheral base address
lengthrows and cols for matrix. LENGTH register configuration: LENGTH[23:16] = M2 cols LENGTH[15:8] = M1 cols LENGTH[7:0] = M1 rows This could be constructed using macro POWERQUAD_MAKE_MATRIX_LEN.
pDatainput matrix
pTmpDatainput temporary matrix, pTmpData length not less than pData lenght and 1024 words is sufficient for the largest supported matrix.
pResultarray for the output data, round down for fixed point.
void PQ_MatrixTranspose ( POWERQUAD_Type *  base,
uint32_t  length,
void *  pData,
void *  pResult 
)
Parameters
basePOWERQUAD peripheral base address
lengthrows and cols for matrix. LENGTH register configuration: LENGTH[23:16] = M2 cols LENGTH[15:8] = M1 cols LENGTH[7:0] = M1 rows This could be constructed using macro POWERQUAD_MAKE_MATRIX_LEN.
pDatainput matrix
pResultarray for the output data.
void PQ_MatrixScale ( POWERQUAD_Type *  base,
uint32_t  length,
float  misc,
void *  pData,
void *  pResult 
)
Parameters
basePOWERQUAD peripheral base address
lengthrows and cols for matrix. LENGTH register configuration: LENGTH[23:16] = M2 cols LENGTH[15:8] = M1 cols LENGTH[7:0] = M1 rows This could be constructed using macro POWERQUAD_MAKE_MATRIX_LEN.
miscscaling parameters
pDatainput matrix
pResultarray for the output data.