<< Chapter < Page Chapter >> Page >
// lab4b.c // Uses PN generation, IIR filtering, and autocorrelation // code by Matt Kleffner -9/2004 // Based on swi_process.c by Educational DSP #include "dsk5510_dual3006cfg.h" #include "dsk5510.h" #include "swi_process.h" #include "dsplib.h" #include "lab4b.h" /* Define N here in header file */ /* function defined in pn.c */ void rand_fillbuffer(void); /* IIR values and buffers (declared in c_fft_given_iirc.asm) */ #define IIR_order 4 extern int scale; extern int coef[IIR_order]; extern int state[IIR_order]; /* Pointer to state buffer location */ int iirptr; extern unsigned int *iseed; /* seed for rand_fillbuffer() and randbit() */ /* function defined in iirfilt.c */ void iirfilt(void); /* function defined in autocorr.c */ void autocorr(void); /* Function defined by c_fft_given_iirc.asm */ //void bit_rev_fft(void); /* FFT data buffers (declared in c_fft_given_iirc.asm) */ extern int bit_rev_data[N*2]; /* Data output for bit-reverse function */ extern int fft_data[N*2]; /* In-place FFT input & Output array */ /* Our input/output buffers */ int autocorr_in[N]; int autocorr_out[N]; // all data processing should be done in SWI_ProcessBuffer void SWI_ProcessBuffer() { static unsigned int mbox_value = 0; short *psrc, *pdest; unsigned int i; mbox_value |= SWI_getmbox(); // buffers are only processed when both transmit and receive are ready if((mbox_value & DMA_RECEIVE_DONE) && (mbox_value & DMA_TRANSMIT_DONE)) { mbox_value = 0; // get buffer pointers psrc = receive_buffer[receive_buffer_to_process_index]; pdest = transmit_buffer[transmit_buffer_to_fill_index]; /* First, transfer inputs and outputs */ for (i = 0; i < N; i++) { pdest[4*i] = autocorr_in[i]; pdest[4*i+1] = bit_rev_data[i*2] << 8; /* Some statements useful in debugging */ /* pdest[4*i] = psrc[4*i+2]; */ /* Be sure to comment out PN-sequence generation */ /* when using the next two lines */ //autocorr_in[i] = psrc[4i+2]; } /* Last, set the DC coefficient to -1 for a trigger pulse */ pdest[0] = -32768; /* Generate PN input */ rand_fillbuffer(); /* Filter input */ iirfilt(); /* Calculate autocorrelation */ autocorr(); /* Transfer autocorr output to FFT input buffer */ for (i = 0; i < N; i++) { fft_data[i*2] = autocorr_out[i]; fft_data[i*2+1] = 0; } // Bit-reverse and compute FFT cfft((DATA *)fft_data,N, SCALE); cbrev((DATA *)fft_data,(DATA *)bit_rev_data,N); /* Done, wait for next time around! */ receive_buffer_processed = 1; // flag receive buffer as processed transmit_buffer_filled = 1; // flag output buffer as full } } // lab4bmain.c // based on main.c by Educational DSP // Initializes autocorr_out, state, and iseed. // Can be modified for optimization. #include "dsk5510_dual3006cfg.h" #include "dsk5510.h" #include <csl.h> #include "lab4b.h" #define IIR_order 4 extern int iirptr; unsigned int *iseed; extern int autocorr_out[N]; extern int state[IIR_order]; void init_DMA(); void main() { int i; DSK5510_init(); // init BSL DSK5510_rset(DSK5510_MISC, 0x03); // route McBSP0/1 to J3 // Initialize autocorr_out to zero since some values will remain zero for (i = 0; i < N; ++i) { autocorr_out[i] = 0; } for ( i = 0; i < IIR_order; ++i) state[i] = 0; // Start McBSP0 I2S slave MCBSP_start(hMcbsp0, MCBSP_XMIT_START | MCBSP_RCV_START | MCBSP_SRGR_START | MCBSP_SRGR_FRAMESYNC, 220); // Start McBSP1 I2S master MCBSP_start(hMcbsp1, MCBSP_XMIT_START | MCBSP_RCV_START | MCBSP_SRGR_START | MCBSP_SRGR_FRAMESYNC, 220); init_DMA(); // configure DMA and interrupts *iseed = 1; iirptr = 0; return; // let DSP/BIOS scheduler take over }

