diff options
author | ymherklotz <ymherklotz@gmail.com> | 2018-02-27 18:25:11 +0000 |
---|---|---|
committer | ymherklotz <ymherklotz@gmail.com> | 2018-02-27 18:25:11 +0000 |
commit | fe922f612d886339faf7d5360990966e3f45ae2d (patch) | |
tree | fac6a4f4a9e34843d01577edbc020923b4bcd922 | |
parent | ce44d5e9c3d9ecaae05adbcf71b2c8ccd6fc2fc2 (diff) | |
download | NoiseSilencer-fe922f612d886339faf7d5360990966e3f45ae2d.tar.gz NoiseSilencer-fe922f612d886339faf7d5360990966e3f45ae2d.zip |
Finished direct form II
-rw-r--r-- | lab5/RTDSP/.launches/RTDSP.launch | 6 | ||||
-rw-r--r-- | lab5/RTDSP/intio.c | 27 |
2 files changed, 19 insertions, 14 deletions
diff --git a/lab5/RTDSP/.launches/RTDSP.launch b/lab5/RTDSP/.launches/RTDSP.launch index 5ff2289..f76cfaa 100644 --- a/lab5/RTDSP/.launches/RTDSP.launch +++ b/lab5/RTDSP/.launches/RTDSP.launch @@ -12,8 +12,8 @@ <stringAttribute key="com.ti.ccstudio.debug.core.DISPLAY_NAME_FORMAT" value="RTDSP [Debug] - {0}"/> <stringAttribute key="CCEDebugOptions.TARGET_CONFIGURATION_OPTION" value="full"/> <stringAttribute key="org.eclipse.cdt.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8"?> <memoryBlockExpressionList/> "/> -<stringAttribute key="com.ti.ccstudio.debug.core.MRU_PROGRAM_NAME" value="C:\Github\RTDSP\lab5\RTDSP\Debug\RTDSP.out"/> -<stringAttribute key="com.ti.ccstudio.debug.core.MRU_MODULES" value="<?xml version="1.0" encoding="UTF-8"?> <modules> <module name="C:\GIT\RTDSP\lab3\RTDSP\Debug\RTDSP.out" time="Fri Jan 19 14:07:28 GMT 2018" time_long="1516370848357"/> <module name="C:\Github\RTDSP\lab3\RTDSP\Debug\RTDSP.out" time="Tue Jan 23 11:15:11 GMT 2018" time_long="1516706111426"/> <module name="C:\GIT\RTDSP\lab4\RTDSP\Debug\RTDSP.out" time="Thu Feb 01 11:44:21 GMT 2018" time_long="1517485461898"/> <module name="C:\github\RTDSP\lab4\RTDSP\Debug\RTDSP.out" time="Thu Feb 15 13:55:55 GMT 2018" time_long="1518702955359"/> <module name="C:\Github\RTDSP\lab5\RTDSP\Debug\RTDSP.out" time="Tue Feb 27 13:50:01 GMT 2018" time_long="1519739401975"/> </modules> "/> +<stringAttribute key="com.ti.ccstudio.debug.core.MRU_PROGRAM_NAME" value="C:\github\RTDSP\lab5\RTDSP\Debug\RTDSP.out"/> +<stringAttribute key="com.ti.ccstudio.debug.core.MRU_MODULES" value="<?xml version="1.0" encoding="UTF-8"?> <modules> <module name="C:\GIT\RTDSP\lab3\RTDSP\Debug\RTDSP.out" time="Fri Jan 19 14:07:28 GMT 2018" time_long="1516370848357"/> <module name="C:\Github\RTDSP\lab3\RTDSP\Debug\RTDSP.out" time="Tue Jan 23 11:15:11 GMT 2018" time_long="1516706111426"/> <module name="C:\GIT\RTDSP\lab4\RTDSP\Debug\RTDSP.out" time="Thu Feb 01 11:44:21 GMT 2018" time_long="1517485461898"/> <module name="C:\github\RTDSP\lab4\RTDSP\Debug\RTDSP.out" time="Thu Feb 15 13:55:55 GMT 2018" time_long="1518702955359"/> <module name="C:\Github\RTDSP\lab5\RTDSP\Debug\RTDSP.out" time="Tue Feb 27 13:50:01 GMT 2018" time_long="1519739401975"/> <module name="C:\github\RTDSP\lab5\RTDSP\Debug\RTDSP.out" time="Tue Feb 27 18:23:54 GMT 2018" time_long="1519755834585"/> </modules> "/> <stringAttribute key="CCEDebugOptions.CPU_NAME" value="Spectrum Digital DSK-EVM-eZdsp onboard USB Emulator_0/TMS320C671X"/> <stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="RTDSP"/> <stringAttribute key="org.eclipse.cdt.launch.GLOBAL_VARIABLES" value="<?xml version="1.0" encoding="UTF-8"?> <globalVariableList/> "/> @@ -21,6 +21,6 @@ <stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Debug/RTDSP.out"/> <stringAttribute key="CCEDebugOptions.CPU_ISA" value="TMS320C671X"/> <stringAttribute key="com.ti.ccstudio.debug.core.BUILD_CONFIGURATION" value="Debug"/> -<stringAttribute key="CCEDebugOptions.TARGET_CONFIGURATION_FILE" value="C:\Github\RTDSP\lab5\RTDSP\NewTargetConfiguration.ccxml"/> +<stringAttribute key="CCEDebugOptions.TARGET_CONFIGURATION_FILE" value="C:\github\RTDSP\lab5\RTDSP\NewTargetConfiguration.ccxml"/> <stringAttribute key="org.eclipse.debug.core.source_locator_id" value="com.ti.ccstudio.debug.core.sourceLocator"/> </launchConfiguration> diff --git a/lab5/RTDSP/intio.c b/lab5/RTDSP/intio.c index a083765..ec0d08d 100644 --- a/lab5/RTDSP/intio.c +++ b/lab5/RTDSP/intio.c @@ -46,7 +46,7 @@ #include "Matlab/coeff.txt" int N = sizeof(a)/sizeof(a[0]); -double* d; +double* v; /******************************* Global declarations ********************************/ @@ -80,8 +80,8 @@ void init_HWI(void); void ISR_AIC(void); /********************************** Main routine ************************************/ void main(){ - d = (double*)malloc(N * sizeof(double)); - memset(d, 0.0, N * sizeof(double)); + v = (double*)malloc(N * sizeof(double)); + memset(v, 0.0, N * sizeof(double)); // initialize board and the audio port init_hardware(); @@ -130,16 +130,21 @@ void init_HWI() /******************** INTERRUPT SERVICE ROUTINE ***********************/ void ISR_AIC() { - int i = 0; - short x_in = mono_read_16Bit(); - double y_out = d[0]; + int i; + double Y = 0.0; - //Shift the values - for (; i < N-2; ++i) { - d[i] = d[i+1] + b[i] * x_in - a[i] * y_out; + v[0] = mono_read_16Bit(); + + for (i = 1; i < N; ++i) { + v[0] -= a[i] * v[i]; + } + + for (i = N-1; i > 0; --i) { + Y += b[i] * v[i]; + v[i] = v[i-1]; } - d[N-1] = b[N-1] * x_in - a[N-1] * y_out; + Y += v[0] * b[0]; - mono_write_16Bit((short)d[0]); + mono_write_16Bit((short)Y); } |