Hello E2E Experts,
Good day.
Could you help me with the C code for the TMS320C5515 microprocessor? My task is to write a function Cascaded IIR Direct Form II Using 4 Coefficients per Biquad. I wrote an algorithm for this function, but there is a problem related to "dbuffer[0] stores the index of the current element in the buffer, and the buffer itself is cyclic: "The first location of dbuffer is reserved for the index"".
ushort iircas4(DATA *x, DATA *h, DATA *r, DATA *dbuffer, ushort nbiq, ushort nx) {
int i, j;
DATA y;
for (i = 0; i < nx; ++i) {
DATA tmp = (long)x[i] - ((long)h[0] * (long)dbuffer[0] >> 16) - ((long)h[2] * (long)dbuffer[nbiq] >> 16);
y = tmp + ((long)h[1] * (long)dbuffer[0] >> 16) + ((long)h[3] * (long)dbuffer[nbiq] >> 16);
dbuffer[nbiq] = dbuffer[0];
dbuffer[0] = tmp;
for (j = 1; j < nbiq; ++j) {
ushort hOffset = (4 * j) >> 1;
tmp = y - ((long)h[hOffset] * (long)dbuffer[j] >> 16) - ((long)h[hOffset + 2] * (long)dbuffer[nbiq + j] >> 16);
y = tmp + ((long)h[hOffset + 1] * (long)dbuffer[j] >> 16) + ((long)h[hOffset +3] * (long)dbuffer[nbiq + j] >> 16);
dbuffer[j + nbiq] = dbuffer[j];
dbuffer[j] = tmp;
}
r[i] = y;
}
volatile ushort oflag = 0;
return oflag;
}
Could you send me the code of the iircas4 function in C.
Regards,
CSC