/* 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)
{
    xASSERT(ulBase == xADC0_BASE);
    xASSERT((ulMode == xADC_MODE_SCAN_SINGLE_CYCLE) ||
            (ulMode == xADC_MODE_SCAN_CONTINUOUS)
           );
    xASSERT((ulTrigger == xADC_TRIGGER_PROCESSOR) || 
            (ulTrigger == xADC_TRIGGER_EXT_PB2)
           );
    xHWREG(ulBase + ADC_RST) |= ADC_ADCRST_ADRST;
    xHWREG(ulBase + ADC_CONV) &= ~ADC_CONV_MODE_M;
    xHWREG(ulBase + ADC_CONV) |= ulMode;
    xHWREG(ulBase + ADC_TSR) |= ulTrigger;
}