MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
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:
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.
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... | |
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... | |
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... | |
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 |
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... | |
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_t * | pState |
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 |
#define FSL_POWERQUAD_DRIVER_VERSION (MAKE_VERSION(2, 0, 1)) |
#define PQ_Initiate_Vector_Func | ( | pSrc, | |
pDst | |||
) |
Start the vector calculation, the input data could be float, int32_t or Q31.
PSRC | Pointer to the source data. |
PDST | Pointer 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 | |||
) |
Start the vector calculation, the input data could be float, int32_t or Q31.
PSRC | Pointer to the source data. |
PDST | Pointer to the destination data. |
LENGTH | Number of the data, must be multiple of 8. |
#define PQ_StartVectorFixed16 | ( | PSRC, | |
PDST, | |||
LENGTH | |||
) |
Start the vector calculation, the input data could be int16_t. This function should be use with PQ_Vector8Fixed16.
PSRC | Pointer to the source data. |
PDST | Pointer to the destination data. |
LENGTH | Number of the data, must be multiple of 8. |
#define PQ_StartVectorQ15 | ( | PSRC, | |
PDST, | |||
LENGTH | |||
) |
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.
PSRC | Pointer to the source data. |
PDST | Pointer to the destination data. |
LENGTH | Number 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 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 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 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 PQ_DF2_Vector8_FP | ( | middle, | |
last | |||
) |
Biquad filter, the input and output data are float data. Biquad side 0 is used. Example:
#define PQ_DF2_Vector8_FX | ( | middle, | |
last | |||
) |
Biquad filter, the input and output data are fixed data. Biquad side 0 is used. Example:
#define PQ_Vector8BiquadDf2F32 | ( | ) |
Biquad filter, the input and output data are float data. Biquad side 0 is used. Example:
#define PQ_Vector8BiquadDf2Fixed32 | ( | ) |
Biquad filter, the input and output data are Q31 or 32-bit integer. Biquad side 0 is used. Example:
#define PQ_Vector8BiquadDf2Fixed16 | ( | ) |
Biquad filter, the input and output data are Q15 or 16-bit integer. Biquad side 0 is used. Example:
#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 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 PQ_Vector8BiqaudDf2CascadeF32 | ( | ) |
The input and output data are float data. The data flow is input -> biquad side 1 -> biquad side 0 -> output.
#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 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 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) |
enum pq_format_t |
enum pq_cordic_iter_t |
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;
config | Pointer to "pq_config_t" structure. |
void PQ_SetConfig | ( | POWERQUAD_Type * | base, |
const pq_config_t * | config | ||
) |
base | POWERQUAD peripheral base address |
config | Pointer to "pq_config_t" structure. |
|
inlinestatic |
base | POWERQUAD peripheral base address |
prescale | Pointer to "pq_prescale_t" structure. |
void PQ_Init | ( | POWERQUAD_Type * | base | ) |
base | POWERQUAD peripheral base address. |
void PQ_Deinit | ( | POWERQUAD_Type * | base | ) |
base | POWERQUAD peripheral base address. |
void PQ_SetFormat | ( | POWERQUAD_Type * | base, |
pq_computationengine_t | engine, | ||
pq_format_t | format | ||
) |
base | POWERQUAD peripheral base address |
engine | Computation engine |
format | Data format |
|
inlinestatic |
base | POWERQUAD peripheral base address |
|
inlinestatic |
*pSrc | points to the block of input data. The range of the input value is (0 +INFINITY). |
*pDst | points to the block of output data |
|
inlinestatic |
*pSrc | points to the block of input data. The range of the input value is non-zero. |
*pDst | points to the block of output data |
|
inlinestatic |
*pSrc | points to the block of input data. The range of the input value is [0 +INFINITY). |
*pDst | points to the block of output data |
|
inlinestatic |
*pSrc | points to the block of input data. The range of the input value is (0 +INFINITY). |
*pDst | points to the block of output data |
|
inlinestatic |
*pSrc | points to the block of input data. The range of the input value is (-INFINITY +INFINITY). |
*pDst | points to the block of output data |
|
inlinestatic |
*pSrc | points to the block of input data. The range of the input value is (-INFINITY +INFINITY). |
*pDst | points to the block of output data |
|
inlinestatic |
*pSrc | points to the block of input data. The input value is in radians, the range is (-INFINITY +INFINITY). |
*pDst | points to the block of output data |
|
inlinestatic |
*pSrc | points to the block of input data. The input value is in radians, the range is (-INFINITY +INFINITY). |
*pDst | points to the block of output data |
|
inlinestatic |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
|
inlinestatic |
Get x1 / x2.
x1 | x1 |
x2 | x2 |
*pDst | points to the block of output data |
|
inlinestatic |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
|
inlinestatic |
val | value to be calculated. The range of the input value is (0 +INFINITY). |
|
inlinestatic |
val | value to be calculated. The range of the input value is non-zero. |
|
inlinestatic |
val | value to be calculated. The range of the input value is [0 +INFINITY). |
|
inlinestatic |
val | value to be calculated. The range of the input value is (0 +INFINITY). |
|
inlinestatic |
val | value to be calculated. The range of the input value is (-INFINITY +INFINITY). |
|
inlinestatic |
val | value to be calculated. The range of the input value is (-INFINITY +INFINITY). |
|
inlinestatic |
val | value to be calculated. The input value is [-1, 1] in Q31 format, which means [-pi, pi]. |
|
inlinestatic |
val | value to be calculated. The input value is [-1, 1] in Q15 format, which means [-pi, pi]. |
|
inlinestatic |
val | value to be calculated. The input value is [-1, 1] in Q31 format, which means [-pi, pi]. |
|
inlinestatic |
val | value to be calculated. The input value is [-1, 1] in Q15 format, which means [-pi, pi]. |
|
inlinestatic |
val | value to be calculated |
void PQ_VectorLnF32 | ( | float * | pSrc, |
float * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
length | the block of input data. |
void PQ_VectorInvF32 | ( | float * | pSrc, |
float * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
length | the block of input data. |
void PQ_VectorSqrtF32 | ( | float * | pSrc, |
float * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
length | the block of input data. |
void PQ_VectorInvSqrtF32 | ( | float * | pSrc, |
float * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
length | the block of input data. |
void PQ_VectorEtoxF32 | ( | float * | pSrc, |
float * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
length | the block of input data. |
void PQ_VectorEtonxF32 | ( | float * | pSrc, |
float * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
length | the block of input data. |
void PQ_VectorSinF32 | ( | float * | pSrc, |
float * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
length | the block of input data. |
void PQ_VectorCosF32 | ( | float * | pSrc, |
float * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
length | the block of input data. |
void PQ_VectorLnFixed32 | ( | int32_t * | pSrc, |
int32_t * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
length | the block of input data. |
void PQ_VectorInvFixed32 | ( | int32_t * | pSrc, |
int32_t * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
length | the block of input data. |
void PQ_VectorSqrtFixed32 | ( | int32_t * | pSrc, |
int32_t * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
length | the block of input data. |
void PQ_VectorInvSqrtFixed32 | ( | int32_t * | pSrc, |
int32_t * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
length | the block of input data. |
void PQ_VectorEtoxFixed32 | ( | int32_t * | pSrc, |
int32_t * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
length | the block of input data. |
void PQ_VectorEtonxFixed32 | ( | int32_t * | pSrc, |
int32_t * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
length | the block of input data. |
void PQ_VectorSinQ15 | ( | int16_t * | pSrc, |
int16_t * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
length | the block of input data. |
void PQ_VectorCosQ15 | ( | int16_t * | pSrc, |
int16_t * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
length | the block of input data. |
void PQ_VectorSinQ31 | ( | int32_t * | pSrc, |
int32_t * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
length | the block of input data. |
void PQ_VectorCosQ31 | ( | int32_t * | pSrc, |
int32_t * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
length | the block of input data. |
void PQ_VectorLnFixed16 | ( | int16_t * | pSrc, |
int16_t * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
length | the block of input data. |
void PQ_VectorInvFixed16 | ( | int16_t * | pSrc, |
int16_t * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
length | the block of input data. |
void PQ_VectorSqrtFixed16 | ( | int16_t * | pSrc, |
int16_t * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
length | the block of input data. |
void PQ_VectorInvSqrtFixed16 | ( | int16_t * | pSrc, |
int16_t * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
length | the block of input data. |
void PQ_VectorEtoxFixed16 | ( | int16_t * | pSrc, |
int16_t * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
length | the block of input data. |
void PQ_VectorEtonxFixed16 | ( | int16_t * | pSrc, |
int16_t * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
length | the block of input data. |
void PQ_VectorBiqaudDf2F32 | ( | float * | pSrc, |
float * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
length | the block size of input data. |
void PQ_VectorBiqaudDf2Fixed32 | ( | int32_t * | pSrc, |
int32_t * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
blocksSize | the block size of input data |
void PQ_VectorBiqaudDf2Fixed16 | ( | int16_t * | pSrc, |
int16_t * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
blocksSize | the block size of input data |
void PQ_VectorBiqaudCascadeDf2F32 | ( | float * | pSrc, |
float * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
blocksSize | the block size of input data |
void PQ_VectorBiqaudCascadeDf2Fixed32 | ( | int32_t * | pSrc, |
int32_t * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
blocksSize | the block size of input data |
void PQ_VectorBiqaudCascadeDf2Fixed16 | ( | int16_t * | pSrc, |
int16_t * | pDst, | ||
int32_t | length | ||
) |
*pSrc | points to the block of input data |
*pDst | points to the block of output data |
blocksSize | the block size of input data |
int32_t PQ_ArctanFixed | ( | POWERQUAD_Type * | base, |
int32_t | x, | ||
int32_t | y, | ||
pq_cordic_iter_t | iteration | ||
) |
base | POWERQUAD peripheral base address |
x | value of opposite |
y | value of adjacent |
iteration | iteration times |
int32_t PQ_ArctanhFixed | ( | POWERQUAD_Type * | base, |
int32_t | x, | ||
int32_t | y, | ||
pq_cordic_iter_t | iteration | ||
) |
base | POWERQUAD peripheral base address |
x | value of opposite |
y | value of adjacent |
iteration | iteration times |
|
inlinestatic |
val | value to be calculated |
void PQ_TransformCFFT | ( | POWERQUAD_Type * | base, |
uint32_t | length, | ||
void * | pData, | ||
void * | pResult | ||
) |
base | POWERQUAD peripheral base address |
length | number of input samples |
pData | input data |
pResult | output data. |
void PQ_TransformRFFT | ( | POWERQUAD_Type * | base, |
uint32_t | length, | ||
void * | pData, | ||
void * | pResult | ||
) |
base | POWERQUAD peripheral base address |
length | number of input samples |
pData | input data |
pResult | output data. |
void PQ_TransformIFFT | ( | POWERQUAD_Type * | base, |
uint32_t | length, | ||
void * | pData, | ||
void * | pResult | ||
) |
base | POWERQUAD peripheral base address |
length | number of input samples |
pData | input data |
pResult | output data. |
void PQ_TransformCDCT | ( | POWERQUAD_Type * | base, |
uint32_t | length, | ||
void * | pData, | ||
void * | pResult | ||
) |
base | POWERQUAD peripheral base address |
length | number of input samples |
pData | input data |
pResult | output data. |
void PQ_TransformRDCT | ( | POWERQUAD_Type * | base, |
uint32_t | length, | ||
void * | pData, | ||
void * | pResult | ||
) |
base | POWERQUAD peripheral base address |
length | number of input samples |
pData | input data |
pResult | output data. |
void PQ_TransformIDCT | ( | POWERQUAD_Type * | base, |
uint32_t | length, | ||
void * | pData, | ||
void * | pResult | ||
) |
base | POWERQUAD peripheral base address |
length | number of input samples |
pData | input data |
pResult | output data. |
void PQ_BiquadBackUpInternalState | ( | POWERQUAD_Type * | base, |
int32_t | biquad_num, | ||
pq_biquad_state_t * | state | ||
) |
base | POWERQUAD peripheral base address |
biquad_num | biquad side |
state | point to states. |
void PQ_BiquadRestoreInternalState | ( | POWERQUAD_Type * | base, |
int32_t | biquad_num, | ||
pq_biquad_state_t * | state | ||
) |
base | POWERQUAD peripheral base address |
biquad_num | biquad side |
state | point to states. |
void PQ_BiquadCascadeDf2Init | ( | pq_biquad_cascade_df2_instance * | S, |
uint8_t | numStages, | ||
pq_biquad_state_t * | pState | ||
) |
[in,out] | *S | points to an instance of the filter data structure. |
[in] | numStages | number of 2nd order stages in the filter. |
[in] | *pState | points to the state buffer. |
void PQ_BiquadCascadeDf2F32 | ( | const pq_biquad_cascade_df2_instance * | S, |
float * | pSrc, | ||
float * | pDst, | ||
uint32_t | blockSize | ||
) |
[in] | *S | points to an instance of the filter data structure. |
[in] | *pSrc | points to the block of input data. |
[out] | *pDst | points to the block of output data |
[in] | blockSize | number of samples to process. |
void PQ_BiquadCascadeDf2Fixed32 | ( | const pq_biquad_cascade_df2_instance * | S, |
int32_t * | pSrc, | ||
int32_t * | pDst, | ||
uint32_t | blockSize | ||
) |
[in] | *S | points to an instance of the filter data structure. |
[in] | *pSrc | points to the block of input data. |
[out] | *pDst | points to the block of output data |
[in] | blockSize | number of samples to process. |
void PQ_BiquadCascadeDf2Fixed16 | ( | const pq_biquad_cascade_df2_instance * | S, |
int16_t * | pSrc, | ||
int16_t * | pDst, | ||
uint32_t | blockSize | ||
) |
[in] | *S | points to an instance of the filter data structure. |
[in] | *pSrc | points to the block of input data. |
[out] | *pDst | points to the block of output data |
[in] | blockSize | number 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 | ||
) |
base | POWERQUAD peripheral base address |
pAData | the first input sequence |
ALength | number of the first input sequence |
pBData | the second input sequence |
BLength | number of the second input sequence |
pResult | array for the output data |
opType | operation 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
base | POWERQUAD peripheral base address |
ALength | number of input samples |
BLength | number of taps |
xoffset | offset for number of input samples |
void PQ_MatrixAddition | ( | POWERQUAD_Type * | base, |
uint32_t | length, | ||
void * | pAData, | ||
void * | pBData, | ||
void * | pResult | ||
) |
base | POWERQUAD peripheral base address |
length | rows 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. |
pAData | input matrix A |
pBData | input matrix B |
pResult | array for the output data. |
void PQ_MatrixSubtraction | ( | POWERQUAD_Type * | base, |
uint32_t | length, | ||
void * | pAData, | ||
void * | pBData, | ||
void * | pResult | ||
) |
base | POWERQUAD peripheral base address |
length | rows 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. |
pAData | input matrix A |
pBData | input matrix B |
pResult | array for the output data. |
void PQ_MatrixMultiplication | ( | POWERQUAD_Type * | base, |
uint32_t | length, | ||
void * | pAData, | ||
void * | pBData, | ||
void * | pResult | ||
) |
base | POWERQUAD peripheral base address |
length | rows 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. |
pAData | input matrix A |
pBData | input matrix B |
pResult | array for the output data. |
void PQ_MatrixProduct | ( | POWERQUAD_Type * | base, |
uint32_t | length, | ||
void * | pAData, | ||
void * | pBData, | ||
void * | pResult | ||
) |
base | POWERQUAD peripheral base address |
length | rows 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. |
pAData | input matrix A |
pBData | input matrix B |
pResult | array for the output data. |
void PQ_VectorDotProduct | ( | POWERQUAD_Type * | base, |
uint32_t | length, | ||
void * | pAData, | ||
void * | pBData, | ||
void * | pResult | ||
) |
base | POWERQUAD peripheral base address |
length | length of vector |
pAData | input vector A |
pBData | input vector B |
pResult | array for the output data. |
void PQ_MatrixInversion | ( | POWERQUAD_Type * | base, |
uint32_t | length, | ||
void * | pData, | ||
void * | pTmpData, | ||
void * | pResult | ||
) |
base | POWERQUAD peripheral base address |
length | rows 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. |
pData | input matrix |
pTmpData | input temporary matrix, pTmpData length not less than pData lenght and 1024 words is sufficient for the largest supported matrix. |
pResult | array for the output data, round down for fixed point. |
void PQ_MatrixTranspose | ( | POWERQUAD_Type * | base, |
uint32_t | length, | ||
void * | pData, | ||
void * | pResult | ||
) |
base | POWERQUAD peripheral base address |
length | rows 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. |
pData | input matrix |
pResult | array for the output data. |
void PQ_MatrixScale | ( | POWERQUAD_Type * | base, |
uint32_t | length, | ||
float | misc, | ||
void * | pData, | ||
void * | pResult | ||
) |
base | POWERQUAD peripheral base address |
length | rows 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. |
misc | scaling parameters |
pData | input matrix |
pResult | array for the output data. |