Advertisement
Bobita

lab13

May 24th, 2024
458
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.18 KB | None | 0 0
  1. /*****************************************************************************
  2.  * lab11.c
  3.  *****************************************************************************/
  4.  
  5. #include <sys/platform.h>
  6. #include "adi_initialize.h"
  7. #include "lab13.h"
  8. #include "Talkthrough.h"
  9. #include <sysreg.h>
  10. #include <ccblkfn.h>
  11.  
  12.  
  13. /*****************************************************************************
  14.  
  15. Variables
  16.  
  17. Description:    The variables ChannelxLeftIn and ChannelxRightIn contain
  18.         the data coming from the codec ADC (AD1871).  The (processed)
  19.         playback data are written into the variables
  20.         ChannelxLeftOut and ChannelxRightOut respectively, which
  21.         are then sent back to the DAC (AD1854) in the SPORT0 ISR.
  22.  
  23. ******************************************************************************/
  24. // left input data from AD1871
  25. int iChannel0LeftIn, iChannel1LeftIn;
  26. // right input data from AD1871
  27. int iChannel0RightIn, iChannel1RightIn;
  28. // left ouput data for AD1854
  29. int iChannel0LeftOut, iChannel1LeftOut;
  30. // right ouput data for AD1854
  31. int iChannel0RightOut, iChannel1RightOut;
  32. // SPORT0 DMA transmit buffer
  33. int iTxBuffer1[2];
  34. // SPORT0 DMA receive buffer
  35. int iRxBuffer1[2];
  36.  
  37. int wr_ptr = 0;
  38. float LFO = 0.0;
  39. float carrerAmplitude = 0.5;
  40. int FS = 44100;
  41. float carrerFrequency = 20.0 / 44100;
  42. float minValue = 1000;
  43. float maxValue = 3000;
  44. float L=1;
  45.  
  46. int BUFFER_SIZE = 2500;
  47.  
  48. int circularBuffer[3000];
  49.  
  50.  
  51. //--------------------------------------------------------------------------//
  52. // Function:    main                                                        //
  53. //                                                                          //
  54. // Description: After calling a few initalization routines, main() just     //
  55. //              waits in a loop forever.  The code to process the incoming  //
  56. //              data can be placed in the function Process_Data() in the    //
  57. //              file "Process_Data.c".                                      //
  58. //--------------------------------------------------------------------------//
  59. void main(void)
  60. {
  61.     Init_Flags();
  62.     Audio_Reset();
  63.     Init_Sport0();
  64.     Init_DMA();
  65.     Init_Interrupts();
  66.     Enable_DMA_Sport0();
  67.  
  68.     while(1)
  69.     {
  70.         if(*pPORTFIO & (1 << 2))
  71.         {
  72.             while(*pPORTFIO & (1 << 2));
  73.             L++;
  74.         }
  75.  
  76.         if(*pPORTFIO & (1 << 3))
  77.         {
  78.             while(*pPORTFIO & (1 << 3));
  79.             L--;
  80.         }
  81.     }
  82. }
  83.  
  84.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement