Path: blob/master/drivers/isdn/hardware/eicon/capidtmf.h
15115 views
1/*2*3Copyright (c) Eicon Networks, 2002.4*5This source file is supplied for the use with6Eicon Networks range of DIVA Server Adapters.7*8Eicon File Revision : 2.19*10This program is free software; you can redistribute it and/or modify11it under the terms of the GNU General Public License as published by12the Free Software Foundation; either version 2, or (at your option)13any later version.14*15This program is distributed in the hope that it will be useful,16but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY17implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.18See the GNU General Public License for more details.19*20You should have received a copy of the GNU General Public License21along with this program; if not, write to the Free Software22Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.23*24*/25#ifndef CAPIDTMF_H_26#define CAPIDTMF_H_27/*---------------------------------------------------------------------------*/28/*---------------------------------------------------------------------------*/29#define CAPIDTMF_TONE_GROUP_COUNT 230#define CAPIDTMF_LOW_GROUP_FREQUENCIES 431#define CAPIDTMF_HIGH_GROUP_FREQUENCIES 432#define DSPDTMF_RX_SENSITIVITY_LOW_DEFAULT 50 /* -52 dBm */33#define DSPDTMF_RX_SENSITIVITY_HIGH_DEFAULT 50 /* -52 dBm */34#define DSPDTMF_RX_HIGH_EXCEEDING_LOW_DEFAULT 10 /* dB */35#define DSPDTMF_RX_LOW_EXCEEDING_HIGH_DEFAULT 10 /* dB */36#define DSPDTMF_RX_HARMONICS_SEL_DEFAULT 12 /* dB */37#define CAPIDTMF_RECV_BASE_FREQUENCY_COUNT (CAPIDTMF_LOW_GROUP_FREQUENCIES + CAPIDTMF_HIGH_GROUP_FREQUENCIES)38#define CAPIDTMF_RECV_GUARD_FREQUENCY_COUNT 839#define CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT (CAPIDTMF_RECV_BASE_FREQUENCY_COUNT + CAPIDTMF_RECV_GUARD_FREQUENCY_COUNT)40#define CAPIDTMF_RECV_POSITIVE_COEFF_COUNT 1641#define CAPIDTMF_RECV_NEGATIVE_COEFF_COUNT (CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT - CAPIDTMF_RECV_POSITIVE_COEFF_COUNT)42#define CAPIDTMF_RECV_ACCUMULATE_CYCLES 20543#define CAPIDTMF_RECV_FUNDAMENTAL_OFFSET (0xff35L * 2)44#define CAPIDTMF_RECV_FUNDAMENTAL_DECREMENT (0x0028L * 2)45#define CAPIDTMF_RECV_DIGIT_BUFFER_SIZE 3246#define CAPIDTMF_RECV_STATE_IDLE 0x0047#define CAPIDTMF_RECV_STATE_DTMF_ACTIVE 0x0148typedef struct tag_capidtmf_recv_state49{50byte digit_buffer[CAPIDTMF_RECV_DIGIT_BUFFER_SIZE];51word digit_write_pos;52word digit_read_pos;53word indication_state;54word indication_state_ack;55long goertzel_buffer[2][CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT];56word min_gap_duration;57word min_digit_duration;58word cycle_counter;59word current_digit_on_time;60word current_digit_off_time;61byte current_digit_value;62byte state;63} t_capidtmf_recv_state;64typedef struct tag_capidtmf_state65{66byte ulaw;67t_capidtmf_recv_state recv;68} t_capidtmf_state;69word capidtmf_recv_indication (t_capidtmf_state *p_state, byte *buffer);70void capidtmf_recv_block (t_capidtmf_state *p_state, byte *buffer, word length);71void capidtmf_init (t_capidtmf_state *p_state, byte ulaw);72void capidtmf_recv_enable (t_capidtmf_state *p_state, word min_digit_duration, word min_gap_duration);73void capidtmf_recv_disable (t_capidtmf_state *p_state);74#define capidtmf_indication(p_state,buffer) (((p_state)->recv.indication_state != (p_state)->recv.indication_state_ack) ? capidtmf_recv_indication (p_state, buffer) : 0)75#define capidtmf_recv_process_block(p_state,buffer,length) { if ((p_state)->recv.state != CAPIDTMF_RECV_STATE_IDLE) capidtmf_recv_block (p_state, buffer, length); }76/*---------------------------------------------------------------------------*/77/*---------------------------------------------------------------------------*/78#endif798081