void GAUDIN_ISR_CompleteI(audin_sample_t *buffer, size_t n) { /* Save the details */ lastcount = n; lastbuffer = buffer; /* Signal the user with the data */ if (paudEvent) { #if GFX_USE_GEVENT paudEvent->type = GEVENT_AUDIO_IN; #endif paudEvent->channel = aud.channel; paudEvent->count = lastcount; paudEvent->buffer = lastbuffer; paudEvent->flags = 0; } /* Our two signalling mechanisms */ if (paudSem) gfxSemSignalI(paudSem); #if GFX_USE_GEVENT if (audFlags & AUDFLG_USE_EVENTS) gtimerJabI(&AudGTimer); #endif }
void GADC_ISR_ErrorI(ADCDriver *adcp, adcerror_t err) { (void) adcp; (void) err; if (curlsdev) { if ((curlsdev->flags & (GADC_FLG_ISACTIVE|GADC_FLG_ISDONE)) == GADC_FLG_ISACTIVE) /* Mark the error then try to repeat it */ curlsdev->flags |= GADC_FLG_ERROR; #if ADC_ISR_FULL_CODE_BUG /** * Oops - We have just finished a low speed conversion but a bug prevents us * restarting the ADC here. Other code will restart it in the thread based * ADC handler. */ gflags &= ~GADC_GFLG_ISACTIVE; gtimerJabI(&LowSpeedGTimer); return; #endif } else { if (hs.flags & GADC_FLG_ISACTIVE) /* Mark the error and then try to repeat it */ hs.flags |= GADC_FLG_ERROR; } /* Start the next conversion */ FindNextConversionI(); }
/* Wake up the mouse driver from an interrupt service routine (there may be new readings available) */ void ginputMouseWakeupI(void) { gtimerJabI(&MouseTimer); }
/* Wake up the mouse driver from an interrupt service routine (there may be new readings available) */ void _gmouseWakeupI(GMouse *m) { if (m) m->flags |= GMOUSE_FLG_NEEDREAD; gtimerJabI(&MouseTimer); }
/* Wake up the keyboard driver from an interrupt service routine (there may be new readings available) */ void _gkeyboardWakeupI(GKeyboard *k) { if (k) k->flags |= GKEYBOARD_FLG_NEEDREAD; gtimerJabI(&KeyboardTimer); }
void GADC_ISR_CompleteI(ADCDriver *adcp, adcsample_t *buffer, size_t n) { (void) adcp; if (curlsdev) { /* This interrupt must be in relation to the low speed device */ if (curlsdev->flags & GADC_FLG_ISACTIVE) { /** * As we only handle a single low speed conversion at a time, we know * we know we won't get any half completion interrupts. */ curlsdev->flags |= GADC_FLG_ISDONE; gtimerJabI(&LowSpeedGTimer); } #if ADC_ISR_FULL_CODE_BUG /** * Oops - We have just finished a low speed conversion but a bug prevents us * restarting the ADC here. Other code will restart it in the thread based * ADC handler. */ gflags &= ~GADC_GFLG_ISACTIVE; return; #endif } else { /* This interrupt must be in relation to the high speed device */ if (hs.flags & GADC_FLG_ISACTIVE) { /* Save the details */ hs.lastcount = n; hs.lastbuffer = buffer; hs.lastflags = GADC_Timer_Missed ? GADC_HSADC_LOSTEVENT : 0; /* Signal the user with the data */ if (hs.pEvent) { #if GFX_USE_GEVENT hs.pEvent->type = GEVENT_ADC; #endif hs.pEvent->count = hs.lastcount; hs.pEvent->buffer = hs.lastbuffer; hs.pEvent->flags = hs.lastflags; } /* Our three signalling mechanisms */ if (hs.isrfn) hs.isrfn(buffer, n); if (hs.bsem) chBSemSignalI(hs.bsem); #if GFX_USE_GEVENT if (hs.flags & GADC_FLG_GTIMER) gtimerJabI(&HighSpeedGTimer); #endif /* Adjust what we have left to do */ hs.lld.count -= n; hs.remaining -= n; /* Half completion - We have done all we can for now - wait for the next interrupt */ if (hs.lld.count) return; /* Our buffer is cyclic - set up the new buffer pointers */ if (hs.remaining) { hs.lld.buffer = buffer + (n * hs.samplesPerConversion); } else { hs.remaining = hs.bufcount; hs.lld.buffer = hs.buffer; } hs.lld.count = hs.remaining < hs.samplesPerEvent ? hs.remaining : hs.samplesPerEvent; } } /** * Look for the next thing to do. */ FindNextConversionI(); }