Instances of this class handle configuring and setting up the coefficients for the IIR Filter core. More...
#include <core/DspFpgaIir.h>
Public Member Functions | |
tcDspFpgaIir (void *apAddress) | |
This constructor is used to open an IIR core instance. | |
~tcDspFpgaIir () | |
Default destructor. | |
int | GetNumPaths (void) |
Return the number of paths configured in the IIR firmware core. | |
bool | SetNumFilters (int anFilters) |
Update the number of cascaded filters (per path) configured in the IIR firmware core. | |
int | GetNumFilters (void) |
Return the number of cascaded filters (per path) configured in the IIR firmware core. | |
bool | SetCoeffs (int anPath, int anFilter, int anB0, int anB1, int anB2, int anA1, int anA2) |
Update the coefficients for the selected filter path and filter number. | |
bool | SetCoeffs (int anPath, int anFilter, float anB0, float anB1, float anB2, float anA1, float anA2) |
Update the coefficients for the selected filter path and filter number. | |
bool | GetCoeffs (int anPath, int anFilter, int &arB0, int &arB1, int &arB2, int &arA1, int &arA2) |
Return the current filter coefficients (as 16-bit integers) for the given path and filter. | |
bool | GetCoeffs (int anPath, int anFilter, float &arB0, float &arB1, float &arB2, float &arA1, float &arA2) |
Return the current filter coefficients for the given path and filter. | |
Static Public Attributes | |
static const int | gnCoeffScale = 0x00010000 |
Filter coefficients are scaled to this value. | |
static const int | gnMaxCoeff = 131071 |
Minimum and maximum allowed integer coefficient (signed 18-bit value). | |
static const int | gnMinCoeff = -131072 |
static const int | gnMaxFilters = 4 |
Number of paths and filters supported. | |
static const int | gnMaxPaths = 4 |
static const int | gnNumACoeffs = 2 |
static const int | gnNumBCoeffs = 3 |
Protected Member Functions | |
void | CopyCoes (unsigned char anFilter, int *anB, int *anA) |
Definition of sample data holding area. | |
void | FetchCoes (unsigned char anFilter, int *anB, int *anA) |
Return the currently configured coefficients for the specified filter directly from the IIR core. | |
int | GetFilterID (int anPath, int anFilter) |
Determing the actual filter index based on the specified path and filter and the configured number of paths (NP) and number of filters (NF). | |
Protected Attributes | |
SEM_Handle | mhMutex |
Mutex to serialize access. | |
volatile unsigned int * | mpBaseAddr |
IIR Core base address. | |
int | mnPaths |
Number of IIR paths. | |
int | mnFilters |
Number of filters per paths. | |
int | maACoes [gnMaxFilters][gnNumACoeffs] |
A[] Coefficients. | |
int | maBCoes [gnMaxFilters][gnNumBCoeffs] |
B[] Coefficients. |
Instances of this class handle configuring and setting up the coefficients for the IIR Filter core.
Each instance provides four filters, which may be cascaded along up to 4 different paths. The number of paths available is implementation specific, and is provided as a read-only value. The number of filters along each path may be configured.
tcDspFpgaIir::tcDspFpgaIir | ( | void * | apAddress | ) |
This constructor is used to open an IIR core instance.
The base address of the FPGA core must be provided.
[in] | apAddress | The base address of the IIR core. |
tcDspFpgaIir::~tcDspFpgaIir | ( | ) |
Default destructor.
int tcDspFpgaIir::GetNumPaths | ( | void | ) |
Return the number of paths configured in the IIR firmware core.
bool tcDspFpgaIir::SetNumFilters | ( | int | anFilters | ) |
Update the number of cascaded filters (per path) configured in the IIR firmware core.
The following are valid combinations:
[in] | anFilters | Requested number of cascaded filters. |
int tcDspFpgaIir::GetNumFilters | ( | void | ) |
Return the number of cascaded filters (per path) configured in the IIR firmware core.
bool tcDspFpgaIir::SetCoeffs | ( | int | anPath, | |
int | anFilter, | |||
int | anB0, | |||
int | anB1, | |||
int | anB2, | |||
int | anA1, | |||
int | anA2 | |||
) |
Update the coefficients for the selected filter path and filter number.
[in] | anPath | Filter path requested. |
[in] | anFilter | Cascaded filter within the selected path. |
[in] | anB0 | New B0 coefficient. |
[in] | anB1 | New B1 coefficient. |
[in] | anB2 | New B2 coefficient. |
[in] | anA1 | New A1 coefficient. |
[in] | anA2 | New A2 coefficient. |
bool tcDspFpgaIir::SetCoeffs | ( | int | anPath, | |
int | anFilter, | |||
float | anB0, | |||
float | anB1, | |||
float | anB2, | |||
float | anA1, | |||
float | anA2 | |||
) |
Update the coefficients for the selected filter path and filter number.
[in] | anPath | Filter path requested. |
[in] | anFilter | Cascaded filter within the selected path. |
[in] | anB0 | New B0 coefficient. |
[in] | anB1 | New B1 coefficient. |
[in] | anB2 | New B2 coefficient. |
[in] | anA1 | New A1 coefficient. |
[in] | anA2 | New A2 coefficient. |
bool tcDspFpgaIir::GetCoeffs | ( | int | anPath, | |
int | anFilter, | |||
int & | arB0, | |||
int & | arB1, | |||
int & | arB2, | |||
int & | arA1, | |||
int & | arA2 | |||
) |
Return the current filter coefficients (as 16-bit integers) for the given path and filter.
[in] | anPath | Filter path requested. |
[in] | anFilter | Cascaded filter within the selected path. |
[out] | arB0 | Reference to B0 coeff storage. |
[out] | arB1 | Reference to B1 coeff storage. |
[out] | arB2 | Reference to B2 coeff storage. |
[out] | arA1 | Reference to A1 coeff storage. |
[out] | arA2 | Reference to A2 coeff storage. |
bool tcDspFpgaIir::GetCoeffs | ( | int | anPath, | |
int | anFilter, | |||
float & | arB0, | |||
float & | arB1, | |||
float & | arB2, | |||
float & | arA1, | |||
float & | arA2 | |||
) |
Return the current filter coefficients for the given path and filter.
[in] | anPath | Filter path requested. |
[in] | anFilter | Cascaded filter within the selected path. |
[out] | arB0 | Reference to B0 coeff storage. |
[out] | arB1 | Reference to B1 coeff storage. |
[out] | arB2 | Reference to B2 coeff storage. |
[out] | arA1 | Reference to A1 coeff storage. |
[out] | arA2 | Reference to A2 coeff storage. |
void tcDspFpgaIir::CopyCoes | ( | unsigned char | anFilter, | |
int * | anB, | |||
int * | anA | |||
) | [protected] |
Definition of sample data holding area.
Copy the provided coefficients for the specified filter to the IIR core.
[in] | anFilter | The requested filter. |
[in] | anB | Pointer to the new "B" coefficients. |
[in] | anA | Pointer to the new "A" coefficients. |
void tcDspFpgaIir::FetchCoes | ( | unsigned char | anFilter, | |
int * | anB, | |||
int * | anA | |||
) | [protected] |
Return the currently configured coefficients for the specified filter directly from the IIR core.
[in] | anFilter | The requested filter. |
[out] | anB | Pointer to storage for the "B" coefficients. |
[out] | anA | Pointer to storage for the "A" coefficients. |
int tcDspFpgaIir::GetFilterID | ( | int | anPath, | |
int | anFilter | |||
) | [protected] |
Determing the actual filter index based on the specified path and filter and the configured number of paths (NP) and number of filters (NF).
[in] | anPath | The filter path. |
[in] | anFilter | The cascaded filter number. |
const int MityDSP::tcDspFpgaIir::gnCoeffScale = 0x00010000 [static] |
Filter coefficients are scaled to this value.
const int MityDSP::tcDspFpgaIir::gnMaxCoeff = 131071 [static] |
Minimum and maximum allowed integer coefficient (signed 18-bit value).
const int MityDSP::tcDspFpgaIir::gnMinCoeff = -131072 [static] |
const int MityDSP::tcDspFpgaIir::gnMaxFilters = 4 [static] |
Number of paths and filters supported.
const int MityDSP::tcDspFpgaIir::gnMaxPaths = 4 [static] |
const int MityDSP::tcDspFpgaIir::gnNumACoeffs = 2 [static] |
const int MityDSP::tcDspFpgaIir::gnNumBCoeffs = 3 [static] |
SEM_Handle MityDSP::tcDspFpgaIir::mhMutex [protected] |
Mutex to serialize access.
volatile unsigned int* MityDSP::tcDspFpgaIir::mpBaseAddr [protected] |
IIR Core base address.
int MityDSP::tcDspFpgaIir::mnPaths [protected] |
Number of IIR paths.
int MityDSP::tcDspFpgaIir::mnFilters [protected] |
Number of filters per paths.
int MityDSP::tcDspFpgaIir::maACoes[gnMaxFilters][gnNumACoeffs] [protected] |
A[] Coefficients.
int MityDSP::tcDspFpgaIir::maBCoes[gnMaxFilters][gnNumBCoeffs] [protected] |
B[] Coefficients.