Rest außer Simulation raus
This commit is contained in:
@@ -1,40 +1,29 @@
|
|||||||
// BLOCK LEN 1 und MAX_FIR_COEFFS 64 werden vom Compiler mitgegeben
|
// BLOCK LEN 1 und MAX_FIR_COEFFS 64 werden vom Compiler mitgegeben
|
||||||
|
|
||||||
//#define SIMULATE
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifdef SIMULATE
|
|
||||||
#include <stdio.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "signal_processing/include/signal_path.h"
|
#include "signal_processing/include/signal_path.h"
|
||||||
|
|
||||||
// Register und Bitmasken für Interrupts zwischen ARM und LPDSP Prozessor
|
// Register und Bitmasken f<EFBFBD>r Interrupts zwischen ARM und LPDSP Prozessor
|
||||||
#define CSS_CMD 0xC00004
|
#define CSS_CMD 0xC00004
|
||||||
#define CSS_CMD_0 (1<<0)
|
#define CSS_CMD_0 (1<<0)
|
||||||
#define CSS_CMD_1 (1<<1)
|
#define CSS_CMD_1 (1<<1)
|
||||||
|
|
||||||
// Shared Memory von ARM und DSP definieren
|
// Shared Memory von ARM und DSP definieren
|
||||||
#define INPUT_PORT0_ADD 0x800000 // Feste Adressen für Eingangsdaten im Shared Memory
|
#define INPUT_PORT0_ADD 0x800000 // Feste Adressen f<EFBFBD>r Eingangsdaten im Shared Memory
|
||||||
#define OUTPUT_PORT_ADD (INPUT_PORT0_ADD + 16) // Feste Adressen für Ausgangsdatensdaten im Shared Memory, 16 Byte von Eingangsadresse Weg
|
#define OUTPUT_PORT_ADD (INPUT_PORT0_ADD + 16) // Feste Adressen f<EFBFBD>r Ausgangsdatensdaten im Shared Memory, 16 Byte von Eingangsadresse Weg
|
||||||
|
|
||||||
//Chess Compiler spezifisch: Interrupt-Register festlegen um ARM zu kontaktieren nach fertiger Berechnung
|
// Structs anlegen f<>r die Signalpfade - hier werden Konfigurationen abgelegt(signal_path.h)
|
||||||
volatile static unsigned char chess_storage(DMIO:CSS_CMD) css_cmd_flag;
|
|
||||||
|
|
||||||
// Interrupt-Flag, welche von ARM gesetzt wird, wenn eine Berechnung gewünscht ist
|
|
||||||
static volatile int action_required;
|
|
||||||
|
|
||||||
// Structs anlegen für die Signalpfade - hier werden Konfigurationen abgelegt(signal_path.h)
|
|
||||||
static SingleSignalPath corrupted_signal;
|
static SingleSignalPath corrupted_signal;
|
||||||
static SingleSignalPath reference_noise_signal;
|
static SingleSignalPath reference_noise_signal;
|
||||||
|
|
||||||
static volatile int16_t chess_storage(DMB:INPUT_PORT0_ADD) input_port[4]; //Array mit 4x16 Bit Einträgen auf 2x32 Bit Registern - nur die ersten 2 werden genutzt
|
static volatile int16_t chess_storage(DMB:INPUT_PORT0_ADD) input_port[4]; //Array mit 4x16 Bit Eintr<EFBFBD>gen auf 2x32 Bit Registern - nur die ersten 2 werden genutzt
|
||||||
static volatile int16_t chess_storage(DMB:OUTPUT_PORT_ADD) output_port[4]; //Array mit 4x16 Bit Einträgen auf 2x32 Bit Registern - alle werden genutzt
|
static volatile int16_t chess_storage(DMB:OUTPUT_PORT_ADD) output_port[4]; //Array mit 4x16 Bit Eintr<EFBFBD>gen auf 2x32 Bit Registern - alle werden genutzt
|
||||||
static volatile int16_t chess_storage(DMB) *input_pointer_0;
|
static volatile int16_t chess_storage(DMB) *input_pointer_0;
|
||||||
static volatile int16_t chess_storage(DMB) *input_pointer_1;
|
static volatile int16_t chess_storage(DMB) *input_pointer_1;
|
||||||
static volatile int16_t chess_storage(DMB) *output_pointer;
|
static volatile int16_t chess_storage(DMB) *output_pointer;
|
||||||
static volatile int16_t chess_storage(DMB) *sample_pointer;
|
static volatile int16_t chess_storage(DMB) *sample_pointer;
|
||||||
static volatile int16_t chess_storage(DMB) sample; //Speicherplatz für Ergebnis der calc()-Funktion
|
static volatile int16_t chess_storage(DMB) sample; //Speicherplatz f<EFBFBD>r Ergebnis der calc()-Funktion
|
||||||
|
|
||||||
//void isr0() ist eine Interrupt Service Routine Funktion, welche als C Funktion deklariert wird
|
//void isr0() ist eine Interrupt Service Routine Funktion, welche als C Funktion deklariert wird
|
||||||
// property (isr) ist Chess Compiler spezifisch und kennzeichnet eine Funktion als Interrupt Service Routine
|
// property (isr) ist Chess Compiler spezifisch und kennzeichnet eine Funktion als Interrupt Service Routine
|
||||||
@@ -46,13 +35,13 @@ extern "C" void isr0() property (isr) {
|
|||||||
int main(void) {
|
int main(void) {
|
||||||
// Enum, welcher den Ausgabemodus definiert - wird in calc()-Funktion verwendet
|
// Enum, welcher den Ausgabemodus definiert - wird in calc()-Funktion verwendet
|
||||||
static OutputMode mode = OUTPUT_MODE_FIR_LMS;
|
static OutputMode mode = OUTPUT_MODE_FIR_LMS;
|
||||||
// Biquad Filter für C-Sensor und Acc-Sensor anlegen
|
// Biquad Filter f<EFBFBD>r C-Sensor und Acc-Sensor anlegen
|
||||||
// Alle 0 bis auf b[0] -> einfacher Gain auf 0,75
|
// Alle 0 bis auf b[0] -> einfacher Gain auf 0,75
|
||||||
double b0[5]={0.75, 0., 0., 0., 0.};
|
double b0[5]={0.75, 0., 0., 0., 0.};
|
||||||
double b1[5]={0.75, 0., 0., 0., 0.};
|
double b1[5]={0.75, 0., 0., 0., 0.};
|
||||||
int coefficients = MAX_FIR_COEFFS; // 64 Koeffizienten für ANR
|
int coefficients = MAX_FIR_COEFFS; // 64 Koeffizienten f<EFBFBD>r ANR
|
||||||
|
|
||||||
// Signale initialisieren, oben angelegte Structs mit Parametern füllen
|
// Signale initialisieren, oben angelegte Structs mit Parametern f<EFBFBD>llen
|
||||||
init(
|
init(
|
||||||
&corrupted_signal, &reference_noise_signal, //Signal-Structs
|
&corrupted_signal, &reference_noise_signal, //Signal-Structs
|
||||||
b0, // Biqquad Koeffizienten C-Sensor
|
b0, // Biqquad Koeffizienten C-Sensor
|
||||||
@@ -65,8 +54,6 @@ int main(void) {
|
|||||||
coefficients // Anzahl Filterkoeffizienten
|
coefficients // Anzahl Filterkoeffizienten
|
||||||
);
|
);
|
||||||
|
|
||||||
//Simulationsmodus mit File I/O
|
|
||||||
#ifdef SIMULATE
|
|
||||||
FILE *fp1 = fopen("./test/testdata/input/chirp_disturber.txt", "r");
|
FILE *fp1 = fopen("./test/testdata/input/chirp_disturber.txt", "r");
|
||||||
FILE *fp2 = fopen("./test/testdata/input/disturber.txt", "r");
|
FILE *fp2 = fopen("./test/testdata/input/disturber.txt", "r");
|
||||||
FILE *fp3 = fopen("./test/testdata/output/out_simulated.txt", "w");
|
FILE *fp3 = fopen("./test/testdata/output/out_simulated.txt", "w");
|
||||||
@@ -89,25 +76,4 @@ int main(void) {
|
|||||||
fclose(fp1);
|
fclose(fp1);
|
||||||
fclose(fp2);
|
fclose(fp2);
|
||||||
fclose(fp3);
|
fclose(fp3);
|
||||||
|
|
||||||
// Hardwaremodus mit Interrupts
|
|
||||||
#else
|
|
||||||
enable_interrupts(); //Interrupts aktivieren
|
|
||||||
output_pointer = &output_port[1]; // Zweite Hälfte des Ausgangspuffers zuerst füllen - warum 1 statt 2? Warum generell nicht 0?
|
|
||||||
sample_pointer = &sample; //Sample-Pointer wird auf Adresse des Sample-Speicherplatzes gesetzt
|
|
||||||
|
|
||||||
//Endlosschleife für Interrupt-gesteuerte Verarbeitung
|
|
||||||
action_required = 0;
|
|
||||||
while (1){
|
|
||||||
css_cmd_flag = CSS_CMD_1; // Interrupt Bit setzen um ARM zu signalisieren, dass der DSP schläft
|
|
||||||
core_halt();
|
|
||||||
if (action_required == 1) {
|
|
||||||
css_cmd_flag = CSS_CMD_0; // Interrupt Bit setzen um ARM zu signalisieren, dass der DSP arbeitet
|
|
||||||
action_required = 0; // Action-Flag setzen, damit Loop nicht automatisch startet
|
|
||||||
output_pointer = cyclic_add(output_pointer, 2, output_port, 4); //Output Buffer um 2 Byte inkrementieren, hat insgesamt 4 Byte - Reset wenn Ende erreicht
|
|
||||||
*output_pointer = *sample_pointer; //Inhalt des Sample-Pointer Ziels (Ergenis der vorherigen Berechnung) in Output-Pointer schreiben
|
|
||||||
calc(&corrupted_signal, &reference_noise_signal, mode, &input_port[1], &input_port[0], sample_pointer); //16 Bit Output Sample aus 2 16 Bit Input Samples berechnen
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|||||||
7
simulation/simulation.prx
Normal file
7
simulation/simulation.prx
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<project name="Project" processor="lpdsp32">
|
||||||
|
<file type="c" name="main.c" path=""/>
|
||||||
|
<file type="c" name="signal_path.c" path="signal_processing"/>
|
||||||
|
<option id="cpp.define" value="BLOCK_LEN=1 MAX_FIR_COEFFS=64" inherit="1" cfg="Release"/>
|
||||||
|
<option id="project.name" value="simulation"/>
|
||||||
|
<option id="project.type" value="exe"/>
|
||||||
|
</project>
|
||||||
34
simulation/simulation.prxui
Normal file
34
simulation/simulation.prxui
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<prxusersettings>
|
||||||
|
<zlayout>
|
||||||
|
<perspective type="dev">
|
||||||
|
<HorPaneNode>
|
||||||
|
<VerPaneNode size="1">
|
||||||
|
<ViewBookNode size="3">
|
||||||
|
<window name="ProjectView" visible="1" select="1"/>
|
||||||
|
<window name="SrcRefView" visible="0" select="0"/>
|
||||||
|
</ViewBookNode>
|
||||||
|
<ViewBookNode size="2">
|
||||||
|
<window name="OutlineView" visible="0" select="0"/>
|
||||||
|
<window name="HierarchyView" visible="0" select="0"/>
|
||||||
|
</ViewBookNode>
|
||||||
|
</VerPaneNode>
|
||||||
|
<VerPaneNode size="2">
|
||||||
|
<EditorBookNode size="2">
|
||||||
|
<window name="editor0" visible="1" select="0"/>
|
||||||
|
<window name="editor1" visible="1" select="0"/>
|
||||||
|
<window name="editor2" visible="1" select="1"/>
|
||||||
|
</EditorBookNode>
|
||||||
|
<ViewBookNode size="1">
|
||||||
|
<window name="ConsoleView" visible="1" select="1"/>
|
||||||
|
<window name="DiagnosticsView" visible="0" select="0"/>
|
||||||
|
</ViewBookNode>
|
||||||
|
</VerPaneNode>
|
||||||
|
</HorPaneNode>
|
||||||
|
</perspective>
|
||||||
|
<editor id="editor0" file="main.c" top="23.0" cursor="36.54" foldmap="1" linemap="0"/>
|
||||||
|
<editor id="editor1" file="signal_processing/signal_path.c" top="1.0" cursor="13.29" foldmap="1" linemap="0"/>
|
||||||
|
<editor id="editor2" file="signal_processing/include/signal_path.h" top="1.0" cursor="10.28" foldmap="1" linemap="0"/>
|
||||||
|
</zlayout>
|
||||||
|
<active cfg="Release" dbg="<None>"/>
|
||||||
|
<selectsim type="ISSCA" exe="<PROCDIR>/../iss/lpdsp32"/>
|
||||||
|
</prxusersettings>
|
||||||
Reference in New Issue
Block a user