/* Get the captured data from a sample sequence. This function copies data from the specified sample sequence FIFO to a memory resident buffer. The number of samples available in the FIFO are copied into the buffer, which is assumed to be large enough to hold that many samples. This will only return the samples that are presently available, which may not be the entire sample sequence if it is in the process of being executed.  */
unsigned long xADCDataGet(unsigned long ulBase, unsigned long *pulBuffer)
/* Get the captured data from a sample sequence. This function copies data from the specified sample sequence FIFO to a memory resident buffer. The number of samples available in the FIFO are copied into the buffer, which is assumed to be large enough to hold that many samples. This will only return the samples that are presently available, which may not be the entire sample sequence if it is in the process of being executed.  */
unsigned long xADCDataGet(unsigned long ulBase, unsigned long *pulBuffer)
{
    unsigned long i        = 0;
    unsigned long cnt      = 0;
    unsigned long ulTmpReg = 0;
    xASSERT(ulBase == xADC0_BASE);
    xASSERT(pulBuffer != NULL);
    ulTmpReg = xHWREG(ulBase + AD_STAT);
    for(i = 0; i < 7; i++)
    {
        if( ulTmpReg & (1<<i) )
        {
            cnt++;
            *pulBuffer++ = ADCDataRead(ulBase, ChID[i]);
        }
    }
    return (cnt);
}