diff options
author | unknown <dm2515@eews303a-028.ic.ac.uk> | 2018-01-25 15:42:21 +0000 |
---|---|---|
committer | unknown <dm2515@eews303a-028.ic.ac.uk> | 2018-01-25 15:42:21 +0000 |
commit | ef69ae72e9163f0e4caedbf682f84510be8771f1 (patch) | |
tree | 36b532de84b6ea4ea1eecd4a5678e54e69373f56 /lab4/.metadata/.plugins/org.eclipse.core.resources/.history/a0 | |
parent | 2a53d71a6c65f1ac5ae185ab09f4c9c118836dc8 (diff) | |
download | NoiseSilencer-ef69ae72e9163f0e4caedbf682f84510be8771f1.tar.gz NoiseSilencer-ef69ae72e9163f0e4caedbf682f84510be8771f1.zip |
Lab 4 part 1
Diffstat (limited to 'lab4/.metadata/.plugins/org.eclipse.core.resources/.history/a0')
2 files changed, 221 insertions, 0 deletions
diff --git a/lab4/.metadata/.plugins/org.eclipse.core.resources/.history/a0/c036a62ce10100181ce89bcacea45786 b/lab4/.metadata/.plugins/org.eclipse.core.resources/.history/a0/c036a62ce10100181ce89bcacea45786 new file mode 100644 index 0000000..eb91014 --- /dev/null +++ b/lab4/.metadata/.plugins/org.eclipse.core.resources/.history/a0/c036a62ce10100181ce89bcacea45786 @@ -0,0 +1,130 @@ +/************************************************************************************* + 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 + ************************************************************************************/ +/* + * You should modify the code so that interrupts are used to service the ++ + /* REGISTER FUNCTION SETTINGS */ + /**********************************************************************/\ + 0x0017, /* 0 LEFTINVOL Left line input channel volume 0dB */\ + 0x0017, /* 1 RIGHTINVOL Right line input channel volume 0dB */\ + 0x01f9, /* 2 LEFTHPVOL Left channel headphone volume 0dB */\ + 0x01f9, /* 3 RIGHTHPVOL Right channel headphone volume 0dB */\ + 0x0011, /* 4 ANAPATH Analog audio path control DAC on, Mic boost 20dB*/\ + 0x0000, /* 5 DIGPATH Digital audio path control All Filters off */\ + 0x0000, /* 6 DPOWERDOWN Power down control All Hardware on */\ + 0x0043, /* 7 DIGIF Digital audio interface format 16 bit */\ + 0x008d, /* 8 SAMPLERATE Sample rate control 8 KHZ */\ + 0x0001 /* 9 DIGACT Digital interface activation On */\ + /**********************************************************************/ +}; + + +// Codec handle:- a variable used to identify audio interface +DSK6713_AIC23_CodecHandle H_Codec; + + /******************************* Function prototypes ********************************/ +void init_hardware(void); +void init_HWI(void); +void ISR_AIC(void); +short non_circ_fir(void); +/********************************** Main routine ************************************/ +void main(){ + // initialize board and the audio port + init_hardware(); + + /* initialize hardware interrupts */ + init_HWI(); + + /* loop indefinitely, waiting for interrupts */ + while(1) {}; +} + +/********************************** init_hardware() **********************************/ +void init_hardware() +{ + // Initialize the board support library, must be called first + DSK6713_init(); + + // Start the AIC23 codec using the settings defined above in config + H_Codec = DSK6713_AIC23_openCodec(0, &Config); + + /* Function below sets the number of bits in word used by MSBSP (serial port) for + receives from AIC23 (audio port). We are using a 32 bit packet containing two + 16 bit numbers hence 32BIT is set for receive */ + MCBSP_FSETS(RCR1, RWDLEN1, 32BIT); + + /* Configures interrupt to activate on each consecutive available 32 bits + from Audio port hence an interrupt is generated for each L & R sample pair */ + MCBSP_FSETS(SPCR1, RINTM, FRM); + + /* These commands do the same thing as above but applied to data transfers to + the audio port */ + MCBSP_FSETS(XCR1, XWDLEN1, 32BIT); + MCBSP_FSETS(SPCR1, XINTM, FRM); +} + +/********************************** init_HWI() **************************************/ +void init_HWI() +{ + IRQ_globalDisable(); // Globally disables interrupts + IRQ_nmiEnable(); // Enables the NMI interrupt (used by the debugger) + IRQ_map(IRQ_EVT_RINT1,4); // Maps an event to a physical interrupt + IRQ_enable(IRQ_EVT_RINT1); // Enables the event + IRQ_globalEnable(); // Globally enables interrupts +} + +/******************** INTERRUPT SERVICE ROUTINE ***********************/ +void ISR_AIC() +{ + unsigned int i; + short sample_in, sample_out; + + sample_in = mono_read_16Bit(); +// +// for (i = N-1; i > 0; i--) { +// x[i] = x[i-1]; +// } +// x[0] = (float) sample_in / 32767.f; +// +// sample_out = non_circ_fir(); + +// mono_write_16Bit(sample_out); + mono_write_16Bit(sample_in); +} + +//Convolve the +short non_circ_fir() +{ +/* double y[N + M - 1]; + int i, M, j; + M = sizeof(b)/sizeof(b[0]); + + for (i = 0; i < N + M - 1; i++) { + for (j = 0; j < i -1; j++) { + y[i] = y[i] + b[j]*h[i-j-1]; + } + + }*/ + double y = 0; + int M, i; + M = sizeof(b) / sizeof(b[0]); + for(i = 0; i < N; i++) { + y += x[i] * b[M-i-1]; + } + return y*32767; +} diff --git a/lab4/.metadata/.plugins/org.eclipse.core.resources/.history/a0/f0464a11e10100181ce89bcacea45786 b/lab4/.metadata/.plugins/org.eclipse.core.resources/.history/a0/f0464a11e10100181ce89bcacea45786 new file mode 100644 index 0000000..5c1d8c8 --- /dev/null +++ b/lab4/.metadata/.plugins/org.eclipse.core.resources/.history/a0/f0464a11e10100181ce89bcacea45786 @@ -0,0 +1,91 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +C_SRCS += \ +../intio.c + +TCF_SRCS += \ +../dsp_bios_.tcf + +GEN_SRCS += \ +./dsp_bios_cfg.cmd \ +./dsp_bios_cfg.s?? \ +./dsp_bios_cfg_c.c + +GEN_CMDS += \ +./dsp_bios_cfg.cmd + +OBJS += \ +./dsp_bios_cfg.obj \ +./dsp_bios_cfg_c.obj \ +./intio.obj + +S??_DEPS += \ +./dsp_bios_cfg.pp + +C_DEPS += \ +./dsp_bios_cfg_c.pp \ +./intio.pp + +OBJS__QTD += \ +".\dsp_bios_cfg.obj" \ +".\dsp_bios_cfg_c.obj" \ +".\intio.obj" + +S??_DEPS__QTD += \ +".\dsp_bios_cfg.pp" + +GEN_SRCS__QTD += \ +".\dsp_bios_cfg.cmd" \ +".\dsp_bios_cfg.s??" \ +".\dsp_bios_cfg_c.c" + +C_DEPS__QTD += \ +".\dsp_bios_cfg_c.pp" \ +".\intio.pp" + +TCF_SRCS_QUOTED += \ +"../dsp_bios_.tcf" + +GEN_CMDS_QUOTED += \ +-l"./dsp_bios_cfg.cmd" + +C_SRCS_QUOTED += \ +"../intio.c" + + +# Each subdirectory must supply rules for building sources it contributes +dsp_bios_cfg.cmd: ../dsp_bios_.tcf + @echo 'Building file: $<' + @echo 'Invoking: TConf Script Compiler' + "C:/EEE/CCStudio4.1/xdctools_3_16_02_32/tconf" -b -Dconfig.importPath="C:/EEE/CCStudio4.1/bios_5_41_02_14/packages;" "$<" + @echo 'Finished building: $<' + @echo ' ' + +dsp_bios_cfg.s??: dsp_bios_cfg.cmd +dsp_bios_cfg_c.c: dsp_bios_cfg.cmd + +dsp_bios_cfg.obj: ./dsp_bios_cfg.s?? $(GEN_OPTS) + @echo 'Building file: $<' + @echo 'Invoking: Compiler' + "C:/EEE/CCStudio4.1/ccsv4/tools/compiler/c6000/bin/cl6x" -mv6700 -g --define=_DEBUG --define=CHIP_6713 --include_path="C:/EEE/CCStudio4.1/ccsv4/tools/compiler/c6000/include" --include_path="C:/EEE/CCStudio4.1/ccsv4/C6000/dsk6713/include" --include_path="C:/EEE/CCStudio4.1/ccsv4/C6000/csl/include" --include_path="C:/GIT/RTDSP/lab4/RTDSP/Debug" --include_path="C:/EEE/CCStudio4.1/bios_5_41_02_14/packages/ti/bios/include" --include_path="C:/EEE/CCStudio4.1/bios_5_41_02_14/packages/ti/rtdx/include/c6000" --diag_warning=225 --preproc_with_compile --preproc_dependency="dsp_bios_cfg.pp" $(GEN_OPTS_QUOTED) $(subst #,$(wildcard $(subst $(SPACE),\$(SPACE),$<)),"#") + @echo 'Finished building: $<' + @echo ' ' + +dsp_bios_cfg_c.obj: ./dsp_bios_cfg_c.c $(GEN_OPTS) + @echo 'Building file: $<' + @echo 'Invoking: Compiler' + "C:/EEE/CCStudio4.1/ccsv4/tools/compiler/c6000/bin/cl6x" -mv6700 -g --define=_DEBUG --define=CHIP_6713 --include_path="C:/EEE/CCStudio4.1/ccsv4/tools/compiler/c6000/include" --include_path="C:/EEE/CCStudio4.1/ccsv4/C6000/dsk6713/include" --include_path="C:/EEE/CCStudio4.1/ccsv4/C6000/csl/include" --include_path="C:/GIT/RTDSP/lab4/RTDSP/Debug" --include_path="C:/EEE/CCStudio4.1/bios_5_41_02_14/packages/ti/bios/include" --include_path="C:/EEE/CCStudio4.1/bios_5_41_02_14/packages/ti/rtdx/include/c6000" --diag_warning=225 --preproc_with_compile --preproc_dependency="dsp_bios_cfg_c.pp" $(GEN_OPTS_QUOTED) $(subst #,$(wildcard $(subst $(SPACE),\$(SPACE),$<)),"#") + @echo 'Finished building: $<' + @echo ' ' + +intio.obj: ../intio.c $(GEN_OPTS) + @echo 'Building file: $<' + @echo 'Invoking: Compiler' + "C:/EEE/CCStudio4.1/ccsv4/tools/compiler/c6000/bin/cl6x" -mv6700 -g --define=_DEBUG --define=CHIP_6713 --include_path="C:/EEE/CCStudio4.1/ccsv4/tools/compiler/c6000/include" --include_path="C:/EEE/CCStudio4.1/ccsv4/C6000/dsk6713/include" --include_path="C:/EEE/CCStudio4.1/ccsv4/C6000/csl/include" --include_path="C:/GIT/RTDSP/lab4/RTDSP/Debug" --include_path="C:/EEE/CCStudio4.1/bios_5_41_02_14/packages/ti/bios/include" --include_path="C:/EEE/CCStudio4.1/bios_5_41_02_14/packages/ti/rtdx/include/c6000" --diag_warning=225 --preproc_with_compile --preproc_dependency="intio.pp" $(GEN_OPTS_QUOTED) $(subst #,$(wildcard $(subst $(SPACE),\$(SPACE),$<)),"#") + @echo 'Finished building: $<' + @echo ' ' + + |