/* * Audio support data for ISDN4Linux. * * Copyright Andreas Eversberg ([email protected]) * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * */ #include <linux/gfp.h> #include <linux/mISDNif.h> #include <linux/mISDNdsp.h> #include "core.h" #include "dsp.h" #define DATA_S … #define SIZE_S … #define DATA_GA … #define SIZE_GA … #define DATA_GO … #define SIZE_GO … #define DATA_DT … #define SIZE_DT … #define DATA_RI … #define SIZE_RI … #define DATA_BU … #define SIZE_BU … #define DATA_S1 … #define SIZE_S1 … #define DATA_S2 … #define SIZE_S2 … #define DATA_S3 … #define SIZE_S3 … /***************/ /* tones loops */ /***************/ /* all tones are alaw encoded */ /* the last sample+1 is in phase with the first sample. the error is low */ static u8 sample_german_all[] = …; static u32 sizeof_german_all = …; static u8 sample_german_old[] = …; static u32 sizeof_german_old = …; static u8 sample_american_dialtone[] = …; static u32 sizeof_american_dialtone = …; static u8 sample_american_ringing[] = …; static u32 sizeof_american_ringing = …; static u8 sample_american_busy[] = …; static u32 sizeof_american_busy = …; static u8 sample_special1[] = …; static u32 sizeof_special1 = …; static u8 sample_special2[] = …; static u32 sizeof_special2 = …; static u8 sample_special3[] = …; static u32 sizeof_special3 = …; static u8 sample_silence[] = …; static u32 sizeof_silence = …; struct tones_samples { … }; static struct tones_samples samples[] = …; /*********************************** * generate ulaw from alaw samples * ***********************************/ void dsp_audio_generate_ulaw_samples(void) { … } /**************************** * tone sequence definition * ****************************/ static struct pattern { … } pattern[] = …; /****************** * copy tone data * ******************/ /* an sk_buff is generated from the number of samples needed. * the count will be changed and may begin from 0 each pattern period. * the clue is to precalculate the pointers and legths to use only one * memcpy per function call, or two memcpy if the tone sequence changes. * * pattern - the type of the pattern * count - the sample from the beginning of the pattern (phase) * len - the number of bytes * * return - the sk_buff with the sample * * if tones has finished (e.g. knocking tone), dsp->tones is turned off */ void dsp_tone_copy(struct dsp *dsp, u8 *data, int len) { … } /******************************* * send HW message to hfc card * *******************************/ static void dsp_tone_hw_message(struct dsp *dsp, u8 *sample, int len) { … } /***************** * timer expires * *****************/ void dsp_tone_timeout(struct timer_list *t) { … } /******************** * set/release tone * ********************/ /* * tones are relaized by streaming or by special loop commands if supported * by hardware. when hardware is used, the patterns will be controlled by * timers. */ int dsp_tone(struct dsp *dsp, int tone) { … }