AnsweredAssumed Answered

How To Include Struct + Function Headers for Universal Access

Question asked by epalaima on Sep 6, 2017
Latest reply on Sep 13, 2017 by Kader.M

Hi, I am working on a project using CCES with the Sharc ADSP-21489, written in C. For my project I was planning on creating several header files containing struct and function definitions for different DSP operations. I am basing my project on the ADSP-21489 Ez-Kit I2S Talkthru Example which has the main() function where setup is done in ADSP-21489 I2S Talkthru.c and the audio processing loop ( process_AD1939_samples() ) in process_audio.c.

 

I am looking for a way to include my header file, as well as declare the necessary struct variables in such a way that they will be accessible by both the main() and process_AD1939_samples()  functions (in order that I can initialize the structs to their starting values in main, prior to beginning audio processings, then use the structs and functions to process the samples in process_AD1939_samples() ). 

 

How should I include my .h file, and where should I declare my struct variables? I am trying to do something like:

 

In filter.h:

 

struct filter{

   filterVars...

}

 

void filter_init(struct filter* myFilter, params...){

initialize params...

}

 

float filter_process(struct filter* myFilter, input){

process input and return result...

}

 

in main():

 

filter_init(&aFilter, params...);

 

in process_AD1939_samples():

 

filter_process(&aFilter, input);

 

somewhere:

 

struct filter aFilter;

Outcomes