/* Configure the mode and trigger source of a sample sequence.  */
void xADCConfigure(unsigned long ulBase, unsigned long ulMode, unsigned long ulTrigger)
/* Configure the mode and trigger source of a sample sequence.  */
void xADCConfigure(unsigned long ulBase, unsigned long ulMode, unsigned long ulTrigger)
{
    unsigned long ulConfig;
    xASSERT(ulBase == xADC0_BASE);
    xASSERT(ulMode == xADC_MODE_SCAN_SINGLE_CYCLE);
    xASSERT((ulTrigger == ADC_TRIGGER_PROCESSOR) || 
            (ulTrigger == (xADC_TRIGGER_EXT_PD2 | 
                           xADC_TRIGGER_EXT_FALLING_EDGE)) ||
            (ulTrigger == (xADC_TRIGGER_EXT_PD2 | 
                           xADC_TRIGGER_EXT_RISING_EDGE))                     
           );
    ulConfig = ulMode | ulTrigger;
    xHWREG(ulBase + ADC_CR) &= ~(ADC_CR_TRGEN | ADC_CR_TRGCOND_FALLING);
    xHWREG(ulBase + ADC_CR) |= ulConfig;    
}