In a class that derives from
coder.fft.StandaloneFFTW3Interface
, implement
lock
and unlock
methods that call C
code to manage a lock.
Write C functions that initialize, set, and unset a lock. To manage the lock, this
example uses the OpenMP library. For a different library, modify the code
accordingly.
Write an FFT callback class myfftcb
that:
Use this class as a template. Replace fftwLocation
with the location of your FFTW library installation.
Set the code generation configuration parameters.
For code generation with the
MATLAB®
Coder™
codegen
command, set:
CustomFFTCallback
to
'myfftcb'
.
CustomSource
to
'mylock.c'
.
CustomInitializer
to
'mylock_initialize();'
.
For code generation with the MATLAB
Coder app, set:
Custom FFT library callback to
myfftcb
.
Additional source files to
mylock.c
.
Initialize function to
mylock_initialize();
.
For code generation from a MATLAB Function block by using
Simulink® Coder, set these parameters:
Custom FFT library callback to
myfftcb
.
In ,
under Additional build information, set
Source files to
mylock.c
.
In ,
under Insert custom C code in generated, set
Initialize function to
mylock_initialize();
.
Generate code.