aboutsummaryrefslogtreecommitdiffstats
path: root/lab5/RTDSP
diff options
context:
space:
mode:
authorymherklotz <ymherklotz@gmail.com>2018-02-27 10:27:11 +0000
committerymherklotz <ymherklotz@gmail.com>2018-02-27 10:27:11 +0000
commit15f14bfcf580dcf123178e254246e7993d077e63 (patch)
treeae0e027aae260e176e602788077e83be1b175b5f /lab5/RTDSP
parent16fd81be34fef52a4805b715b10218747c497420 (diff)
downloadNoiseSilencer-15f14bfcf580dcf123178e254246e7993d077e63.tar.gz
NoiseSilencer-15f14bfcf580dcf123178e254246e7993d077e63.zip
Fixed proj lab5ex1
Diffstat (limited to 'lab5/RTDSP')
-rw-r--r--lab5/RTDSP/.launches/RTDSP.launch6
-rw-r--r--lab5/RTDSP/intio.c38
2 files changed, 13 insertions, 31 deletions
diff --git a/lab5/RTDSP/.launches/RTDSP.launch b/lab5/RTDSP/.launches/RTDSP.launch
index 1e2e15a..169264f 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="&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\lab4\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;/modules&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 10:22:44 GMT 2018&quot; time_long=&quot;1519726964340&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;"/>
@@ -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\lab4\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 124fc03..219ca56 100644
--- a/lab5/RTDSP/intio.c
+++ b/lab5/RTDSP/intio.c
@@ -1,16 +1,11 @@
/*************************************************************************************
DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING
IMPERIAL COLLEGE LONDON
-
EE 3.19: Real Time Digital Signal Processing
Dr Paul Mitcheson and Daniel Harvey
-
LAB 3: Interrupt I/O
-
********* I N T I O. C **********
-
Demonstrates inputing and outputing data from the DSK's audio port using interrupts.
-
*************************************************************************************
Updated for use on 6713 DSK by Danny Harvey: May-Aug 2006
Updated for CCS V4 Sept 10
@@ -36,16 +31,16 @@
// Some functions to help with writing/reading the audio ports when using interrupts.
#include <helper_functions_ISR.h>
-#include "Matlab/filter_coeff.txt"
// Some functions to help with configuring hardware
#include "helper_functions_polling.h"
// PI defined here for use in your code
#define PI 3.141592653589793
-#define N 249
-double buffer[N]= {0};
-unsigned ptr = N-1;
+short x[] = {0, 0};
+double y[] = {0.0, 0.0};
+double a[] = {1, -1.875/2.125};
+double b[] = {0.125/2.125, 0.125/2.125};
/******************************* Global declarations ********************************/
@@ -126,23 +121,10 @@ void init_HWI()
/******************** INTERRUPT SERVICE ROUTINE ***********************/
void ISR_AIC()
{
- buffer[ptr] = (double) mono_read_16Bit();
- mono_write_16Bit((short)circ_fir());
- if (ptr == 0)
- ptr = N;
- ptr--;
-}
-
-// Perform linear convolution
-short circ_fir()
-{
- double y = 0;
- int i = 0;
- for(; i+ptr < N; i++) {
- y += buffer[i+ptr] * b[N-i-1];
- }
- for(; i < N; i++) {
- y += buffer[i+ptr-N] * b[N-i-1];
- }
- return y;
+ x[1] = x[0];
+ x[0] = mono_read_16Bit();
+ y[1] = y[0];
+ y[0] = b[0] * x[0] + b[1] * x[1] - a[1] * y[1];
+
+ mono_write_16Bit((short)y[0]);
}