home *** CD-ROM | disk | FTP | other *** search
/ M.u.C.S. Disc 2000 / MUCS2000.iso / sound / mp2 / src / gem / mp2dsp.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-11-28  |  1.5 KB  |  81 lines

  1. #include <tos.h>
  2. #ifdef DEBUG
  3. #include <stdio.h>
  4. #endif
  5.  
  6. /* #include "dsp_boot.h" */
  7. /* #include "dsp_dsp.h"  */
  8.  
  9. #include "mp2info.h"
  10.  
  11. /* global variables from dsp_bin.c */
  12. extern char dsp_binext[], dsp_binint[];
  13.  
  14. /* global variables from dsp_dat.c */
  15. extern char dsp_dat[];
  16.  
  17. /* Function in this module */
  18. void bootdsp(void);
  19.  
  20. /* Function from dsp_bin.c */
  21. extern long get_bin_len(int);
  22.  
  23. /* Function from dsp_dat.c */
  24. extern long get_dat_len(void);
  25.  
  26. /* Function from mp2boot.s */
  27. extern long dsp_load(void);
  28.  
  29. /* global variable from mp2audio.c */
  30. extern int ext;
  31.  
  32. /* global variable from mp2info.c */
  33. extern MP2INFO mp2info;
  34.  
  35. /*
  36. /* global variable */
  37. long dsp_codebin,dsp_bootbin;
  38. int dsp_codelen,dsp_bootlen;
  39. */
  40.  
  41. void bootdsp()
  42. {
  43.     char *dsp_binptr;
  44.     long dsp_binsize,dsp_datsize;
  45.     
  46.     if((mp2info.sample_frequency==44100L) && !ext)
  47.     {
  48.         dsp_binptr=dsp_binint; /* use internal clock */
  49.         dsp_binsize = get_bin_len(0)/3;
  50. /*        dsp_binsize=((long)sizeof(dsp_binint))/3; */
  51.     }
  52.     else
  53.     {
  54.         dsp_binptr=dsp_binext; /* use external clock */
  55.         dsp_binsize = get_bin_len(1)/3;
  56. /*        dsp_binsize=((long)sizeof(dsp_binext))/3; */
  57.     }
  58.  
  59. /*
  60.     dsp_codebin=(long)dsp_binptr;
  61.     dsp_codelen=(int)dsp_binsize;
  62.     dsp_bootbin=(long)dsp_bootstrap;
  63.     dsp_bootlen=((int)sizeof(dsp_bootstrap))/3;
  64.     Supexec(dsp_load);
  65. */
  66.  
  67.     Dsp_ExecProg(dsp_binptr, dsp_binsize, 0x42);
  68.  
  69.  
  70. #ifdef DEBUG
  71.     printf("DSP bootstrapped\n");
  72. #endif
  73.     
  74.     dsp_datsize=get_dat_len()/4;
  75.     Dsp_BlkUnpacked((long *)dsp_dat, dsp_datsize, 0, 0);
  76. #ifdef DEBUG
  77.     printf("DSP data uploaded\n");
  78. #endif
  79. }
  80.  
  81.