//#define SIMULATE #ifdef SIMULATE #include #endif #include #include "signalProcessing/include/signal_path.h" #define CSS_CMD 0xC00004 // Define the specific interrupt that the cm3 will trigger when it wants // us to perform a calculation #define CSS_CMD_0 (1<<0) #define CSS_CMD_1 (1<<1) // Define the shared memory between the ARM and LPDSP processors #define INPUT_PORT0_ADD 0x800000 // TODO: if BLOCK_LEN >1 is used, the data is interleaved: ch0ch1, ch0ch1 .... //#define INPUT_PORT1_ADD INPUT_PORT0_ADD + 2 //DMB #define OUTPUT_PORT_ADD (INPUT_PORT0_ADD + 16) // 2* for 2 channels // Define the interrupt register to notify the ARM of a completed operation volatile static unsigned char chess_storage(DMIO:CSS_CMD) CssCmdGen; // handling requests from the CM3 is activated static volatile int actionRequired; static SingleSignalPath cSensorSignal; static SingleSignalPath accSensorSignal; #if BLOCK_LEN == 1 static volatile int16_t chess_storage(DMB:INPUT_PORT0_ADD) intputPort[4]; //TODO: if BLOCK_LEN >1 is used, the data is interleaved: ch0ch1, ch0ch1 .... chess_storage(DMA % alignof(int)) ? //static volatile int16_t chess_storage(DMB:INPUT_PORT1_ADD) intputPort1[BLOCK_LEN]; static volatile int16_t chess_storage(DMB:OUTPUT_PORT_ADD) outputPort[4]; static volatile int16_t chess_storage(DMB) *inPtr0; static volatile int16_t chess_storage(DMB) *inPtr1; static volatile int16_t chess_storage(DMB) *outPtr; static volatile int16_t chess_storage(DMB) sample; static volatile int16_t chess_storage(DMB) *sample_ptr; #else static int16_t chess_storage(DMA) intputPort[BLOCK_LEN]; //chess_storage(DMA:INPUT_PORT_ADD) TODO: volatile? chess_storage(DMA % alignof(int)) //static int16_t chess_storage(DMA) intputPort1[BLOCK_LEN]; //chess_storage(DMA:INPUT_PORT_ADD) static int16_t chess_storage(DMB) outputPort[BLOCK_LEN]; // chess_storage(DMB:OUTPUT_PORT_ADD) TODO: determine output port add #endif extern "C" void isr0() property (isr) { // raise the flag indicating something needs to be processed actionRequired = 1; } #ifdef __chess__ extern "C" #endif int main(void) { static OutputMode mode = OUTPUT_MODE_FIR_LMS; // Initialize the signal path // Initialize the csensor signal subpath // Instanciate the signal path state structs // Deactivate preemphasis filter by initializing with coefficients {1., 0., 0., 0., 0.} // biquad filter coefficients - off double b0[5]={0.75, 0., 0., 0., 0.}; double b1[5]={0.75, 0., 0., 0., 0.}; int N_lms_fir_coeffs = MAX_FIR_COEFFS; // always test with max coeffs init( &cSensorSignal, &accSensorSignal, //&ptr_fir_lms_delay_line, &ptr_fir_lms_coeffs, b0, b1, 2, // sample delay 2, 0.9, // weight 0.9, 0.01, // lms learning rate N_lms_fir_coeffs // Numer of lms fir coefficients ); if (mode == OUTPUT_MODE_FIR){ //FIR filter mit fixen coeffizienten wenn nicht adaptiv for (int i=0; i