Advertisement
Donny3000

dummy_dsp.h

Jan 26th, 2015
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.74 KB | None | 0 0
  1. /*
  2.  * Copyright (C) 2010-2011 University of Texas at Austin
  3.  *
  4.  * Author: Dan Zhang <dan.zhang@mail.utexas.edu>
  5.  *
  6.  * This library is free software; you can redistribute it and/or
  7.  * modify it under the terms of the GNU Lesser General Public
  8.  * License as published by the Free Software Foundation
  9.  * version 2.1 of the License.
  10.  *
  11.  * This library is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14.  * Lesser General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU Lesser General Public
  17.  * License along with this library; if not, write to the Free Software
  18.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  19.  *
  20.  */
  21.  
  22. #define FFT_SIZE 32
  23.  
  24.  
  25. /* The default DSP behavior is as follows:
  26.  
  27.    while(1) {
  28.       run idle function
  29.      
  30.       if(message available)
  31.          run function specified by the message's command
  32.  
  33. */
  34.  
  35.  
  36. // Define your non-temporary variables here:
  37. struct dsp_global_t {
  38.     uint32_t counter;
  39. };
  40.  
  41. // Initialize them here
  42. inline void dsp_init_vars(struct dsp_global_t* global) {
  43.     global->counter = 0;
  44. }
  45.  
  46.  
  47. /* The number of DSP functions that you wish to run. In this example,
  48.    the only function to run is the matrix multiply function. */
  49. #define NUM_DSP_FUNC 1
  50.  
  51. /* Message send and receive sizes. Do not exceed the maximum.
  52.    The send and receive DMA buffers are sized to be the maximum. If
  53.    you do not need the space, you may reduce the size as you see fit.
  54.  */
  55. #define MAX_SEND_SIZE 512*1024     // 512KB
  56. #define MAX_RECEIVE_SIZE 512*1024  // 512KB
  57.  
  58. /* These are the functions that the DSP can run. A function pointer
  59.    array accesses them based on the message command # sent to the DSP.
  60. */
  61. void compute_fft(struct dsp_global_t* global, void* in, void* out, uint32_t size, uint32_t unused);
  62.  
  63.  
  64. // Map msg.cmd number to function to run.
  65. // WARNING: 0 and 0x80000000 are reserved, don't use it!
  66. #define RESERVED1 0
  67. #define COMPUTE_FFT 1
  68. #define RESERVED2 0x80000000
  69.  
  70. // The indices into the array should match the above.
  71. inline void init_dsp_func(void (**pt2Func)(struct dsp_global_t*, void*, void*, uint32_t, uint32_t)) {
  72.   pt2Func[1] = compute_fft;
  73. }
  74.  
  75.  
  76.  
  77. // Do you actually wish to run the idle function? If so, uncomment.
  78. // Else, comment.
  79. #define DSP_IDLE_FUNC_EN
  80.  
  81. // DSP Idle Function (see explanation above)
  82. inline void dsp_idle_func(struct dsp_global_t* global) {
  83.     global->counter++;
  84. }
  85.  
  86.  
  87. // Function specified by message command
  88. //void compute_fft(struct dsp_global_t* global, void* in, void* out, uint32_t size, uint32_t unused) {
  89. //  DSP_fft(global->w, FFT_SIZE, (short *) in, (short *) out);
  90. //}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement