/*Mapping the Signals to the Appropriate ADC Channels*/
33. #define ES_CTL ADC0_VIN00_CTL
34. #define EC_CTL ADC1_VIN00_CTL
35. #define VDC_CTL ADC0_VIN02_CTL
36. #define THS_CTL ADC0_VIN03_CTL
37. #define IV_CTL ADC0_VIN01_CTL
38. #define IW_CTL ADC1_VIN01_CTL
/*Locations of ADC Signals in Data Buffer Index*/
39. #define IV_ADC 0
40. #define IW_ADC 1
41. #define ES_ADC 0
42. #define EC_ADC 1
43. #define VDC_ADC 2
44. #define THS_ADC 3
/*******************Variables********************/
45. static ADI_ADCC_HANDLE hADCC; /* ADCC Handle */
46. static ADI_ADCC_HANDLE hADCCTimer0, hADCCTimer1; /*ADCC Timer Handles*/
47. static uint8_t ADCCMemory[ADI_ADCC_MEMORY]; /* Memory buffer for the ADCC device - predefined */
48. static uint8_t ADCCTmr0Memory[ADI_ADCC_TMR_MEMORY];
49. static uint8_t ADCCTmr1Memory[ADI_ADCC_TMR_MEMORY]; /* Memory buffer for the ADCC Timers - predefined*/
50. static uint16_t SampleBuffer0[NUM_SAMPLES0];
51. static uint16_t SampleBuffer1[NUM_SAMPLES1];
/* Memory buffer for the ADC samples */
52. static uint16_t Iv_adc, Iw_adc;
53. static uint16_t Es_adc, Ec_adc, Vdc_adc, Ths_adc;
/*Variables for ADC data*/
54. static uint8_t TruDevMemory[ADI_TRU_REQ_MEMORY];
55. static ADI_TRU_HANDLE hTru;
/*TRU Device Memory and Handle*/
/*************Function Prototypes****************/
56. void SetupADC(void);
57. void SetupTRU(void);
58. static void AdccTmr0Callback(void *pCBParam, uint32_t Event, void *pArg);
59. static void AdccTmr1Callback(void *pCBParam, uint32_t Event, void *pArg);
/******Function to Configure ADCC***************/
60. void SetupADC(void) {
61. static ADI_ADCC_RESULT result;
/*Set Up Event Configuration Table*/
62. ADI_ADCC_EVENT_CFG EventCFG[NO_OF_EVENTS] = {
63. {0, ES_CTL, ADI_ADCC_ADCIF0, ADI_ADCC_TIMER0, true, 0, SMP_TIME0},
64. {1, EC_CTL, ADI_ADCC_ADCIF1, ADI_ADCC_TIMER0, true, 2, SMP_TIME1},
65. {2, VDC_CTL, ADI_ADCC_ADCIF0, ADI_ADCC_TIMER0, false, 4, SMP_TIME2 },
66. {3, THS_CTL, ADI_ADCC_ADCIF0, ADI_ADCC_TIMER0, false, 6, SMP_TIME3 },
67. {4, IV_CTL, ADI_ADCC_ADCIF0, ADI_ADCC_TIMER1, true, 8, SMP_TIME4 },
68. {5, IW_CTL, ADI_ADCC_ADCIF1, ADI_ADCC_TIMER1, true, 10, SMP_TIME5 }}; /*Event#, CTL_WORD, ADC Interface, Timer ID, sim. samp, Mem offset in frame, Event time */
评论
查看更多