Lines Matching +full:timer +full:- +full:dsp

15 #include "dsp.h"
367 * pattern - the type of the pattern
368 * count - the sample from the beginning of the pattern (phase)
369 * len - the number of bytes
371 * return - the sk_buff with the sample
373 * if tones has finished (e.g. knocking tone), dsp->tones is turned off
375 void dsp_tone_copy(struct dsp *dsp, u8 *data, int len) in dsp_tone_copy() argument
379 struct dsp_tone *tone = &dsp->tone; in dsp_tone_copy()
382 if (!tone->tone) { in dsp_tone_copy()
388 pat = (struct pattern *)tone->pattern; in dsp_tone_copy()
390 index = tone->index; /* gives current sequence index */ in dsp_tone_copy()
391 count = tone->count; /* gives current sample */ in dsp_tone_copy()
398 if (!pat->seq[index]) { in dsp_tone_copy()
403 if (count < pat->seq[index]) in dsp_tone_copy()
408 count -= pat->seq[index]; in dsp_tone_copy()
412 start = count % (*(pat->siz[index])); in dsp_tone_copy()
414 if (num + count > pat->seq[index]) in dsp_tone_copy()
415 num = pat->seq[index] - count; in dsp_tone_copy()
416 if (num + start > (*(pat->siz[index]))) in dsp_tone_copy()
417 num = (*(pat->siz[index])) - start; in dsp_tone_copy()
419 memcpy(data, pat->data[index] + start, num); in dsp_tone_copy()
423 len -= num; in dsp_tone_copy()
425 tone->index = index; in dsp_tone_copy()
426 tone->count = count; in dsp_tone_copy()
438 dsp_tone_hw_message(struct dsp *dsp, u8 *sample, int len) in dsp_tone_hw_message() argument
447 if (dsp->ch.peer) { in dsp_tone_hw_message()
448 if (dsp->ch.recv(dsp->ch.peer, nskb)) in dsp_tone_hw_message()
457 * timer expires *
462 struct dsp *dsp = from_timer(dsp, t, tone.tl); in dsp_tone_timeout() local
463 struct dsp_tone *tone = &dsp->tone; in dsp_tone_timeout()
464 struct pattern *pat = (struct pattern *)tone->pattern; in dsp_tone_timeout()
465 int index = tone->index; in dsp_tone_timeout()
467 if (!tone->tone) in dsp_tone_timeout()
471 if (!pat->seq[index]) in dsp_tone_timeout()
473 tone->index = index; in dsp_tone_timeout()
476 if (pat->data[index] == DATA_S) in dsp_tone_timeout()
477 dsp_tone_hw_message(dsp, NULL, 0); in dsp_tone_timeout()
479 dsp_tone_hw_message(dsp, pat->data[index], *(pat->siz[index])); in dsp_tone_timeout()
480 /* set timer */ in dsp_tone_timeout()
481 tone->tl.expires = jiffies + (pat->seq[index] * HZ) / 8000; in dsp_tone_timeout()
482 add_timer(&tone->tl); in dsp_tone_timeout()
496 dsp_tone(struct dsp *dsp, int tone) in dsp_tone() argument
500 struct dsp_tone *tonet = &dsp->tone; in dsp_tone()
502 tonet->software = 0; in dsp_tone()
503 tonet->hardware = 0; in dsp_tone()
507 if (dsp->features.hfc_loops && timer_pending(&tonet->tl)) in dsp_tone()
508 del_timer(&tonet->tl); in dsp_tone()
509 if (dsp->features.hfc_loops) in dsp_tone()
510 dsp_tone_hw_message(dsp, NULL, 0); in dsp_tone()
511 tonet->tone = 0; in dsp_tone()
525 printk(KERN_WARNING "dsp: given tone 0x%x is invalid\n", tone); in dsp_tone()
526 return -EINVAL; in dsp_tone()
531 tonet->tone = tone; in dsp_tone()
532 tonet->pattern = pat; in dsp_tone()
533 tonet->index = 0; in dsp_tone()
534 tonet->count = 0; in dsp_tone()
536 if (dsp->features.hfc_loops) { in dsp_tone()
537 tonet->hardware = 1; in dsp_tone()
539 dsp_tone_hw_message(dsp, pat->data[0], *(pat->siz[0])); in dsp_tone()
540 /* set timer */ in dsp_tone()
541 if (timer_pending(&tonet->tl)) in dsp_tone()
542 del_timer(&tonet->tl); in dsp_tone()
543 tonet->tl.expires = jiffies + (pat->seq[0] * HZ) / 8000; in dsp_tone()
544 add_timer(&tonet->tl); in dsp_tone()
546 tonet->software = 1; in dsp_tone()