aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorymherklotz <ymherklotz@gmail.com>2018-02-27 13:51:19 +0000
committerymherklotz <ymherklotz@gmail.com>2018-02-27 13:51:19 +0000
commitce44d5e9c3d9ecaae05adbcf71b2c8ccd6fc2fc2 (patch)
tree1eeb1a90dc55241c1828aee3984f034a90989ef0
parent8c4c776fedeb003055d3badde73ae014c1d51a8d (diff)
downloadNoiseSilencer-ce44d5e9c3d9ecaae05adbcf71b2c8ccd6fc2fc2.tar.gz
NoiseSilencer-ce44d5e9c3d9ecaae05adbcf71b2c8ccd6fc2fc2.zip
Nearly finished last code
-rw-r--r--lab5/RTDSP/.launches/RTDSP.launch2
-rw-r--r--lab5/RTDSP/Matlab/coeff.txt2
-rw-r--r--lab5/RTDSP/intio.c28
3 files changed, 12 insertions, 20 deletions
diff --git a/lab5/RTDSP/.launches/RTDSP.launch b/lab5/RTDSP/.launches/RTDSP.launch
index 4330703..5ff2289 100644
--- a/lab5/RTDSP/.launches/RTDSP.launch
+++ b/lab5/RTDSP/.launches/RTDSP.launch
@@ -13,7 +13,7 @@
<stringAttribute key="CCEDebugOptions.TARGET_CONFIGURATION_OPTION" value="full"/>
<stringAttribute key="org.eclipse.cdt.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;memoryBlockExpressionList/&gt;&#13;&#10;"/>
<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="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;modules&gt;&#13;&#10;&lt;module name=&quot;C:\GIT\RTDSP\lab3\RTDSP\Debug\RTDSP.out&quot; time=&quot;Fri Jan 19 14:07:28 GMT 2018&quot; time_long=&quot;1516370848357&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\Github\RTDSP\lab3\RTDSP\Debug\RTDSP.out&quot; time=&quot;Tue Jan 23 11:15:11 GMT 2018&quot; time_long=&quot;1516706111426&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\GIT\RTDSP\lab4\RTDSP\Debug\RTDSP.out&quot; time=&quot;Thu Feb 01 11:44:21 GMT 2018&quot; time_long=&quot;1517485461898&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\github\RTDSP\lab4\RTDSP\Debug\RTDSP.out&quot; time=&quot;Thu Feb 15 13:55:55 GMT 2018&quot; time_long=&quot;1518702955359&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\Github\RTDSP\lab5\RTDSP\Debug\RTDSP.out&quot; time=&quot;Tue Feb 27 12:18:55 GMT 2018&quot; time_long=&quot;1519733935329&quot;/&gt;&#13;&#10;&lt;/modules&gt;&#13;&#10;"/>
+<stringAttribute key="com.ti.ccstudio.debug.core.MRU_MODULES" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;modules&gt;&#13;&#10;&lt;module name=&quot;C:\GIT\RTDSP\lab3\RTDSP\Debug\RTDSP.out&quot; time=&quot;Fri Jan 19 14:07:28 GMT 2018&quot; time_long=&quot;1516370848357&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\Github\RTDSP\lab3\RTDSP\Debug\RTDSP.out&quot; time=&quot;Tue Jan 23 11:15:11 GMT 2018&quot; time_long=&quot;1516706111426&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\GIT\RTDSP\lab4\RTDSP\Debug\RTDSP.out&quot; time=&quot;Thu Feb 01 11:44:21 GMT 2018&quot; time_long=&quot;1517485461898&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\github\RTDSP\lab4\RTDSP\Debug\RTDSP.out&quot; time=&quot;Thu Feb 15 13:55:55 GMT 2018&quot; time_long=&quot;1518702955359&quot;/&gt;&#13;&#10;&lt;module name=&quot;C:\Github\RTDSP\lab5\RTDSP\Debug\RTDSP.out&quot; time=&quot;Tue Feb 27 13:50:01 GMT 2018&quot; time_long=&quot;1519739401975&quot;/&gt;&#13;&#10;&lt;/modules&gt;&#13;&#10;"/>
<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="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;globalVariableList/&gt;&#13;&#10;"/>
diff --git a/lab5/RTDSP/Matlab/coeff.txt b/lab5/RTDSP/Matlab/coeff.txt
index 6c1b0ff..1b9f5ae 100644
--- a/lab5/RTDSP/Matlab/coeff.txt
+++ b/lab5/RTDSP/Matlab/coeff.txt
@@ -1,2 +1,2 @@
-double a[] = {1.000000000000000e+00, -3.622738280081862e+00, 5.063887790131743e+00, -3.234610259864946e+00, 7.984164681552797e-01, };
+double a[] = {0.0, -3.622738280081862e+00, 5.063887790131743e+00, -3.234610259864946e+00, 7.984164681552797e-01, };
double b[] = {9.756494393306392e-02, -3.428674269973439e-01, 4.911005379625814e-01, -3.428674269973437e-01, 9.756494393306386e-02, };
diff --git a/lab5/RTDSP/intio.c b/lab5/RTDSP/intio.c
index e7ae084..a083765 100644
--- a/lab5/RTDSP/intio.c
+++ b/lab5/RTDSP/intio.c
@@ -46,8 +46,7 @@
#include "Matlab/coeff.txt"
int N = sizeof(a)/sizeof(a[0]);
-short* x;
-double* y;
+double* d;
/******************************* Global declarations ********************************/
@@ -81,9 +80,8 @@ void init_HWI(void);
void ISR_AIC(void);
/********************************** Main routine ************************************/
void main(){
- x = (short*)calloc(N, sizeof(short));
- y = (double*)malloc(N * sizeof(double));
- memset(y, 0.0, N * sizeof(double));
+ d = (double*)malloc(N * sizeof(double));
+ memset(d, 0.0, N * sizeof(double));
// initialize board and the audio port
init_hardware();
@@ -132,22 +130,16 @@ void init_HWI()
/******************** INTERRUPT SERVICE ROUTINE ***********************/
void ISR_AIC()
{
- int i = N-1;
- double Y = 0.0;
+ int i = 0;
+ short x_in = mono_read_16Bit();
+ double y_out = d[0];
//Shift the values
- for (; i > 0; --i) {
- x[i] = x[i-1];
- y[i] = y[i-1];
-
- Y += x[i] * b[i] - y[i] * a[i];
+ for (; i < N-2; ++i) {
+ d[i] = d[i+1] + b[i] * x_in - a[i] * y_out;
}
-
- x[0] = mono_read_16Bit();
-
- Y += x[0] * b[0];
- y[0] = Y;
+ d[N-1] = b[N-1] * x_in - a[N-1] * y_out;
- mono_write_16Bit((short)Y);
+ mono_write_16Bit((short)d[0]);
}