void fiq_record(void) ICODE_ATTR __attribute__ ((interrupt ("FIQ"))); void fiq_record(void) { short value; pcm_more_callback_type2 more_ready; int status = 0; /* Clear interrupt */ #if CONFIG_CPU == PP5020 IISCONFIG &= ~0x01; #elif CONFIG_CPU == PP5002 /* TODO */ #endif while (p_size > 0) { if (FIFO_FULL_COUNT < 2) { /* enable interrupt */ #if CONFIG_CPU == PP5020 IISCONFIG |= 0x01; #elif CONFIG_CPU == PP5002 /* TODO */ #endif return; } value = (unsigned short)(IISFIFO_RD >> 16); if (value > peak_l) peak_l = value; else if (-value > peak_l) peak_l = -value; *(p++) = value; value = (unsigned short)(IISFIFO_RD >> 16); if (value > peak_r) peak_r = value; else if (-value > peak_r) peak_r = -value; *(p++) = value; p_size -= 4; /* If we have filled the current chunk, start a new one */ if (p_size == 0) { rec_peak_left = peak_l; rec_peak_right = peak_r; peak_l = peak_r = 0; } } more_ready = pcm_callback_more_ready; if (more_ready != NULL && more_ready(status) >= 0) { logf("more ready"); return; } logf("end"); /* Finished recording */ pcm_rec_dma_stop(); }