/* Reads data coming from a SSC peripheral receiver and stores it into the provided buffer. Returns true if the buffer has been queued for reception; otherwise returns false.  */
unsigned char SSC_ReadBuffer(AT91S_SSC *ssc, void *buffer, unsigned int length)
/* Reads data coming from a SSC peripheral receiver and stores it into the provided buffer. Returns true if the buffer has been queued for reception; otherwise returns false.  */
unsigned char SSC_ReadBuffer(AT91S_SSC *ssc, void *buffer, unsigned int length)
{
    if (ssc->SSC_RCR == 0) {
        ssc->SSC_RPR = (unsigned int) buffer;
        ssc->SSC_RCR = length;
        ssc->SSC_PTCR = AT91C_PDC_RXTEN;
        return 1;
    }
    else if (ssc->SSC_RNCR == 0) {
        ssc->SSC_RNPR = (unsigned int) buffer;
        ssc->SSC_RNCR = length;
        return 1;
    }
    return 0;
}