Questions & Answers

how does Neisseria cause meningitis
Nyibol Reply
what is microbiologist
Muhammad Reply
what is errata
Muhammad
is the branch of biology that deals with the study of microorganisms.
Ntefuni Reply
What is microbiology
Mercy Reply
studies of microbes
Louisiaste
when we takee the specimen which lumbar,spin,
Ziyad Reply
How bacteria create energy to survive?
Muhamad Reply
Bacteria doesn't produce energy they are dependent upon their substrate in case of lack of nutrients they are able to make spores which helps them to sustain in harsh environments
_Adnan
But not all bacteria make spores, l mean Eukaryotic cells have Mitochondria which acts as powerhouse for them, since bacteria don't have it, what is the substitution for it?
Muhamad
they make spores
Louisiaste
what is sporadic nd endemic, epidemic
Aminu Reply
the significance of food webs for disease transmission
Abreham
food webs brings about an infection as an individual depends on number of diseased foods or carriers dully.
Mark
explain assimilatory nitrate reduction
Esinniobiwa Reply
Assimilatory nitrate reduction is a process that occurs in some microorganisms, such as bacteria and archaea, in which nitrate (NO3-) is reduced to nitrite (NO2-), and then further reduced to ammonia (NH3).
Elkana
This process is called assimilatory nitrate reduction because the nitrogen that is produced is incorporated in the cells of microorganisms where it can be used in the synthesis of amino acids and other nitrogen products
Elkana
Examples of thermophilic organisms
Shu Reply
Give Examples of thermophilic organisms
Shu
advantages of normal Flora to the host
Micheal Reply
Prevent foreign microbes to the host
Abubakar
they provide healthier benefits to their hosts
ayesha
They are friends to host only when Host immune system is strong and become enemies when the host immune system is weakened . very bad relationship!
Mark
what is cell
faisal Reply
cell is the smallest unit of life
Fauziya
cell is the smallest unit of life
Akanni
ok
Innocent
cell is the structural and functional unit of life
Hasan
is the fundamental units of Life
Musa
what are emergency diseases
Micheal Reply
There are nothing like emergency disease but there are some common medical emergency which can occur simultaneously like Bleeding,heart attack,Breathing difficulties,severe pain heart stock.Hope you will get my point .Have a nice day ❣️
_Adnan
define infection ,prevention and control
Innocent
I think infection prevention and control is the avoidance of all things we do that gives out break of infections and promotion of health practices that promote life
Lubega
Heyy Lubega hussein where are u from?
_Adnan
en français
Adama
which site have a normal flora
ESTHER Reply
Many sites of the body have it Skin Nasal cavity Oral cavity Gastro intestinal tract
Safaa
skin
Asiina
skin,Oral,Nasal,GIt
Sadik
How can Commensal can Bacteria change into pathogen?
Sadik
How can Commensal Bacteria change into pathogen?
Sadik
all
Tesfaye
by fussion
Asiina
what are the advantages of normal Flora to the host
Micheal
what are the ways of control and prevention of nosocomial infection in the hospital
Micheal
what is inflammation
Shelly Reply
part of a tissue or an organ being wounded or bruised.
Wilfred
what term is used to name and classify microorganisms?
Micheal Reply
Binomial nomenclature
adeolu
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Digital signal processing laboratory (ece 420 55x). OpenStax CNX. Jan 18, 2010 Download for free at http://cnx.org/content/col10397/1.10
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Digital signal processing laboratory (ece 420 55x)' conversation and receive update notifications?

Ask