Hi,
I'm trying to figure out the how to correctly use the Configure buffer sizes tab in the algorithm designer section of Sigma Studio+ using SC573.
I understand and make work the examples of the mute no slew and gain control and even the BPROCESS_ and INIT_ functionality.
My problem is I want to declare some global variables of type float and also my own structure but I cannot get the algorithm to work. I think it maybe something to do with I haven't configured the buffer sizes correctly.
I have read the memory types in the coding conventions
wiki.analog.com/.../algorithm_designer_coding_conventions
and refer to this for how to use global variables but I don't understand how to apply this for the global variables I have. Which one of the memory types do I use ?
State, State B, State C, State (Ext Pre), Scratch(PM), Scratch(DM)
Constant Tables
All global variables and global tables in the Module are treated as constant tables by SigmaStudio. In case of ADSP-SC5xx only one instance of this memory is allocated per schematic. This memory is mapped on to the parameter buffer. Note: Modification of this memory is allowed even though this is treated as constant table by SigmaStudio. This memory is shared across all modules in any given schematic.
in my source code (below )everything builds and works as long as I don't try and write to the variable
'current_gain' as I try in INIT_GainTest
any suggestions why writing to the variable breaks ?
Many thanks
here is my source code
#include "adi_ss_extmod.h"
float current_gain = 2;
#pragma section("seg_pmco")
void BPROCESS_GainTest (SSBlockAlgo* pBlkAlgoInfo)
{
int index, sample, gain, blockSize, repCount;
float *pInput, *pOutput;
repCount = pBlkAlgoInfo->nGrowth;
for(index = 0; index < repCount; index++)
{
blockSize = pBlkAlgoInfo->pInputs[index].pBlockProperties->nBlockSize;
gain = ((float *)pBlkAlgoInfo->pParam)[index];
pInput = pBlkAlgoInfo->pInputs[index].pSamples;
pOutput = pBlkAlgoInfo->pOutputs[index].pSamples;
for(sample = 0; sample < blockSize; sample++)
{
pOutput[sample] = pInput[sample] * gain;
}
}
}
#pragma section("seg_pmco")
void INIT_GainTest (SSBlockAlgo* pBlkAlgoInfo)
{
int index, repCount;
// current_gain = 3; // if I try to write to variable then it breaks everything
repCount = pBlkAlgoInfo->nGrowth;
for(index = 0; index < repCount; index++)
{
((float *)pBlkAlgoInfo->pParam)[index] = current_gain;
}
}
Alogrithm_test.zip