^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) * Audio support data for ISDN4Linux.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright 2002/2003 by Andreas Eversberg (jolly@eversberg.eu)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * This software may be used and distributed according to the terms
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * of the GNU General Public License, incorporated herein by reference.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #define DEBUG_DSP_CTRL 0x0001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #define DEBUG_DSP_CORE 0x0002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #define DEBUG_DSP_DTMF 0x0004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #define DEBUG_DSP_CMX 0x0010
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define DEBUG_DSP_TONE 0x0020
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define DEBUG_DSP_BLOWFISH 0x0040
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #define DEBUG_DSP_DELAY 0x0100
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #define DEBUG_DSP_CLOCK 0x0200
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define DEBUG_DSP_DTMFCOEFF 0x8000 /* heavy output */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) /* options may be:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) * bit 0 = use ulaw instead of alaw
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * bit 1 = enable hfc hardware acceleration for all channels
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #define DSP_OPT_ULAW (1 << 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define DSP_OPT_NOHARDWARE (1 << 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #include <linux/timer.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #include <linux/workqueue.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #include "dsp_ecdis.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) extern int dsp_options;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) extern int dsp_debug;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) extern int dsp_poll;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) extern int dsp_tics;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) extern spinlock_t dsp_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) extern struct work_struct dsp_workq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) extern u32 dsp_poll_diff; /* calculated fix-comma corrected poll value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) /***************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) * audio stuff *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) ***************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) extern s32 dsp_audio_alaw_to_s32[256];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) extern s32 dsp_audio_ulaw_to_s32[256];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) extern s32 *dsp_audio_law_to_s32;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) extern u8 dsp_audio_s16_to_law[65536];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) extern u8 dsp_audio_alaw_to_ulaw[256];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) extern u8 dsp_audio_mix_law[65536];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) extern u8 dsp_audio_seven2law[128];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) extern u8 dsp_audio_law2seven[256];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) extern void dsp_audio_generate_law_tables(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) extern void dsp_audio_generate_s2law_table(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) extern void dsp_audio_generate_seven(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) extern void dsp_audio_generate_mix_table(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) extern void dsp_audio_generate_ulaw_samples(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) extern void dsp_audio_generate_volume_changes(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) extern u8 dsp_silence;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) /*************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) * cmx stuff *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) *************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) #define MAX_POLL 256 /* maximum number of send-chunks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) #define CMX_BUFF_SIZE 0x8000 /* must be 2**n (0x1000 about 1/2 second) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) #define CMX_BUFF_HALF 0x4000 /* CMX_BUFF_SIZE / 2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) #define CMX_BUFF_MASK 0x7fff /* CMX_BUFF_SIZE - 1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) /* how many seconds will we check the lowest delay until the jitter buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) is reduced by that delay */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) #define MAX_SECONDS_JITTER_CHECK 5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) extern struct timer_list dsp_spl_tl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) /* the datatype need to match jiffies datatype */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) extern unsigned long dsp_spl_jiffies;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) /* the structure of conferences:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) * each conference has a unique number, given by user space.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) * the conferences are linked in a chain.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) * each conference has members linked in a chain.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) * each dsplayer points to a member, each member points to a dsplayer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) /* all members within a conference (this is linked 1:1 with the dsp) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) struct dsp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) struct dsp_conf_member {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) struct dsp *dsp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) /* the list of all conferences */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) struct dsp_conf {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) u32 id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) /* all cmx stacks with the same ID are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) connected */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) struct list_head mlist;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) int software; /* conf is processed by software */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) int hardware; /* conf is processed by hardware */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) /* note: if both unset, has only one member */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) /**************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) * DTMF stuff *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) **************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) #define DSP_DTMF_NPOINTS 102
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) #define ECHOCAN_BUFF_SIZE 0x400 /* must be 2**n */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) #define ECHOCAN_BUFF_MASK 0x3ff /* -1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) struct dsp_dtmf {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) int enable; /* dtmf is enabled */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) int treshold; /* above this is dtmf (square of) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) int software; /* dtmf uses software decoding */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) int hardware; /* dtmf uses hardware decoding */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) int size; /* number of bytes in buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) signed short buffer[DSP_DTMF_NPOINTS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) /* buffers one full dtmf frame */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) u8 lastwhat, lastdigit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) int count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) u8 digits[16]; /* dtmf result */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) /******************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) * pipeline stuff *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) ******************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) struct dsp_pipeline {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) rwlock_t lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) int inuse;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) /***************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) * tones stuff *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) ***************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) struct dsp_tone {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) int software; /* tones are generated by software */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) int hardware; /* tones are generated by hardware */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) int tone;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) void *pattern;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) int count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) int index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) struct timer_list tl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) /***************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) * echo stuff *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) ***************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) struct dsp_echo {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) int software; /* echo is generated by software */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) int hardware; /* echo is generated by hardware */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) /*****************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) * general stuff *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) *****************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) struct dsp {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) struct mISDNchannel ch;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) struct mISDNchannel *up;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) unsigned char name[64];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) int b_active;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) struct dsp_echo echo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) int rx_disabled; /* what the user wants */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) int rx_is_off; /* what the card is */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) int tx_mix;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) struct dsp_tone tone;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) struct dsp_dtmf dtmf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) int tx_volume, rx_volume;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) /* queue for sending frames */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) struct work_struct workq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) struct sk_buff_head sendq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) int hdlc; /* if mode is hdlc */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) int data_pending; /* currently an unconfirmed frame */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) /* conference stuff */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) u32 conf_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) struct dsp_conf *conf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) struct dsp_conf_member
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) *member;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) /* buffer stuff */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) int rx_W; /* current write pos for data without timestamp */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) int rx_R; /* current read pos for transmit clock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) int rx_init; /* if set, pointers will be adjusted first */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) int tx_W; /* current write pos for transmit data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) int tx_R; /* current read pos for transmit clock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) int rx_delay[MAX_SECONDS_JITTER_CHECK];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) int tx_delay[MAX_SECONDS_JITTER_CHECK];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) u8 tx_buff[CMX_BUFF_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) u8 rx_buff[CMX_BUFF_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) int last_tx; /* if set, we transmitted last poll interval */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) int cmx_delay; /* initial delay of buffers,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) or 0 for dynamic jitter buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) int tx_dejitter; /* if set, dejitter tx buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) int tx_data; /* enables tx-data of CMX to upper layer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) /* hardware stuff */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) struct dsp_features features;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) int features_rx_off; /* set if rx_off is featured */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) int features_fill_empty; /* set if fill_empty is featured */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) int pcm_slot_rx; /* current PCM slot (or -1) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) int pcm_bank_rx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) int pcm_slot_tx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) int pcm_bank_tx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) int hfc_conf; /* unique id of current conference (or -1) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) /* encryption stuff */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) int bf_enable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) u32 bf_p[18];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) u32 bf_s[1024];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) int bf_crypt_pos;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) u8 bf_data_in[9];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) u8 bf_crypt_out[9];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) int bf_decrypt_in_pos;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) int bf_decrypt_out_pos;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) u8 bf_crypt_inring[16];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) u8 bf_data_out[9];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) int bf_sync;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) struct dsp_pipeline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) pipeline;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) /* functions */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) extern void dsp_change_volume(struct sk_buff *skb, int volume);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) extern struct list_head dsp_ilist;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) extern struct list_head conf_ilist;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) extern void dsp_cmx_debug(struct dsp *dsp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) extern void dsp_cmx_hardware(struct dsp_conf *conf, struct dsp *dsp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) extern int dsp_cmx_conf(struct dsp *dsp, u32 conf_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) extern void dsp_cmx_receive(struct dsp *dsp, struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) extern void dsp_cmx_hdlc(struct dsp *dsp, struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) extern void dsp_cmx_send(void *arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) extern void dsp_cmx_transmit(struct dsp *dsp, struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) extern int dsp_cmx_del_conf_member(struct dsp *dsp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) extern int dsp_cmx_del_conf(struct dsp_conf *conf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) extern void dsp_dtmf_goertzel_init(struct dsp *dsp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) extern void dsp_dtmf_hardware(struct dsp *dsp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) extern u8 *dsp_dtmf_goertzel_decode(struct dsp *dsp, u8 *data, int len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) int fmt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) extern int dsp_tone(struct dsp *dsp, int tone);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) extern void dsp_tone_copy(struct dsp *dsp, u8 *data, int len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) extern void dsp_tone_timeout(struct timer_list *t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) extern void dsp_bf_encrypt(struct dsp *dsp, u8 *data, int len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) extern void dsp_bf_decrypt(struct dsp *dsp, u8 *data, int len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) extern int dsp_bf_init(struct dsp *dsp, const u8 *key, unsigned int keylen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) extern void dsp_bf_cleanup(struct dsp *dsp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) extern int dsp_pipeline_module_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) extern void dsp_pipeline_module_exit(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) extern int dsp_pipeline_init(struct dsp_pipeline *pipeline);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) extern void dsp_pipeline_destroy(struct dsp_pipeline *pipeline);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) extern int dsp_pipeline_build(struct dsp_pipeline *pipeline, const char *cfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) extern void dsp_pipeline_process_tx(struct dsp_pipeline *pipeline, u8 *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) int len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) extern void dsp_pipeline_process_rx(struct dsp_pipeline *pipeline, u8 *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) int len, unsigned int txlen);