ISDN: eicon: Remove driver

I started looking at the history of this driver, and last time the
maintainer was active on the mailing list was when discussing how to
remove it. This was in 2012:

https://lore.kernel.org/lkml/4F4DE175.30002@melware.de/

It looks to me like this has in practice been an orphan for quite a while.
It's throwing warnings about stack size in a function that is in dire
need of refactoring, and it's probably a case of "it's time to call it".

Cc: Armin Schindler <mac@melware.de>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Olof Johansson 2018-11-02 15:00:26 -07:00 committed by David S. Miller
parent 8053e5b93e
commit a8d6219536
85 changed files with 0 additions and 41755 deletions

View File

@ -7843,13 +7843,6 @@ F: include/linux/isdn/
F: include/uapi/linux/isdn.h
F: include/uapi/linux/isdn/
ISDN SUBSYSTEM (Eicon active card driver)
M: Armin Schindler <mac@melware.de>
L: isdn4linux@listserv.isdn4linux.de (subscribers-only)
W: http://www.melware.de
S: Maintained
F: drivers/isdn/hardware/eicon/
IT87 HARDWARE MONITORING DRIVER
M: Jean Delvare <jdelvare@suse.com>
L: linux-hwmon@vger.kernel.org

View File

@ -5,5 +5,3 @@ comment "CAPI hardware drivers"
source "drivers/isdn/hardware/avm/Kconfig"
source "drivers/isdn/hardware/eicon/Kconfig"

View File

@ -3,5 +3,4 @@
# Object files in subdirectories
obj-$(CONFIG_CAPI_AVM) += avm/
obj-$(CONFIG_CAPI_EICON) += eicon/
obj-$(CONFIG_MISDN) += mISDN/

View File

@ -1,51 +0,0 @@
#
# ISDN DIVAS Eicon driver
#
menuconfig CAPI_EICON
bool "Active Eicon DIVA Server cards"
help
Enable support for Eicon Networks active ISDN cards.
if CAPI_EICON
config ISDN_DIVAS
tristate "Support Eicon DIVA Server cards"
depends on PROC_FS && PCI
help
Say Y here if you have an Eicon Networks DIVA Server PCI ISDN card.
In order to use this card, additional firmware is necessary, which
has to be downloaded into the card using the divactrl utility.
if ISDN_DIVAS
config ISDN_DIVAS_BRIPCI
bool "DIVA Server BRI/PCI support"
help
Enable support for DIVA Server BRI-PCI.
config ISDN_DIVAS_PRIPCI
bool "DIVA Server PRI/PCI support"
help
Enable support for DIVA Server PRI-PCI.
config ISDN_DIVAS_DIVACAPI
tristate "DIVA CAPI2.0 interface support"
help
You need this to provide the CAPI interface
for DIVA Server cards.
config ISDN_DIVAS_USERIDI
tristate "DIVA User-IDI interface support"
help
Enable support for user-mode IDI interface.
config ISDN_DIVAS_MAINT
tristate "DIVA Maint driver support"
depends on m
help
Enable Divas Maintenance driver.
endif # ISDN_DIVAS
endif # CAPI_EICON

View File

@ -1,24 +0,0 @@
# SPDX-License-Identifier: GPL-2.0
# Makefile for the Eicon DIVA ISDN drivers.
# Each configuration option enables a list of files.
obj-$(CONFIG_ISDN_DIVAS) += divadidd.o divas.o
obj-$(CONFIG_ISDN_DIVAS_MAINT) += diva_mnt.o
obj-$(CONFIG_ISDN_DIVAS_USERIDI) += diva_idi.o
obj-$(CONFIG_ISDN_DIVAS_DIVACAPI) += divacapi.o
# Multipart objects.
divas-y := divasmain.o divasfunc.o di.o io.o istream.o \
diva.o divasproc.o diva_dma.o
divas-$(CONFIG_ISDN_DIVAS_BRIPCI) += os_bri.o s_bri.o os_4bri.o s_4bri.o
divas-$(CONFIG_ISDN_DIVAS_PRIPCI) += os_pri.o s_pri.o
divacapi-y := capimain.o capifunc.o message.o capidtmf.o
divadidd-y := diva_didd.o diddfunc.o dadapter.o
diva_mnt-y := divamnt.o mntfunc.o debug.o maintidi.o
diva_idi-y := divasi.o idifunc.o um_idi.o dqueue.o

View File

@ -1,18 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* $Id: adapter.h,v 1.4 2004/03/21 17:26:01 armin Exp $ */
#ifndef __DIVA_USER_MODE_IDI_ADAPTER_H__
#define __DIVA_USER_MODE_IDI_ADAPTER_H__
#define DIVA_UM_IDI_ADAPTER_REMOVED 0x00000001
typedef struct _diva_um_idi_adapter {
struct list_head link;
DESCRIPTOR d;
int adapter_nr;
struct list_head entity_q; /* entities linked to this adapter */
dword status;
} diva_um_idi_adapter_t;
#endif

View File

@ -1,699 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef _INC_CAPI20
#define _INC_CAPI20
/* operations on message queues */
/* the common device type for CAPI20 drivers */
#define FILE_DEVICE_CAPI20 0x8001
/* DEVICE_CONTROL codes for user and kernel mode applications */
#define CAPI20_CTL_REGISTER 0x0801
#define CAPI20_CTL_RELEASE 0x0802
#define CAPI20_CTL_GET_MANUFACTURER 0x0805
#define CAPI20_CTL_GET_VERSION 0x0806
#define CAPI20_CTL_GET_SERIAL 0x0807
#define CAPI20_CTL_GET_PROFILE 0x0808
/* INTERNAL_DEVICE_CONTROL codes for kernel mode applicatios only */
#define CAPI20_CTL_PUT_MESSAGE 0x0803
#define CAPI20_CTL_GET_MESSAGE 0x0804
/* the wrapped codes as required by the system */
#define CAPI_CTL_CODE(f, m) CTL_CODE(FILE_DEVICE_CAPI20, f, m, FILE_ANY_ACCESS)
#define IOCTL_CAPI_REGISTER CAPI_CTL_CODE(CAPI20_CTL_REGISTER, METHOD_BUFFERED)
#define IOCTL_CAPI_RELEASE CAPI_CTL_CODE(CAPI20_CTL_RELEASE, METHOD_BUFFERED)
#define IOCTL_CAPI_GET_MANUFACTURER CAPI_CTL_CODE(CAPI20_CTL_GET_MANUFACTURER, METHOD_BUFFERED)
#define IOCTL_CAPI_GET_VERSION CAPI_CTL_CODE(CAPI20_CTL_GET_VERSION, METHOD_BUFFERED)
#define IOCTL_CAPI_GET_SERIAL CAPI_CTL_CODE(CAPI20_CTL_GET_SERIAL, METHOD_BUFFERED)
#define IOCTL_CAPI_GET_PROFILE CAPI_CTL_CODE(CAPI20_CTL_GET_PROFILE, METHOD_BUFFERED)
#define IOCTL_CAPI_PUT_MESSAGE CAPI_CTL_CODE(CAPI20_CTL_PUT_MESSAGE, METHOD_BUFFERED)
#define IOCTL_CAPI_GET_MESSAGE CAPI_CTL_CODE(CAPI20_CTL_GET_MESSAGE, METHOD_BUFFERED)
struct divas_capi_register_params {
word MessageBufferSize;
word maxLogicalConnection;
word maxBDataBlocks;
word maxBDataLen;
};
struct divas_capi_version {
word CapiMajor;
word CapiMinor;
word ManuMajor;
word ManuMinor;
};
typedef struct api_profile_s {
word Number;
word Channels;
dword Global_Options;
dword B1_Protocols;
dword B2_Protocols;
dword B3_Protocols;
} API_PROFILE;
/* ISDN Common API message types */
#define _ALERT_R 0x8001
#define _CONNECT_R 0x8002
#define _CONNECT_I 0x8202
#define _CONNECT_ACTIVE_I 0x8203
#define _DISCONNECT_R 0x8004
#define _DISCONNECT_I 0x8204
#define _LISTEN_R 0x8005
#define _INFO_R 0x8008
#define _INFO_I 0x8208
#define _SELECT_B_REQ 0x8041
#define _FACILITY_R 0x8080
#define _FACILITY_I 0x8280
#define _CONNECT_B3_R 0x8082
#define _CONNECT_B3_I 0x8282
#define _CONNECT_B3_ACTIVE_I 0x8283
#define _DISCONNECT_B3_R 0x8084
#define _DISCONNECT_B3_I 0x8284
#define _DATA_B3_R 0x8086
#define _DATA_B3_I 0x8286
#define _RESET_B3_R 0x8087
#define _RESET_B3_I 0x8287
#define _CONNECT_B3_T90_ACTIVE_I 0x8288
#define _MANUFACTURER_R 0x80ff
#define _MANUFACTURER_I 0x82ff
/* OR this to convert a REQUEST to a CONFIRM */
#define CONFIRM 0x0100
/* OR this to convert a INDICATION to a RESPONSE */
#define RESPONSE 0x0100
/*------------------------------------------------------------------*/
/* diehl isdn private MANUFACTURER codes */
/*------------------------------------------------------------------*/
#define _DI_MANU_ID 0x44444944
#define _DI_ASSIGN_PLCI 0x0001
#define _DI_ADV_CODEC 0x0002
#define _DI_DSP_CTRL 0x0003
#define _DI_SIG_CTRL 0x0004
#define _DI_RXT_CTRL 0x0005
#define _DI_IDI_CTRL 0x0006
#define _DI_CFG_CTRL 0x0007
#define _DI_REMOVE_CODEC 0x0008
#define _DI_OPTIONS_REQUEST 0x0009
#define _DI_SSEXT_CTRL 0x000a
#define _DI_NEGOTIATE_B3 0x000b
/*------------------------------------------------------------------*/
/* parameter structures */
/*------------------------------------------------------------------*/
/* ALERT-REQUEST */
typedef struct {
byte structs[0]; /* Additional Info */
} _ALT_REQP;
/* ALERT-CONFIRM */
typedef struct {
word Info;
} _ALT_CONP;
/* CONNECT-REQUEST */
typedef struct {
word CIP_Value;
byte structs[0]; /* Called party number,
Called party subaddress,
Calling party number,
Calling party subaddress,
B_protocol,
BC,
LLC,
HLC,
Additional Info */
} _CON_REQP;
/* CONNECT-CONFIRM */
typedef struct {
word Info;
} _CON_CONP;
/* CONNECT-INDICATION */
typedef struct {
word CIP_Value;
byte structs[0]; /* Called party number,
Called party subaddress,
Calling party number,
Calling party subaddress,
BC,
LLC,
HLC,
Additional Info */
} _CON_INDP;
/* CONNECT-RESPONSE */
typedef struct {
word Accept;
byte structs[0]; /* B_protocol,
Connected party number,
Connected party subaddress,
LLC */
} _CON_RESP;
/* CONNECT-ACTIVE-INDICATION */
typedef struct {
byte structs[0]; /* Connected party number,
Connected party subaddress,
LLC */
} _CON_A_INDP;
/* CONNECT-ACTIVE-RESPONSE */
typedef struct {
byte structs[0]; /* empty */
} _CON_A_RESP;
/* DISCONNECT-REQUEST */
typedef struct {
byte structs[0]; /* Additional Info */
} _DIS_REQP;
/* DISCONNECT-CONFIRM */
typedef struct {
word Info;
} _DIS_CONP;
/* DISCONNECT-INDICATION */
typedef struct {
word Info;
} _DIS_INDP;
/* DISCONNECT-RESPONSE */
typedef struct {
byte structs[0]; /* empty */
} _DIS_RESP;
/* LISTEN-REQUEST */
typedef struct {
dword Info_Mask;
dword CIP_Mask;
byte structs[0]; /* Calling party number,
Calling party subaddress */
} _LIS_REQP;
/* LISTEN-CONFIRM */
typedef struct {
word Info;
} _LIS_CONP;
/* INFO-REQUEST */
typedef struct {
byte structs[0]; /* Called party number,
Additional Info */
} _INF_REQP;
/* INFO-CONFIRM */
typedef struct {
word Info;
} _INF_CONP;
/* INFO-INDICATION */
typedef struct {
word Number;
byte structs[0]; /* Info element */
} _INF_INDP;
/* INFO-RESPONSE */
typedef struct {
byte structs[0]; /* empty */
} _INF_RESP;
/* SELECT-B-REQUEST */
typedef struct {
byte structs[0]; /* B-protocol */
} _SEL_B_REQP;
/* SELECT-B-CONFIRM */
typedef struct {
word Info;
} _SEL_B_CONP;
/* FACILITY-REQUEST */
typedef struct {
word Selector;
byte structs[0]; /* Facility parameters */
} _FAC_REQP;
/* FACILITY-CONFIRM STRUCT FOR SUPPLEMENT. SERVICES */
typedef struct {
byte struct_length;
word function;
byte length;
word SupplementaryServiceInfo;
dword SupportedServices;
} _FAC_CON_STRUCTS;
/* FACILITY-CONFIRM */
typedef struct {
word Info;
word Selector;
byte structs[0]; /* Facility parameters */
} _FAC_CONP;
/* FACILITY-INDICATION */
typedef struct {
word Selector;
byte structs[0]; /* Facility parameters */
} _FAC_INDP;
/* FACILITY-RESPONSE */
typedef struct {
word Selector;
byte structs[0]; /* Facility parameters */
} _FAC_RESP;
/* CONNECT-B3-REQUEST */
typedef struct {
byte structs[0]; /* NCPI */
} _CON_B3_REQP;
/* CONNECT-B3-CONFIRM */
typedef struct {
word Info;
} _CON_B3_CONP;
/* CONNECT-B3-INDICATION */
typedef struct {
byte structs[0]; /* NCPI */
} _CON_B3_INDP;
/* CONNECT-B3-RESPONSE */
typedef struct {
word Accept;
byte structs[0]; /* NCPI */
} _CON_B3_RESP;
/* CONNECT-B3-ACTIVE-INDICATION */
typedef struct {
byte structs[0]; /* NCPI */
} _CON_B3_A_INDP;
/* CONNECT-B3-ACTIVE-RESPONSE */
typedef struct {
byte structs[0]; /* empty */
} _CON_B3_A_RESP;
/* DISCONNECT-B3-REQUEST */
typedef struct {
byte structs[0]; /* NCPI */
} _DIS_B3_REQP;
/* DISCONNECT-B3-CONFIRM */
typedef struct {
word Info;
} _DIS_B3_CONP;
/* DISCONNECT-B3-INDICATION */
typedef struct {
word Info;
byte structs[0]; /* NCPI */
} _DIS_B3_INDP;
/* DISCONNECT-B3-RESPONSE */
typedef struct {
byte structs[0]; /* empty */
} _DIS_B3_RESP;
/* DATA-B3-REQUEST */
typedef struct {
dword Data;
word Data_Length;
word Number;
word Flags;
} _DAT_B3_REQP;
/* DATA-B3-REQUEST 64 BIT Systems */
typedef struct {
dword Data;
word Data_Length;
word Number;
word Flags;
void *pData;
} _DAT_B3_REQ64P;
/* DATA-B3-CONFIRM */
typedef struct {
word Number;
word Info;
} _DAT_B3_CONP;
/* DATA-B3-INDICATION */
typedef struct {
dword Data;
word Data_Length;
word Number;
word Flags;
} _DAT_B3_INDP;
/* DATA-B3-INDICATION 64 BIT Systems */
typedef struct {
dword Data;
word Data_Length;
word Number;
word Flags;
void *pData;
} _DAT_B3_IND64P;
/* DATA-B3-RESPONSE */
typedef struct {
word Number;
} _DAT_B3_RESP;
/* RESET-B3-REQUEST */
typedef struct {
byte structs[0]; /* NCPI */
} _RES_B3_REQP;
/* RESET-B3-CONFIRM */
typedef struct {
word Info;
} _RES_B3_CONP;
/* RESET-B3-INDICATION */
typedef struct {
byte structs[0]; /* NCPI */
} _RES_B3_INDP;
/* RESET-B3-RESPONSE */
typedef struct {
byte structs[0]; /* empty */
} _RES_B3_RESP;
/* CONNECT-B3-T90-ACTIVE-INDICATION */
typedef struct {
byte structs[0]; /* NCPI */
} _CON_B3_T90_A_INDP;
/* CONNECT-B3-T90-ACTIVE-RESPONSE */
typedef struct {
word Reject;
byte structs[0]; /* NCPI */
} _CON_B3_T90_A_RESP;
/*------------------------------------------------------------------*/
/* message structure */
/*------------------------------------------------------------------*/
typedef struct _API_MSG CAPI_MSG;
typedef struct _MSG_HEADER CAPI_MSG_HEADER;
struct _API_MSG {
struct _MSG_HEADER {
word length;
word appl_id;
word command;
word number;
byte controller;
byte plci;
word ncci;
} header;
union {
_ALT_REQP alert_req;
_ALT_CONP alert_con;
_CON_REQP connect_req;
_CON_CONP connect_con;
_CON_INDP connect_ind;
_CON_RESP connect_res;
_CON_A_INDP connect_a_ind;
_CON_A_RESP connect_a_res;
_DIS_REQP disconnect_req;
_DIS_CONP disconnect_con;
_DIS_INDP disconnect_ind;
_DIS_RESP disconnect_res;
_LIS_REQP listen_req;
_LIS_CONP listen_con;
_INF_REQP info_req;
_INF_CONP info_con;
_INF_INDP info_ind;
_INF_RESP info_res;
_SEL_B_REQP select_b_req;
_SEL_B_CONP select_b_con;
_FAC_REQP facility_req;
_FAC_CONP facility_con;
_FAC_INDP facility_ind;
_FAC_RESP facility_res;
_CON_B3_REQP connect_b3_req;
_CON_B3_CONP connect_b3_con;
_CON_B3_INDP connect_b3_ind;
_CON_B3_RESP connect_b3_res;
_CON_B3_A_INDP connect_b3_a_ind;
_CON_B3_A_RESP connect_b3_a_res;
_DIS_B3_REQP disconnect_b3_req;
_DIS_B3_CONP disconnect_b3_con;
_DIS_B3_INDP disconnect_b3_ind;
_DIS_B3_RESP disconnect_b3_res;
_DAT_B3_REQP data_b3_req;
_DAT_B3_REQ64P data_b3_req64;
_DAT_B3_CONP data_b3_con;
_DAT_B3_INDP data_b3_ind;
_DAT_B3_IND64P data_b3_ind64;
_DAT_B3_RESP data_b3_res;
_RES_B3_REQP reset_b3_req;
_RES_B3_CONP reset_b3_con;
_RES_B3_INDP reset_b3_ind;
_RES_B3_RESP reset_b3_res;
_CON_B3_T90_A_INDP connect_b3_t90_a_ind;
_CON_B3_T90_A_RESP connect_b3_t90_a_res;
byte b[200];
} info;
};
/*------------------------------------------------------------------*/
/* non-fatal errors */
/*------------------------------------------------------------------*/
#define _NCPI_IGNORED 0x0001
#define _FLAGS_IGNORED 0x0002
#define _ALERT_IGNORED 0x0003
/*------------------------------------------------------------------*/
/* API function error codes */
/*------------------------------------------------------------------*/
#define GOOD 0x0000
#define _TOO_MANY_APPLICATIONS 0x1001
#define _BLOCK_TOO_SMALL 0x1002
#define _BUFFER_TOO_BIG 0x1003
#define _MSG_BUFFER_TOO_SMALL 0x1004
#define _TOO_MANY_CONNECTIONS 0x1005
#define _REG_CAPI_BUSY 0x1007
#define _REG_RESOURCE_ERROR 0x1008
#define _REG_CAPI_NOT_INSTALLED 0x1009
#define _WRONG_APPL_ID 0x1101
#define _BAD_MSG 0x1102
#define _QUEUE_FULL 0x1103
#define _GET_NO_MSG 0x1104
#define _MSG_LOST 0x1105
#define _WRONG_NOTIFY 0x1106
#define _CAPI_BUSY 0x1107
#define _RESOURCE_ERROR 0x1108
#define _CAPI_NOT_INSTALLED 0x1109
#define _NO_EXTERNAL_EQUIPMENT 0x110a
#define _ONLY_EXTERNAL_EQUIPMENT 0x110b
/*------------------------------------------------------------------*/
/* addressing/coding error codes */
/*------------------------------------------------------------------*/
#define _WRONG_STATE 0x2001
#define _WRONG_IDENTIFIER 0x2002
#define _OUT_OF_PLCI 0x2003
#define _OUT_OF_NCCI 0x2004
#define _OUT_OF_LISTEN 0x2005
#define _OUT_OF_FAX 0x2006
#define _WRONG_MESSAGE_FORMAT 0x2007
#define _OUT_OF_INTERCONNECT_RESOURCES 0x2008
/*------------------------------------------------------------------*/
/* configuration error codes */
/*------------------------------------------------------------------*/
#define _B1_NOT_SUPPORTED 0x3001
#define _B2_NOT_SUPPORTED 0x3002
#define _B3_NOT_SUPPORTED 0x3003
#define _B1_PARM_NOT_SUPPORTED 0x3004
#define _B2_PARM_NOT_SUPPORTED 0x3005
#define _B3_PARM_NOT_SUPPORTED 0x3006
#define _B_STACK_NOT_SUPPORTED 0x3007
#define _NCPI_NOT_SUPPORTED 0x3008
#define _CIP_NOT_SUPPORTED 0x3009
#define _FLAGS_NOT_SUPPORTED 0x300a
#define _FACILITY_NOT_SUPPORTED 0x300b
#define _DATA_LEN_NOT_SUPPORTED 0x300c
#define _RESET_NOT_SUPPORTED 0x300d
#define _SUPPLEMENTARY_SERVICE_NOT_SUPPORTED 0x300e
#define _REQUEST_NOT_ALLOWED_IN_THIS_STATE 0x3010
#define _FACILITY_SPECIFIC_FUNCTION_NOT_SUPP 0x3011
/*------------------------------------------------------------------*/
/* reason codes */
/*------------------------------------------------------------------*/
#define _L1_ERROR 0x3301
#define _L2_ERROR 0x3302
#define _L3_ERROR 0x3303
#define _OTHER_APPL_CONNECTED 0x3304
#define _CAPI_GUARD_ERROR 0x3305
#define _L3_CAUSE 0x3400
/*------------------------------------------------------------------*/
/* b3 reason codes */
/*------------------------------------------------------------------*/
#define _B_CHANNEL_LOST 0x3301
#define _B2_ERROR 0x3302
#define _B3_ERROR 0x3303
/*------------------------------------------------------------------*/
/* fax error codes */
/*------------------------------------------------------------------*/
#define _FAX_NO_CONNECTION 0x3311
#define _FAX_TRAINING_ERROR 0x3312
#define _FAX_REMOTE_REJECT 0x3313
#define _FAX_REMOTE_ABORT 0x3314
#define _FAX_PROTOCOL_ERROR 0x3315
#define _FAX_TX_UNDERRUN 0x3316
#define _FAX_RX_OVERFLOW 0x3317
#define _FAX_LOCAL_ABORT 0x3318
#define _FAX_PARAMETER_ERROR 0x3319
/*------------------------------------------------------------------*/
/* line interconnect error codes */
/*------------------------------------------------------------------*/
#define _LI_USER_INITIATED 0x0000
#define _LI_LINE_NO_LONGER_AVAILABLE 0x3805
#define _LI_INTERCONNECT_NOT_ESTABLISHED 0x3806
#define _LI_LINES_NOT_COMPATIBLE 0x3807
#define _LI2_USER_INITIATED 0x0000
#define _LI2_PLCI_HAS_NO_BCHANNEL 0x3800
#define _LI2_LINES_NOT_COMPATIBLE 0x3801
#define _LI2_NOT_IN_SAME_INTERCONNECTION 0x3802
/*------------------------------------------------------------------*/
/* global options */
/*------------------------------------------------------------------*/
#define GL_INTERNAL_CONTROLLER_SUPPORTED 0x00000001L
#define GL_EXTERNAL_EQUIPMENT_SUPPORTED 0x00000002L
#define GL_HANDSET_SUPPORTED 0x00000004L
#define GL_DTMF_SUPPORTED 0x00000008L
#define GL_SUPPLEMENTARY_SERVICES_SUPPORTED 0x00000010L
#define GL_CHANNEL_ALLOCATION_SUPPORTED 0x00000020L
#define GL_BCHANNEL_OPERATION_SUPPORTED 0x00000040L
#define GL_LINE_INTERCONNECT_SUPPORTED 0x00000080L
#define GL_ECHO_CANCELLER_SUPPORTED 0x00000100L
/*------------------------------------------------------------------*/
/* protocol selection */
/*------------------------------------------------------------------*/
#define B1_HDLC 0
#define B1_TRANSPARENT 1
#define B1_V110_ASYNC 2
#define B1_V110_SYNC 3
#define B1_T30 4
#define B1_HDLC_INVERTED 5
#define B1_TRANSPARENT_R 6
#define B1_MODEM_ALL_NEGOTIATE 7
#define B1_MODEM_ASYNC 8
#define B1_MODEM_SYNC_HDLC 9
#define B2_X75 0
#define B2_TRANSPARENT 1
#define B2_SDLC 2
#define B2_LAPD 3
#define B2_T30 4
#define B2_PPP 5
#define B2_TRANSPARENT_NO_CRC 6
#define B2_MODEM_EC_COMPRESSION 7
#define B2_X75_V42BIS 8
#define B2_V120_ASYNC 9
#define B2_V120_ASYNC_V42BIS 10
#define B2_V120_BIT_TRANSPARENT 11
#define B2_LAPD_FREE_SAPI_SEL 12
#define B3_TRANSPARENT 0
#define B3_T90NL 1
#define B3_ISO8208 2
#define B3_X25_DCE 3
#define B3_T30 4
#define B3_T30_WITH_EXTENSIONS 5
#define B3_RESERVED 6
#define B3_MODEM 7
/*------------------------------------------------------------------*/
/* facility definitions */
/*------------------------------------------------------------------*/
#define SELECTOR_HANDSET 0
#define SELECTOR_DTMF 1
#define SELECTOR_V42BIS 2
#define SELECTOR_SU_SERV 3
#define SELECTOR_POWER_MANAGEMENT 4
#define SELECTOR_LINE_INTERCONNECT 5
#define SELECTOR_ECHO_CANCELLER 6
/*------------------------------------------------------------------*/
/* supplementary services definitions */
/*------------------------------------------------------------------*/
#define S_GET_SUPPORTED_SERVICES 0x0000
#define S_LISTEN 0x0001
#define S_HOLD 0x0002
#define S_RETRIEVE 0x0003
#define S_SUSPEND 0x0004
#define S_RESUME 0x0005
#define S_ECT 0x0006
#define S_3PTY_BEGIN 0x0007
#define S_3PTY_END 0x0008
#define S_CALL_DEFLECTION 0x000d
#define S_CALL_FORWARDING_START 0x0009
#define S_CALL_FORWARDING_STOP 0x000a
#define S_INTERROGATE_DIVERSION 0x000b /* or interrogate parameters */
#define S_INTERROGATE_NUMBERS 0x000c
#define S_CCBS_REQUEST 0x000f
#define S_CCBS_DEACTIVATE 0x0010
#define S_CCBS_INTERROGATE 0x0011
#define S_CCBS_CALL 0x0012
#define S_MWI_ACTIVATE 0x0013
#define S_MWI_DEACTIVATE 0x0014
#define S_CONF_BEGIN 0x0017
#define S_CONF_ADD 0x0018
#define S_CONF_SPLIT 0x0019
#define S_CONF_DROP 0x001a
#define S_CONF_ISOLATE 0x001b
#define S_CONF_REATTACH 0x001c
#define S_CCBS_ERASECALLLINKAGEID 0x800d
#define S_CCBS_STOP_ALERTING 0x8012
#define S_CCBS_INFO_RETAIN 0x8013
#define S_MWI_INDICATE 0x8014
#define S_CONF_PARTYDISC 0x8016
#define S_CONF_NOTIFICATION 0x8017
/* Service Masks */
#define MASK_HOLD_RETRIEVE 0x00000001
#define MASK_TERMINAL_PORTABILITY 0x00000002
#define MASK_ECT 0x00000004
#define MASK_3PTY 0x00000008
#define MASK_CALL_FORWARDING 0x00000010
#define MASK_CALL_DEFLECTION 0x00000020
#define MASK_MWI 0x00000100
#define MASK_CCNR 0x00000200
#define MASK_CONF 0x00000400
/*------------------------------------------------------------------*/
/* dtmf definitions */
/*------------------------------------------------------------------*/
#define DTMF_LISTEN_START 1
#define DTMF_LISTEN_STOP 2
#define DTMF_DIGITS_SEND 3
#define DTMF_SUCCESS 0
#define DTMF_INCORRECT_DIGIT 1
#define DTMF_UNKNOWN_REQUEST 2
/*------------------------------------------------------------------*/
/* line interconnect definitions */
/*------------------------------------------------------------------*/
#define LI_GET_SUPPORTED_SERVICES 0
#define LI_REQ_CONNECT 1
#define LI_REQ_DISCONNECT 2
#define LI_IND_CONNECT_ACTIVE 1
#define LI_IND_DISCONNECT 2
#define LI_FLAG_CONFERENCE_A_B ((dword) 0x00000001L)
#define LI_FLAG_CONFERENCE_B_A ((dword) 0x00000002L)
#define LI_FLAG_MONITOR_A ((dword) 0x00000004L)
#define LI_FLAG_MONITOR_B ((dword) 0x00000008L)
#define LI_FLAG_ANNOUNCEMENT_A ((dword) 0x00000010L)
#define LI_FLAG_ANNOUNCEMENT_B ((dword) 0x00000020L)
#define LI_FLAG_MIX_A ((dword) 0x00000040L)
#define LI_FLAG_MIX_B ((dword) 0x00000080L)
#define LI_CONFERENCING_SUPPORTED ((dword) 0x00000001L)
#define LI_MONITORING_SUPPORTED ((dword) 0x00000002L)
#define LI_ANNOUNCEMENTS_SUPPORTED ((dword) 0x00000004L)
#define LI_MIXING_SUPPORTED ((dword) 0x00000008L)
#define LI_CROSS_CONTROLLER_SUPPORTED ((dword) 0x00000010L)
#define LI2_GET_SUPPORTED_SERVICES 0
#define LI2_REQ_CONNECT 1
#define LI2_REQ_DISCONNECT 2
#define LI2_IND_CONNECT_ACTIVE 1
#define LI2_IND_DISCONNECT 2
#define LI2_FLAG_INTERCONNECT_A_B ((dword) 0x00000001L)
#define LI2_FLAG_INTERCONNECT_B_A ((dword) 0x00000002L)
#define LI2_FLAG_MONITOR_B ((dword) 0x00000004L)
#define LI2_FLAG_MIX_B ((dword) 0x00000008L)
#define LI2_FLAG_MONITOR_X ((dword) 0x00000010L)
#define LI2_FLAG_MIX_X ((dword) 0x00000020L)
#define LI2_FLAG_LOOP_B ((dword) 0x00000040L)
#define LI2_FLAG_LOOP_PC ((dword) 0x00000080L)
#define LI2_FLAG_LOOP_X ((dword) 0x00000100L)
#define LI2_CROSS_CONTROLLER_SUPPORTED ((dword) 0x00000001L)
#define LI2_ASYMMETRIC_SUPPORTED ((dword) 0x00000002L)
#define LI2_MONITORING_SUPPORTED ((dword) 0x00000004L)
#define LI2_MIXING_SUPPORTED ((dword) 0x00000008L)
#define LI2_REMOTE_MONITORING_SUPPORTED ((dword) 0x00000010L)
#define LI2_REMOTE_MIXING_SUPPORTED ((dword) 0x00000020L)
#define LI2_B_LOOPING_SUPPORTED ((dword) 0x00000040L)
#define LI2_PC_LOOPING_SUPPORTED ((dword) 0x00000080L)
#define LI2_X_LOOPING_SUPPORTED ((dword) 0x00000100L)
/*------------------------------------------------------------------*/
/* echo canceller definitions */
/*------------------------------------------------------------------*/
#define EC_GET_SUPPORTED_SERVICES 0
#define EC_ENABLE_OPERATION 1
#define EC_DISABLE_OPERATION 2
#define EC_ENABLE_NON_LINEAR_PROCESSING 0x0001
#define EC_DO_NOT_REQUIRE_REVERSALS 0x0002
#define EC_DETECT_DISABLE_TONE 0x0004
#define EC_ENABLE_ADAPTIVE_PREDELAY 0x0008
#define EC_NON_LINEAR_PROCESSING_SUPPORTED 0x0001
#define EC_BYPASS_ON_ANY_2100HZ_SUPPORTED 0x0002
#define EC_BYPASS_ON_REV_2100HZ_SUPPORTED 0x0004
#define EC_ADAPTIVE_PREDELAY_SUPPORTED 0x0008
#define EC_BYPASS_INDICATION 1
#define EC_BYPASS_DUE_TO_CONTINUOUS_2100HZ 1
#define EC_BYPASS_DUE_TO_REVERSED_2100HZ 2
#define EC_BYPASS_RELEASED 3
/*------------------------------------------------------------------*/
/* function prototypes */
/*------------------------------------------------------------------*/
/*------------------------------------------------------------------*/
#endif /* _INC_CAPI20 */

View File

@ -1,685 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include "platform.h"
#include "capidtmf.h"
/* #define TRACE_ */
#define FILE_ "CAPIDTMF.C"
/*---------------------------------------------------------------------------*/
#define trace(a)
/*---------------------------------------------------------------------------*/
static short capidtmf_expand_table_alaw[0x0100] =
{
-5504, 5504, -344, 344, -22016, 22016, -1376, 1376,
-2752, 2752, -88, 88, -11008, 11008, -688, 688,
-7552, 7552, -472, 472, -30208, 30208, -1888, 1888,
-3776, 3776, -216, 216, -15104, 15104, -944, 944,
-4480, 4480, -280, 280, -17920, 17920, -1120, 1120,
-2240, 2240, -24, 24, -8960, 8960, -560, 560,
-6528, 6528, -408, 408, -26112, 26112, -1632, 1632,
-3264, 3264, -152, 152, -13056, 13056, -816, 816,
-6016, 6016, -376, 376, -24064, 24064, -1504, 1504,
-3008, 3008, -120, 120, -12032, 12032, -752, 752,
-8064, 8064, -504, 504, -32256, 32256, -2016, 2016,
-4032, 4032, -248, 248, -16128, 16128, -1008, 1008,
-4992, 4992, -312, 312, -19968, 19968, -1248, 1248,
-2496, 2496, -56, 56, -9984, 9984, -624, 624,
-7040, 7040, -440, 440, -28160, 28160, -1760, 1760,
-3520, 3520, -184, 184, -14080, 14080, -880, 880,
-5248, 5248, -328, 328, -20992, 20992, -1312, 1312,
-2624, 2624, -72, 72, -10496, 10496, -656, 656,
-7296, 7296, -456, 456, -29184, 29184, -1824, 1824,
-3648, 3648, -200, 200, -14592, 14592, -912, 912,
-4224, 4224, -264, 264, -16896, 16896, -1056, 1056,
-2112, 2112, -8, 8, -8448, 8448, -528, 528,
-6272, 6272, -392, 392, -25088, 25088, -1568, 1568,
-3136, 3136, -136, 136, -12544, 12544, -784, 784,
-5760, 5760, -360, 360, -23040, 23040, -1440, 1440,
-2880, 2880, -104, 104, -11520, 11520, -720, 720,
-7808, 7808, -488, 488, -31232, 31232, -1952, 1952,
-3904, 3904, -232, 232, -15616, 15616, -976, 976,
-4736, 4736, -296, 296, -18944, 18944, -1184, 1184,
-2368, 2368, -40, 40, -9472, 9472, -592, 592,
-6784, 6784, -424, 424, -27136, 27136, -1696, 1696,
-3392, 3392, -168, 168, -13568, 13568, -848, 848
};
static short capidtmf_expand_table_ulaw[0x0100] =
{
-32124, 32124, -1884, 1884, -7932, 7932, -372, 372,
-15996, 15996, -876, 876, -3900, 3900, -120, 120,
-23932, 23932, -1372, 1372, -5884, 5884, -244, 244,
-11900, 11900, -620, 620, -2876, 2876, -56, 56,
-28028, 28028, -1628, 1628, -6908, 6908, -308, 308,
-13948, 13948, -748, 748, -3388, 3388, -88, 88,
-19836, 19836, -1116, 1116, -4860, 4860, -180, 180,
-9852, 9852, -492, 492, -2364, 2364, -24, 24,
-30076, 30076, -1756, 1756, -7420, 7420, -340, 340,
-14972, 14972, -812, 812, -3644, 3644, -104, 104,
-21884, 21884, -1244, 1244, -5372, 5372, -212, 212,
-10876, 10876, -556, 556, -2620, 2620, -40, 40,
-25980, 25980, -1500, 1500, -6396, 6396, -276, 276,
-12924, 12924, -684, 684, -3132, 3132, -72, 72,
-17788, 17788, -988, 988, -4348, 4348, -148, 148,
-8828, 8828, -428, 428, -2108, 2108, -8, 8,
-31100, 31100, -1820, 1820, -7676, 7676, -356, 356,
-15484, 15484, -844, 844, -3772, 3772, -112, 112,
-22908, 22908, -1308, 1308, -5628, 5628, -228, 228,
-11388, 11388, -588, 588, -2748, 2748, -48, 48,
-27004, 27004, -1564, 1564, -6652, 6652, -292, 292,
-13436, 13436, -716, 716, -3260, 3260, -80, 80,
-18812, 18812, -1052, 1052, -4604, 4604, -164, 164,
-9340, 9340, -460, 460, -2236, 2236, -16, 16,
-29052, 29052, -1692, 1692, -7164, 7164, -324, 324,
-14460, 14460, -780, 780, -3516, 3516, -96, 96,
-20860, 20860, -1180, 1180, -5116, 5116, -196, 196,
-10364, 10364, -524, 524, -2492, 2492, -32, 32,
-24956, 24956, -1436, 1436, -6140, 6140, -260, 260,
-12412, 12412, -652, 652, -3004, 3004, -64, 64,
-16764, 16764, -924, 924, -4092, 4092, -132, 132,
-8316, 8316, -396, 396, -1980, 1980, 0, 0
};
/*---------------------------------------------------------------------------*/
static short capidtmf_recv_window_function[CAPIDTMF_RECV_ACCUMULATE_CYCLES] =
{
-500L, -999L, -1499L, -1998L, -2496L, -2994L, -3491L, -3988L,
-4483L, -4978L, -5471L, -5963L, -6454L, -6943L, -7431L, -7917L,
-8401L, -8883L, -9363L, -9840L, -10316L, -10789L, -11259L, -11727L,
-12193L, -12655L, -13115L, -13571L, -14024L, -14474L, -14921L, -15364L,
-15804L, -16240L, -16672L, -17100L, -17524L, -17944L, -18360L, -18772L,
-19180L, -19583L, -19981L, -20375L, -20764L, -21148L, -21527L, -21901L,
-22270L, -22634L, -22993L, -23346L, -23694L, -24037L, -24374L, -24705L,
-25030L, -25350L, -25664L, -25971L, -26273L, -26568L, -26858L, -27141L,
-27418L, -27688L, -27952L, -28210L, -28461L, -28705L, -28943L, -29174L,
-29398L, -29615L, -29826L, -30029L, -30226L, -30415L, -30598L, -30773L,
-30941L, -31102L, -31256L, -31402L, -31541L, -31673L, -31797L, -31914L,
-32024L, -32126L, -32221L, -32308L, -32388L, -32460L, -32524L, -32581L,
-32631L, -32673L, -32707L, -32734L, -32753L, -32764L, -32768L, -32764L,
-32753L, -32734L, -32707L, -32673L, -32631L, -32581L, -32524L, -32460L,
-32388L, -32308L, -32221L, -32126L, -32024L, -31914L, -31797L, -31673L,
-31541L, -31402L, -31256L, -31102L, -30941L, -30773L, -30598L, -30415L,
-30226L, -30029L, -29826L, -29615L, -29398L, -29174L, -28943L, -28705L,
-28461L, -28210L, -27952L, -27688L, -27418L, -27141L, -26858L, -26568L,
-26273L, -25971L, -25664L, -25350L, -25030L, -24705L, -24374L, -24037L,
-23694L, -23346L, -22993L, -22634L, -22270L, -21901L, -21527L, -21148L,
-20764L, -20375L, -19981L, -19583L, -19180L, -18772L, -18360L, -17944L,
-17524L, -17100L, -16672L, -16240L, -15804L, -15364L, -14921L, -14474L,
-14024L, -13571L, -13115L, -12655L, -12193L, -11727L, -11259L, -10789L,
-10316L, -9840L, -9363L, -8883L, -8401L, -7917L, -7431L, -6943L,
-6454L, -5963L, -5471L, -4978L, -4483L, -3988L, -3491L, -2994L,
-2496L, -1998L, -1499L, -999L, -500L,
};
static byte capidtmf_leading_zeroes_table[0x100] =
{
8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
#define capidtmf_byte_leading_zeroes(b) (capidtmf_leading_zeroes_table[(BYTE)(b)])
#define capidtmf_word_leading_zeroes(w) (((w) & 0xff00) ? capidtmf_leading_zeroes_table[(w) >> 8] : 8 + capidtmf_leading_zeroes_table[(w)])
#define capidtmf_dword_leading_zeroes(d) (((d) & 0xffff0000L) ? (((d) & 0xff000000L) ? capidtmf_leading_zeroes_table[(d) >> 24] : 8 + capidtmf_leading_zeroes_table[(d) >> 16]) : (((d) & 0xff00) ? 16 + capidtmf_leading_zeroes_table[(d) >> 8] : 24 + capidtmf_leading_zeroes_table[(d)]))
/*---------------------------------------------------------------------------*/
static void capidtmf_goertzel_loop(long *buffer, long *coeffs, short *sample, long count)
{
int i, j;
long c, d, q0, q1, q2;
for (i = 0; i < CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT - 1; i++)
{
q1 = buffer[i];
q2 = buffer[i + CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT];
d = coeffs[i] >> 1;
c = d << 1;
if (c >= 0)
{
for (j = 0; j < count; j++)
{
q0 = sample[j] - q2 + (c * (q1 >> 16)) + (((dword)(((dword) d) * ((dword)(q1 & 0xffff)))) >> 15);
q2 = q1;
q1 = q0;
}
}
else
{
c = -c;
d = -d;
for (j = 0; j < count; j++)
{
q0 = sample[j] - q2 - ((c * (q1 >> 16)) + (((dword)(((dword) d) * ((dword)(q1 & 0xffff)))) >> 15));
q2 = q1;
q1 = q0;
}
}
buffer[i] = q1;
buffer[i + CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT] = q2;
}
q1 = buffer[i];
q2 = buffer[i + CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT];
c = (coeffs[i] >> 1) << 1;
if (c >= 0)
{
for (j = 0; j < count; j++)
{
q0 = sample[j] - q2 + (c * (q1 >> 16)) + (((dword)(((dword)(c >> 1)) * ((dword)(q1 & 0xffff)))) >> 15);
q2 = q1;
q1 = q0;
c -= CAPIDTMF_RECV_FUNDAMENTAL_DECREMENT;
}
}
else
{
c = -c;
for (j = 0; j < count; j++)
{
q0 = sample[j] - q2 - ((c * (q1 >> 16)) + (((dword)(((dword)(c >> 1)) * ((dword)(q1 & 0xffff)))) >> 15));
q2 = q1;
q1 = q0;
c += CAPIDTMF_RECV_FUNDAMENTAL_DECREMENT;
}
}
coeffs[i] = c;
buffer[i] = q1;
buffer[i + CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT] = q2;
}
static void capidtmf_goertzel_result(long *buffer, long *coeffs)
{
int i;
long d, e, q1, q2, lo, mid, hi;
dword k;
for (i = 0; i < CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT; i++)
{
q1 = buffer[i];
q2 = buffer[i + CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT];
d = coeffs[i] >> 1;
if (d >= 0)
d = ((d << 1) * (-q1 >> 16)) + (((dword)(((dword) d) * ((dword)(-q1 & 0xffff)))) >> 15);
else
d = ((-d << 1) * (-q1 >> 16)) + (((dword)(((dword) -d) * ((dword)(-q1 & 0xffff)))) >> 15);
e = (q2 >= 0) ? q2 : -q2;
if (d >= 0)
{
k = ((dword)(d & 0xffff)) * ((dword)(e & 0xffff));
lo = k & 0xffff;
mid = k >> 16;
k = ((dword)(d >> 16)) * ((dword)(e & 0xffff));
mid += k & 0xffff;
hi = k >> 16;
k = ((dword)(d & 0xffff)) * ((dword)(e >> 16));
mid += k & 0xffff;
hi += k >> 16;
hi += ((dword)(d >> 16)) * ((dword)(e >> 16));
}
else
{
d = -d;
k = ((dword)(d & 0xffff)) * ((dword)(e & 0xffff));
lo = -((long)(k & 0xffff));
mid = -((long)(k >> 16));
k = ((dword)(d >> 16)) * ((dword)(e & 0xffff));
mid -= k & 0xffff;
hi = -((long)(k >> 16));
k = ((dword)(d & 0xffff)) * ((dword)(e >> 16));
mid -= k & 0xffff;
hi -= k >> 16;
hi -= ((dword)(d >> 16)) * ((dword)(e >> 16));
}
if (q2 < 0)
{
lo = -lo;
mid = -mid;
hi = -hi;
}
d = (q1 >= 0) ? q1 : -q1;
k = ((dword)(d & 0xffff)) * ((dword)(d & 0xffff));
lo += k & 0xffff;
mid += k >> 16;
k = ((dword)(d >> 16)) * ((dword)(d & 0xffff));
mid += (k & 0xffff) << 1;
hi += (k >> 16) << 1;
hi += ((dword)(d >> 16)) * ((dword)(d >> 16));
d = (q2 >= 0) ? q2 : -q2;
k = ((dword)(d & 0xffff)) * ((dword)(d & 0xffff));
lo += k & 0xffff;
mid += k >> 16;
k = ((dword)(d >> 16)) * ((dword)(d & 0xffff));
mid += (k & 0xffff) << 1;
hi += (k >> 16) << 1;
hi += ((dword)(d >> 16)) * ((dword)(d >> 16));
mid += lo >> 16;
hi += mid >> 16;
buffer[i] = (lo & 0xffff) | (mid << 16);
buffer[i + CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT] = hi;
}
}
/*---------------------------------------------------------------------------*/
#define CAPIDTMF_RECV_GUARD_SNR_INDEX_697 0
#define CAPIDTMF_RECV_GUARD_SNR_INDEX_770 1
#define CAPIDTMF_RECV_GUARD_SNR_INDEX_852 2
#define CAPIDTMF_RECV_GUARD_SNR_INDEX_941 3
#define CAPIDTMF_RECV_GUARD_SNR_INDEX_1209 4
#define CAPIDTMF_RECV_GUARD_SNR_INDEX_1336 5
#define CAPIDTMF_RECV_GUARD_SNR_INDEX_1477 6
#define CAPIDTMF_RECV_GUARD_SNR_INDEX_1633 7
#define CAPIDTMF_RECV_GUARD_SNR_INDEX_635 8
#define CAPIDTMF_RECV_GUARD_SNR_INDEX_1010 9
#define CAPIDTMF_RECV_GUARD_SNR_INDEX_1140 10
#define CAPIDTMF_RECV_GUARD_SNR_INDEX_1272 11
#define CAPIDTMF_RECV_GUARD_SNR_INDEX_1405 12
#define CAPIDTMF_RECV_GUARD_SNR_INDEX_1555 13
#define CAPIDTMF_RECV_GUARD_SNR_INDEX_1715 14
#define CAPIDTMF_RECV_GUARD_SNR_INDEX_1875 15
#define CAPIDTMF_RECV_GUARD_SNR_DONTCARE 0xc000
#define CAPIDTMF_RECV_NO_DIGIT 0xff
#define CAPIDTMF_RECV_TIME_GRANULARITY (CAPIDTMF_RECV_ACCUMULATE_CYCLES + 1)
#define CAPIDTMF_RECV_INDICATION_DIGIT 0x0001
static long capidtmf_recv_goertzel_coef_table[CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT] =
{
0xda97L * 2, /* 697 Hz (Low group 697 Hz) */
0xd299L * 2, /* 770 Hz (Low group 770 Hz) */
0xc8cbL * 2, /* 852 Hz (Low group 852 Hz) */
0xbd36L * 2, /* 941 Hz (Low group 941 Hz) */
0x9501L * 2, /* 1209 Hz (High group 1209 Hz) */
0x7f89L * 2, /* 1336 Hz (High group 1336 Hz) */
0x6639L * 2, /* 1477 Hz (High group 1477 Hz) */
0x48c6L * 2, /* 1633 Hz (High group 1633 Hz) */
0xe14cL * 2, /* 630 Hz (Lower guard of low group 631 Hz) */
0xb2e0L * 2, /* 1015 Hz (Upper guard of low group 1039 Hz) */
0xa1a0L * 2, /* 1130 Hz (Lower guard of high group 1140 Hz) */
0x8a87L * 2, /* 1272 Hz (Guard between 1209 Hz and 1336 Hz: 1271 Hz) */
0x7353L * 2, /* 1405 Hz (2nd harmonics of 697 Hz and guard between 1336 Hz and 1477 Hz: 1405 Hz) */
0x583bL * 2, /* 1552 Hz (2nd harmonics of 770 Hz and guard between 1477 Hz and 1633 Hz: 1553 Hz) */
0x37d8L * 2, /* 1720 Hz (2nd harmonics of 852 Hz and upper guard of high group: 1715 Hz) */
0x0000L * 2 /* 100-630 Hz (fundamentals) */
};
static word capidtmf_recv_guard_snr_low_table[CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT] =
{
14, /* Low group peak versus 697 Hz */
14, /* Low group peak versus 770 Hz */
16, /* Low group peak versus 852 Hz */
16, /* Low group peak versus 941 Hz */
CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* Low group peak versus 1209 Hz */
CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* Low group peak versus 1336 Hz */
CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* Low group peak versus 1477 Hz */
CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* Low group peak versus 1633 Hz */
14, /* Low group peak versus 635 Hz */
16, /* Low group peak versus 1010 Hz */
CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* Low group peak versus 1140 Hz */
CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* Low group peak versus 1272 Hz */
DSPDTMF_RX_HARMONICS_SEL_DEFAULT - 8, /* Low group peak versus 1405 Hz */
DSPDTMF_RX_HARMONICS_SEL_DEFAULT - 4, /* Low group peak versus 1555 Hz */
DSPDTMF_RX_HARMONICS_SEL_DEFAULT - 4, /* Low group peak versus 1715 Hz */
12 /* Low group peak versus 100-630 Hz */
};
static word capidtmf_recv_guard_snr_high_table[CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT] =
{
CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* High group peak versus 697 Hz */
CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* High group peak versus 770 Hz */
CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* High group peak versus 852 Hz */
CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* High group peak versus 941 Hz */
20, /* High group peak versus 1209 Hz */
20, /* High group peak versus 1336 Hz */
20, /* High group peak versus 1477 Hz */
20, /* High group peak versus 1633 Hz */
CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* High group peak versus 635 Hz */
CAPIDTMF_RECV_GUARD_SNR_DONTCARE, /* High group peak versus 1010 Hz */
16, /* High group peak versus 1140 Hz */
4, /* High group peak versus 1272 Hz */
6, /* High group peak versus 1405 Hz */
8, /* High group peak versus 1555 Hz */
16, /* High group peak versus 1715 Hz */
12 /* High group peak versus 100-630 Hz */
};
/*---------------------------------------------------------------------------*/
static void capidtmf_recv_init(t_capidtmf_state *p_state)
{
p_state->recv.min_gap_duration = 1;
p_state->recv.min_digit_duration = 1;
p_state->recv.cycle_counter = 0;
p_state->recv.current_digit_on_time = 0;
p_state->recv.current_digit_off_time = 0;
p_state->recv.current_digit_value = CAPIDTMF_RECV_NO_DIGIT;
p_state->recv.digit_write_pos = 0;
p_state->recv.digit_read_pos = 0;
p_state->recv.indication_state = 0;
p_state->recv.indication_state_ack = 0;
p_state->recv.state = CAPIDTMF_RECV_STATE_IDLE;
}
void capidtmf_recv_enable(t_capidtmf_state *p_state, word min_digit_duration, word min_gap_duration)
{
p_state->recv.indication_state_ack &= CAPIDTMF_RECV_INDICATION_DIGIT;
p_state->recv.min_digit_duration = (word)(((((dword) min_digit_duration) * 8) +
((dword)(CAPIDTMF_RECV_TIME_GRANULARITY / 2))) / ((dword) CAPIDTMF_RECV_TIME_GRANULARITY));
if (p_state->recv.min_digit_duration <= 1)
p_state->recv.min_digit_duration = 1;
else
(p_state->recv.min_digit_duration)--;
p_state->recv.min_gap_duration =
(word)((((dword) min_gap_duration) * 8) / ((dword) CAPIDTMF_RECV_TIME_GRANULARITY));
if (p_state->recv.min_gap_duration <= 1)
p_state->recv.min_gap_duration = 1;
else
(p_state->recv.min_gap_duration)--;
p_state->recv.state |= CAPIDTMF_RECV_STATE_DTMF_ACTIVE;
}
void capidtmf_recv_disable(t_capidtmf_state *p_state)
{
p_state->recv.state &= ~CAPIDTMF_RECV_STATE_DTMF_ACTIVE;
if (p_state->recv.state == CAPIDTMF_RECV_STATE_IDLE)
capidtmf_recv_init(p_state);
else
{
p_state->recv.cycle_counter = 0;
p_state->recv.current_digit_on_time = 0;
p_state->recv.current_digit_off_time = 0;
p_state->recv.current_digit_value = CAPIDTMF_RECV_NO_DIGIT;
}
}
word capidtmf_recv_indication(t_capidtmf_state *p_state, byte *buffer)
{
word i, j, k, flags;
flags = p_state->recv.indication_state ^ p_state->recv.indication_state_ack;
p_state->recv.indication_state_ack ^= flags & CAPIDTMF_RECV_INDICATION_DIGIT;
if (p_state->recv.digit_write_pos != p_state->recv.digit_read_pos)
{
i = 0;
k = p_state->recv.digit_write_pos;
j = p_state->recv.digit_read_pos;
do
{
buffer[i++] = p_state->recv.digit_buffer[j];
j = (j == CAPIDTMF_RECV_DIGIT_BUFFER_SIZE - 1) ? 0 : j + 1;
} while (j != k);
p_state->recv.digit_read_pos = k;
return (i);
}
p_state->recv.indication_state_ack ^= flags;
return (0);
}
#define CAPIDTMF_RECV_WINDOWED_SAMPLES 32
void capidtmf_recv_block(t_capidtmf_state *p_state, byte *buffer, word length)
{
byte result_digit;
word sample_number, cycle_counter, n, i;
word low_peak, high_peak;
dword lo, hi;
byte *p;
short *q;
byte goertzel_result_buffer[CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT];
short windowed_sample_buffer[CAPIDTMF_RECV_WINDOWED_SAMPLES];
if (p_state->recv.state & CAPIDTMF_RECV_STATE_DTMF_ACTIVE)
{
cycle_counter = p_state->recv.cycle_counter;
sample_number = 0;
while (sample_number < length)
{
if (cycle_counter < CAPIDTMF_RECV_ACCUMULATE_CYCLES)
{
if (cycle_counter == 0)
{
for (i = 0; i < CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT; i++)
{
p_state->recv.goertzel_buffer[0][i] = 0;
p_state->recv.goertzel_buffer[1][i] = 0;
}
}
n = CAPIDTMF_RECV_ACCUMULATE_CYCLES - cycle_counter;
if (n > length - sample_number)
n = length - sample_number;
if (n > CAPIDTMF_RECV_WINDOWED_SAMPLES)
n = CAPIDTMF_RECV_WINDOWED_SAMPLES;
p = buffer + sample_number;
q = capidtmf_recv_window_function + cycle_counter;
if (p_state->ulaw)
{
for (i = 0; i < n; i++)
{
windowed_sample_buffer[i] =
(short)((capidtmf_expand_table_ulaw[p[i]] * ((long)(q[i]))) >> 15);
}
}
else
{
for (i = 0; i < n; i++)
{
windowed_sample_buffer[i] =
(short)((capidtmf_expand_table_alaw[p[i]] * ((long)(q[i]))) >> 15);
}
}
capidtmf_recv_goertzel_coef_table[CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT - 1] = CAPIDTMF_RECV_FUNDAMENTAL_OFFSET;
capidtmf_goertzel_loop(p_state->recv.goertzel_buffer[0],
capidtmf_recv_goertzel_coef_table, windowed_sample_buffer, n);
cycle_counter += n;
sample_number += n;
}
else
{
capidtmf_goertzel_result(p_state->recv.goertzel_buffer[0],
capidtmf_recv_goertzel_coef_table);
for (i = 0; i < CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT; i++)
{
lo = (dword)(p_state->recv.goertzel_buffer[0][i]);
hi = (dword)(p_state->recv.goertzel_buffer[1][i]);
if (hi != 0)
{
n = capidtmf_dword_leading_zeroes(hi);
hi = (hi << n) | (lo >> (32 - n));
}
else
{
n = capidtmf_dword_leading_zeroes(lo);
hi = lo << n;
n += 32;
}
n = 195 - 3 * n;
if (hi >= 0xcb300000L)
n += 2;
else if (hi >= 0xa1450000L)
n++;
goertzel_result_buffer[i] = (byte) n;
}
low_peak = DSPDTMF_RX_SENSITIVITY_LOW_DEFAULT;
result_digit = CAPIDTMF_RECV_NO_DIGIT;
for (i = 0; i < CAPIDTMF_LOW_GROUP_FREQUENCIES; i++)
{
if (goertzel_result_buffer[i] > low_peak)
{
low_peak = goertzel_result_buffer[i];
result_digit = (byte) i;
}
}
high_peak = DSPDTMF_RX_SENSITIVITY_HIGH_DEFAULT;
n = CAPIDTMF_RECV_NO_DIGIT;
for (i = CAPIDTMF_LOW_GROUP_FREQUENCIES; i < CAPIDTMF_RECV_BASE_FREQUENCY_COUNT; i++)
{
if (goertzel_result_buffer[i] > high_peak)
{
high_peak = goertzel_result_buffer[i];
n = (i - CAPIDTMF_LOW_GROUP_FREQUENCIES) << 2;
}
}
result_digit |= (byte) n;
if (low_peak + DSPDTMF_RX_HIGH_EXCEEDING_LOW_DEFAULT < high_peak)
result_digit = CAPIDTMF_RECV_NO_DIGIT;
if (high_peak + DSPDTMF_RX_LOW_EXCEEDING_HIGH_DEFAULT < low_peak)
result_digit = CAPIDTMF_RECV_NO_DIGIT;
n = 0;
for (i = 0; i < CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT; i++)
{
if ((((short)(low_peak - goertzel_result_buffer[i] - capidtmf_recv_guard_snr_low_table[i])) < 0)
|| (((short)(high_peak - goertzel_result_buffer[i] - capidtmf_recv_guard_snr_high_table[i])) < 0))
{
n++;
}
}
if (n != 2)
result_digit = CAPIDTMF_RECV_NO_DIGIT;
if (result_digit == CAPIDTMF_RECV_NO_DIGIT)
{
if (p_state->recv.current_digit_on_time != 0)
{
if (++(p_state->recv.current_digit_off_time) >= p_state->recv.min_gap_duration)
{
p_state->recv.current_digit_on_time = 0;
p_state->recv.current_digit_off_time = 0;
}
}
else
{
if (p_state->recv.current_digit_off_time != 0)
(p_state->recv.current_digit_off_time)--;
}
}
else
{
if ((p_state->recv.current_digit_on_time == 0)
&& (p_state->recv.current_digit_off_time != 0))
{
(p_state->recv.current_digit_off_time)--;
}
else
{
n = p_state->recv.current_digit_off_time;
if ((p_state->recv.current_digit_on_time != 0)
&& (result_digit != p_state->recv.current_digit_value))
{
p_state->recv.current_digit_on_time = 0;
n = 0;
}
p_state->recv.current_digit_value = result_digit;
p_state->recv.current_digit_off_time = 0;
if (p_state->recv.current_digit_on_time != 0xffff)
{
p_state->recv.current_digit_on_time += n + 1;
if (p_state->recv.current_digit_on_time >= p_state->recv.min_digit_duration)
{
p_state->recv.current_digit_on_time = 0xffff;
i = (p_state->recv.digit_write_pos == CAPIDTMF_RECV_DIGIT_BUFFER_SIZE - 1) ?
0 : p_state->recv.digit_write_pos + 1;
if (i == p_state->recv.digit_read_pos)
{
trace(dprintf("%s,%d: Receive digit overrun",
(char *)(FILE_), __LINE__));
}
else
{
p_state->recv.digit_buffer[p_state->recv.digit_write_pos] = result_digit;
p_state->recv.digit_write_pos = i;
p_state->recv.indication_state =
(p_state->recv.indication_state & ~CAPIDTMF_RECV_INDICATION_DIGIT) |
(~p_state->recv.indication_state_ack & CAPIDTMF_RECV_INDICATION_DIGIT);
}
}
}
}
}
cycle_counter = 0;
sample_number++;
}
}
p_state->recv.cycle_counter = cycle_counter;
}
}
void capidtmf_init(t_capidtmf_state *p_state, byte ulaw)
{
p_state->ulaw = ulaw;
capidtmf_recv_init(p_state);
}
/*---------------------------------------------------------------------------*/

View File

@ -1,79 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef CAPIDTMF_H_
#define CAPIDTMF_H_
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
#define CAPIDTMF_TONE_GROUP_COUNT 2
#define CAPIDTMF_LOW_GROUP_FREQUENCIES 4
#define CAPIDTMF_HIGH_GROUP_FREQUENCIES 4
#define DSPDTMF_RX_SENSITIVITY_LOW_DEFAULT 50 /* -52 dBm */
#define DSPDTMF_RX_SENSITIVITY_HIGH_DEFAULT 50 /* -52 dBm */
#define DSPDTMF_RX_HIGH_EXCEEDING_LOW_DEFAULT 10 /* dB */
#define DSPDTMF_RX_LOW_EXCEEDING_HIGH_DEFAULT 10 /* dB */
#define DSPDTMF_RX_HARMONICS_SEL_DEFAULT 12 /* dB */
#define CAPIDTMF_RECV_BASE_FREQUENCY_COUNT (CAPIDTMF_LOW_GROUP_FREQUENCIES + CAPIDTMF_HIGH_GROUP_FREQUENCIES)
#define CAPIDTMF_RECV_GUARD_FREQUENCY_COUNT 8
#define CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT (CAPIDTMF_RECV_BASE_FREQUENCY_COUNT + CAPIDTMF_RECV_GUARD_FREQUENCY_COUNT)
#define CAPIDTMF_RECV_POSITIVE_COEFF_COUNT 16
#define CAPIDTMF_RECV_NEGATIVE_COEFF_COUNT (CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT - CAPIDTMF_RECV_POSITIVE_COEFF_COUNT)
#define CAPIDTMF_RECV_ACCUMULATE_CYCLES 205
#define CAPIDTMF_RECV_FUNDAMENTAL_OFFSET (0xff35L * 2)
#define CAPIDTMF_RECV_FUNDAMENTAL_DECREMENT (0x0028L * 2)
#define CAPIDTMF_RECV_DIGIT_BUFFER_SIZE 32
#define CAPIDTMF_RECV_STATE_IDLE 0x00
#define CAPIDTMF_RECV_STATE_DTMF_ACTIVE 0x01
typedef struct tag_capidtmf_recv_state
{
byte digit_buffer[CAPIDTMF_RECV_DIGIT_BUFFER_SIZE];
word digit_write_pos;
word digit_read_pos;
word indication_state;
word indication_state_ack;
long goertzel_buffer[2][CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT];
word min_gap_duration;
word min_digit_duration;
word cycle_counter;
word current_digit_on_time;
word current_digit_off_time;
byte current_digit_value;
byte state;
} t_capidtmf_recv_state;
typedef struct tag_capidtmf_state
{
byte ulaw;
t_capidtmf_recv_state recv;
} t_capidtmf_state;
word capidtmf_recv_indication(t_capidtmf_state *p_state, byte *buffer);
void capidtmf_recv_block(t_capidtmf_state *p_state, byte *buffer, word length);
void capidtmf_init(t_capidtmf_state *p_state, byte ulaw);
void capidtmf_recv_enable(t_capidtmf_state *p_state, word min_digit_duration, word min_gap_duration);
void capidtmf_recv_disable(t_capidtmf_state *p_state);
#define capidtmf_indication(p_state, buffer) (((p_state)->recv.indication_state != (p_state)->recv.indication_state_ack) ? capidtmf_recv_indication(p_state, buffer) : 0)
#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); }
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,40 +0,0 @@
/* $Id: capifunc.h,v 1.11.4.1 2004/08/28 20:03:53 armin Exp $
*
* ISDN interface module for Eicon active cards DIVA.
* CAPI Interface common functions
*
* Copyright 2000-2003 by Armin Schindler (mac@melware.de)
* Copyright 2000-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*/
#ifndef __CAPIFUNC_H__
#define __CAPIFUNC_H__
#define DRRELMAJOR 2
#define DRRELMINOR 0
#define DRRELEXTRA ""
#define M_COMPANY "Eicon Networks"
extern char DRIVERRELEASE_CAPI[];
typedef struct _diva_card {
struct list_head list;
int remove_in_progress;
int Id;
struct capi_ctr capi_ctrl;
DIVA_CAPI_ADAPTER *adapter;
DESCRIPTOR d;
char name[32];
} diva_card;
/*
* prototypes
*/
int init_capifunc(void);
void finit_capifunc(void);
#endif /* __CAPIFUNC_H__ */

View File

@ -1,141 +0,0 @@
/* $Id: capimain.c,v 1.24 2003/09/09 06:51:05 schindler Exp $
*
* ISDN interface module for Eicon active cards DIVA.
* CAPI Interface
*
* Copyright 2000-2003 by Armin Schindler (mac@melware.de)
* Copyright 2000-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*/
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/uaccess.h>
#include <linux/seq_file.h>
#include <linux/skbuff.h>
#include "os_capi.h"
#include "platform.h"
#include "di_defs.h"
#include "capi20.h"
#include "divacapi.h"
#include "cp_vers.h"
#include "capifunc.h"
static char *main_revision = "$Revision: 1.24 $";
static char *DRIVERNAME =
"Eicon DIVA - CAPI Interface driver (http://www.melware.net)";
static char *DRIVERLNAME = "divacapi";
MODULE_DESCRIPTION("CAPI driver for Eicon DIVA cards");
MODULE_AUTHOR("Cytronics & Melware, Eicon Networks");
MODULE_SUPPORTED_DEVICE("CAPI and DIVA card drivers");
MODULE_LICENSE("GPL");
/*
* get revision number from revision string
*/
static char *getrev(const char *revision)
{
char *rev;
char *p;
if ((p = strchr(revision, ':'))) {
rev = p + 2;
p = strchr(rev, '$');
*--p = 0;
} else
rev = "1.0";
return rev;
}
/*
* alloc a message buffer
*/
diva_os_message_buffer_s *diva_os_alloc_message_buffer(unsigned long size,
void **data_buf)
{
diva_os_message_buffer_s *dmb = alloc_skb(size, GFP_ATOMIC);
if (dmb) {
*data_buf = skb_put(dmb, size);
}
return (dmb);
}
/*
* free a message buffer
*/
void diva_os_free_message_buffer(diva_os_message_buffer_s *dmb)
{
kfree_skb(dmb);
}
/*
* proc function for controller info
*/
static int diva_ctl_proc_show(struct seq_file *m, void *v)
{
struct capi_ctr *ctrl = m->private;
diva_card *card = (diva_card *) ctrl->driverdata;
seq_printf(m, "%s\n", ctrl->name);
seq_printf(m, "Serial No. : %s\n", ctrl->serial);
seq_printf(m, "Id : %d\n", card->Id);
seq_printf(m, "Channels : %d\n", card->d.channels);
return 0;
}
/*
* set additional os settings in capi_ctr struct
*/
void diva_os_set_controller_struct(struct capi_ctr *ctrl)
{
ctrl->driver_name = DRIVERLNAME;
ctrl->load_firmware = NULL;
ctrl->reset_ctr = NULL;
ctrl->proc_show = diva_ctl_proc_show;
ctrl->owner = THIS_MODULE;
}
/*
* module init
*/
static int __init divacapi_init(void)
{
char tmprev[32];
int ret = 0;
sprintf(DRIVERRELEASE_CAPI, "%d.%d%s", DRRELMAJOR, DRRELMINOR,
DRRELEXTRA);
printk(KERN_INFO "%s\n", DRIVERNAME);
printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE_CAPI);
strcpy(tmprev, main_revision);
printk("%s Build: %s(%s)\n", getrev(tmprev),
diva_capi_common_code_build, DIVA_BUILD);
if (!(init_capifunc())) {
printk(KERN_ERR "%s: failed init capi_driver.\n",
DRIVERLNAME);
ret = -EIO;
}
return ret;
}
/*
* module exit
*/
static void __exit divacapi_exit(void)
{
finit_capifunc();
printk(KERN_INFO "%s: module unloaded.\n", DRIVERLNAME);
}
module_init(divacapi_init);
module_exit(divacapi_exit);

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
static char diva_capi_common_code_build[] = "102-28";

View File

@ -1,364 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include "platform.h"
#include "pc.h"
#include "debuglib.h"
#include "di_defs.h"
#include "divasync.h"
#include "dadapter.h"
/* --------------------------------------------------------------------------
Adapter array change notification framework
-------------------------------------------------------------------------- */
typedef struct _didd_adapter_change_notification {
didd_adapter_change_callback_t callback;
void IDI_CALL_ENTITY_T *context;
} didd_adapter_change_notification_t, \
* IDI_CALL_ENTITY_T pdidd_adapter_change_notification_t;
#define DIVA_DIDD_MAX_NOTIFICATIONS 256
static didd_adapter_change_notification_t \
NotificationTable[DIVA_DIDD_MAX_NOTIFICATIONS];
/* --------------------------------------------------------------------------
Array to held adapter information
-------------------------------------------------------------------------- */
static DESCRIPTOR HandleTable[NEW_MAX_DESCRIPTORS];
static dword Adapters = 0; /* Number of adapters */
/* --------------------------------------------------------------------------
Shadow IDI_DIMAINT
and 'shadow' debug stuff
-------------------------------------------------------------------------- */
static void no_printf(unsigned char *format, ...)
{
#ifdef EBUG
va_list ap;
va_start(ap, format);
debug((format, ap));
va_end(ap);
#endif
}
/* -------------------------------------------------------------------------
Portable debug Library
------------------------------------------------------------------------- */
#include "debuglib.c"
static DESCRIPTOR MAdapter = {IDI_DIMAINT, /* Adapter Type */
0x00, /* Channels */
0x0000, /* Features */
(IDI_CALL)no_printf};
/* --------------------------------------------------------------------------
DAdapter. Only IDI clients with buffer, that is huge enough to
get all descriptors will receive information about DAdapter
{ byte type, byte channels, word features, IDI_CALL request }
-------------------------------------------------------------------------- */
static void IDI_CALL_LINK_T diva_dadapter_request(ENTITY IDI_CALL_ENTITY_T *);
static DESCRIPTOR DAdapter = {IDI_DADAPTER, /* Adapter Type */
0x00, /* Channels */
0x0000, /* Features */
diva_dadapter_request };
/* --------------------------------------------------------------------------
LOCALS
-------------------------------------------------------------------------- */
static dword diva_register_adapter_callback(\
didd_adapter_change_callback_t callback,
void IDI_CALL_ENTITY_T *context);
static void diva_remove_adapter_callback(dword handle);
static void diva_notify_adapter_change(DESCRIPTOR *d, int removal);
static diva_os_spin_lock_t didd_spin;
/* --------------------------------------------------------------------------
Should be called as first step, after driver init
-------------------------------------------------------------------------- */
void diva_didd_load_time_init(void) {
memset(&HandleTable[0], 0x00, sizeof(HandleTable));
memset(&NotificationTable[0], 0x00, sizeof(NotificationTable));
diva_os_initialize_spin_lock(&didd_spin, "didd");
}
/* --------------------------------------------------------------------------
Should be called as last step, if driver does unload
-------------------------------------------------------------------------- */
void diva_didd_load_time_finit(void) {
diva_os_destroy_spin_lock(&didd_spin, "didd");
}
/* --------------------------------------------------------------------------
Called in order to register new adapter in adapter array
return adapter handle (> 0) on success
return -1 adapter array overflow
-------------------------------------------------------------------------- */
static int diva_didd_add_descriptor(DESCRIPTOR *d) {
diva_os_spin_lock_magic_t irql;
int i;
if (d->type == IDI_DIMAINT) {
if (d->request) {
MAdapter.request = d->request;
dprintf = (DIVA_DI_PRINTF)d->request;
diva_notify_adapter_change(&MAdapter, 0); /* Inserted */
DBG_TRC(("DIMAINT registered, dprintf=%08x", d->request))
} else {
DBG_TRC(("DIMAINT removed"))
diva_notify_adapter_change(&MAdapter, 1); /* About to remove */
MAdapter.request = (IDI_CALL)no_printf;
dprintf = no_printf;
}
return (NEW_MAX_DESCRIPTORS);
}
for (i = 0; i < NEW_MAX_DESCRIPTORS; i++) {
diva_os_enter_spin_lock(&didd_spin, &irql, "didd_add");
if (HandleTable[i].type == 0) {
memcpy(&HandleTable[i], d, sizeof(*d));
Adapters++;
diva_os_leave_spin_lock(&didd_spin, &irql, "didd_add");
diva_notify_adapter_change(d, 0); /* we have new adapter */
DBG_TRC(("Add adapter[%d], request=%08x", (i + 1), d->request))
return (i + 1);
}
diva_os_leave_spin_lock(&didd_spin, &irql, "didd_add");
}
DBG_ERR(("Can't add adapter, out of resources"))
return (-1);
}
/* --------------------------------------------------------------------------
Called in order to remove one registered adapter from array
return adapter handle (> 0) on success
return 0 on success
-------------------------------------------------------------------------- */
static int diva_didd_remove_descriptor(IDI_CALL request) {
diva_os_spin_lock_magic_t irql;
int i;
if (request == MAdapter.request) {
DBG_TRC(("DIMAINT removed"))
dprintf = no_printf;
diva_notify_adapter_change(&MAdapter, 1); /* About to remove */
MAdapter.request = (IDI_CALL)no_printf;
return (0);
}
for (i = 0; (Adapters && (i < NEW_MAX_DESCRIPTORS)); i++) {
if (HandleTable[i].request == request) {
diva_notify_adapter_change(&HandleTable[i], 1); /* About to remove */
diva_os_enter_spin_lock(&didd_spin, &irql, "didd_rm");
memset(&HandleTable[i], 0x00, sizeof(HandleTable[0]));
Adapters--;
diva_os_leave_spin_lock(&didd_spin, &irql, "didd_rm");
DBG_TRC(("Remove adapter[%d], request=%08x", (i + 1), request))
return (0);
}
}
DBG_ERR(("Invalid request=%08x, can't remove adapter", request))
return (-1);
}
/* --------------------------------------------------------------------------
Read adapter array
return 1 if not enough space to save all available adapters
-------------------------------------------------------------------------- */
static int diva_didd_read_adapter_array(DESCRIPTOR *buffer, int length) {
diva_os_spin_lock_magic_t irql;
int src, dst;
memset(buffer, 0x00, length);
length /= sizeof(DESCRIPTOR);
DBG_TRC(("DIDD_Read, space = %d, Adapters = %d", length, Adapters + 2))
diva_os_enter_spin_lock(&didd_spin, &irql, "didd_read");
for (src = 0, dst = 0;
(Adapters && (src < NEW_MAX_DESCRIPTORS) && (dst < length));
src++) {
if (HandleTable[src].type) {
memcpy(&buffer[dst], &HandleTable[src], sizeof(DESCRIPTOR));
dst++;
}
}
diva_os_leave_spin_lock(&didd_spin, &irql, "didd_read");
if (dst < length) {
memcpy(&buffer[dst], &MAdapter, sizeof(DESCRIPTOR));
dst++;
} else {
DBG_ERR(("Can't write DIMAINT. Array too small"))
}
if (dst < length) {
memcpy(&buffer[dst], &DAdapter, sizeof(DESCRIPTOR));
dst++;
} else {
DBG_ERR(("Can't write DADAPTER. Array too small"))
}
DBG_TRC(("Read %d adapters", dst))
return (dst == length);
}
/* --------------------------------------------------------------------------
DAdapter request function.
This function does process only synchronous requests, and is used
for reception/registration of new interfaces
-------------------------------------------------------------------------- */
static void IDI_CALL_LINK_T diva_dadapter_request( \
ENTITY IDI_CALL_ENTITY_T *e) {
IDI_SYNC_REQ *syncReq = (IDI_SYNC_REQ *)e;
if (e->Req) { /* We do not process it, also return error */
e->Rc = OUT_OF_RESOURCES;
DBG_ERR(("Can't process async request, Req=%02x", e->Req))
return;
}
/*
So, we process sync request
*/
switch (e->Rc) {
case IDI_SYNC_REQ_DIDD_REGISTER_ADAPTER_NOTIFY: {
diva_didd_adapter_notify_t *pinfo = &syncReq->didd_notify.info;
pinfo->handle = diva_register_adapter_callback( \
(didd_adapter_change_callback_t)pinfo->callback,
(void IDI_CALL_ENTITY_T *)pinfo->context);
e->Rc = 0xff;
} break;
case IDI_SYNC_REQ_DIDD_REMOVE_ADAPTER_NOTIFY: {
diva_didd_adapter_notify_t *pinfo = &syncReq->didd_notify.info;
diva_remove_adapter_callback(pinfo->handle);
e->Rc = 0xff;
} break;
case IDI_SYNC_REQ_DIDD_ADD_ADAPTER: {
diva_didd_add_adapter_t *pinfo = &syncReq->didd_add_adapter.info;
if (diva_didd_add_descriptor((DESCRIPTOR *)pinfo->descriptor) < 0) {
e->Rc = OUT_OF_RESOURCES;
} else {
e->Rc = 0xff;
}
} break;
case IDI_SYNC_REQ_DIDD_REMOVE_ADAPTER: {
diva_didd_remove_adapter_t *pinfo = &syncReq->didd_remove_adapter.info;
if (diva_didd_remove_descriptor((IDI_CALL)pinfo->p_request) < 0) {
e->Rc = OUT_OF_RESOURCES;
} else {
e->Rc = 0xff;
}
} break;
case IDI_SYNC_REQ_DIDD_READ_ADAPTER_ARRAY: {
diva_didd_read_adapter_array_t *pinfo =\
&syncReq->didd_read_adapter_array.info;
if (diva_didd_read_adapter_array((DESCRIPTOR *)pinfo->buffer,
(int)pinfo->length)) {
e->Rc = OUT_OF_RESOURCES;
} else {
e->Rc = 0xff;
}
} break;
default:
DBG_ERR(("Can't process sync request, Req=%02x", e->Rc))
e->Rc = OUT_OF_RESOURCES;
}
}
/* --------------------------------------------------------------------------
IDI client does register his notification function
-------------------------------------------------------------------------- */
static dword diva_register_adapter_callback( \
didd_adapter_change_callback_t callback,
void IDI_CALL_ENTITY_T *context) {
diva_os_spin_lock_magic_t irql;
dword i;
for (i = 0; i < DIVA_DIDD_MAX_NOTIFICATIONS; i++) {
diva_os_enter_spin_lock(&didd_spin, &irql, "didd_nfy_add");
if (!NotificationTable[i].callback) {
NotificationTable[i].callback = callback;
NotificationTable[i].context = context;
diva_os_leave_spin_lock(&didd_spin, &irql, "didd_nfy_add");
DBG_TRC(("Register adapter notification[%d]=%08x", i + 1, callback))
return (i + 1);
}
diva_os_leave_spin_lock(&didd_spin, &irql, "didd_nfy_add");
}
DBG_ERR(("Can't register adapter notification, overflow"))
return (0);
}
/* --------------------------------------------------------------------------
IDI client does register his notification function
-------------------------------------------------------------------------- */
static void diva_remove_adapter_callback(dword handle) {
diva_os_spin_lock_magic_t irql;
if (handle && ((--handle) < DIVA_DIDD_MAX_NOTIFICATIONS)) {
diva_os_enter_spin_lock(&didd_spin, &irql, "didd_nfy_rm");
NotificationTable[handle].callback = NULL;
NotificationTable[handle].context = NULL;
diva_os_leave_spin_lock(&didd_spin, &irql, "didd_nfy_rm");
DBG_TRC(("Remove adapter notification[%d]", (int)(handle + 1)))
return;
}
DBG_ERR(("Can't remove adapter notification, handle=%d", handle))
}
/* --------------------------------------------------------------------------
Notify all client about adapter array change
Does suppose following behavior in the client side:
Step 1: Redister Notification
Step 2: Read Adapter Array
-------------------------------------------------------------------------- */
static void diva_notify_adapter_change(DESCRIPTOR *d, int removal) {
int i, do_notify;
didd_adapter_change_notification_t nfy;
diva_os_spin_lock_magic_t irql;
for (i = 0; i < DIVA_DIDD_MAX_NOTIFICATIONS; i++) {
do_notify = 0;
diva_os_enter_spin_lock(&didd_spin, &irql, "didd_nfy");
if (NotificationTable[i].callback) {
memcpy(&nfy, &NotificationTable[i], sizeof(nfy));
do_notify = 1;
}
diva_os_leave_spin_lock(&didd_spin, &irql, "didd_nfy");
if (do_notify) {
(*(nfy.callback))(nfy.context, d, removal);
}
}
}
/* --------------------------------------------------------------------------
For all systems, that are linked by Kernel Mode Linker this is ONLY one
function thet should be exported by this device driver
IDI clients should look for IDI_DADAPTER, and use request function
of this adapter (sync request) in order to receive appropriate services:
- add new adapter
- remove existing adapter
- add adapter array notification
- remove adapter array notification
(read adapter is redundant in this case)
INPUT:
buffer - pointer to buffer that will receive adapter array
length - length (in bytes) of space in buffer
OUTPUT:
Adapter array will be written to memory described by 'buffer'
If the last adapter seen in the returned adapter array is
IDI_DADAPTER or if last adapter in array does have type '0', then
it was enougth space in buffer to accommodate all available
adapter descriptors
*NOTE 1 (debug interface):
The IDI adapter of type 'IDI_DIMAINT' does register as 'request'
famous 'dprintf' function (of type DI_PRINTF, please look
include/debuglib.c and include/debuglib.h) for details.
So dprintf is not exported from module debug module directly,
instead of this IDI_DIMAINT is registered.
Module load order will receive in this case:
1. DIDD (this file)
2. DIMAINT does load and register 'IDI_DIMAINT', at this step
DIDD should be able to get 'dprintf', save it, and
register with DIDD by means of 'dprintf' function.
3. any other driver is loaded and is able to access adapter array
and debug interface
This approach does allow to load/unload debug interface on demand,
and save memory, it it is necessary.
-------------------------------------------------------------------------- */
void IDI_CALL_LINK_T DIVA_DIDD_Read(void IDI_CALL_ENTITY_T *buffer,
int length) {
diva_didd_read_adapter_array(buffer, length);
}

View File

@ -1,34 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef __DIVA_DIDD_DADAPTER_INC__
#define __DIVA_DIDD_DADAPTER_INC__
void diva_didd_load_time_init(void);
void diva_didd_load_time_finit(void);
#define NEW_MAX_DESCRIPTORS 64
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,88 +0,0 @@
/*
*
Copyright (c) Eicon Technology Corporation, 2000.
*
This source file is supplied for the use with Eicon
Technology Corporation's range of DIVA Server Adapters.
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef __DIVA_DEBUG_IF_H__
#define __DIVA_DEBUG_IF_H__
#define MSG_TYPE_DRV_ID 0x0001
#define MSG_TYPE_FLAGS 0x0002
#define MSG_TYPE_STRING 0x0003
#define MSG_TYPE_BINARY 0x0004
#define MSG_TYPE_MLOG 0x0005
#define MSG_FRAME_MAX_SIZE 2150
typedef struct _diva_dbg_entry_head {
dword sequence;
dword time_sec;
dword time_usec;
dword facility;
dword dli;
dword drv_id;
dword di_cpu;
dword data_length;
} diva_dbg_entry_head_t;
int diva_maint_init(byte *base, unsigned long length, int do_init);
void *diva_maint_finit(void);
dword diva_dbg_q_length(void);
diva_dbg_entry_head_t *diva_maint_get_message(word *size,
diva_os_spin_lock_magic_t *old_irql);
void diva_maint_ack_message(int do_release,
diva_os_spin_lock_magic_t *old_irql);
void diva_maint_prtComp(char *format, ...);
void diva_maint_wakeup_read(void);
int diva_get_driver_info(dword id, byte *data, int data_length);
int diva_get_driver_dbg_mask(dword id, byte *data);
int diva_set_driver_dbg_mask(dword id, dword mask);
void diva_mnt_remove_xdi_adapter(const DESCRIPTOR *d);
void diva_mnt_add_xdi_adapter(const DESCRIPTOR *d);
int diva_mnt_shutdown_xdi_adapters(void);
#define DIVA_MAX_SELECTIVE_FILTER_LENGTH 127
int diva_set_trace_filter(int filter_length, const char *filter);
int diva_get_trace_filter(int max_length, char *filter);
#define DITRACE_CMD_GET_DRIVER_INFO 1
#define DITRACE_READ_DRIVER_DBG_MASK 2
#define DITRACE_WRITE_DRIVER_DBG_MASK 3
#define DITRACE_READ_TRACE_ENTRY 4
#define DITRACE_READ_TRACE_ENTRYS 5
#define DITRACE_WRITE_SELECTIVE_TRACE_FILTER 6
#define DITRACE_READ_SELECTIVE_TRACE_FILTER 7
/*
Trace lavels for debug via management interface
*/
#define DIVA_MGT_DBG_TRACE 0x00000001 /* All trace messages from the card */
#define DIVA_MGT_DBG_DCHAN 0x00000002 /* All D-channel relater trace messages */
#define DIVA_MGT_DBG_MDM_PROGRESS 0x00000004 /* Modem progress events */
#define DIVA_MGT_DBG_FAX_PROGRESS 0x00000008 /* Fax progress events */
#define DIVA_MGT_DBG_IFC_STATISTICS 0x00000010 /* Interface call statistics */
#define DIVA_MGT_DBG_MDM_STATISTICS 0x00000020 /* Global modem statistics */
#define DIVA_MGT_DBG_FAX_STATISTICS 0x00000040 /* Global call statistics */
#define DIVA_MGT_DBG_LINE_EVENTS 0x00000080 /* Line state events */
#define DIVA_MGT_DBG_IFC_EVENTS 0x00000100 /* Interface/L1/L2 state events */
#define DIVA_MGT_DBG_IFC_BCHANNEL 0x00000200 /* B-Channel trace for all channels */
#define DIVA_MGT_DBG_IFC_AUDIO 0x00000400 /* Audio Tap trace for all channels */
# endif /* DEBUG_IF___H */

View File

@ -1,156 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include "debuglib.h"
#ifdef DIVA_NO_DEBUGLIB
static DIVA_DI_PRINTF dprintf;
#else /* DIVA_NO_DEBUGLIB */
_DbgHandle_ myDriverDebugHandle = { 0 /*!Registered*/, DBG_HANDLE_VERSION };
DIVA_DI_PRINTF dprintf = no_printf;
/*****************************************************************************/
#define DBG_FUNC(name) \
void \
myDbgPrint_##name(char *format, ...) \
{ va_list ap; \
if (myDriverDebugHandle.dbg_prt) \
{ va_start(ap, format); \
(myDriverDebugHandle.dbg_prt) \
(myDriverDebugHandle.id, DLI_##name, format, ap); \
va_end(ap); \
} }
DBG_FUNC(LOG)
DBG_FUNC(FTL)
DBG_FUNC(ERR)
DBG_FUNC(TRC)
DBG_FUNC(MXLOG)
DBG_FUNC(FTL_MXLOG)
void
myDbgPrint_EVL(long msgID, ...)
{ va_list ap;
if (myDriverDebugHandle.dbg_ev)
{ va_start(ap, msgID);
(myDriverDebugHandle.dbg_ev)
(myDriverDebugHandle.id, (unsigned long)msgID, ap);
va_end(ap);
} }
DBG_FUNC(REG)
DBG_FUNC(MEM)
DBG_FUNC(SPL)
DBG_FUNC(IRP)
DBG_FUNC(TIM)
DBG_FUNC(BLK)
DBG_FUNC(TAPI)
DBG_FUNC(NDIS)
DBG_FUNC(CONN)
DBG_FUNC(STAT)
DBG_FUNC(SEND)
DBG_FUNC(RECV)
DBG_FUNC(PRV0)
DBG_FUNC(PRV1)
DBG_FUNC(PRV2)
DBG_FUNC(PRV3)
/*****************************************************************************/
int
DbgRegister(char *drvName, char *drvTag, unsigned long dbgMask)
{
int len;
/*
* deregister (if already registered) and zero out myDriverDebugHandle
*/
DbgDeregister();
/*
* initialize the debug handle
*/
myDriverDebugHandle.Version = DBG_HANDLE_VERSION;
myDriverDebugHandle.id = -1;
myDriverDebugHandle.dbgMask = dbgMask | (DL_EVL | DL_FTL | DL_LOG);
len = strlen(drvName);
memcpy(myDriverDebugHandle.drvName, drvName,
(len < sizeof(myDriverDebugHandle.drvName)) ?
len : sizeof(myDriverDebugHandle.drvName) - 1);
len = strlen(drvTag);
memcpy(myDriverDebugHandle.drvTag, drvTag,
(len < sizeof(myDriverDebugHandle.drvTag)) ?
len : sizeof(myDriverDebugHandle.drvTag) - 1);
/*
* Try to register debugging via old (and only) interface
*/
dprintf("\000\377", &myDriverDebugHandle);
if (myDriverDebugHandle.dbg_prt)
{
return (1);
}
/*
* Check if we registered with an old maint driver (see debuglib.h)
*/
if (myDriverDebugHandle.dbg_end != NULL
/* location of 'dbg_prt' in _OldDbgHandle_ struct */
&& (myDriverDebugHandle.regTime.LowPart ||
myDriverDebugHandle.regTime.HighPart))
/* same location as in _OldDbgHandle_ struct */
{
dprintf("%s: Cannot log to old maint driver !", drvName);
myDriverDebugHandle.dbg_end =
((_OldDbgHandle_ *)&myDriverDebugHandle)->dbg_end;
DbgDeregister();
}
return (0);
}
/*****************************************************************************/
void
DbgSetLevel(unsigned long dbgMask)
{
myDriverDebugHandle.dbgMask = dbgMask | (DL_EVL | DL_FTL | DL_LOG);
}
/*****************************************************************************/
void
DbgDeregister(void)
{
if (myDriverDebugHandle.dbg_end)
{
(myDriverDebugHandle.dbg_end)(&myDriverDebugHandle);
}
memset(&myDriverDebugHandle, 0, sizeof(myDriverDebugHandle));
}
void xdi_dbg_xlog(char *x, ...) {
va_list ap;
va_start(ap, x);
if (myDriverDebugHandle.dbg_end &&
(myDriverDebugHandle.dbg_irq || myDriverDebugHandle.dbg_old) &&
(myDriverDebugHandle.dbgMask & DL_STAT)) {
if (myDriverDebugHandle.dbg_irq) {
(*(myDriverDebugHandle.dbg_irq))(myDriverDebugHandle.id,
(x[0] != 0) ? DLI_TRC : DLI_XLOG, x, ap);
} else {
(*(myDriverDebugHandle.dbg_old))(myDriverDebugHandle.id, x, ap);
}
}
va_end(ap);
}
/*****************************************************************************/
#endif /* DIVA_NO_DEBUGLIB */

View File

@ -1,322 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#if !defined(__DEBUGLIB_H__)
#define __DEBUGLIB_H__
#include <stdarg.h>
/*
* define global debug priorities
*/
#define DL_LOG 0x00000001 /* always worth mentioning */
#define DL_FTL 0x00000002 /* always sampled error */
#define DL_ERR 0x00000004 /* any kind of error */
#define DL_TRC 0x00000008 /* verbose information */
#define DL_XLOG 0x00000010 /* old xlog info */
#define DL_MXLOG 0x00000020 /* maestra xlog info */
#define DL_FTL_MXLOG 0x00000021 /* fatal maestra xlog info */
#define DL_EVL 0x00000080 /* special NT eventlog msg */
#define DL_COMPAT (DL_MXLOG | DL_XLOG)
#define DL_PRIOR_MASK (DL_EVL | DL_COMPAT | DL_TRC | DL_ERR | DL_FTL | DL_LOG)
#define DLI_LOG 0x0100
#define DLI_FTL 0x0200
#define DLI_ERR 0x0300
#define DLI_TRC 0x0400
#define DLI_XLOG 0x0500
#define DLI_MXLOG 0x0600
#define DLI_FTL_MXLOG 0x0600
#define DLI_EVL 0x0800
/*
* define OS (operating system interface) debuglevel
*/
#define DL_REG 0x00000100 /* init/query registry */
#define DL_MEM 0x00000200 /* memory management */
#define DL_SPL 0x00000400 /* event/spinlock handling */
#define DL_IRP 0x00000800 /* I/O request handling */
#define DL_TIM 0x00001000 /* timer/watchdog handling */
#define DL_BLK 0x00002000 /* raw data block contents */
#define DL_OS_MASK (DL_BLK | DL_TIM | DL_IRP | DL_SPL | DL_MEM | DL_REG)
#define DLI_REG 0x0900
#define DLI_MEM 0x0A00
#define DLI_SPL 0x0B00
#define DLI_IRP 0x0C00
#define DLI_TIM 0x0D00
#define DLI_BLK 0x0E00
/*
* define ISDN (connection interface) debuglevel
*/
#define DL_TAPI 0x00010000 /* debug TAPI interface */
#define DL_NDIS 0x00020000 /* debug NDIS interface */
#define DL_CONN 0x00040000 /* connection handling */
#define DL_STAT 0x00080000 /* trace state machines */
#define DL_SEND 0x00100000 /* trace raw xmitted data */
#define DL_RECV 0x00200000 /* trace raw received data */
#define DL_DATA (DL_SEND | DL_RECV)
#define DL_ISDN_MASK (DL_DATA | DL_STAT | DL_CONN | DL_NDIS | DL_TAPI)
#define DLI_TAPI 0x1100
#define DLI_NDIS 0x1200
#define DLI_CONN 0x1300
#define DLI_STAT 0x1400
#define DLI_SEND 0x1500
#define DLI_RECV 0x1600
/*
* define some private (unspecified) debuglevel
*/
#define DL_PRV0 0x01000000
#define DL_PRV1 0x02000000
#define DL_PRV2 0x04000000
#define DL_PRV3 0x08000000
#define DL_PRIV_MASK (DL_PRV0 | DL_PRV1 | DL_PRV2 | DL_PRV3)
#define DLI_PRV0 0x1900
#define DLI_PRV1 0x1A00
#define DLI_PRV2 0x1B00
#define DLI_PRV3 0x1C00
#define DT_INDEX(x) ((x) & 0x000F)
#define DL_INDEX(x) ((((x) >> 8) & 0x00FF) - 1)
#define DLI_NAME(x) ((x) & 0xFF00)
/*
* Debug mask for kernel mode tracing, if set the output is also sent to
* the system debug function. Requires that the project is compiled
* with _KERNEL_DBG_PRINT_
*/
#define DL_TO_KERNEL 0x40000000
#ifdef DIVA_NO_DEBUGLIB
#define myDbgPrint_LOG(x...) do { } while (0);
#define myDbgPrint_FTL(x...) do { } while (0);
#define myDbgPrint_ERR(x...) do { } while (0);
#define myDbgPrint_TRC(x...) do { } while (0);
#define myDbgPrint_MXLOG(x...) do { } while (0);
#define myDbgPrint_EVL(x...) do { } while (0);
#define myDbgPrint_REG(x...) do { } while (0);
#define myDbgPrint_MEM(x...) do { } while (0);
#define myDbgPrint_SPL(x...) do { } while (0);
#define myDbgPrint_IRP(x...) do { } while (0);
#define myDbgPrint_TIM(x...) do { } while (0);
#define myDbgPrint_BLK(x...) do { } while (0);
#define myDbgPrint_TAPI(x...) do { } while (0);
#define myDbgPrint_NDIS(x...) do { } while (0);
#define myDbgPrint_CONN(x...) do { } while (0);
#define myDbgPrint_STAT(x...) do { } while (0);
#define myDbgPrint_SEND(x...) do { } while (0);
#define myDbgPrint_RECV(x...) do { } while (0);
#define myDbgPrint_PRV0(x...) do { } while (0);
#define myDbgPrint_PRV1(x...) do { } while (0);
#define myDbgPrint_PRV2(x...) do { } while (0);
#define myDbgPrint_PRV3(x...) do { } while (0);
#define DBG_TEST(func, args) do { } while (0);
#define DBG_EVL_ID(args) do { } while (0);
#else /* DIVA_NO_DEBUGLIB */
/*
* define low level macros for formatted & raw debugging
*/
#define DBG_DECL(func) extern void myDbgPrint_##func(char *, ...);
DBG_DECL(LOG)
DBG_DECL(FTL)
DBG_DECL(ERR)
DBG_DECL(TRC)
DBG_DECL(MXLOG)
DBG_DECL(FTL_MXLOG)
extern void myDbgPrint_EVL(long, ...);
DBG_DECL(REG)
DBG_DECL(MEM)
DBG_DECL(SPL)
DBG_DECL(IRP)
DBG_DECL(TIM)
DBG_DECL(BLK)
DBG_DECL(TAPI)
DBG_DECL(NDIS)
DBG_DECL(CONN)
DBG_DECL(STAT)
DBG_DECL(SEND)
DBG_DECL(RECV)
DBG_DECL(PRV0)
DBG_DECL(PRV1)
DBG_DECL(PRV2)
DBG_DECL(PRV3)
#ifdef _KERNEL_DBG_PRINT_
/*
* tracing to maint and kernel if selected in the trace mask.
*/
#define DBG_TEST(func, args) \
{ if ((myDriverDebugHandle.dbgMask) & (unsigned long)DL_##func) \
{ \
if ((myDriverDebugHandle.dbgMask) & DL_TO_KERNEL) \
{ DbgPrint args; DbgPrint("\r\n"); } \
myDbgPrint_##func args; \
} }
#else
/*
* Standard tracing to maint driver.
*/
#define DBG_TEST(func, args) \
{ if ((myDriverDebugHandle.dbgMask) & (unsigned long)DL_##func) \
{ myDbgPrint_##func args; \
} }
#endif
/*
* For event level debug use a separate define, the parameter are
* different and cause compiler errors on some systems.
*/
#define DBG_EVL_ID(args) \
{ if ((myDriverDebugHandle.dbgMask) & (unsigned long)DL_EVL) \
{ myDbgPrint_EVL args; \
} }
#endif /* DIVA_NO_DEBUGLIB */
#define DBG_LOG(args) DBG_TEST(LOG, args)
#define DBG_FTL(args) DBG_TEST(FTL, args)
#define DBG_ERR(args) DBG_TEST(ERR, args)
#define DBG_TRC(args) DBG_TEST(TRC, args)
#define DBG_MXLOG(args) DBG_TEST(MXLOG, args)
#define DBG_FTL_MXLOG(args) DBG_TEST(FTL_MXLOG, args)
#define DBG_EVL(args) DBG_EVL_ID(args)
#define DBG_REG(args) DBG_TEST(REG, args)
#define DBG_MEM(args) DBG_TEST(MEM, args)
#define DBG_SPL(args) DBG_TEST(SPL, args)
#define DBG_IRP(args) DBG_TEST(IRP, args)
#define DBG_TIM(args) DBG_TEST(TIM, args)
#define DBG_BLK(args) DBG_TEST(BLK, args)
#define DBG_TAPI(args) DBG_TEST(TAPI, args)
#define DBG_NDIS(args) DBG_TEST(NDIS, args)
#define DBG_CONN(args) DBG_TEST(CONN, args)
#define DBG_STAT(args) DBG_TEST(STAT, args)
#define DBG_SEND(args) DBG_TEST(SEND, args)
#define DBG_RECV(args) DBG_TEST(RECV, args)
#define DBG_PRV0(args) DBG_TEST(PRV0, args)
#define DBG_PRV1(args) DBG_TEST(PRV1, args)
#define DBG_PRV2(args) DBG_TEST(PRV2, args)
#define DBG_PRV3(args) DBG_TEST(PRV3, args)
/*
* prototypes for debug register/deregister functions in "debuglib.c"
*/
#ifdef DIVA_NO_DEBUGLIB
#define DbgRegister(name, tag, mask) do { } while (0)
#define DbgDeregister() do { } while (0)
#define DbgSetLevel(mask) do { } while (0)
#else
extern DIVA_DI_PRINTF dprintf;
extern int DbgRegister(char *drvName, char *drvTag, unsigned long dbgMask);
extern void DbgDeregister(void);
extern void DbgSetLevel(unsigned long dbgMask);
#endif
/*
* driver internal structure for debug handling;
* in client drivers this structure is maintained in "debuglib.c",
* in the debug driver "debug.c" maintains a chain of such structs.
*/
typedef struct _DbgHandle_ *pDbgHandle;
typedef void (*DbgEnd)(pDbgHandle);
typedef void (*DbgLog)(unsigned short, int, char *, va_list);
typedef void (*DbgOld)(unsigned short, char *, va_list);
typedef void (*DbgEv)(unsigned short, unsigned long, va_list);
typedef void (*DbgIrq)(unsigned short, int, char *, va_list);
typedef struct _DbgHandle_
{ char Registered; /* driver successfully registered */
#define DBG_HANDLE_REG_NEW 0x01 /* this (new) structure */
#define DBG_HANDLE_REG_OLD 0x7f /* old structure (see below) */
char Version; /* version of this structure */
#define DBG_HANDLE_VERSION 1 /* contains dbg_old function now */
#define DBG_HANDLE_VER_EXT 2 /* pReserved points to extended info*/
short id; /* internal id of registered driver */
struct _DbgHandle_ *next; /* ptr to next registered driver */
struct /*LARGE_INTEGER*/ {
unsigned long LowPart;
long HighPart;
} regTime; /* timestamp for registration */
void *pIrp; /* ptr to pending i/o request */
unsigned long dbgMask; /* current debug mask */
char drvName[128]; /* ASCII name of registered driver */
char drvTag[64]; /* revision string */
DbgEnd dbg_end; /* function for debug closing */
DbgLog dbg_prt; /* function for debug appending */
DbgOld dbg_old; /* function for old debug appending */
DbgEv dbg_ev; /* function for Windows NT Eventlog */
DbgIrq dbg_irq; /* function for irql checked debug */
void *pReserved3;
} _DbgHandle_;
extern _DbgHandle_ myDriverDebugHandle;
typedef struct _OldDbgHandle_
{ struct _OldDbgHandle_ *next;
void *pIrp;
long regTime[2];
unsigned long dbgMask;
short id;
char drvName[78];
DbgEnd dbg_end;
DbgLog dbg_prt;
} _OldDbgHandle_;
/* the differences in DbgHandles
old: tmp: new:
0 long next char Registered char Registered
char filler char Version
short id short id
4 long pIrp long regTime.lo long next
8 long regTime.lo long regTime.hi long regTime.lo
12 long regTime.hi long next long regTime.hi
16 long dbgMask long pIrp long pIrp
20 short id long dbgMask long dbgMask
22 char drvName[78] ..
24 .. char drvName[16] char drvName[16]
40 .. char drvTag[64] char drvTag[64]
100 void *dbg_end .. ..
104 void *dbg_prt void *dbg_end void *dbg_end
108 .. void *dbg_prt void *dbg_prt
112 .. .. void *dbg_old
116 .. .. void *dbg_ev
120 .. .. void *dbg_irq
124 .. .. void *pReserved3
( new->id == 0 && *((short *)&new->dbgMask) == -1 ) identifies "old",
new->Registered and new->Version overlay old->next,
new->next overlays old->pIrp, new->regTime matches old->regTime and
thus these fields can be maintained in new struct whithout trouble;
id, dbgMask, drvName, dbg_end and dbg_prt need special handling !
*/
#define DBG_EXT_TYPE_CARD_TRACE 0x00000001
typedef struct
{
unsigned long ExtendedType;
union
{
/* DBG_EXT_TYPE_CARD_TRACE */
struct
{
void (*MaskChangedNotify)(void *pContext);
unsigned long ModuleTxtMask;
unsigned long DebugLevel;
unsigned long B_ChannelMask;
unsigned long LogBufferSize;
} CardTrace;
} Data;
} _DbgExtendedInfo_;
#ifndef DIVA_NO_DEBUGLIB
/* -------------------------------------------------------------
Function used for xlog-style debug
------------------------------------------------------------- */
#define XDI_USE_XLOG 1
void xdi_dbg_xlog(char *x, ...);
#endif /* DIVA_NO_DEBUGLIB */
#endif /* __DEBUGLIB_H__ */

View File

@ -1,54 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef __DIVA_IDI_DFIFO_INC__
#define __DIVA_IDI_DFIFO_INC__
#define DIVA_DFIFO_CACHE_SZ 64 /* Used to isolate pipe from
rest of the world
should be divisible by 4
*/
#define DIVA_DFIFO_RAW_SZ (2512 * 8)
#define DIVA_DFIFO_DATA_SZ 68
#define DIVA_DFIFO_HDR_SZ 4
#define DIVA_DFIFO_SEGMENT_SZ (DIVA_DFIFO_DATA_SZ + DIVA_DFIFO_HDR_SZ)
#define DIVA_DFIFO_SEGMENTS ((DIVA_DFIFO_RAW_SZ) / (DIVA_DFIFO_SEGMENT_SZ) + 1)
#define DIVA_DFIFO_MEM_SZ ( \
(DIVA_DFIFO_SEGMENT_SZ) * (DIVA_DFIFO_SEGMENTS) + \
(DIVA_DFIFO_CACHE_SZ) * 2 \
)
#define DIVA_DFIFO_STEP DIVA_DFIFO_SEGMENT_SZ
/* -------------------------------------------------------------------------
Block header layout is:
byte[0] -> flags
byte[1] -> length of data in block
byte[2] -> reserved
byte[4] -> reserved
------------------------------------------------------------------------- */
#define DIVA_DFIFO_WRAP 0x80 /* This is the last block in fifo */
#define DIVA_DFIFO_READY 0x40 /* This block is ready for processing */
#define DIVA_DFIFO_LAST 0x20 /* This block is last in message */
#define DIVA_DFIFO_AUTO 0x10 /* Don't look for 'ready', don't ack */
int diva_dfifo_create(void *start, int length);
#endif

View File

@ -1,835 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include "platform.h"
#include "pc.h"
#include "pr_pc.h"
#include "di_defs.h"
#include "di.h"
#if !defined USE_EXTENDED_DEBUGS
#include "dimaint.h"
#else
#define dprintf
#endif
#include "io.h"
#include "dfifo.h"
#define PR_RAM ((struct pr_ram *)0)
#define RAM ((struct dual *)0)
/*------------------------------------------------------------------*/
/* local function prototypes */
/*------------------------------------------------------------------*/
void pr_out(ADAPTER *a);
byte pr_dpc(ADAPTER *a);
static byte pr_ready(ADAPTER *a);
static byte isdn_rc(ADAPTER *, byte, byte, byte, word, dword, dword);
static byte isdn_ind(ADAPTER *, byte, byte, byte, PBUFFER *, byte, word);
/* -----------------------------------------------------------------
Functions used for the extended XDI Debug
macros
global convergence counter (used by all adapters)
Look by the implementation part of the functions
about the parameters.
If you change the dubugging parameters, then you should update
the aididbg.doc in the IDI doc's.
----------------------------------------------------------------- */
#if defined(XDI_USE_XLOG)
#define XDI_A_NR(_x_) ((byte)(((ISDN_ADAPTER *)(_x_->io))->ANum))
static void xdi_xlog(byte *msg, word code, int length);
static byte xdi_xlog_sec = 0;
#else
#define XDI_A_NR(_x_) ((byte)0)
#endif
static void xdi_xlog_rc_event(byte Adapter,
byte Id, byte Ch, byte Rc, byte cb, byte type);
static void xdi_xlog_request(byte Adapter, byte Id,
byte Ch, byte Req, byte type);
static void xdi_xlog_ind(byte Adapter,
byte Id,
byte Ch,
byte Ind,
byte rnr_valid,
byte rnr,
byte type);
/*------------------------------------------------------------------*/
/* output function */
/*------------------------------------------------------------------*/
void pr_out(ADAPTER *a)
{
byte e_no;
ENTITY *this = NULL;
BUFFERS *X;
word length;
word i;
word clength;
REQ *ReqOut;
byte more;
byte ReadyCount;
byte ReqCount;
byte Id;
dtrc(dprintf("pr_out"));
/* while a request is pending ... */
e_no = look_req(a);
if (!e_no)
{
dtrc(dprintf("no_req"));
return;
}
ReadyCount = pr_ready(a);
if (!ReadyCount)
{
dtrc(dprintf("not_ready"));
return;
}
ReqCount = 0;
while (e_no && ReadyCount) {
next_req(a);
this = entity_ptr(a, e_no);
#ifdef USE_EXTENDED_DEBUGS
if (!this)
{
DBG_FTL(("XDI: [%02x] !A%d ==> NULL entity ptr - try to ignore",
xdi_xlog_sec++, (int)((ISDN_ADAPTER *)a->io)->ANum))
e_no = look_req(a);
ReadyCount--;
continue;
}
{
DBG_TRC((">A%d Id=0x%x Req=0x%x", ((ISDN_ADAPTER *)a->io)->ANum, this->Id, this->Req))
}
#else
dbug(dprintf("out:Req=%x,Id=%x,Ch=%x", this->Req, this->Id, this->ReqCh));
#endif
/* get address of next available request buffer */
ReqOut = (REQ *)&PR_RAM->B[a->ram_inw(a, &PR_RAM->NextReq)];
#if defined(DIVA_ISTREAM)
if (!(a->tx_stream[this->Id] &&
this->Req == N_DATA)) {
#endif
/* now copy the data from the current data buffer into the */
/* adapters request buffer */
length = 0;
i = this->XCurrent;
X = PTR_X(a, this);
while (i < this->XNum && length < 270) {
clength = min((word)(270 - length), (word)(X[i].PLength-this->XOffset));
a->ram_out_buffer(a,
&ReqOut->XBuffer.P[length],
PTR_P(a, this, &X[i].P[this->XOffset]),
clength);
length += clength;
this->XOffset += clength;
if (this->XOffset == X[i].PLength) {
this->XCurrent = (byte)++i;
this->XOffset = 0;
}
}
#if defined(DIVA_ISTREAM)
} else { /* Use CMA extension in order to transfer data to the card */
i = this->XCurrent;
X = PTR_X(a, this);
while (i < this->XNum) {
diva_istream_write(a,
this->Id,
PTR_P(a, this, &X[i].P[0]),
X[i].PLength,
((i + 1) == this->XNum),
0, 0);
this->XCurrent = (byte)++i;
}
length = 0;
}
#endif
a->ram_outw(a, &ReqOut->XBuffer.length, length);
a->ram_out(a, &ReqOut->ReqId, this->Id);
a->ram_out(a, &ReqOut->ReqCh, this->ReqCh);
/* if it's a specific request (no ASSIGN) ... */
if (this->Id & 0x1f) {
/* if buffers are left in the list of data buffers do */
/* do chaining (LL_MDATA, N_MDATA) */
this->More++;
if (i < this->XNum && this->MInd) {
xdi_xlog_request(XDI_A_NR(a), this->Id, this->ReqCh, this->MInd,
a->IdTypeTable[this->No]);
a->ram_out(a, &ReqOut->Req, this->MInd);
more = true;
}
else {
xdi_xlog_request(XDI_A_NR(a), this->Id, this->ReqCh, this->Req,
a->IdTypeTable[this->No]);
this->More |= XMOREF;
a->ram_out(a, &ReqOut->Req, this->Req);
more = false;
if (a->FlowControlIdTable[this->ReqCh] == this->Id)
a->FlowControlSkipTable[this->ReqCh] = true;
/*
Note that remove request was sent to the card
*/
if (this->Req == REMOVE) {
a->misc_flags_table[e_no] |= DIVA_MISC_FLAGS_REMOVE_PENDING;
}
}
/* if we did chaining, this entity is put back into the */
/* request queue */
if (more) {
req_queue(a, this->No);
}
}
/* else it's a ASSIGN */
else {
/* save the request code used for buffer chaining */
this->MInd = 0;
if (this->Id == BLLC_ID) this->MInd = LL_MDATA;
if (this->Id == NL_ID ||
this->Id == TASK_ID ||
this->Id == MAN_ID
) this->MInd = N_MDATA;
/* send the ASSIGN */
a->IdTypeTable[this->No] = this->Id;
xdi_xlog_request(XDI_A_NR(a), this->Id, this->ReqCh, this->Req, this->Id);
this->More |= XMOREF;
a->ram_out(a, &ReqOut->Req, this->Req);
/* save the reference of the ASSIGN */
assign_queue(a, this->No, a->ram_inw(a, &ReqOut->Reference));
}
a->ram_outw(a, &PR_RAM->NextReq, a->ram_inw(a, &ReqOut->next));
ReadyCount--;
ReqCount++;
e_no = look_req(a);
}
/* send the filled request buffers to the ISDN adapter */
a->ram_out(a, &PR_RAM->ReqInput,
(byte)(a->ram_in(a, &PR_RAM->ReqInput) + ReqCount));
/* if it is a 'unreturncoded' UREMOVE request, remove the */
/* Id from our table after sending the request */
if (this && (this->Req == UREMOVE) && this->Id) {
Id = this->Id;
e_no = a->IdTable[Id];
free_entity(a, e_no);
for (i = 0; i < 256; i++)
{
if (a->FlowControlIdTable[i] == Id)
a->FlowControlIdTable[i] = 0;
}
a->IdTable[Id] = 0;
this->Id = 0;
}
}
static byte pr_ready(ADAPTER *a)
{
byte ReadyCount;
ReadyCount = (byte)(a->ram_in(a, &PR_RAM->ReqOutput) -
a->ram_in(a, &PR_RAM->ReqInput));
if (!ReadyCount) {
if (!a->ReadyInt) {
a->ram_inc(a, &PR_RAM->ReadyInt);
a->ReadyInt++;
}
}
return ReadyCount;
}
/*------------------------------------------------------------------*/
/* isdn interrupt handler */
/*------------------------------------------------------------------*/
byte pr_dpc(ADAPTER *a)
{
byte Count;
RC *RcIn;
IND *IndIn;
byte c;
byte RNRId;
byte Rc;
byte Ind;
/* if return codes are available ... */
if ((Count = a->ram_in(a, &PR_RAM->RcOutput)) != 0) {
dtrc(dprintf("#Rc=%x", Count));
/* get the buffer address of the first return code */
RcIn = (RC *)&PR_RAM->B[a->ram_inw(a, &PR_RAM->NextRc)];
/* for all return codes do ... */
while (Count--) {
if ((Rc = a->ram_in(a, &RcIn->Rc)) != 0) {
dword tmp[2];
/*
Get extended information, associated with return code
*/
a->ram_in_buffer(a,
&RcIn->Reserved2[0],
(byte *)&tmp[0],
8);
/* call return code handler, if it is not our return code */
/* the handler returns 2 */
/* for all return codes we process, we clear the Rc field */
isdn_rc(a,
Rc,
a->ram_in(a, &RcIn->RcId),
a->ram_in(a, &RcIn->RcCh),
a->ram_inw(a, &RcIn->Reference),
tmp[0], /* type of extended information */
tmp[1]); /* extended information */
a->ram_out(a, &RcIn->Rc, 0);
}
/* get buffer address of next return code */
RcIn = (RC *)&PR_RAM->B[a->ram_inw(a, &RcIn->next)];
}
/* clear all return codes (no chaining!) */
a->ram_out(a, &PR_RAM->RcOutput, 0);
/* call output function */
pr_out(a);
}
/* clear RNR flag */
RNRId = 0;
/* if indications are available ... */
if ((Count = a->ram_in(a, &PR_RAM->IndOutput)) != 0) {
dtrc(dprintf("#Ind=%x", Count));
/* get the buffer address of the first indication */
IndIn = (IND *)&PR_RAM->B[a->ram_inw(a, &PR_RAM->NextInd)];
/* for all indications do ... */
while (Count--) {
/* if the application marks an indication as RNR, all */
/* indications from the same Id delivered in this interrupt */
/* are marked RNR */
if (RNRId && RNRId == a->ram_in(a, &IndIn->IndId)) {
a->ram_out(a, &IndIn->Ind, 0);
a->ram_out(a, &IndIn->RNR, true);
}
else {
Ind = a->ram_in(a, &IndIn->Ind);
if (Ind) {
RNRId = 0;
/* call indication handler, a return value of 2 means chain */
/* a return value of 1 means RNR */
/* for all indications we process, we clear the Ind field */
c = isdn_ind(a,
Ind,
a->ram_in(a, &IndIn->IndId),
a->ram_in(a, &IndIn->IndCh),
&IndIn->RBuffer,
a->ram_in(a, &IndIn->MInd),
a->ram_inw(a, &IndIn->MLength));
if (c == 1) {
dtrc(dprintf("RNR"));
a->ram_out(a, &IndIn->Ind, 0);
RNRId = a->ram_in(a, &IndIn->IndId);
a->ram_out(a, &IndIn->RNR, true);
}
}
}
/* get buffer address of next indication */
IndIn = (IND *)&PR_RAM->B[a->ram_inw(a, &IndIn->next)];
}
a->ram_out(a, &PR_RAM->IndOutput, 0);
}
return false;
}
byte scom_test_int(ADAPTER *a)
{
return a->ram_in(a, (void *)0x3fe);
}
void scom_clear_int(ADAPTER *a)
{
a->ram_out(a, (void *)0x3fe, 0);
}
/*------------------------------------------------------------------*/
/* return code handler */
/*------------------------------------------------------------------*/
static byte isdn_rc(ADAPTER *a,
byte Rc,
byte Id,
byte Ch,
word Ref,
dword extended_info_type,
dword extended_info)
{
ENTITY *this;
byte e_no;
word i;
int cancel_rc;
#ifdef USE_EXTENDED_DEBUGS
{
DBG_TRC(("<A%d Id=0x%x Rc=0x%x", ((ISDN_ADAPTER *)a->io)->ANum, Id, Rc))
}
#else
dbug(dprintf("isdn_rc(Rc=%x,Id=%x,Ch=%x)", Rc, Id, Ch));
#endif
/* check for ready interrupt */
if (Rc == READY_INT) {
xdi_xlog_rc_event(XDI_A_NR(a), Id, Ch, Rc, 0, 0);
if (a->ReadyInt) {
a->ReadyInt--;
return 0;
}
return 2;
}
/* if we know this Id ... */
e_no = a->IdTable[Id];
if (e_no) {
this = entity_ptr(a, e_no);
xdi_xlog_rc_event(XDI_A_NR(a), Id, Ch, Rc, 0, a->IdTypeTable[this->No]);
this->RcCh = Ch;
/* if it is a return code to a REMOVE request, remove the */
/* Id from our table */
if ((a->misc_flags_table[e_no] & DIVA_MISC_FLAGS_REMOVE_PENDING) &&
(Rc == OK)) {
if (a->IdTypeTable[e_no] == NL_ID) {
if (a->RcExtensionSupported &&
(extended_info_type != DIVA_RC_TYPE_REMOVE_COMPLETE)) {
dtrc(dprintf("XDI: N-REMOVE, A(%02x) Id:%02x, ignore RC=OK",
XDI_A_NR(a), Id));
return (0);
}
if (extended_info_type == DIVA_RC_TYPE_REMOVE_COMPLETE)
a->RcExtensionSupported = true;
}
a->misc_flags_table[e_no] &= ~DIVA_MISC_FLAGS_REMOVE_PENDING;
a->misc_flags_table[e_no] &= ~DIVA_MISC_FLAGS_NO_RC_CANCELLING;
free_entity(a, e_no);
for (i = 0; i < 256; i++)
{
if (a->FlowControlIdTable[i] == Id)
a->FlowControlIdTable[i] = 0;
}
a->IdTable[Id] = 0;
this->Id = 0;
/* ---------------------------------------------------------------
If we send N_DISC or N_DISK_ACK after we have received OK_FC
then the card will respond with OK_FC and later with RC==OK.
If we send N_REMOVE in this state we will receive only RC==OK
This will create the state in that the XDI is waiting for the
additional RC and does not delivery the RC to the client. This
code corrects the counter of outstanding RC's in this case.
--------------------------------------------------------------- */
if ((this->More & XMOREC) > 1) {
this->More &= ~XMOREC;
this->More |= 1;
dtrc(dprintf("XDI: correct MORE on REMOVE A(%02x) Id:%02x",
XDI_A_NR(a), Id));
}
}
if (Rc == OK_FC) {
a->FlowControlIdTable[Ch] = Id;
a->FlowControlSkipTable[Ch] = false;
this->Rc = Rc;
this->More &= ~(XBUSY | XMOREC);
this->complete = 0xff;
xdi_xlog_rc_event(XDI_A_NR(a), Id, Ch, Rc, 1, a->IdTypeTable[this->No]);
CALLBACK(a, this);
return 0;
}
/*
New protocol code sends return codes that comes from release
of flow control condition marked with DIVA_RC_TYPE_OK_FC extended
information element type.
If like return code arrives then application is able to process
all return codes self and XDI should not cances return codes.
This return code does not decrement XMOREC partial return code
counter due to fact that it was no request for this return code,
also XMOREC was not incremented.
*/
if (extended_info_type == DIVA_RC_TYPE_OK_FC) {
a->misc_flags_table[e_no] |= DIVA_MISC_FLAGS_NO_RC_CANCELLING;
this->Rc = Rc;
this->complete = 0xff;
xdi_xlog_rc_event(XDI_A_NR(a), Id, Ch, Rc, 1, a->IdTypeTable[this->No]);
DBG_TRC(("XDI OK_FC A(%02x) Id:%02x Ch:%02x Rc:%02x",
XDI_A_NR(a), Id, Ch, Rc))
CALLBACK(a, this);
return 0;
}
cancel_rc = !(a->misc_flags_table[e_no] & DIVA_MISC_FLAGS_NO_RC_CANCELLING);
if (cancel_rc && (a->FlowControlIdTable[Ch] == Id))
{
a->FlowControlIdTable[Ch] = 0;
if ((Rc != OK) || !a->FlowControlSkipTable[Ch])
{
this->Rc = Rc;
if (Ch == this->ReqCh)
{
this->More &= ~(XBUSY | XMOREC);
this->complete = 0xff;
}
xdi_xlog_rc_event(XDI_A_NR(a), Id, Ch, Rc, 1, a->IdTypeTable[this->No]);
CALLBACK(a, this);
}
return 0;
}
if (this->More & XMOREC)
this->More--;
/* call the application callback function */
if (((!cancel_rc) || (this->More & XMOREF)) && !(this->More & XMOREC)) {
this->Rc = Rc;
this->More &= ~XBUSY;
this->complete = 0xff;
xdi_xlog_rc_event(XDI_A_NR(a), Id, Ch, Rc, 1, a->IdTypeTable[this->No]);
CALLBACK(a, this);
}
return 0;
}
/* if it's an ASSIGN return code check if it's a return */
/* code to an ASSIGN request from us */
if ((Rc & 0xf0) == ASSIGN_RC) {
e_no = get_assign(a, Ref);
if (e_no) {
this = entity_ptr(a, e_no);
this->Id = Id;
xdi_xlog_rc_event(XDI_A_NR(a), Id, Ch, Rc, 2, a->IdTypeTable[this->No]);
/* call the application callback function */
this->Rc = Rc;
this->More &= ~XBUSY;
this->complete = 0xff;
#if defined(DIVA_ISTREAM) /* { */
if ((Rc == ASSIGN_OK) && a->ram_offset &&
(a->IdTypeTable[this->No] == NL_ID) &&
((extended_info_type == DIVA_RC_TYPE_RX_DMA) ||
(extended_info_type == DIVA_RC_TYPE_CMA_PTR)) &&
extended_info) {
dword offset = (*(a->ram_offset)) (a);
dword tmp[2];
extended_info -= offset;
#ifdef PLATFORM_GT_32BIT
a->ram_in_dw(a, (void *)ULongToPtr(extended_info), (dword *)&tmp[0], 2);
#else
a->ram_in_dw(a, (void *)extended_info, (dword *)&tmp[0], 2);
#endif
a->tx_stream[Id] = tmp[0];
a->rx_stream[Id] = tmp[1];
if (extended_info_type == DIVA_RC_TYPE_RX_DMA) {
DBG_TRC(("Id=0x%x RxDMA=%08x:%08x",
Id, a->tx_stream[Id], a->rx_stream[Id]))
a->misc_flags_table[this->No] |= DIVA_MISC_FLAGS_RX_DMA;
} else {
DBG_TRC(("Id=0x%x CMA=%08x:%08x",
Id, a->tx_stream[Id], a->rx_stream[Id]))
a->misc_flags_table[this->No] &= ~DIVA_MISC_FLAGS_RX_DMA;
a->rx_pos[Id] = 0;
a->rx_stream[Id] -= offset;
}
a->tx_pos[Id] = 0;
a->tx_stream[Id] -= offset;
} else {
a->tx_stream[Id] = 0;
a->rx_stream[Id] = 0;
a->misc_flags_table[this->No] &= ~DIVA_MISC_FLAGS_RX_DMA;
}
#endif /* } */
CALLBACK(a, this);
if (Rc == ASSIGN_OK) {
a->IdTable[Id] = e_no;
}
else
{
free_entity(a, e_no);
for (i = 0; i < 256; i++)
{
if (a->FlowControlIdTable[i] == Id)
a->FlowControlIdTable[i] = 0;
}
a->IdTable[Id] = 0;
this->Id = 0;
}
return 1;
}
}
return 2;
}
/*------------------------------------------------------------------*/
/* indication handler */
/*------------------------------------------------------------------*/
static byte isdn_ind(ADAPTER *a,
byte Ind,
byte Id,
byte Ch,
PBUFFER *RBuffer,
byte MInd,
word MLength)
{
ENTITY *this;
word clength;
word offset;
BUFFERS *R;
byte *cma = NULL;
#ifdef USE_EXTENDED_DEBUGS
{
DBG_TRC(("<A%d Id=0x%x Ind=0x%x", ((ISDN_ADAPTER *)a->io)->ANum, Id, Ind))
}
#else
dbug(dprintf("isdn_ind(Ind=%x,Id=%x,Ch=%x)", Ind, Id, Ch));
#endif
if (a->IdTable[Id]) {
this = entity_ptr(a, a->IdTable[Id]);
this->IndCh = Ch;
xdi_xlog_ind(XDI_A_NR(a), Id, Ch, Ind,
0/* rnr_valid */, 0 /* rnr */, a->IdTypeTable[this->No]);
/* if the Receive More flag is not yet set, this is the */
/* first buffer of the packet */
if (this->RCurrent == 0xff) {
/* check for receive buffer chaining */
if (Ind == this->MInd) {
this->complete = 0;
this->Ind = MInd;
}
else {
this->complete = 1;
this->Ind = Ind;
}
/* call the application callback function for the receive */
/* look ahead */
this->RLength = MLength;
#if defined(DIVA_ISTREAM)
if ((a->rx_stream[this->Id] ||
(a->misc_flags_table[this->No] & DIVA_MISC_FLAGS_RX_DMA)) &&
((Ind == N_DATA) ||
(a->protocol_capabilities & PROTCAP_CMA_ALLPR))) {
PISDN_ADAPTER IoAdapter = (PISDN_ADAPTER)a->io;
if (a->misc_flags_table[this->No] & DIVA_MISC_FLAGS_RX_DMA) {
#if defined(DIVA_IDI_RX_DMA)
dword d;
diva_get_dma_map_entry(\
(struct _diva_dma_map_entry *)IoAdapter->dma_map,
(int)a->rx_stream[this->Id], (void **)&cma, &d);
#else
cma = &a->stream_buffer[0];
cma[0] = cma[1] = cma[2] = cma[3] = 0;
#endif
this->RLength = MLength = (word)*(dword *)cma;
cma += 4;
} else {
int final = 0;
cma = &a->stream_buffer[0];
this->RLength = MLength = (word)diva_istream_read(a,
Id,
cma,
sizeof(a->stream_buffer),
&final, NULL, NULL);
}
IoAdapter->RBuffer.length = min(MLength, (word)270);
if (IoAdapter->RBuffer.length != MLength) {
this->complete = 0;
} else {
this->complete = 1;
}
memcpy(IoAdapter->RBuffer.P, cma, IoAdapter->RBuffer.length);
this->RBuffer = (DBUFFER *)&IoAdapter->RBuffer;
}
#endif
if (!cma) {
a->ram_look_ahead(a, RBuffer, this);
}
this->RNum = 0;
CALLBACK(a, this);
/* map entity ptr, selector could be re-mapped by call to */
/* IDI from within callback */
this = entity_ptr(a, a->IdTable[Id]);
xdi_xlog_ind(XDI_A_NR(a), Id, Ch, Ind,
1/* rnr_valid */, this->RNR/* rnr */, a->IdTypeTable[this->No]);
/* check for RNR */
if (this->RNR == 1) {
this->RNR = 0;
return 1;
}
/* if no buffers are provided by the application, the */
/* application want to copy the data itself including */
/* N_MDATA/LL_MDATA chaining */
if (!this->RNR && !this->RNum) {
xdi_xlog_ind(XDI_A_NR(a), Id, Ch, Ind,
2/* rnr_valid */, 0/* rnr */, a->IdTypeTable[this->No]);
return 0;
}
/* if there is no RNR, set the More flag */
this->RCurrent = 0;
this->ROffset = 0;
}
if (this->RNR == 2) {
if (Ind != this->MInd) {
this->RCurrent = 0xff;
this->RNR = 0;
}
return 0;
}
/* if we have received buffers from the application, copy */
/* the data into these buffers */
offset = 0;
R = PTR_R(a, this);
do {
if (this->ROffset == R[this->RCurrent].PLength) {
this->ROffset = 0;
this->RCurrent++;
}
if (cma) {
clength = min(MLength, (word)(R[this->RCurrent].PLength-this->ROffset));
} else {
clength = min(a->ram_inw(a, &RBuffer->length)-offset,
R[this->RCurrent].PLength-this->ROffset);
}
if (R[this->RCurrent].P) {
if (cma) {
memcpy(PTR_P(a, this, &R[this->RCurrent].P[this->ROffset]),
&cma[offset],
clength);
} else {
a->ram_in_buffer(a,
&RBuffer->P[offset],
PTR_P(a, this, &R[this->RCurrent].P[this->ROffset]),
clength);
}
}
offset += clength;
this->ROffset += clength;
if (cma) {
if (offset >= MLength) {
break;
}
continue;
}
} while (offset < (a->ram_inw(a, &RBuffer->length)));
/* if it's the last buffer of the packet, call the */
/* application callback function for the receive complete */
/* call */
if (Ind != this->MInd) {
R[this->RCurrent].PLength = this->ROffset;
if (this->ROffset) this->RCurrent++;
this->RNum = this->RCurrent;
this->RCurrent = 0xff;
this->Ind = Ind;
this->complete = 2;
xdi_xlog_ind(XDI_A_NR(a), Id, Ch, Ind,
3/* rnr_valid */, 0/* rnr */, a->IdTypeTable[this->No]);
CALLBACK(a, this);
}
return 0;
}
return 2;
}
#if defined(XDI_USE_XLOG)
/* -----------------------------------------------------------
This function works in the same way as xlog on the
active board
----------------------------------------------------------- */
static void xdi_xlog(byte *msg, word code, int length) {
xdi_dbg_xlog("\x00\x02", msg, code, length);
}
#endif
/* -----------------------------------------------------------
This function writes the information about the Return Code
processing in the trace buffer. Trace ID is 221.
INPUT:
Adapter - system unicue adapter number (0 ... 255)
Id - Id of the entity that had sent this return code
Ch - Channel of the entity that had sent this return code
Rc - return code value
cb: (0...2)
switch (cb) {
case 0: printf ("DELIVERY"); break;
case 1: printf ("CALLBACK"); break;
case 2: printf ("ASSIGN"); break;
}
DELIVERY - have entered isdn_rc with this RC
CALLBACK - about to make callback to the application
for this RC
ASSIGN - about to make callback for RC that is result
of ASSIGN request. It is no DELIVERY message
before of this message
type - the Id that was sent by the ASSIGN of this entity.
This should be global Id like NL_ID, DSIG_ID, MAN_ID.
An unknown Id will cause "?-" in the front of the request.
In this case the log.c is to be extended.
----------------------------------------------------------- */
static void xdi_xlog_rc_event(byte Adapter,
byte Id, byte Ch, byte Rc, byte cb, byte type) {
#if defined(XDI_USE_XLOG)
word LogInfo[4];
PUT_WORD(&LogInfo[0], ((word)Adapter | (word)(xdi_xlog_sec++ << 8)));
PUT_WORD(&LogInfo[1], ((word)Id | (word)(Ch << 8)));
PUT_WORD(&LogInfo[2], ((word)Rc | (word)(type << 8)));
PUT_WORD(&LogInfo[3], cb);
xdi_xlog((byte *)&LogInfo[0], 221, sizeof(LogInfo));
#endif
}
/* ------------------------------------------------------------------------
This function writes the information about the request processing
in the trace buffer. Trace ID is 220.
INPUT:
Adapter - system unicue adapter number (0 ... 255)
Id - Id of the entity that had sent this request
Ch - Channel of the entity that had sent this request
Req - Code of the request
type - the Id that was sent by the ASSIGN of this entity.
This should be global Id like NL_ID, DSIG_ID, MAN_ID.
An unknown Id will cause "?-" in the front of the request.
In this case the log.c is to be extended.
------------------------------------------------------------------------ */
static void xdi_xlog_request(byte Adapter, byte Id,
byte Ch, byte Req, byte type) {
#if defined(XDI_USE_XLOG)
word LogInfo[3];
PUT_WORD(&LogInfo[0], ((word)Adapter | (word)(xdi_xlog_sec++ << 8)));
PUT_WORD(&LogInfo[1], ((word)Id | (word)(Ch << 8)));
PUT_WORD(&LogInfo[2], ((word)Req | (word)(type << 8)));
xdi_xlog((byte *)&LogInfo[0], 220, sizeof(LogInfo));
#endif
}
/* ------------------------------------------------------------------------
This function writes the information about the indication processing
in the trace buffer. Trace ID is 222.
INPUT:
Adapter - system unicue adapter number (0 ... 255)
Id - Id of the entity that had sent this indication
Ch - Channel of the entity that had sent this indication
Ind - Code of the indication
rnr_valid: (0 .. 3) supported
switch (rnr_valid) {
case 0: printf ("DELIVERY"); break;
case 1: printf ("RNR=%d", rnr);
case 2: printf ("RNum=0");
case 3: printf ("COMPLETE");
}
DELIVERY - indication entered isdn_rc function
RNR=... - application had returned RNR=... after the
look ahead callback
RNum=0 - application had not returned any buffer to copy
this indication and will copy it self
COMPLETE - XDI had copied the data to the buffers provided
bu the application and is about to issue the
final callback
rnr: Look case 1 of the rnr_valid
type: the Id that was sent by the ASSIGN of this entity. This should
be global Id like NL_ID, DSIG_ID, MAN_ID. An unknown Id will
cause "?-" in the front of the request. In this case the
log.c is to be extended.
------------------------------------------------------------------------ */
static void xdi_xlog_ind(byte Adapter,
byte Id,
byte Ch,
byte Ind,
byte rnr_valid,
byte rnr,
byte type) {
#if defined(XDI_USE_XLOG)
word LogInfo[4];
PUT_WORD(&LogInfo[0], ((word)Adapter | (word)(xdi_xlog_sec++ << 8)));
PUT_WORD(&LogInfo[1], ((word)Id | (word)(Ch << 8)));
PUT_WORD(&LogInfo[2], ((word)Ind | (word)(type << 8)));
PUT_WORD(&LogInfo[3], ((word)rnr | (word)(rnr_valid << 8)));
xdi_xlog((byte *)&LogInfo[0], 222, sizeof(LogInfo));
#endif
}

View File

@ -1,118 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/*
* some macros for detailed trace management
*/
#include "di_dbg.h"
/*****************************************************************************/
#define XMOREC 0x1f
#define XMOREF 0x20
#define XBUSY 0x40
#define RMORE 0x80
#define DIVA_MISC_FLAGS_REMOVE_PENDING 0x01
#define DIVA_MISC_FLAGS_NO_RC_CANCELLING 0x02
#define DIVA_MISC_FLAGS_RX_DMA 0x04
/* structure for all information we have to keep on a per */
/* adapater basis */
typedef struct adapter_s ADAPTER;
struct adapter_s {
void *io;
byte IdTable[256];
byte IdTypeTable[256];
byte FlowControlIdTable[256];
byte FlowControlSkipTable[256];
byte ReadyInt;
byte RcExtensionSupported;
byte misc_flags_table[256];
dword protocol_capabilities;
byte (*ram_in)(ADAPTER *a, void *adr);
word (*ram_inw)(ADAPTER *a, void *adr);
void (*ram_in_buffer)(ADAPTER *a, void *adr, void *P, word length);
void (*ram_look_ahead)(ADAPTER *a, PBUFFER *RBuffer, ENTITY *e);
void (*ram_out)(ADAPTER *a, void *adr, byte data);
void (*ram_outw)(ADAPTER *a, void *adr, word data);
void (*ram_out_buffer)(ADAPTER *a, void *adr, void *P, word length);
void (*ram_inc)(ADAPTER *a, void *adr);
#if defined(DIVA_ISTREAM)
dword rx_stream[256];
dword tx_stream[256];
word tx_pos[256];
word rx_pos[256];
byte stream_buffer[2512];
dword (*ram_offset)(ADAPTER *a);
void (*ram_out_dw)(ADAPTER *a,
void *addr,
const dword *data,
int dwords);
void (*ram_in_dw)(ADAPTER *a,
void *addr,
dword *data,
int dwords);
void (*istream_wakeup)(ADAPTER *a);
#else
byte stream_buffer[4];
#endif
};
/*------------------------------------------------------------------*/
/* public functions of IDI common code */
/*------------------------------------------------------------------*/
void pr_out(ADAPTER *a);
byte pr_dpc(ADAPTER *a);
byte scom_test_int(ADAPTER *a);
void scom_clear_int(ADAPTER *a);
/*------------------------------------------------------------------*/
/* OS specific functions used by IDI common code */
/*------------------------------------------------------------------*/
void free_entity(ADAPTER *a, byte e_no);
void assign_queue(ADAPTER *a, byte e_no, word ref);
byte get_assign(ADAPTER *a, word ref);
void req_queue(ADAPTER *a, byte e_no);
byte look_req(ADAPTER *a);
void next_req(ADAPTER *a);
ENTITY *entity_ptr(ADAPTER *a, byte e_no);
#if defined(DIVA_ISTREAM)
struct _diva_xdi_stream_interface;
void diva_xdi_provide_istream_info(ADAPTER *a,
struct _diva_xdi_stream_interface *pI);
void pr_stream(ADAPTER *a);
int diva_istream_write(void *context,
int Id,
void *data,
int length,
int final,
byte usr1,
byte usr2);
int diva_istream_read(void *context,
int Id,
void *data,
int max_length,
int *final,
byte *usr1,
byte *usr2);
#if defined(DIVA_IDI_RX_DMA)
#include "diva_dma.h"
#endif
#endif

View File

@ -1,37 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef __DIVA_DI_DBG_INC__
#define __DIVA_DI_DBG_INC__
#if !defined(dtrc)
#define dtrc(a)
#endif
#if !defined(dbug)
#define dbug(a)
#endif
#if !defined USE_EXTENDED_DEBUGS
extern void (*dprintf)(char*, ...);
#endif
#endif

View File

@ -1,181 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef _DI_DEFS_
#define _DI_DEFS_
/* typedefs for our data structures */
typedef struct get_name_s GET_NAME;
/* The entity_s structure is used to pass all
parameters between application and IDI */
typedef struct entity_s ENTITY;
typedef struct buffers_s BUFFERS;
typedef struct postcall_s POSTCALL;
typedef struct get_para_s GET_PARA;
#define BOARD_NAME_LENGTH 9
#define IDI_CALL_LINK_T
#define IDI_CALL_ENTITY_T
/* typedef void ( * IDI_CALL)(ENTITY *); */
/* --------------------------------------------------------
IDI_CALL
-------------------------------------------------------- */
typedef void (IDI_CALL_LINK_T *IDI_CALL)(ENTITY IDI_CALL_ENTITY_T *);
typedef struct {
word length; /* length of data/parameter field */
byte P[270]; /* data/parameter field */
} DBUFFER;
struct get_name_s {
word command; /* command = 0x0100 */
byte name[BOARD_NAME_LENGTH];
};
struct postcall_s {
word command; /* command = 0x0300 */
word dummy; /* not used */
void (*callback)(void *); /* call back */
void *context; /* context pointer */
};
#define REQ_PARA 0x0600 /* request command line parameters */
#define REQ_PARA_LEN 1 /* number of data bytes */
#define L1_STARTUP_DOWN_POS 0 /* '-y' command line parameter in......*/
#define L1_STARTUP_DOWN_MSK 0x01 /* first byte position (index 0) with value 0x01 */
struct get_para_s {
word command; /* command = 0x0600 */
byte len; /* max length of para field in bytes */
byte para[REQ_PARA_LEN]; /* parameter field */
};
struct buffers_s {
word PLength;
byte *P;
};
struct entity_s {
byte Req; /* pending request */
byte Rc; /* return code received */
byte Ind; /* indication received */
byte ReqCh; /* channel of current Req */
byte RcCh; /* channel of current Rc */
byte IndCh; /* channel of current Ind */
byte Id; /* ID used by this entity */
byte GlobalId; /* reserved field */
byte XNum; /* number of X-buffers */
byte RNum; /* number of R-buffers */
BUFFERS *X; /* pointer to X-buffer list */
BUFFERS *R; /* pointer to R-buffer list */
word RLength; /* length of current R-data */
DBUFFER *RBuffer; /* buffer of current R-data */
byte RNR; /* receive not ready flag */
byte complete; /* receive complete status */
IDI_CALL callback;
word user[2];
/* fields used by the driver internally */
byte No; /* entity number */
byte reserved2; /* reserved field */
byte More; /* R/X More flags */
byte MInd; /* MDATA coding for this ID */
byte XCurrent; /* current transmit buffer */
byte RCurrent; /* current receive buffer */
word XOffset; /* offset in x-buffer */
word ROffset; /* offset in r-buffer */
};
typedef struct {
byte type;
byte channels;
word features;
IDI_CALL request;
} DESCRIPTOR;
/* descriptor type field coding */
#define IDI_ADAPTER_S 1
#define IDI_ADAPTER_PR 2
#define IDI_ADAPTER_DIVA 3
#define IDI_ADAPTER_MAESTRA 4
#define IDI_VADAPTER 0x40
#define IDI_DRIVER 0x80
#define IDI_DADAPTER 0xfd
#define IDI_DIDDPNP 0xfe
#define IDI_DIMAINT 0xff
/* Hardware IDs ISA PNP */
#define HW_ID_DIVA_PRO 3 /* same as IDI_ADAPTER_DIVA */
#define HW_ID_MAESTRA 4 /* same as IDI_ADAPTER_MAESTRA */
#define HW_ID_PICCOLA 5
#define HW_ID_DIVA_PRO20 6
#define HW_ID_DIVA20 7
#define HW_ID_DIVA_PRO20_U 8
#define HW_ID_DIVA20_U 9
#define HW_ID_DIVA30 10
#define HW_ID_DIVA30_U 11
/* Hardware IDs PCI */
#define HW_ID_EICON_PCI 0x1133
#define HW_ID_SIEMENS_PCI 0x8001 /* unused SubVendor ID for Siemens Cornet-N cards */
#define HW_ID_PROTTYPE_CORNETN 0x0014 /* SubDevice ID for Siemens Cornet-N cards */
#define HW_ID_FUJITSU_SIEMENS_PCI 0x110A /* SubVendor ID for Fujitsu Siemens */
#define HW_ID_GS03_PCI 0x0021 /* SubDevice ID for Fujitsu Siemens ISDN S0 card */
#define HW_ID_DIVA_PRO20_PCI 0xe001
#define HW_ID_DIVA20_PCI 0xe002
#define HW_ID_DIVA_PRO20_PCI_U 0xe003
#define HW_ID_DIVA20_PCI_U 0xe004
#define HW_ID_DIVA201_PCI 0xe005
#define HW_ID_DIVA_CT_ST 0xe006
#define HW_ID_DIVA_CT_U 0xe007
#define HW_ID_DIVA_CTL_ST 0xe008
#define HW_ID_DIVA_CTL_U 0xe009
#define HW_ID_DIVA_ISDN_V90_PCI 0xe00a
#define HW_ID_DIVA202_PCI_ST 0xe00b
#define HW_ID_DIVA202_PCI_U 0xe00c
#define HW_ID_DIVA_PRO30_PCI 0xe00d
#define HW_ID_MAESTRA_PCI 0xe010
#define HW_ID_MAESTRAQ_PCI 0xe012
#define HW_ID_DSRV_Q8M_V2_PCI 0xe013
#define HW_ID_MAESTRAP_PCI 0xe014
#define HW_ID_DSRV_P30M_V2_PCI 0xe015
#define HW_ID_DSRV_VOICE_Q8M_PCI 0xe016
#define HW_ID_DSRV_VOICE_Q8M_V2_PCI 0xe017
#define HW_ID_DSRV_B2M_V2_PCI 0xe018
#define HW_ID_DSRV_VOICE_P30M_V2_PCI 0xe019
#define HW_ID_DSRV_B2F_PCI 0xe01a
#define HW_ID_DSRV_VOICE_B2M_V2_PCI 0xe01b
/* Hardware IDs USB */
#define EICON_USB_VENDOR_ID 0x071D
#define HW_ID_DIVA_USB_REV1 0x1000
#define HW_ID_DIVA_USB_REV2 0x1003
#define HW_ID_TELEDAT_SURF_USB_REV2 0x1004
#define HW_ID_TELEDAT_SURF_USB_REV1 0x2000
/* --------------------------------------------------------------------------
Adapter array change notification framework
-------------------------------------------------------------------------- */
typedef void (IDI_CALL_LINK_T *didd_adapter_change_callback_t)(void IDI_CALL_ENTITY_T *context, DESCRIPTOR *adapter, int removal);
/* -------------------------------------------------------------------------- */
#define DI_VOICE 0x0 /* obsolete define */
#define DI_FAX3 0x1
#define DI_MODEM 0x2
#define DI_POST 0x4
#define DI_V110 0x8
#define DI_V120 0x10
#define DI_POTS 0x20
#define DI_CODEC 0x40
#define DI_MANAGE 0x80
#define DI_V_42 0x0100
#define DI_EXTD_FAX 0x0200 /* Extended FAX (ECM, 2D, T.6, Polling) */
#define DI_AT_PARSER 0x0400 /* Build-in AT Parser in the L2 */
#define DI_VOICE_OVER_IP 0x0800 /* Voice over IP support */
typedef void (IDI_CALL_LINK_T *_IDI_CALL)(void *, ENTITY *);
#endif

View File

@ -1,26 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
static char diva_didd_common_code_build[] = "102-51";

View File

@ -1,115 +0,0 @@
/* $Id: diddfunc.c,v 1.14.6.2 2004/08/28 20:03:53 armin Exp $
*
* DIDD Interface module for Eicon active cards.
*
* Functions are in dadapter.c
*
* Copyright 2002-2003 by Armin Schindler (mac@melware.de)
* Copyright 2002-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*/
#include "platform.h"
#include "di_defs.h"
#include "dadapter.h"
#include "divasync.h"
#define DBG_MINIMUM (DL_LOG + DL_FTL + DL_ERR)
#define DBG_DEFAULT (DBG_MINIMUM + DL_XLOG + DL_REG)
extern void DIVA_DIDD_Read(void *, int);
extern char *DRIVERRELEASE_DIDD;
static dword notify_handle;
static DESCRIPTOR _DAdapter;
/*
* didd callback function
*/
static void *didd_callback(void *context, DESCRIPTOR *adapter,
int removal)
{
if (adapter->type == IDI_DADAPTER) {
DBG_ERR(("Notification about IDI_DADAPTER change ! Oops."))
return (NULL);
} else if (adapter->type == IDI_DIMAINT) {
if (removal) {
DbgDeregister();
} else {
DbgRegister("DIDD", DRIVERRELEASE_DIDD, DBG_DEFAULT);
}
}
return (NULL);
}
/*
* connect to didd
*/
static int __init connect_didd(void)
{
int x = 0;
int dadapter = 0;
IDI_SYNC_REQ req;
DESCRIPTOR DIDD_Table[MAX_DESCRIPTORS];
DIVA_DIDD_Read(DIDD_Table, sizeof(DIDD_Table));
for (x = 0; x < MAX_DESCRIPTORS; x++) {
if (DIDD_Table[x].type == IDI_DADAPTER) { /* DADAPTER found */
dadapter = 1;
memcpy(&_DAdapter, &DIDD_Table[x], sizeof(_DAdapter));
req.didd_notify.e.Req = 0;
req.didd_notify.e.Rc =
IDI_SYNC_REQ_DIDD_REGISTER_ADAPTER_NOTIFY;
req.didd_notify.info.callback = (void *)didd_callback;
req.didd_notify.info.context = NULL;
_DAdapter.request((ENTITY *)&req);
if (req.didd_notify.e.Rc != 0xff)
return (0);
notify_handle = req.didd_notify.info.handle;
} else if (DIDD_Table[x].type == IDI_DIMAINT) { /* MAINT found */
DbgRegister("DIDD", DRIVERRELEASE_DIDD, DBG_DEFAULT);
}
}
return (dadapter);
}
/*
* disconnect from didd
*/
static void __exit disconnect_didd(void)
{
IDI_SYNC_REQ req;
req.didd_notify.e.Req = 0;
req.didd_notify.e.Rc = IDI_SYNC_REQ_DIDD_REMOVE_ADAPTER_NOTIFY;
req.didd_notify.info.handle = notify_handle;
_DAdapter.request((ENTITY *)&req);
}
/*
* init
*/
int __init diddfunc_init(void)
{
diva_didd_load_time_init();
if (!connect_didd()) {
DBG_ERR(("init: failed to connect to DIDD."))
diva_didd_load_time_finit();
return (0);
}
return (1);
}
/*
* finit
*/
void __exit diddfunc_finit(void)
{
DbgDeregister();
disconnect_didd();
diva_didd_load_time_finit();
}

View File

@ -1,666 +0,0 @@
// SPDX-License-Identifier: GPL-2.0
/* $Id: diva.c,v 1.21.4.1 2004/05/08 14:33:43 armin Exp $ */
#define CARDTYPE_H_WANT_DATA 1
#define CARDTYPE_H_WANT_IDI_DATA 0
#define CARDTYPE_H_WANT_RESOURCE_DATA 0
#define CARDTYPE_H_WANT_FILE_DATA 0
#include "platform.h"
#include "debuglib.h"
#include "cardtype.h"
#include "pc.h"
#include "di_defs.h"
#include "di.h"
#include "io.h"
#include "pc_maint.h"
#include "xdi_msg.h"
#include "xdi_adapter.h"
#include "diva_pci.h"
#include "diva.h"
#ifdef CONFIG_ISDN_DIVAS_PRIPCI
#include "os_pri.h"
#endif
#ifdef CONFIG_ISDN_DIVAS_BRIPCI
#include "os_bri.h"
#include "os_4bri.h"
#endif
PISDN_ADAPTER IoAdapters[MAX_ADAPTER];
extern IDI_CALL Requests[MAX_ADAPTER];
extern int create_adapter_proc(diva_os_xdi_adapter_t *a);
extern void remove_adapter_proc(diva_os_xdi_adapter_t *a);
#define DivaIdiReqFunc(N) \
static void DivaIdiRequest##N(ENTITY *e) \
{ if (IoAdapters[N]) (*IoAdapters[N]->DIRequest)(IoAdapters[N], e); }
/*
** Create own 32 Adapters
*/
DivaIdiReqFunc(0)
DivaIdiReqFunc(1)
DivaIdiReqFunc(2)
DivaIdiReqFunc(3)
DivaIdiReqFunc(4)
DivaIdiReqFunc(5)
DivaIdiReqFunc(6)
DivaIdiReqFunc(7)
DivaIdiReqFunc(8)
DivaIdiReqFunc(9)
DivaIdiReqFunc(10)
DivaIdiReqFunc(11)
DivaIdiReqFunc(12)
DivaIdiReqFunc(13)
DivaIdiReqFunc(14)
DivaIdiReqFunc(15)
DivaIdiReqFunc(16)
DivaIdiReqFunc(17)
DivaIdiReqFunc(18)
DivaIdiReqFunc(19)
DivaIdiReqFunc(20)
DivaIdiReqFunc(21)
DivaIdiReqFunc(22)
DivaIdiReqFunc(23)
DivaIdiReqFunc(24)
DivaIdiReqFunc(25)
DivaIdiReqFunc(26)
DivaIdiReqFunc(27)
DivaIdiReqFunc(28)
DivaIdiReqFunc(29)
DivaIdiReqFunc(30)
DivaIdiReqFunc(31)
/*
** LOCALS
*/
static LIST_HEAD(adapter_queue);
typedef struct _diva_get_xlog {
word command;
byte req;
byte rc;
byte data[sizeof(struct mi_pc_maint)];
} diva_get_xlog_t;
typedef struct _diva_supported_cards_info {
int CardOrdinal;
diva_init_card_proc_t init_card;
} diva_supported_cards_info_t;
static diva_supported_cards_info_t divas_supported_cards[] = {
#ifdef CONFIG_ISDN_DIVAS_PRIPCI
/*
PRI Cards
*/
{CARDTYPE_DIVASRV_P_30M_PCI, diva_pri_init_card},
/*
PRI Rev.2 Cards
*/
{CARDTYPE_DIVASRV_P_30M_V2_PCI, diva_pri_init_card},
/*
PRI Rev.2 VoIP Cards
*/
{CARDTYPE_DIVASRV_VOICE_P_30M_V2_PCI, diva_pri_init_card},
#endif
#ifdef CONFIG_ISDN_DIVAS_BRIPCI
/*
4BRI Rev 1 Cards
*/
{CARDTYPE_DIVASRV_Q_8M_PCI, diva_4bri_init_card},
{CARDTYPE_DIVASRV_VOICE_Q_8M_PCI, diva_4bri_init_card},
/*
4BRI Rev 2 Cards
*/
{CARDTYPE_DIVASRV_Q_8M_V2_PCI, diva_4bri_init_card},
{CARDTYPE_DIVASRV_VOICE_Q_8M_V2_PCI, diva_4bri_init_card},
/*
4BRI Based BRI Rev 2 Cards
*/
{CARDTYPE_DIVASRV_B_2M_V2_PCI, diva_4bri_init_card},
{CARDTYPE_DIVASRV_B_2F_PCI, diva_4bri_init_card},
{CARDTYPE_DIVASRV_VOICE_B_2M_V2_PCI, diva_4bri_init_card},
/*
BRI
*/
{CARDTYPE_MAESTRA_PCI, diva_bri_init_card},
#endif
/*
EOL
*/
{-1}
};
static void diva_init_request_array(void);
static void *divas_create_pci_card(int handle, void *pci_dev_handle);
static diva_os_spin_lock_t adapter_lock;
static int diva_find_free_adapters(int base, int nr)
{
int i;
for (i = 0; i < nr; i++) {
if (IoAdapters[base + i]) {
return (-1);
}
}
return (0);
}
static diva_os_xdi_adapter_t *diva_q_get_next(struct list_head *what)
{
diva_os_xdi_adapter_t *a = NULL;
if (what && (what->next != &adapter_queue))
a = list_entry(what->next, diva_os_xdi_adapter_t, link);
return (a);
}
/* --------------------------------------------------------------------------
Add card to the card list
-------------------------------------------------------------------------- */
void *diva_driver_add_card(void *pdev, unsigned long CardOrdinal)
{
diva_os_spin_lock_magic_t old_irql;
diva_os_xdi_adapter_t *pdiva, *pa;
int i, j, max, nr;
for (i = 0; divas_supported_cards[i].CardOrdinal != -1; i++) {
if (divas_supported_cards[i].CardOrdinal == CardOrdinal) {
if (!(pdiva = divas_create_pci_card(i, pdev))) {
return NULL;
}
switch (CardOrdinal) {
case CARDTYPE_DIVASRV_Q_8M_PCI:
case CARDTYPE_DIVASRV_VOICE_Q_8M_PCI:
case CARDTYPE_DIVASRV_Q_8M_V2_PCI:
case CARDTYPE_DIVASRV_VOICE_Q_8M_V2_PCI:
max = MAX_ADAPTER - 4;
nr = 4;
break;
default:
max = MAX_ADAPTER;
nr = 1;
}
diva_os_enter_spin_lock(&adapter_lock, &old_irql, "add card");
for (i = 0; i < max; i++) {
if (!diva_find_free_adapters(i, nr)) {
pdiva->controller = i + 1;
pdiva->xdi_adapter.ANum = pdiva->controller;
IoAdapters[i] = &pdiva->xdi_adapter;
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "add card");
create_adapter_proc(pdiva); /* add adapter to proc file system */
DBG_LOG(("add %s:%d",
CardProperties
[CardOrdinal].Name,
pdiva->controller))
diva_os_enter_spin_lock(&adapter_lock, &old_irql, "add card");
pa = pdiva;
for (j = 1; j < nr; j++) { /* slave adapters, if any */
pa = diva_q_get_next(&pa->link);
if (pa && !pa->interface.cleanup_adapter_proc) {
pa->controller = i + 1 + j;
pa->xdi_adapter.ANum = pa->controller;
IoAdapters[i + j] = &pa->xdi_adapter;
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "add card");
DBG_LOG(("add slave adapter (%d)",
pa->controller))
create_adapter_proc(pa); /* add adapter to proc file system */
diva_os_enter_spin_lock(&adapter_lock, &old_irql, "add card");
} else {
DBG_ERR(("slave adapter problem"))
break;
}
}
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "add card");
return (pdiva);
}
}
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "add card");
/*
Not able to add adapter - remove it and return error
*/
DBG_ERR(("can not alloc request array"))
diva_driver_remove_card(pdiva);
return NULL;
}
}
return NULL;
}
/* --------------------------------------------------------------------------
Called on driver load, MAIN, main, DriverEntry
-------------------------------------------------------------------------- */
int divasa_xdi_driver_entry(void)
{
diva_os_initialize_spin_lock(&adapter_lock, "adapter");
memset(&IoAdapters[0], 0x00, sizeof(IoAdapters));
diva_init_request_array();
return (0);
}
/* --------------------------------------------------------------------------
Remove adapter from list
-------------------------------------------------------------------------- */
static diva_os_xdi_adapter_t *get_and_remove_from_queue(void)
{
diva_os_spin_lock_magic_t old_irql;
diva_os_xdi_adapter_t *a = NULL;
diva_os_enter_spin_lock(&adapter_lock, &old_irql, "driver_unload");
if (!list_empty(&adapter_queue)) {
a = list_entry(adapter_queue.next, diva_os_xdi_adapter_t, link);
list_del(adapter_queue.next);
}
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "driver_unload");
return (a);
}
/* --------------------------------------------------------------------------
Remove card from the card list
-------------------------------------------------------------------------- */
void diva_driver_remove_card(void *pdiva)
{
diva_os_spin_lock_magic_t old_irql;
diva_os_xdi_adapter_t *a[4];
diva_os_xdi_adapter_t *pa;
int i;
pa = a[0] = (diva_os_xdi_adapter_t *) pdiva;
a[1] = a[2] = a[3] = NULL;
diva_os_enter_spin_lock(&adapter_lock, &old_irql, "remode adapter");
for (i = 1; i < 4; i++) {
if ((pa = diva_q_get_next(&pa->link))
&& !pa->interface.cleanup_adapter_proc) {
a[i] = pa;
} else {
break;
}
}
for (i = 0; ((i < 4) && a[i]); i++) {
list_del(&a[i]->link);
}
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "driver_unload");
(*(a[0]->interface.cleanup_adapter_proc)) (a[0]);
for (i = 0; i < 4; i++) {
if (a[i]) {
if (a[i]->controller) {
DBG_LOG(("remove adapter (%d)",
a[i]->controller)) IoAdapters[a[i]->controller - 1] = NULL;
remove_adapter_proc(a[i]);
}
diva_os_free(0, a[i]);
}
}
}
/* --------------------------------------------------------------------------
Create diva PCI adapter and init internal adapter structures
-------------------------------------------------------------------------- */
static void *divas_create_pci_card(int handle, void *pci_dev_handle)
{
diva_supported_cards_info_t *pI = &divas_supported_cards[handle];
diva_os_spin_lock_magic_t old_irql;
diva_os_xdi_adapter_t *a;
DBG_LOG(("found %d-%s", pI->CardOrdinal, CardProperties[pI->CardOrdinal].Name))
if (!(a = (diva_os_xdi_adapter_t *) diva_os_malloc(0, sizeof(*a)))) {
DBG_ERR(("A: can't alloc adapter"));
return NULL;
}
memset(a, 0x00, sizeof(*a));
a->CardIndex = handle;
a->CardOrdinal = pI->CardOrdinal;
a->Bus = DIVAS_XDI_ADAPTER_BUS_PCI;
a->xdi_adapter.cardType = a->CardOrdinal;
a->resources.pci.bus = diva_os_get_pci_bus(pci_dev_handle);
a->resources.pci.func = diva_os_get_pci_func(pci_dev_handle);
a->resources.pci.hdev = pci_dev_handle;
/*
Add master adapter first, so slave adapters will receive higher
numbers as master adapter
*/
diva_os_enter_spin_lock(&adapter_lock, &old_irql, "found_pci_card");
list_add_tail(&a->link, &adapter_queue);
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "found_pci_card");
if ((*(pI->init_card)) (a)) {
diva_os_enter_spin_lock(&adapter_lock, &old_irql, "found_pci_card");
list_del(&a->link);
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "found_pci_card");
diva_os_free(0, a);
DBG_ERR(("A: can't get adapter resources"));
return NULL;
}
return (a);
}
/* --------------------------------------------------------------------------
Called on driver unload FINIT, finit, Unload
-------------------------------------------------------------------------- */
void divasa_xdi_driver_unload(void)
{
diva_os_xdi_adapter_t *a;
while ((a = get_and_remove_from_queue())) {
if (a->interface.cleanup_adapter_proc) {
(*(a->interface.cleanup_adapter_proc)) (a);
}
if (a->controller) {
IoAdapters[a->controller - 1] = NULL;
remove_adapter_proc(a);
}
diva_os_free(0, a);
}
diva_os_destroy_spin_lock(&adapter_lock, "adapter");
}
/*
** Receive and process command from user mode utility
*/
void *diva_xdi_open_adapter(void *os_handle, const void __user *src,
int length, void *mptr,
divas_xdi_copy_from_user_fn_t cp_fn)
{
diva_xdi_um_cfg_cmd_t *msg = (diva_xdi_um_cfg_cmd_t *)mptr;
diva_os_xdi_adapter_t *a = NULL;
diva_os_spin_lock_magic_t old_irql;
struct list_head *tmp;
if (length < sizeof(diva_xdi_um_cfg_cmd_t)) {
DBG_ERR(("A: A(?) open, msg too small (%d < %d)",
length, sizeof(diva_xdi_um_cfg_cmd_t)))
return NULL;
}
if ((*cp_fn) (os_handle, msg, src, sizeof(*msg)) <= 0) {
DBG_ERR(("A: A(?) open, write error"))
return NULL;
}
diva_os_enter_spin_lock(&adapter_lock, &old_irql, "open_adapter");
list_for_each(tmp, &adapter_queue) {
a = list_entry(tmp, diva_os_xdi_adapter_t, link);
if (a->controller == (int)msg->adapter)
break;
a = NULL;
}
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "open_adapter");
if (!a) {
DBG_ERR(("A: A(%d) open, adapter not found", msg->adapter))
}
return (a);
}
/*
** Easy cleanup mailbox status
*/
void diva_xdi_close_adapter(void *adapter, void *os_handle)
{
diva_os_xdi_adapter_t *a = (diva_os_xdi_adapter_t *) adapter;
a->xdi_mbox.status &= ~DIVA_XDI_MBOX_BUSY;
if (a->xdi_mbox.data) {
diva_os_free(0, a->xdi_mbox.data);
a->xdi_mbox.data = NULL;
}
}
int
diva_xdi_write(void *adapter, void *os_handle, const void __user *src,
int length, void *mptr,
divas_xdi_copy_from_user_fn_t cp_fn)
{
diva_xdi_um_cfg_cmd_t *msg = (diva_xdi_um_cfg_cmd_t *)mptr;
diva_os_xdi_adapter_t *a = (diva_os_xdi_adapter_t *) adapter;
void *data;
if (a->xdi_mbox.status & DIVA_XDI_MBOX_BUSY) {
DBG_ERR(("A: A(%d) write, mbox busy", a->controller))
return (-1);
}
if (length < sizeof(diva_xdi_um_cfg_cmd_t)) {
DBG_ERR(("A: A(%d) write, message too small (%d < %d)",
a->controller, length,
sizeof(diva_xdi_um_cfg_cmd_t)))
return (-3);
}
if (!(data = diva_os_malloc(0, length))) {
DBG_ERR(("A: A(%d) write, ENOMEM", a->controller))
return (-2);
}
if (msg) {
*(diva_xdi_um_cfg_cmd_t *)data = *msg;
length = (*cp_fn) (os_handle, (char *)data + sizeof(*msg),
src + sizeof(*msg), length - sizeof(*msg));
} else {
length = (*cp_fn) (os_handle, data, src, length);
}
if (length > 0) {
if ((*(a->interface.cmd_proc))
(a, (diva_xdi_um_cfg_cmd_t *) data, length)) {
length = -3;
}
} else {
DBG_ERR(("A: A(%d) write error (%d)", a->controller,
length))
}
diva_os_free(0, data);
return (length);
}
/*
** Write answers to user mode utility, if any
*/
int
diva_xdi_read(void *adapter, void *os_handle, void __user *dst,
int max_length, divas_xdi_copy_to_user_fn_t cp_fn)
{
diva_os_xdi_adapter_t *a = (diva_os_xdi_adapter_t *) adapter;
int ret;
if (!(a->xdi_mbox.status & DIVA_XDI_MBOX_BUSY)) {
DBG_ERR(("A: A(%d) rx mbox empty", a->controller))
return (-1);
}
if (!a->xdi_mbox.data) {
a->xdi_mbox.status &= ~DIVA_XDI_MBOX_BUSY;
DBG_ERR(("A: A(%d) rx ENOMEM", a->controller))
return (-2);
}
if (max_length < a->xdi_mbox.data_length) {
DBG_ERR(("A: A(%d) rx buffer too short(%d < %d)",
a->controller, max_length,
a->xdi_mbox.data_length))
return (-3);
}
ret = (*cp_fn) (os_handle, dst, a->xdi_mbox.data,
a->xdi_mbox.data_length);
if (ret > 0) {
diva_os_free(0, a->xdi_mbox.data);
a->xdi_mbox.data = NULL;
a->xdi_mbox.status &= ~DIVA_XDI_MBOX_BUSY;
}
return (ret);
}
irqreturn_t diva_os_irq_wrapper(int irq, void *context)
{
diva_os_xdi_adapter_t *a = context;
diva_xdi_clear_interrupts_proc_t clear_int_proc;
if (!a || !a->xdi_adapter.diva_isr_handler)
return IRQ_NONE;
if ((clear_int_proc = a->clear_interrupts_proc)) {
(*clear_int_proc) (a);
a->clear_interrupts_proc = NULL;
return IRQ_HANDLED;
}
(*(a->xdi_adapter.diva_isr_handler)) (&a->xdi_adapter);
return IRQ_HANDLED;
}
static void diva_init_request_array(void)
{
Requests[0] = DivaIdiRequest0;
Requests[1] = DivaIdiRequest1;
Requests[2] = DivaIdiRequest2;
Requests[3] = DivaIdiRequest3;
Requests[4] = DivaIdiRequest4;
Requests[5] = DivaIdiRequest5;
Requests[6] = DivaIdiRequest6;
Requests[7] = DivaIdiRequest7;
Requests[8] = DivaIdiRequest8;
Requests[9] = DivaIdiRequest9;
Requests[10] = DivaIdiRequest10;
Requests[11] = DivaIdiRequest11;
Requests[12] = DivaIdiRequest12;
Requests[13] = DivaIdiRequest13;
Requests[14] = DivaIdiRequest14;
Requests[15] = DivaIdiRequest15;
Requests[16] = DivaIdiRequest16;
Requests[17] = DivaIdiRequest17;
Requests[18] = DivaIdiRequest18;
Requests[19] = DivaIdiRequest19;
Requests[20] = DivaIdiRequest20;
Requests[21] = DivaIdiRequest21;
Requests[22] = DivaIdiRequest22;
Requests[23] = DivaIdiRequest23;
Requests[24] = DivaIdiRequest24;
Requests[25] = DivaIdiRequest25;
Requests[26] = DivaIdiRequest26;
Requests[27] = DivaIdiRequest27;
Requests[28] = DivaIdiRequest28;
Requests[29] = DivaIdiRequest29;
Requests[30] = DivaIdiRequest30;
Requests[31] = DivaIdiRequest31;
}
void diva_xdi_display_adapter_features(int card)
{
dword features;
if (!card || ((card - 1) >= MAX_ADAPTER) || !IoAdapters[card - 1]) {
return;
}
card--;
features = IoAdapters[card]->Properties.Features;
DBG_LOG(("FEATURES FOR ADAPTER: %d", card + 1))
DBG_LOG((" DI_FAX3 : %s",
(features & DI_FAX3) ? "Y" : "N"))
DBG_LOG((" DI_MODEM : %s",
(features & DI_MODEM) ? "Y" : "N"))
DBG_LOG((" DI_POST : %s",
(features & DI_POST) ? "Y" : "N"))
DBG_LOG((" DI_V110 : %s",
(features & DI_V110) ? "Y" : "N"))
DBG_LOG((" DI_V120 : %s",
(features & DI_V120) ? "Y" : "N"))
DBG_LOG((" DI_POTS : %s",
(features & DI_POTS) ? "Y" : "N"))
DBG_LOG((" DI_CODEC : %s",
(features & DI_CODEC) ? "Y" : "N"))
DBG_LOG((" DI_MANAGE : %s",
(features & DI_MANAGE) ? "Y" : "N"))
DBG_LOG((" DI_V_42 : %s",
(features & DI_V_42) ? "Y" : "N"))
DBG_LOG((" DI_EXTD_FAX : %s",
(features & DI_EXTD_FAX) ? "Y" : "N"))
DBG_LOG((" DI_AT_PARSER : %s",
(features & DI_AT_PARSER) ? "Y" : "N"))
DBG_LOG((" DI_VOICE_OVER_IP : %s",
(features & DI_VOICE_OVER_IP) ? "Y" : "N"))
}
void diva_add_slave_adapter(diva_os_xdi_adapter_t *a)
{
diva_os_spin_lock_magic_t old_irql;
diva_os_enter_spin_lock(&adapter_lock, &old_irql, "add_slave");
list_add_tail(&a->link, &adapter_queue);
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "add_slave");
}
int diva_card_read_xlog(diva_os_xdi_adapter_t *a)
{
diva_get_xlog_t *req;
byte *data;
if (!a->xdi_adapter.Initialized || !a->xdi_adapter.DIRequest) {
return (-1);
}
if (!(data = diva_os_malloc(0, sizeof(struct mi_pc_maint)))) {
return (-1);
}
memset(data, 0x00, sizeof(struct mi_pc_maint));
if (!(req = diva_os_malloc(0, sizeof(*req)))) {
diva_os_free(0, data);
return (-1);
}
req->command = 0x0400;
req->req = LOG;
req->rc = 0x00;
(*(a->xdi_adapter.DIRequest)) (&a->xdi_adapter, (ENTITY *) req);
if (!req->rc || req->req) {
diva_os_free(0, data);
diva_os_free(0, req);
return (-1);
}
memcpy(data, &req->req, sizeof(struct mi_pc_maint));
diva_os_free(0, req);
a->xdi_mbox.data_length = sizeof(struct mi_pc_maint);
a->xdi_mbox.data = data;
a->xdi_mbox.status = DIVA_XDI_MBOX_BUSY;
return (0);
}
void xdiFreeFile(void *handle)
{
}

View File

@ -1,33 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* $Id: diva.h,v 1.1.2.2 2001/02/08 12:25:43 armin Exp $ */
#ifndef __DIVA_XDI_OS_PART_H__
#define __DIVA_XDI_OS_PART_H__
int divasa_xdi_driver_entry(void);
void divasa_xdi_driver_unload(void);
void *diva_driver_add_card(void *pdev, unsigned long CardOrdinal);
void diva_driver_remove_card(void *pdiva);
typedef int (*divas_xdi_copy_to_user_fn_t) (void *os_handle, void __user *dst,
const void *src, int length);
typedef int (*divas_xdi_copy_from_user_fn_t) (void *os_handle, void *dst,
const void __user *src, int length);
int diva_xdi_read(void *adapter, void *os_handle, void __user *dst,
int max_length, divas_xdi_copy_to_user_fn_t cp_fn);
int diva_xdi_write(void *adapter, void *os_handle, const void __user *src,
int length, void *msg,
divas_xdi_copy_from_user_fn_t cp_fn);
void *diva_xdi_open_adapter(void *os_handle, const void __user *src,
int length, void *msg,
divas_xdi_copy_from_user_fn_t cp_fn);
void diva_xdi_close_adapter(void *adapter, void *os_handle);
#endif

View File

@ -1,139 +0,0 @@
/* $Id: diva_didd.c,v 1.13.6.4 2005/02/11 19:40:25 armin Exp $
*
* DIDD Interface module for Eicon active cards.
*
* Functions are in dadapter.c
*
* Copyright 2002-2003 by Armin Schindler (mac@melware.de)
* Copyright 2002-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <net/net_namespace.h>
#include "platform.h"
#include "di_defs.h"
#include "dadapter.h"
#include "divasync.h"
#include "did_vers.h"
static char *main_revision = "$Revision: 1.13.6.4 $";
static char *DRIVERNAME =
"Eicon DIVA - DIDD table (http://www.melware.net)";
static char *DRIVERLNAME = "divadidd";
char *DRIVERRELEASE_DIDD = "2.0";
MODULE_DESCRIPTION("DIDD table driver for diva drivers");
MODULE_AUTHOR("Cytronics & Melware, Eicon Networks");
MODULE_SUPPORTED_DEVICE("Eicon diva drivers");
MODULE_LICENSE("GPL");
#define DBG_MINIMUM (DL_LOG + DL_FTL + DL_ERR)
#define DBG_DEFAULT (DBG_MINIMUM + DL_XLOG + DL_REG)
extern int diddfunc_init(void);
extern void diddfunc_finit(void);
extern void DIVA_DIDD_Read(void *, int);
static struct proc_dir_entry *proc_didd;
struct proc_dir_entry *proc_net_eicon = NULL;
EXPORT_SYMBOL(DIVA_DIDD_Read);
EXPORT_SYMBOL(proc_net_eicon);
static char *getrev(const char *revision)
{
char *rev;
char *p;
if ((p = strchr(revision, ':'))) {
rev = p + 2;
p = strchr(rev, '$');
*--p = 0;
} else
rev = "1.0";
return rev;
}
static int divadidd_proc_show(struct seq_file *m, void *v)
{
char tmprev[32];
strcpy(tmprev, main_revision);
seq_printf(m, "%s\n", DRIVERNAME);
seq_printf(m, "name : %s\n", DRIVERLNAME);
seq_printf(m, "release : %s\n", DRIVERRELEASE_DIDD);
seq_printf(m, "build : %s(%s)\n",
diva_didd_common_code_build, DIVA_BUILD);
seq_printf(m, "revision : %s\n", getrev(tmprev));
return 0;
}
static int __init create_proc(void)
{
proc_net_eicon = proc_mkdir("eicon", init_net.proc_net);
if (proc_net_eicon) {
proc_didd = proc_create_single(DRIVERLNAME, S_IRUGO,
proc_net_eicon, divadidd_proc_show);
return (1);
}
return (0);
}
static void remove_proc(void)
{
remove_proc_entry(DRIVERLNAME, proc_net_eicon);
remove_proc_entry("eicon", init_net.proc_net);
}
static int __init divadidd_init(void)
{
char tmprev[32];
int ret = 0;
printk(KERN_INFO "%s\n", DRIVERNAME);
printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE_DIDD);
strcpy(tmprev, main_revision);
printk("%s Build:%s(%s)\n", getrev(tmprev),
diva_didd_common_code_build, DIVA_BUILD);
if (!create_proc()) {
printk(KERN_ERR "%s: could not create proc entry\n",
DRIVERLNAME);
ret = -EIO;
goto out;
}
if (!diddfunc_init()) {
printk(KERN_ERR "%s: failed to connect to DIDD.\n",
DRIVERLNAME);
#ifdef MODULE
remove_proc();
#endif
ret = -EIO;
goto out;
}
out:
return (ret);
}
static void __exit divadidd_exit(void)
{
diddfunc_finit();
remove_proc();
printk(KERN_INFO "%s: module unloaded.\n", DRIVERLNAME);
}
module_init(divadidd_init);
module_exit(divadidd_exit);

View File

@ -1,94 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include "platform.h"
#include "diva_dma.h"
/*
Every entry has length of PAGE_SIZE
and represents one single physical page
*/
struct _diva_dma_map_entry {
int busy;
dword phys_bus_addr; /* 32bit address as seen by the card */
void *local_ram_addr; /* local address as seen by the host */
void *addr_handle; /* handle uset to free allocated memory */
};
/*
Create local mapping structure and init it to default state
*/
struct _diva_dma_map_entry *diva_alloc_dma_map(void *os_context, int nentries) {
diva_dma_map_entry_t *pmap = diva_os_malloc(0, sizeof(*pmap) * (nentries + 1));
if (pmap)
memset(pmap, 0, sizeof(*pmap) * (nentries + 1));
return pmap;
}
/*
Free local map (context should be freed before) if any
*/
void diva_free_dma_mapping(struct _diva_dma_map_entry *pmap) {
if (pmap) {
diva_os_free(0, pmap);
}
}
/*
Set information saved on the map entry
*/
void diva_init_dma_map_entry(struct _diva_dma_map_entry *pmap,
int nr, void *virt, dword phys,
void *addr_handle) {
pmap[nr].phys_bus_addr = phys;
pmap[nr].local_ram_addr = virt;
pmap[nr].addr_handle = addr_handle;
}
/*
Allocate one single entry in the map
*/
int diva_alloc_dma_map_entry(struct _diva_dma_map_entry *pmap) {
int i;
for (i = 0; (pmap && pmap[i].local_ram_addr); i++) {
if (!pmap[i].busy) {
pmap[i].busy = 1;
return (i);
}
}
return (-1);
}
/*
Free one single entry in the map
*/
void diva_free_dma_map_entry(struct _diva_dma_map_entry *pmap, int nr) {
pmap[nr].busy = 0;
}
/*
Get information saved on the map entry
*/
void diva_get_dma_map_entry(struct _diva_dma_map_entry *pmap, int nr,
void **pvirt, dword *pphys) {
*pphys = pmap[nr].phys_bus_addr;
*pvirt = pmap[nr].local_ram_addr;
}
void *diva_get_entry_handle(struct _diva_dma_map_entry *pmap, int nr) {
return (pmap[nr].addr_handle);
}

View File

@ -1,48 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef __DIVA_DMA_MAPPING_IFC_H__
#define __DIVA_DMA_MAPPING_IFC_H__
typedef struct _diva_dma_map_entry diva_dma_map_entry_t;
struct _diva_dma_map_entry *diva_alloc_dma_map(void *os_context, int nentries);
void diva_init_dma_map_entry(struct _diva_dma_map_entry *pmap,
int nr, void *virt, dword phys,
void *addr_handle);
int diva_alloc_dma_map_entry(struct _diva_dma_map_entry *pmap);
void diva_free_dma_map_entry(struct _diva_dma_map_entry *pmap, int entry);
void diva_get_dma_map_entry(struct _diva_dma_map_entry *pmap, int nr,
void **pvirt, dword *pphys);
void diva_free_dma_mapping(struct _diva_dma_map_entry *pmap);
/*
Functionality to be implemented by OS wrapper
and running in process context
*/
void diva_init_dma_map(void *hdev,
struct _diva_dma_map_entry **ppmap,
int nentries);
void diva_free_dma_map(void *hdev,
struct _diva_dma_map_entry *pmap);
void *diva_get_entry_handle(struct _diva_dma_map_entry *pmap, int nr);
#endif

View File

@ -1,20 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* $Id: diva_pci.h,v 1.6 2003/01/04 15:29:45 schindler Exp $ */
#ifndef __DIVA_PCI_INTERFACE_H__
#define __DIVA_PCI_INTERFACE_H__
void __iomem *divasa_remap_pci_bar(diva_os_xdi_adapter_t *a,
int id,
unsigned long bar,
unsigned long area_length);
void divasa_unmap_pci_bar(void __iomem *bar);
unsigned long divasa_get_pci_irq(unsigned char bus,
unsigned char func, void *pci_dev_handle);
unsigned long divasa_get_pci_bar(unsigned char bus,
unsigned char func,
int bar, void *pci_dev_handle);
byte diva_os_get_pci_bus(void *pci_dev_handle);
byte diva_os_get_pci_func(void *pci_dev_handle);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,239 +0,0 @@
/* $Id: divamnt.c,v 1.32.6.10 2005/02/11 19:40:25 armin Exp $
*
* Driver for Eicon DIVA Server ISDN cards.
* Maint module
*
* Copyright 2000-2003 by Armin Schindler (mac@melware.de)
* Copyright 2000-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/poll.h>
#include <linux/mutex.h>
#include <linux/uaccess.h>
#include "platform.h"
#include "di_defs.h"
#include "divasync.h"
#include "debug_if.h"
static DEFINE_MUTEX(maint_mutex);
static char *main_revision = "$Revision: 1.32.6.10 $";
static int major;
MODULE_DESCRIPTION("Maint driver for Eicon DIVA Server cards");
MODULE_AUTHOR("Cytronics & Melware, Eicon Networks");
MODULE_SUPPORTED_DEVICE("DIVA card driver");
MODULE_LICENSE("GPL");
static int buffer_length = 128;
module_param(buffer_length, int, 0);
static unsigned long diva_dbg_mem = 0;
module_param(diva_dbg_mem, ulong, 0);
static char *DRIVERNAME =
"Eicon DIVA - MAINT module (http://www.melware.net)";
static char *DRIVERLNAME = "diva_mnt";
static char *DEVNAME = "DivasMAINT";
char *DRIVERRELEASE_MNT = "2.0";
static wait_queue_head_t msgwaitq;
static unsigned long opened;
extern int mntfunc_init(int *, void **, unsigned long);
extern void mntfunc_finit(void);
extern int maint_read_write(void __user *buf, int count);
/*
* helper functions
*/
static char *getrev(const char *revision)
{
char *rev;
char *p;
if ((p = strchr(revision, ':'))) {
rev = p + 2;
p = strchr(rev, '$');
*--p = 0;
} else
rev = "1.0";
return rev;
}
/*
* kernel/user space copy functions
*/
int diva_os_copy_to_user(void *os_handle, void __user *dst, const void *src,
int length)
{
return (copy_to_user(dst, src, length));
}
int diva_os_copy_from_user(void *os_handle, void *dst, const void __user *src,
int length)
{
return (copy_from_user(dst, src, length));
}
/*
* get time
*/
void diva_os_get_time(dword *sec, dword *usec)
{
struct timespec64 time;
ktime_get_ts64(&time);
*sec = (dword) time.tv_sec;
*usec = (dword) (time.tv_nsec / NSEC_PER_USEC);
}
/*
* device node operations
*/
static __poll_t maint_poll(struct file *file, poll_table *wait)
{
__poll_t mask = 0;
poll_wait(file, &msgwaitq, wait);
mask = EPOLLOUT | EPOLLWRNORM;
if (file->private_data || diva_dbg_q_length()) {
mask |= EPOLLIN | EPOLLRDNORM;
}
return (mask);
}
static int maint_open(struct inode *ino, struct file *filep)
{
int ret;
mutex_lock(&maint_mutex);
/* only one open is allowed, so we test
it atomically */
if (test_and_set_bit(0, &opened))
ret = -EBUSY;
else {
filep->private_data = NULL;
ret = nonseekable_open(ino, filep);
}
mutex_unlock(&maint_mutex);
return ret;
}
static int maint_close(struct inode *ino, struct file *filep)
{
if (filep->private_data) {
diva_os_free(0, filep->private_data);
filep->private_data = NULL;
}
/* clear 'used' flag */
clear_bit(0, &opened);
return (0);
}
static ssize_t divas_maint_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
return (maint_read_write((char __user *) buf, (int) count));
}
static ssize_t divas_maint_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
return (maint_read_write(buf, (int) count));
}
static const struct file_operations divas_maint_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.read = divas_maint_read,
.write = divas_maint_write,
.poll = maint_poll,
.open = maint_open,
.release = maint_close
};
static void divas_maint_unregister_chrdev(void)
{
unregister_chrdev(major, DEVNAME);
}
static int __init divas_maint_register_chrdev(void)
{
if ((major = register_chrdev(0, DEVNAME, &divas_maint_fops)) < 0)
{
printk(KERN_ERR "%s: failed to create /dev entry.\n",
DRIVERLNAME);
return (0);
}
return (1);
}
/*
* wake up reader
*/
void diva_maint_wakeup_read(void)
{
wake_up_interruptible(&msgwaitq);
}
/*
* Driver Load
*/
static int __init maint_init(void)
{
char tmprev[50];
int ret = 0;
void *buffer = NULL;
init_waitqueue_head(&msgwaitq);
printk(KERN_INFO "%s\n", DRIVERNAME);
printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE_MNT);
strcpy(tmprev, main_revision);
printk("%s Build: %s \n", getrev(tmprev), DIVA_BUILD);
if (!divas_maint_register_chrdev()) {
ret = -EIO;
goto out;
}
if (!(mntfunc_init(&buffer_length, &buffer, diva_dbg_mem))) {
printk(KERN_ERR "%s: failed to connect to DIDD.\n",
DRIVERLNAME);
divas_maint_unregister_chrdev();
ret = -EIO;
goto out;
}
printk(KERN_INFO "%s: trace buffer = %p - %d kBytes, %s (Major: %d)\n",
DRIVERLNAME, buffer, (buffer_length / 1024),
(diva_dbg_mem == 0) ? "internal" : "external", major);
out:
return (ret);
}
/*
** Driver Unload
*/
static void __exit maint_exit(void)
{
divas_maint_unregister_chrdev();
mntfunc_finit();
printk(KERN_INFO "%s: module unloaded.\n", DRIVERLNAME);
}
module_init(maint_init);
module_exit(maint_exit);

View File

@ -1,237 +0,0 @@
/* $Id: divasfunc.c,v 1.23.4.2 2004/08/28 20:03:53 armin Exp $
*
* Low level driver for Eicon DIVA Server ISDN cards.
*
* Copyright 2000-2003 by Armin Schindler (mac@melware.de)
* Copyright 2000-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*/
#include "platform.h"
#include "di_defs.h"
#include "pc.h"
#include "di.h"
#include "io.h"
#include "divasync.h"
#include "diva.h"
#include "xdi_vers.h"
#define DBG_MINIMUM (DL_LOG + DL_FTL + DL_ERR)
#define DBG_DEFAULT (DBG_MINIMUM + DL_XLOG + DL_REG)
static int debugmask;
extern void DIVA_DIDD_Read(void *, int);
extern PISDN_ADAPTER IoAdapters[MAX_ADAPTER];
extern char *DRIVERRELEASE_DIVAS;
static dword notify_handle;
static DESCRIPTOR DAdapter;
static DESCRIPTOR MAdapter;
/* --------------------------------------------------------------------------
MAINT driver connector section
-------------------------------------------------------------------------- */
static void no_printf(unsigned char *x, ...)
{
/* dummy debug function */
}
#include "debuglib.c"
/*
* get the adapters serial number
*/
void diva_get_vserial_number(PISDN_ADAPTER IoAdapter, char *buf)
{
int contr = 0;
if ((contr = ((IoAdapter->serialNo & 0xff000000) >> 24))) {
sprintf(buf, "%d-%d",
IoAdapter->serialNo & 0x00ffffff, contr + 1);
} else {
sprintf(buf, "%d", IoAdapter->serialNo);
}
}
/*
* register a new adapter
*/
void diva_xdi_didd_register_adapter(int card)
{
DESCRIPTOR d;
IDI_SYNC_REQ req;
if (card && ((card - 1) < MAX_ADAPTER) &&
IoAdapters[card - 1] && Requests[card - 1]) {
d.type = IoAdapters[card - 1]->Properties.DescType;
d.request = Requests[card - 1];
d.channels = IoAdapters[card - 1]->Properties.Channels;
d.features = IoAdapters[card - 1]->Properties.Features;
DBG_TRC(("DIDD register A(%d) channels=%d", card,
d.channels))
/* workaround for different Name in structure */
strlcpy(IoAdapters[card - 1]->Name,
IoAdapters[card - 1]->Properties.Name,
sizeof(IoAdapters[card - 1]->Name));
req.didd_remove_adapter.e.Req = 0;
req.didd_add_adapter.e.Rc = IDI_SYNC_REQ_DIDD_ADD_ADAPTER;
req.didd_add_adapter.info.descriptor = (void *) &d;
DAdapter.request((ENTITY *)&req);
if (req.didd_add_adapter.e.Rc != 0xff) {
DBG_ERR(("DIDD register A(%d) failed !", card))
}
IoAdapters[card - 1]->os_trap_nfy_Fnc = NULL;
}
}
/*
* remove an adapter
*/
void diva_xdi_didd_remove_adapter(int card)
{
IDI_SYNC_REQ req;
ADAPTER *a = &IoAdapters[card - 1]->a;
IoAdapters[card - 1]->os_trap_nfy_Fnc = NULL;
DBG_TRC(("DIDD de-register A(%d)", card))
req.didd_remove_adapter.e.Req = 0;
req.didd_remove_adapter.e.Rc = IDI_SYNC_REQ_DIDD_REMOVE_ADAPTER;
req.didd_remove_adapter.info.p_request =
(IDI_CALL) Requests[card - 1];
DAdapter.request((ENTITY *)&req);
memset(&(a->IdTable), 0x00, 256);
}
/*
* start debug
*/
static void start_dbg(void)
{
DbgRegister("DIVAS", DRIVERRELEASE_DIVAS, (debugmask) ? debugmask : DBG_DEFAULT);
DBG_LOG(("DIVA ISDNXDI BUILD (%s[%s])",
DIVA_BUILD, diva_xdi_common_code_build))
}
/*
* stop debug
*/
static void stop_dbg(void)
{
DbgDeregister();
memset(&MAdapter, 0, sizeof(MAdapter));
dprintf = no_printf;
}
/*
* didd callback function
*/
static void *didd_callback(void *context, DESCRIPTOR *adapter,
int removal)
{
if (adapter->type == IDI_DADAPTER) {
DBG_ERR(("Notification about IDI_DADAPTER change ! Oops."));
return (NULL);
}
if (adapter->type == IDI_DIMAINT) {
if (removal) {
stop_dbg();
} else {
memcpy(&MAdapter, adapter, sizeof(MAdapter));
dprintf = (DIVA_DI_PRINTF) MAdapter.request;
start_dbg();
}
}
return (NULL);
}
/*
* connect to didd
*/
static int __init connect_didd(void)
{
int x = 0;
int dadapter = 0;
IDI_SYNC_REQ req;
DESCRIPTOR DIDD_Table[MAX_DESCRIPTORS];
DIVA_DIDD_Read(DIDD_Table, sizeof(DIDD_Table));
for (x = 0; x < MAX_DESCRIPTORS; x++) {
if (DIDD_Table[x].type == IDI_DADAPTER) { /* DADAPTER found */
dadapter = 1;
memcpy(&DAdapter, &DIDD_Table[x], sizeof(DAdapter));
req.didd_notify.e.Req = 0;
req.didd_notify.e.Rc =
IDI_SYNC_REQ_DIDD_REGISTER_ADAPTER_NOTIFY;
req.didd_notify.info.callback = (void *)didd_callback;
req.didd_notify.info.context = NULL;
DAdapter.request((ENTITY *)&req);
if (req.didd_notify.e.Rc != 0xff) {
stop_dbg();
return (0);
}
notify_handle = req.didd_notify.info.handle;
} else if (DIDD_Table[x].type == IDI_DIMAINT) { /* MAINT found */
memcpy(&MAdapter, &DIDD_Table[x], sizeof(DAdapter));
dprintf = (DIVA_DI_PRINTF) MAdapter.request;
start_dbg();
}
}
if (!dadapter) {
stop_dbg();
}
return (dadapter);
}
/*
* disconnect from didd
*/
static void disconnect_didd(void)
{
IDI_SYNC_REQ req;
stop_dbg();
req.didd_notify.e.Req = 0;
req.didd_notify.e.Rc = IDI_SYNC_REQ_DIDD_REMOVE_ADAPTER_NOTIFY;
req.didd_notify.info.handle = notify_handle;
DAdapter.request((ENTITY *)&req);
}
/*
* init
*/
int __init divasfunc_init(int dbgmask)
{
char *version;
debugmask = dbgmask;
if (!connect_didd()) {
DBG_ERR(("divasfunc: failed to connect to DIDD."))
return (0);
}
version = diva_xdi_common_code_build;
divasa_xdi_driver_entry();
return (1);
}
/*
* exit
*/
void divasfunc_exit(void)
{
divasa_xdi_driver_unload();
disconnect_didd();
}

View File

@ -1,562 +0,0 @@
/* $Id: divasi.c,v 1.25.6.2 2005/01/31 12:22:20 armin Exp $
*
* Driver for Eicon DIVA Server ISDN cards.
* User Mode IDI Interface
*
* Copyright 2000-2003 by Armin Schindler (mac@melware.de)
* Copyright 2000-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/poll.h>
#include <linux/proc_fs.h>
#include <linux/skbuff.h>
#include <linux/seq_file.h>
#include <linux/uaccess.h>
#include "platform.h"
#include "di_defs.h"
#include "divasync.h"
#include "um_xdi.h"
#include "um_idi.h"
static char *main_revision = "$Revision: 1.25.6.2 $";
static int major;
MODULE_DESCRIPTION("User IDI Interface for Eicon ISDN cards");
MODULE_AUTHOR("Cytronics & Melware, Eicon Networks");
MODULE_SUPPORTED_DEVICE("DIVA card driver");
MODULE_LICENSE("GPL");
typedef struct _diva_um_idi_os_context {
wait_queue_head_t read_wait;
wait_queue_head_t close_wait;
struct timer_list diva_timer_id;
int aborted;
int adapter_nr;
} diva_um_idi_os_context_t;
static char *DRIVERNAME = "Eicon DIVA - User IDI (http://www.melware.net)";
static char *DRIVERLNAME = "diva_idi";
static char *DEVNAME = "DivasIDI";
char *DRIVERRELEASE_IDI = "2.0";
extern int idifunc_init(void);
extern void idifunc_finit(void);
/*
* helper functions
*/
static char *getrev(const char *revision)
{
char *rev;
char *p;
if ((p = strchr(revision, ':'))) {
rev = p + 2;
p = strchr(rev, '$');
*--p = 0;
} else
rev = "1.0";
return rev;
}
/*
* LOCALS
*/
static ssize_t um_idi_read(struct file *file, char __user *buf, size_t count,
loff_t *offset);
static ssize_t um_idi_write(struct file *file, const char __user *buf,
size_t count, loff_t *offset);
static __poll_t um_idi_poll(struct file *file, poll_table *wait);
static int um_idi_open(struct inode *inode, struct file *file);
static int um_idi_release(struct inode *inode, struct file *file);
static int remove_entity(void *entity);
static void diva_um_timer_function(struct timer_list *t);
/*
* proc entry
*/
extern struct proc_dir_entry *proc_net_eicon;
static struct proc_dir_entry *um_idi_proc_entry = NULL;
static int um_idi_proc_show(struct seq_file *m, void *v)
{
char tmprev[32];
seq_printf(m, "%s\n", DRIVERNAME);
seq_printf(m, "name : %s\n", DRIVERLNAME);
seq_printf(m, "release : %s\n", DRIVERRELEASE_IDI);
strcpy(tmprev, main_revision);
seq_printf(m, "revision : %s\n", getrev(tmprev));
seq_printf(m, "build : %s\n", DIVA_BUILD);
seq_printf(m, "major : %d\n", major);
return 0;
}
static int __init create_um_idi_proc(void)
{
um_idi_proc_entry = proc_create_single(DRIVERLNAME, S_IRUGO,
proc_net_eicon, um_idi_proc_show);
if (!um_idi_proc_entry)
return (0);
return (1);
}
static void remove_um_idi_proc(void)
{
if (um_idi_proc_entry) {
remove_proc_entry(DRIVERLNAME, proc_net_eicon);
um_idi_proc_entry = NULL;
}
}
static const struct file_operations divas_idi_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.read = um_idi_read,
.write = um_idi_write,
.poll = um_idi_poll,
.open = um_idi_open,
.release = um_idi_release
};
static void divas_idi_unregister_chrdev(void)
{
unregister_chrdev(major, DEVNAME);
}
static int __init divas_idi_register_chrdev(void)
{
if ((major = register_chrdev(0, DEVNAME, &divas_idi_fops)) < 0)
{
printk(KERN_ERR "%s: failed to create /dev entry.\n",
DRIVERLNAME);
return (0);
}
return (1);
}
/*
** Driver Load
*/
static int __init divasi_init(void)
{
char tmprev[50];
int ret = 0;
printk(KERN_INFO "%s\n", DRIVERNAME);
printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE_IDI);
strcpy(tmprev, main_revision);
printk("%s Build: %s\n", getrev(tmprev), DIVA_BUILD);
if (!divas_idi_register_chrdev()) {
ret = -EIO;
goto out;
}
if (!create_um_idi_proc()) {
divas_idi_unregister_chrdev();
printk(KERN_ERR "%s: failed to create proc entry.\n",
DRIVERLNAME);
ret = -EIO;
goto out;
}
if (!(idifunc_init())) {
remove_um_idi_proc();
divas_idi_unregister_chrdev();
printk(KERN_ERR "%s: failed to connect to DIDD.\n",
DRIVERLNAME);
ret = -EIO;
goto out;
}
printk(KERN_INFO "%s: started with major %d\n", DRIVERLNAME, major);
out:
return (ret);
}
/*
** Driver Unload
*/
static void __exit divasi_exit(void)
{
idifunc_finit();
remove_um_idi_proc();
divas_idi_unregister_chrdev();
printk(KERN_INFO "%s: module unloaded.\n", DRIVERLNAME);
}
module_init(divasi_init);
module_exit(divasi_exit);
/*
* FILE OPERATIONS
*/
static int
divas_um_idi_copy_to_user(void *os_handle, void *dst, const void *src,
int length)
{
memcpy(dst, src, length);
return (length);
}
static ssize_t
um_idi_read(struct file *file, char __user *buf, size_t count, loff_t *offset)
{
diva_um_idi_os_context_t *p_os;
int ret = -EINVAL;
void *data;
if (!file->private_data) {
return (-ENODEV);
}
if (!
(p_os =
(diva_um_idi_os_context_t *) diva_um_id_get_os_context(file->
private_data)))
{
return (-ENODEV);
}
if (p_os->aborted) {
return (-ENODEV);
}
if (!(data = diva_os_malloc(0, count))) {
return (-ENOMEM);
}
ret = diva_um_idi_read(file->private_data,
file, data, count,
divas_um_idi_copy_to_user);
switch (ret) {
case 0: /* no message available */
ret = (-EAGAIN);
break;
case (-1): /* adapter was removed */
ret = (-ENODEV);
break;
case (-2): /* message_length > length of user buffer */
ret = (-EFAULT);
break;
}
if (ret > 0) {
if (copy_to_user(buf, data, ret)) {
ret = (-EFAULT);
}
}
diva_os_free(0, data);
DBG_TRC(("read: ret %d", ret));
return (ret);
}
static int
divas_um_idi_copy_from_user(void *os_handle, void *dst, const void *src,
int length)
{
memcpy(dst, src, length);
return (length);
}
static int um_idi_open_adapter(struct file *file, int adapter_nr)
{
diva_um_idi_os_context_t *p_os;
void *e =
divas_um_idi_create_entity((dword) adapter_nr, (void *) file);
if (!(file->private_data = e)) {
return (0);
}
p_os = (diva_um_idi_os_context_t *) diva_um_id_get_os_context(e);
init_waitqueue_head(&p_os->read_wait);
init_waitqueue_head(&p_os->close_wait);
timer_setup(&p_os->diva_timer_id, diva_um_timer_function, 0);
p_os->aborted = 0;
p_os->adapter_nr = adapter_nr;
return (1);
}
static ssize_t
um_idi_write(struct file *file, const char __user *buf, size_t count,
loff_t *offset)
{
diva_um_idi_os_context_t *p_os;
int ret = -EINVAL;
void *data;
int adapter_nr = 0;
if (!file->private_data) {
/* the first write() selects the adapter_nr */
if (count == sizeof(int)) {
if (copy_from_user
((void *) &adapter_nr, buf,
count)) return (-EFAULT);
if (!(um_idi_open_adapter(file, adapter_nr)))
return (-ENODEV);
return (count);
} else
return (-ENODEV);
}
if (!(p_os =
(diva_um_idi_os_context_t *) diva_um_id_get_os_context(file->
private_data)))
{
return (-ENODEV);
}
if (p_os->aborted) {
return (-ENODEV);
}
if (!(data = diva_os_malloc(0, count))) {
return (-ENOMEM);
}
if (copy_from_user(data, buf, count)) {
ret = -EFAULT;
} else {
ret = diva_um_idi_write(file->private_data,
file, data, count,
divas_um_idi_copy_from_user);
switch (ret) {
case 0: /* no space available */
ret = (-EAGAIN);
break;
case (-1): /* adapter was removed */
ret = (-ENODEV);
break;
case (-2): /* length of user buffer > max message_length */
ret = (-EFAULT);
break;
}
}
diva_os_free(0, data);
DBG_TRC(("write: ret %d", ret));
return (ret);
}
static __poll_t um_idi_poll(struct file *file, poll_table *wait)
{
diva_um_idi_os_context_t *p_os;
if (!file->private_data) {
return (EPOLLERR);
}
if ((!(p_os =
(diva_um_idi_os_context_t *)
diva_um_id_get_os_context(file->private_data)))
|| p_os->aborted) {
return (EPOLLERR);
}
poll_wait(file, &p_os->read_wait, wait);
if (p_os->aborted) {
return (EPOLLERR);
}
switch (diva_user_mode_idi_ind_ready(file->private_data, file)) {
case (-1):
return (EPOLLERR);
case 0:
return (0);
}
return (EPOLLIN | EPOLLRDNORM);
}
static int um_idi_open(struct inode *inode, struct file *file)
{
return (0);
}
static int um_idi_release(struct inode *inode, struct file *file)
{
diva_um_idi_os_context_t *p_os;
unsigned int adapter_nr;
int ret = 0;
if (!(file->private_data)) {
ret = -ENODEV;
goto out;
}
if (!(p_os =
(diva_um_idi_os_context_t *) diva_um_id_get_os_context(file->private_data))) {
ret = -ENODEV;
goto out;
}
adapter_nr = p_os->adapter_nr;
if ((ret = remove_entity(file->private_data))) {
goto out;
}
if (divas_um_idi_delete_entity
((int) adapter_nr, file->private_data)) {
ret = -ENODEV;
goto out;
}
out:
return (ret);
}
int diva_os_get_context_size(void)
{
return (sizeof(diva_um_idi_os_context_t));
}
void diva_os_wakeup_read(void *os_context)
{
diva_um_idi_os_context_t *p_os =
(diva_um_idi_os_context_t *) os_context;
wake_up_interruptible(&p_os->read_wait);
}
void diva_os_wakeup_close(void *os_context)
{
diva_um_idi_os_context_t *p_os =
(diva_um_idi_os_context_t *) os_context;
wake_up_interruptible(&p_os->close_wait);
}
static
void diva_um_timer_function(struct timer_list *t)
{
diva_um_idi_os_context_t *p_os = from_timer(p_os, t, diva_timer_id);
p_os->aborted = 1;
wake_up_interruptible(&p_os->read_wait);
wake_up_interruptible(&p_os->close_wait);
DBG_ERR(("entity removal watchdog"))
}
/*
** If application exits without entity removal this function will remove
** entity and block until removal is complete
*/
static int remove_entity(void *entity)
{
struct task_struct *curtask = current;
diva_um_idi_os_context_t *p_os;
diva_um_idi_stop_wdog(entity);
if (!entity) {
DBG_FTL(("Zero entity on remove"))
return (0);
}
if (!(p_os =
(diva_um_idi_os_context_t *)
diva_um_id_get_os_context(entity))) {
DBG_FTL(("Zero entity os context on remove"))
return (0);
}
if (!divas_um_idi_entity_assigned(entity) || p_os->aborted) {
/*
Entity is not assigned, also can be removed
*/
return (0);
}
DBG_TRC(("E(%08x) check remove", entity))
/*
If adapter not answers on remove request inside of
10 Sec, then adapter is dead
*/
diva_um_idi_start_wdog(entity);
{
DECLARE_WAITQUEUE(wait, curtask);
add_wait_queue(&p_os->close_wait, &wait);
for (;;) {
set_current_state(TASK_INTERRUPTIBLE);
if (!divas_um_idi_entity_start_remove(entity)
|| p_os->aborted) {
break;
}
schedule();
}
set_current_state(TASK_RUNNING);
remove_wait_queue(&p_os->close_wait, &wait);
}
DBG_TRC(("E(%08x) start remove", entity))
{
DECLARE_WAITQUEUE(wait, curtask);
add_wait_queue(&p_os->close_wait, &wait);
for (;;) {
set_current_state(TASK_INTERRUPTIBLE);
if (!divas_um_idi_entity_assigned(entity)
|| p_os->aborted) {
break;
}
schedule();
}
set_current_state(TASK_RUNNING);
remove_wait_queue(&p_os->close_wait, &wait);
}
DBG_TRC(("E(%08x) remove complete, aborted:%d", entity,
p_os->aborted))
diva_um_idi_stop_wdog(entity);
p_os->aborted = 0;
return (0);
}
/*
* timer watchdog
*/
void diva_um_idi_start_wdog(void *entity)
{
diva_um_idi_os_context_t *p_os;
if (entity &&
((p_os =
(diva_um_idi_os_context_t *)
diva_um_id_get_os_context(entity)))) {
mod_timer(&p_os->diva_timer_id, jiffies + 10 * HZ);
}
}
void diva_um_idi_stop_wdog(void *entity)
{
diva_um_idi_os_context_t *p_os;
if (entity &&
((p_os =
(diva_um_idi_os_context_t *)
diva_um_id_get_os_context(entity)))) {
del_timer(&p_os->diva_timer_id);
}
}

View File

@ -1,848 +0,0 @@
/* $Id: divasmain.c,v 1.55.4.6 2005/02/09 19:28:20 armin Exp $
*
* Low level driver for Eicon DIVA Server ISDN cards.
*
* Copyright 2000-2003 by Armin Schindler (mac@melware.de)
* Copyright 2000-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/uaccess.h>
#include <asm/io.h>
#include <linux/ioport.h>
#include <linux/pci.h>
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/poll.h>
#include <linux/kmod.h>
#include "platform.h"
#undef ID_MASK
#undef N_DATA
#include "pc.h"
#include "di_defs.h"
#include "divasync.h"
#include "diva.h"
#include "di.h"
#include "io.h"
#include "xdi_msg.h"
#include "xdi_adapter.h"
#include "xdi_vers.h"
#include "diva_dma.h"
#include "diva_pci.h"
static char *main_revision = "$Revision: 1.55.4.6 $";
static int major;
static int dbgmask;
MODULE_DESCRIPTION("Kernel driver for Eicon DIVA Server cards");
MODULE_AUTHOR("Cytronics & Melware, Eicon Networks");
MODULE_LICENSE("GPL");
module_param(dbgmask, int, 0);
MODULE_PARM_DESC(dbgmask, "initial debug mask");
static char *DRIVERNAME =
"Eicon DIVA Server driver (http://www.melware.net)";
static char *DRIVERLNAME = "divas";
static char *DEVNAME = "Divas";
char *DRIVERRELEASE_DIVAS = "2.0";
extern irqreturn_t diva_os_irq_wrapper(int irq, void *context);
extern int create_divas_proc(void);
extern void remove_divas_proc(void);
extern void diva_get_vserial_number(PISDN_ADAPTER IoAdapter, char *buf);
extern int divasfunc_init(int dbgmask);
extern void divasfunc_exit(void);
typedef struct _diva_os_thread_dpc {
struct tasklet_struct divas_task;
diva_os_soft_isr_t *psoft_isr;
} diva_os_thread_dpc_t;
/* --------------------------------------------------------------------------
PCI driver interface section
-------------------------------------------------------------------------- */
/*
vendor, device Vendor and device ID to match (or PCI_ANY_ID)
subvendor, Subsystem vendor and device ID to match (or PCI_ANY_ID)
subdevice
class, Device class to match. The class_mask tells which bits
class_mask of the class are honored during the comparison.
driver_data Data private to the driver.
*/
#if !defined(PCI_DEVICE_ID_EICON_MAESTRAP_2)
#define PCI_DEVICE_ID_EICON_MAESTRAP_2 0xE015
#endif
#if !defined(PCI_DEVICE_ID_EICON_4BRI_VOIP)
#define PCI_DEVICE_ID_EICON_4BRI_VOIP 0xE016
#endif
#if !defined(PCI_DEVICE_ID_EICON_4BRI_2_VOIP)
#define PCI_DEVICE_ID_EICON_4BRI_2_VOIP 0xE017
#endif
#if !defined(PCI_DEVICE_ID_EICON_BRI2M_2)
#define PCI_DEVICE_ID_EICON_BRI2M_2 0xE018
#endif
#if !defined(PCI_DEVICE_ID_EICON_MAESTRAP_2_VOIP)
#define PCI_DEVICE_ID_EICON_MAESTRAP_2_VOIP 0xE019
#endif
#if !defined(PCI_DEVICE_ID_EICON_2F)
#define PCI_DEVICE_ID_EICON_2F 0xE01A
#endif
#if !defined(PCI_DEVICE_ID_EICON_BRI2M_2_VOIP)
#define PCI_DEVICE_ID_EICON_BRI2M_2_VOIP 0xE01B
#endif
/*
This table should be sorted by PCI device ID
*/
static const struct pci_device_id divas_pci_tbl[] = {
/* Diva Server BRI-2M PCI 0xE010 */
{ PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_MAESTRA),
CARDTYPE_MAESTRA_PCI },
/* Diva Server 4BRI-8M PCI 0xE012 */
{ PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_MAESTRAQ),
CARDTYPE_DIVASRV_Q_8M_PCI },
/* Diva Server 4BRI-8M 2.0 PCI 0xE013 */
{ PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_MAESTRAQ_U),
CARDTYPE_DIVASRV_Q_8M_V2_PCI },
/* Diva Server PRI-30M PCI 0xE014 */
{ PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_MAESTRAP),
CARDTYPE_DIVASRV_P_30M_PCI },
/* Diva Server PRI 2.0 adapter 0xE015 */
{ PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_MAESTRAP_2),
CARDTYPE_DIVASRV_P_30M_V2_PCI },
/* Diva Server Voice 4BRI-8M PCI 0xE016 */
{ PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_4BRI_VOIP),
CARDTYPE_DIVASRV_VOICE_Q_8M_PCI },
/* Diva Server Voice 4BRI-8M 2.0 PCI 0xE017 */
{ PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_4BRI_2_VOIP),
CARDTYPE_DIVASRV_VOICE_Q_8M_V2_PCI },
/* Diva Server BRI-2M 2.0 PCI 0xE018 */
{ PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_BRI2M_2),
CARDTYPE_DIVASRV_B_2M_V2_PCI },
/* Diva Server Voice PRI 2.0 PCI 0xE019 */
{ PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_MAESTRAP_2_VOIP),
CARDTYPE_DIVASRV_VOICE_P_30M_V2_PCI },
/* Diva Server 2FX 0xE01A */
{ PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_2F),
CARDTYPE_DIVASRV_B_2F_PCI },
/* Diva Server Voice BRI-2M 2.0 PCI 0xE01B */
{ PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_BRI2M_2_VOIP),
CARDTYPE_DIVASRV_VOICE_B_2M_V2_PCI },
{ 0, } /* 0 terminated list. */
};
MODULE_DEVICE_TABLE(pci, divas_pci_tbl);
static int divas_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent);
static void divas_remove_one(struct pci_dev *pdev);
static struct pci_driver diva_pci_driver = {
.name = "divas",
.probe = divas_init_one,
.remove = divas_remove_one,
.id_table = divas_pci_tbl,
};
/*********************************************************
** little helper functions
*********************************************************/
static char *getrev(const char *revision)
{
char *rev;
char *p;
if ((p = strchr(revision, ':'))) {
rev = p + 2;
p = strchr(rev, '$');
*--p = 0;
} else
rev = "1.0";
return rev;
}
void diva_log_info(unsigned char *format, ...)
{
va_list args;
unsigned char line[160];
va_start(args, format);
vsnprintf(line, sizeof(line), format, args);
va_end(args);
printk(KERN_INFO "%s: %s\n", DRIVERLNAME, line);
}
void divas_get_version(char *p)
{
char tmprev[32];
strcpy(tmprev, main_revision);
sprintf(p, "%s: %s(%s) %s(%s) major=%d\n", DRIVERLNAME, DRIVERRELEASE_DIVAS,
getrev(tmprev), diva_xdi_common_code_build, DIVA_BUILD, major);
}
/* --------------------------------------------------------------------------
PCI Bus services
-------------------------------------------------------------------------- */
byte diva_os_get_pci_bus(void *pci_dev_handle)
{
struct pci_dev *pdev = (struct pci_dev *) pci_dev_handle;
return ((byte) pdev->bus->number);
}
byte diva_os_get_pci_func(void *pci_dev_handle)
{
struct pci_dev *pdev = (struct pci_dev *) pci_dev_handle;
return ((byte) pdev->devfn);
}
unsigned long divasa_get_pci_irq(unsigned char bus, unsigned char func,
void *pci_dev_handle)
{
unsigned char irq = 0;
struct pci_dev *dev = (struct pci_dev *) pci_dev_handle;
irq = dev->irq;
return ((unsigned long) irq);
}
unsigned long divasa_get_pci_bar(unsigned char bus, unsigned char func,
int bar, void *pci_dev_handle)
{
unsigned long ret = 0;
struct pci_dev *dev = (struct pci_dev *) pci_dev_handle;
if (bar < 6) {
ret = dev->resource[bar].start;
}
DBG_TRC(("GOT BAR[%d]=%08x", bar, ret));
{
unsigned long type = (ret & 0x00000001);
if (type & PCI_BASE_ADDRESS_SPACE_IO) {
DBG_TRC((" I/O"));
ret &= PCI_BASE_ADDRESS_IO_MASK;
} else {
DBG_TRC((" memory"));
ret &= PCI_BASE_ADDRESS_MEM_MASK;
}
DBG_TRC((" final=%08x", ret));
}
return (ret);
}
void PCIwrite(byte bus, byte func, int offset, void *data, int length,
void *pci_dev_handle)
{
struct pci_dev *dev = (struct pci_dev *) pci_dev_handle;
switch (length) {
case 1: /* byte */
pci_write_config_byte(dev, offset,
*(unsigned char *) data);
break;
case 2: /* word */
pci_write_config_word(dev, offset,
*(unsigned short *) data);
break;
case 4: /* dword */
pci_write_config_dword(dev, offset,
*(unsigned int *) data);
break;
default: /* buffer */
if (!(length % 4) && !(length & 0x03)) { /* Copy as dword */
dword *p = (dword *) data;
length /= 4;
while (length--) {
pci_write_config_dword(dev, offset,
*(unsigned int *)
p++);
}
} else { /* copy as byte stream */
byte *p = (byte *) data;
while (length--) {
pci_write_config_byte(dev, offset,
*(unsigned char *)
p++);
}
}
}
}
void PCIread(byte bus, byte func, int offset, void *data, int length,
void *pci_dev_handle)
{
struct pci_dev *dev = (struct pci_dev *) pci_dev_handle;
switch (length) {
case 1: /* byte */
pci_read_config_byte(dev, offset, (unsigned char *) data);
break;
case 2: /* word */
pci_read_config_word(dev, offset, (unsigned short *) data);
break;
case 4: /* dword */
pci_read_config_dword(dev, offset, (unsigned int *) data);
break;
default: /* buffer */
if (!(length % 4) && !(length & 0x03)) { /* Copy as dword */
dword *p = (dword *) data;
length /= 4;
while (length--) {
pci_read_config_dword(dev, offset,
(unsigned int *)
p++);
}
} else { /* copy as byte stream */
byte *p = (byte *) data;
while (length--) {
pci_read_config_byte(dev, offset,
(unsigned char *)
p++);
}
}
}
}
/*
Init map with DMA pages. It is not problem if some allocations fail -
the channels that will not get one DMA page will use standard PIO
interface
*/
static void *diva_pci_alloc_consistent(struct pci_dev *hwdev,
size_t size,
dma_addr_t *dma_handle,
void **addr_handle)
{
void *addr = pci_alloc_consistent(hwdev, size, dma_handle);
*addr_handle = addr;
return (addr);
}
void diva_init_dma_map(void *hdev,
struct _diva_dma_map_entry **ppmap, int nentries)
{
struct pci_dev *pdev = (struct pci_dev *) hdev;
struct _diva_dma_map_entry *pmap =
diva_alloc_dma_map(hdev, nentries);
if (pmap) {
int i;
dma_addr_t dma_handle;
void *cpu_addr;
void *addr_handle;
for (i = 0; i < nentries; i++) {
if (!(cpu_addr = diva_pci_alloc_consistent(pdev,
PAGE_SIZE,
&dma_handle,
&addr_handle)))
{
break;
}
diva_init_dma_map_entry(pmap, i, cpu_addr,
(dword) dma_handle,
addr_handle);
DBG_TRC(("dma map alloc [%d]=(%08lx:%08x:%08lx)",
i, (unsigned long) cpu_addr,
(dword) dma_handle,
(unsigned long) addr_handle))}
}
*ppmap = pmap;
}
/*
Free all contained in the map entries and memory used by the map
Should be always called after adapter removal from DIDD array
*/
void diva_free_dma_map(void *hdev, struct _diva_dma_map_entry *pmap)
{
struct pci_dev *pdev = (struct pci_dev *) hdev;
int i;
dword phys_addr;
void *cpu_addr;
dma_addr_t dma_handle;
void *addr_handle;
for (i = 0; (pmap != NULL); i++) {
diva_get_dma_map_entry(pmap, i, &cpu_addr, &phys_addr);
if (!cpu_addr) {
break;
}
addr_handle = diva_get_entry_handle(pmap, i);
dma_handle = (dma_addr_t) phys_addr;
pci_free_consistent(pdev, PAGE_SIZE, addr_handle,
dma_handle);
DBG_TRC(("dma map free [%d]=(%08lx:%08x:%08lx)", i,
(unsigned long) cpu_addr, (dword) dma_handle,
(unsigned long) addr_handle))
}
diva_free_dma_mapping(pmap);
}
/*********************************************************
** I/O port utilities
*********************************************************/
int
diva_os_register_io_port(void *adapter, int on, unsigned long port,
unsigned long length, const char *name, int id)
{
if (on) {
if (!request_region(port, length, name)) {
DBG_ERR(("A: I/O: can't register port=%08x", port))
return (-1);
}
} else {
release_region(port, length);
}
return (0);
}
void __iomem *divasa_remap_pci_bar(diva_os_xdi_adapter_t *a, int id, unsigned long bar, unsigned long area_length)
{
void __iomem *ret = ioremap(bar, area_length);
DBG_TRC(("remap(%08x)->%p", bar, ret));
return (ret);
}
void divasa_unmap_pci_bar(void __iomem *bar)
{
if (bar) {
iounmap(bar);
}
}
/*********************************************************
** I/O port access
*********************************************************/
inline byte inpp(void __iomem *addr)
{
return (inb((unsigned long) addr));
}
inline word inppw(void __iomem *addr)
{
return (inw((unsigned long) addr));
}
inline void inppw_buffer(void __iomem *addr, void *P, int length)
{
insw((unsigned long) addr, (word *) P, length >> 1);
}
inline void outppw_buffer(void __iomem *addr, void *P, int length)
{
outsw((unsigned long) addr, (word *) P, length >> 1);
}
inline void outppw(void __iomem *addr, word w)
{
outw(w, (unsigned long) addr);
}
inline void outpp(void __iomem *addr, word p)
{
outb(p, (unsigned long) addr);
}
/* --------------------------------------------------------------------------
IRQ request / remove
-------------------------------------------------------------------------- */
int diva_os_register_irq(void *context, byte irq, const char *name)
{
int result = request_irq(irq, diva_os_irq_wrapper,
IRQF_SHARED, name, context);
return (result);
}
void diva_os_remove_irq(void *context, byte irq)
{
free_irq(irq, context);
}
/* --------------------------------------------------------------------------
DPC framework implementation
-------------------------------------------------------------------------- */
static void diva_os_dpc_proc(unsigned long context)
{
diva_os_thread_dpc_t *psoft_isr = (diva_os_thread_dpc_t *) context;
diva_os_soft_isr_t *pisr = psoft_isr->psoft_isr;
(*(pisr->callback)) (pisr, pisr->callback_context);
}
int diva_os_initialize_soft_isr(diva_os_soft_isr_t *psoft_isr,
diva_os_soft_isr_callback_t callback,
void *callback_context)
{
diva_os_thread_dpc_t *pdpc;
pdpc = (diva_os_thread_dpc_t *) diva_os_malloc(0, sizeof(*pdpc));
if (!(psoft_isr->object = pdpc)) {
return (-1);
}
memset(pdpc, 0x00, sizeof(*pdpc));
psoft_isr->callback = callback;
psoft_isr->callback_context = callback_context;
pdpc->psoft_isr = psoft_isr;
tasklet_init(&pdpc->divas_task, diva_os_dpc_proc, (unsigned long)pdpc);
return (0);
}
int diva_os_schedule_soft_isr(diva_os_soft_isr_t *psoft_isr)
{
if (psoft_isr && psoft_isr->object) {
diva_os_thread_dpc_t *pdpc =
(diva_os_thread_dpc_t *) psoft_isr->object;
tasklet_schedule(&pdpc->divas_task);
}
return (1);
}
int diva_os_cancel_soft_isr(diva_os_soft_isr_t *psoft_isr)
{
return (0);
}
void diva_os_remove_soft_isr(diva_os_soft_isr_t *psoft_isr)
{
if (psoft_isr && psoft_isr->object) {
diva_os_thread_dpc_t *pdpc =
(diva_os_thread_dpc_t *) psoft_isr->object;
void *mem;
tasklet_kill(&pdpc->divas_task);
mem = psoft_isr->object;
psoft_isr->object = NULL;
diva_os_free(0, mem);
}
}
/*
* kernel/user space copy functions
*/
static int
xdi_copy_to_user(void *os_handle, void __user *dst, const void *src, int length)
{
if (copy_to_user(dst, src, length)) {
return (-EFAULT);
}
return (length);
}
static int
xdi_copy_from_user(void *os_handle, void *dst, const void __user *src, int length)
{
if (copy_from_user(dst, src, length)) {
return (-EFAULT);
}
return (length);
}
/*
* device node operations
*/
static int divas_open(struct inode *inode, struct file *file)
{
return (0);
}
static int divas_release(struct inode *inode, struct file *file)
{
if (file->private_data) {
diva_xdi_close_adapter(file->private_data, file);
}
return (0);
}
static ssize_t divas_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
diva_xdi_um_cfg_cmd_t msg;
int ret = -EINVAL;
if (!file->private_data) {
file->private_data = diva_xdi_open_adapter(file, buf,
count, &msg,
xdi_copy_from_user);
if (!file->private_data)
return (-ENODEV);
ret = diva_xdi_write(file->private_data, file,
buf, count, &msg, xdi_copy_from_user);
} else {
ret = diva_xdi_write(file->private_data, file,
buf, count, NULL, xdi_copy_from_user);
}
switch (ret) {
case -1: /* Message should be removed from rx mailbox first */
ret = -EBUSY;
break;
case -2: /* invalid adapter was specified in this call */
ret = -ENOMEM;
break;
case -3:
ret = -ENXIO;
break;
}
DBG_TRC(("write: ret %d", ret));
return (ret);
}
static ssize_t divas_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
diva_xdi_um_cfg_cmd_t msg;
int ret = -EINVAL;
if (!file->private_data) {
file->private_data = diva_xdi_open_adapter(file, buf,
count, &msg,
xdi_copy_from_user);
}
if (!file->private_data) {
return (-ENODEV);
}
ret = diva_xdi_read(file->private_data, file,
buf, count, xdi_copy_to_user);
switch (ret) {
case -1: /* RX mailbox is empty */
ret = -EAGAIN;
break;
case -2: /* no memory, mailbox was cleared, last command is failed */
ret = -ENOMEM;
break;
case -3: /* can't copy to user, retry */
ret = -EFAULT;
break;
}
DBG_TRC(("read: ret %d", ret));
return (ret);
}
static __poll_t divas_poll(struct file *file, poll_table *wait)
{
if (!file->private_data) {
return (EPOLLERR);
}
return (EPOLLIN | EPOLLRDNORM);
}
static const struct file_operations divas_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.read = divas_read,
.write = divas_write,
.poll = divas_poll,
.open = divas_open,
.release = divas_release
};
static void divas_unregister_chrdev(void)
{
unregister_chrdev(major, DEVNAME);
}
static int __init divas_register_chrdev(void)
{
if ((major = register_chrdev(0, DEVNAME, &divas_fops)) < 0)
{
printk(KERN_ERR "%s: failed to create /dev entry.\n",
DRIVERLNAME);
return (0);
}
return (1);
}
/* --------------------------------------------------------------------------
PCI driver section
-------------------------------------------------------------------------- */
static int divas_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
{
void *pdiva = NULL;
u8 pci_latency;
u8 new_latency = 32;
DBG_TRC(("%s bus: %08x fn: %08x insertion.\n",
CardProperties[ent->driver_data].Name,
pdev->bus->number, pdev->devfn))
printk(KERN_INFO "%s: %s bus: %08x fn: %08x insertion.\n",
DRIVERLNAME, CardProperties[ent->driver_data].Name,
pdev->bus->number, pdev->devfn);
if (pci_enable_device(pdev)) {
DBG_TRC(("%s: %s bus: %08x fn: %08x device init failed.\n",
DRIVERLNAME,
CardProperties[ent->driver_data].Name,
pdev->bus->number,
pdev->devfn))
printk(KERN_ERR
"%s: %s bus: %08x fn: %08x device init failed.\n",
DRIVERLNAME,
CardProperties[ent->driver_data].
Name, pdev->bus->number,
pdev->devfn);
return (-EIO);
}
pci_set_master(pdev);
pci_read_config_byte(pdev, PCI_LATENCY_TIMER, &pci_latency);
if (!pci_latency) {
DBG_TRC(("%s: bus: %08x fn: %08x fix latency.\n",
DRIVERLNAME, pdev->bus->number, pdev->devfn))
printk(KERN_INFO
"%s: bus: %08x fn: %08x fix latency.\n",
DRIVERLNAME, pdev->bus->number, pdev->devfn);
pci_write_config_byte(pdev, PCI_LATENCY_TIMER, new_latency);
}
if (!(pdiva = diva_driver_add_card(pdev, ent->driver_data))) {
DBG_TRC(("%s: %s bus: %08x fn: %08x card init failed.\n",
DRIVERLNAME,
CardProperties[ent->driver_data].Name,
pdev->bus->number,
pdev->devfn))
printk(KERN_ERR
"%s: %s bus: %08x fn: %08x card init failed.\n",
DRIVERLNAME,
CardProperties[ent->driver_data].
Name, pdev->bus->number,
pdev->devfn);
return (-EIO);
}
pci_set_drvdata(pdev, pdiva);
return (0);
}
static void divas_remove_one(struct pci_dev *pdev)
{
void *pdiva = pci_get_drvdata(pdev);
DBG_TRC(("bus: %08x fn: %08x removal.\n",
pdev->bus->number, pdev->devfn))
printk(KERN_INFO "%s: bus: %08x fn: %08x removal.\n",
DRIVERLNAME, pdev->bus->number, pdev->devfn);
if (pdiva) {
diva_driver_remove_card(pdiva);
}
}
/* --------------------------------------------------------------------------
Driver Load / Startup
-------------------------------------------------------------------------- */
static int __init divas_init(void)
{
char tmprev[50];
int ret = 0;
printk(KERN_INFO "%s\n", DRIVERNAME);
printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE_DIVAS);
strcpy(tmprev, main_revision);
printk("%s Build: %s(%s)\n", getrev(tmprev),
diva_xdi_common_code_build, DIVA_BUILD);
printk(KERN_INFO "%s: support for: ", DRIVERLNAME);
#ifdef CONFIG_ISDN_DIVAS_BRIPCI
printk("BRI/PCI ");
#endif
#ifdef CONFIG_ISDN_DIVAS_PRIPCI
printk("PRI/PCI ");
#endif
printk("adapters\n");
if (!divasfunc_init(dbgmask)) {
printk(KERN_ERR "%s: failed to connect to DIDD.\n",
DRIVERLNAME);
ret = -EIO;
goto out;
}
if (!divas_register_chrdev()) {
#ifdef MODULE
divasfunc_exit();
#endif
ret = -EIO;
goto out;
}
if (!create_divas_proc()) {
#ifdef MODULE
divas_unregister_chrdev();
divasfunc_exit();
#endif
printk(KERN_ERR "%s: failed to create proc entry.\n",
DRIVERLNAME);
ret = -EIO;
goto out;
}
if ((ret = pci_register_driver(&diva_pci_driver))) {
#ifdef MODULE
remove_divas_proc();
divas_unregister_chrdev();
divasfunc_exit();
#endif
printk(KERN_ERR "%s: failed to init pci driver.\n",
DRIVERLNAME);
goto out;
}
printk(KERN_INFO "%s: started with major %d\n", DRIVERLNAME, major);
out:
return (ret);
}
/* --------------------------------------------------------------------------
Driver Unload
-------------------------------------------------------------------------- */
static void __exit divas_exit(void)
{
pci_unregister_driver(&diva_pci_driver);
remove_divas_proc();
divas_unregister_chrdev();
divasfunc_exit();
printk(KERN_INFO "%s: module unloaded.\n", DRIVERLNAME);
}
module_init(divas_init);
module_exit(divas_exit);

View File

@ -1,412 +0,0 @@
/* $Id: divasproc.c,v 1.19.4.3 2005/01/31 12:22:20 armin Exp $
*
* Low level driver for Eicon DIVA Server ISDN cards.
* /proc functions
*
* Copyright 2000-2003 by Armin Schindler (mac@melware.de)
* Copyright 2000-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/poll.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/list.h>
#include <linux/uaccess.h>
#include "platform.h"
#include "debuglib.h"
#undef ID_MASK
#undef N_DATA
#include "pc.h"
#include "di_defs.h"
#include "divasync.h"
#include "di.h"
#include "io.h"
#include "xdi_msg.h"
#include "xdi_adapter.h"
#include "diva.h"
#include "diva_pci.h"
extern PISDN_ADAPTER IoAdapters[MAX_ADAPTER];
extern void divas_get_version(char *);
extern void diva_get_vserial_number(PISDN_ADAPTER IoAdapter, char *buf);
/*********************************************************
** Functions for /proc interface / File operations
*********************************************************/
static char *divas_proc_name = "divas";
static char *adapter_dir_name = "adapter";
static char *info_proc_name = "info";
static char *grp_opt_proc_name = "group_optimization";
static char *d_l1_down_proc_name = "dynamic_l1_down";
/*
** "divas" entry
*/
extern struct proc_dir_entry *proc_net_eicon;
static struct proc_dir_entry *divas_proc_entry = NULL;
static ssize_t
divas_read(struct file *file, char __user *buf, size_t count, loff_t *off)
{
int len = 0;
int cadapter;
char tmpbuf[80];
char tmpser[16];
if (*off)
return 0;
divas_get_version(tmpbuf);
if (copy_to_user(buf + len, &tmpbuf, strlen(tmpbuf)))
return -EFAULT;
len += strlen(tmpbuf);
for (cadapter = 0; cadapter < MAX_ADAPTER; cadapter++) {
if (IoAdapters[cadapter]) {
diva_get_vserial_number(IoAdapters[cadapter],
tmpser);
sprintf(tmpbuf,
"%2d: %-30s Serial:%-10s IRQ:%2d\n",
cadapter + 1,
IoAdapters[cadapter]->Properties.Name,
tmpser,
IoAdapters[cadapter]->irq_info.irq_nr);
if ((strlen(tmpbuf) + len) > count)
break;
if (copy_to_user
(buf + len, &tmpbuf,
strlen(tmpbuf))) return -EFAULT;
len += strlen(tmpbuf);
}
}
*off += len;
return (len);
}
static ssize_t
divas_write(struct file *file, const char __user *buf, size_t count, loff_t *off)
{
return (-ENODEV);
}
static __poll_t divas_poll(struct file *file, poll_table *wait)
{
return (EPOLLERR);
}
static int divas_open(struct inode *inode, struct file *file)
{
return nonseekable_open(inode, file);
}
static int divas_close(struct inode *inode, struct file *file)
{
return (0);
}
static const struct file_operations divas_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.read = divas_read,
.write = divas_write,
.poll = divas_poll,
.open = divas_open,
.release = divas_close
};
int create_divas_proc(void)
{
divas_proc_entry = proc_create(divas_proc_name, S_IFREG | S_IRUGO,
proc_net_eicon, &divas_fops);
if (!divas_proc_entry)
return (0);
return (1);
}
void remove_divas_proc(void)
{
if (divas_proc_entry) {
remove_proc_entry(divas_proc_name, proc_net_eicon);
divas_proc_entry = NULL;
}
}
static ssize_t grp_opt_proc_write(struct file *file, const char __user *buffer,
size_t count, loff_t *pos)
{
diva_os_xdi_adapter_t *a = PDE_DATA(file_inode(file));
PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1];
if ((count == 1) || (count == 2)) {
char c;
if (get_user(c, buffer))
return -EFAULT;
switch (c) {
case '0':
IoAdapter->capi_cfg.cfg_1 &=
~DIVA_XDI_CAPI_CFG_1_GROUP_POPTIMIZATION_ON;
break;
case '1':
IoAdapter->capi_cfg.cfg_1 |=
DIVA_XDI_CAPI_CFG_1_GROUP_POPTIMIZATION_ON;
break;
default:
return (-EINVAL);
}
return (count);
}
return (-EINVAL);
}
static ssize_t d_l1_down_proc_write(struct file *file, const char __user *buffer,
size_t count, loff_t *pos)
{
diva_os_xdi_adapter_t *a = PDE_DATA(file_inode(file));
PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1];
if ((count == 1) || (count == 2)) {
char c;
if (get_user(c, buffer))
return -EFAULT;
switch (c) {
case '0':
IoAdapter->capi_cfg.cfg_1 &=
~DIVA_XDI_CAPI_CFG_1_DYNAMIC_L1_ON;
break;
case '1':
IoAdapter->capi_cfg.cfg_1 |=
DIVA_XDI_CAPI_CFG_1_DYNAMIC_L1_ON;
break;
default:
return (-EINVAL);
}
return (count);
}
return (-EINVAL);
}
static int d_l1_down_proc_show(struct seq_file *m, void *v)
{
diva_os_xdi_adapter_t *a = m->private;
PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1];
seq_printf(m, "%s\n",
(IoAdapter->capi_cfg.
cfg_1 & DIVA_XDI_CAPI_CFG_1_DYNAMIC_L1_ON) ? "1" :
"0");
return 0;
}
static int d_l1_down_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, d_l1_down_proc_show, PDE_DATA(inode));
}
static const struct file_operations d_l1_down_proc_fops = {
.owner = THIS_MODULE,
.open = d_l1_down_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
.write = d_l1_down_proc_write,
};
static int grp_opt_proc_show(struct seq_file *m, void *v)
{
diva_os_xdi_adapter_t *a = m->private;
PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1];
seq_printf(m, "%s\n",
(IoAdapter->capi_cfg.
cfg_1 & DIVA_XDI_CAPI_CFG_1_GROUP_POPTIMIZATION_ON)
? "1" : "0");
return 0;
}
static int grp_opt_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, grp_opt_proc_show, PDE_DATA(inode));
}
static const struct file_operations grp_opt_proc_fops = {
.owner = THIS_MODULE,
.open = grp_opt_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
.write = grp_opt_proc_write,
};
static ssize_t info_proc_write(struct file *file, const char __user *buffer,
size_t count, loff_t *pos)
{
diva_os_xdi_adapter_t *a = PDE_DATA(file_inode(file));
PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1];
char c[4];
if (count <= 4)
return -EINVAL;
if (copy_from_user(c, buffer, 4))
return -EFAULT;
/* this is for test purposes only */
if (!memcmp(c, "trap", 4)) {
(*(IoAdapter->os_trap_nfy_Fnc)) (IoAdapter, IoAdapter->ANum);
return (count);
}
return (-EINVAL);
}
static int info_proc_show(struct seq_file *m, void *v)
{
int i = 0;
char *p;
char tmpser[16];
diva_os_xdi_adapter_t *a = m->private;
PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1];
seq_printf(m, "Name : %s\n", IoAdapter->Properties.Name);
seq_printf(m, "DSP state : %08x\n", a->dsp_mask);
seq_printf(m, "Channels : %02d\n", IoAdapter->Properties.Channels);
seq_printf(m, "E. max/used : %03d/%03d\n",
IoAdapter->e_max, IoAdapter->e_count);
diva_get_vserial_number(IoAdapter, tmpser);
seq_printf(m, "Serial : %s\n", tmpser);
seq_printf(m, "IRQ : %d\n", IoAdapter->irq_info.irq_nr);
seq_printf(m, "CardIndex : %d\n", a->CardIndex);
seq_printf(m, "CardOrdinal : %d\n", a->CardOrdinal);
seq_printf(m, "Controller : %d\n", a->controller);
seq_printf(m, "Bus-Type : %s\n",
(a->Bus ==
DIVAS_XDI_ADAPTER_BUS_ISA) ? "ISA" : "PCI");
seq_printf(m, "Port-Name : %s\n", a->port_name);
if (a->Bus == DIVAS_XDI_ADAPTER_BUS_PCI) {
seq_printf(m, "PCI-bus : %d\n", a->resources.pci.bus);
seq_printf(m, "PCI-func : %d\n", a->resources.pci.func);
for (i = 0; i < 8; i++) {
if (a->resources.pci.bar[i]) {
seq_printf(m,
"Mem / I/O %d : 0x%x / mapped : 0x%lx",
i, a->resources.pci.bar[i],
(unsigned long) a->resources.
pci.addr[i]);
if (a->resources.pci.length[i]) {
seq_printf(m,
" / length : %d",
a->resources.pci.
length[i]);
}
seq_putc(m, '\n');
}
}
}
if ((!a->xdi_adapter.port) &&
((!a->xdi_adapter.ram) ||
(!a->xdi_adapter.reset)
|| (!a->xdi_adapter.cfg))) {
if (!IoAdapter->irq_info.irq_nr) {
p = "slave";
} else {
p = "out of service";
}
} else if (a->xdi_adapter.trapped) {
p = "trapped";
} else if (a->xdi_adapter.Initialized) {
p = "active";
} else {
p = "ready";
}
seq_printf(m, "State : %s\n", p);
return 0;
}
static int info_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, info_proc_show, PDE_DATA(inode));
}
static const struct file_operations info_proc_fops = {
.owner = THIS_MODULE,
.open = info_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
.write = info_proc_write,
};
/*
** adapter proc init/de-init
*/
/* --------------------------------------------------------------------------
Create adapter directory and files in proc file system
-------------------------------------------------------------------------- */
int create_adapter_proc(diva_os_xdi_adapter_t *a)
{
struct proc_dir_entry *de, *pe;
char tmp[16];
sprintf(tmp, "%s%d", adapter_dir_name, a->controller);
if (!(de = proc_mkdir(tmp, proc_net_eicon)))
return (0);
a->proc_adapter_dir = (void *) de;
pe = proc_create_data(info_proc_name, S_IRUGO | S_IWUSR, de,
&info_proc_fops, a);
if (!pe)
return (0);
a->proc_info = (void *) pe;
pe = proc_create_data(grp_opt_proc_name, S_IRUGO | S_IWUSR, de,
&grp_opt_proc_fops, a);
if (pe)
a->proc_grp_opt = (void *) pe;
pe = proc_create_data(d_l1_down_proc_name, S_IRUGO | S_IWUSR, de,
&d_l1_down_proc_fops, a);
if (pe)
a->proc_d_l1_down = (void *) pe;
DBG_TRC(("proc entry %s created", tmp));
return (1);
}
/* --------------------------------------------------------------------------
Remove adapter directory and files in proc file system
-------------------------------------------------------------------------- */
void remove_adapter_proc(diva_os_xdi_adapter_t *a)
{
char tmp[16];
if (a->proc_adapter_dir) {
if (a->proc_d_l1_down) {
remove_proc_entry(d_l1_down_proc_name,
(struct proc_dir_entry *) a->proc_adapter_dir);
}
if (a->proc_grp_opt) {
remove_proc_entry(grp_opt_proc_name,
(struct proc_dir_entry *) a->proc_adapter_dir);
}
if (a->proc_info) {
remove_proc_entry(info_proc_name,
(struct proc_dir_entry *) a->proc_adapter_dir);
}
sprintf(tmp, "%s%d", adapter_dir_name, a->controller);
remove_proc_entry(tmp, proc_net_eicon);
DBG_TRC(("proc entry %s%d removed", adapter_dir_name,
a->controller));
}
}

View File

@ -1,489 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef __DIVA_SYNC__H
#define __DIVA_SYNC__H
#define IDI_SYNC_REQ_REMOVE 0x00
#define IDI_SYNC_REQ_GET_NAME 0x01
#define IDI_SYNC_REQ_GET_SERIAL 0x02
#define IDI_SYNC_REQ_SET_POSTCALL 0x03
#define IDI_SYNC_REQ_GET_XLOG 0x04
#define IDI_SYNC_REQ_GET_FEATURES 0x05
#define IDI_SYNC_REQ_USB_REGISTER 0x06
#define IDI_SYNC_REQ_USB_RELEASE 0x07
#define IDI_SYNC_REQ_USB_ADD_DEVICE 0x08
#define IDI_SYNC_REQ_USB_START_DEVICE 0x09
#define IDI_SYNC_REQ_USB_STOP_DEVICE 0x0A
#define IDI_SYNC_REQ_USB_REMOVE_DEVICE 0x0B
#define IDI_SYNC_REQ_GET_CARDTYPE 0x0C
#define IDI_SYNC_REQ_GET_DBG_XLOG 0x0D
#define DIVA_USB
#define DIVA_USB_REQ 0xAC
#define DIVA_USB_TEST 0xAB
#define DIVA_USB_ADD_ADAPTER 0xAC
#define DIVA_USB_REMOVE_ADAPTER 0xAD
#define IDI_SYNC_REQ_SERIAL_HOOK 0x80
#define IDI_SYNC_REQ_XCHANGE_STATUS 0x81
#define IDI_SYNC_REQ_USB_HOOK 0x82
#define IDI_SYNC_REQ_PORTDRV_HOOK 0x83
#define IDI_SYNC_REQ_SLI 0x84 /* SLI request from 3signal modem drivers */
#define IDI_SYNC_REQ_RECONFIGURE 0x85
#define IDI_SYNC_REQ_RESET 0x86
#define IDI_SYNC_REQ_GET_85X_DEVICE_DATA 0x87
#define IDI_SYNC_REQ_LOCK_85X 0x88
#define IDI_SYNC_REQ_DIVA_85X_USB_DATA_EXCHANGE 0x99
#define IDI_SYNC_REQ_DIPORT_EXCHANGE_REQ 0x98
#define IDI_SYNC_REQ_GET_85X_EXT_PORT_TYPE 0xA0
/******************************************************************************/
#define IDI_SYNC_REQ_XDI_GET_EXTENDED_FEATURES 0x92
/*
To receive XDI features:
1. set 'buffer_length_in_bytes' to length of you buffer
2. set 'features' to pointer to your buffer
3. issue synchronous request to XDI
4. Check that feature 'DIVA_XDI_EXTENDED_FEATURES_VALID' is present
after call. This feature does indicate that your request
was processed and XDI does support this synchronous request
5. if on return bit 31 (0x80000000) in 'buffer_length_in_bytes' is
set then provided buffer was too small, and bits 30-0 does
contain necessary length of buffer.
in this case only features that do find place in the buffer
are indicated to caller
*/
typedef struct _diva_xdi_get_extended_xdi_features {
dword buffer_length_in_bytes;
byte *features;
} diva_xdi_get_extended_xdi_features_t;
/*
features[0]
*/
#define DIVA_XDI_EXTENDED_FEATURES_VALID 0x01
#define DIVA_XDI_EXTENDED_FEATURE_CMA 0x02
#define DIVA_XDI_EXTENDED_FEATURE_SDRAM_BAR 0x04
#define DIVA_XDI_EXTENDED_FEATURE_CAPI_PRMS 0x08
#define DIVA_XDI_EXTENDED_FEATURE_NO_CANCEL_RC 0x10
#define DIVA_XDI_EXTENDED_FEATURE_RX_DMA 0x20
#define DIVA_XDI_EXTENDED_FEATURE_MANAGEMENT_DMA 0x40
#define DIVA_XDI_EXTENDED_FEATURE_WIDE_ID 0x80
#define DIVA_XDI_EXTENDED_FEATURES_MAX_SZ 1
/******************************************************************************/
#define IDI_SYNC_REQ_XDI_GET_ADAPTER_SDRAM_BAR 0x93
typedef struct _diva_xdi_get_adapter_sdram_bar {
dword bar;
} diva_xdi_get_adapter_sdram_bar_t;
/******************************************************************************/
#define IDI_SYNC_REQ_XDI_GET_CAPI_PARAMS 0x94
/*
CAPI Parameters will be written in the caller's buffer
*/
typedef struct _diva_xdi_get_capi_parameters {
dword structure_length;
byte flag_dynamic_l1_down;
byte group_optimization_enabled;
} diva_xdi_get_capi_parameters_t;
/******************************************************************************/
#define IDI_SYNC_REQ_XDI_GET_LOGICAL_ADAPTER_NUMBER 0x95
/*
Get logical adapter number, as assigned by XDI
'controller' is starting with zero 'sub' controller number
in case of one adapter that supports multiple interfaces
'controller' is zero for Master adapter (and adapter that supports
only one interface)
*/
typedef struct _diva_xdi_get_logical_adapter_number {
dword logical_adapter_number;
dword controller;
dword total_controllers;
} diva_xdi_get_logical_adapter_number_s_t;
/******************************************************************************/
#define IDI_SYNC_REQ_UP1DM_OPERATION 0x96
/******************************************************************************/
#define IDI_SYNC_REQ_DMA_DESCRIPTOR_OPERATION 0x97
#define IDI_SYNC_REQ_DMA_DESCRIPTOR_ALLOC 0x01
#define IDI_SYNC_REQ_DMA_DESCRIPTOR_FREE 0x02
typedef struct _diva_xdi_dma_descriptor_operation {
int operation;
int descriptor_number;
void *descriptor_address;
dword descriptor_magic;
} diva_xdi_dma_descriptor_operation_t;
/******************************************************************************/
#define IDI_SYNC_REQ_DIDD_REGISTER_ADAPTER_NOTIFY 0x01
#define IDI_SYNC_REQ_DIDD_REMOVE_ADAPTER_NOTIFY 0x02
#define IDI_SYNC_REQ_DIDD_ADD_ADAPTER 0x03
#define IDI_SYNC_REQ_DIDD_REMOVE_ADAPTER 0x04
#define IDI_SYNC_REQ_DIDD_READ_ADAPTER_ARRAY 0x05
#define IDI_SYNC_REQ_DIDD_GET_CFG_LIB_IFC 0x10
typedef struct _diva_didd_adapter_notify {
dword handle; /* Notification handle */
void *callback;
void *context;
} diva_didd_adapter_notify_t;
typedef struct _diva_didd_add_adapter {
void *descriptor;
} diva_didd_add_adapter_t;
typedef struct _diva_didd_remove_adapter {
IDI_CALL p_request;
} diva_didd_remove_adapter_t;
typedef struct _diva_didd_read_adapter_array {
void *buffer;
dword length;
} diva_didd_read_adapter_array_t;
typedef struct _diva_didd_get_cfg_lib_ifc {
void *ifc;
} diva_didd_get_cfg_lib_ifc_t;
/******************************************************************************/
#define IDI_SYNC_REQ_XDI_GET_STREAM 0x91
#define DIVA_XDI_SYNCHRONOUS_SERVICE 0x01
#define DIVA_XDI_DMA_SERVICE 0x02
#define DIVA_XDI_AUTO_SERVICE 0x03
#define DIVA_ISTREAM_COMPLETE_NOTIFY 0
#define DIVA_ISTREAM_COMPLETE_READ 1
#define DIVA_ISTREAM_COMPLETE_WRITE 2
typedef struct _diva_xdi_stream_interface {
unsigned char Id; /* filled by XDI client */
unsigned char provided_service; /* filled by XDI */
unsigned char requested_service; /* filled by XDI Client */
void *xdi_context; /* filled by XDI */
void *client_context; /* filled by XDI client */
int (*write)(void *context,
int Id,
void *data,
int length,
int final,
byte usr1,
byte usr2);
int (*read)(void *context,
int Id,
void *data,
int max_length,
int *final,
byte *usr1,
byte *usr2);
int (*complete)(void *client_context,
int Id,
int what,
void *data,
int length,
int *final);
} diva_xdi_stream_interface_t;
/******************************************************************************/
/*
* IDI_SYNC_REQ_SERIAL_HOOK - special interface for the DIVA Mobile card
*/
typedef struct
{ unsigned char LineState; /* Modem line state (STATUS_R) */
#define SERIAL_GSM_CELL 0x01 /* GSM or CELL cable attached */
unsigned char CardState; /* PCMCIA card state (0 = down) */
unsigned char IsdnState; /* ISDN layer 1 state (0 = down)*/
unsigned char HookState; /* current logical hook state */
#define SERIAL_ON_HOOK 0x02 /* set in DIVA CTRL_R register */
} SERIAL_STATE;
typedef int (*SERIAL_INT_CB)(void *Context);
typedef int (*SERIAL_DPC_CB)(void *Context);
typedef unsigned char (*SERIAL_I_SYNC)(void *Context);
typedef struct
{ /* 'Req' and 'Rc' must be at the same place as in the ENTITY struct */
unsigned char Req; /* request (must be always 0) */
unsigned char Rc; /* return code (is the request) */
unsigned char Function; /* private function code */
#define SERIAL_HOOK_ATTACH 0x81
#define SERIAL_HOOK_STATUS 0x82
#define SERIAL_HOOK_I_SYNC 0x83
#define SERIAL_HOOK_NOECHO 0x84
#define SERIAL_HOOK_RING 0x85
#define SERIAL_HOOK_DETACH 0x8f
unsigned char Flags; /* function refinements */
/* parameters passed by the ATTACH request */
SERIAL_INT_CB InterruptHandler; /* called on each interrupt */
SERIAL_DPC_CB DeferredHandler; /* called on hook state changes */
void *HandlerContext; /* context for both handlers */
/* return values for both the ATTACH and the STATUS request */
unsigned long IoBase; /* IO port assigned to UART */
SERIAL_STATE State;
/* parameters and return values for the I_SYNC function */
SERIAL_I_SYNC SyncFunction; /* to be called synchronized */
void *SyncContext; /* context for this function */
unsigned char SyncResult; /* return value of function */
} SERIAL_HOOK;
/*
* IDI_SYNC_REQ_XCHANGE_STATUS - exchange the status between IDI and WMP
* IDI_SYNC_REQ_RECONFIGURE - reconfiguration of IDI from WMP
*/
typedef struct
{ /* 'Req' and 'Rc' must be at the same place as in the ENTITY struct */
unsigned char Req; /* request (must be always 0) */
unsigned char Rc; /* return code (is the request) */
#define DRIVER_STATUS_BOOT 0xA1
#define DRIVER_STATUS_INIT_DEV 0xA2
#define DRIVER_STATUS_RUNNING 0xA3
#define DRIVER_STATUS_SHUTDOWN 0xAF
#define DRIVER_STATUS_TRAPPED 0xAE
unsigned char wmpStatus; /* exported by WMP */
unsigned char idiStatus; /* exported by IDI */
unsigned long wizProto; /* from WMP registry to IDI */
/* the cardtype value is defined by cardtype.h */
unsigned long cardType; /* from IDI registry to WMP */
unsigned long nt2; /* from IDI registry to WMP */
unsigned long permanent; /* from IDI registry to WMP */
unsigned long stableL2; /* from IDI registry to WMP */
unsigned long tei; /* from IDI registry to WMP */
#define CRC4_MASK 0x00000003
#define L1_TRISTATE_MASK 0x00000004
#define WATCHDOG_MASK 0x00000008
#define NO_ORDER_CHECK_MASK 0x00000010
#define LOW_CHANNEL_MASK 0x00000020
#define NO_HSCX30_MASK 0x00000040
#define SET_BOARD 0x00001000
#define SET_CRC4 0x00030000
#define SET_L1_TRISTATE 0x00040000
#define SET_WATCHDOG 0x00080000
#define SET_NO_ORDER_CHECK 0x00100000
#define SET_LOW_CHANNEL 0x00200000
#define SET_NO_HSCX30 0x00400000
#define SET_MODE 0x00800000
#define SET_PROTO 0x02000000
#define SET_CARDTYPE 0x04000000
#define SET_NT2 0x08000000
#define SET_PERMANENT 0x10000000
#define SET_STABLEL2 0x20000000
#define SET_TEI 0x40000000
#define SET_NUMBERLEN 0x80000000
unsigned long Flag; /* |31-Type-16|15-Mask-0| */
unsigned long NumberLen; /* reconfiguration: union is empty */
union {
struct { /* possible reconfiguration, but ... ; SET_BOARD */
unsigned long SerialNumber;
char *pCardname; /* di_defs.h: BOARD_NAME_LENGTH */
} board;
struct { /* reset: need resources */
void *pRawResources;
void *pXlatResources;
} res;
struct { /* reconfiguration: wizProto == PROTTYPE_RBSCAS */
#define GLARE_RESOLVE_MASK 0x00000001
#define DID_MASK 0x00000002
#define BEARER_CAP_MASK 0x0000000c
#define SET_GLARE_RESOLVE 0x00010000
#define SET_DID 0x00020000
#define SET_BEARER_CAP 0x000c0000
unsigned long Flag; /* |31-Type-16|15-VALUE-0| */
unsigned short DigitTimeout;
unsigned short AnswerDelay;
} rbs;
struct { /* reconfiguration: wizProto == PROTTYPE_QSIG */
#define CALL_REF_LENGTH1_MASK 0x00000001
#define BRI_CHANNEL_ID_MASK 0x00000002
#define SET_CALL_REF_LENGTH 0x00010000
#define SET_BRI_CHANNEL_ID 0x00020000
unsigned long Flag; /* |31-Type-16|15-VALUE-0| */
} qsig;
struct { /* reconfiguration: NumberLen != 0 */
#define SET_SPID1 0x00010000
#define SET_NUMBER1 0x00020000
#define SET_SUBADDRESS1 0x00040000
#define SET_SPID2 0x00100000
#define SET_NUMBER2 0x00200000
#define SET_SUBADDRESS2 0x00400000
#define MASK_SET 0xffff0000
unsigned long Flag; /* |31-Type-16|15-Channel-0| */
unsigned char *pBuffer; /* number value */
} isdnNo;
}
parms
;
} isdnProps;
/*
* IDI_SYNC_REQ_PORTDRV_HOOK - signal plug/unplug (Award Cardware only)
*/
typedef void (*PORTDRV_HOOK_CB)(void *Context, int Plug);
typedef struct
{ /* 'Req' and 'Rc' must be at the same place as in the ENTITY struct */
unsigned char Req; /* request (must be always 0) */
unsigned char Rc; /* return code (is the request) */
unsigned char Function; /* private function code */
unsigned char Flags; /* function refinements */
PORTDRV_HOOK_CB Callback; /* to be called on plug/unplug */
void *Context; /* context for callback */
unsigned long Info; /* more info if needed */
} PORTDRV_HOOK;
/* Codes for the 'Rc' element in structure below. */
#define SLI_INSTALL (0xA1)
#define SLI_UNINSTALL (0xA2)
typedef int (*SLIENTRYPOINT)(void *p3SignalAPI, void *pContext);
typedef struct
{ /* 'Req' and 'Rc' must be at the same place as in the ENTITY struct */
unsigned char Req; /* request (must be always 0) */
unsigned char Rc; /* return code (is the request) */
unsigned char Function; /* private function code */
unsigned char Flags; /* function refinements */
SLIENTRYPOINT Callback; /* to be called on plug/unplug */
void *Context; /* context for callback */
unsigned long Info; /* more info if needed */
} SLIENTRYPOINT_REQ;
/******************************************************************************/
/*
* Definitions for DIVA USB
*/
typedef int (*USB_SEND_REQ)(unsigned char PipeIndex, unsigned char Type, void *Data, int sizeData);
typedef int (*USB_START_DEV)(void *Adapter, void *Ipac);
/* called from WDM */
typedef void (*USB_RECV_NOTIFY)(void *Ipac, void *msg);
typedef void (*USB_XMIT_NOTIFY)(void *Ipac, unsigned char PipeIndex);
/******************************************************************************/
/*
* Parameter description for synchronous requests.
*
* Sorry, must repeat some parts of di_defs.h here because
* they are not defined for all operating environments
*/
typedef union
{ ENTITY Entity;
struct
{ /* 'Req' and 'Rc' are at the same place as in the ENTITY struct */
unsigned char Req; /* request (must be always 0) */
unsigned char Rc; /* return code (is the request) */
} Request;
struct
{ unsigned char Req; /* request (must be always 0) */
unsigned char Rc; /* return code (0x01) */
unsigned char name[BOARD_NAME_LENGTH];
} GetName;
struct
{ unsigned char Req; /* request (must be always 0) */
unsigned char Rc; /* return code (0x02) */
unsigned long serial; /* serial number */
} GetSerial;
struct
{ unsigned char Req; /* request (must be always 0) */
unsigned char Rc; /* return code (0x02) */
unsigned long lineIdx;/* line, 0 if card has only one */
} GetLineIdx;
struct
{ unsigned char Req; /* request (must be always 0) */
unsigned char Rc; /* return code (0x02) */
unsigned long cardtype;/* card type */
} GetCardType;
struct
{ unsigned short command;/* command = 0x0300 */
unsigned short dummy; /* not used */
IDI_CALL callback;/* routine to call back */
ENTITY *contxt; /* ptr to entity to use */
} PostCall;
struct
{ unsigned char Req; /* request (must be always 0) */
unsigned char Rc; /* return code (0x04) */
unsigned char pcm[1]; /* buffer (a pc_maint struct) */
} GetXlog;
struct
{ unsigned char Req; /* request (must be always 0) */
unsigned char Rc; /* return code (0x05) */
unsigned short features;/* feature defines see below */
} GetFeatures;
SERIAL_HOOK SerialHook;
/* Added for DIVA USB */
struct
{ unsigned char Req;
unsigned char Rc;
USB_SEND_REQ UsbSendRequest; /* function in Diva Usb WDM driver in usb_os.c, */
/* called from usb_drv.c to send a message to our device */
/* eg UsbSendRequest (USB_PIPE_SIGNAL, USB_IPAC_START, 0, 0); */
USB_RECV_NOTIFY usb_recv; /* called from usb_os.c to pass a received message and ptr to IPAC */
/* on to usb_drv.c by a call to usb_recv(). */
USB_XMIT_NOTIFY usb_xmit; /* called from usb_os.c in DivaUSB.sys WDM to indicate a completed transmit */
/* to usb_drv.c by a call to usb_xmit(). */
USB_START_DEV UsbStartDevice; /* Start the USB Device, in usb_os.c */
IDI_CALL callback; /* routine to call back */
ENTITY *contxt; /* ptr to entity to use */
void **ipac_ptr; /* pointer to struct IPAC in VxD */
} Usb_Msg_old;
/* message used by WDM and VXD to pass pointers of function and IPAC* */
struct
{ unsigned char Req;
unsigned char Rc;
USB_SEND_REQ pUsbSendRequest;/* function in Diva Usb WDM driver in usb_os.c, */
/* called from usb_drv.c to send a message to our device */
/* eg UsbSendRequest (USB_PIPE_SIGNAL, USB_IPAC_START, 0, 0); */
USB_RECV_NOTIFY p_usb_recv; /* called from usb_os.c to pass a received message and ptr to IPAC */
/* on to usb_drv.c by a call to usb_recv(). */
USB_XMIT_NOTIFY p_usb_xmit; /* called from usb_os.c in DivaUSB.sys WDM to indicate a completed transmit */
/* to usb_drv.c by a call to usb_xmit().*/
void *ipac_ptr; /* &Diva.ipac pointer to struct IPAC in VxD */
} Usb_Msg;
PORTDRV_HOOK PortdrvHook;
SLIENTRYPOINT_REQ sliEntryPointReq;
struct {
unsigned char Req;
unsigned char Rc;
diva_xdi_stream_interface_t info;
} xdi_stream_info;
struct {
unsigned char Req;
unsigned char Rc;
diva_xdi_get_extended_xdi_features_t info;
} xdi_extended_features;
struct {
unsigned char Req;
unsigned char Rc;
diva_xdi_get_adapter_sdram_bar_t info;
} xdi_sdram_bar;
struct {
unsigned char Req;
unsigned char Rc;
diva_xdi_get_capi_parameters_t info;
} xdi_capi_prms;
struct {
ENTITY e;
diva_didd_adapter_notify_t info;
} didd_notify;
struct {
ENTITY e;
diva_didd_add_adapter_t info;
} didd_add_adapter;
struct {
ENTITY e;
diva_didd_remove_adapter_t info;
} didd_remove_adapter;
struct {
ENTITY e;
diva_didd_read_adapter_array_t info;
} didd_read_adapter_array;
struct {
ENTITY e;
diva_didd_get_cfg_lib_ifc_t info;
} didd_get_cfg_lib_ifc;
struct {
unsigned char Req;
unsigned char Rc;
diva_xdi_get_logical_adapter_number_s_t info;
} xdi_logical_adapter_number;
struct {
unsigned char Req;
unsigned char Rc;
diva_xdi_dma_descriptor_operation_t info;
} xdi_dma_descriptor_operation;
} IDI_SYNC_REQ;
/******************************************************************************/
#endif /* __DIVA_SYNC__H */

View File

@ -1,110 +0,0 @@
/* $Id: dqueue.c,v 1.5 2003/04/12 21:40:49 schindler Exp $
*
* Driver for Eicon DIVA Server ISDN cards.
* User Mode IDI Interface
*
* Copyright 2000-2003 by Armin Schindler (mac@melware.de)
* Copyright 2000-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*/
#include "platform.h"
#include "dqueue.h"
int
diva_data_q_init(diva_um_idi_data_queue_t *q,
int max_length, int max_segments)
{
int i;
q->max_length = max_length;
q->segments = max_segments;
for (i = 0; i < q->segments; i++) {
q->data[i] = NULL;
q->length[i] = 0;
}
q->read = q->write = q->count = q->segment_pending = 0;
for (i = 0; i < q->segments; i++) {
if (!(q->data[i] = diva_os_malloc(0, q->max_length))) {
diva_data_q_finit(q);
return (-1);
}
}
return (0);
}
int diva_data_q_finit(diva_um_idi_data_queue_t *q)
{
int i;
for (i = 0; i < q->segments; i++) {
if (q->data[i]) {
diva_os_free(0, q->data[i]);
}
q->data[i] = NULL;
q->length[i] = 0;
}
q->read = q->write = q->count = q->segment_pending = 0;
return (0);
}
int diva_data_q_get_max_length(const diva_um_idi_data_queue_t *q)
{
return (q->max_length);
}
void *diva_data_q_get_segment4write(diva_um_idi_data_queue_t *q)
{
if ((!q->segment_pending) && (q->count < q->segments)) {
q->segment_pending = 1;
return (q->data[q->write]);
}
return NULL;
}
void
diva_data_q_ack_segment4write(diva_um_idi_data_queue_t *q, int length)
{
if (q->segment_pending) {
q->length[q->write] = length;
q->count++;
q->write++;
if (q->write >= q->segments) {
q->write = 0;
}
q->segment_pending = 0;
}
}
const void *diva_data_q_get_segment4read(const diva_um_idi_data_queue_t *
q)
{
if (q->count) {
return (q->data[q->read]);
}
return NULL;
}
int diva_data_q_get_segment_length(const diva_um_idi_data_queue_t *q)
{
return (q->length[q->read]);
}
void diva_data_q_ack_segment4read(diva_um_idi_data_queue_t *q)
{
if (q->count) {
q->length[q->read] = 0;
q->count--;
q->read++;
if (q->read >= q->segments) {
q->read = 0;
}
}
}

View File

@ -1,32 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* $Id: dqueue.h,v 1.1.2.2 2001/02/08 12:25:43 armin Exp $ */
#ifndef _DIVA_USER_MODE_IDI_DATA_QUEUE_H__
#define _DIVA_USER_MODE_IDI_DATA_QUEUE_H__
#define DIVA_UM_IDI_MAX_MSGS 64
typedef struct _diva_um_idi_data_queue {
int segments;
int max_length;
int read;
int write;
int count;
int segment_pending;
void *data[DIVA_UM_IDI_MAX_MSGS];
int length[DIVA_UM_IDI_MAX_MSGS];
} diva_um_idi_data_queue_t;
int diva_data_q_init(diva_um_idi_data_queue_t *q,
int max_length, int max_segments);
int diva_data_q_finit(diva_um_idi_data_queue_t *q);
int diva_data_q_get_max_length(const diva_um_idi_data_queue_t *q);
void *diva_data_q_get_segment4write(diva_um_idi_data_queue_t *q);
void diva_data_q_ack_segment4write(diva_um_idi_data_queue_t *q,
int length);
const void *diva_data_q_get_segment4read(const diva_um_idi_data_queue_t *
q);
int diva_data_q_get_segment_length(const diva_um_idi_data_queue_t *q);
void diva_data_q_ack_segment4read(diva_um_idi_data_queue_t *q);
#endif

View File

@ -1,301 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef DSP_DEFS_H_
#define DSP_DEFS_H_
#include "dspdids.h"
/*---------------------------------------------------------------------------*/
#define dsp_download_reserve_space(fp, length)
/*****************************************************************************/
/*
* OS file access abstraction layer
*
* I/O functions returns -1 on error, 0 on EOF
*/
struct _OsFileHandle_;
typedef long (*OsFileIo)(struct _OsFileHandle_ *handle,
void *buffer,
long size);
typedef long (*OsFileSeek)(struct _OsFileHandle_ *handle,
long position,
int mode);
typedef long (*OsCardLoad)(struct _OsFileHandle_ *handle,
long length,
void **addr);
typedef struct _OsFileHandle_
{ void *sysFileDesc;
unsigned long sysFileSize;
OsFileIo sysFileRead;
OsFileSeek sysFileSeek;
void *sysLoadDesc;
OsCardLoad sysCardLoad;
} OsFileHandle;
extern OsFileHandle *OsOpenFile(char *path_name);
extern void OsCloseFile(OsFileHandle *fp);
/*****************************************************************************/
#define DSP_TELINDUS_FILE "dspdload.bin"
/* special DSP file for BRI cards for Qsig and CornetN because of missing memory */
#define DSP_QSIG_TELINDUS_FILE "dspdqsig.bin"
#define DSP_MDM_TELINDUS_FILE "dspdvmdm.bin"
#define DSP_FAX_TELINDUS_FILE "dspdvfax.bin"
#define DSP_DIRECTORY_ENTRIES 64
#define DSP_MEMORY_TYPE_EXTERNAL_DM 0
#define DSP_MEMORY_TYPE_EXTERNAL_PM 1
#define DSP_MEMORY_TYPE_INTERNAL_DM 2
#define DSP_MEMORY_TYPE_INTERNAL_PM 3
#define DSP_DOWNLOAD_FLAG_BOOTABLE 0x0001
#define DSP_DOWNLOAD_FLAG_2181 0x0002
#define DSP_DOWNLOAD_FLAG_TIMECRITICAL 0x0004
#define DSP_DOWNLOAD_FLAG_COMPAND 0x0008
#define DSP_MEMORY_BLOCK_COUNT 16
#define DSP_SEGMENT_PM_FLAG 0x0001
#define DSP_SEGMENT_SHARED_FLAG 0x0002
#define DSP_SEGMENT_EXTERNAL_DM DSP_MEMORY_TYPE_EXTERNAL_DM
#define DSP_SEGMENT_EXTERNAL_PM DSP_MEMORY_TYPE_EXTERNAL_PM
#define DSP_SEGMENT_INTERNAL_DM DSP_MEMORY_TYPE_INTERNAL_DM
#define DSP_SEGMENT_INTERNAL_PM DSP_MEMORY_TYPE_INTERNAL_PM
#define DSP_SEGMENT_FIRST_RELOCATABLE 4
#define DSP_DATA_BLOCK_PM_FLAG 0x0001
#define DSP_DATA_BLOCK_DWORD_FLAG 0x0002
#define DSP_DATA_BLOCK_RESOLVE_FLAG 0x0004
#define DSP_RELOC_NONE 0x00
#define DSP_RELOC_SEGMENT_MASK 0x3f
#define DSP_RELOC_TYPE_MASK 0xc0
#define DSP_RELOC_TYPE_0 0x00 /* relocation of address in DM word / high part of PM word */
#define DSP_RELOC_TYPE_1 0x40 /* relocation of address in low part of PM data word */
#define DSP_RELOC_TYPE_2 0x80 /* relocation of address in standard command */
#define DSP_RELOC_TYPE_3 0xc0 /* relocation of address in call/jump on flag in */
#define DSP_COMBIFILE_FORMAT_IDENTIFICATION_SIZE 48
#define DSP_COMBIFILE_FORMAT_VERSION_BCD 0x0100
#define DSP_FILE_FORMAT_IDENTIFICATION_SIZE 48
#define DSP_FILE_FORMAT_VERSION_BCD 0x0100
typedef struct tag_dsp_combifile_header
{
char format_identification[DSP_COMBIFILE_FORMAT_IDENTIFICATION_SIZE];
word format_version_bcd;
word header_size;
word combifile_description_size;
word directory_entries;
word directory_size;
word download_count;
word usage_mask_size;
} t_dsp_combifile_header;
typedef struct tag_dsp_combifile_directory_entry
{
word card_type_number;
word file_set_number;
} t_dsp_combifile_directory_entry;
typedef struct tag_dsp_file_header
{
char format_identification[DSP_FILE_FORMAT_IDENTIFICATION_SIZE];
word format_version_bcd;
word download_id;
word download_flags;
word required_processing_power;
word interface_channel_count;
word header_size;
word download_description_size;
word memory_block_table_size;
word memory_block_count;
word segment_table_size;
word segment_count;
word symbol_table_size;
word symbol_count;
word total_data_size_dm;
word data_block_count_dm;
word total_data_size_pm;
word data_block_count_pm;
} t_dsp_file_header;
typedef struct tag_dsp_memory_block_desc
{
word alias_memory_block;
word memory_type;
word address;
word size; /* DSP words */
} t_dsp_memory_block_desc;
typedef struct tag_dsp_segment_desc
{
word memory_block;
word attributes;
word base;
word size;
word alignment; /* ==0 -> no other legal start address than base */
} t_dsp_segment_desc;
typedef struct tag_dsp_symbol_desc
{
word symbol_id;
word segment;
word offset;
word size; /* DSP words */
} t_dsp_symbol_desc;
typedef struct tag_dsp_data_block_header
{
word attributes;
word segment;
word offset;
word size; /* DSP words */
} t_dsp_data_block_header;
typedef struct tag_dsp_download_desc
{
word download_id;
word download_flags;
word required_processing_power;
word interface_channel_count;
word excess_header_size;
word memory_block_count;
word segment_count;
word symbol_count;
word data_block_count_dm;
word data_block_count_pm;
byte *p_excess_header_data;
char *p_download_description;
t_dsp_memory_block_desc *p_memory_block_table;
t_dsp_segment_desc *p_segment_table;
t_dsp_symbol_desc *p_symbol_table;
word *p_data_blocks_dm;
word *p_data_blocks_pm;
} t_dsp_desc;
typedef struct tag_dsp_portable_download_desc /* be sure to keep native alignment for MAESTRA's */
{
word download_id;
word download_flags;
word required_processing_power;
word interface_channel_count;
word excess_header_size;
word memory_block_count;
word segment_count;
word symbol_count;
word data_block_count_dm;
word data_block_count_pm;
dword p_excess_header_data;
dword p_download_description;
dword p_memory_block_table;
dword p_segment_table;
dword p_symbol_table;
dword p_data_blocks_dm;
dword p_data_blocks_pm;
} t_dsp_portable_desc;
#define DSP_DOWNLOAD_INDEX_KERNEL 0
#define DSP30TX_DOWNLOAD_INDEX_KERNEL 1
#define DSP30RX_DOWNLOAD_INDEX_KERNEL 2
#define DSP_MAX_DOWNLOAD_COUNT 64
#define DSP_DOWNLOAD_MAX_SEGMENTS 16
#define DSP_UDATA_REQUEST_RECONFIGURE 0
/*
parameters:
<word> reconfigure delay (in 8kHz samples)
<word> reconfigure code
<byte> reconfigure hdlc preamble flags
*/
#define DSP_RECONFIGURE_TX_FLAG 0x8000
#define DSP_RECONFIGURE_SHORT_TRAIN_FLAG 0x4000
#define DSP_RECONFIGURE_ECHO_PROTECT_FLAG 0x2000
#define DSP_RECONFIGURE_HDLC_FLAG 0x1000
#define DSP_RECONFIGURE_SYNC_FLAG 0x0800
#define DSP_RECONFIGURE_PROTOCOL_MASK 0x00ff
#define DSP_RECONFIGURE_IDLE 0
#define DSP_RECONFIGURE_V25 1
#define DSP_RECONFIGURE_V21_CH2 2
#define DSP_RECONFIGURE_V27_2400 3
#define DSP_RECONFIGURE_V27_4800 4
#define DSP_RECONFIGURE_V29_7200 5
#define DSP_RECONFIGURE_V29_9600 6
#define DSP_RECONFIGURE_V33_12000 7
#define DSP_RECONFIGURE_V33_14400 8
#define DSP_RECONFIGURE_V17_7200 9
#define DSP_RECONFIGURE_V17_9600 10
#define DSP_RECONFIGURE_V17_12000 11
#define DSP_RECONFIGURE_V17_14400 12
/*
data indications if transparent framer
<byte> data 0
<byte> data 1
...
data indications if HDLC framer
<byte> data 0
<byte> data 1
...
<byte> CRC 0
<byte> CRC 1
<byte> preamble flags
*/
#define DSP_UDATA_INDICATION_SYNC 0
/*
returns:
<word> time of sync (sampled from counter at 8kHz)
*/
#define DSP_UDATA_INDICATION_DCD_OFF 1
/*
returns:
<word> time of DCD off (sampled from counter at 8kHz)
*/
#define DSP_UDATA_INDICATION_DCD_ON 2
/*
returns:
<word> time of DCD on (sampled from counter at 8kHz)
<byte> connected norm
<word> connected options
<dword> connected speed (bit/s)
*/
#define DSP_UDATA_INDICATION_CTS_OFF 3
/*
returns:
<word> time of CTS off (sampled from counter at 8kHz)
*/
#define DSP_UDATA_INDICATION_CTS_ON 4
/*
returns:
<word> time of CTS on (sampled from counter at 8kHz)
<byte> connected norm
<word> connected options
<dword> connected speed (bit/s)
*/
#define DSP_CONNECTED_NORM_UNSPECIFIED 0
#define DSP_CONNECTED_NORM_V21 1
#define DSP_CONNECTED_NORM_V23 2
#define DSP_CONNECTED_NORM_V22 3
#define DSP_CONNECTED_NORM_V22_BIS 4
#define DSP_CONNECTED_NORM_V32_BIS 5
#define DSP_CONNECTED_NORM_V34 6
#define DSP_CONNECTED_NORM_V8 7
#define DSP_CONNECTED_NORM_BELL_212A 8
#define DSP_CONNECTED_NORM_BELL_103 9
#define DSP_CONNECTED_NORM_V29_LEASED_LINE 10
#define DSP_CONNECTED_NORM_V33_LEASED_LINE 11
#define DSP_CONNECTED_NORM_TFAST 12
#define DSP_CONNECTED_NORM_V21_CH2 13
#define DSP_CONNECTED_NORM_V27_TER 14
#define DSP_CONNECTED_NORM_V29 15
#define DSP_CONNECTED_NORM_V33 16
#define DSP_CONNECTED_NORM_V17 17
#define DSP_CONNECTED_OPTION_TRELLIS 0x0001
/*---------------------------------------------------------------------------*/
extern char *dsp_read_file(OsFileHandle *fp,
word card_type_number,
word *p_dsp_download_count,
t_dsp_desc *p_dsp_download_table,
t_dsp_portable_desc *p_dsp_portable_download_table);
/*---------------------------------------------------------------------------*/
#endif /* DSP_DEFS_H_ */

View File

@ -1,48 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* $Id: dsp_tst.h,v 1.1.2.2 2001/02/08 12:25:43 armin Exp $ */
#ifndef __DIVA_PRI_HOST_TEST_DSPS_H__
#define __DIVA_PRI_HOST_TEST_DSPS_H__
/*
DSP registers on maestra pri
*/
#define DSP1_PORT (0x00)
#define DSP2_PORT (0x8)
#define DSP3_PORT (0x800)
#define DSP4_PORT (0x808)
#define DSP5_PORT (0x810)
#define DSP6_PORT (0x818)
#define DSP7_PORT (0x820)
#define DSP8_PORT (0x828)
#define DSP9_PORT (0x830)
#define DSP10_PORT (0x840)
#define DSP11_PORT (0x848)
#define DSP12_PORT (0x850)
#define DSP13_PORT (0x858)
#define DSP14_PORT (0x860)
#define DSP15_PORT (0x868)
#define DSP16_PORT (0x870)
#define DSP17_PORT (0x1000)
#define DSP18_PORT (0x1008)
#define DSP19_PORT (0x1010)
#define DSP20_PORT (0x1018)
#define DSP21_PORT (0x1020)
#define DSP22_PORT (0x1028)
#define DSP23_PORT (0x1030)
#define DSP24_PORT (0x1040)
#define DSP25_PORT (0x1048)
#define DSP26_PORT (0x1050)
#define DSP27_PORT (0x1058)
#define DSP28_PORT (0x1060)
#define DSP29_PORT (0x1068)
#define DSP30_PORT (0x1070)
#define DSP_ADR_OFFS 0x80
/*------------------------------------------------------------------
Dsp related definitions
------------------------------------------------------------------ */
#define DSP_SIGNATURE_PROBE_WORD 0x5a5a
#define dsp_make_address_ex(pm, address) ((word)((pm) ? (address) : (address) + 0x4000))
#endif

View File

@ -1,75 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef DSPDIDS_H_
#define DSPDIDS_H_
/*---------------------------------------------------------------------------*/
#define DSP_DID_INVALID 0
#define DSP_DID_DIVA 1
#define DSP_DID_DIVA_PRO 2
#define DSP_DID_DIVA_PRO_20 3
#define DSP_DID_DIVA_PRO_PCCARD 4
#define DSP_DID_DIVA_SERVER_BRI_1M 5
#define DSP_DID_DIVA_SERVER_BRI_2M 6
#define DSP_DID_DIVA_SERVER_PRI_2M_TX 7
#define DSP_DID_DIVA_SERVER_PRI_2M_RX 8
#define DSP_DID_DIVA_SERVER_PRI_30M 9
#define DSP_DID_TASK_HSCX 100
#define DSP_DID_TASK_HSCX_PRI_2M_TX 101
#define DSP_DID_TASK_HSCX_PRI_2M_RX 102
#define DSP_DID_TASK_V110KRNL 200
#define DSP_DID_OVERLAY_V1100 201
#define DSP_DID_OVERLAY_V1101 202
#define DSP_DID_OVERLAY_V1102 203
#define DSP_DID_OVERLAY_V1103 204
#define DSP_DID_OVERLAY_V1104 205
#define DSP_DID_OVERLAY_V1105 206
#define DSP_DID_OVERLAY_V1106 207
#define DSP_DID_OVERLAY_V1107 208
#define DSP_DID_OVERLAY_V1108 209
#define DSP_DID_OVERLAY_V1109 210
#define DSP_DID_TASK_V110_PRI_2M_TX 220
#define DSP_DID_TASK_V110_PRI_2M_RX 221
#define DSP_DID_TASK_MODEM 300
#define DSP_DID_TASK_FAX05 400
#define DSP_DID_TASK_VOICE 500
#define DSP_DID_TASK_TIKRNL81 600
#define DSP_DID_OVERLAY_DIAL 601
#define DSP_DID_OVERLAY_V22 602
#define DSP_DID_OVERLAY_V32 603
#define DSP_DID_OVERLAY_FSK 604
#define DSP_DID_OVERLAY_FAX 605
#define DSP_DID_OVERLAY_VXX 606
#define DSP_DID_OVERLAY_V8 607
#define DSP_DID_OVERLAY_INFO 608
#define DSP_DID_OVERLAY_V34 609
#define DSP_DID_OVERLAY_DFX 610
#define DSP_DID_PARTIAL_OVERLAY_DIAL 611
#define DSP_DID_PARTIAL_OVERLAY_FSK 612
#define DSP_DID_PARTIAL_OVERLAY_FAX 613
#define DSP_DID_TASK_TIKRNL05 700
/*---------------------------------------------------------------------------*/
#endif
/*---------------------------------------------------------------------------*/

View File

@ -1,40 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef __DIVA_XDI_DSRV_4_BRI_INC__
#define __DIVA_XDI_DSRV_4_BRI_INC__
/*
* Some special registers in the PLX 9054
*/
#define PLX9054_P2LDBELL 0x60
#define PLX9054_L2PDBELL 0x64
#define PLX9054_INTCSR 0x69
#define PLX9054_INT_ENABLE 0x09
#define PLX9054_SOFT_RESET 0x4000
#define PLX9054_RELOAD_EEPROM 0x2000
#define DIVA_4BRI_REVISION(__x__) (((__x__)->cardType == CARDTYPE_DIVASRV_Q_8M_V2_PCI) || ((__x__)->cardType == CARDTYPE_DIVASRV_VOICE_Q_8M_V2_PCI) || ((__x__)->cardType == CARDTYPE_DIVASRV_B_2M_V2_PCI) || ((__x__)->cardType == CARDTYPE_DIVASRV_B_2F_PCI) || ((__x__)->cardType == CARDTYPE_DIVASRV_VOICE_B_2M_V2_PCI))
void diva_os_set_qBri_functions(PISDN_ADAPTER IoAdapter);
void diva_os_set_qBri2_functions(PISDN_ADAPTER IoAdapter);
#endif

View File

@ -1,37 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef __DIVA_XDI_DSRV_BRI_INC__
#define __DIVA_XDI_DSRV_BRI_INC__
/*
Functions exported from os dependent part of
BRI card configuration and used in
OS independed part
*/
/*
Prepare OS dependent part of BRI functions
*/
void diva_os_prepare_maestra_functions(PISDN_ADAPTER IoAdapter);
#endif

View File

@ -1,38 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef __DIVA_XDI_DSRV_PRI_INC__
#define __DIVA_XDI_DSRV_PRI_INC__
/*
Functions exported from os dependent part of
PRI card configuration and used in
OS independed part
*/
/*
Prepare OS dependent part of PRI/PRI Rev.2 functions
*/
void diva_os_prepare_pri_functions(PISDN_ADAPTER IoAdapter);
void diva_os_prepare_pri2_functions(PISDN_ADAPTER IoAdapter);
#endif

View File

@ -1,29 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* $Id: entity.h,v 1.4 2004/03/21 17:26:01 armin Exp $ */
#ifndef __DIVAS_USER_MODE_IDI_ENTITY__
#define __DIVAS_USER_MODE_IDI_ENTITY__
#define DIVA_UM_IDI_RC_PENDING 0x00000001
#define DIVA_UM_IDI_REMOVE_PENDING 0x00000002
#define DIVA_UM_IDI_TX_FLOW_CONTROL 0x00000004
#define DIVA_UM_IDI_REMOVED 0x00000008
#define DIVA_UM_IDI_ASSIGN_PENDING 0x00000010
typedef struct _divas_um_idi_entity {
struct list_head link;
diva_um_idi_adapter_t *adapter; /* Back to adapter */
ENTITY e;
void *os_ref;
dword status;
void *os_context;
int rc_count;
diva_um_idi_data_queue_t data; /* definad by user 1 ... MAX */
diva_um_idi_data_queue_t rc; /* two entries */
BUFFERS XData;
BUFFERS RData;
byte buffer[2048 + 512];
} divas_um_idi_entity_t;
#endif

View File

@ -1,51 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef __DIVA_XDI_CARD_CONFIG_HELPERS_INC__
#define __DIVA_XDI_CARD_CONFIG_HELPERS_INC__
dword diva_get_protocol_file_features(byte *File,
int offset,
char *IdStringBuffer,
dword IdBufferSize);
void diva_configure_protocol(PISDN_ADAPTER IoAdapter);
/*
Low level file access system abstraction
*/
/* -------------------------------------------------------------------------
Access to single file
Return pointer to the image of the requested file,
write image length to 'FileLength'
------------------------------------------------------------------------- */
void *xdiLoadFile(char *FileName, dword *FileLength, unsigned long MaxLoadSize);
/* -------------------------------------------------------------------------
Dependent on the protocol settings does read return pointer
to the image of appropriate protocol file
------------------------------------------------------------------------- */
void *xdiLoadArchive(PISDN_ADAPTER IoAdapter, dword *FileLength, unsigned long MaxLoadSize);
/* --------------------------------------------------------------------------
Free all system resources accessed by xdiLoadFile and xdiLoadArchive
-------------------------------------------------------------------------- */
void xdiFreeFile(void *handle);
#endif

View File

@ -1,268 +0,0 @@
/* $Id: idifunc.c,v 1.14.4.4 2004/08/28 20:03:53 armin Exp $
*
* Driver for Eicon DIVA Server ISDN cards.
* User Mode IDI Interface
*
* Copyright 2000-2003 by Armin Schindler (mac@melware.de)
* Copyright 2000-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*/
#include "platform.h"
#include "di_defs.h"
#include "divasync.h"
#include "um_xdi.h"
#include "um_idi.h"
#define DBG_MINIMUM (DL_LOG + DL_FTL + DL_ERR)
#define DBG_DEFAULT (DBG_MINIMUM + DL_XLOG + DL_REG)
extern char *DRIVERRELEASE_IDI;
extern void DIVA_DIDD_Read(void *, int);
extern int diva_user_mode_idi_create_adapter(const DESCRIPTOR *, int);
extern void diva_user_mode_idi_remove_adapter(int);
static dword notify_handle;
static DESCRIPTOR DAdapter;
static DESCRIPTOR MAdapter;
static void no_printf(unsigned char *x, ...)
{
/* dummy debug function */
}
#include "debuglib.c"
/*
* stop debug
*/
static void stop_dbg(void)
{
DbgDeregister();
memset(&MAdapter, 0, sizeof(MAdapter));
dprintf = no_printf;
}
typedef struct _udiva_card {
struct list_head list;
int Id;
DESCRIPTOR d;
} udiva_card;
static LIST_HEAD(cards);
static diva_os_spin_lock_t ll_lock;
/*
* find card in list
*/
static udiva_card *find_card_in_list(DESCRIPTOR *d)
{
udiva_card *card;
struct list_head *tmp;
diva_os_spin_lock_magic_t old_irql;
diva_os_enter_spin_lock(&ll_lock, &old_irql, "find card");
list_for_each(tmp, &cards) {
card = list_entry(tmp, udiva_card, list);
if (card->d.request == d->request) {
diva_os_leave_spin_lock(&ll_lock, &old_irql,
"find card");
return (card);
}
}
diva_os_leave_spin_lock(&ll_lock, &old_irql, "find card");
return ((udiva_card *) NULL);
}
/*
* new card
*/
static void um_new_card(DESCRIPTOR *d)
{
int adapter_nr = 0;
udiva_card *card = NULL;
IDI_SYNC_REQ sync_req;
diva_os_spin_lock_magic_t old_irql;
if (!(card = diva_os_malloc(0, sizeof(udiva_card)))) {
DBG_ERR(("cannot get buffer for card"));
return;
}
memcpy(&card->d, d, sizeof(DESCRIPTOR));
sync_req.xdi_logical_adapter_number.Req = 0;
sync_req.xdi_logical_adapter_number.Rc =
IDI_SYNC_REQ_XDI_GET_LOGICAL_ADAPTER_NUMBER;
card->d.request((ENTITY *)&sync_req);
adapter_nr =
sync_req.xdi_logical_adapter_number.info.logical_adapter_number;
card->Id = adapter_nr;
if (!(diva_user_mode_idi_create_adapter(d, adapter_nr))) {
diva_os_enter_spin_lock(&ll_lock, &old_irql, "add card");
list_add_tail(&card->list, &cards);
diva_os_leave_spin_lock(&ll_lock, &old_irql, "add card");
} else {
DBG_ERR(("could not create user mode idi card %d",
adapter_nr));
diva_os_free(0, card);
}
}
/*
* remove card
*/
static void um_remove_card(DESCRIPTOR *d)
{
diva_os_spin_lock_magic_t old_irql;
udiva_card *card = NULL;
if (!(card = find_card_in_list(d))) {
DBG_ERR(("cannot find card to remove"));
return;
}
diva_user_mode_idi_remove_adapter(card->Id);
diva_os_enter_spin_lock(&ll_lock, &old_irql, "remove card");
list_del(&card->list);
diva_os_leave_spin_lock(&ll_lock, &old_irql, "remove card");
DBG_LOG(("idi proc entry removed for card %d", card->Id));
diva_os_free(0, card);
}
/*
* remove all adapter
*/
static void __exit remove_all_idi_proc(void)
{
udiva_card *card;
diva_os_spin_lock_magic_t old_irql;
rescan:
diva_os_enter_spin_lock(&ll_lock, &old_irql, "remove all");
if (!list_empty(&cards)) {
card = list_entry(cards.next, udiva_card, list);
list_del(&card->list);
diva_os_leave_spin_lock(&ll_lock, &old_irql, "remove all");
diva_user_mode_idi_remove_adapter(card->Id);
diva_os_free(0, card);
goto rescan;
}
diva_os_leave_spin_lock(&ll_lock, &old_irql, "remove all");
}
/*
* DIDD notify callback
*/
static void *didd_callback(void *context, DESCRIPTOR *adapter,
int removal)
{
if (adapter->type == IDI_DADAPTER) {
DBG_ERR(("Notification about IDI_DADAPTER change ! Oops."));
return (NULL);
} else if (adapter->type == IDI_DIMAINT) {
if (removal) {
stop_dbg();
} else {
memcpy(&MAdapter, adapter, sizeof(MAdapter));
dprintf = (DIVA_DI_PRINTF) MAdapter.request;
DbgRegister("User IDI", DRIVERRELEASE_IDI, DBG_DEFAULT);
}
} else if ((adapter->type > 0) && (adapter->type < 16)) { /* IDI Adapter */
if (removal) {
um_remove_card(adapter);
} else {
um_new_card(adapter);
}
}
return (NULL);
}
/*
* connect DIDD
*/
static int __init connect_didd(void)
{
int x = 0;
int dadapter = 0;
IDI_SYNC_REQ req;
DESCRIPTOR DIDD_Table[MAX_DESCRIPTORS];
DIVA_DIDD_Read(DIDD_Table, sizeof(DIDD_Table));
for (x = 0; x < MAX_DESCRIPTORS; x++) {
if (DIDD_Table[x].type == IDI_DADAPTER) { /* DADAPTER found */
dadapter = 1;
memcpy(&DAdapter, &DIDD_Table[x], sizeof(DAdapter));
req.didd_notify.e.Req = 0;
req.didd_notify.e.Rc =
IDI_SYNC_REQ_DIDD_REGISTER_ADAPTER_NOTIFY;
req.didd_notify.info.callback = (void *)didd_callback;
req.didd_notify.info.context = NULL;
DAdapter.request((ENTITY *)&req);
if (req.didd_notify.e.Rc != 0xff) {
stop_dbg();
return (0);
}
notify_handle = req.didd_notify.info.handle;
} else if (DIDD_Table[x].type == IDI_DIMAINT) { /* MAINT found */
memcpy(&MAdapter, &DIDD_Table[x], sizeof(DAdapter));
dprintf = (DIVA_DI_PRINTF) MAdapter.request;
DbgRegister("User IDI", DRIVERRELEASE_IDI, DBG_DEFAULT);
} else if ((DIDD_Table[x].type > 0)
&& (DIDD_Table[x].type < 16)) { /* IDI Adapter found */
um_new_card(&DIDD_Table[x]);
}
}
if (!dadapter) {
stop_dbg();
}
return (dadapter);
}
/*
* Disconnect from DIDD
*/
static void __exit disconnect_didd(void)
{
IDI_SYNC_REQ req;
stop_dbg();
req.didd_notify.e.Req = 0;
req.didd_notify.e.Rc = IDI_SYNC_REQ_DIDD_REMOVE_ADAPTER_NOTIFY;
req.didd_notify.info.handle = notify_handle;
DAdapter.request((ENTITY *)&req);
}
/*
* init
*/
int __init idifunc_init(void)
{
diva_os_initialize_spin_lock(&ll_lock, "idifunc");
if (diva_user_mode_idi_init()) {
DBG_ERR(("init: init failed."));
return (0);
}
if (!connect_didd()) {
diva_user_mode_idi_finit();
DBG_ERR(("init: failed to connect to DIDD."));
return (0);
}
return (1);
}
/*
* finit
*/
void __exit idifunc_finit(void)
{
diva_user_mode_idi_finit();
disconnect_didd();
remove_all_idi_proc();
}

View File

@ -1,852 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include "platform.h"
#include "di_defs.h"
#include "pc.h"
#include "pr_pc.h"
#include "divasync.h"
#define MIPS_SCOM
#include "pkmaint.h" /* pc_main.h, packed in os-dependent fashion */
#include "di.h"
#include "mi_pc.h"
#include "io.h"
extern ADAPTER *adapter[MAX_ADAPTER];
extern PISDN_ADAPTER IoAdapters[MAX_ADAPTER];
void request(PISDN_ADAPTER, ENTITY *);
static void pcm_req(PISDN_ADAPTER, ENTITY *);
/* --------------------------------------------------------------------------
local functions
-------------------------------------------------------------------------- */
#define ReqFunc(N) \
static void Request##N(ENTITY *e) \
{ if (IoAdapters[N]) (*IoAdapters[N]->DIRequest)(IoAdapters[N], e); }
ReqFunc(0)
ReqFunc(1)
ReqFunc(2)
ReqFunc(3)
ReqFunc(4)
ReqFunc(5)
ReqFunc(6)
ReqFunc(7)
ReqFunc(8)
ReqFunc(9)
ReqFunc(10)
ReqFunc(11)
ReqFunc(12)
ReqFunc(13)
ReqFunc(14)
ReqFunc(15)
IDI_CALL Requests[MAX_ADAPTER] =
{ &Request0, &Request1, &Request2, &Request3,
&Request4, &Request5, &Request6, &Request7,
&Request8, &Request9, &Request10, &Request11,
&Request12, &Request13, &Request14, &Request15
};
/*****************************************************************************/
/*
This array should indicate all new services, that this version of XDI
is able to provide to his clients
*/
static byte extended_xdi_features[DIVA_XDI_EXTENDED_FEATURES_MAX_SZ + 1] = {
(DIVA_XDI_EXTENDED_FEATURES_VALID |
DIVA_XDI_EXTENDED_FEATURE_SDRAM_BAR |
DIVA_XDI_EXTENDED_FEATURE_CAPI_PRMS |
#if defined(DIVA_IDI_RX_DMA)
DIVA_XDI_EXTENDED_FEATURE_CMA |
DIVA_XDI_EXTENDED_FEATURE_RX_DMA |
DIVA_XDI_EXTENDED_FEATURE_MANAGEMENT_DMA |
#endif
DIVA_XDI_EXTENDED_FEATURE_NO_CANCEL_RC),
0
};
/*****************************************************************************/
void
dump_xlog_buffer(PISDN_ADAPTER IoAdapter, Xdesc *xlogDesc)
{
dword logLen;
word *Xlog = xlogDesc->buf;
word logCnt = xlogDesc->cnt;
word logOut = xlogDesc->out / sizeof(*Xlog);
DBG_FTL(("%s: ************* XLOG recovery (%d) *************",
&IoAdapter->Name[0], (int)logCnt))
DBG_FTL(("Microcode: %s", &IoAdapter->ProtocolIdString[0]))
for (; logCnt > 0; --logCnt)
{
if (!GET_WORD(&Xlog[logOut]))
{
if (--logCnt == 0)
break;
logOut = 0;
}
if (GET_WORD(&Xlog[logOut]) <= (logOut * sizeof(*Xlog)))
{
if (logCnt > 2)
{
DBG_FTL(("Possibly corrupted XLOG: %d entries left",
(int)logCnt))
}
break;
}
logLen = (dword)(GET_WORD(&Xlog[logOut]) - (logOut * sizeof(*Xlog)));
DBG_FTL_MXLOG(((char *)&Xlog[logOut + 1], (dword)(logLen - 2)))
logOut = (GET_WORD(&Xlog[logOut]) + 1) / sizeof(*Xlog);
}
DBG_FTL(("%s: ***************** end of XLOG *****************",
&IoAdapter->Name[0]))
}
/*****************************************************************************/
#if defined(XDI_USE_XLOG)
static char *(ExceptionCauseTable[]) =
{
"Interrupt",
"TLB mod /IBOUND",
"TLB load /DBOUND",
"TLB store",
"Address error load",
"Address error store",
"Instruction load bus error",
"Data load/store bus error",
"Syscall",
"Breakpoint",
"Reverd instruction",
"Coprocessor unusable",
"Overflow",
"TRAP",
"VCEI",
"Floating Point Exception",
"CP2",
"Reserved 17",
"Reserved 18",
"Reserved 19",
"Reserved 20",
"Reserved 21",
"Reserved 22",
"WATCH",
"Reserved 24",
"Reserved 25",
"Reserved 26",
"Reserved 27",
"Reserved 28",
"Reserved 29",
"Reserved 30",
"VCED"
};
#endif
void
dump_trap_frame(PISDN_ADAPTER IoAdapter, byte __iomem *exceptionFrame)
{
MP_XCPTC __iomem *xcept = (MP_XCPTC __iomem *)exceptionFrame;
dword __iomem *regs;
regs = &xcept->regs[0];
DBG_FTL(("%s: ***************** CPU TRAPPED *****************",
&IoAdapter->Name[0]))
DBG_FTL(("Microcode: %s", &IoAdapter->ProtocolIdString[0]))
DBG_FTL(("Cause: %s",
ExceptionCauseTable[(READ_DWORD(&xcept->cr) & 0x0000007c) >> 2]))
DBG_FTL(("sr 0x%08x cr 0x%08x epc 0x%08x vaddr 0x%08x",
READ_DWORD(&xcept->sr), READ_DWORD(&xcept->cr),
READ_DWORD(&xcept->epc), READ_DWORD(&xcept->vaddr)))
DBG_FTL(("zero 0x%08x at 0x%08x v0 0x%08x v1 0x%08x",
READ_DWORD(&regs[0]), READ_DWORD(&regs[1]),
READ_DWORD(&regs[2]), READ_DWORD(&regs[3])))
DBG_FTL(("a0 0x%08x a1 0x%08x a2 0x%08x a3 0x%08x",
READ_DWORD(&regs[4]), READ_DWORD(&regs[5]),
READ_DWORD(&regs[6]), READ_DWORD(&regs[7])))
DBG_FTL(("t0 0x%08x t1 0x%08x t2 0x%08x t3 0x%08x",
READ_DWORD(&regs[8]), READ_DWORD(&regs[9]),
READ_DWORD(&regs[10]), READ_DWORD(&regs[11])))
DBG_FTL(("t4 0x%08x t5 0x%08x t6 0x%08x t7 0x%08x",
READ_DWORD(&regs[12]), READ_DWORD(&regs[13]),
READ_DWORD(&regs[14]), READ_DWORD(&regs[15])))
DBG_FTL(("s0 0x%08x s1 0x%08x s2 0x%08x s3 0x%08x",
READ_DWORD(&regs[16]), READ_DWORD(&regs[17]),
READ_DWORD(&regs[18]), READ_DWORD(&regs[19])))
DBG_FTL(("s4 0x%08x s5 0x%08x s6 0x%08x s7 0x%08x",
READ_DWORD(&regs[20]), READ_DWORD(&regs[21]),
READ_DWORD(&regs[22]), READ_DWORD(&regs[23])))
DBG_FTL(("t8 0x%08x t9 0x%08x k0 0x%08x k1 0x%08x",
READ_DWORD(&regs[24]), READ_DWORD(&regs[25]),
READ_DWORD(&regs[26]), READ_DWORD(&regs[27])))
DBG_FTL(("gp 0x%08x sp 0x%08x s8 0x%08x ra 0x%08x",
READ_DWORD(&regs[28]), READ_DWORD(&regs[29]),
READ_DWORD(&regs[30]), READ_DWORD(&regs[31])))
DBG_FTL(("md 0x%08x|%08x resvd 0x%08x class 0x%08x",
READ_DWORD(&xcept->mdhi), READ_DWORD(&xcept->mdlo),
READ_DWORD(&xcept->reseverd), READ_DWORD(&xcept->xclass)))
}
/* --------------------------------------------------------------------------
Real XDI Request function
-------------------------------------------------------------------------- */
void request(PISDN_ADAPTER IoAdapter, ENTITY *e)
{
byte i;
diva_os_spin_lock_magic_t irql;
/*
* if the Req field in the entity structure is 0,
* we treat this request as a special function call
*/
if (!e->Req)
{
IDI_SYNC_REQ *syncReq = (IDI_SYNC_REQ *)e;
switch (e->Rc)
{
#if defined(DIVA_IDI_RX_DMA)
case IDI_SYNC_REQ_DMA_DESCRIPTOR_OPERATION: {
diva_xdi_dma_descriptor_operation_t *pI = \
&syncReq->xdi_dma_descriptor_operation.info;
if (!IoAdapter->dma_map) {
pI->operation = -1;
pI->descriptor_number = -1;
return;
}
diva_os_enter_spin_lock(&IoAdapter->data_spin_lock, &irql, "dma_op");
if (pI->operation == IDI_SYNC_REQ_DMA_DESCRIPTOR_ALLOC) {
pI->descriptor_number = diva_alloc_dma_map_entry(\
(struct _diva_dma_map_entry *)IoAdapter->dma_map);
if (pI->descriptor_number >= 0) {
dword dma_magic;
void *local_addr;
diva_get_dma_map_entry(\
(struct _diva_dma_map_entry *)IoAdapter->dma_map,
pI->descriptor_number,
&local_addr, &dma_magic);
pI->descriptor_address = local_addr;
pI->descriptor_magic = dma_magic;
pI->operation = 0;
} else {
pI->operation = -1;
}
} else if ((pI->operation == IDI_SYNC_REQ_DMA_DESCRIPTOR_FREE) &&
(pI->descriptor_number >= 0)) {
diva_free_dma_map_entry((struct _diva_dma_map_entry *)IoAdapter->dma_map,
pI->descriptor_number);
pI->descriptor_number = -1;
pI->operation = 0;
} else {
pI->descriptor_number = -1;
pI->operation = -1;
}
diva_os_leave_spin_lock(&IoAdapter->data_spin_lock, &irql, "dma_op");
} return;
#endif
case IDI_SYNC_REQ_XDI_GET_LOGICAL_ADAPTER_NUMBER: {
diva_xdi_get_logical_adapter_number_s_t *pI = \
&syncReq->xdi_logical_adapter_number.info;
pI->logical_adapter_number = IoAdapter->ANum;
pI->controller = IoAdapter->ControllerNumber;
pI->total_controllers = IoAdapter->Properties.Adapters;
} return;
case IDI_SYNC_REQ_XDI_GET_CAPI_PARAMS: {
diva_xdi_get_capi_parameters_t prms, *pI = &syncReq->xdi_capi_prms.info;
memset(&prms, 0x00, sizeof(prms));
prms.structure_length = min_t(size_t, sizeof(prms), pI->structure_length);
memset(pI, 0x00, pI->structure_length);
prms.flag_dynamic_l1_down = (IoAdapter->capi_cfg.cfg_1 & \
DIVA_XDI_CAPI_CFG_1_DYNAMIC_L1_ON) ? 1 : 0;
prms.group_optimization_enabled = (IoAdapter->capi_cfg.cfg_1 & \
DIVA_XDI_CAPI_CFG_1_GROUP_POPTIMIZATION_ON) ? 1 : 0;
memcpy(pI, &prms, prms.structure_length);
} return;
case IDI_SYNC_REQ_XDI_GET_ADAPTER_SDRAM_BAR:
syncReq->xdi_sdram_bar.info.bar = IoAdapter->sdram_bar;
return;
case IDI_SYNC_REQ_XDI_GET_EXTENDED_FEATURES: {
dword i;
diva_xdi_get_extended_xdi_features_t *pI =\
&syncReq->xdi_extended_features.info;
pI->buffer_length_in_bytes &= ~0x80000000;
if (pI->buffer_length_in_bytes && pI->features) {
memset(pI->features, 0x00, pI->buffer_length_in_bytes);
}
for (i = 0; ((pI->features) && (i < pI->buffer_length_in_bytes) &&
(i < DIVA_XDI_EXTENDED_FEATURES_MAX_SZ)); i++) {
pI->features[i] = extended_xdi_features[i];
}
if ((pI->buffer_length_in_bytes < DIVA_XDI_EXTENDED_FEATURES_MAX_SZ) ||
(!pI->features)) {
pI->buffer_length_in_bytes =\
(0x80000000 | DIVA_XDI_EXTENDED_FEATURES_MAX_SZ);
}
} return;
case IDI_SYNC_REQ_XDI_GET_STREAM:
if (IoAdapter) {
diva_xdi_provide_istream_info(&IoAdapter->a,
&syncReq->xdi_stream_info.info);
} else {
syncReq->xdi_stream_info.info.provided_service = 0;
}
return;
case IDI_SYNC_REQ_GET_NAME:
if (IoAdapter)
{
strcpy(&syncReq->GetName.name[0], IoAdapter->Name);
DBG_TRC(("xdi: Adapter %d / Name '%s'",
IoAdapter->ANum, IoAdapter->Name))
return;
}
syncReq->GetName.name[0] = '\0';
break;
case IDI_SYNC_REQ_GET_SERIAL:
if (IoAdapter)
{
syncReq->GetSerial.serial = IoAdapter->serialNo;
DBG_TRC(("xdi: Adapter %d / SerialNo %ld",
IoAdapter->ANum, IoAdapter->serialNo))
return;
}
syncReq->GetSerial.serial = 0;
break;
case IDI_SYNC_REQ_GET_CARDTYPE:
if (IoAdapter)
{
syncReq->GetCardType.cardtype = IoAdapter->cardType;
DBG_TRC(("xdi: Adapter %d / CardType %ld",
IoAdapter->ANum, IoAdapter->cardType))
return;
}
syncReq->GetCardType.cardtype = 0;
break;
case IDI_SYNC_REQ_GET_XLOG:
if (IoAdapter)
{
pcm_req(IoAdapter, e);
return;
}
e->Ind = 0;
break;
case IDI_SYNC_REQ_GET_DBG_XLOG:
if (IoAdapter)
{
pcm_req(IoAdapter, e);
return;
}
e->Ind = 0;
break;
case IDI_SYNC_REQ_GET_FEATURES:
if (IoAdapter)
{
syncReq->GetFeatures.features =
(unsigned short)IoAdapter->features;
return;
}
syncReq->GetFeatures.features = 0;
break;
case IDI_SYNC_REQ_PORTDRV_HOOK:
if (IoAdapter)
{
DBG_TRC(("Xdi:IDI_SYNC_REQ_PORTDRV_HOOK - ignored"))
return;
}
break;
}
if (IoAdapter)
{
return;
}
}
DBG_TRC(("xdi: Id 0x%x / Req 0x%x / Rc 0x%x", e->Id, e->Req, e->Rc))
if (!IoAdapter)
{
DBG_FTL(("xdi: uninitialized Adapter used - ignore request"))
return;
}
diva_os_enter_spin_lock(&IoAdapter->data_spin_lock, &irql, "data_req");
/*
* assign an entity
*/
if (!(e->Id & 0x1f))
{
if (IoAdapter->e_count >= IoAdapter->e_max)
{
DBG_FTL(("xdi: all Ids in use (max=%d) --> Req ignored",
IoAdapter->e_max))
diva_os_leave_spin_lock(&IoAdapter->data_spin_lock, &irql, "data_req");
return;
}
/*
* find a new free id
*/
for (i = 1; IoAdapter->e_tbl[i].e; ++i);
IoAdapter->e_tbl[i].e = e;
IoAdapter->e_count++;
e->No = (byte)i;
e->More = 0;
e->RCurrent = 0xff;
}
else
{
i = e->No;
}
/*
* if the entity is still busy, ignore the request call
*/
if (e->More & XBUSY)
{
DBG_FTL(("xdi: Id 0x%x busy --> Req 0x%x ignored", e->Id, e->Req))
if (!IoAdapter->trapped && IoAdapter->trapFnc)
{
IoAdapter->trapFnc(IoAdapter);
/*
Firs trap, also notify user if supported
*/
if (IoAdapter->trapped && IoAdapter->os_trap_nfy_Fnc) {
(*(IoAdapter->os_trap_nfy_Fnc))(IoAdapter, IoAdapter->ANum);
}
}
diva_os_leave_spin_lock(&IoAdapter->data_spin_lock, &irql, "data_req");
return;
}
/*
* initialize transmit status variables
*/
e->More |= XBUSY;
e->More &= ~XMOREF;
e->XCurrent = 0;
e->XOffset = 0;
/*
* queue this entity in the adapter request queue
*/
IoAdapter->e_tbl[i].next = 0;
if (IoAdapter->head)
{
IoAdapter->e_tbl[IoAdapter->tail].next = i;
IoAdapter->tail = i;
}
else
{
IoAdapter->head = i;
IoAdapter->tail = i;
}
/*
* queue the DPC to process the request
*/
diva_os_schedule_soft_isr(&IoAdapter->req_soft_isr);
diva_os_leave_spin_lock(&IoAdapter->data_spin_lock, &irql, "data_req");
}
/* ---------------------------------------------------------------------
Main DPC routine
--------------------------------------------------------------------- */
void DIDpcRoutine(struct _diva_os_soft_isr *psoft_isr, void *Context) {
PISDN_ADAPTER IoAdapter = (PISDN_ADAPTER)Context;
ADAPTER *a = &IoAdapter->a;
diva_os_atomic_t *pin_dpc = &IoAdapter->in_dpc;
if (diva_os_atomic_increment(pin_dpc) == 1) {
do {
if (IoAdapter->tst_irq(a))
{
if (!IoAdapter->Unavailable)
IoAdapter->dpc(a);
IoAdapter->clr_irq(a);
}
IoAdapter->out(a);
} while (diva_os_atomic_decrement(pin_dpc) > 0);
/* ----------------------------------------------------------------
Look for XLOG request (cards with indirect addressing)
---------------------------------------------------------------- */
if (IoAdapter->pcm_pending) {
struct pc_maint *pcm;
diva_os_spin_lock_magic_t OldIrql;
diva_os_enter_spin_lock(&IoAdapter->data_spin_lock,
&OldIrql,
"data_dpc");
pcm = (struct pc_maint *)IoAdapter->pcm_data;
switch (IoAdapter->pcm_pending) {
case 1: /* ask card for XLOG */
a->ram_out(a, &IoAdapter->pcm->rc, 0);
a->ram_out(a, &IoAdapter->pcm->req, pcm->req);
IoAdapter->pcm_pending = 2;
break;
case 2: /* Try to get XLOG from the card */
if ((int)(a->ram_in(a, &IoAdapter->pcm->rc))) {
a->ram_in_buffer(a, IoAdapter->pcm, pcm, sizeof(*pcm));
IoAdapter->pcm_pending = 3;
}
break;
case 3: /* let XDI recovery XLOG */
break;
}
diva_os_leave_spin_lock(&IoAdapter->data_spin_lock,
&OldIrql,
"data_dpc");
}
/* ---------------------------------------------------------------- */
}
}
/* --------------------------------------------------------------------------
XLOG interface
-------------------------------------------------------------------------- */
static void
pcm_req(PISDN_ADAPTER IoAdapter, ENTITY *e)
{
diva_os_spin_lock_magic_t OldIrql;
int i, rc;
ADAPTER *a = &IoAdapter->a;
struct pc_maint *pcm = (struct pc_maint *)&e->Ind;
/*
* special handling of I/O based card interface
* the memory access isn't an atomic operation !
*/
if (IoAdapter->Properties.Card == CARD_MAE)
{
diva_os_enter_spin_lock(&IoAdapter->data_spin_lock,
&OldIrql,
"data_pcm_1");
IoAdapter->pcm_data = (void *)pcm;
IoAdapter->pcm_pending = 1;
diva_os_schedule_soft_isr(&IoAdapter->req_soft_isr);
diva_os_leave_spin_lock(&IoAdapter->data_spin_lock,
&OldIrql,
"data_pcm_1");
for (rc = 0, i = (IoAdapter->trapped ? 3000 : 250); !rc && (i > 0); --i)
{
diva_os_sleep(1);
if (IoAdapter->pcm_pending == 3) {
diva_os_enter_spin_lock(&IoAdapter->data_spin_lock,
&OldIrql,
"data_pcm_3");
IoAdapter->pcm_pending = 0;
IoAdapter->pcm_data = NULL;
diva_os_leave_spin_lock(&IoAdapter->data_spin_lock,
&OldIrql,
"data_pcm_3");
return;
}
diva_os_enter_spin_lock(&IoAdapter->data_spin_lock,
&OldIrql,
"data_pcm_2");
diva_os_schedule_soft_isr(&IoAdapter->req_soft_isr);
diva_os_leave_spin_lock(&IoAdapter->data_spin_lock,
&OldIrql,
"data_pcm_2");
}
diva_os_enter_spin_lock(&IoAdapter->data_spin_lock,
&OldIrql,
"data_pcm_4");
IoAdapter->pcm_pending = 0;
IoAdapter->pcm_data = NULL;
diva_os_leave_spin_lock(&IoAdapter->data_spin_lock,
&OldIrql,
"data_pcm_4");
goto Trapped;
}
/*
* memory based shared ram is accessible from different
* processors without disturbing concurrent processes.
*/
a->ram_out(a, &IoAdapter->pcm->rc, 0);
a->ram_out(a, &IoAdapter->pcm->req, pcm->req);
for (i = (IoAdapter->trapped ? 3000 : 250); --i > 0;)
{
diva_os_sleep(1);
rc = (int)(a->ram_in(a, &IoAdapter->pcm->rc));
if (rc)
{
a->ram_in_buffer(a, IoAdapter->pcm, pcm, sizeof(*pcm));
return;
}
}
Trapped:
if (IoAdapter->trapFnc)
{
int trapped = IoAdapter->trapped;
IoAdapter->trapFnc(IoAdapter);
/*
Firs trap, also notify user if supported
*/
if (!trapped && IoAdapter->trapped && IoAdapter->os_trap_nfy_Fnc) {
(*(IoAdapter->os_trap_nfy_Fnc))(IoAdapter, IoAdapter->ANum);
}
}
}
/*------------------------------------------------------------------*/
/* ram access functions for memory mapped cards */
/*------------------------------------------------------------------*/
byte mem_in(ADAPTER *a, void *addr)
{
byte val;
volatile byte __iomem *Base = DIVA_OS_MEM_ATTACH_RAM((PISDN_ADAPTER)a->io);
val = READ_BYTE(Base + (unsigned long)addr);
DIVA_OS_MEM_DETACH_RAM((PISDN_ADAPTER)a->io, Base);
return (val);
}
word mem_inw(ADAPTER *a, void *addr)
{
word val;
volatile byte __iomem *Base = DIVA_OS_MEM_ATTACH_RAM((PISDN_ADAPTER)a->io);
val = READ_WORD((Base + (unsigned long)addr));
DIVA_OS_MEM_DETACH_RAM((PISDN_ADAPTER)a->io, Base);
return (val);
}
void mem_in_dw(ADAPTER *a, void *addr, dword *data, int dwords)
{
volatile byte __iomem *Base = DIVA_OS_MEM_ATTACH_RAM((PISDN_ADAPTER)a->io);
while (dwords--) {
*data++ = READ_DWORD((Base + (unsigned long)addr));
addr += 4;
}
DIVA_OS_MEM_DETACH_RAM((PISDN_ADAPTER)a->io, Base);
}
void mem_in_buffer(ADAPTER *a, void *addr, void *buffer, word length)
{
volatile byte __iomem *Base = DIVA_OS_MEM_ATTACH_RAM((PISDN_ADAPTER)a->io);
memcpy_fromio(buffer, (Base + (unsigned long)addr), length);
DIVA_OS_MEM_DETACH_RAM((PISDN_ADAPTER)a->io, Base);
}
void mem_look_ahead(ADAPTER *a, PBUFFER *RBuffer, ENTITY *e)
{
PISDN_ADAPTER IoAdapter = (PISDN_ADAPTER)a->io;
IoAdapter->RBuffer.length = mem_inw(a, &RBuffer->length);
mem_in_buffer(a, RBuffer->P, IoAdapter->RBuffer.P,
IoAdapter->RBuffer.length);
e->RBuffer = (DBUFFER *)&IoAdapter->RBuffer;
}
void mem_out(ADAPTER *a, void *addr, byte data)
{
volatile byte __iomem *Base = DIVA_OS_MEM_ATTACH_RAM((PISDN_ADAPTER)a->io);
WRITE_BYTE(Base + (unsigned long)addr, data);
DIVA_OS_MEM_DETACH_RAM((PISDN_ADAPTER)a->io, Base);
}
void mem_outw(ADAPTER *a, void *addr, word data)
{
volatile byte __iomem *Base = DIVA_OS_MEM_ATTACH_RAM((PISDN_ADAPTER)a->io);
WRITE_WORD((Base + (unsigned long)addr), data);
DIVA_OS_MEM_DETACH_RAM((PISDN_ADAPTER)a->io, Base);
}
void mem_out_dw(ADAPTER *a, void *addr, const dword *data, int dwords)
{
volatile byte __iomem *Base = DIVA_OS_MEM_ATTACH_RAM((PISDN_ADAPTER)a->io);
while (dwords--) {
WRITE_DWORD((Base + (unsigned long)addr), *data);
addr += 4;
data++;
}
DIVA_OS_MEM_DETACH_RAM((PISDN_ADAPTER)a->io, Base);
}
void mem_out_buffer(ADAPTER *a, void *addr, void *buffer, word length)
{
volatile byte __iomem *Base = DIVA_OS_MEM_ATTACH_RAM((PISDN_ADAPTER)a->io);
memcpy_toio((Base + (unsigned long)addr), buffer, length);
DIVA_OS_MEM_DETACH_RAM((PISDN_ADAPTER)a->io, Base);
}
void mem_inc(ADAPTER *a, void *addr)
{
volatile byte __iomem *Base = DIVA_OS_MEM_ATTACH_RAM((PISDN_ADAPTER)a->io);
byte x = READ_BYTE(Base + (unsigned long)addr);
WRITE_BYTE(Base + (unsigned long)addr, x + 1);
DIVA_OS_MEM_DETACH_RAM((PISDN_ADAPTER)a->io, Base);
}
/*------------------------------------------------------------------*/
/* ram access functions for io-mapped cards */
/*------------------------------------------------------------------*/
byte io_in(ADAPTER *a, void *adr)
{
byte val;
byte __iomem *Port = DIVA_OS_MEM_ATTACH_PORT((PISDN_ADAPTER)a->io);
outppw(Port + 4, (word)(unsigned long)adr);
val = inpp(Port);
DIVA_OS_MEM_DETACH_PORT((PISDN_ADAPTER)a->io, Port);
return (val);
}
word io_inw(ADAPTER *a, void *adr)
{
word val;
byte __iomem *Port = DIVA_OS_MEM_ATTACH_PORT((PISDN_ADAPTER)a->io);
outppw(Port + 4, (word)(unsigned long)adr);
val = inppw(Port);
DIVA_OS_MEM_DETACH_PORT((PISDN_ADAPTER)a->io, Port);
return (val);
}
void io_in_buffer(ADAPTER *a, void *adr, void *buffer, word len)
{
byte __iomem *Port = DIVA_OS_MEM_ATTACH_PORT((PISDN_ADAPTER)a->io);
byte *P = (byte *)buffer;
if ((long)adr & 1) {
outppw(Port + 4, (word)(unsigned long)adr);
*P = inpp(Port);
P++;
adr = ((byte *) adr) + 1;
len--;
if (!len) {
DIVA_OS_MEM_DETACH_PORT((PISDN_ADAPTER)a->io, Port);
return;
}
}
outppw(Port + 4, (word)(unsigned long)adr);
inppw_buffer(Port, P, len + 1);
DIVA_OS_MEM_DETACH_PORT((PISDN_ADAPTER)a->io, Port);
}
void io_look_ahead(ADAPTER *a, PBUFFER *RBuffer, ENTITY *e)
{
byte __iomem *Port = DIVA_OS_MEM_ATTACH_PORT((PISDN_ADAPTER)a->io);
outppw(Port + 4, (word)(unsigned long)RBuffer);
((PISDN_ADAPTER)a->io)->RBuffer.length = inppw(Port);
inppw_buffer(Port, ((PISDN_ADAPTER)a->io)->RBuffer.P, ((PISDN_ADAPTER)a->io)->RBuffer.length + 1);
e->RBuffer = (DBUFFER *) &(((PISDN_ADAPTER)a->io)->RBuffer);
DIVA_OS_MEM_DETACH_PORT((PISDN_ADAPTER)a->io, Port);
}
void io_out(ADAPTER *a, void *adr, byte data)
{
byte __iomem *Port = DIVA_OS_MEM_ATTACH_PORT((PISDN_ADAPTER)a->io);
outppw(Port + 4, (word)(unsigned long)adr);
outpp(Port, data);
DIVA_OS_MEM_DETACH_PORT((PISDN_ADAPTER)a->io, Port);
}
void io_outw(ADAPTER *a, void *adr, word data)
{
byte __iomem *Port = DIVA_OS_MEM_ATTACH_PORT((PISDN_ADAPTER)a->io);
outppw(Port + 4, (word)(unsigned long)adr);
outppw(Port, data);
DIVA_OS_MEM_DETACH_PORT((PISDN_ADAPTER)a->io, Port);
}
void io_out_buffer(ADAPTER *a, void *adr, void *buffer, word len)
{
byte __iomem *Port = DIVA_OS_MEM_ATTACH_PORT((PISDN_ADAPTER)a->io);
byte *P = (byte *)buffer;
if ((long)adr & 1) {
outppw(Port + 4, (word)(unsigned long)adr);
outpp(Port, *P);
P++;
adr = ((byte *) adr) + 1;
len--;
if (!len) {
DIVA_OS_MEM_DETACH_PORT((PISDN_ADAPTER)a->io, Port);
return;
}
}
outppw(Port + 4, (word)(unsigned long)adr);
outppw_buffer(Port, P, len + 1);
DIVA_OS_MEM_DETACH_PORT((PISDN_ADAPTER)a->io, Port);
}
void io_inc(ADAPTER *a, void *adr)
{
byte x;
byte __iomem *Port = DIVA_OS_MEM_ATTACH_PORT((PISDN_ADAPTER)a->io);
outppw(Port + 4, (word)(unsigned long)adr);
x = inpp(Port);
outppw(Port + 4, (word)(unsigned long)adr);
outpp(Port, x + 1);
DIVA_OS_MEM_DETACH_PORT((PISDN_ADAPTER)a->io, Port);
}
/*------------------------------------------------------------------*/
/* OS specific functions related to queuing of entities */
/*------------------------------------------------------------------*/
void free_entity(ADAPTER *a, byte e_no)
{
PISDN_ADAPTER IoAdapter;
diva_os_spin_lock_magic_t irql;
IoAdapter = (PISDN_ADAPTER) a->io;
diva_os_enter_spin_lock(&IoAdapter->data_spin_lock, &irql, "data_free");
IoAdapter->e_tbl[e_no].e = NULL;
IoAdapter->e_count--;
diva_os_leave_spin_lock(&IoAdapter->data_spin_lock, &irql, "data_free");
}
void assign_queue(ADAPTER *a, byte e_no, word ref)
{
PISDN_ADAPTER IoAdapter;
diva_os_spin_lock_magic_t irql;
IoAdapter = (PISDN_ADAPTER) a->io;
diva_os_enter_spin_lock(&IoAdapter->data_spin_lock, &irql, "data_assign");
IoAdapter->e_tbl[e_no].assign_ref = ref;
IoAdapter->e_tbl[e_no].next = (byte)IoAdapter->assign;
IoAdapter->assign = e_no;
diva_os_leave_spin_lock(&IoAdapter->data_spin_lock, &irql, "data_assign");
}
byte get_assign(ADAPTER *a, word ref)
{
PISDN_ADAPTER IoAdapter;
diva_os_spin_lock_magic_t irql;
byte e_no;
IoAdapter = (PISDN_ADAPTER) a->io;
diva_os_enter_spin_lock(&IoAdapter->data_spin_lock,
&irql,
"data_assign_get");
for (e_no = (byte)IoAdapter->assign;
e_no && IoAdapter->e_tbl[e_no].assign_ref != ref;
e_no = IoAdapter->e_tbl[e_no].next);
diva_os_leave_spin_lock(&IoAdapter->data_spin_lock,
&irql,
"data_assign_get");
return e_no;
}
void req_queue(ADAPTER *a, byte e_no)
{
PISDN_ADAPTER IoAdapter;
diva_os_spin_lock_magic_t irql;
IoAdapter = (PISDN_ADAPTER) a->io;
diva_os_enter_spin_lock(&IoAdapter->data_spin_lock, &irql, "data_req_q");
IoAdapter->e_tbl[e_no].next = 0;
if (IoAdapter->head) {
IoAdapter->e_tbl[IoAdapter->tail].next = e_no;
IoAdapter->tail = e_no;
}
else {
IoAdapter->head = e_no;
IoAdapter->tail = e_no;
}
diva_os_leave_spin_lock(&IoAdapter->data_spin_lock, &irql, "data_req_q");
}
byte look_req(ADAPTER *a)
{
PISDN_ADAPTER IoAdapter;
IoAdapter = (PISDN_ADAPTER) a->io;
return ((byte)IoAdapter->head);
}
void next_req(ADAPTER *a)
{
PISDN_ADAPTER IoAdapter;
diva_os_spin_lock_magic_t irql;
IoAdapter = (PISDN_ADAPTER) a->io;
diva_os_enter_spin_lock(&IoAdapter->data_spin_lock, &irql, "data_req_next");
IoAdapter->head = IoAdapter->e_tbl[IoAdapter->head].next;
if (!IoAdapter->head) IoAdapter->tail = 0;
diva_os_leave_spin_lock(&IoAdapter->data_spin_lock, &irql, "data_req_next");
}
/*------------------------------------------------------------------*/
/* memory map functions */
/*------------------------------------------------------------------*/
ENTITY *entity_ptr(ADAPTER *a, byte e_no)
{
PISDN_ADAPTER IoAdapter;
IoAdapter = (PISDN_ADAPTER)a->io;
return (IoAdapter->e_tbl[e_no].e);
}
void *PTR_X(ADAPTER *a, ENTITY *e)
{
return ((void *) e->X);
}
void *PTR_R(ADAPTER *a, ENTITY *e)
{
return ((void *) e->R);
}
void *PTR_P(ADAPTER *a, ENTITY *e, void *P)
{
return P;
}
void CALLBACK(ADAPTER *a, ENTITY *e)
{
if (e && e->callback)
e->callback(e);
}

View File

@ -1,308 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef __DIVA_XDI_COMMON_IO_H_INC__ /* { */
#define __DIVA_XDI_COMMON_IO_H_INC__
/*
maximum = 16 adapters
*/
#define DI_MAX_LINKS MAX_ADAPTER
#define ISDN_MAX_NUM_LEN 60
/* --------------------------------------------------------------------------
structure for quadro card management (obsolete for
systems that do provide per card load event)
-------------------------------------------------------------------------- */
typedef struct {
dword Num;
DEVICE_NAME DeviceName[4];
PISDN_ADAPTER QuadroAdapter[4];
} ADAPTER_LIST_ENTRY, *PADAPTER_LIST_ENTRY;
/* --------------------------------------------------------------------------
Special OS memory support structures
-------------------------------------------------------------------------- */
#define MAX_MAPPED_ENTRIES 8
typedef struct {
void *Address;
dword Length;
} ADAPTER_MEMORY;
/* --------------------------------------------------------------------------
Configuration of XDI clients carried by XDI
-------------------------------------------------------------------------- */
#define DIVA_XDI_CAPI_CFG_1_DYNAMIC_L1_ON 0x01
#define DIVA_XDI_CAPI_CFG_1_GROUP_POPTIMIZATION_ON 0x02
typedef struct _diva_xdi_capi_cfg {
byte cfg_1;
} diva_xdi_capi_cfg_t;
/* --------------------------------------------------------------------------
Main data structure kept per adapter
-------------------------------------------------------------------------- */
struct _ISDN_ADAPTER {
void (*DIRequest)(PISDN_ADAPTER, ENTITY *);
int State; /* from NT4 1.srv, a good idea, but a poor achievement */
int Initialized;
int RegisteredWithDidd;
int Unavailable; /* callback function possible? */
int ResourcesClaimed;
int PnpBiosConfigUsed;
dword Logging;
dword features;
char ProtocolIdString[80];
/*
remember mapped memory areas
*/
ADAPTER_MEMORY MappedMemory[MAX_MAPPED_ENTRIES];
CARD_PROPERTIES Properties;
dword cardType;
dword protocol_id; /* configured protocol identifier */
char protocol_name[8]; /* readable name of protocol */
dword BusType;
dword BusNumber;
dword slotNumber;
dword slotId;
dword ControllerNumber; /* for QUADRO cards only */
PISDN_ADAPTER MultiMaster; /* for 4-BRI card only - use MultiMaster or QuadroList */
PADAPTER_LIST_ENTRY QuadroList; /* for QUADRO card only */
PDEVICE_OBJECT DeviceObject;
dword DeviceId;
diva_os_adapter_irq_info_t irq_info;
dword volatile IrqCount;
int trapped;
dword DspCodeBaseAddr;
dword MaxDspCodeSize;
dword downloadAddr;
dword DspCodeBaseAddrTable[4]; /* add. for MultiMaster */
dword MaxDspCodeSizeTable[4]; /* add. for MultiMaster */
dword downloadAddrTable[4]; /* add. for MultiMaster */
dword MemoryBase;
dword MemorySize;
byte __iomem *Address;
byte __iomem *Config;
byte __iomem *Control;
byte __iomem *reset;
byte __iomem *port;
byte __iomem *ram;
byte __iomem *cfg;
byte __iomem *prom;
byte __iomem *ctlReg;
struct pc_maint *pcm;
diva_os_dependent_devica_name_t os_name;
byte Name[32];
dword serialNo;
dword ANum;
dword ArchiveType; /* ARCHIVE_TYPE_NONE ..._SINGLE ..._USGEN ..._MULTI */
char *ProtocolSuffix; /* internal protocolfile table */
char Archive[32];
char Protocol[32];
char AddDownload[32]; /* Dsp- or other additional download files */
char Oad1[ISDN_MAX_NUM_LEN];
char Osa1[ISDN_MAX_NUM_LEN];
char Oad2[ISDN_MAX_NUM_LEN];
char Osa2[ISDN_MAX_NUM_LEN];
char Spid1[ISDN_MAX_NUM_LEN];
char Spid2[ISDN_MAX_NUM_LEN];
byte nosig;
byte BriLayer2LinkCount; /* amount of TEI's that adapter will support in P2MP mode */
dword Channels;
dword tei;
dword nt2;
dword TerminalCount;
dword WatchDog;
dword Permanent;
dword BChMask; /* B channel mask for unchannelized modes */
dword StableL2;
dword DidLen;
dword NoOrderCheck;
dword ForceLaw; /* VoiceCoding - default:0, a-law: 1, my-law: 2 */
dword SigFlags;
dword LowChannel;
dword NoHscx30;
dword ProtVersion;
dword crc4;
dword L1TristateOrQsig; /* enable Layer 1 Tristate (bit 2)Or Qsig params (bit 0,1)*/
dword InitialDspInfo;
dword ModemGuardTone;
dword ModemMinSpeed;
dword ModemMaxSpeed;
dword ModemOptions;
dword ModemOptions2;
dword ModemNegotiationMode;
dword ModemModulationsMask;
dword ModemTransmitLevel;
dword FaxOptions;
dword FaxMaxSpeed;
dword Part68LevelLimiter;
dword UsEktsNumCallApp;
byte UsEktsFeatAddConf;
byte UsEktsFeatRemoveConf;
byte UsEktsFeatCallTransfer;
byte UsEktsFeatMsgWaiting;
byte QsigDialect;
byte ForceVoiceMailAlert;
byte DisableAutoSpid;
byte ModemCarrierWaitTimeSec;
byte ModemCarrierLossWaitTimeTenthSec;
byte PiafsLinkTurnaroundInFrames;
byte DiscAfterProgress;
byte AniDniLimiter[3];
byte TxAttenuation; /* PRI/E1 only: attenuate TX signal */
word QsigFeatures;
dword GenerateRingtone;
dword SupplementaryServicesFeatures;
dword R2Dialect;
dword R2CasOptions;
dword FaxV34Options;
dword DisabledDspMask;
dword AdapterTestMask;
dword DspImageLength;
word AlertToIn20mSecTicks;
word ModemEyeSetup;
byte R2CtryLength;
byte CCBSRelTimer;
byte *PcCfgBufferFile;/* flexible parameter via file */
byte *PcCfgBuffer; /* flexible parameter via multistring */
diva_os_dump_file_t dump_file; /* dump memory to file at lowest irq level */
diva_os_board_trace_t board_trace; /* traces from the board */
diva_os_spin_lock_t isr_spin_lock;
diva_os_spin_lock_t data_spin_lock;
diva_os_soft_isr_t req_soft_isr;
diva_os_soft_isr_t isr_soft_isr;
diva_os_atomic_t in_dpc;
PBUFFER RBuffer; /* Copy of receive lookahead buffer */
word e_max;
word e_count;
E_INFO *e_tbl;
word assign; /* list of pending ASSIGNs */
word head; /* head of request queue */
word tail; /* tail of request queue */
ADAPTER a; /* not a separate structure */
void (*out)(ADAPTER *a);
byte (*dpc)(ADAPTER *a);
byte (*tst_irq)(ADAPTER *a);
void (*clr_irq)(ADAPTER *a);
int (*load)(PISDN_ADAPTER);
int (*mapmem)(PISDN_ADAPTER);
int (*chkIrq)(PISDN_ADAPTER);
void (*disIrq)(PISDN_ADAPTER);
void (*start)(PISDN_ADAPTER);
void (*stop)(PISDN_ADAPTER);
void (*rstFnc)(PISDN_ADAPTER);
void (*trapFnc)(PISDN_ADAPTER);
dword (*DetectDsps)(PISDN_ADAPTER);
void (*os_trap_nfy_Fnc)(PISDN_ADAPTER, dword);
diva_os_isr_callback_t diva_isr_handler;
dword sdram_bar; /* must be 32 bit */
dword fpga_features;
volatile int pcm_pending;
volatile void *pcm_data;
diva_xdi_capi_cfg_t capi_cfg;
dword tasks;
void *dma_map;
int (*DivaAdapterTestProc)(PISDN_ADAPTER);
void *AdapterTestMemoryStart;
dword AdapterTestMemoryLength;
const byte *cfg_lib_memory_init;
dword cfg_lib_memory_init_length;
};
/* ---------------------------------------------------------------------
Entity table
--------------------------------------------------------------------- */
struct e_info_s {
ENTITY *e;
byte next; /* chaining index */
word assign_ref; /* assign reference */
};
/* ---------------------------------------------------------------------
S-cards shared ram structure for loading
--------------------------------------------------------------------- */
struct s_load {
byte ctrl;
byte card;
byte msize;
byte fill0;
word ebit;
word elocl;
word eloch;
byte reserved[20];
word signature;
byte fill[224];
byte b[256];
};
#define PR_RAM ((struct pr_ram *)0)
#define RAM ((struct dual *)0)
/* ---------------------------------------------------------------------
platform specific conversions
--------------------------------------------------------------------- */
extern void *PTR_P(ADAPTER *a, ENTITY *e, void *P);
extern void *PTR_X(ADAPTER *a, ENTITY *e);
extern void *PTR_R(ADAPTER *a, ENTITY *e);
extern void CALLBACK(ADAPTER *a, ENTITY *e);
extern void set_ram(void **adr_ptr);
/* ---------------------------------------------------------------------
ram access functions for io mapped cards
--------------------------------------------------------------------- */
byte io_in(ADAPTER *a, void *adr);
word io_inw(ADAPTER *a, void *adr);
void io_in_buffer(ADAPTER *a, void *adr, void *P, word length);
void io_look_ahead(ADAPTER *a, PBUFFER *RBuffer, ENTITY *e);
void io_out(ADAPTER *a, void *adr, byte data);
void io_outw(ADAPTER *a, void *adr, word data);
void io_out_buffer(ADAPTER *a, void *adr, void *P, word length);
void io_inc(ADAPTER *a, void *adr);
void bri_in_buffer(PISDN_ADAPTER IoAdapter, dword Pos,
void *Buf, dword Len);
int bri_out_buffer(PISDN_ADAPTER IoAdapter, dword Pos,
void *Buf, dword Len, int Verify);
/* ---------------------------------------------------------------------
ram access functions for memory mapped cards
--------------------------------------------------------------------- */
byte mem_in(ADAPTER *a, void *adr);
word mem_inw(ADAPTER *a, void *adr);
void mem_in_buffer(ADAPTER *a, void *adr, void *P, word length);
void mem_look_ahead(ADAPTER *a, PBUFFER *RBuffer, ENTITY *e);
void mem_out(ADAPTER *a, void *adr, byte data);
void mem_outw(ADAPTER *a, void *adr, word data);
void mem_out_buffer(ADAPTER *a, void *adr, void *P, word length);
void mem_inc(ADAPTER *a, void *adr);
void mem_in_dw(ADAPTER *a, void *addr, dword *data, int dwords);
void mem_out_dw(ADAPTER *a, void *addr, const dword *data, int dwords);
/* ---------------------------------------------------------------------
functions exported by io.c
--------------------------------------------------------------------- */
extern IDI_CALL Requests[MAX_ADAPTER];
extern void DIDpcRoutine(struct _diva_os_soft_isr *psoft_isr,
void *context);
extern void request(PISDN_ADAPTER, ENTITY *);
/* ---------------------------------------------------------------------
trapFn helpers, used to recover debug trace from dead card
--------------------------------------------------------------------- */
typedef struct {
word *buf;
word cnt;
word out;
} Xdesc;
extern void dump_trap_frame(PISDN_ADAPTER IoAdapter, byte __iomem *exception);
extern void dump_xlog_buffer(PISDN_ADAPTER IoAdapter, Xdesc *xlogDesc);
/* --------------------------------------------------------------------- */
#endif /* } __DIVA_XDI_COMMON_IO_H_INC__ */

View File

@ -1,226 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include "platform.h"
#if defined(DIVA_ISTREAM) /* { */
#include "pc.h"
#include "pr_pc.h"
#include "di_defs.h"
#include "divasync.h"
#include "di.h"
#if !defined USE_EXTENDED_DEBUGS
#include "dimaint.h"
#else
#define dprintf
#endif
#include "dfifo.h"
int diva_istream_write(void *context,
int Id,
void *data,
int length,
int final,
byte usr1,
byte usr2);
int diva_istream_read(void *context,
int Id,
void *data,
int max_length,
int *final,
byte *usr1,
byte *usr2);
/* -------------------------------------------------------------------
Does provide iStream interface to the client
------------------------------------------------------------------- */
void diva_xdi_provide_istream_info(ADAPTER *a,
diva_xdi_stream_interface_t *pi) {
pi->provided_service = 0;
}
/* ------------------------------------------------------------------
Does write the data from caller's buffer to the card's
stream interface.
If synchronous service was requested, then function
does return amount of data written to stream.
'final' does indicate that piece of data to be written is
final part of frame (necessary only by structured datatransfer)
return 0 if zero lengh packet was written
return -1 if stream is full
------------------------------------------------------------------ */
int diva_istream_write(void *context,
int Id,
void *data,
int length,
int final,
byte usr1,
byte usr2) {
ADAPTER *a = (ADAPTER *)context;
int written = 0, to_write = -1;
char tmp[4];
byte *data_ptr = (byte *)data;
for (;;) {
a->ram_in_dw(a,
#ifdef PLATFORM_GT_32BIT
ULongToPtr(a->tx_stream[Id] + a->tx_pos[Id]),
#else
(void *)(a->tx_stream[Id] + a->tx_pos[Id]),
#endif
(dword *)&tmp[0],
1);
if (tmp[0] & DIVA_DFIFO_READY) { /* No free blocks more */
if (to_write < 0)
return (-1); /* was not able to write */
break; /* only part of message was written */
}
to_write = min(length, DIVA_DFIFO_DATA_SZ);
if (to_write) {
a->ram_out_buffer(a,
#ifdef PLATFORM_GT_32BIT
ULongToPtr(a->tx_stream[Id] + a->tx_pos[Id] + 4),
#else
(void *)(a->tx_stream[Id] + a->tx_pos[Id] + 4),
#endif
data_ptr,
(word)to_write);
length -= to_write;
written += to_write;
data_ptr += to_write;
}
tmp[1] = (char)to_write;
tmp[0] = (tmp[0] & DIVA_DFIFO_WRAP) |
DIVA_DFIFO_READY |
((!length && final) ? DIVA_DFIFO_LAST : 0);
if (tmp[0] & DIVA_DFIFO_LAST) {
tmp[2] = usr1;
tmp[3] = usr2;
}
a->ram_out_dw(a,
#ifdef PLATFORM_GT_32BIT
ULongToPtr(a->tx_stream[Id] + a->tx_pos[Id]),
#else
(void *)(a->tx_stream[Id] + a->tx_pos[Id]),
#endif
(dword *)&tmp[0],
1);
if (tmp[0] & DIVA_DFIFO_WRAP) {
a->tx_pos[Id] = 0;
} else {
a->tx_pos[Id] += DIVA_DFIFO_STEP;
}
if (!length) {
break;
}
}
return (written);
}
/* -------------------------------------------------------------------
In case of SYNCRONOUS service:
Does write data from stream in caller's buffer.
Does return amount of data written to buffer
Final flag is set on return if last part of structured frame
was received
return 0 if zero packet was received
return -1 if stream is empty
return -2 if read buffer does not profide sufficient space
to accommodate entire segment
max_length should be at least 68 bytes
------------------------------------------------------------------- */
int diva_istream_read(void *context,
int Id,
void *data,
int max_length,
int *final,
byte *usr1,
byte *usr2) {
ADAPTER *a = (ADAPTER *)context;
int read = 0, to_read = -1;
char tmp[4];
byte *data_ptr = (byte *)data;
*final = 0;
for (;;) {
a->ram_in_dw(a,
#ifdef PLATFORM_GT_32BIT
ULongToPtr(a->rx_stream[Id] + a->rx_pos[Id]),
#else
(void *)(a->rx_stream[Id] + a->rx_pos[Id]),
#endif
(dword *)&tmp[0],
1);
if (tmp[1] > max_length) {
if (to_read < 0)
return (-2); /* was not able to read */
break;
}
if (!(tmp[0] & DIVA_DFIFO_READY)) {
if (to_read < 0)
return (-1); /* was not able to read */
break;
}
to_read = min(max_length, (int)tmp[1]);
if (to_read) {
a->ram_in_buffer(a,
#ifdef PLATFORM_GT_32BIT
ULongToPtr(a->rx_stream[Id] + a->rx_pos[Id] + 4),
#else
(void *)(a->rx_stream[Id] + a->rx_pos[Id] + 4),
#endif
data_ptr,
(word)to_read);
max_length -= to_read;
read += to_read;
data_ptr += to_read;
}
if (tmp[0] & DIVA_DFIFO_LAST) {
*final = 1;
}
tmp[0] &= DIVA_DFIFO_WRAP;
a->ram_out_dw(a,
#ifdef PLATFORM_GT_32BIT
ULongToPtr(a->rx_stream[Id] + a->rx_pos[Id]),
#else
(void *)(a->rx_stream[Id] + a->rx_pos[Id]),
#endif
(dword *)&tmp[0],
1);
if (tmp[0] & DIVA_DFIFO_WRAP) {
a->rx_pos[Id] = 0;
} else {
a->rx_pos[Id] += DIVA_DFIFO_STEP;
}
if (*final) {
if (usr1)
*usr1 = tmp[2];
if (usr2)
*usr2 = tmp[3];
break;
}
}
return (read);
}
/* ---------------------------------------------------------------------
Does check if one of streams had caused interrupt and does
wake up corresponding application
--------------------------------------------------------------------- */
void pr_stream(ADAPTER *a) {
}
#endif /* } */

View File

@ -1,335 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2000.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 1.9
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef __DIVA_EICON_TRACE_API__
#define __DIVA_EICON_TRACE_API__
#define DIVA_TRACE_LINE_TYPE_LEN 64
#define DIVA_TRACE_IE_LEN 64
#define DIVA_TRACE_FAX_PRMS_LEN 128
typedef struct _diva_trace_ie {
byte length;
byte data[DIVA_TRACE_IE_LEN];
} diva_trace_ie_t;
/*
Structure used to represent "State\\BX\\Modem" directory
to user.
*/
typedef struct _diva_trace_modem_state {
dword ChannelNumber;
dword Event;
dword Norm;
dword Options; /* Options received from Application */
dword TxSpeed;
dword RxSpeed;
dword RoundtripMsec;
dword SymbolRate;
int RxLeveldBm;
int EchoLeveldBm;
dword SNRdb;
dword MAE;
dword LocalRetrains;
dword RemoteRetrains;
dword LocalResyncs;
dword RemoteResyncs;
dword DiscReason;
} diva_trace_modem_state_t;
/*
Representation of "State\\BX\\FAX" directory
*/
typedef struct _diva_trace_fax_state {
dword ChannelNumber;
dword Event;
dword Page_Counter;
dword Features;
char Station_ID[DIVA_TRACE_FAX_PRMS_LEN];
char Subaddress[DIVA_TRACE_FAX_PRMS_LEN];
char Password[DIVA_TRACE_FAX_PRMS_LEN];
dword Speed;
dword Resolution;
dword Paper_Width;
dword Paper_Length;
dword Scanline_Time;
dword Disc_Reason;
dword dummy;
} diva_trace_fax_state_t;
/*
Structure used to represent Interface State in the abstract
and interface/D-channel protocol independent form.
*/
typedef struct _diva_trace_interface_state {
char Layer1[DIVA_TRACE_LINE_TYPE_LEN];
char Layer2[DIVA_TRACE_LINE_TYPE_LEN];
} diva_trace_interface_state_t;
typedef struct _diva_incoming_call_statistics {
dword Calls;
dword Connected;
dword User_Busy;
dword Call_Rejected;
dword Wrong_Number;
dword Incompatible_Dst;
dword Out_of_Order;
dword Ignored;
} diva_incoming_call_statistics_t;
typedef struct _diva_outgoing_call_statistics {
dword Calls;
dword Connected;
dword User_Busy;
dword No_Answer;
dword Wrong_Number;
dword Call_Rejected;
dword Other_Failures;
} diva_outgoing_call_statistics_t;
typedef struct _diva_modem_call_statistics {
dword Disc_Normal;
dword Disc_Unspecified;
dword Disc_Busy_Tone;
dword Disc_Congestion;
dword Disc_Carr_Wait;
dword Disc_Trn_Timeout;
dword Disc_Incompat;
dword Disc_Frame_Rej;
dword Disc_V42bis;
} diva_modem_call_statistics_t;
typedef struct _diva_fax_call_statistics {
dword Disc_Normal;
dword Disc_Not_Ident;
dword Disc_No_Response;
dword Disc_Retries;
dword Disc_Unexp_Msg;
dword Disc_No_Polling;
dword Disc_Training;
dword Disc_Unexpected;
dword Disc_Application;
dword Disc_Incompat;
dword Disc_No_Command;
dword Disc_Long_Msg;
dword Disc_Supervisor;
dword Disc_SUB_SEP_PWD;
dword Disc_Invalid_Msg;
dword Disc_Page_Coding;
dword Disc_App_Timeout;
dword Disc_Unspecified;
} diva_fax_call_statistics_t;
typedef struct _diva_prot_statistics {
dword X_Frames;
dword X_Bytes;
dword X_Errors;
dword R_Frames;
dword R_Bytes;
dword R_Errors;
} diva_prot_statistics_t;
typedef struct _diva_ifc_statistics {
diva_incoming_call_statistics_t inc;
diva_outgoing_call_statistics_t outg;
diva_modem_call_statistics_t mdm;
diva_fax_call_statistics_t fax;
diva_prot_statistics_t b1;
diva_prot_statistics_t b2;
diva_prot_statistics_t d1;
diva_prot_statistics_t d2;
} diva_ifc_statistics_t;
/*
Structure used to represent "State\\BX" directory
to user.
*/
typedef struct _diva_trace_line_state {
dword ChannelNumber;
char Line[DIVA_TRACE_LINE_TYPE_LEN];
char Framing[DIVA_TRACE_LINE_TYPE_LEN];
char Layer2[DIVA_TRACE_LINE_TYPE_LEN];
char Layer3[DIVA_TRACE_LINE_TYPE_LEN];
char RemoteAddress[DIVA_TRACE_LINE_TYPE_LEN];
char RemoteSubAddress[DIVA_TRACE_LINE_TYPE_LEN];
char LocalAddress[DIVA_TRACE_LINE_TYPE_LEN];
char LocalSubAddress[DIVA_TRACE_LINE_TYPE_LEN];
diva_trace_ie_t call_BC;
diva_trace_ie_t call_HLC;
diva_trace_ie_t call_LLC;
dword Charges;
dword CallReference;
dword LastDisconnecCause;
char UserID[DIVA_TRACE_LINE_TYPE_LEN];
diva_trace_modem_state_t modem;
diva_trace_fax_state_t fax;
diva_trace_interface_state_t *pInterface;
diva_ifc_statistics_t *pInterfaceStat;
} diva_trace_line_state_t;
#define DIVA_SUPER_TRACE_NOTIFY_LINE_CHANGE ('l')
#define DIVA_SUPER_TRACE_NOTIFY_MODEM_CHANGE ('m')
#define DIVA_SUPER_TRACE_NOTIFY_FAX_CHANGE ('f')
#define DIVA_SUPER_TRACE_INTERFACE_CHANGE ('i')
#define DIVA_SUPER_TRACE_NOTIFY_STAT_CHANGE ('s')
#define DIVA_SUPER_TRACE_NOTIFY_MDM_STAT_CHANGE ('M')
#define DIVA_SUPER_TRACE_NOTIFY_FAX_STAT_CHANGE ('F')
struct _diva_strace_library_interface;
typedef void (*diva_trace_channel_state_change_proc_t)(void *user_context,
struct _diva_strace_library_interface *hLib,
int Adapter,
diva_trace_line_state_t *channel, int notify_subject);
typedef void (*diva_trace_channel_trace_proc_t)(void *user_context,
struct _diva_strace_library_interface *hLib,
int Adapter, void *xlog_buffer, int length);
typedef void (*diva_trace_error_proc_t)(void *user_context,
struct _diva_strace_library_interface *hLib,
int Adapter,
int error, const char *file, int line);
/*
This structure creates interface from user to library
*/
typedef struct _diva_trace_library_user_interface {
void *user_context;
diva_trace_channel_state_change_proc_t notify_proc;
diva_trace_channel_trace_proc_t trace_proc;
diva_trace_error_proc_t error_notify_proc;
} diva_trace_library_user_interface_t;
/*
Interface from Library to User
*/
typedef int (*DivaSTraceLibraryStart_proc_t)(void *hLib);
typedef int (*DivaSTraceLibraryFinit_proc_t)(void *hLib);
typedef int (*DivaSTraceMessageInput_proc_t)(void *hLib);
typedef void* (*DivaSTraceGetHandle_proc_t)(void *hLib);
/*
Turn Audio Tap trace on/off
Channel should be in the range 1 ... Number of Channels
*/
typedef int (*DivaSTraceSetAudioTap_proc_t)(void *hLib, int Channel, int on);
/*
Turn B-channel trace on/off
Channel should be in the range 1 ... Number of Channels
*/
typedef int (*DivaSTraceSetBChannel_proc_t)(void *hLib, int Channel, int on);
/*
Turn D-channel (Layer1/Layer2/Layer3) trace on/off
Layer1 - All D-channel frames received/sent over the interface
inclusive Layer 2 headers, Layer 2 frames and TEI management frames
Layer2 - Events from LAPD protocol instance with SAPI of signalling protocol
Layer3 - All D-channel frames addressed to assigned to the card TEI and
SAPI of signalling protocol, and signalling protocol events.
*/
typedef int (*DivaSTraceSetDChannel_proc_t)(void *hLib, int on);
/*
Get overall card statistics
*/
typedef int (*DivaSTraceGetOutgoingCallStatistics_proc_t)(void *hLib);
typedef int (*DivaSTraceGetIncomingCallStatistics_proc_t)(void *hLib);
typedef int (*DivaSTraceGetModemStatistics_proc_t)(void *hLib);
typedef int (*DivaSTraceGetFaxStatistics_proc_t)(void *hLib);
typedef int (*DivaSTraceGetBLayer1Statistics_proc_t)(void *hLib);
typedef int (*DivaSTraceGetBLayer2Statistics_proc_t)(void *hLib);
typedef int (*DivaSTraceGetDLayer1Statistics_proc_t)(void *hLib);
typedef int (*DivaSTraceGetDLayer2Statistics_proc_t)(void *hLib);
/*
Call control
*/
typedef int (*DivaSTraceClearCall_proc_t)(void *hLib, int Channel);
typedef struct _diva_strace_library_interface {
void *hLib;
DivaSTraceLibraryStart_proc_t DivaSTraceLibraryStart;
DivaSTraceLibraryStart_proc_t DivaSTraceLibraryStop;
DivaSTraceLibraryFinit_proc_t DivaSTraceLibraryFinit;
DivaSTraceMessageInput_proc_t DivaSTraceMessageInput;
DivaSTraceGetHandle_proc_t DivaSTraceGetHandle;
DivaSTraceSetAudioTap_proc_t DivaSTraceSetAudioTap;
DivaSTraceSetBChannel_proc_t DivaSTraceSetBChannel;
DivaSTraceSetDChannel_proc_t DivaSTraceSetDChannel;
DivaSTraceSetDChannel_proc_t DivaSTraceSetInfo;
DivaSTraceGetOutgoingCallStatistics_proc_t \
DivaSTraceGetOutgoingCallStatistics;
DivaSTraceGetIncomingCallStatistics_proc_t \
DivaSTraceGetIncomingCallStatistics;
DivaSTraceGetModemStatistics_proc_t \
DivaSTraceGetModemStatistics;
DivaSTraceGetFaxStatistics_proc_t \
DivaSTraceGetFaxStatistics;
DivaSTraceGetBLayer1Statistics_proc_t \
DivaSTraceGetBLayer1Statistics;
DivaSTraceGetBLayer2Statistics_proc_t \
DivaSTraceGetBLayer2Statistics;
DivaSTraceGetDLayer1Statistics_proc_t \
DivaSTraceGetDLayer1Statistics;
DivaSTraceGetDLayer2Statistics_proc_t \
DivaSTraceGetDLayer2Statistics;
DivaSTraceClearCall_proc_t DivaSTraceClearCall;
} diva_strace_library_interface_t;
/*
Create and return Library interface
*/
diva_strace_library_interface_t *DivaSTraceLibraryCreateInstance(int Adapter,
const diva_trace_library_user_interface_t *user_proc,
byte *pmem);
dword DivaSTraceGetMemotyRequirement(int channels);
#define DIVA_MAX_ADAPTERS 64
#define DIVA_MAX_LINES 32
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,171 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2000.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 1.9
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef __DIVA_EICON_TRACE_IDI_IFC_H__
#define __DIVA_EICON_TRACE_IDI_IFC_H__
void *SuperTraceOpenAdapter(int AdapterNumber);
int SuperTraceCloseAdapter(void *AdapterHandle);
int SuperTraceWrite(void *AdapterHandle,
const void *data, int length);
int SuperTraceReadRequest(void *AdapterHandle, const char *name, byte *data);
int SuperTraceGetNumberOfChannels(void *AdapterHandle);
int SuperTraceASSIGN(void *AdapterHandle, byte *data);
int SuperTraceREMOVE(void *AdapterHandle);
int SuperTraceTraceOnRequest(void *hAdapter, const char *name, byte *data);
int SuperTraceWriteVar(void *AdapterHandle,
byte *data,
const char *name,
void *var,
byte type,
byte var_length);
int SuperTraceExecuteRequest(void *AdapterHandle,
const char *name,
byte *data);
typedef struct _diva_strace_path2action {
char path[64]; /* Full path to variable */
void *variable; /* Variable that will receive value */
} diva_strace_path2action_t;
#define DIVA_MAX_MANAGEMENT_TRANSFER_SIZE 4096
typedef struct _diva_strace_context {
diva_strace_library_interface_t instance;
int Adapter;
void *hAdapter;
int Channels;
int req_busy;
ENTITY e;
IDI_CALL request;
BUFFERS XData;
BUFFERS RData;
byte buffer[DIVA_MAX_MANAGEMENT_TRANSFER_SIZE + 1];
int removal_state;
int general_b_ch_event;
int general_fax_event;
int general_mdm_event;
byte rc_ok;
/*
Initialization request state machine
*/
int ChannelsTraceActive;
int ModemTraceActive;
int FaxTraceActive;
int IncomingCallsCallsActive;
int IncomingCallsConnectedActive;
int OutgoingCallsCallsActive;
int OutgoingCallsConnectedActive;
int trace_mask_init;
int audio_trace_init;
int bchannel_init;
int trace_length_init;
int trace_on;
int trace_events_down;
int l1_trace;
int l2_trace;
/*
Trace\Event Enable
*/
word trace_event_mask;
word current_trace_event_mask;
dword audio_tap_mask;
dword current_audio_tap_mask;
dword current_eye_pattern_mask;
int audio_tap_pending;
int eye_pattern_pending;
dword bchannel_trace_mask;
dword current_bchannel_trace_mask;
diva_trace_line_state_t lines[30];
int parse_entries;
int cur_parse_entry;
diva_strace_path2action_t *parse_table;
diva_trace_library_user_interface_t user_proc_table;
int line_parse_entry_first[30];
int line_parse_entry_last[30];
int modem_parse_entry_first[30];
int modem_parse_entry_last[30];
int fax_parse_entry_first[30];
int fax_parse_entry_last[30];
int statistic_parse_first;
int statistic_parse_last;
int mdm_statistic_parse_first;
int mdm_statistic_parse_last;
int fax_statistic_parse_first;
int fax_statistic_parse_last;
dword line_init_event;
dword modem_init_event;
dword fax_init_event;
dword pending_line_status;
dword pending_modem_status;
dword pending_fax_status;
dword clear_call_command;
int outgoing_ifc_stats;
int incoming_ifc_stats;
int modem_ifc_stats;
int fax_ifc_stats;
int b1_ifc_stats;
int b2_ifc_stats;
int d1_ifc_stats;
int d2_ifc_stats;
diva_trace_interface_state_t Interface;
diva_ifc_statistics_t InterfaceStat;
} diva_strace_context_t;
typedef struct _diva_man_var_header {
byte escape;
byte length;
byte management_id;
byte type;
byte attribute;
byte status;
byte value_length;
byte path_length;
} diva_man_var_header_t;
#endif

View File

@ -1,133 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 1.9
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/* Definitions for use with the Management Information Element */
/*------------------------------------------------------------------*/
/* Management information element */
/* ---------------------------------------------------------- */
/* Byte Coding Comment */
/* ---------------------------------------------------------- */
/* 0 | 0 1 1 1 1 1 1 1 | ESC */
/* 1 | 0 x x x x x x x | Length of information element (m-1) */
/* 2 | 1 0 0 0 0 0 0 0 | Management Information Id */
/* 3 | x x x x x x x x | Type */
/* 4 | x x x x x x x x | Attribute */
/* 5 | x x x x x x x x | Status */
/* 6 | x x x x x x x x | Variable Value Length (m-n) */
/* 7 | x x x x x x x x | Path / Variable Name String Length (n-8)*/
/* 8..n | x x x x x x x x | Path/Node Name String separated by '\' */
/* n..m | x x x x x x x x | Variable content */
/*------------------------------------------------------------------*/
/*------------------------------------------------------------------*/
/* Type Field */
/* */
/* MAN_READ: not used */
/* MAN_WRITE: not used */
/* MAN_EVENT_ON: not used */
/* MAN_EVENT_OFF: not used */
/* MAN_INFO_IND: type of variable */
/* MAN_EVENT_IND: type of variable */
/* MAN_TRACE_IND not used */
/*------------------------------------------------------------------*/
#define MI_DIR 0x01 /* Directory string (zero terminated) */
#define MI_EXECUTE 0x02 /* Executable function (has no value) */
#define MI_ASCIIZ 0x03 /* Zero terminated string */
#define MI_ASCII 0x04 /* String, first byte is length */
#define MI_NUMBER 0x05 /* Number string, first byte is length*/
#define MI_TRACE 0x06 /* Trace information, format see below*/
#define MI_FIXED_LENGTH 0x80 /* get length from MAN_INFO max_len */
#define MI_INT 0x81 /* number to display as signed int */
#define MI_UINT 0x82 /* number to display as unsigned int */
#define MI_HINT 0x83 /* number to display in hex format */
#define MI_HSTR 0x84 /* number to display as a hex string */
#define MI_BOOLEAN 0x85 /* number to display as boolean */
#define MI_IP_ADDRESS 0x86 /* number to display as IP address */
#define MI_BITFLD 0x87 /* number to display as bit field */
#define MI_SPID_STATE 0x88 /* state# of SPID initialisation */
/*------------------------------------------------------------------*/
/* Attribute Field */
/* */
/* MAN_READ: not used */
/* MAN_WRITE: not used */
/* MAN_EVENT_ON: not used */
/* MAN_EVENT_OFF: not used */
/* MAN_INFO_IND: set according to capabilities of that variable */
/* MAN_EVENT_IND: not used */
/* MAN_TRACE_IND not used */
/*------------------------------------------------------------------*/
#define MI_WRITE 0x01 /* Variable is writeable */
#define MI_EVENT 0x02 /* Variable can indicate changes */
/*------------------------------------------------------------------*/
/* Status Field */
/* */
/* MAN_READ: not used */
/* MAN_WRITE: not used */
/* MAN_EVENT_ON: not used */
/* MAN_EVENT_OFF: not used */
/* MAN_INFO_IND: set according to the actual status */
/* MAN_EVENT_IND: set according to the actual statu */
/* MAN_TRACE_IND not used */
/*------------------------------------------------------------------*/
#define MI_LOCKED 0x01 /* write protected by another instance*/
#define MI_EVENT_ON 0x02 /* Event logging switched on */
#define MI_PROTECTED 0x04 /* write protected by this instance */
/*------------------------------------------------------------------*/
/* Data Format used for MAN_TRACE_IND (no MI-element used) */
/*------------------------------------------------------------------*/
typedef struct mi_xlog_hdr_s MI_XLOG_HDR;
struct mi_xlog_hdr_s
{
unsigned long time; /* Timestamp in msec units */
unsigned short size; /* Size of data that follows */
unsigned short code; /* code of trace event */
}; /* unspecified data follows this header */
/*------------------------------------------------------------------*/
/* Trace mask definitions for trace events except B channel and */
/* debug trace events */
/*------------------------------------------------------------------*/
#define TM_D_CHAN 0x0001 /* D-Channel (D-.) Code 3,4 */
#define TM_L_LAYER 0x0002 /* Low Layer (LL) Code 6,7 */
#define TM_N_LAYER 0x0004 /* Network Layer (N) Code 14,15 */
#define TM_DL_ERR 0x0008 /* Data Link Error (MDL) Code 9 */
#define TM_LAYER1 0x0010 /* Layer 1 Code 20 */
#define TM_C_COMM 0x0020 /* Call Comment (SIG) Code 5,21,22 */
#define TM_M_DATA 0x0040 /* Modulation Data (EYE) Code 23 */
#define TM_STRING 0x0080 /* Sting data Code 24 */
#define TM_N_USED2 0x0100 /* not used */
#define TM_N_USED3 0x0200 /* not used */
#define TM_N_USED4 0x0400 /* not used */
#define TM_N_USED5 0x0800 /* not used */
#define TM_N_USED6 0x1000 /* not used */
#define TM_N_USED7 0x2000 /* not used */
#define TM_N_USED8 0x4000 /* not used */
#define TM_REST 0x8000 /* Codes 10,11,12,13,16,18,19,128,129 */
/*------ End of file -----------------------------------------------*/

View File

@ -1,346 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef __EICON_MDM_MSG_H__
#define __EICON_MDM_MSG_H__
#define DSP_UDATA_INDICATION_DCD_OFF 0x01
#define DSP_UDATA_INDICATION_DCD_ON 0x02
#define DSP_UDATA_INDICATION_CTS_OFF 0x03
#define DSP_UDATA_INDICATION_CTS_ON 0x04
/* =====================================================================
DCD_OFF Message:
<word> time of DCD off (sampled from counter at 8kHz)
DCD_ON Message:
<word> time of DCD on (sampled from counter at 8kHz)
<byte> connected norm
<word> connected options
<dword> connected speed (bit/s, max of tx and rx speed)
<word> roundtrip delay (ms)
<dword> connected speed tx (bit/s)
<dword> connected speed rx (bit/s)
Size of this message == 19 bytes, but we will receive only 11
===================================================================== */
#define DSP_CONNECTED_NORM_UNSPECIFIED 0
#define DSP_CONNECTED_NORM_V21 1
#define DSP_CONNECTED_NORM_V23 2
#define DSP_CONNECTED_NORM_V22 3
#define DSP_CONNECTED_NORM_V22_BIS 4
#define DSP_CONNECTED_NORM_V32_BIS 5
#define DSP_CONNECTED_NORM_V34 6
#define DSP_CONNECTED_NORM_V8 7
#define DSP_CONNECTED_NORM_BELL_212A 8
#define DSP_CONNECTED_NORM_BELL_103 9
#define DSP_CONNECTED_NORM_V29_LEASED_LINE 10
#define DSP_CONNECTED_NORM_V33_LEASED_LINE 11
#define DSP_CONNECTED_NORM_V90 12
#define DSP_CONNECTED_NORM_V21_CH2 13
#define DSP_CONNECTED_NORM_V27_TER 14
#define DSP_CONNECTED_NORM_V29 15
#define DSP_CONNECTED_NORM_V33 16
#define DSP_CONNECTED_NORM_V17 17
#define DSP_CONNECTED_NORM_V32 18
#define DSP_CONNECTED_NORM_K56_FLEX 19
#define DSP_CONNECTED_NORM_X2 20
#define DSP_CONNECTED_NORM_V18 21
#define DSP_CONNECTED_NORM_V18_LOW_HIGH 22
#define DSP_CONNECTED_NORM_V18_HIGH_LOW 23
#define DSP_CONNECTED_NORM_V21_LOW_HIGH 24
#define DSP_CONNECTED_NORM_V21_HIGH_LOW 25
#define DSP_CONNECTED_NORM_BELL103_LOW_HIGH 26
#define DSP_CONNECTED_NORM_BELL103_HIGH_LOW 27
#define DSP_CONNECTED_NORM_V23_75_1200 28
#define DSP_CONNECTED_NORM_V23_1200_75 29
#define DSP_CONNECTED_NORM_EDT_110 30
#define DSP_CONNECTED_NORM_BAUDOT_45 31
#define DSP_CONNECTED_NORM_BAUDOT_47 32
#define DSP_CONNECTED_NORM_BAUDOT_50 33
#define DSP_CONNECTED_NORM_DTMF 34
#define DSP_CONNECTED_NORM_V18_RESERVED_13 35
#define DSP_CONNECTED_NORM_V18_RESERVED_14 36
#define DSP_CONNECTED_NORM_V18_RESERVED_15 37
#define DSP_CONNECTED_NORM_VOWN 38
#define DSP_CONNECTED_NORM_V23_OFF_HOOK 39
#define DSP_CONNECTED_NORM_V23_ON_HOOK 40
#define DSP_CONNECTED_NORM_VOWN_RESERVED_3 41
#define DSP_CONNECTED_NORM_VOWN_RESERVED_4 42
#define DSP_CONNECTED_NORM_VOWN_RESERVED_5 43
#define DSP_CONNECTED_NORM_VOWN_RESERVED_6 44
#define DSP_CONNECTED_NORM_VOWN_RESERVED_7 45
#define DSP_CONNECTED_NORM_VOWN_RESERVED_8 46
#define DSP_CONNECTED_NORM_VOWN_RESERVED_9 47
#define DSP_CONNECTED_NORM_VOWN_RESERVED_10 48
#define DSP_CONNECTED_NORM_VOWN_RESERVED_11 49
#define DSP_CONNECTED_NORM_VOWN_RESERVED_12 50
#define DSP_CONNECTED_NORM_VOWN_RESERVED_13 51
#define DSP_CONNECTED_NORM_VOWN_RESERVED_14 52
#define DSP_CONNECTED_NORM_VOWN_RESERVED_15 53
#define DSP_CONNECTED_NORM_VOWN_RESERVED_16 54
#define DSP_CONNECTED_NORM_VOWN_RESERVED_17 55
#define DSP_CONNECTED_NORM_VOWN_RESERVED_18 56
#define DSP_CONNECTED_NORM_VOWN_RESERVED_19 57
#define DSP_CONNECTED_NORM_VOWN_RESERVED_20 58
#define DSP_CONNECTED_NORM_VOWN_RESERVED_21 59
#define DSP_CONNECTED_NORM_VOWN_RESERVED_22 60
#define DSP_CONNECTED_NORM_VOWN_RESERVED_23 61
#define DSP_CONNECTED_NORM_VOWN_RESERVED_24 62
#define DSP_CONNECTED_NORM_VOWN_RESERVED_25 63
#define DSP_CONNECTED_NORM_VOWN_RESERVED_26 64
#define DSP_CONNECTED_NORM_VOWN_RESERVED_27 65
#define DSP_CONNECTED_NORM_VOWN_RESERVED_28 66
#define DSP_CONNECTED_NORM_VOWN_RESERVED_29 67
#define DSP_CONNECTED_NORM_VOWN_RESERVED_30 68
#define DSP_CONNECTED_NORM_VOWN_RESERVED_31 69
#define DSP_CONNECTED_OPTION_TRELLIS 0x0001
#define DSP_CONNECTED_OPTION_V42_TRANS 0x0002
#define DSP_CONNECTED_OPTION_V42_LAPM 0x0004
#define DSP_CONNECTED_OPTION_SHORT_TRAIN 0x0008
#define DSP_CONNECTED_OPTION_TALKER_ECHO_PROTECT 0x0010
#define DSP_CONNECTED_OPTION_V42BIS 0x0020
#define DSP_CONNECTED_OPTION_MNP2 0x0040
#define DSP_CONNECTED_OPTION_MNP3 0x0080
#define DSP_CONNECTED_OPTION_MNP4 0x00c0
#define DSP_CONNECTED_OPTION_MNP5 0x0100
#define DSP_CONNECTED_OPTION_MNP10 0x0200
#define DSP_CONNECTED_OPTION_MASK_V42 0x0024
#define DSP_CONNECTED_OPTION_MASK_MNP 0x03c0
#define DSP_CONNECTED_OPTION_MASK_ERROR_CORRECT 0x03e4
#define DSP_CONNECTED_OPTION_MASK_COMPRESSION 0x0320
#define DSP_UDATA_INDICATION_DISCONNECT 5
/*
returns:
<byte> cause
*/
/* ==========================================================
DLC: B2 modem configuration
========================================================== */
/*
Fields in assign DLC information element for modem protocol V.42/MNP:
<byte> length of information element
<word> information field length
<byte> address A (not used, default 3)
<byte> address B (not used, default 1)
<byte> modulo mode (not used, default 7)
<byte> window size (not used, default 7)
<word> XID length (not used, default 0)
... XID information (not used, default empty)
<byte> modem protocol negotiation options
<byte> modem protocol options
<byte> modem protocol break configuration
<byte> modem protocol application options
*/
#define DLC_MODEMPROT_DISABLE_V42_V42BIS 0x01
#define DLC_MODEMPROT_DISABLE_MNP_MNP5 0x02
#define DLC_MODEMPROT_REQUIRE_PROTOCOL 0x04
#define DLC_MODEMPROT_DISABLE_V42_DETECT 0x08
#define DLC_MODEMPROT_DISABLE_COMPRESSION 0x10
#define DLC_MODEMPROT_REQUIRE_PROTOCOL_V34UP 0x20
#define DLC_MODEMPROT_NO_PROTOCOL_IF_1200 0x01
#define DLC_MODEMPROT_BUFFER_IN_V42_DETECT 0x02
#define DLC_MODEMPROT_DISABLE_V42_SREJ 0x04
#define DLC_MODEMPROT_DISABLE_MNP3 0x08
#define DLC_MODEMPROT_DISABLE_MNP4 0x10
#define DLC_MODEMPROT_DISABLE_MNP10 0x20
#define DLC_MODEMPROT_NO_PROTOCOL_IF_V22BIS 0x40
#define DLC_MODEMPROT_NO_PROTOCOL_IF_V32BIS 0x80
#define DLC_MODEMPROT_BREAK_DISABLED 0x00
#define DLC_MODEMPROT_BREAK_NORMAL 0x01
#define DLC_MODEMPROT_BREAK_EXPEDITED 0x02
#define DLC_MODEMPROT_BREAK_DESTRUCTIVE 0x03
#define DLC_MODEMPROT_BREAK_CONFIG_MASK 0x03
#define DLC_MODEMPROT_APPL_EARLY_CONNECT 0x01
#define DLC_MODEMPROT_APPL_PASS_INDICATIONS 0x02
/* ==========================================================
CAI parameters used for the modem L1 configuration
========================================================== */
/*
Fields in assign CAI information element:
<byte> length of information element
<byte> info field and B-channel hardware
<byte> rate adaptation bit rate
<byte> async framing parameters
<byte> reserved
<word> packet length
<byte> modem line taking options
<byte> modem modulation negotiation parameters
<byte> modem modulation options
<byte> modem disabled modulations mask low
<byte> modem disabled modulations mask high
<byte> modem enabled modulations mask
<word> modem min TX speed
<word> modem max TX speed
<word> modem min RX speed
<word> modem max RX speed
<byte> modem disabled symbol rates mask
<byte> modem info options mask
<byte> modem transmit level adjust
<byte> modem speaker parameters
<word> modem private debug config
<struct> modem reserved
<struct> v18 config parameters
<struct> v18 probing sequence
<struct> v18 probing message
*/
#define DSP_CAI_HARDWARE_HDLC_64K 0x05
#define DSP_CAI_HARDWARE_HDLC_56K 0x08
#define DSP_CAI_HARDWARE_TRANSP 0x09
#define DSP_CAI_HARDWARE_V110_SYNC 0x0c
#define DSP_CAI_HARDWARE_V110_ASYNC 0x0d
#define DSP_CAI_HARDWARE_HDLC_128K 0x0f
#define DSP_CAI_HARDWARE_FAX 0x10
#define DSP_CAI_HARDWARE_MODEM_ASYNC 0x11
#define DSP_CAI_HARDWARE_MODEM_SYNC 0x12
#define DSP_CAI_HARDWARE_V110_HDLCA 0x13
#define DSP_CAI_HARDWARE_ADVANCED_VOICE 0x14
#define DSP_CAI_HARDWARE_TRANSP_DTMF 0x16
#define DSP_CAI_HARDWARE_DTMF_VOICE_ISDN 0x17
#define DSP_CAI_HARDWARE_DTMF_VOICE_LOCAL 0x18
#define DSP_CAI_HARDWARE_MASK 0x3f
#define DSP_CAI_ENABLE_INFO_INDICATIONS 0x80
#define DSP_CAI_RATE_ADAPTATION_300 0x00
#define DSP_CAI_RATE_ADAPTATION_600 0x01
#define DSP_CAI_RATE_ADAPTATION_1200 0x02
#define DSP_CAI_RATE_ADAPTATION_2400 0x03
#define DSP_CAI_RATE_ADAPTATION_4800 0x04
#define DSP_CAI_RATE_ADAPTATION_9600 0x05
#define DSP_CAI_RATE_ADAPTATION_19200 0x06
#define DSP_CAI_RATE_ADAPTATION_38400 0x07
#define DSP_CAI_RATE_ADAPTATION_48000 0x08
#define DSP_CAI_RATE_ADAPTATION_56000 0x09
#define DSP_CAI_RATE_ADAPTATION_7200 0x0a
#define DSP_CAI_RATE_ADAPTATION_14400 0x0b
#define DSP_CAI_RATE_ADAPTATION_28800 0x0c
#define DSP_CAI_RATE_ADAPTATION_12000 0x0d
#define DSP_CAI_RATE_ADAPTATION_1200_75 0x0e
#define DSP_CAI_RATE_ADAPTATION_75_1200 0x0f
#define DSP_CAI_RATE_ADAPTATION_MASK 0x0f
#define DSP_CAI_ASYNC_PARITY_ENABLE 0x01
#define DSP_CAI_ASYNC_PARITY_SPACE 0x00
#define DSP_CAI_ASYNC_PARITY_ODD 0x02
#define DSP_CAI_ASYNC_PARITY_EVEN 0x04
#define DSP_CAI_ASYNC_PARITY_MARK 0x06
#define DSP_CAI_ASYNC_PARITY_MASK 0x06
#define DSP_CAI_ASYNC_ONE_STOP_BIT 0x00
#define DSP_CAI_ASYNC_TWO_STOP_BITS 0x20
#define DSP_CAI_ASYNC_CHAR_LENGTH_8 0x00
#define DSP_CAI_ASYNC_CHAR_LENGTH_7 0x40
#define DSP_CAI_ASYNC_CHAR_LENGTH_6 0x80
#define DSP_CAI_ASYNC_CHAR_LENGTH_5 0xc0
#define DSP_CAI_ASYNC_CHAR_LENGTH_MASK 0xc0
#define DSP_CAI_MODEM_LEASED_LINE_MODE 0x01
#define DSP_CAI_MODEM_4_WIRE_OPERATION 0x02
#define DSP_CAI_MODEM_DISABLE_BUSY_DETECT 0x04
#define DSP_CAI_MODEM_DISABLE_CALLING_TONE 0x08
#define DSP_CAI_MODEM_DISABLE_ANSWER_TONE 0x10
#define DSP_CAI_MODEM_ENABLE_DIAL_TONE_DET 0x20
#define DSP_CAI_MODEM_USE_POTS_INTERFACE 0x40
#define DSP_CAI_MODEM_FORCE_RAY_TAYLOR_FAX 0x80
#define DSP_CAI_MODEM_NEGOTIATE_HIGHEST 0x00
#define DSP_CAI_MODEM_NEGOTIATE_DISABLED 0x01
#define DSP_CAI_MODEM_NEGOTIATE_IN_CLASS 0x02
#define DSP_CAI_MODEM_NEGOTIATE_V100 0x03
#define DSP_CAI_MODEM_NEGOTIATE_V8 0x04
#define DSP_CAI_MODEM_NEGOTIATE_V8BIS 0x05
#define DSP_CAI_MODEM_NEGOTIATE_MASK 0x07
#define DSP_CAI_MODEM_GUARD_TONE_NONE 0x00
#define DSP_CAI_MODEM_GUARD_TONE_550HZ 0x40
#define DSP_CAI_MODEM_GUARD_TONE_1800HZ 0x80
#define DSP_CAI_MODEM_GUARD_TONE_MASK 0xc0
#define DSP_CAI_MODEM_DISABLE_RETRAIN 0x01
#define DSP_CAI_MODEM_DISABLE_STEPUPDOWN 0x02
#define DSP_CAI_MODEM_DISABLE_SPLIT_SPEED 0x04
#define DSP_CAI_MODEM_DISABLE_TRELLIS 0x08
#define DSP_CAI_MODEM_ALLOW_RDL_TEST_LOOP 0x10
#define DSP_CAI_MODEM_DISABLE_FLUSH_TIMER 0x40
#define DSP_CAI_MODEM_REVERSE_DIRECTION 0x80
#define DSP_CAI_MODEM_DISABLE_V21 0x01
#define DSP_CAI_MODEM_DISABLE_V23 0x02
#define DSP_CAI_MODEM_DISABLE_V22 0x04
#define DSP_CAI_MODEM_DISABLE_V22BIS 0x08
#define DSP_CAI_MODEM_DISABLE_V32 0x10
#define DSP_CAI_MODEM_DISABLE_V32BIS 0x20
#define DSP_CAI_MODEM_DISABLE_V34 0x40
#define DSP_CAI_MODEM_DISABLE_V90 0x80
#define DSP_CAI_MODEM_DISABLE_BELL103 0x01
#define DSP_CAI_MODEM_DISABLE_BELL212A 0x02
#define DSP_CAI_MODEM_DISABLE_VFC 0x04
#define DSP_CAI_MODEM_DISABLE_K56FLEX 0x08
#define DSP_CAI_MODEM_DISABLE_X2 0x10
#define DSP_CAI_MODEM_ENABLE_V29FDX 0x01
#define DSP_CAI_MODEM_ENABLE_V33 0x02
#define DSP_CAI_MODEM_DISABLE_2400_SYMBOLS 0x01
#define DSP_CAI_MODEM_DISABLE_2743_SYMBOLS 0x02
#define DSP_CAI_MODEM_DISABLE_2800_SYMBOLS 0x04
#define DSP_CAI_MODEM_DISABLE_3000_SYMBOLS 0x08
#define DSP_CAI_MODEM_DISABLE_3200_SYMBOLS 0x10
#define DSP_CAI_MODEM_DISABLE_3429_SYMBOLS 0x20
#define DSP_CAI_MODEM_DISABLE_TX_REDUCTION 0x01
#define DSP_CAI_MODEM_DISABLE_PRECODING 0x02
#define DSP_CAI_MODEM_DISABLE_PREEMPHASIS 0x04
#define DSP_CAI_MODEM_DISABLE_SHAPING 0x08
#define DSP_CAI_MODEM_DISABLE_NONLINEAR_EN 0x10
#define DSP_CAI_MODEM_SPEAKER_OFF 0x00
#define DSP_CAI_MODEM_SPEAKER_DURING_TRAIN 0x01
#define DSP_CAI_MODEM_SPEAKER_TIL_CONNECT 0x02
#define DSP_CAI_MODEM_SPEAKER_ALWAYS_ON 0x03
#define DSP_CAI_MODEM_SPEAKER_CONTROL_MASK 0x03
#define DSP_CAI_MODEM_SPEAKER_VOLUME_MIN 0x00
#define DSP_CAI_MODEM_SPEAKER_VOLUME_LOW 0x04
#define DSP_CAI_MODEM_SPEAKER_VOLUME_HIGH 0x08
#define DSP_CAI_MODEM_SPEAKER_VOLUME_MAX 0x0c
#define DSP_CAI_MODEM_SPEAKER_VOLUME_MASK 0x0c
/* ==========================================================
DCD/CTS State
========================================================== */
#define MDM_WANT_CONNECT_B3_ACTIVE_I 0x01
#define MDM_NCPI_VALID 0x02
#define MDM_NCPI_CTS_ON_RECEIVED 0x04
#define MDM_NCPI_DCD_ON_RECEIVED 0x08
/* ==========================================================
CAPI NCPI Constants
========================================================== */
#define MDM_NCPI_ECM_V42 0x0001
#define MDM_NCPI_ECM_MNP 0x0002
#define MDM_NCPI_TRANSPARENT 0x0004
#define MDM_NCPI_COMPRESSED 0x0010
/* ==========================================================
CAPI B2 Config Constants
========================================================== */
#define MDM_B2_DISABLE_V42bis 0x0001
#define MDM_B2_DISABLE_MNP 0x0002
#define MDM_B2_DISABLE_TRANS 0x0004
#define MDM_B2_DISABLE_V42 0x0008
#define MDM_B2_DISABLE_COMP 0x0010
/* ==========================================================
CAPI B1 Config Constants
========================================================== */
#define MDM_CAPI_DISABLE_RETRAIN 0x0001
#define MDM_CAPI_DISABLE_RING_TONE 0x0002
#define MDM_CAPI_GUARD_1800 0x0004
#define MDM_CAPI_GUARD_550 0x0008
#define MDM_CAPI_NEG_V8 0x0003
#define MDM_CAPI_NEG_V100 0x0002
#define MDM_CAPI_NEG_MOD_CLASS 0x0001
#define MDM_CAPI_NEG_DISABLED 0x0000
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,204 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/*----------------------------------------------------------------------------
// MAESTRA ISA PnP */
#define BRI_MEMORY_BASE 0x1f700000
#define BRI_MEMORY_SIZE 0x00100000 /* 1MB on the BRI */
#define BRI_SHARED_RAM_SIZE 0x00010000 /* 64k shared RAM */
#define BRI_RAY_TAYLOR_DSP_CODE_SIZE 0x00020000 /* max 128k DSP-Code (Ray Taylor's code) */
#define BRI_ORG_MAX_DSP_CODE_SIZE 0x00050000 /* max 320k DSP-Code (Telindus) */
#define BRI_V90D_MAX_DSP_CODE_SIZE 0x00060000 /* max 384k DSP-Code if V.90D included */
#define BRI_CACHED_ADDR(x) (((x) & 0x1fffffffL) | 0x80000000L)
#define BRI_UNCACHED_ADDR(x) (((x) & 0x1fffffffL) | 0xa0000000L)
#define ADDR 4
#define ADDRH 6
#define DATA 0
#define RESET 7
#define DEFAULT_ADDRESS 0x240
#define DEFAULT_IRQ 3
#define M_PCI_ADDR 0x04 /* MAESTRA BRI PCI */
#define M_PCI_ADDRH 0x0c /* MAESTRA BRI PCI */
#define M_PCI_DATA 0x00 /* MAESTRA BRI PCI */
#define M_PCI_RESET 0x10 /* MAESTRA BRI PCI */
/*----------------------------------------------------------------------------
// MAESTRA PRI PCI */
#define MP_IRQ_RESET 0xc18 /* offset of isr in the CONFIG memory bar */
#define MP_IRQ_RESET_VAL 0xfe /* value to clear an interrupt */
#define MP_MEMORY_SIZE 0x00400000 /* 4MB on standard PRI */
#define MP2_MEMORY_SIZE 0x00800000 /* 8MB on PRI Rev. 2 */
#define MP_SHARED_RAM_OFFSET 0x00001000 /* offset of shared RAM base in the DRAM memory bar */
#define MP_SHARED_RAM_SIZE 0x00010000 /* 64k shared RAM */
#define MP_PROTOCOL_OFFSET (MP_SHARED_RAM_OFFSET + MP_SHARED_RAM_SIZE)
#define MP_RAY_TAYLOR_DSP_CODE_SIZE 0x00040000 /* max 256k DSP-Code (Ray Taylor's code) */
#define MP_ORG_MAX_DSP_CODE_SIZE 0x00060000 /* max 384k DSP-Code (Telindus) */
#define MP_V90D_MAX_DSP_CODE_SIZE 0x00070000 /* max 448k DSP-Code if V.90D included) */
#define MP_VOIP_MAX_DSP_CODE_SIZE 0x00090000 /* max 576k DSP-Code if voice over IP included */
#define MP_CACHED_ADDR(x) (((x) & 0x1fffffffL) | 0x80000000L)
#define MP_UNCACHED_ADDR(x) (((x) & 0x1fffffffL) | 0xa0000000L)
#define MP_RESET 0x20 /* offset of RESET register in the DEVICES memory bar */
/* RESET register bits */
#define _MP_S2M_RESET 0x10 /* active lo */
#define _MP_LED2 0x08 /* 1 = on */
#define _MP_LED1 0x04 /* 1 = on */
#define _MP_DSP_RESET 0x02 /* active lo */
#define _MP_RISC_RESET 0x81 /* active hi, bit 7 for compatibility with old boards */
/* CPU exception context structure in MP shared ram after trap */
typedef struct mp_xcptcontext_s MP_XCPTC;
struct mp_xcptcontext_s {
dword sr;
dword cr;
dword epc;
dword vaddr;
dword regs[32];
dword mdlo;
dword mdhi;
dword reseverd;
dword xclass;
};
/* boot interface structure for PRI */
struct mp_load {
dword volatile cmd;
dword volatile addr;
dword volatile len;
dword volatile err;
dword volatile live;
dword volatile res1[0x1b];
dword volatile TrapId; /* has value 0x999999XX on a CPU trap */
dword volatile res2[0x03];
MP_XCPTC volatile xcpt; /* contains register dump */
dword volatile rest[((0x1020 >> 2) - 6) - 0x1b - 1 - 0x03 - (sizeof(MP_XCPTC) >> 2)];
dword volatile signature;
dword data[60000]; /* real interface description */
};
/*----------------------------------------------------------------------------*/
/* SERVER 4BRI (Quattro PCI) */
#define MQ_BOARD_REG_OFFSET 0x800000 /* PC relative On board registers offset */
#define MQ_BREG_RISC 0x1200 /* RISC Reset ect */
#define MQ_RISC_COLD_RESET_MASK 0x0001 /* RISC Cold reset */
#define MQ_RISC_WARM_RESET_MASK 0x0002 /* RISC Warm reset */
#define MQ_BREG_IRQ_TEST 0x0608 /* Interrupt request, no CPU interaction */
#define MQ_IRQ_REQ_ON 0x1
#define MQ_IRQ_REQ_OFF 0x0
#define MQ_BOARD_DSP_OFFSET 0xa00000 /* PC relative On board DSP regs offset */
#define MQ_DSP1_ADDR_OFFSET 0x0008 /* Addr register offset DSP 1 subboard 1 */
#define MQ_DSP2_ADDR_OFFSET 0x0208 /* Addr register offset DSP 2 subboard 1 */
#define MQ_DSP1_DATA_OFFSET 0x0000 /* Data register offset DSP 1 subboard 1 */
#define MQ_DSP2_DATA_OFFSET 0x0200 /* Data register offset DSP 2 subboard 1 */
#define MQ_DSP_JUNK_OFFSET 0x0400 /* DSP Data/Addr regs subboard offset */
#define MQ_ISAC_DSP_RESET 0x0028 /* ISAC and DSP reset address offset */
#define MQ_BOARD_ISAC_DSP_RESET 0x800028 /* ISAC and DSP reset address offset */
#define MQ_INSTANCE_COUNT 4 /* 4BRI consists of four instances */
#define MQ_MEMORY_SIZE 0x00400000 /* 4MB on standard 4BRI */
#define MQ_CTRL_SIZE 0x00002000 /* 8K memory mapped registers */
#define MQ_SHARED_RAM_SIZE 0x00010000 /* 64k shared RAM */
#define MQ_ORG_MAX_DSP_CODE_SIZE 0x00050000 /* max 320k DSP-Code (Telindus) */
#define MQ_V90D_MAX_DSP_CODE_SIZE 0x00060000 /* max 384K DSP-Code if V.90D included */
#define MQ_VOIP_MAX_DSP_CODE_SIZE 0x00028000 /* max 4*160k = 640K DSP-Code if voice over IP included */
#define MQ_CACHED_ADDR(x) (((x) & 0x1fffffffL) | 0x80000000L)
#define MQ_UNCACHED_ADDR(x) (((x) & 0x1fffffffL) | 0xa0000000L)
/*--------------------------------------------------------------------------------------------*/
/* Additional definitions reflecting the different address map of the SERVER 4BRI V2 */
#define MQ2_BREG_RISC 0x0200 /* RISC Reset ect */
#define MQ2_BREG_IRQ_TEST 0x0400 /* Interrupt request, no CPU interaction */
#define MQ2_BOARD_DSP_OFFSET 0x800000 /* PC relative On board DSP regs offset */
#define MQ2_DSP1_DATA_OFFSET 0x1800 /* Data register offset DSP 1 subboard 1 */
#define MQ2_DSP1_ADDR_OFFSET 0x1808 /* Addr register offset DSP 1 subboard 1 */
#define MQ2_DSP2_DATA_OFFSET 0x1810 /* Data register offset DSP 2 subboard 1 */
#define MQ2_DSP2_ADDR_OFFSET 0x1818 /* Addr register offset DSP 2 subboard 1 */
#define MQ2_DSP_JUNK_OFFSET 0x1000 /* DSP Data/Addr regs subboard offset */
#define MQ2_ISAC_DSP_RESET 0x0000 /* ISAC and DSP reset address offset */
#define MQ2_BOARD_ISAC_DSP_RESET 0x800000 /* ISAC and DSP reset address offset */
#define MQ2_IPACX_CONFIG 0x0300 /* IPACX Configuration TE(0)/NT(1) */
#define MQ2_BOARD_IPACX_CONFIG 0x800300 /* "" */
#define MQ2_MEMORY_SIZE 0x01000000 /* 16MB code/data memory */
#define MQ2_CTRL_SIZE 0x00008000 /* 32K memory mapped registers */
/*----------------------------------------------------------------------------*/
/* SERVER BRI 2M/2F as derived from 4BRI V2 */
#define BRI2_MEMORY_SIZE 0x00800000 /* 8MB code/data memory */
#define BRI2_PROTOCOL_MEMORY_SIZE (MQ2_MEMORY_SIZE >> 2) /* same as one 4BRI Rev.2 task */
#define BRI2_CTRL_SIZE 0x00008000 /* 32K memory mapped registers */
#define M_INSTANCE_COUNT 1 /* BRI consists of one instance */
/*
* Some useful constants for proper initialization of the GT6401x
*/
#define ID_REG 0x0000 /*Pci reg-contain the Dev&Ven ID of the card*/
#define RAS0_BASEREG 0x0010 /*Ras0 register - contain the base addr Ras0*/
#define RAS2_BASEREG 0x0014
#define CS_BASEREG 0x0018
#define BOOT_BASEREG 0x001c
#define GTREGS_BASEREG 0x0024 /*GTRegsBase reg-contain the base addr where*/
/*the GT64010 internal regs where mapped */
/*
* GT64010 internal registers
*/
/* DRAM device coding */
#define LOW_RAS0_DREG 0x0400 /*Ras0 low decode address*/
#define HI_RAS0_DREG 0x0404 /*Ras0 high decode address*/
#define LOW_RAS1_DREG 0x0408 /*Ras1 low decode address*/
#define HI_RAS1_DREG 0x040c /*Ras1 high decode address*/
#define LOW_RAS2_DREG 0x0410 /*Ras2 low decode address*/
#define HI_RAS2_DREG 0x0414 /*Ras2 high decode address*/
#define LOW_RAS3_DREG 0x0418 /*Ras3 low decode address*/
#define HI_RAS3_DREG 0x041c /*Ras3 high decode address*/
/* I/O CS device coding */
#define LOW_CS0_DREG 0x0420 /* CS0* low decode register */
#define HI_CS0_DREG 0x0424 /* CS0* high decode register */
#define LOW_CS1_DREG 0x0428 /* CS1* low decode register */
#define HI_CS1_DREG 0x042c /* CS1* high decode register */
#define LOW_CS2_DREG 0x0430 /* CS2* low decode register */
#define HI_CS2_DREG 0x0434 /* CS2* high decode register */
#define LOW_CS3_DREG 0x0438 /* CS3* low decode register */
#define HI_CS3_DREG 0x043c /* CS3* high decode register */
/* Boot PROM device coding */
#define LOW_BOOTCS_DREG 0x0440 /* Boot CS low decode register */
#define HI_BOOTCS_DREG 0x0444 /* Boot CS High decode register */
/* DRAM group coding (for CPU) */
#define LO_RAS10_GREG 0x0008 /*Ras1..0 group low decode address*/
#define HI_RAS10_GREG 0x0010 /*Ras1..0 group high decode address*/
#define LO_RAS32_GREG 0x0018 /*Ras3..2 group low decode address */
#define HI_RAS32_GREG 0x0020 /*Ras3..2 group high decode address */
/* I/O CS group coding for (CPU) */
#define LO_CS20_GREG 0x0028 /* CS2..0 group low decode register */
#define HI_CS20_GREG 0x0030 /* CS2..0 group high decode register */
#define LO_CS3B_GREG 0x0038 /* CS3 & PROM group low decode register */
#define HI_CS3B_GREG 0x0040 /* CS3 & PROM group high decode register */
/* Galileo specific PCI config. */
#define PCI_TIMEOUT_RET 0x0c04 /* Time Out and retry register */
#define RAS10_BANKSIZE 0x0c08 /* RAS 1..0 group PCI bank size */
#define RAS32_BANKSIZE 0x0c0c /* RAS 3..2 group PCI bank size */
#define CS20_BANKSIZE 0x0c10 /* CS 2..0 group PCI bank size */
#define CS3B_BANKSIZE 0x0c14 /* CS 3 & Boot group PCI bank size */
#define DRAM_SIZE 0x0001 /*Dram size in mega bytes*/
#define PROM_SIZE 0x08000 /*Prom size in bytes*/
/*--------------------------------------------------------------------------*/
#define OFFS_DIVA_INIT_TASK_COUNT 0x68
#define OFFS_DSP_CODE_BASE_ADDR 0x6c
#define OFFS_XLOG_BUF_ADDR 0x70
#define OFFS_XLOG_COUNT_ADDR 0x74
#define OFFS_XLOG_OUT_ADDR 0x78
#define OFFS_PROTOCOL_END_ADDR 0x7c
#define OFFS_PROTOCOL_ID_STRING 0x80
/*--------------------------------------------------------------------------*/

View File

@ -1,370 +0,0 @@
/* $Id: mntfunc.c,v 1.19.6.4 2005/01/31 12:22:20 armin Exp $
*
* Driver for Eicon DIVA Server ISDN cards.
* Maint module
*
* Copyright 2000-2003 by Armin Schindler (mac@melware.de)
* Copyright 2000-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*/
#include "platform.h"
#include "di_defs.h"
#include "divasync.h"
#include "debug_if.h"
extern char *DRIVERRELEASE_MNT;
#define DBG_MINIMUM (DL_LOG + DL_FTL + DL_ERR)
#define DBG_DEFAULT (DBG_MINIMUM + DL_XLOG + DL_REG)
extern void DIVA_DIDD_Read(void *, int);
static dword notify_handle;
static DESCRIPTOR DAdapter;
static DESCRIPTOR MAdapter;
static DESCRIPTOR MaintDescriptor =
{ IDI_DIMAINT, 0, 0, (IDI_CALL) diva_maint_prtComp };
extern int diva_os_copy_to_user(void *os_handle, void __user *dst,
const void *src, int length);
extern int diva_os_copy_from_user(void *os_handle, void *dst,
const void __user *src, int length);
static void no_printf(unsigned char *x, ...)
{
/* dummy debug function */
}
#include "debuglib.c"
/*
* DIDD callback function
*/
static void *didd_callback(void *context, DESCRIPTOR *adapter,
int removal)
{
if (adapter->type == IDI_DADAPTER) {
DBG_ERR(("cb: Change in DAdapter ? Oops ?."));
} else if (adapter->type == IDI_DIMAINT) {
if (removal) {
DbgDeregister();
memset(&MAdapter, 0, sizeof(MAdapter));
dprintf = no_printf;
} else {
memcpy(&MAdapter, adapter, sizeof(MAdapter));
dprintf = (DIVA_DI_PRINTF) MAdapter.request;
DbgRegister("MAINT", DRIVERRELEASE_MNT, DBG_DEFAULT);
}
} else if ((adapter->type > 0) && (adapter->type < 16)) {
if (removal) {
diva_mnt_remove_xdi_adapter(adapter);
} else {
diva_mnt_add_xdi_adapter(adapter);
}
}
return (NULL);
}
/*
* connect to didd
*/
static int __init connect_didd(void)
{
int x = 0;
int dadapter = 0;
IDI_SYNC_REQ req;
DESCRIPTOR DIDD_Table[MAX_DESCRIPTORS];
DIVA_DIDD_Read(DIDD_Table, sizeof(DIDD_Table));
for (x = 0; x < MAX_DESCRIPTORS; x++) {
if (DIDD_Table[x].type == IDI_DADAPTER) { /* DADAPTER found */
dadapter = 1;
memcpy(&DAdapter, &DIDD_Table[x], sizeof(DAdapter));
req.didd_notify.e.Req = 0;
req.didd_notify.e.Rc =
IDI_SYNC_REQ_DIDD_REGISTER_ADAPTER_NOTIFY;
req.didd_notify.info.callback = (void *)didd_callback;
req.didd_notify.info.context = NULL;
DAdapter.request((ENTITY *)&req);
if (req.didd_notify.e.Rc != 0xff)
return (0);
notify_handle = req.didd_notify.info.handle;
/* Register MAINT (me) */
req.didd_add_adapter.e.Req = 0;
req.didd_add_adapter.e.Rc =
IDI_SYNC_REQ_DIDD_ADD_ADAPTER;
req.didd_add_adapter.info.descriptor =
(void *) &MaintDescriptor;
DAdapter.request((ENTITY *)&req);
if (req.didd_add_adapter.e.Rc != 0xff)
return (0);
} else if ((DIDD_Table[x].type > 0)
&& (DIDD_Table[x].type < 16)) {
diva_mnt_add_xdi_adapter(&DIDD_Table[x]);
}
}
return (dadapter);
}
/*
* disconnect from didd
*/
static void __exit disconnect_didd(void)
{
IDI_SYNC_REQ req;
req.didd_notify.e.Req = 0;
req.didd_notify.e.Rc = IDI_SYNC_REQ_DIDD_REMOVE_ADAPTER_NOTIFY;
req.didd_notify.info.handle = notify_handle;
DAdapter.request((ENTITY *)&req);
req.didd_remove_adapter.e.Req = 0;
req.didd_remove_adapter.e.Rc = IDI_SYNC_REQ_DIDD_REMOVE_ADAPTER;
req.didd_remove_adapter.info.p_request =
(IDI_CALL) MaintDescriptor.request;
DAdapter.request((ENTITY *)&req);
}
/*
* read/write maint
*/
int maint_read_write(void __user *buf, int count)
{
byte data[128];
dword cmd, id, mask;
int ret = 0;
if (count < (3 * sizeof(dword)))
return (-EFAULT);
if (diva_os_copy_from_user(NULL, (void *) &data[0],
buf, 3 * sizeof(dword))) {
return (-EFAULT);
}
cmd = *(dword *)&data[0]; /* command */
id = *(dword *)&data[4]; /* driver id */
mask = *(dword *)&data[8]; /* mask or size */
switch (cmd) {
case DITRACE_CMD_GET_DRIVER_INFO:
if ((ret = diva_get_driver_info(id, data, sizeof(data))) > 0) {
if ((count < ret) || diva_os_copy_to_user
(NULL, buf, (void *) &data[0], ret))
ret = -EFAULT;
} else {
ret = -EINVAL;
}
break;
case DITRACE_READ_DRIVER_DBG_MASK:
if ((ret = diva_get_driver_dbg_mask(id, (byte *) data)) > 0) {
if ((count < ret) || diva_os_copy_to_user
(NULL, buf, (void *) &data[0], ret))
ret = -EFAULT;
} else {
ret = -ENODEV;
}
break;
case DITRACE_WRITE_DRIVER_DBG_MASK:
if ((ret = diva_set_driver_dbg_mask(id, mask)) <= 0) {
ret = -ENODEV;
}
break;
/*
Filter commands will ignore the ID due to fact that filtering affects
the B- channel and Audio Tap trace levels only. Also MAINT driver will
select the right trace ID by itself
*/
case DITRACE_WRITE_SELECTIVE_TRACE_FILTER:
if (!mask) {
ret = diva_set_trace_filter(1, "*");
} else if (mask < sizeof(data)) {
if (diva_os_copy_from_user(NULL, data, (char __user *)buf + 12, mask)) {
ret = -EFAULT;
} else {
ret = diva_set_trace_filter((int)mask, data);
}
} else {
ret = -EINVAL;
}
break;
case DITRACE_READ_SELECTIVE_TRACE_FILTER:
if ((ret = diva_get_trace_filter(sizeof(data), data)) > 0) {
if (diva_os_copy_to_user(NULL, buf, data, ret))
ret = -EFAULT;
} else {
ret = -ENODEV;
}
break;
case DITRACE_READ_TRACE_ENTRY:{
diva_os_spin_lock_magic_t old_irql;
word size;
diva_dbg_entry_head_t *pmsg;
byte *pbuf;
if (!(pbuf = diva_os_malloc(0, mask))) {
return (-ENOMEM);
}
for (;;) {
if (!(pmsg =
diva_maint_get_message(&size, &old_irql))) {
break;
}
if (size > mask) {
diva_maint_ack_message(0, &old_irql);
ret = -EINVAL;
break;
}
ret = size;
memcpy(pbuf, pmsg, size);
diva_maint_ack_message(1, &old_irql);
if ((count < size) ||
diva_os_copy_to_user(NULL, buf, (void *) pbuf, size))
ret = -EFAULT;
break;
}
diva_os_free(0, pbuf);
}
break;
case DITRACE_READ_TRACE_ENTRYS:{
diva_os_spin_lock_magic_t old_irql;
word size;
diva_dbg_entry_head_t *pmsg;
byte *pbuf = NULL;
int written = 0;
if (mask < 4096) {
ret = -EINVAL;
break;
}
if (!(pbuf = diva_os_malloc(0, mask))) {
return (-ENOMEM);
}
for (;;) {
if (!(pmsg =
diva_maint_get_message(&size, &old_irql))) {
break;
}
if ((size + 8) > mask) {
diva_maint_ack_message(0, &old_irql);
break;
}
/*
Write entry length
*/
pbuf[written++] = (byte) size;
pbuf[written++] = (byte) (size >> 8);
pbuf[written++] = 0;
pbuf[written++] = 0;
/*
Write message
*/
memcpy(&pbuf[written], pmsg, size);
diva_maint_ack_message(1, &old_irql);
written += size;
mask -= (size + 4);
}
pbuf[written++] = 0;
pbuf[written++] = 0;
pbuf[written++] = 0;
pbuf[written++] = 0;
if ((count < written) || diva_os_copy_to_user(NULL, buf, (void *) pbuf, written)) {
ret = -EFAULT;
} else {
ret = written;
}
diva_os_free(0, pbuf);
}
break;
default:
ret = -EINVAL;
}
return (ret);
}
/*
* init
*/
int __init mntfunc_init(int *buffer_length, void **buffer,
unsigned long diva_dbg_mem)
{
if (*buffer_length < 64) {
*buffer_length = 64;
}
if (*buffer_length > 512) {
*buffer_length = 512;
}
*buffer_length *= 1024;
if (diva_dbg_mem) {
*buffer = (void *) diva_dbg_mem;
} else {
while ((*buffer_length >= (64 * 1024))
&&
(!(*buffer = diva_os_malloc(0, *buffer_length)))) {
*buffer_length -= 1024;
}
if (!*buffer) {
DBG_ERR(("init: Can not alloc trace buffer"));
return (0);
}
}
if (diva_maint_init(*buffer, *buffer_length, (diva_dbg_mem == 0))) {
if (!diva_dbg_mem) {
diva_os_free(0, *buffer);
}
DBG_ERR(("init: maint init failed"));
return (0);
}
if (!connect_didd()) {
DBG_ERR(("init: failed to connect to DIDD."));
diva_maint_finit();
if (!diva_dbg_mem) {
diva_os_free(0, *buffer);
}
return (0);
}
return (1);
}
/*
* exit
*/
void __exit mntfunc_finit(void)
{
void *buffer;
int i = 100;
DbgDeregister();
while (diva_mnt_shutdown_xdi_adapters() && i--) {
diva_os_sleep(10);
}
disconnect_didd();
if ((buffer = diva_maint_finit())) {
diva_os_free(0, buffer);
}
memset(&MAdapter, 0, sizeof(MAdapter));
dprintf = no_printf;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* $Id: os_4bri.h,v 1.1.2.2 2001/02/08 12:25:44 armin Exp $ */
#ifndef __DIVA_OS_4_BRI_H__
#define __DIVA_OS_4_BRI_H__
int diva_4bri_init_card(diva_os_xdi_adapter_t *a);
#endif

View File

@ -1,815 +0,0 @@
// SPDX-License-Identifier: GPL-2.0
/* $Id: os_bri.c,v 1.21 2004/03/21 17:26:01 armin Exp $ */
#include "platform.h"
#include "debuglib.h"
#include "cardtype.h"
#include "pc.h"
#include "pr_pc.h"
#include "di_defs.h"
#include "dsp_defs.h"
#include "di.h"
#include "io.h"
#include "xdi_msg.h"
#include "xdi_adapter.h"
#include "os_bri.h"
#include "diva_pci.h"
#include "mi_pc.h"
#include "pc_maint.h"
#include "dsrv_bri.h"
/*
** IMPORTS
*/
extern void prepare_maestra_functions(PISDN_ADAPTER IoAdapter);
extern void diva_xdi_display_adapter_features(int card);
extern int diva_card_read_xlog(diva_os_xdi_adapter_t *a);
/*
** LOCALS
*/
static int bri_bar_length[3] = {
0x80,
0x80,
0x20
};
static int diva_bri_cleanup_adapter(diva_os_xdi_adapter_t *a);
static dword diva_bri_get_serial_number(diva_os_xdi_adapter_t *a);
static int diva_bri_cmd_card_proc(struct _diva_os_xdi_adapter *a,
diva_xdi_um_cfg_cmd_t *cmd, int length);
static int diva_bri_reregister_io(diva_os_xdi_adapter_t *a);
static int diva_bri_reset_adapter(PISDN_ADAPTER IoAdapter);
static int diva_bri_write_sdram_block(PISDN_ADAPTER IoAdapter,
dword address,
const byte *data, dword length);
static int diva_bri_start_adapter(PISDN_ADAPTER IoAdapter,
dword start_address, dword features);
static int diva_bri_stop_adapter(diva_os_xdi_adapter_t *a);
static void diva_bri_set_addresses(diva_os_xdi_adapter_t *a)
{
a->resources.pci.mem_type_id[MEM_TYPE_RAM] = 0;
a->resources.pci.mem_type_id[MEM_TYPE_CFG] = 1;
a->resources.pci.mem_type_id[MEM_TYPE_ADDRESS] = 2;
a->resources.pci.mem_type_id[MEM_TYPE_RESET] = 1;
a->resources.pci.mem_type_id[MEM_TYPE_PORT] = 2;
a->resources.pci.mem_type_id[MEM_TYPE_CTLREG] = 2;
a->xdi_adapter.ram = a->resources.pci.addr[0];
a->xdi_adapter.cfg = a->resources.pci.addr[1];
a->xdi_adapter.Address = a->resources.pci.addr[2];
a->xdi_adapter.reset = a->xdi_adapter.cfg;
a->xdi_adapter.port = a->xdi_adapter.Address;
a->xdi_adapter.ctlReg = a->xdi_adapter.port + M_PCI_RESET;
a->xdi_adapter.reset += 0x4C; /* PLX 9050 !! */
}
/*
** BAR0 - MEM Addr - 0x80 - NOT USED
** BAR1 - I/O Addr - 0x80
** BAR2 - I/O Addr - 0x20
*/
int diva_bri_init_card(diva_os_xdi_adapter_t *a)
{
int bar;
dword bar2 = 0, bar2_length = 0xffffffff;
word cmd = 0, cmd_org;
byte Bus, Slot;
void *hdev;
byte __iomem *p;
/*
Set properties
*/
a->xdi_adapter.Properties = CardProperties[a->CardOrdinal];
DBG_LOG(("Load %s", a->xdi_adapter.Properties.Name))
/*
Get resources
*/
for (bar = 0; bar < 3; bar++) {
a->resources.pci.bar[bar] =
divasa_get_pci_bar(a->resources.pci.bus,
a->resources.pci.func, bar,
a->resources.pci.hdev);
if (!a->resources.pci.bar[bar]) {
DBG_ERR(("A: can't get BAR[%d]", bar))
return (-1);
}
}
a->resources.pci.irq =
(byte) divasa_get_pci_irq(a->resources.pci.bus,
a->resources.pci.func,
a->resources.pci.hdev);
if (!a->resources.pci.irq) {
DBG_ERR(("A: invalid irq"));
return (-1);
}
/*
Get length of I/O bar 2 - it is different by older
EEPROM version
*/
Bus = a->resources.pci.bus;
Slot = a->resources.pci.func;
hdev = a->resources.pci.hdev;
/*
Get plain original values of the BAR2 CDM registers
*/
PCIread(Bus, Slot, 0x18, &bar2, sizeof(bar2), hdev);
PCIread(Bus, Slot, 0x04, &cmd_org, sizeof(cmd_org), hdev);
/*
Disable device and get BAR2 length
*/
PCIwrite(Bus, Slot, 0x04, &cmd, sizeof(cmd), hdev);
PCIwrite(Bus, Slot, 0x18, &bar2_length, sizeof(bar2_length), hdev);
PCIread(Bus, Slot, 0x18, &bar2_length, sizeof(bar2_length), hdev);
/*
Restore BAR2 and CMD registers
*/
PCIwrite(Bus, Slot, 0x18, &bar2, sizeof(bar2), hdev);
PCIwrite(Bus, Slot, 0x04, &cmd_org, sizeof(cmd_org), hdev);
/*
Calculate BAR2 length
*/
bar2_length = (~(bar2_length & ~7)) + 1;
DBG_LOG(("BAR[2] length=%lx", bar2_length))
/*
Map and register resources
*/
if (!(a->resources.pci.addr[0] =
divasa_remap_pci_bar(a, 0, a->resources.pci.bar[0],
bri_bar_length[0]))) {
DBG_ERR(("A: BRI, can't map BAR[0]"))
diva_bri_cleanup_adapter(a);
return (-1);
}
sprintf(&a->port_name[0], "BRI %02x:%02x",
a->resources.pci.bus, a->resources.pci.func);
if (diva_os_register_io_port(a, 1, a->resources.pci.bar[1],
bri_bar_length[1], &a->port_name[0], 1)) {
DBG_ERR(("A: BRI, can't register BAR[1]"))
diva_bri_cleanup_adapter(a);
return (-1);
}
a->resources.pci.addr[1] = (void *) (unsigned long) a->resources.pci.bar[1];
a->resources.pci.length[1] = bri_bar_length[1];
if (diva_os_register_io_port(a, 1, a->resources.pci.bar[2],
bar2_length, &a->port_name[0], 2)) {
DBG_ERR(("A: BRI, can't register BAR[2]"))
diva_bri_cleanup_adapter(a);
return (-1);
}
a->resources.pci.addr[2] = (void *) (unsigned long) a->resources.pci.bar[2];
a->resources.pci.length[2] = bar2_length;
/*
Set all memory areas
*/
diva_bri_set_addresses(a);
/*
Get Serial Number
*/
a->xdi_adapter.serialNo = diva_bri_get_serial_number(a);
/*
Register I/O ports with correct name now
*/
if (diva_bri_reregister_io(a)) {
diva_bri_cleanup_adapter(a);
return (-1);
}
/*
Initialize OS dependent objects
*/
if (diva_os_initialize_spin_lock
(&a->xdi_adapter.isr_spin_lock, "isr")) {
diva_bri_cleanup_adapter(a);
return (-1);
}
if (diva_os_initialize_spin_lock
(&a->xdi_adapter.data_spin_lock, "data")) {
diva_bri_cleanup_adapter(a);
return (-1);
}
strcpy(a->xdi_adapter.req_soft_isr.dpc_thread_name, "kdivasbrid");
if (diva_os_initialize_soft_isr(&a->xdi_adapter.req_soft_isr,
DIDpcRoutine, &a->xdi_adapter)) {
diva_bri_cleanup_adapter(a);
return (-1);
}
/*
Do not initialize second DPC - only one thread will be created
*/
a->xdi_adapter.isr_soft_isr.object = a->xdi_adapter.req_soft_isr.object;
/*
Create entity table
*/
a->xdi_adapter.Channels = CardProperties[a->CardOrdinal].Channels;
a->xdi_adapter.e_max = CardProperties[a->CardOrdinal].E_info;
a->xdi_adapter.e_tbl = diva_os_malloc(0, a->xdi_adapter.e_max * sizeof(E_INFO));
if (!a->xdi_adapter.e_tbl) {
diva_bri_cleanup_adapter(a);
return (-1);
}
memset(a->xdi_adapter.e_tbl, 0x00, a->xdi_adapter.e_max * sizeof(E_INFO));
/*
Set up interface
*/
a->xdi_adapter.a.io = &a->xdi_adapter;
a->xdi_adapter.DIRequest = request;
a->interface.cleanup_adapter_proc = diva_bri_cleanup_adapter;
a->interface.cmd_proc = diva_bri_cmd_card_proc;
p = DIVA_OS_MEM_ATTACH_RESET(&a->xdi_adapter);
outpp(p, 0x41);
DIVA_OS_MEM_DETACH_RESET(&a->xdi_adapter, p);
prepare_maestra_functions(&a->xdi_adapter);
a->dsp_mask = 0x00000003;
/*
Set IRQ handler
*/
a->xdi_adapter.irq_info.irq_nr = a->resources.pci.irq;
sprintf(a->xdi_adapter.irq_info.irq_name, "DIVA BRI %ld",
(long) a->xdi_adapter.serialNo);
if (diva_os_register_irq(a, a->xdi_adapter.irq_info.irq_nr,
a->xdi_adapter.irq_info.irq_name)) {
diva_bri_cleanup_adapter(a);
return (-1);
}
a->xdi_adapter.irq_info.registered = 1;
diva_log_info("%s IRQ:%d SerNo:%d", a->xdi_adapter.Properties.Name,
a->resources.pci.irq, a->xdi_adapter.serialNo);
return (0);
}
static int diva_bri_cleanup_adapter(diva_os_xdi_adapter_t *a)
{
int i;
if (a->xdi_adapter.Initialized) {
diva_bri_stop_adapter(a);
}
/*
Remove ISR Handler
*/
if (a->xdi_adapter.irq_info.registered) {
diva_os_remove_irq(a, a->xdi_adapter.irq_info.irq_nr);
}
a->xdi_adapter.irq_info.registered = 0;
if (a->resources.pci.addr[0] && a->resources.pci.bar[0]) {
divasa_unmap_pci_bar(a->resources.pci.addr[0]);
a->resources.pci.addr[0] = NULL;
a->resources.pci.bar[0] = 0;
}
for (i = 1; i < 3; i++) {
if (a->resources.pci.addr[i] && a->resources.pci.bar[i]) {
diva_os_register_io_port(a, 0,
a->resources.pci.bar[i],
a->resources.pci.
length[i],
&a->port_name[0], i);
a->resources.pci.addr[i] = NULL;
a->resources.pci.bar[i] = 0;
}
}
/*
Free OS objects
*/
diva_os_cancel_soft_isr(&a->xdi_adapter.req_soft_isr);
diva_os_cancel_soft_isr(&a->xdi_adapter.isr_soft_isr);
diva_os_remove_soft_isr(&a->xdi_adapter.req_soft_isr);
a->xdi_adapter.isr_soft_isr.object = NULL;
diva_os_destroy_spin_lock(&a->xdi_adapter.isr_spin_lock, "rm");
diva_os_destroy_spin_lock(&a->xdi_adapter.data_spin_lock, "rm");
/*
Free memory
*/
if (a->xdi_adapter.e_tbl) {
diva_os_free(0, a->xdi_adapter.e_tbl);
a->xdi_adapter.e_tbl = NULL;
}
return (0);
}
void diva_os_prepare_maestra_functions(PISDN_ADAPTER IoAdapter)
{
}
/*
** Get serial number
*/
static dword diva_bri_get_serial_number(diva_os_xdi_adapter_t *a)
{
dword serNo = 0;
byte __iomem *confIO;
word serHi, serLo;
word __iomem *confMem;
confIO = DIVA_OS_MEM_ATTACH_CFG(&a->xdi_adapter);
serHi = (word) (inppw(&confIO[0x22]) & 0x0FFF);
serLo = (word) (inppw(&confIO[0x26]) & 0x0FFF);
serNo = ((dword) serHi << 16) | (dword) serLo;
DIVA_OS_MEM_DETACH_CFG(&a->xdi_adapter, confIO);
if ((serNo == 0) || (serNo == 0xFFFFFFFF)) {
DBG_FTL(("W: BRI use BAR[0] to get card serial number"))
confMem = (word __iomem *)DIVA_OS_MEM_ATTACH_RAM(&a->xdi_adapter);
serHi = (word) (READ_WORD(&confMem[0x11]) & 0x0FFF);
serLo = (word) (READ_WORD(&confMem[0x13]) & 0x0FFF);
serNo = (((dword) serHi) << 16) | ((dword) serLo);
DIVA_OS_MEM_DETACH_RAM(&a->xdi_adapter, confMem);
}
DBG_LOG(("Serial Number=%ld", serNo))
return (serNo);
}
/*
** Unregister I/O and register it with new name,
** based on Serial Number
*/
static int diva_bri_reregister_io(diva_os_xdi_adapter_t *a)
{
int i;
for (i = 1; i < 3; i++) {
diva_os_register_io_port(a, 0, a->resources.pci.bar[i],
a->resources.pci.length[i],
&a->port_name[0], i);
a->resources.pci.addr[i] = NULL;
}
sprintf(a->port_name, "DIVA BRI %ld",
(long) a->xdi_adapter.serialNo);
for (i = 1; i < 3; i++) {
if (diva_os_register_io_port(a, 1, a->resources.pci.bar[i],
a->resources.pci.length[i],
&a->port_name[0], i)) {
DBG_ERR(("A: failed to reregister BAR[%d]", i))
return (-1);
}
a->resources.pci.addr[i] =
(void *) (unsigned long) a->resources.pci.bar[i];
}
return (0);
}
/*
** Process command from user mode
*/
static int
diva_bri_cmd_card_proc(struct _diva_os_xdi_adapter *a,
diva_xdi_um_cfg_cmd_t *cmd, int length)
{
int ret = -1;
if (cmd->adapter != a->controller) {
DBG_ERR(("A: pri_cmd, invalid controller=%d != %d",
cmd->adapter, a->controller))
return (-1);
}
switch (cmd->command) {
case DIVA_XDI_UM_CMD_GET_CARD_ORDINAL:
a->xdi_mbox.data_length = sizeof(dword);
a->xdi_mbox.data =
diva_os_malloc(0, a->xdi_mbox.data_length);
if (a->xdi_mbox.data) {
*(dword *) a->xdi_mbox.data =
(dword) a->CardOrdinal;
a->xdi_mbox.status = DIVA_XDI_MBOX_BUSY;
ret = 0;
}
break;
case DIVA_XDI_UM_CMD_GET_SERIAL_NR:
a->xdi_mbox.data_length = sizeof(dword);
a->xdi_mbox.data =
diva_os_malloc(0, a->xdi_mbox.data_length);
if (a->xdi_mbox.data) {
*(dword *) a->xdi_mbox.data =
(dword) a->xdi_adapter.serialNo;
a->xdi_mbox.status = DIVA_XDI_MBOX_BUSY;
ret = 0;
}
break;
case DIVA_XDI_UM_CMD_GET_PCI_HW_CONFIG:
a->xdi_mbox.data_length = sizeof(dword) * 9;
a->xdi_mbox.data =
diva_os_malloc(0, a->xdi_mbox.data_length);
if (a->xdi_mbox.data) {
int i;
dword *data = (dword *) a->xdi_mbox.data;
for (i = 0; i < 8; i++) {
*data++ = a->resources.pci.bar[i];
}
*data++ = (dword) a->resources.pci.irq;
a->xdi_mbox.status = DIVA_XDI_MBOX_BUSY;
ret = 0;
}
break;
case DIVA_XDI_UM_CMD_GET_CARD_STATE:
a->xdi_mbox.data_length = sizeof(dword);
a->xdi_mbox.data =
diva_os_malloc(0, a->xdi_mbox.data_length);
if (a->xdi_mbox.data) {
dword *data = (dword *) a->xdi_mbox.data;
if (!a->xdi_adapter.port) {
*data = 3;
} else if (a->xdi_adapter.trapped) {
*data = 2;
} else if (a->xdi_adapter.Initialized) {
*data = 1;
} else {
*data = 0;
}
a->xdi_mbox.status = DIVA_XDI_MBOX_BUSY;
ret = 0;
}
break;
case DIVA_XDI_UM_CMD_RESET_ADAPTER:
ret = diva_bri_reset_adapter(&a->xdi_adapter);
break;
case DIVA_XDI_UM_CMD_WRITE_SDRAM_BLOCK:
ret = diva_bri_write_sdram_block(&a->xdi_adapter,
cmd->command_data.
write_sdram.offset,
(byte *)&cmd[1],
cmd->command_data.
write_sdram.length);
break;
case DIVA_XDI_UM_CMD_START_ADAPTER:
ret = diva_bri_start_adapter(&a->xdi_adapter,
cmd->command_data.start.
offset,
cmd->command_data.start.
features);
break;
case DIVA_XDI_UM_CMD_SET_PROTOCOL_FEATURES:
a->xdi_adapter.features =
cmd->command_data.features.features;
a->xdi_adapter.a.protocol_capabilities =
a->xdi_adapter.features;
DBG_TRC(
("Set raw protocol features (%08x)",
a->xdi_adapter.features)) ret = 0;
break;
case DIVA_XDI_UM_CMD_STOP_ADAPTER:
ret = diva_bri_stop_adapter(a);
break;
case DIVA_XDI_UM_CMD_READ_XLOG_ENTRY:
ret = diva_card_read_xlog(a);
break;
default:
DBG_ERR(
("A: A(%d) invalid cmd=%d", a->controller,
cmd->command))}
return (ret);
}
static int diva_bri_reset_adapter(PISDN_ADAPTER IoAdapter)
{
byte __iomem *addrHi, *addrLo, *ioaddr;
dword i;
byte __iomem *Port;
if (!IoAdapter->port) {
return (-1);
}
if (IoAdapter->Initialized) {
DBG_ERR(("A: A(%d) can't reset BRI adapter - please stop first",
IoAdapter->ANum)) return (-1);
}
(*(IoAdapter->rstFnc)) (IoAdapter);
diva_os_wait(100);
Port = DIVA_OS_MEM_ATTACH_PORT(IoAdapter);
addrHi = Port +
((IoAdapter->Properties.Bus == BUS_PCI) ? M_PCI_ADDRH : ADDRH);
addrLo = Port + ADDR;
ioaddr = Port + DATA;
/*
recover
*/
outpp(addrHi, (byte) 0);
outppw(addrLo, (word) 0);
outppw(ioaddr, (word) 0);
/*
clear shared memory
*/
outpp(addrHi,
(byte) (
(IoAdapter->MemoryBase + IoAdapter->MemorySize -
BRI_SHARED_RAM_SIZE) >> 16));
outppw(addrLo, 0);
for (i = 0; i < 0x8000; outppw(ioaddr, 0), ++i);
diva_os_wait(100);
/*
clear signature
*/
outpp(addrHi,
(byte) (
(IoAdapter->MemoryBase + IoAdapter->MemorySize -
BRI_SHARED_RAM_SIZE) >> 16));
outppw(addrLo, 0x1e);
outpp(ioaddr, 0);
outpp(ioaddr, 0);
outpp(addrHi, (byte) 0);
outppw(addrLo, (word) 0);
outppw(ioaddr, (word) 0);
DIVA_OS_MEM_DETACH_PORT(IoAdapter, Port);
/*
Forget all outstanding entities
*/
IoAdapter->e_count = 0;
if (IoAdapter->e_tbl) {
memset(IoAdapter->e_tbl, 0x00,
IoAdapter->e_max * sizeof(E_INFO));
}
IoAdapter->head = 0;
IoAdapter->tail = 0;
IoAdapter->assign = 0;
IoAdapter->trapped = 0;
memset(&IoAdapter->a.IdTable[0], 0x00,
sizeof(IoAdapter->a.IdTable));
memset(&IoAdapter->a.IdTypeTable[0], 0x00,
sizeof(IoAdapter->a.IdTypeTable));
memset(&IoAdapter->a.FlowControlIdTable[0], 0x00,
sizeof(IoAdapter->a.FlowControlIdTable));
memset(&IoAdapter->a.FlowControlSkipTable[0], 0x00,
sizeof(IoAdapter->a.FlowControlSkipTable));
memset(&IoAdapter->a.misc_flags_table[0], 0x00,
sizeof(IoAdapter->a.misc_flags_table));
memset(&IoAdapter->a.rx_stream[0], 0x00,
sizeof(IoAdapter->a.rx_stream));
memset(&IoAdapter->a.tx_stream[0], 0x00,
sizeof(IoAdapter->a.tx_stream));
memset(&IoAdapter->a.tx_pos[0], 0x00, sizeof(IoAdapter->a.tx_pos));
memset(&IoAdapter->a.rx_pos[0], 0x00, sizeof(IoAdapter->a.rx_pos));
return (0);
}
static int
diva_bri_write_sdram_block(PISDN_ADAPTER IoAdapter,
dword address, const byte *data, dword length)
{
byte __iomem *addrHi, *addrLo, *ioaddr;
byte __iomem *Port;
if (!IoAdapter->port) {
return (-1);
}
Port = DIVA_OS_MEM_ATTACH_PORT(IoAdapter);
addrHi = Port +
((IoAdapter->Properties.Bus == BUS_PCI) ? M_PCI_ADDRH : ADDRH);
addrLo = Port + ADDR;
ioaddr = Port + DATA;
while (length--) {
outpp(addrHi, (word) (address >> 16));
outppw(addrLo, (word) (address & 0x0000ffff));
outpp(ioaddr, *data++);
address++;
}
DIVA_OS_MEM_DETACH_PORT(IoAdapter, Port);
return (0);
}
static int
diva_bri_start_adapter(PISDN_ADAPTER IoAdapter,
dword start_address, dword features)
{
byte __iomem *Port;
dword i, test;
byte __iomem *addrHi, *addrLo, *ioaddr;
int started = 0;
ADAPTER *a = &IoAdapter->a;
if (IoAdapter->Initialized) {
DBG_ERR(
("A: A(%d) bri_start_adapter, adapter already running",
IoAdapter->ANum)) return (-1);
}
if (!IoAdapter->port) {
DBG_ERR(("A: A(%d) bri_start_adapter, adapter not mapped",
IoAdapter->ANum)) return (-1);
}
sprintf(IoAdapter->Name, "A(%d)", (int) IoAdapter->ANum);
DBG_LOG(("A(%d) start BRI", IoAdapter->ANum))
Port = DIVA_OS_MEM_ATTACH_PORT(IoAdapter);
addrHi = Port +
((IoAdapter->Properties.Bus == BUS_PCI) ? M_PCI_ADDRH : ADDRH);
addrLo = Port + ADDR;
ioaddr = Port + DATA;
outpp(addrHi,
(byte) (
(IoAdapter->MemoryBase + IoAdapter->MemorySize -
BRI_SHARED_RAM_SIZE) >> 16));
outppw(addrLo, 0x1e);
outppw(ioaddr, 0x00);
DIVA_OS_MEM_DETACH_PORT(IoAdapter, Port);
/*
start the protocol code
*/
Port = DIVA_OS_MEM_ATTACH_CTLREG(IoAdapter);
outpp(Port, 0x08);
DIVA_OS_MEM_DETACH_CTLREG(IoAdapter, Port);
Port = DIVA_OS_MEM_ATTACH_PORT(IoAdapter);
addrHi = Port +
((IoAdapter->Properties.Bus == BUS_PCI) ? M_PCI_ADDRH : ADDRH);
addrLo = Port + ADDR;
ioaddr = Port + DATA;
/*
wait for signature (max. 3 seconds)
*/
for (i = 0; i < 300; ++i) {
diva_os_wait(10);
outpp(addrHi,
(byte) (
(IoAdapter->MemoryBase +
IoAdapter->MemorySize -
BRI_SHARED_RAM_SIZE) >> 16));
outppw(addrLo, 0x1e);
test = (dword) inppw(ioaddr);
if (test == 0x4447) {
DBG_LOG(
("Protocol startup time %d.%02d seconds",
(i / 100), (i % 100)))
started = 1;
break;
}
}
DIVA_OS_MEM_DETACH_PORT(IoAdapter, Port);
if (!started) {
DBG_FTL(("A: A(%d) %s: Adapter selftest failed 0x%04X",
IoAdapter->ANum, IoAdapter->Properties.Name,
test))
(*(IoAdapter->trapFnc)) (IoAdapter);
return (-1);
}
IoAdapter->Initialized = 1;
/*
Check Interrupt
*/
IoAdapter->IrqCount = 0;
a->ReadyInt = 1;
if (IoAdapter->reset) {
Port = DIVA_OS_MEM_ATTACH_RESET(IoAdapter);
outpp(Port, 0x41);
DIVA_OS_MEM_DETACH_RESET(IoAdapter, Port);
}
a->ram_out(a, &PR_RAM->ReadyInt, 1);
for (i = 0; ((!IoAdapter->IrqCount) && (i < 100)); i++) {
diva_os_wait(10);
}
if (!IoAdapter->IrqCount) {
DBG_ERR(
("A: A(%d) interrupt test failed",
IoAdapter->ANum))
IoAdapter->Initialized = 0;
IoAdapter->stop(IoAdapter);
return (-1);
}
IoAdapter->Properties.Features = (word) features;
diva_xdi_display_adapter_features(IoAdapter->ANum);
DBG_LOG(("A(%d) BRI adapter successfully started", IoAdapter->ANum))
/*
Register with DIDD
*/
diva_xdi_didd_register_adapter(IoAdapter->ANum);
return (0);
}
static void diva_bri_clear_interrupts(diva_os_xdi_adapter_t *a)
{
PISDN_ADAPTER IoAdapter = &a->xdi_adapter;
/*
clear any pending interrupt
*/
IoAdapter->disIrq(IoAdapter);
IoAdapter->tst_irq(&IoAdapter->a);
IoAdapter->clr_irq(&IoAdapter->a);
IoAdapter->tst_irq(&IoAdapter->a);
/*
kill pending dpcs
*/
diva_os_cancel_soft_isr(&IoAdapter->req_soft_isr);
diva_os_cancel_soft_isr(&IoAdapter->isr_soft_isr);
}
/*
** Stop card
*/
static int diva_bri_stop_adapter(diva_os_xdi_adapter_t *a)
{
PISDN_ADAPTER IoAdapter = &a->xdi_adapter;
int i = 100;
if (!IoAdapter->port) {
return (-1);
}
if (!IoAdapter->Initialized) {
DBG_ERR(("A: A(%d) can't stop BRI adapter - not running",
IoAdapter->ANum))
return (-1); /* nothing to stop */
}
IoAdapter->Initialized = 0;
/*
Disconnect Adapter from DIDD
*/
diva_xdi_didd_remove_adapter(IoAdapter->ANum);
/*
Stop interrupts
*/
a->clear_interrupts_proc = diva_bri_clear_interrupts;
IoAdapter->a.ReadyInt = 1;
IoAdapter->a.ram_inc(&IoAdapter->a, &PR_RAM->ReadyInt);
do {
diva_os_sleep(10);
} while (i-- && a->clear_interrupts_proc);
if (a->clear_interrupts_proc) {
diva_bri_clear_interrupts(a);
a->clear_interrupts_proc = NULL;
DBG_ERR(("A: A(%d) no final interrupt from BRI adapter",
IoAdapter->ANum))
}
IoAdapter->a.ReadyInt = 0;
/*
Stop and reset adapter
*/
IoAdapter->stop(IoAdapter);
return (0);
}

View File

@ -1,9 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* $Id: os_bri.h,v 1.1.2.2 2001/02/08 12:25:44 armin Exp $ */
#ifndef __DIVA_OS_BRI_REV_1_H__
#define __DIVA_OS_BRI_REV_1_H__
int diva_bri_init_card(diva_os_xdi_adapter_t *a);
#endif

View File

@ -1,21 +0,0 @@
/* $Id: os_capi.h,v 1.7 2003/04/12 21:40:49 schindler Exp $
*
* ISDN interface module for Eicon active cards DIVA.
* CAPI Interface OS include files
*
* Copyright 2000-2003 by Armin Schindler (mac@melware.de)
* Copyright 2000-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*/
#ifndef __OS_CAPI_H__
#define __OS_CAPI_H__
#include <linux/capi.h>
#include <linux/kernelcapi.h>
#include <linux/isdn/capiutil.h>
#include <linux/isdn/capilli.h>
#endif /* __OS_CAPI_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* $Id: os_pri.h,v 1.1.2.2 2001/02/08 12:25:44 armin Exp $ */
#ifndef __DIVA_OS_PRI_REV_1_H__
#define __DIVA_OS_PRI_REV_1_H__
int diva_pri_init_card(diva_os_xdi_adapter_t *a);
#endif

View File

@ -1,738 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef PC_H_INCLUDED /* { */
#define PC_H_INCLUDED
/*------------------------------------------------------------------*/
/* buffer definition */
/*------------------------------------------------------------------*/
typedef struct {
word length; /* length of data/parameter field */
byte P[270]; /* data/parameter field */
} PBUFFER;
/*------------------------------------------------------------------*/
/* dual port ram structure */
/*------------------------------------------------------------------*/
struct dual
{
byte Req; /* request register */
byte ReqId; /* request task/entity identification */
byte Rc; /* return code register */
byte RcId; /* return code task/entity identification */
byte Ind; /* Indication register */
byte IndId; /* Indication task/entity identification */
byte IMask; /* Interrupt Mask Flag */
byte RNR; /* Receiver Not Ready (set by PC) */
byte XLock; /* XBuffer locked Flag */
byte Int; /* ISDN-S interrupt */
byte ReqCh; /* Channel field for layer-3 Requests */
byte RcCh; /* Channel field for layer-3 Returncodes */
byte IndCh; /* Channel field for layer-3 Indications */
byte MInd; /* more data indication field */
word MLength; /* more data total packet length */
byte ReadyInt; /* request field for ready interrupt */
byte SWReg; /* Software register for special purposes */
byte Reserved[11]; /* reserved space */
byte InterfaceType; /* interface type 1=16K interface */
word Signature; /* ISDN-S adapter Signature (GD) */
PBUFFER XBuffer; /* Transmit Buffer */
PBUFFER RBuffer; /* Receive Buffer */
};
/*------------------------------------------------------------------*/
/* SWReg Values (0 means no command) */
/*------------------------------------------------------------------*/
#define SWREG_DIE_WITH_LEDON 0x01
#define SWREG_HALT_CPU 0x02 /* Push CPU into a while (1) loop */
/*------------------------------------------------------------------*/
/* Id Fields Coding */
/*------------------------------------------------------------------*/
#define ID_MASK 0xe0 /* Mask for the ID field */
#define GL_ERR_ID 0x1f /* ID for error reporting on global requests*/
#define DSIG_ID 0x00 /* ID for D-channel signaling */
#define NL_ID 0x20 /* ID for network-layer access (B or D) */
#define BLLC_ID 0x60 /* ID for B-channel link level access */
#define TASK_ID 0x80 /* ID for dynamic user tasks */
#define TIMER_ID 0xa0 /* ID for timer task */
#define TEL_ID 0xc0 /* ID for telephone support */
#define MAN_ID 0xe0 /* ID for management */
/*------------------------------------------------------------------*/
/* ASSIGN and REMOVE requests are the same for all entities */
/*------------------------------------------------------------------*/
#define ASSIGN 0x01
#define UREMOVE 0xfe /* without return code */
#define REMOVE 0xff
/*------------------------------------------------------------------*/
/* Timer Interrupt Task Interface */
/*------------------------------------------------------------------*/
#define ASSIGN_TIM 0x01
#define REMOVE_TIM 0xff
/*------------------------------------------------------------------*/
/* dynamic user task interface */
/*------------------------------------------------------------------*/
#define ASSIGN_TSK 0x01
#define REMOVE_TSK 0xff
#define LOAD 0xf0
#define RELOCATE 0xf1
#define START 0xf2
#define LOAD2 0xf3
#define RELOCATE2 0xf4
/*------------------------------------------------------------------*/
/* dynamic user task messages */
/*------------------------------------------------------------------*/
#define TSK_B2 0x0000
#define TSK_WAKEUP 0x2000
#define TSK_TIMER 0x4000
#define TSK_TSK 0x6000
#define TSK_PC 0xe000
/*------------------------------------------------------------------*/
/* LL management primitives */
/*------------------------------------------------------------------*/
#define ASSIGN_LL 1 /* assign logical link */
#define REMOVE_LL 0xff /* remove logical link */
/*------------------------------------------------------------------*/
/* LL service primitives */
/*------------------------------------------------------------------*/
#define LL_UDATA 1 /* link unit data request/indication */
#define LL_ESTABLISH 2 /* link establish request/indication */
#define LL_RELEASE 3 /* link release request/indication */
#define LL_DATA 4 /* data request/indication */
#define LL_LOCAL 5 /* switch to local operation (COM only) */
#define LL_DATA_PEND 5 /* data pending indication (SDLC SHM only) */
#define LL_REMOTE 6 /* switch to remote operation (COM only) */
#define LL_TEST 8 /* link test request */
#define LL_MDATA 9 /* more data request/indication */
#define LL_BUDATA 10 /* broadcast unit data request/indication */
#define LL_XID 12 /* XID command request/indication */
#define LL_XID_R 13 /* XID response request/indication */
/*------------------------------------------------------------------*/
/* NL service primitives */
/*------------------------------------------------------------------*/
#define N_MDATA 1 /* more data to come REQ/IND */
#define N_CONNECT 2 /* OSI N-CONNECT REQ/IND */
#define N_CONNECT_ACK 3 /* OSI N-CONNECT CON/RES */
#define N_DISC 4 /* OSI N-DISC REQ/IND */
#define N_DISC_ACK 5 /* OSI N-DISC CON/RES */
#define N_RESET 6 /* OSI N-RESET REQ/IND */
#define N_RESET_ACK 7 /* OSI N-RESET CON/RES */
#define N_DATA 8 /* OSI N-DATA REQ/IND */
#define N_EDATA 9 /* OSI N-EXPEDITED DATA REQ/IND */
#define N_UDATA 10 /* OSI D-UNIT-DATA REQ/IND */
#define N_BDATA 11 /* BROADCAST-DATA REQ/IND */
#define N_DATA_ACK 12 /* data ack ind for D-bit procedure */
#define N_EDATA_ACK 13 /* data ack ind for INTERRUPT */
#define N_XON 15 /* clear RNR state */
#define N_COMBI_IND N_XON /* combined indication */
#define N_Q_BIT 0x10 /* Q-bit for req/ind */
#define N_M_BIT 0x20 /* M-bit for req/ind */
#define N_D_BIT 0x40 /* D-bit for req/ind */
/*------------------------------------------------------------------*/
/* Signaling management primitives */
/*------------------------------------------------------------------*/
#define ASSIGN_SIG 1 /* assign signaling task */
#define UREMOVE_SIG 0xfe /* remove signaling task without return code*/
#define REMOVE_SIG 0xff /* remove signaling task */
/*------------------------------------------------------------------*/
/* Signaling service primitives */
/*------------------------------------------------------------------*/
#define CALL_REQ 1 /* call request */
#define CALL_CON 1 /* call confirmation */
#define CALL_IND 2 /* incoming call connected */
#define LISTEN_REQ 2 /* listen request */
#define HANGUP 3 /* hangup request/indication */
#define SUSPEND 4 /* call suspend request/confirm */
#define RESUME 5 /* call resume request/confirm */
#define SUSPEND_REJ 6 /* suspend rejected indication */
#define USER_DATA 8 /* user data for user to user signaling */
#define CONGESTION 9 /* network congestion indication */
#define INDICATE_REQ 10 /* request to indicate an incoming call */
#define INDICATE_IND 10 /* indicates that there is an incoming call */
#define CALL_RES 11 /* accept an incoming call */
#define CALL_ALERT 12 /* send ALERT for incoming call */
#define INFO_REQ 13 /* INFO request */
#define INFO_IND 13 /* INFO indication */
#define REJECT 14 /* reject an incoming call */
#define RESOURCES 15 /* reserve B-Channel hardware resources */
#define HW_CTRL 16 /* B-Channel hardware IOCTL req/ind */
#define TEL_CTRL 16 /* Telephone control request/indication */
#define STATUS_REQ 17 /* Request D-State (returned in INFO_IND) */
#define FAC_REG_REQ 18 /* 1TR6 connection independent fac reg */
#define FAC_REG_ACK 19 /* 1TR6 fac registration acknowledge */
#define FAC_REG_REJ 20 /* 1TR6 fac registration reject */
#define CALL_COMPLETE 21/* send a CALL_PROC for incoming call */
#define SW_CTRL 22 /* extended software features */
#define REGISTER_REQ 23 /* Q.931 connection independent reg req */
#define REGISTER_IND 24 /* Q.931 connection independent reg ind */
#define FACILITY_REQ 25 /* Q.931 connection independent fac req */
#define FACILITY_IND 26 /* Q.931 connection independent fac ind */
#define NCR_INFO_REQ 27 /* INFO_REQ with NULL CR */
#define GCR_MIM_REQ 28 /* MANAGEMENT_INFO_REQ with global CR */
#define SIG_CTRL 29 /* Control for Signalling Hardware */
#define DSP_CTRL 30 /* Control for DSPs */
#define LAW_REQ 31 /* Law config request for (returns info_i) */
#define SPID_CTRL 32 /* Request/indication SPID related */
#define NCR_FACILITY 33 /* Request/indication with NULL/DUMMY CR */
#define CALL_HOLD 34 /* Request/indication to hold a CALL */
#define CALL_RETRIEVE 35 /* Request/indication to retrieve a CALL */
#define CALL_HOLD_ACK 36 /* OK of hold a CALL */
#define CALL_RETRIEVE_ACK 37 /* OK of retrieve a CALL */
#define CALL_HOLD_REJ 38 /* Reject of hold a CALL */
#define CALL_RETRIEVE_REJ 39 /* Reject of retrieve a call */
#define GCR_RESTART 40 /* Send/Receive Restart message */
#define S_SERVICE 41 /* Send/Receive Supplementary Service */
#define S_SERVICE_REJ 42 /* Reject Supplementary Service indication */
#define S_SUPPORTED 43 /* Req/Ind to get Supported Services */
#define STATUS_ENQ 44 /* Req to send the D-ch request if !state0 */
#define CALL_GUARD 45 /* Req/Ind to use the FLAGS_CALL_OUTCHECK */
#define CALL_GUARD_HP 46 /* Call Guard function to reject a call */
#define CALL_GUARD_IF 47 /* Call Guard function, inform the appl */
#define SSEXT_REQ 48 /* Supplem.Serv./QSIG specific request */
#define SSEXT_IND 49 /* Supplem.Serv./QSIG specific indication */
/* reserved commands for the US protocols */
#define INT_3PTY_NIND 50 /* US specific indication */
#define INT_CF_NIND 51 /* US specific indication */
#define INT_3PTY_DROP 52 /* US specific indication */
#define INT_MOVE_CONF 53 /* US specific indication */
#define INT_MOVE_RC 54 /* US specific indication */
#define INT_MOVE_FLIPPED_CONF 55 /* US specific indication */
#define INT_X5NI_OK 56 /* internal transfer OK indication */
#define INT_XDMS_START 57 /* internal transfer OK indication */
#define INT_XDMS_STOP 58 /* internal transfer finish indication */
#define INT_XDMS_STOP2 59 /* internal transfer send FA */
#define INT_CUSTCONF_REJ 60 /* internal conference reject */
#define INT_CUSTXFER 61 /* internal transfer request */
#define INT_CUSTX_NIND 62 /* internal transfer ack */
#define INT_CUSTXREJ_NIND 63 /* internal transfer rej */
#define INT_X5NI_CF_XFER 64 /* internal transfer OK indication */
#define VSWITCH_REQ 65 /* communication between protocol and */
#define VSWITCH_IND 66 /* capifunctions for D-CH-switching */
#define MWI_POLL 67 /* Message Waiting Status Request fkt */
#define CALL_PEND_NOTIFY 68 /* notify capi to set new listen */
#define DO_NOTHING 69 /* dont do somethin if you get this */
#define INT_CT_REJ 70 /* ECT rejected internal command */
#define CALL_HOLD_COMPLETE 71 /* In NT Mode indicate hold complete */
#define CALL_RETRIEVE_COMPLETE 72 /* In NT Mode indicate retrieve complete */
/*------------------------------------------------------------------*/
/* management service primitives */
/*------------------------------------------------------------------*/
#define MAN_READ 2
#define MAN_WRITE 3
#define MAN_EXECUTE 4
#define MAN_EVENT_ON 5
#define MAN_EVENT_OFF 6
#define MAN_LOCK 7
#define MAN_UNLOCK 8
#define MAN_INFO_IND 2
#define MAN_EVENT_IND 3
#define MAN_TRACE_IND 4
#define MAN_COMBI_IND 9
#define MAN_ESC 0x80
/*------------------------------------------------------------------*/
/* return code coding */
/*------------------------------------------------------------------*/
#define UNKNOWN_COMMAND 0x01 /* unknown command */
#define WRONG_COMMAND 0x02 /* wrong command */
#define WRONG_ID 0x03 /* unknown task/entity id */
#define WRONG_CH 0x04 /* wrong task/entity id */
#define UNKNOWN_IE 0x05 /* unknown information el. */
#define WRONG_IE 0x06 /* wrong information el. */
#define OUT_OF_RESOURCES 0x07 /* ISDN-S card out of res. */
#define ISDN_GUARD_REJ 0x09 /* ISDN-Guard SuppServ rej */
#define N_FLOW_CONTROL 0x10 /* Flow-Control, retry */
#define ASSIGN_RC 0xe0 /* ASSIGN acknowledgement */
#define ASSIGN_OK 0xef /* ASSIGN OK */
#define OK_FC 0xfc /* Flow-Control RC */
#define READY_INT 0xfd /* Ready interrupt */
#define TIMER_INT 0xfe /* timer interrupt */
#define OK 0xff /* command accepted */
/*------------------------------------------------------------------*/
/* information elements */
/*------------------------------------------------------------------*/
#define SHIFT 0x90 /* codeset shift */
#define MORE 0xa0 /* more data */
#define SDNCMPL 0xa1 /* sending complete */
#define CL 0xb0 /* congestion level */
/* codeset 0 */
#define SMSG 0x00 /* segmented message */
#define BC 0x04 /* Bearer Capability */
#define CAU 0x08 /* cause */
#define CAD 0x0c /* Connected address */
#define CAI 0x10 /* call identity */
#define CHI 0x18 /* channel identification */
#define LLI 0x19 /* logical link id */
#define CHA 0x1a /* charge advice */
#define FTY 0x1c /* Facility */
#define DT 0x29 /* ETSI date/time */
#define KEY 0x2c /* keypad information element */
#define UID 0x2d /* User id information element */
#define DSP 0x28 /* display */
#define SIG 0x34 /* signalling hardware control */
#define OAD 0x6c /* origination address */
#define OSA 0x6d /* origination sub-address */
#define CPN 0x70 /* called party number */
#define DSA 0x71 /* destination sub-address */
#define RDX 0x73 /* redirecting number extended */
#define RDN 0x74 /* redirecting number */
#define RIN 0x76 /* redirection number */
#define IUP 0x76 /* VN6 rerouter->PCS (codeset 6) */
#define IPU 0x77 /* VN6 PCS->rerouter (codeset 6) */
#define RI 0x79 /* restart indicator */
#define MIE 0x7a /* management info element */
#define LLC 0x7c /* low layer compatibility */
#define HLC 0x7d /* high layer compatibility */
#define UUI 0x7e /* user user information */
#define ESC 0x7f /* escape extension */
#define DLC 0x20 /* data link layer configuration */
#define NLC 0x21 /* network layer configuration */
#define REDIRECT_IE 0x22 /* redirection request/indication data */
#define REDIRECT_NET_IE 0x23 /* redirection network override data */
/* codeset 6 */
#define SIN 0x01 /* service indicator */
#define CIF 0x02 /* charging information */
#define DATE 0x03 /* date */
#define CPS 0x07 /* called party status */
/*------------------------------------------------------------------*/
/* ESC information elements */
/*------------------------------------------------------------------*/
#define MSGTYPEIE 0x7a /* Messagetype info element */
#define CRIE 0x7b /* INFO info element */
#define CODESET6IE 0xec /* Tunnel for Codeset 6 IEs */
#define VSWITCHIE 0xed /* VSwitch info element */
#define SSEXTIE 0xee /* Supplem. Service info element */
#define PROFILEIE 0xef /* Profile info element */
/*------------------------------------------------------------------*/
/* TEL_CTRL contents */
/*------------------------------------------------------------------*/
#define RING_ON 0x01
#define RING_OFF 0x02
#define HANDS_FREE_ON 0x03
#define HANDS_FREE_OFF 0x04
#define ON_HOOK 0x80
#define OFF_HOOK 0x90
/* operation values used by ETSI supplementary services */
#define THREE_PTY_BEGIN 0x04
#define THREE_PTY_END 0x05
#define ECT_EXECUTE 0x06
#define ACTIVATION_DIVERSION 0x07
#define DEACTIVATION_DIVERSION 0x08
#define CALL_DEFLECTION 0x0D
#define INTERROGATION_DIVERSION 0x0B
#define INTERROGATION_SERV_USR_NR 0x11
#define ACTIVATION_MWI 0x20
#define DEACTIVATION_MWI 0x21
#define MWI_INDICATION 0x22
#define MWI_RESPONSE 0x23
#define CONF_BEGIN 0x28
#define CONF_ADD 0x29
#define CONF_SPLIT 0x2a
#define CONF_DROP 0x2b
#define CONF_ISOLATE 0x2c
#define CONF_REATTACH 0x2d
#define CONF_PARTYDISC 0x2e
#define CCBS_INFO_RETAIN 0x2f
#define CCBS_ERASECALLLINKAGEID 0x30
#define CCBS_STOP_ALERTING 0x31
#define CCBS_REQUEST 0x32
#define CCBS_DEACTIVATE 0x33
#define CCBS_INTERROGATE 0x34
#define CCBS_STATUS 0x35
#define CCBS_ERASE 0x36
#define CCBS_B_FREE 0x37
#define CCNR_INFO_RETAIN 0x38
#define CCBS_REMOTE_USER_FREE 0x39
#define CCNR_REQUEST 0x3a
#define CCNR_INTERROGATE 0x3b
#define GET_SUPPORTED_SERVICES 0xff
#define DIVERSION_PROCEDURE_CFU 0x70
#define DIVERSION_PROCEDURE_CFB 0x71
#define DIVERSION_PROCEDURE_CFNR 0x72
#define DIVERSION_DEACTIVATION_CFU 0x80
#define DIVERSION_DEACTIVATION_CFB 0x81
#define DIVERSION_DEACTIVATION_CFNR 0x82
#define DIVERSION_INTERROGATE_NUM 0x11
#define DIVERSION_INTERROGATE_CFU 0x60
#define DIVERSION_INTERROGATE_CFB 0x61
#define DIVERSION_INTERROGATE_CFNR 0x62
/* Service Masks */
#define SMASK_HOLD_RETRIEVE 0x00000001
#define SMASK_TERMINAL_PORTABILITY 0x00000002
#define SMASK_ECT 0x00000004
#define SMASK_3PTY 0x00000008
#define SMASK_CALL_FORWARDING 0x00000010
#define SMASK_CALL_DEFLECTION 0x00000020
#define SMASK_MCID 0x00000040
#define SMASK_CCBS 0x00000080
#define SMASK_MWI 0x00000100
#define SMASK_CCNR 0x00000200
#define SMASK_CONF 0x00000400
/* ----------------------------------------------
Types of transfers used to transfer the
information in the 'struct RC->Reserved2[8]'
The information is transferred as 2 dwords
(2 4Byte unsigned values)
First of them is the transfer type.
2^32-1 possible messages are possible in this way.
The context of the second one had no meaning
---------------------------------------------- */
#define DIVA_RC_TYPE_NONE 0x00000000
#define DIVA_RC_TYPE_REMOVE_COMPLETE 0x00000008
#define DIVA_RC_TYPE_STREAM_PTR 0x00000009
#define DIVA_RC_TYPE_CMA_PTR 0x0000000a
#define DIVA_RC_TYPE_OK_FC 0x0000000b
#define DIVA_RC_TYPE_RX_DMA 0x0000000c
/* ------------------------------------------------------
IO Control codes for IN BAND SIGNALING
------------------------------------------------------ */
#define CTRL_L1_SET_SIG_ID 5
#define CTRL_L1_SET_DAD 6
#define CTRL_L1_RESOURCES 7
/* ------------------------------------------------------ */
/* ------------------------------------------------------
Layer 2 types
------------------------------------------------------ */
#define X75T 1 /* x.75 for ttx */
#define TRF 2 /* transparent with hdlc framing */
#define TRF_IN 3 /* transparent with hdlc fr. inc. */
#define SDLC 4 /* sdlc, sna layer-2 */
#define X75 5 /* x.75 for btx */
#define LAPD 6 /* lapd (Q.921) */
#define X25_L2 7 /* x.25 layer-2 */
#define V120_L2 8 /* V.120 layer-2 protocol */
#define V42_IN 9 /* V.42 layer-2 protocol, incoming */
#define V42 10 /* V.42 layer-2 protocol */
#define MDM_ATP 11 /* AT Parser built in the L2 */
#define X75_V42BIS 12 /* x.75 with V.42bis */
#define RTPL2_IN 13 /* RTP layer-2 protocol, incoming */
#define RTPL2 14 /* RTP layer-2 protocol */
#define V120_V42BIS 15 /* V.120 asynchronous mode supporting V.42bis compression */
#define LISTENER 27 /* Layer 2 to listen line */
#define MTP2 28 /* MTP2 Layer 2 */
#define PIAFS_CRC 29 /* PIAFS Layer 2 with CRC calculation at L2 */
/* ------------------------------------------------------
PIAFS DLC DEFINITIONS
------------------------------------------------------ */
#define PIAFS_64K 0x01
#define PIAFS_VARIABLE_SPEED 0x02
#define PIAFS_CHINESE_SPEED 0x04
#define PIAFS_UDATA_ABILITY_ID 0x80
#define PIAFS_UDATA_ABILITY_DCDON 0x01
#define PIAFS_UDATA_ABILITY_DDI 0x80
/*
DLC of PIAFS :
Byte | 8 7 6 5 4 3 2 1
-----+--------------------------------------------------------
0 | 0 0 1 0 0 0 0 0 Data Link Configuration
1 | X X X X X X X X Length of IE (at least 15 Bytes)
2 | 0 0 0 0 0 0 0 0 max. information field, LOW byte (not used, fix 73 Bytes)
3 | 0 0 0 0 0 0 0 0 max. information field, HIGH byte (not used, fix 73 Bytes)
4 | 0 0 0 0 0 0 0 0 address A (not used)
5 | 0 0 0 0 0 0 0 0 address B (not used)
6 | 0 0 0 0 0 0 0 0 Mode (not used, fix 128)
7 | 0 0 0 0 0 0 0 0 Window Size (not used, fix 127)
8 | X X X X X X X X XID Length, Low Byte (at least 7 Bytes)
9 | X X X X X X X X XID Length, High Byte
10 | 0 0 0 0 0 C V S PIAFS Protocol Speed configuration -> Note(1)
| S = 0 -> Protocol Speed is 32K
| S = 1 -> Protocol Speed is 64K
| V = 0 -> Protocol Speed is fixed
| V = 1 -> Protocol Speed is variable
| C = 0 -> speed setting according to standard
| C = 1 -> speed setting for chinese implementation
11 | 0 0 0 0 0 0 R T P0 - V42bis Compression enable/disable, Low Byte
| T = 0 -> Transmit Direction enable
| T = 1 -> Transmit Direction disable
| R = 0 -> Receive Direction enable
| R = 1 -> Receive Direction disable
13 | 0 0 0 0 0 0 0 0 P0 - V42bis Compression enable/disable, High Byte
14 | X X X X X X X X P1 - V42bis Dictionary Size, Low Byte
15 | X X X X X X X X P1 - V42bis Dictionary Size, High Byte
16 | X X X X X X X X P2 - V42bis String Length, Low Byte
17 | X X X X X X X X P2 - V42bis String Length, High Byte
18 | X X X X X X X X PIAFS extension length
19 | 1 0 0 0 0 0 0 0 PIAFS extension Id (0x80) - UDATA abilities
20 | U 0 0 0 0 0 0 D UDATA abilities -> Note (2)
| up to now the following Bits are defined:
| D - signal DCD ON
| U - use extensive UDATA control communication
| for DDI test application
+ Note (1): ----------+------+-----------------------------------------+
| PIAFS Protocol | Bit | |
| Speed configuration | S | Bit 1 - Protocol Speed |
| | | 0 - 32K |
| | | 1 - 64K (default) |
| | V | Bit 2 - Variable Protocol Speed |
| | | 0 - Speed is fix |
| | | 1 - Speed is variable (default) |
| | | OVERWRITES 32k Bit 1 |
| | C | Bit 3 0 - Speed Settings according to |
| | | PIAFS specification |
| | | 1 - Speed setting for chinese |
| | | PIAFS implementation |
| | | Explanation for chinese speed settings: |
| | | if Bit 3 is set the following |
| | | rules apply: |
| | | Bit1=0 Bit2=0: 32k fix |
| | | Bit1=1 Bit2=0: 64k fix |
| | | Bit1=0 Bit2=1: PIAFS is trying |
| | | to negotiate 32k is that is |
| | | not possible it tries to |
| | | negotiate 64k |
| | | Bit1=1 Bit2=1: PIAFS is trying |
| | | to negotiate 64k is that is |
| | | not possible it tries to |
| | | negotiate 32k |
+ Note (2): ----------+------+-----------------------------------------+
| PIAFS | Bit | this byte defines the usage of UDATA |
| Implementation | | control communication |
| UDATA usage | D | Bit 1 - DCD-ON signalling |
| | | 0 - no DCD-ON is signalled |
| | | (default) |
| | | 1 - DCD-ON will be signalled |
| | U | Bit 8 - DDI test application UDATA |
| | | control communication |
| | | 0 - no UDATA control |
| | | communication (default) |
| | | sets as well the DCD-ON |
| | | signalling |
| | | 1 - UDATA control communication |
| | | ATTENTION: Do not use these |
| | | setting if you |
| | | are not really |
| | | that you need it |
| | | and you know |
| | | exactly what you |
| | | are doing. |
| | | You can easily |
| | | disable any |
| | | data transfer. |
+---------------------+------+-----------------------------------------+
*/
/* ------------------------------------------------------
LISTENER DLC DEFINITIONS
------------------------------------------------------ */
#define LISTENER_FEATURE_MASK_CUMMULATIVE 0x0001
/* ------------------------------------------------------
LISTENER META-FRAME CODE/PRIMITIVE DEFINITIONS
------------------------------------------------------ */
#define META_CODE_LL_UDATA_RX 0x01
#define META_CODE_LL_UDATA_TX 0x02
#define META_CODE_LL_DATA_RX 0x03
#define META_CODE_LL_DATA_TX 0x04
#define META_CODE_LL_MDATA_RX 0x05
#define META_CODE_LL_MDATA_TX 0x06
#define META_CODE_EMPTY 0x10
#define META_CODE_LOST_FRAMES 0x11
#define META_FLAG_TRUNCATED 0x0001
/*------------------------------------------------------------------*/
/* CAPI-like profile to indicate features on LAW_REQ */
/*------------------------------------------------------------------*/
#define GL_INTERNAL_CONTROLLER_SUPPORTED 0x00000001L
#define GL_EXTERNAL_EQUIPMENT_SUPPORTED 0x00000002L
#define GL_HANDSET_SUPPORTED 0x00000004L
#define GL_DTMF_SUPPORTED 0x00000008L
#define GL_SUPPLEMENTARY_SERVICES_SUPPORTED 0x00000010L
#define GL_CHANNEL_ALLOCATION_SUPPORTED 0x00000020L
#define GL_BCHANNEL_OPERATION_SUPPORTED 0x00000040L
#define GL_LINE_INTERCONNECT_SUPPORTED 0x00000080L
#define B1_HDLC_SUPPORTED 0x00000001L
#define B1_TRANSPARENT_SUPPORTED 0x00000002L
#define B1_V110_ASYNC_SUPPORTED 0x00000004L
#define B1_V110_SYNC_SUPPORTED 0x00000008L
#define B1_T30_SUPPORTED 0x00000010L
#define B1_HDLC_INVERTED_SUPPORTED 0x00000020L
#define B1_TRANSPARENT_R_SUPPORTED 0x00000040L
#define B1_MODEM_ALL_NEGOTIATE_SUPPORTED 0x00000080L
#define B1_MODEM_ASYNC_SUPPORTED 0x00000100L
#define B1_MODEM_SYNC_HDLC_SUPPORTED 0x00000200L
#define B2_X75_SUPPORTED 0x00000001L
#define B2_TRANSPARENT_SUPPORTED 0x00000002L
#define B2_SDLC_SUPPORTED 0x00000004L
#define B2_LAPD_SUPPORTED 0x00000008L
#define B2_T30_SUPPORTED 0x00000010L
#define B2_PPP_SUPPORTED 0x00000020L
#define B2_TRANSPARENT_NO_CRC_SUPPORTED 0x00000040L
#define B2_MODEM_EC_COMPRESSION_SUPPORTED 0x00000080L
#define B2_X75_V42BIS_SUPPORTED 0x00000100L
#define B2_V120_ASYNC_SUPPORTED 0x00000200L
#define B2_V120_ASYNC_V42BIS_SUPPORTED 0x00000400L
#define B2_V120_BIT_TRANSPARENT_SUPPORTED 0x00000800L
#define B2_LAPD_FREE_SAPI_SEL_SUPPORTED 0x00001000L
#define B3_TRANSPARENT_SUPPORTED 0x00000001L
#define B3_T90NL_SUPPORTED 0x00000002L
#define B3_ISO8208_SUPPORTED 0x00000004L
#define B3_X25_DCE_SUPPORTED 0x00000008L
#define B3_T30_SUPPORTED 0x00000010L
#define B3_T30_WITH_EXTENSIONS_SUPPORTED 0x00000020L
#define B3_RESERVED_SUPPORTED 0x00000040L
#define B3_MODEM_SUPPORTED 0x00000080L
#define MANUFACTURER_FEATURE_SLAVE_CODEC 0x00000001L
#define MANUFACTURER_FEATURE_FAX_MORE_DOCUMENTS 0x00000002L
#define MANUFACTURER_FEATURE_HARDDTMF 0x00000004L
#define MANUFACTURER_FEATURE_SOFTDTMF_SEND 0x00000008L
#define MANUFACTURER_FEATURE_DTMF_PARAMETERS 0x00000010L
#define MANUFACTURER_FEATURE_SOFTDTMF_RECEIVE 0x00000020L
#define MANUFACTURER_FEATURE_FAX_SUB_SEP_PWD 0x00000040L
#define MANUFACTURER_FEATURE_V18 0x00000080L
#define MANUFACTURER_FEATURE_MIXER_CH_CH 0x00000100L
#define MANUFACTURER_FEATURE_MIXER_CH_PC 0x00000200L
#define MANUFACTURER_FEATURE_MIXER_PC_CH 0x00000400L
#define MANUFACTURER_FEATURE_MIXER_PC_PC 0x00000800L
#define MANUFACTURER_FEATURE_ECHO_CANCELLER 0x00001000L
#define MANUFACTURER_FEATURE_RTP 0x00002000L
#define MANUFACTURER_FEATURE_T38 0x00004000L
#define MANUFACTURER_FEATURE_TRANSP_DELIVERY_CONF 0x00008000L
#define MANUFACTURER_FEATURE_XONOFF_FLOW_CONTROL 0x00010000L
#define MANUFACTURER_FEATURE_OOB_CHANNEL 0x00020000L
#define MANUFACTURER_FEATURE_IN_BAND_CHANNEL 0x00040000L
#define MANUFACTURER_FEATURE_IN_BAND_FEATURE 0x00080000L
#define MANUFACTURER_FEATURE_PIAFS 0x00100000L
#define MANUFACTURER_FEATURE_DTMF_TONE 0x00200000L
#define MANUFACTURER_FEATURE_FAX_PAPER_FORMATS 0x00400000L
#define MANUFACTURER_FEATURE_OK_FC_LABEL 0x00800000L
#define MANUFACTURER_FEATURE_VOWN 0x01000000L
#define MANUFACTURER_FEATURE_XCONNECT 0x02000000L
#define MANUFACTURER_FEATURE_DMACONNECT 0x04000000L
#define MANUFACTURER_FEATURE_AUDIO_TAP 0x08000000L
#define MANUFACTURER_FEATURE_FAX_NONSTANDARD 0x10000000L
#define MANUFACTURER_FEATURE_SS7 0x20000000L
#define MANUFACTURER_FEATURE_MADAPTER 0x40000000L
#define MANUFACTURER_FEATURE_MEASURE 0x80000000L
#define MANUFACTURER_FEATURE2_LISTENING 0x00000001L
#define MANUFACTURER_FEATURE2_SS_DIFFCONTPOSSIBLE 0x00000002L
#define MANUFACTURER_FEATURE2_GENERIC_TONE 0x00000004L
#define MANUFACTURER_FEATURE2_COLOR_FAX 0x00000008L
#define MANUFACTURER_FEATURE2_SS_ECT_DIFFCONTPOSSIBLE 0x00000010L
#define RTP_PRIM_PAYLOAD_PCMU_8000 0
#define RTP_PRIM_PAYLOAD_1016_8000 1
#define RTP_PRIM_PAYLOAD_G726_32_8000 2
#define RTP_PRIM_PAYLOAD_GSM_8000 3
#define RTP_PRIM_PAYLOAD_G723_8000 4
#define RTP_PRIM_PAYLOAD_DVI4_8000 5
#define RTP_PRIM_PAYLOAD_DVI4_16000 6
#define RTP_PRIM_PAYLOAD_LPC_8000 7
#define RTP_PRIM_PAYLOAD_PCMA_8000 8
#define RTP_PRIM_PAYLOAD_G722_16000 9
#define RTP_PRIM_PAYLOAD_QCELP_8000 12
#define RTP_PRIM_PAYLOAD_G728_8000 14
#define RTP_PRIM_PAYLOAD_G729_8000 18
#define RTP_PRIM_PAYLOAD_GSM_HR_8000 30
#define RTP_PRIM_PAYLOAD_GSM_EFR_8000 31
#define RTP_ADD_PAYLOAD_BASE 32
#define RTP_ADD_PAYLOAD_RED 32
#define RTP_ADD_PAYLOAD_CN_8000 33
#define RTP_ADD_PAYLOAD_DTMF 34
#define RTP_PRIM_PAYLOAD_PCMU_8000_SUPPORTED (1L << RTP_PRIM_PAYLOAD_PCMU_8000)
#define RTP_PRIM_PAYLOAD_1016_8000_SUPPORTED (1L << RTP_PRIM_PAYLOAD_1016_8000)
#define RTP_PRIM_PAYLOAD_G726_32_8000_SUPPORTED (1L << RTP_PRIM_PAYLOAD_G726_32_8000)
#define RTP_PRIM_PAYLOAD_GSM_8000_SUPPORTED (1L << RTP_PRIM_PAYLOAD_GSM_8000)
#define RTP_PRIM_PAYLOAD_G723_8000_SUPPORTED (1L << RTP_PRIM_PAYLOAD_G723_8000)
#define RTP_PRIM_PAYLOAD_DVI4_8000_SUPPORTED (1L << RTP_PRIM_PAYLOAD_DVI4_8000)
#define RTP_PRIM_PAYLOAD_DVI4_16000_SUPPORTED (1L << RTP_PRIM_PAYLOAD_DVI4_16000)
#define RTP_PRIM_PAYLOAD_LPC_8000_SUPPORTED (1L << RTP_PRIM_PAYLOAD_LPC_8000)
#define RTP_PRIM_PAYLOAD_PCMA_8000_SUPPORTED (1L << RTP_PRIM_PAYLOAD_PCMA_8000)
#define RTP_PRIM_PAYLOAD_G722_16000_SUPPORTED (1L << RTP_PRIM_PAYLOAD_G722_16000)
#define RTP_PRIM_PAYLOAD_QCELP_8000_SUPPORTED (1L << RTP_PRIM_PAYLOAD_QCELP_8000)
#define RTP_PRIM_PAYLOAD_G728_8000_SUPPORTED (1L << RTP_PRIM_PAYLOAD_G728_8000)
#define RTP_PRIM_PAYLOAD_G729_8000_SUPPORTED (1L << RTP_PRIM_PAYLOAD_G729_8000)
#define RTP_PRIM_PAYLOAD_GSM_HR_8000_SUPPORTED (1L << RTP_PRIM_PAYLOAD_GSM_HR_8000)
#define RTP_PRIM_PAYLOAD_GSM_EFR_8000_SUPPORTED (1L << RTP_PRIM_PAYLOAD_GSM_EFR_8000)
#define RTP_ADD_PAYLOAD_RED_SUPPORTED (1L << (RTP_ADD_PAYLOAD_RED - RTP_ADD_PAYLOAD_BASE))
#define RTP_ADD_PAYLOAD_CN_8000_SUPPORTED (1L << (RTP_ADD_PAYLOAD_CN_8000 - RTP_ADD_PAYLOAD_BASE))
#define RTP_ADD_PAYLOAD_DTMF_SUPPORTED (1L << (RTP_ADD_PAYLOAD_DTMF - RTP_ADD_PAYLOAD_BASE))
/* virtual switching definitions */
#define VSJOIN 1
#define VSTRANSPORT 2
#define VSGETPARAMS 3
#define VSCAD 1
#define VSRXCPNAME 2
#define VSCALLSTAT 3
#define VSINVOKEID 4
#define VSCLMRKS 5
#define VSTBCTIDENT 6
#define VSETSILINKID 7
#define VSSAMECONTROLLER 8
/* Errorcodes for VSETSILINKID begin */
#define VSETSILINKIDRRWC 1
#define VSETSILINKIDREJECT 2
#define VSETSILINKIDTIMEOUT 3
#define VSETSILINKIDFAILCOUNT 4
#define VSETSILINKIDERROR 5
/* Errorcodes for VSETSILINKID end */
/* -----------------------------------------------------------**
** The PROTOCOL_FEATURE_STRING in feature.h (included **
** in prstart.sx and astart.sx) defines capabilities and **
** features of the actual protocol code. It's used as a bit **
** mask. **
** The following Bits are defined: **
** -----------------------------------------------------------*/
#define PROTCAP_TELINDUS 0x0001 /* Telindus Variant of protocol code */
#define PROTCAP_MAN_IF 0x0002 /* Management interface implemented */
#define PROTCAP_V_42 0x0004 /* V42 implemented */
#define PROTCAP_V90D 0x0008 /* V.90D (implies up to 384k DSP code) */
#define PROTCAP_EXTD_FAX 0x0010 /* Extended FAX (ECM, 2D, T6, Polling) */
#define PROTCAP_EXTD_RXFC 0x0020 /* RxFC (Extd Flow Control), OOB Chnl */
#define PROTCAP_VOIP 0x0040 /* VoIP (implies up to 512k DSP code) */
#define PROTCAP_CMA_ALLPR 0x0080 /* CMA support for all NL primitives */
#define PROTCAP_FREE8 0x0100 /* not used */
#define PROTCAP_FREE9 0x0200 /* not used */
#define PROTCAP_FREE10 0x0400 /* not used */
#define PROTCAP_FREE11 0x0800 /* not used */
#define PROTCAP_FREE12 0x1000 /* not used */
#define PROTCAP_FREE13 0x2000 /* not used */
#define PROTCAP_FREE14 0x4000 /* not used */
#define PROTCAP_EXTENSION 0x8000 /* used for future extensions */
/* -----------------------------------------------------------* */
/* Onhook data transmission ETS30065901 */
/* Message Type */
/*#define RESERVED4 0x4*/
#define CALL_SETUP 0x80
#define MESSAGE_WAITING_INDICATOR 0x82
/*#define RESERVED84 0x84*/
/*#define RESERVED85 0x85*/
#define ADVICE_OF_CHARGE 0x86
/*1111 0001
to
1111 1111
F1H - Reserved for network operator use
to
FFH*/
/* Parameter Types */
#define DATE_AND_TIME 1
#define CLI_PARAMETER_TYPE 2
#define CALLED_DIRECTORY_NUMBER_PARAMETER_TYPE 3
#define REASON_FOR_ABSENCE_OF_CLI_PARAMETER_TYPE 4
#define NAME_PARAMETER_TYPE 7
#define REASON_FOR_ABSENCE_OF_CALLING_PARTY_NAME_PARAMETER_TYPE 8
#define VISUAL_INDICATOR_PARAMETER_TYPE 0xb
#define COMPLEMENTARY_CLI_PARAMETER_TYPE 0x10
#define CALL_TYPE_PARAMETER_TYPE 0x11
#define FIRST_CALLED_LINE_DIRECTORY_NUMBER_PARAMETER_TYPE 0x12
#define NETWORK_MESSAGE_SYSTEM_STATUS_PARAMETER_TYPE 0x13
#define FORWARDED_CALL_TYPE_PARAMETER_TYPE 0x15
#define TYPE_OF_CALLING_USER_PARAMETER_TYPE 0x16
#define REDIRECTING_NUMBER_PARAMETER_TYPE 0x1a
#define EXTENSION_FOR_NETWORK_OPERATOR_USE_PARAMETER_TYPE 0xe0
/* -----------------------------------------------------------* */
#else
#endif /* PC_H_INCLUDED } */

View File

@ -1,267 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef PC_INIT_H_
#define PC_INIT_H_
/*------------------------------------------------------------------*/
/*
Initialisation parameters for the card
0x0008 <byte> TEI
0x0009 <byte> NT2 flag
0x000a <byte> Default DID length
0x000b <byte> Disable watchdog flag
0x000c <byte> Permanent connection flag
0x000d <byte> Bit 3-8: L1 Hunt Group/Tristate
0x000d <byte> Bit 1: QSig small CR length if set to 1
0x000d <byte> Bit 2: QSig small CHI length if set to 1
0x000e <byte> Bit 1-3: Stable L2, 0=OnDemand,1=NoDisc,2=permanent
0x000e <byte> Bit 4: NT mode
0x000e <byte> Bit 5: QSig Channel ID format
0x000e <byte> Bit 6: QSig Call Forwarding Allowed Flag
0x000e <byte> Bit 7: Disable AutoSPID Flag
0x000f <byte> No order check flag
0x0010 <byte> Force companding type:0=default,1=a-law,2=u-law
0x0012 <byte> Low channel flag
0x0013 <byte> Protocol version
0x0014 <byte> CRC4 option:0=default,1=double_frm,2=multi_frm,3=auto
0x0015 <byte> Bit 0: NoHscx30, Bit 1: Loopback flag, Bit 2: ForceHscx30
0x0016 <byte> DSP info
0x0017-0x0019 Serial number
0x001a <byte> Card type
0x0020 <string> OAD 0
0x0040 <string> OSA 0
0x0060 <string> SPID 0 (if not T.1)
0x0060 <struct> if T.1: Robbed Bit Configuration
0x0060 length (8)
0x0061 RBS Answer Delay
0x0062 RBS Config Bit 3, 4:
0 0 -> Wink Start
1 0 -> Loop Start
0 1 -> Ground Start
1 1 -> reserved
Bit 5, 6:
0 0 -> Pulse Dial -> Rotary
1 0 -> DTMF
0 1 -> MF
1 1 -> reserved
0x0063 RBS RX Digit Timeout
0x0064 RBS Bearer Capability
0x0065-0x0069 RBS Debug Mask
0x0080 <string> OAD 1
0x00a0 <string> OSA 1
0x00c0 <string> SPID 1
0x00e0 <w-element list> Additional configuration
*/
#define PCINIT_END_OF_LIST 0x00
#define PCINIT_MODEM_GUARD_TONE 0x01
#define PCINIT_MODEM_MIN_SPEED 0x02
#define PCINIT_MODEM_MAX_SPEED 0x03
#define PCINIT_MODEM_PROTOCOL_OPTIONS 0x04
#define PCINIT_FAX_OPTIONS 0x05
#define PCINIT_FAX_MAX_SPEED 0x06
#define PCINIT_MODEM_OPTIONS 0x07
#define PCINIT_MODEM_NEGOTIATION_MODE 0x08
#define PCINIT_MODEM_MODULATIONS_MASK 0x09
#define PCINIT_MODEM_TRANSMIT_LEVEL 0x0a
#define PCINIT_FAX_DISABLED_RESOLUTIONS 0x0b
#define PCINIT_FAX_MAX_RECORDING_WIDTH 0x0c
#define PCINIT_FAX_MAX_RECORDING_LENGTH 0x0d
#define PCINIT_FAX_MIN_SCANLINE_TIME 0x0e
#define PCINIT_US_EKTS_CACH_HANDLES 0x0f
#define PCINIT_US_EKTS_BEGIN_CONF 0x10
#define PCINIT_US_EKTS_DROP_CONF 0x11
#define PCINIT_US_EKTS_CALL_TRANSFER 0x12
#define PCINIT_RINGERTONE_OPTION 0x13
#define PCINIT_CARD_ADDRESS 0x14
#define PCINIT_FPGA_FEATURES 0x15
#define PCINIT_US_EKTS_MWI 0x16
#define PCINIT_MODEM_SPEAKER_CONTROL 0x17
#define PCINIT_MODEM_SPEAKER_VOLUME 0x18
#define PCINIT_MODEM_CARRIER_WAIT_TIME 0x19
#define PCINIT_MODEM_CARRIER_LOSS_TIME 0x1a
#define PCINIT_UNCHAN_B_MASK 0x1b
#define PCINIT_PART68_LIMITER 0x1c
#define PCINIT_XDI_FEATURES 0x1d
#define PCINIT_QSIG_DIALECT 0x1e
#define PCINIT_DISABLE_AUTOSPID_FLAG 0x1f
#define PCINIT_FORCE_VOICE_MAIL_ALERT 0x20
#define PCINIT_PIAFS_TURNAROUND_FRAMES 0x21
#define PCINIT_L2_COUNT 0x22
#define PCINIT_QSIG_FEATURES 0x23
#define PCINIT_NO_SIGNALLING 0x24
#define PCINIT_CARD_SN 0x25
#define PCINIT_CARD_PORT 0x26
#define PCINIT_ALERTTO 0x27
#define PCINIT_MODEM_EYE_SETUP 0x28
#define PCINIT_FAX_V34_OPTIONS 0x29
/*------------------------------------------------------------------*/
#define PCINIT_MODEM_GUARD_TONE_NONE 0x00
#define PCINIT_MODEM_GUARD_TONE_550HZ 0x01
#define PCINIT_MODEM_GUARD_TONE_1800HZ 0x02
#define PCINIT_MODEM_GUARD_TONE_CHOICES 0x03
#define PCINIT_MODEMPROT_DISABLE_V42_V42BIS 0x0001
#define PCINIT_MODEMPROT_DISABLE_MNP_MNP5 0x0002
#define PCINIT_MODEMPROT_REQUIRE_PROTOCOL 0x0004
#define PCINIT_MODEMPROT_DISABLE_V42_DETECT 0x0008
#define PCINIT_MODEMPROT_DISABLE_COMPRESSION 0x0010
#define PCINIT_MODEMPROT_REQUIRE_PROTOCOL_V34UP 0x0020
#define PCINIT_MODEMPROT_NO_PROTOCOL_IF_1200 0x0100
#define PCINIT_MODEMPROT_BUFFER_IN_V42_DETECT 0x0200
#define PCINIT_MODEMPROT_DISABLE_V42_SREJ 0x0400
#define PCINIT_MODEMPROT_DISABLE_MNP3 0x0800
#define PCINIT_MODEMPROT_DISABLE_MNP4 0x1000
#define PCINIT_MODEMPROT_DISABLE_MNP10 0x2000
#define PCINIT_MODEMPROT_NO_PROTOCOL_IF_V22BIS 0x4000
#define PCINIT_MODEMPROT_NO_PROTOCOL_IF_V32BIS 0x8000
#define PCINIT_MODEMCONFIG_LEASED_LINE_MODE 0x00000001L
#define PCINIT_MODEMCONFIG_4_WIRE_OPERATION 0x00000002L
#define PCINIT_MODEMCONFIG_DISABLE_BUSY_DETECT 0x00000004L
#define PCINIT_MODEMCONFIG_DISABLE_CALLING_TONE 0x00000008L
#define PCINIT_MODEMCONFIG_DISABLE_ANSWER_TONE 0x00000010L
#define PCINIT_MODEMCONFIG_ENABLE_DIAL_TONE_DET 0x00000020L
#define PCINIT_MODEMCONFIG_USE_POTS_INTERFACE 0x00000040L
#define PCINIT_MODEMCONFIG_FORCE_RAY_TAYLOR_FAX 0x00000080L
#define PCINIT_MODEMCONFIG_DISABLE_RETRAIN 0x00000100L
#define PCINIT_MODEMCONFIG_DISABLE_STEPDOWN 0x00000200L
#define PCINIT_MODEMCONFIG_DISABLE_SPLIT_SPEED 0x00000400L
#define PCINIT_MODEMCONFIG_DISABLE_TRELLIS 0x00000800L
#define PCINIT_MODEMCONFIG_ALLOW_RDL_TEST_LOOP 0x00001000L
#define PCINIT_MODEMCONFIG_DISABLE_STEPUP 0x00002000L
#define PCINIT_MODEMCONFIG_DISABLE_FLUSH_TIMER 0x00004000L
#define PCINIT_MODEMCONFIG_REVERSE_DIRECTION 0x00008000L
#define PCINIT_MODEMCONFIG_DISABLE_TX_REDUCTION 0x00010000L
#define PCINIT_MODEMCONFIG_DISABLE_PRECODING 0x00020000L
#define PCINIT_MODEMCONFIG_DISABLE_PREEMPHASIS 0x00040000L
#define PCINIT_MODEMCONFIG_DISABLE_SHAPING 0x00080000L
#define PCINIT_MODEMCONFIG_DISABLE_NONLINEAR_EN 0x00100000L
#define PCINIT_MODEMCONFIG_DISABLE_MANUALREDUCT 0x00200000L
#define PCINIT_MODEMCONFIG_DISABLE_16_POINT_TRN 0x00400000L
#define PCINIT_MODEMCONFIG_DISABLE_2400_SYMBOLS 0x01000000L
#define PCINIT_MODEMCONFIG_DISABLE_2743_SYMBOLS 0x02000000L
#define PCINIT_MODEMCONFIG_DISABLE_2800_SYMBOLS 0x04000000L
#define PCINIT_MODEMCONFIG_DISABLE_3000_SYMBOLS 0x08000000L
#define PCINIT_MODEMCONFIG_DISABLE_3200_SYMBOLS 0x10000000L
#define PCINIT_MODEMCONFIG_DISABLE_3429_SYMBOLS 0x20000000L
#define PCINIT_MODEM_NEGOTIATE_HIGHEST 0x00
#define PCINIT_MODEM_NEGOTIATE_DISABLED 0x01
#define PCINIT_MODEM_NEGOTIATE_IN_CLASS 0x02
#define PCINIT_MODEM_NEGOTIATE_V100 0x03
#define PCINIT_MODEM_NEGOTIATE_V8 0x04
#define PCINIT_MODEM_NEGOTIATE_V8BIS 0x05
#define PCINIT_MODEM_NEGOTIATE_CHOICES 0x06
#define PCINIT_MODEMMODULATION_DISABLE_V21 0x00000001L
#define PCINIT_MODEMMODULATION_DISABLE_V23 0x00000002L
#define PCINIT_MODEMMODULATION_DISABLE_V22 0x00000004L
#define PCINIT_MODEMMODULATION_DISABLE_V22BIS 0x00000008L
#define PCINIT_MODEMMODULATION_DISABLE_V32 0x00000010L
#define PCINIT_MODEMMODULATION_DISABLE_V32BIS 0x00000020L
#define PCINIT_MODEMMODULATION_DISABLE_V34 0x00000040L
#define PCINIT_MODEMMODULATION_DISABLE_V90 0x00000080L
#define PCINIT_MODEMMODULATION_DISABLE_BELL103 0x00000100L
#define PCINIT_MODEMMODULATION_DISABLE_BELL212A 0x00000200L
#define PCINIT_MODEMMODULATION_DISABLE_VFC 0x00000400L
#define PCINIT_MODEMMODULATION_DISABLE_K56FLEX 0x00000800L
#define PCINIT_MODEMMODULATION_DISABLE_X2 0x00001000L
#define PCINIT_MODEMMODULATION_ENABLE_V29FDX 0x00010000L
#define PCINIT_MODEMMODULATION_ENABLE_V33 0x00020000L
#define PCINIT_MODEMMODULATION_ENABLE_V90A 0x00040000L
#define PCINIT_MODEM_TRANSMIT_LEVEL_CHOICES 0x10
#define PCINIT_MODEM_SPEAKER_OFF 0x00
#define PCINIT_MODEM_SPEAKER_DURING_TRAIN 0x01
#define PCINIT_MODEM_SPEAKER_TIL_CONNECT 0x02
#define PCINIT_MODEM_SPEAKER_ALWAYS_ON 0x03
#define PCINIT_MODEM_SPEAKER_CHOICES 0x04
#define PCINIT_MODEM_SPEAKER_VOLUME_MIN 0x00
#define PCINIT_MODEM_SPEAKER_VOLUME_LOW 0x01
#define PCINIT_MODEM_SPEAKER_VOLUME_HIGH 0x02
#define PCINIT_MODEM_SPEAKER_VOLUME_MAX 0x03
#define PCINIT_MODEM_SPEAKER_VOLUME_CHOICES 0x04
/*------------------------------------------------------------------*/
#define PCINIT_FAXCONFIG_DISABLE_FINE 0x0001
#define PCINIT_FAXCONFIG_DISABLE_ECM 0x0002
#define PCINIT_FAXCONFIG_ECM_64_BYTES 0x0004
#define PCINIT_FAXCONFIG_DISABLE_2D_CODING 0x0008
#define PCINIT_FAXCONFIG_DISABLE_T6_CODING 0x0010
#define PCINIT_FAXCONFIG_DISABLE_UNCOMPR 0x0020
#define PCINIT_FAXCONFIG_REFUSE_POLLING 0x0040
#define PCINIT_FAXCONFIG_HIDE_TOTAL_PAGES 0x0080
#define PCINIT_FAXCONFIG_HIDE_ALL_HEADLINE 0x0100
#define PCINIT_FAXCONFIG_HIDE_PAGE_INFO 0x0180
#define PCINIT_FAXCONFIG_HEADLINE_OPTIONS_MASK 0x0180
#define PCINIT_FAXCONFIG_DISABLE_FEATURE_FALLBACK 0x0200
#define PCINIT_FAXCONFIG_V34FAX_CONTROL_RATE_1200 0x0800
#define PCINIT_FAXCONFIG_DISABLE_V34FAX 0x1000
#define PCINIT_FAXCONFIG_DISABLE_R8_0770_OR_200 0x01
#define PCINIT_FAXCONFIG_DISABLE_R8_1540 0x02
#define PCINIT_FAXCONFIG_DISABLE_R16_1540_OR_400 0x04
#define PCINIT_FAXCONFIG_DISABLE_R4_0385_OR_100 0x08
#define PCINIT_FAXCONFIG_DISABLE_300_300 0x10
#define PCINIT_FAXCONFIG_DISABLE_INCH_BASED 0x40
#define PCINIT_FAXCONFIG_DISABLE_METRIC_BASED 0x80
#define PCINIT_FAXCONFIG_REC_WIDTH_ISO_A3 0
#define PCINIT_FAXCONFIG_REC_WIDTH_ISO_B4 1
#define PCINIT_FAXCONFIG_REC_WIDTH_ISO_A4 2
#define PCINIT_FAXCONFIG_REC_WIDTH_COUNT 3
#define PCINIT_FAXCONFIG_REC_LENGTH_UNLIMITED 0
#define PCINIT_FAXCONFIG_REC_LENGTH_ISO_B4 1
#define PCINIT_FAXCONFIG_REC_LENGTH_ISO_A4 2
#define PCINIT_FAXCONFIG_REC_LENGTH_COUNT 3
#define PCINIT_FAXCONFIG_SCANLINE_TIME_00_00_00 0
#define PCINIT_FAXCONFIG_SCANLINE_TIME_05_05_05 1
#define PCINIT_FAXCONFIG_SCANLINE_TIME_10_05_05 2
#define PCINIT_FAXCONFIG_SCANLINE_TIME_10_10_10 3
#define PCINIT_FAXCONFIG_SCANLINE_TIME_20_10_10 4
#define PCINIT_FAXCONFIG_SCANLINE_TIME_20_20_20 5
#define PCINIT_FAXCONFIG_SCANLINE_TIME_40_20_20 6
#define PCINIT_FAXCONFIG_SCANLINE_TIME_40_40_40 7
#define PCINIT_FAXCONFIG_SCANLINE_TIME_RES_8 8
#define PCINIT_FAXCONFIG_SCANLINE_TIME_RES_9 9
#define PCINIT_FAXCONFIG_SCANLINE_TIME_RES_10 10
#define PCINIT_FAXCONFIG_SCANLINE_TIME_10_10_05 11
#define PCINIT_FAXCONFIG_SCANLINE_TIME_20_10_05 12
#define PCINIT_FAXCONFIG_SCANLINE_TIME_20_20_10 13
#define PCINIT_FAXCONFIG_SCANLINE_TIME_40_20_10 14
#define PCINIT_FAXCONFIG_SCANLINE_TIME_40_40_20 15
#define PCINIT_FAXCONFIG_SCANLINE_TIME_COUNT 16
#define PCINIT_FAXCONFIG_DISABLE_TX_REDUCTION 0x00010000L
#define PCINIT_FAXCONFIG_DISABLE_PRECODING 0x00020000L
#define PCINIT_FAXCONFIG_DISABLE_PREEMPHASIS 0x00040000L
#define PCINIT_FAXCONFIG_DISABLE_SHAPING 0x00080000L
#define PCINIT_FAXCONFIG_DISABLE_NONLINEAR_EN 0x00100000L
#define PCINIT_FAXCONFIG_DISABLE_MANUALREDUCT 0x00200000L
#define PCINIT_FAXCONFIG_DISABLE_16_POINT_TRN 0x00400000L
#define PCINIT_FAXCONFIG_DISABLE_2400_SYMBOLS 0x01000000L
#define PCINIT_FAXCONFIG_DISABLE_2743_SYMBOLS 0x02000000L
#define PCINIT_FAXCONFIG_DISABLE_2800_SYMBOLS 0x04000000L
#define PCINIT_FAXCONFIG_DISABLE_3000_SYMBOLS 0x08000000L
#define PCINIT_FAXCONFIG_DISABLE_3200_SYMBOLS 0x10000000L
#define PCINIT_FAXCONFIG_DISABLE_3429_SYMBOLS 0x20000000L
/*--------------------------------------------------------------------------*/
#define PCINIT_XDI_CMA_FOR_ALL_NL_PRIMITIVES 0x01
/*--------------------------------------------------------------------------*/
#define PCINIT_FPGA_PLX_ACCESS_SUPPORTED 0x01
/*--------------------------------------------------------------------------*/
#endif
/*--------------------------------------------------------------------------*/

View File

@ -1,160 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifdef PLATFORM_GT_32BIT
/* #define POINTER_32BIT byte * __ptr32 */
#define POINTER_32BIT dword
#else
#define POINTER_32BIT byte *
#endif
#if !defined(MIPS_SCOM)
#define BUFFER_SZ 48
#define MAINT_OFFS 0x380
#else
#define BUFFER_SZ 128
#if defined(PRI)
#define MAINT_OFFS 0xef00
#else
#define MAINT_OFFS 0xff00
#endif
#endif
#define MIPS_BUFFER_SZ 128
#if defined(PRI)
#define MIPS_MAINT_OFFS 0xef00
#else
#define MIPS_MAINT_OFFS 0xff00
#endif
#define LOG 1
#define MEMR 2
#define MEMW 3
#define IOR 4
#define IOW 5
#define B1TEST 6
#define B2TEST 7
#define BTESTOFF 8
#define DSIG_STATS 9
#define B_CH_STATS 10
#define D_CH_STATS 11
#define BL1_STATS 12
#define BL1_STATS_C 13
#define GET_VERSION 14
#define OS_STATS 15
#define XLOG_SET_MASK 16
#define XLOG_GET_MASK 17
#define DSP_READ 20
#define DSP_WRITE 21
#define OK 0xff
#define MORE_EVENTS 0xfe
#define NO_EVENT 1
struct DSigStruc
{
byte Id;
byte u;
byte listen;
byte active;
byte sin[3];
byte bc[6];
byte llc[6];
byte hlc[6];
byte oad[20];
};
struct BL1Struc {
dword cx_b1;
dword cx_b2;
dword cr_b1;
dword cr_b2;
dword px_b1;
dword px_b2;
dword pr_b1;
dword pr_b2;
word er_b1;
word er_b2;
};
struct L2Struc {
dword XTotal;
dword RTotal;
word XError;
word RError;
};
struct OSStruc {
dword free_n;
};
typedef union
{
struct DSigStruc DSigStats;
struct BL1Struc BL1Stats;
struct L2Struc L2Stats;
struct OSStruc OSStats;
byte b[BUFFER_SZ];
word w[BUFFER_SZ >> 1];
word l[BUFFER_SZ >> 2]; /* word is wrong, do not use! Use 'd' instead. */
dword d[BUFFER_SZ >> 2];
} BUFFER;
typedef union
{
struct DSigStruc DSigStats;
struct BL1Struc BL1Stats;
struct L2Struc L2Stats;
struct OSStruc OSStats;
byte b[MIPS_BUFFER_SZ];
word w[MIPS_BUFFER_SZ >> 1];
word l[BUFFER_SZ >> 2]; /* word is wrong, do not use! Use 'd' instead. */
dword d[MIPS_BUFFER_SZ >> 2];
} MIPS_BUFFER;
#if !defined(MIPS_SCOM)
struct pc_maint
{
byte req;
byte rc;
POINTER_32BIT mem;
short length;
word port;
byte fill[6];
BUFFER data;
};
#else
struct pc_maint
{
byte req;
byte rc;
byte reserved[2]; /* R3000 alignment ... */
POINTER_32BIT mem;
short length;
word port;
byte fill[4]; /* data at offset 16 */
BUFFER data;
};
#endif
struct mi_pc_maint
{
byte req;
byte rc;
byte reserved[2]; /* R3000 alignment ... */
POINTER_32BIT mem;
short length;
word port;
byte fill[4]; /* data at offset 16 */
MIPS_BUFFER data;
};

View File

@ -1,43 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef __DIVA_XDI_OS_DEPENDENT_PACK_MAIN_ON_BYTE_INC__
#define __DIVA_XDI_OS_DEPENDENT_PACK_MAIN_ON_BYTE_INC__
/*
Only one purpose of this compiler dependent file to pack
structures, described in pc_maint.h so that no padding
will be included.
With microsoft compile it is done by "pshpack1.h" and
after is restored by "poppack.h"
*/
#include "pc_maint.h"
#endif

View File

@ -1,369 +0,0 @@
/* $Id: platform.h,v 1.37.4.6 2005/01/31 12:22:20 armin Exp $
*
* platform.h
*
*
* Copyright 2000-2003 by Armin Schindler (mac@melware.de)
* Copyright 2000 Eicon Networks
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*/
#ifndef __PLATFORM_H__
#define __PLATFORM_H__
#if !defined(DIVA_BUILD)
#define DIVA_BUILD "local"
#endif
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/skbuff.h>
#include <linux/vmalloc.h>
#include <linux/proc_fs.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/list.h>
#include <asm/types.h>
#include <asm/io.h>
#include "cardtype.h"
/* activate debuglib for modules only */
#ifndef MODULE
#define DIVA_NO_DEBUGLIB
#endif
#define DIVA_USER_MODE_CARD_CONFIG 1
#define USE_EXTENDED_DEBUGS 1
#define MAX_ADAPTER 32
#define DIVA_ISTREAM 1
#define MEMORY_SPACE_TYPE 0
#define PORT_SPACE_TYPE 1
#include <linux/string.h>
#ifndef byte
#define byte u8
#endif
#ifndef word
#define word u16
#endif
#ifndef dword
#define dword u32
#endif
#ifndef qword
#define qword u64
#endif
#ifndef NULL
#define NULL ((void *) 0)
#endif
#ifndef far
#define far
#endif
#ifndef _pascal
#define _pascal
#endif
#ifndef _loadds
#define _loadds
#endif
#ifndef _cdecl
#define _cdecl
#endif
#define MEM_TYPE_RAM 0
#define MEM_TYPE_PORT 1
#define MEM_TYPE_PROM 2
#define MEM_TYPE_CTLREG 3
#define MEM_TYPE_RESET 4
#define MEM_TYPE_CFG 5
#define MEM_TYPE_ADDRESS 6
#define MEM_TYPE_CONFIG 7
#define MEM_TYPE_CONTROL 8
#define MAX_MEM_TYPE 10
#define DIVA_OS_MEM_ATTACH_RAM(a) ((a)->ram)
#define DIVA_OS_MEM_ATTACH_PORT(a) ((a)->port)
#define DIVA_OS_MEM_ATTACH_PROM(a) ((a)->prom)
#define DIVA_OS_MEM_ATTACH_CTLREG(a) ((a)->ctlReg)
#define DIVA_OS_MEM_ATTACH_RESET(a) ((a)->reset)
#define DIVA_OS_MEM_ATTACH_CFG(a) ((a)->cfg)
#define DIVA_OS_MEM_ATTACH_ADDRESS(a) ((a)->Address)
#define DIVA_OS_MEM_ATTACH_CONFIG(a) ((a)->Config)
#define DIVA_OS_MEM_ATTACH_CONTROL(a) ((a)->Control)
#define DIVA_OS_MEM_DETACH_RAM(a, x) do { } while (0)
#define DIVA_OS_MEM_DETACH_PORT(a, x) do { } while (0)
#define DIVA_OS_MEM_DETACH_PROM(a, x) do { } while (0)
#define DIVA_OS_MEM_DETACH_CTLREG(a, x) do { } while (0)
#define DIVA_OS_MEM_DETACH_RESET(a, x) do { } while (0)
#define DIVA_OS_MEM_DETACH_CFG(a, x) do { } while (0)
#define DIVA_OS_MEM_DETACH_ADDRESS(a, x) do { } while (0)
#define DIVA_OS_MEM_DETACH_CONFIG(a, x) do { } while (0)
#define DIVA_OS_MEM_DETACH_CONTROL(a, x) do { } while (0)
#define DIVA_INVALID_FILE_HANDLE ((dword)(-1))
#define DIVAS_CONTAINING_RECORD(address, type, field) \
((type *)((char *)(address) - (char *)(&((type *)0)->field)))
extern int sprintf(char *, const char *, ...);
typedef void *LIST_ENTRY;
typedef char DEVICE_NAME[64];
typedef struct _ISDN_ADAPTER ISDN_ADAPTER;
typedef struct _ISDN_ADAPTER *PISDN_ADAPTER;
typedef void (*DIVA_DI_PRINTF)(unsigned char *, ...);
#include "debuglib.h"
#define dtrc(p) DBG_PRV0(p)
#define dbug(a, p) DBG_PRV1(p)
typedef struct e_info_s E_INFO;
typedef char diva_os_dependent_devica_name_t[64];
typedef void *PDEVICE_OBJECT;
struct _diva_os_soft_isr;
struct _diva_os_timer;
struct _ISDN_ADAPTER;
void diva_log_info(unsigned char *, ...);
/*
** XDI DIDD Interface
*/
void diva_xdi_didd_register_adapter(int card);
void diva_xdi_didd_remove_adapter(int card);
/*
** memory allocation
*/
static __inline__ void *diva_os_malloc(unsigned long flags, unsigned long size)
{
void *ret = NULL;
if (size) {
ret = (void *) vmalloc((unsigned int) size);
}
return (ret);
}
static __inline__ void diva_os_free(unsigned long flags, void *ptr)
{
vfree(ptr);
}
/*
** use skbuffs for message buffer
*/
typedef struct sk_buff diva_os_message_buffer_s;
diva_os_message_buffer_s *diva_os_alloc_message_buffer(unsigned long size, void **data_buf);
void diva_os_free_message_buffer(diva_os_message_buffer_s *dmb);
#define DIVA_MESSAGE_BUFFER_LEN(x) x->len
#define DIVA_MESSAGE_BUFFER_DATA(x) x->data
/*
** mSeconds waiting
*/
static __inline__ void diva_os_sleep(dword mSec)
{
msleep(mSec);
}
static __inline__ void diva_os_wait(dword mSec)
{
mdelay(mSec);
}
/*
** PCI Configuration space access
*/
void PCIwrite(byte bus, byte func, int offset, void *data, int length, void *pci_dev_handle);
void PCIread(byte bus, byte func, int offset, void *data, int length, void *pci_dev_handle);
/*
** I/O Port utilities
*/
int diva_os_register_io_port(void *adapter, int reg, unsigned long port,
unsigned long length, const char *name, int id);
/*
** I/O port access abstraction
*/
byte inpp(void __iomem *);
word inppw(void __iomem *);
void inppw_buffer(void __iomem *, void *, int);
void outppw(void __iomem *, word);
void outppw_buffer(void __iomem * , void*, int);
void outpp(void __iomem *, word);
/*
** IRQ
*/
typedef struct _diva_os_adapter_irq_info {
byte irq_nr;
int registered;
char irq_name[24];
} diva_os_adapter_irq_info_t;
int diva_os_register_irq(void *context, byte irq, const char *name);
void diva_os_remove_irq(void *context, byte irq);
#define diva_os_in_irq() in_irq()
/*
** Spin Lock framework
*/
typedef long diva_os_spin_lock_magic_t;
typedef spinlock_t diva_os_spin_lock_t;
static __inline__ int diva_os_initialize_spin_lock(spinlock_t *lock, void *unused) { \
spin_lock_init(lock); return (0); }
static __inline__ void diva_os_enter_spin_lock(diva_os_spin_lock_t *a, \
diva_os_spin_lock_magic_t *old_irql, \
void *dbg) { spin_lock_bh(a); }
static __inline__ void diva_os_leave_spin_lock(diva_os_spin_lock_t *a, \
diva_os_spin_lock_magic_t *old_irql, \
void *dbg) { spin_unlock_bh(a); }
#define diva_os_destroy_spin_lock(a, b) do { } while (0)
/*
** Deffered processing framework
*/
typedef int (*diva_os_isr_callback_t)(struct _ISDN_ADAPTER *);
typedef void (*diva_os_soft_isr_callback_t)(struct _diva_os_soft_isr *psoft_isr, void *context);
typedef struct _diva_os_soft_isr {
void *object;
diva_os_soft_isr_callback_t callback;
void *callback_context;
char dpc_thread_name[24];
} diva_os_soft_isr_t;
int diva_os_initialize_soft_isr(diva_os_soft_isr_t *psoft_isr, diva_os_soft_isr_callback_t callback, void *callback_context);
int diva_os_schedule_soft_isr(diva_os_soft_isr_t *psoft_isr);
int diva_os_cancel_soft_isr(diva_os_soft_isr_t *psoft_isr);
void diva_os_remove_soft_isr(diva_os_soft_isr_t *psoft_isr);
/*
Get time service
*/
void diva_os_get_time(dword *sec, dword *usec);
/*
** atomic operation, fake because we use threads
*/
typedef int diva_os_atomic_t;
static inline diva_os_atomic_t
diva_os_atomic_increment(diva_os_atomic_t *pv)
{
*pv += 1;
return (*pv);
}
static inline diva_os_atomic_t
diva_os_atomic_decrement(diva_os_atomic_t *pv)
{
*pv -= 1;
return (*pv);
}
/*
** CAPI SECTION
*/
#define NO_CORNETN
#define IMPLEMENT_DTMF 1
#define IMPLEMENT_ECHO_CANCELLER 1
#define IMPLEMENT_RTP 1
#define IMPLEMENT_T38 1
#define IMPLEMENT_FAX_SUB_SEP_PWD 1
#define IMPLEMENT_V18 1
#define IMPLEMENT_DTMF_TONE 1
#define IMPLEMENT_PIAFS 1
#define IMPLEMENT_FAX_PAPER_FORMATS 1
#define IMPLEMENT_VOWN 1
#define IMPLEMENT_CAPIDTMF 1
#define IMPLEMENT_FAX_NONSTANDARD 1
#define VSWITCH_SUPPORT 1
#define IMPLEMENT_MARKED_OK_AFTER_FC 1
#define DIVA_IDI_RX_DMA 1
/*
** endian macros
**
** If only... In some cases we did use them for endianness conversion;
** unfortunately, other uses were real iomem accesses.
*/
#define READ_BYTE(addr) readb(addr)
#define READ_WORD(addr) readw(addr)
#define READ_DWORD(addr) readl(addr)
#define WRITE_BYTE(addr, v) writeb(v, addr)
#define WRITE_WORD(addr, v) writew(v, addr)
#define WRITE_DWORD(addr, v) writel(v, addr)
static inline __u16 GET_WORD(void *addr)
{
return le16_to_cpu(*(__le16 *)addr);
}
static inline __u32 GET_DWORD(void *addr)
{
return le32_to_cpu(*(__le32 *)addr);
}
static inline void PUT_WORD(void *addr, __u16 v)
{
*(__le16 *)addr = cpu_to_le16(v);
}
static inline void PUT_DWORD(void *addr, __u32 v)
{
*(__le32 *)addr = cpu_to_le32(v);
}
/*
** 32/64 bit macors
*/
#ifdef BITS_PER_LONG
#if BITS_PER_LONG > 32
#define PLATFORM_GT_32BIT
#define ULongToPtr(x) (void *)(unsigned long)(x)
#endif
#endif
/*
** undef os definitions of macros we use
*/
#undef ID_MASK
#undef N_DATA
#undef ADDR
/*
** dump file
*/
#define diva_os_dump_file_t char
#define diva_os_board_trace_t char
#define diva_os_dump_file(__x__) do { } while (0)
/*
** size of internal arrays
*/
#define MAX_DESCRIPTORS 64
#endif /* __PLATFORM_H__ */

View File

@ -1,76 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
struct pr_ram {
word NextReq; /* pointer to next Req Buffer */
word NextRc; /* pointer to next Rc Buffer */
word NextInd; /* pointer to next Ind Buffer */
byte ReqInput; /* number of Req Buffers sent */
byte ReqOutput; /* number of Req Buffers returned */
byte ReqReserved; /* number of Req Buffers reserved */
byte Int; /* ISDN-P interrupt */
byte XLock; /* Lock field for arbitration */
byte RcOutput; /* number of Rc buffers received */
byte IndOutput; /* number of Ind buffers received */
byte IMask; /* Interrupt Mask Flag */
byte Reserved1[2]; /* reserved field, do not use */
byte ReadyInt; /* request field for ready interrupt */
byte Reserved2[12]; /* reserved field, do not use */
byte InterfaceType; /* interface type 1=16K interface */
word Signature; /* ISDN-P initialized indication */
byte B[1]; /* buffer space for Req,Ind and Rc */
};
typedef struct {
word next;
byte Req;
byte ReqId;
byte ReqCh;
byte Reserved1;
word Reference;
byte Reserved[8];
PBUFFER XBuffer;
} REQ;
typedef struct {
word next;
byte Rc;
byte RcId;
byte RcCh;
byte Reserved1;
word Reference;
byte Reserved2[8];
} RC;
typedef struct {
word next;
byte Ind;
byte IndId;
byte IndCh;
byte MInd;
word MLength;
word Reference;
byte RNR;
byte Reserved;
dword Ack;
PBUFFER RBuffer;
} IND;

View File

@ -1,510 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include "platform.h"
#include "di_defs.h"
#include "pc.h"
#include "pr_pc.h"
#include "di.h"
#include "mi_pc.h"
#include "pc_maint.h"
#include "divasync.h"
#include "pc_init.h"
#include "io.h"
#include "helpers.h"
#include "dsrv4bri.h"
#include "dsp_defs.h"
#include "sdp_hdr.h"
/*****************************************************************************/
#define MAX_XLOG_SIZE (64 * 1024)
/* --------------------------------------------------------------------------
Recovery XLOG from QBRI Card
-------------------------------------------------------------------------- */
static void qBri_cpu_trapped(PISDN_ADAPTER IoAdapter) {
byte __iomem *base;
word *Xlog;
dword regs[4], TrapID, offset, size;
Xdesc xlogDesc;
int factor = (IoAdapter->tasks == 1) ? 1 : 2;
/*
* check for trapped MIPS 46xx CPU, dump exception frame
*/
base = DIVA_OS_MEM_ATTACH_CONTROL(IoAdapter);
offset = IoAdapter->ControllerNumber * (IoAdapter->MemorySize >> factor);
TrapID = READ_DWORD(&base[0x80]);
if ((TrapID == 0x99999999) || (TrapID == 0x99999901))
{
dump_trap_frame(IoAdapter, &base[0x90]);
IoAdapter->trapped = 1;
}
regs[0] = READ_DWORD((base + offset) + 0x70);
regs[1] = READ_DWORD((base + offset) + 0x74);
regs[2] = READ_DWORD((base + offset) + 0x78);
regs[3] = READ_DWORD((base + offset) + 0x7c);
regs[0] &= IoAdapter->MemorySize - 1;
if ((regs[0] >= offset)
&& (regs[0] < offset + (IoAdapter->MemorySize >> factor) - 1))
{
if (!(Xlog = (word *)diva_os_malloc(0, MAX_XLOG_SIZE))) {
DIVA_OS_MEM_DETACH_CONTROL(IoAdapter, base);
return;
}
size = offset + (IoAdapter->MemorySize >> factor) - regs[0];
if (size > MAX_XLOG_SIZE)
size = MAX_XLOG_SIZE;
memcpy_fromio(Xlog, &base[regs[0]], size);
xlogDesc.buf = Xlog;
xlogDesc.cnt = READ_WORD(&base[regs[1] & (IoAdapter->MemorySize - 1)]);
xlogDesc.out = READ_WORD(&base[regs[2] & (IoAdapter->MemorySize - 1)]);
dump_xlog_buffer(IoAdapter, &xlogDesc);
diva_os_free(0, Xlog);
IoAdapter->trapped = 2;
}
DIVA_OS_MEM_DETACH_CONTROL(IoAdapter, base);
}
/* --------------------------------------------------------------------------
Reset QBRI Hardware
-------------------------------------------------------------------------- */
static void reset_qBri_hardware(PISDN_ADAPTER IoAdapter) {
word volatile __iomem *qBriReset;
byte volatile __iomem *qBriCntrl;
byte volatile __iomem *p;
qBriReset = (word volatile __iomem *)DIVA_OS_MEM_ATTACH_PROM(IoAdapter);
WRITE_WORD(qBriReset, READ_WORD(qBriReset) | PLX9054_SOFT_RESET);
diva_os_wait(1);
WRITE_WORD(qBriReset, READ_WORD(qBriReset) & ~PLX9054_SOFT_RESET);
diva_os_wait(1);
WRITE_WORD(qBriReset, READ_WORD(qBriReset) | PLX9054_RELOAD_EEPROM);
diva_os_wait(1);
WRITE_WORD(qBriReset, READ_WORD(qBriReset) & ~PLX9054_RELOAD_EEPROM);
diva_os_wait(1);
DIVA_OS_MEM_DETACH_PROM(IoAdapter, qBriReset);
qBriCntrl = DIVA_OS_MEM_ATTACH_CTLREG(IoAdapter);
p = &qBriCntrl[DIVA_4BRI_REVISION(IoAdapter) ? (MQ2_BREG_RISC) : (MQ_BREG_RISC)];
WRITE_DWORD(p, 0);
DIVA_OS_MEM_DETACH_CTLREG(IoAdapter, qBriCntrl);
DBG_TRC(("resetted board @ reset addr 0x%08lx", qBriReset))
DBG_TRC(("resetted board @ cntrl addr 0x%08lx", p))
}
/* --------------------------------------------------------------------------
Start Card CPU
-------------------------------------------------------------------------- */
void start_qBri_hardware(PISDN_ADAPTER IoAdapter) {
byte volatile __iomem *qBriReset;
byte volatile __iomem *p;
p = DIVA_OS_MEM_ATTACH_CTLREG(IoAdapter);
qBriReset = &p[(DIVA_4BRI_REVISION(IoAdapter)) ? (MQ2_BREG_RISC) : (MQ_BREG_RISC)];
WRITE_DWORD(qBriReset, MQ_RISC_COLD_RESET_MASK);
diva_os_wait(2);
WRITE_DWORD(qBriReset, MQ_RISC_WARM_RESET_MASK | MQ_RISC_COLD_RESET_MASK);
diva_os_wait(10);
DIVA_OS_MEM_DETACH_CTLREG(IoAdapter, p);
DBG_TRC(("started processor @ addr 0x%08lx", qBriReset))
}
/* --------------------------------------------------------------------------
Stop Card CPU
-------------------------------------------------------------------------- */
static void stop_qBri_hardware(PISDN_ADAPTER IoAdapter) {
byte volatile __iomem *p;
dword volatile __iomem *qBriReset;
dword volatile __iomem *qBriIrq;
dword volatile __iomem *qBriIsacDspReset;
int rev2 = DIVA_4BRI_REVISION(IoAdapter);
int reset_offset = rev2 ? (MQ2_BREG_RISC) : (MQ_BREG_RISC);
int irq_offset = rev2 ? (MQ2_BREG_IRQ_TEST) : (MQ_BREG_IRQ_TEST);
int hw_offset = rev2 ? (MQ2_ISAC_DSP_RESET) : (MQ_ISAC_DSP_RESET);
if (IoAdapter->ControllerNumber > 0)
return;
p = DIVA_OS_MEM_ATTACH_CTLREG(IoAdapter);
qBriReset = (dword volatile __iomem *)&p[reset_offset];
qBriIsacDspReset = (dword volatile __iomem *)&p[hw_offset];
/*
* clear interrupt line (reset Local Interrupt Test Register)
*/
WRITE_DWORD(qBriReset, 0);
WRITE_DWORD(qBriIsacDspReset, 0);
DIVA_OS_MEM_DETACH_CTLREG(IoAdapter, p);
p = DIVA_OS_MEM_ATTACH_RESET(IoAdapter);
WRITE_BYTE(&p[PLX9054_INTCSR], 0x00); /* disable PCI interrupts */
DIVA_OS_MEM_DETACH_RESET(IoAdapter, p);
p = DIVA_OS_MEM_ATTACH_CTLREG(IoAdapter);
qBriIrq = (dword volatile __iomem *)&p[irq_offset];
WRITE_DWORD(qBriIrq, MQ_IRQ_REQ_OFF);
DIVA_OS_MEM_DETACH_CTLREG(IoAdapter, p);
DBG_TRC(("stopped processor @ addr 0x%08lx", qBriReset))
}
/* --------------------------------------------------------------------------
FPGA download
-------------------------------------------------------------------------- */
#define FPGA_NAME_OFFSET 0x10
static byte *qBri_check_FPGAsrc(PISDN_ADAPTER IoAdapter, char *FileName,
dword *Length, dword *code) {
byte *File;
char *fpgaFile, *fpgaType, *fpgaDate, *fpgaTime;
dword fpgaFlen, fpgaTlen, fpgaDlen, cnt, year, i;
if (!(File = (byte *)xdiLoadFile(FileName, Length, 0))) {
return (NULL);
}
/*
* scan file until FF and put id string into buffer
*/
for (i = 0; File[i] != 0xff;)
{
if (++i >= *Length)
{
DBG_FTL(("FPGA download: start of data header not found"))
xdiFreeFile(File);
return (NULL);
}
}
*code = i++;
if ((File[i] & 0xF0) != 0x20)
{
DBG_FTL(("FPGA download: data header corrupted"))
xdiFreeFile(File);
return (NULL);
}
fpgaFlen = (dword)File[FPGA_NAME_OFFSET - 1];
if (fpgaFlen == 0)
fpgaFlen = 12;
fpgaFile = (char *)&File[FPGA_NAME_OFFSET];
fpgaTlen = (dword)fpgaFile[fpgaFlen + 2];
if (fpgaTlen == 0)
fpgaTlen = 10;
fpgaType = (char *)&fpgaFile[fpgaFlen + 3];
fpgaDlen = (dword) fpgaType[fpgaTlen + 2];
if (fpgaDlen == 0)
fpgaDlen = 11;
fpgaDate = (char *)&fpgaType[fpgaTlen + 3];
fpgaTime = (char *)&fpgaDate[fpgaDlen + 3];
cnt = (dword)(((File[i] & 0x0F) << 20) + (File[i + 1] << 12)
+ (File[i + 2] << 4) + (File[i + 3] >> 4));
if ((dword)(i + (cnt / 8)) > *Length)
{
DBG_FTL(("FPGA download: '%s' file too small (%ld < %ld)",
FileName, *Length, code + ((cnt + 7) / 8)))
xdiFreeFile(File);
return (NULL);
}
i = 0;
do
{
while ((fpgaDate[i] != '\0')
&& ((fpgaDate[i] < '0') || (fpgaDate[i] > '9')))
{
i++;
}
year = 0;
while ((fpgaDate[i] >= '0') && (fpgaDate[i] <= '9'))
year = year * 10 + (fpgaDate[i++] - '0');
} while ((year < 2000) && (fpgaDate[i] != '\0'));
switch (IoAdapter->cardType) {
case CARDTYPE_DIVASRV_B_2F_PCI:
break;
default:
if (year >= 2001) {
IoAdapter->fpga_features |= PCINIT_FPGA_PLX_ACCESS_SUPPORTED;
}
}
DBG_LOG(("FPGA[%s] file %s (%s %s) len %d",
fpgaType, fpgaFile, fpgaDate, fpgaTime, cnt))
return (File);
}
/******************************************************************************/
#define FPGA_PROG 0x0001 /* PROG enable low */
#define FPGA_BUSY 0x0002 /* BUSY high, DONE low */
#define FPGA_CS 0x000C /* Enable I/O pins */
#define FPGA_CCLK 0x0100
#define FPGA_DOUT 0x0400
#define FPGA_DIN FPGA_DOUT /* bidirectional I/O */
int qBri_FPGA_download(PISDN_ADAPTER IoAdapter) {
int bit;
byte *File;
dword code, FileLength;
word volatile __iomem *addr = (word volatile __iomem *)DIVA_OS_MEM_ATTACH_PROM(IoAdapter);
word val, baseval = FPGA_CS | FPGA_PROG;
if (DIVA_4BRI_REVISION(IoAdapter))
{
char *name;
switch (IoAdapter->cardType) {
case CARDTYPE_DIVASRV_B_2F_PCI:
name = "dsbri2f.bit";
break;
case CARDTYPE_DIVASRV_B_2M_V2_PCI:
case CARDTYPE_DIVASRV_VOICE_B_2M_V2_PCI:
name = "dsbri2m.bit";
break;
default:
name = "ds4bri2.bit";
}
File = qBri_check_FPGAsrc(IoAdapter, name,
&FileLength, &code);
}
else
{
File = qBri_check_FPGAsrc(IoAdapter, "ds4bri.bit",
&FileLength, &code);
}
if (!File) {
DIVA_OS_MEM_DETACH_PROM(IoAdapter, addr);
return (0);
}
/*
* prepare download, pulse PROGRAM pin down.
*/
WRITE_WORD(addr, baseval & ~FPGA_PROG); /* PROGRAM low pulse */
WRITE_WORD(addr, baseval); /* release */
diva_os_wait(50); /* wait until FPGA finished internal memory clear */
/*
* check done pin, must be low
*/
if (READ_WORD(addr) & FPGA_BUSY)
{
DBG_FTL(("FPGA download: acknowledge for FPGA memory clear missing"))
xdiFreeFile(File);
DIVA_OS_MEM_DETACH_PROM(IoAdapter, addr);
return (0);
}
/*
* put data onto the FPGA
*/
while (code < FileLength)
{
val = ((word)File[code++]) << 3;
for (bit = 8; bit-- > 0; val <<= 1) /* put byte onto FPGA */
{
baseval &= ~FPGA_DOUT; /* clr data bit */
baseval |= (val & FPGA_DOUT); /* copy data bit */
WRITE_WORD(addr, baseval);
WRITE_WORD(addr, baseval | FPGA_CCLK); /* set CCLK hi */
WRITE_WORD(addr, baseval | FPGA_CCLK); /* set CCLK hi */
WRITE_WORD(addr, baseval); /* set CCLK lo */
}
}
xdiFreeFile(File);
diva_os_wait(100);
val = READ_WORD(addr);
DIVA_OS_MEM_DETACH_PROM(IoAdapter, addr);
if (!(val & FPGA_BUSY))
{
DBG_FTL(("FPGA download: chip remains in busy state (0x%04x)", val))
return (0);
}
return (1);
}
static int load_qBri_hardware(PISDN_ADAPTER IoAdapter) {
return (0);
}
/* --------------------------------------------------------------------------
Card ISR
-------------------------------------------------------------------------- */
static int qBri_ISR(struct _ISDN_ADAPTER *IoAdapter) {
dword volatile __iomem *qBriIrq;
PADAPTER_LIST_ENTRY QuadroList = IoAdapter->QuadroList;
word i;
int serviced = 0;
byte __iomem *p;
p = DIVA_OS_MEM_ATTACH_RESET(IoAdapter);
if (!(READ_BYTE(&p[PLX9054_INTCSR]) & 0x80)) {
DIVA_OS_MEM_DETACH_RESET(IoAdapter, p);
return (0);
}
DIVA_OS_MEM_DETACH_RESET(IoAdapter, p);
/*
* clear interrupt line (reset Local Interrupt Test Register)
*/
p = DIVA_OS_MEM_ATTACH_CTLREG(IoAdapter);
qBriIrq = (dword volatile __iomem *)(&p[DIVA_4BRI_REVISION(IoAdapter) ? (MQ2_BREG_IRQ_TEST) : (MQ_BREG_IRQ_TEST)]);
WRITE_DWORD(qBriIrq, MQ_IRQ_REQ_OFF);
DIVA_OS_MEM_DETACH_CTLREG(IoAdapter, p);
for (i = 0; i < IoAdapter->tasks; ++i)
{
IoAdapter = QuadroList->QuadroAdapter[i];
if (IoAdapter && IoAdapter->Initialized
&& IoAdapter->tst_irq(&IoAdapter->a))
{
IoAdapter->IrqCount++;
serviced = 1;
diva_os_schedule_soft_isr(&IoAdapter->isr_soft_isr);
}
}
return (serviced);
}
/* --------------------------------------------------------------------------
Does disable the interrupt on the card
-------------------------------------------------------------------------- */
static void disable_qBri_interrupt(PISDN_ADAPTER IoAdapter) {
dword volatile __iomem *qBriIrq;
byte __iomem *p;
if (IoAdapter->ControllerNumber > 0)
return;
/*
* clear interrupt line (reset Local Interrupt Test Register)
*/
p = DIVA_OS_MEM_ATTACH_RESET(IoAdapter);
WRITE_BYTE(&p[PLX9054_INTCSR], 0x00); /* disable PCI interrupts */
DIVA_OS_MEM_DETACH_RESET(IoAdapter, p);
p = DIVA_OS_MEM_ATTACH_CTLREG(IoAdapter);
qBriIrq = (dword volatile __iomem *)(&p[DIVA_4BRI_REVISION(IoAdapter) ? (MQ2_BREG_IRQ_TEST) : (MQ_BREG_IRQ_TEST)]);
WRITE_DWORD(qBriIrq, MQ_IRQ_REQ_OFF);
DIVA_OS_MEM_DETACH_CTLREG(IoAdapter, p);
}
/* --------------------------------------------------------------------------
Install Adapter Entry Points
-------------------------------------------------------------------------- */
static void set_common_qBri_functions(PISDN_ADAPTER IoAdapter) {
ADAPTER *a;
a = &IoAdapter->a;
a->ram_in = mem_in;
a->ram_inw = mem_inw;
a->ram_in_buffer = mem_in_buffer;
a->ram_look_ahead = mem_look_ahead;
a->ram_out = mem_out;
a->ram_outw = mem_outw;
a->ram_out_buffer = mem_out_buffer;
a->ram_inc = mem_inc;
IoAdapter->out = pr_out;
IoAdapter->dpc = pr_dpc;
IoAdapter->tst_irq = scom_test_int;
IoAdapter->clr_irq = scom_clear_int;
IoAdapter->pcm = (struct pc_maint *)MIPS_MAINT_OFFS;
IoAdapter->load = load_qBri_hardware;
IoAdapter->disIrq = disable_qBri_interrupt;
IoAdapter->rstFnc = reset_qBri_hardware;
IoAdapter->stop = stop_qBri_hardware;
IoAdapter->trapFnc = qBri_cpu_trapped;
IoAdapter->diva_isr_handler = qBri_ISR;
IoAdapter->a.io = (void *)IoAdapter;
}
static void set_qBri_functions(PISDN_ADAPTER IoAdapter) {
if (!IoAdapter->tasks) {
IoAdapter->tasks = MQ_INSTANCE_COUNT;
}
IoAdapter->MemorySize = MQ_MEMORY_SIZE;
set_common_qBri_functions(IoAdapter);
diva_os_set_qBri_functions(IoAdapter);
}
static void set_qBri2_functions(PISDN_ADAPTER IoAdapter) {
if (!IoAdapter->tasks) {
IoAdapter->tasks = MQ_INSTANCE_COUNT;
}
IoAdapter->MemorySize = (IoAdapter->tasks == 1) ? BRI2_MEMORY_SIZE : MQ2_MEMORY_SIZE;
set_common_qBri_functions(IoAdapter);
diva_os_set_qBri2_functions(IoAdapter);
}
/******************************************************************************/
void prepare_qBri_functions(PISDN_ADAPTER IoAdapter) {
set_qBri_functions(IoAdapter->QuadroList->QuadroAdapter[0]);
set_qBri_functions(IoAdapter->QuadroList->QuadroAdapter[1]);
set_qBri_functions(IoAdapter->QuadroList->QuadroAdapter[2]);
set_qBri_functions(IoAdapter->QuadroList->QuadroAdapter[3]);
}
void prepare_qBri2_functions(PISDN_ADAPTER IoAdapter) {
if (!IoAdapter->tasks) {
IoAdapter->tasks = MQ_INSTANCE_COUNT;
}
set_qBri2_functions(IoAdapter->QuadroList->QuadroAdapter[0]);
if (IoAdapter->tasks > 1) {
set_qBri2_functions(IoAdapter->QuadroList->QuadroAdapter[1]);
set_qBri2_functions(IoAdapter->QuadroList->QuadroAdapter[2]);
set_qBri2_functions(IoAdapter->QuadroList->QuadroAdapter[3]);
}
}
/* -------------------------------------------------------------------------- */

View File

@ -1,191 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include "platform.h"
#include "di_defs.h"
#include "pc.h"
#include "pr_pc.h"
#include "di.h"
#include "mi_pc.h"
#include "pc_maint.h"
#include "divasync.h"
#include "io.h"
#include "helpers.h"
#include "dsrv_bri.h"
#include "dsp_defs.h"
/*****************************************************************************/
#define MAX_XLOG_SIZE (64 * 1024)
/* --------------------------------------------------------------------------
Investigate card state, recovery trace buffer
-------------------------------------------------------------------------- */
static void bri_cpu_trapped(PISDN_ADAPTER IoAdapter) {
byte __iomem *addrHi, *addrLo, *ioaddr;
word *Xlog;
dword regs[4], i, size;
Xdesc xlogDesc;
byte __iomem *Port;
/*
* first read pointers and trap frame
*/
if (!(Xlog = (word *)diva_os_malloc(0, MAX_XLOG_SIZE)))
return;
Port = DIVA_OS_MEM_ATTACH_PORT(IoAdapter);
addrHi = Port + ((IoAdapter->Properties.Bus == BUS_PCI) ? M_PCI_ADDRH : ADDRH);
addrLo = Port + ADDR;
ioaddr = Port + DATA;
outpp(addrHi, 0);
outppw(addrLo, 0);
for (i = 0; i < 0x100; Xlog[i++] = inppw(ioaddr));
/*
* check for trapped MIPS 3xxx CPU, dump only exception frame
*/
if (GET_DWORD(&Xlog[0x80 / sizeof(Xlog[0])]) == 0x99999999)
{
dump_trap_frame(IoAdapter, &((byte *)Xlog)[0x90]);
IoAdapter->trapped = 1;
}
regs[0] = GET_DWORD(&((byte *)Xlog)[0x70]);
regs[1] = GET_DWORD(&((byte *)Xlog)[0x74]);
regs[2] = GET_DWORD(&((byte *)Xlog)[0x78]);
regs[3] = GET_DWORD(&((byte *)Xlog)[0x7c]);
outpp(addrHi, (regs[1] >> 16) & 0x7F);
outppw(addrLo, regs[1] & 0xFFFF);
xlogDesc.cnt = inppw(ioaddr);
outpp(addrHi, (regs[2] >> 16) & 0x7F);
outppw(addrLo, regs[2] & 0xFFFF);
xlogDesc.out = inppw(ioaddr);
xlogDesc.buf = Xlog;
regs[0] &= IoAdapter->MemorySize - 1;
if ((regs[0] < IoAdapter->MemorySize - 1))
{
size = IoAdapter->MemorySize - regs[0];
if (size > MAX_XLOG_SIZE)
size = MAX_XLOG_SIZE;
for (i = 0; i < (size / sizeof(*Xlog)); regs[0] += 2)
{
outpp(addrHi, (regs[0] >> 16) & 0x7F);
outppw(addrLo, regs[0] & 0xFFFF);
Xlog[i++] = inppw(ioaddr);
}
dump_xlog_buffer(IoAdapter, &xlogDesc);
diva_os_free(0, Xlog);
IoAdapter->trapped = 2;
}
outpp(addrHi, (byte)((BRI_UNCACHED_ADDR(IoAdapter->MemoryBase + IoAdapter->MemorySize -
BRI_SHARED_RAM_SIZE)) >> 16));
outppw(addrLo, 0x00);
DIVA_OS_MEM_DETACH_PORT(IoAdapter, Port);
}
/* ---------------------------------------------------------------------
Reset hardware
--------------------------------------------------------------------- */
static void reset_bri_hardware(PISDN_ADAPTER IoAdapter) {
byte __iomem *p = DIVA_OS_MEM_ATTACH_CTLREG(IoAdapter);
outpp(p, 0x00);
DIVA_OS_MEM_DETACH_CTLREG(IoAdapter, p);
}
/* ---------------------------------------------------------------------
Halt system
--------------------------------------------------------------------- */
static void stop_bri_hardware(PISDN_ADAPTER IoAdapter) {
byte __iomem *p = DIVA_OS_MEM_ATTACH_RESET(IoAdapter);
if (p) {
outpp(p, 0x00); /* disable interrupts ! */
}
DIVA_OS_MEM_DETACH_RESET(IoAdapter, p);
p = DIVA_OS_MEM_ATTACH_CTLREG(IoAdapter);
outpp(p, 0x00); /* clear int, halt cpu */
DIVA_OS_MEM_DETACH_CTLREG(IoAdapter, p);
}
static int load_bri_hardware(PISDN_ADAPTER IoAdapter) {
return (0);
}
/******************************************************************************/
static int bri_ISR(struct _ISDN_ADAPTER *IoAdapter) {
byte __iomem *p;
p = DIVA_OS_MEM_ATTACH_CTLREG(IoAdapter);
if (!(inpp(p) & 0x01)) {
DIVA_OS_MEM_DETACH_CTLREG(IoAdapter, p);
return (0);
}
/*
clear interrupt line
*/
outpp(p, 0x08);
DIVA_OS_MEM_DETACH_CTLREG(IoAdapter, p);
IoAdapter->IrqCount++;
if (IoAdapter->Initialized) {
diva_os_schedule_soft_isr(&IoAdapter->isr_soft_isr);
}
return (1);
}
/* --------------------------------------------------------------------------
Disable IRQ in the card hardware
-------------------------------------------------------------------------- */
static void disable_bri_interrupt(PISDN_ADAPTER IoAdapter) {
byte __iomem *p;
p = DIVA_OS_MEM_ATTACH_RESET(IoAdapter);
if (p)
{
outpp(p, 0x00); /* disable interrupts ! */
}
DIVA_OS_MEM_DETACH_RESET(IoAdapter, p);
p = DIVA_OS_MEM_ATTACH_CTLREG(IoAdapter);
outpp(p, 0x00); /* clear int, halt cpu */
DIVA_OS_MEM_DETACH_CTLREG(IoAdapter, p);
}
/* -------------------------------------------------------------------------
Fill card entry points
------------------------------------------------------------------------- */
void prepare_maestra_functions(PISDN_ADAPTER IoAdapter) {
ADAPTER *a = &IoAdapter->a;
a->ram_in = io_in;
a->ram_inw = io_inw;
a->ram_in_buffer = io_in_buffer;
a->ram_look_ahead = io_look_ahead;
a->ram_out = io_out;
a->ram_outw = io_outw;
a->ram_out_buffer = io_out_buffer;
a->ram_inc = io_inc;
IoAdapter->MemoryBase = BRI_MEMORY_BASE;
IoAdapter->MemorySize = BRI_MEMORY_SIZE;
IoAdapter->out = pr_out;
IoAdapter->dpc = pr_dpc;
IoAdapter->tst_irq = scom_test_int;
IoAdapter->clr_irq = scom_clear_int;
IoAdapter->pcm = (struct pc_maint *)MIPS_MAINT_OFFS;
IoAdapter->load = load_bri_hardware;
IoAdapter->disIrq = disable_bri_interrupt;
IoAdapter->rstFnc = reset_bri_hardware;
IoAdapter->stop = stop_bri_hardware;
IoAdapter->trapFnc = bri_cpu_trapped;
IoAdapter->diva_isr_handler = bri_ISR;
/*
Prepare OS dependent functions
*/
diva_os_prepare_maestra_functions(IoAdapter);
}
/* -------------------------------------------------------------------------- */

View File

@ -1,205 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include "platform.h"
#include "di_defs.h"
#include "pc.h"
#include "pr_pc.h"
#include "di.h"
#include "mi_pc.h"
#include "pc_maint.h"
#include "divasync.h"
#include "io.h"
#include "helpers.h"
#include "dsrv_pri.h"
#include "dsp_defs.h"
/*****************************************************************************/
#define MAX_XLOG_SIZE (64 * 1024)
/* -------------------------------------------------------------------------
Does return offset between ADAPTER->ram and real begin of memory
------------------------------------------------------------------------- */
static dword pri_ram_offset(ADAPTER *a) {
return ((dword)MP_SHARED_RAM_OFFSET);
}
/* -------------------------------------------------------------------------
Recovery XLOG buffer from the card
------------------------------------------------------------------------- */
static void pri_cpu_trapped(PISDN_ADAPTER IoAdapter) {
byte __iomem *base;
word *Xlog;
dword regs[4], TrapID, size;
Xdesc xlogDesc;
/*
* check for trapped MIPS 46xx CPU, dump exception frame
*/
base = DIVA_OS_MEM_ATTACH_ADDRESS(IoAdapter);
TrapID = READ_DWORD(&base[0x80]);
if ((TrapID == 0x99999999) || (TrapID == 0x99999901))
{
dump_trap_frame(IoAdapter, &base[0x90]);
IoAdapter->trapped = 1;
}
regs[0] = READ_DWORD(&base[MP_PROTOCOL_OFFSET + 0x70]);
regs[1] = READ_DWORD(&base[MP_PROTOCOL_OFFSET + 0x74]);
regs[2] = READ_DWORD(&base[MP_PROTOCOL_OFFSET + 0x78]);
regs[3] = READ_DWORD(&base[MP_PROTOCOL_OFFSET + 0x7c]);
regs[0] &= IoAdapter->MemorySize - 1;
if ((regs[0] < IoAdapter->MemorySize - 1))
{
if (!(Xlog = (word *)diva_os_malloc(0, MAX_XLOG_SIZE))) {
DIVA_OS_MEM_DETACH_ADDRESS(IoAdapter, base);
return;
}
size = IoAdapter->MemorySize - regs[0];
if (size > MAX_XLOG_SIZE)
size = MAX_XLOG_SIZE;
memcpy_fromio(Xlog, &base[regs[0]], size);
xlogDesc.buf = Xlog;
xlogDesc.cnt = READ_WORD(&base[regs[1] & (IoAdapter->MemorySize - 1)]);
xlogDesc.out = READ_WORD(&base[regs[2] & (IoAdapter->MemorySize - 1)]);
dump_xlog_buffer(IoAdapter, &xlogDesc);
diva_os_free(0, Xlog);
IoAdapter->trapped = 2;
}
DIVA_OS_MEM_DETACH_ADDRESS(IoAdapter, base);
}
/* -------------------------------------------------------------------------
Hardware reset of PRI card
------------------------------------------------------------------------- */
static void reset_pri_hardware(PISDN_ADAPTER IoAdapter) {
byte __iomem *p = DIVA_OS_MEM_ATTACH_RESET(IoAdapter);
WRITE_BYTE(p, _MP_RISC_RESET | _MP_LED1 | _MP_LED2);
diva_os_wait(50);
WRITE_BYTE(p, 0x00);
diva_os_wait(50);
DIVA_OS_MEM_DETACH_RESET(IoAdapter, p);
}
/* -------------------------------------------------------------------------
Stop Card Hardware
------------------------------------------------------------------------- */
static void stop_pri_hardware(PISDN_ADAPTER IoAdapter) {
dword i;
byte __iomem *p;
dword volatile __iomem *cfgReg = (void __iomem *)DIVA_OS_MEM_ATTACH_CFG(IoAdapter);
WRITE_DWORD(&cfgReg[3], 0);
WRITE_DWORD(&cfgReg[1], 0);
DIVA_OS_MEM_DETACH_CFG(IoAdapter, cfgReg);
IoAdapter->a.ram_out(&IoAdapter->a, &RAM->SWReg, SWREG_HALT_CPU);
i = 0;
while ((i < 100) && (IoAdapter->a.ram_in(&IoAdapter->a, &RAM->SWReg) != 0))
{
diva_os_wait(1);
i++;
}
DBG_TRC(("%s: PRI stopped (%d)", IoAdapter->Name, i))
cfgReg = (void __iomem *)DIVA_OS_MEM_ATTACH_CFG(IoAdapter);
WRITE_DWORD(&cfgReg[0], ((dword)(~0x03E00000)));
DIVA_OS_MEM_DETACH_CFG(IoAdapter, cfgReg);
diva_os_wait(1);
p = DIVA_OS_MEM_ATTACH_RESET(IoAdapter);
WRITE_BYTE(p, _MP_RISC_RESET | _MP_LED1 | _MP_LED2);
DIVA_OS_MEM_DETACH_RESET(IoAdapter, p);
}
static int load_pri_hardware(PISDN_ADAPTER IoAdapter) {
return (0);
}
/* --------------------------------------------------------------------------
PRI Adapter interrupt Service Routine
-------------------------------------------------------------------------- */
static int pri_ISR(struct _ISDN_ADAPTER *IoAdapter) {
byte __iomem *cfg = DIVA_OS_MEM_ATTACH_CFG(IoAdapter);
if (!(READ_DWORD(cfg) & 0x80000000)) {
DIVA_OS_MEM_DETACH_CFG(IoAdapter, cfg);
return (0);
}
/*
clear interrupt line
*/
WRITE_DWORD(cfg, (dword)~0x03E00000);
DIVA_OS_MEM_DETACH_CFG(IoAdapter, cfg);
IoAdapter->IrqCount++;
if (IoAdapter->Initialized)
{
diva_os_schedule_soft_isr(&IoAdapter->isr_soft_isr);
}
return (1);
}
/* -------------------------------------------------------------------------
Disable interrupt in the card hardware
------------------------------------------------------------------------- */
static void disable_pri_interrupt(PISDN_ADAPTER IoAdapter) {
dword volatile __iomem *cfgReg = (dword volatile __iomem *)DIVA_OS_MEM_ATTACH_CFG(IoAdapter);
WRITE_DWORD(&cfgReg[3], 0);
WRITE_DWORD(&cfgReg[1], 0);
WRITE_DWORD(&cfgReg[0], (dword)(~0x03E00000));
DIVA_OS_MEM_DETACH_CFG(IoAdapter, cfgReg);
}
/* -------------------------------------------------------------------------
Install entry points for PRI Adapter
------------------------------------------------------------------------- */
static void prepare_common_pri_functions(PISDN_ADAPTER IoAdapter) {
ADAPTER *a = &IoAdapter->a;
a->ram_in = mem_in;
a->ram_inw = mem_inw;
a->ram_in_buffer = mem_in_buffer;
a->ram_look_ahead = mem_look_ahead;
a->ram_out = mem_out;
a->ram_outw = mem_outw;
a->ram_out_buffer = mem_out_buffer;
a->ram_inc = mem_inc;
a->ram_offset = pri_ram_offset;
a->ram_out_dw = mem_out_dw;
a->ram_in_dw = mem_in_dw;
a->istream_wakeup = pr_stream;
IoAdapter->out = pr_out;
IoAdapter->dpc = pr_dpc;
IoAdapter->tst_irq = scom_test_int;
IoAdapter->clr_irq = scom_clear_int;
IoAdapter->pcm = (struct pc_maint *)(MIPS_MAINT_OFFS
- MP_SHARED_RAM_OFFSET);
IoAdapter->load = load_pri_hardware;
IoAdapter->disIrq = disable_pri_interrupt;
IoAdapter->rstFnc = reset_pri_hardware;
IoAdapter->stop = stop_pri_hardware;
IoAdapter->trapFnc = pri_cpu_trapped;
IoAdapter->diva_isr_handler = pri_ISR;
}
/* -------------------------------------------------------------------------
Install entry points for PRI Adapter
------------------------------------------------------------------------- */
void prepare_pri_functions(PISDN_ADAPTER IoAdapter) {
IoAdapter->MemorySize = MP_MEMORY_SIZE;
prepare_common_pri_functions(IoAdapter);
diva_os_prepare_pri_functions(IoAdapter);
}
/* -------------------------------------------------------------------------
Install entry points for PRI Rev.2 Adapter
------------------------------------------------------------------------- */
void prepare_pri2_functions(PISDN_ADAPTER IoAdapter) {
IoAdapter->MemorySize = MP2_MEMORY_SIZE;
prepare_common_pri_functions(IoAdapter);
diva_os_prepare_pri2_functions(IoAdapter);
}
/* ------------------------------------------------------------------------- */

View File

@ -1,117 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef __DIVA_SOFT_DSP_TASK_ENTRY_H__
#define __DIVA_SOFT_DSP_TASK_ENTRY_H__
/*
The soft DSP image is described by binary header contained on begin of this
image:
OFFSET FROM IMAGE START | VARIABLE
------------------------------------------------------------------------
DIVA_MIPS_TASK_IMAGE_LINK_OFFS | link to the next image
----------------------------------------------------------------------
DIVA_MIPS_TASK_IMAGE_GP_OFFS | image gp register value, void*
----------------------------------------------------------------------
DIVA_MIPS_TASK_IMAGE_ENTRY_OFFS | diva_mips_sdp_task_entry_t*
----------------------------------------------------------------------
DIVA_MIPS_TASK_IMAGE_LOAD_ADDR_OFFS | image image start address (void*)
----------------------------------------------------------------------
DIVA_MIPS_TASK_IMAGE_END_ADDR_OFFS | image image end address (void*)
----------------------------------------------------------------------
DIVA_MIPS_TASK_IMAGE_ID_STRING_OFFS | image id string char[...];
----------------------------------------------------------------------
*/
#define DIVA_MIPS_TASK_IMAGE_LINK_OFFS 0x6C
#define DIVA_MIPS_TASK_IMAGE_GP_OFFS 0x70
#define DIVA_MIPS_TASK_IMAGE_ENTRY_OFFS 0x74
#define DIVA_MIPS_TASK_IMAGE_LOAD_ADDR_OFFS 0x78
#define DIVA_MIPS_TASK_IMAGE_END_ADDR_OFFS 0x7c
#define DIVA_MIPS_TASK_IMAGE_ID_STRING_OFFS 0x80
/*
This function is called in order to set GP register of this task
This function should be always called before any function of the
task is called
*/
typedef void (*diva_task_set_prog_gp_proc_t)(void *new_gp);
/*
This function is called to clear .bss at task initialization step
*/
typedef void (*diva_task_sys_reset_proc_t)(void);
/*
This function is called in order to provide GP of master call to
task, that will be used by calls from the task to the master
*/
typedef void (*diva_task_set_main_gp_proc_t)(void *main_gp);
/*
This function is called to provide address of 'dprintf' function
to the task
*/
typedef word (*diva_prt_proc_t)(char *, ...);
typedef void (*diva_task_set_prt_proc_t)(diva_prt_proc_t fn);
/*
This function is called to set task PID
*/
typedef void (*diva_task_set_pid_proc_t)(dword id);
/*
This function is called for run-time task init
*/
typedef int (*diva_task_run_time_init_proc_t)(void*, dword);
/*
This function is called from system scheduler or from timer
*/
typedef void (*diva_task_callback_proc_t)(void);
/*
This callback is used by task to get current time im mS
*/
typedef dword (*diva_task_get_tick_count_proc_t)(void);
typedef void (*diva_task_set_get_time_proc_t)(\
diva_task_get_tick_count_proc_t fn);
typedef struct _diva_mips_sdp_task_entry {
diva_task_set_prog_gp_proc_t set_gp_proc;
diva_task_sys_reset_proc_t sys_reset_proc;
diva_task_set_main_gp_proc_t set_main_gp_proc;
diva_task_set_prt_proc_t set_dprintf_proc;
diva_task_set_pid_proc_t set_pid_proc;
diva_task_run_time_init_proc_t run_time_init_proc;
diva_task_callback_proc_t task_callback_proc;
diva_task_callback_proc_t timer_callback_proc;
diva_task_set_get_time_proc_t set_get_time_proc;
void *last_entry_proc;
} diva_mips_sdp_task_entry_t;
/*
'last_entry_proc' should be set to zero and is used for future extensuios
*/
typedef struct _diva_mips_sw_task {
diva_mips_sdp_task_entry_t sdp_entry;
void *sdp_gp_reg;
void *own_gp_reg;
} diva_mips_sw_task_t;
#if !defined(DIVA_BRI2F_SDP_1_NAME)
#define DIVA_BRI2F_SDP_1_NAME "sdp0.2q0"
#endif
#if !defined(DIVA_BRI2F_SDP_2_NAME)
#define DIVA_BRI2F_SDP_2_NAME "sdp1.2q0"
#endif
#endif

View File

@ -1,886 +0,0 @@
// SPDX-License-Identifier: GPL-2.0
/* $Id: um_idi.c,v 1.14 2004/03/21 17:54:37 armin Exp $ */
#include "platform.h"
#include "di_defs.h"
#include "pc.h"
#include "dqueue.h"
#include "adapter.h"
#include "entity.h"
#include "um_xdi.h"
#include "um_idi.h"
#include "debuglib.h"
#include "divasync.h"
#define DIVAS_MAX_XDI_ADAPTERS 64
/* --------------------------------------------------------------------------
IMPORTS
-------------------------------------------------------------------------- */
extern void diva_os_wakeup_read(void *os_context);
extern void diva_os_wakeup_close(void *os_context);
/* --------------------------------------------------------------------------
LOCALS
-------------------------------------------------------------------------- */
static LIST_HEAD(adapter_q);
static diva_os_spin_lock_t adapter_lock;
static diva_um_idi_adapter_t *diva_um_idi_find_adapter(dword nr);
static void cleanup_adapter(diva_um_idi_adapter_t *a);
static void cleanup_entity(divas_um_idi_entity_t *e);
static int diva_user_mode_idi_adapter_features(diva_um_idi_adapter_t *a,
diva_um_idi_adapter_features_t
*features);
static int process_idi_request(divas_um_idi_entity_t *e,
const diva_um_idi_req_hdr_t *req);
static int process_idi_rc(divas_um_idi_entity_t *e, byte rc);
static int process_idi_ind(divas_um_idi_entity_t *e, byte ind);
static int write_return_code(divas_um_idi_entity_t *e, byte rc);
/* --------------------------------------------------------------------------
MAIN
-------------------------------------------------------------------------- */
int diva_user_mode_idi_init(void)
{
diva_os_initialize_spin_lock(&adapter_lock, "adapter");
return (0);
}
/* --------------------------------------------------------------------------
Copy adapter features to user supplied buffer
-------------------------------------------------------------------------- */
static int
diva_user_mode_idi_adapter_features(diva_um_idi_adapter_t *a,
diva_um_idi_adapter_features_t *
features)
{
IDI_SYNC_REQ sync_req;
if ((a) && (a->d.request)) {
features->type = a->d.type;
features->features = a->d.features;
features->channels = a->d.channels;
memset(features->name, 0, sizeof(features->name));
sync_req.GetName.Req = 0;
sync_req.GetName.Rc = IDI_SYNC_REQ_GET_NAME;
(*(a->d.request)) ((ENTITY *)&sync_req);
strlcpy(features->name, sync_req.GetName.name,
sizeof(features->name));
sync_req.GetSerial.Req = 0;
sync_req.GetSerial.Rc = IDI_SYNC_REQ_GET_SERIAL;
sync_req.GetSerial.serial = 0;
(*(a->d.request))((ENTITY *)&sync_req);
features->serial_number = sync_req.GetSerial.serial;
}
return ((a) ? 0 : -1);
}
/* --------------------------------------------------------------------------
REMOVE ADAPTER
-------------------------------------------------------------------------- */
void diva_user_mode_idi_remove_adapter(int adapter_nr)
{
struct list_head *tmp;
diva_um_idi_adapter_t *a;
list_for_each(tmp, &adapter_q) {
a = list_entry(tmp, diva_um_idi_adapter_t, link);
if (a->adapter_nr == adapter_nr) {
list_del(tmp);
cleanup_adapter(a);
DBG_LOG(("DIDD: del adapter(%d)", a->adapter_nr));
diva_os_free(0, a);
break;
}
}
}
/* --------------------------------------------------------------------------
CALLED ON DRIVER EXIT (UNLOAD)
-------------------------------------------------------------------------- */
void diva_user_mode_idi_finit(void)
{
struct list_head *tmp, *safe;
diva_um_idi_adapter_t *a;
list_for_each_safe(tmp, safe, &adapter_q) {
a = list_entry(tmp, diva_um_idi_adapter_t, link);
list_del(tmp);
cleanup_adapter(a);
DBG_LOG(("DIDD: del adapter(%d)", a->adapter_nr));
diva_os_free(0, a);
}
diva_os_destroy_spin_lock(&adapter_lock, "adapter");
}
/* -------------------------------------------------------------------------
CREATE AND INIT IDI ADAPTER
------------------------------------------------------------------------- */
int diva_user_mode_idi_create_adapter(const DESCRIPTOR *d, int adapter_nr)
{
diva_os_spin_lock_magic_t old_irql;
diva_um_idi_adapter_t *a =
(diva_um_idi_adapter_t *) diva_os_malloc(0,
sizeof
(diva_um_idi_adapter_t));
if (!a) {
return (-1);
}
memset(a, 0x00, sizeof(*a));
INIT_LIST_HEAD(&a->entity_q);
a->d = *d;
a->adapter_nr = adapter_nr;
DBG_LOG(("DIDD_ADD A(%d), type:%02x, features:%04x, channels:%d",
adapter_nr, a->d.type, a->d.features, a->d.channels));
diva_os_enter_spin_lock(&adapter_lock, &old_irql, "create_adapter");
list_add_tail(&a->link, &adapter_q);
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "create_adapter");
return (0);
}
/* ------------------------------------------------------------------------
Find adapter by Adapter number
------------------------------------------------------------------------ */
static diva_um_idi_adapter_t *diva_um_idi_find_adapter(dword nr)
{
diva_um_idi_adapter_t *a = NULL;
struct list_head *tmp;
list_for_each(tmp, &adapter_q) {
a = list_entry(tmp, diva_um_idi_adapter_t, link);
DBG_TRC(("find_adapter: (%d)-(%d)", nr, a->adapter_nr));
if (a->adapter_nr == (int)nr)
break;
a = NULL;
}
return (a);
}
/* ------------------------------------------------------------------------
Cleanup this adapter and cleanup/delete all entities assigned
to this adapter
------------------------------------------------------------------------ */
static void cleanup_adapter(diva_um_idi_adapter_t *a)
{
struct list_head *tmp, *safe;
divas_um_idi_entity_t *e;
list_for_each_safe(tmp, safe, &a->entity_q) {
e = list_entry(tmp, divas_um_idi_entity_t, link);
list_del(tmp);
cleanup_entity(e);
if (e->os_context) {
diva_os_wakeup_read(e->os_context);
diva_os_wakeup_close(e->os_context);
}
}
memset(&a->d, 0x00, sizeof(DESCRIPTOR));
}
/* ------------------------------------------------------------------------
Cleanup, but NOT delete this entity
------------------------------------------------------------------------ */
static void cleanup_entity(divas_um_idi_entity_t *e)
{
e->os_ref = NULL;
e->status = 0;
e->adapter = NULL;
e->e.Id = 0;
e->rc_count = 0;
e->status |= DIVA_UM_IDI_REMOVED;
e->status |= DIVA_UM_IDI_REMOVE_PENDING;
diva_data_q_finit(&e->data);
diva_data_q_finit(&e->rc);
}
/* ------------------------------------------------------------------------
Create ENTITY, link it to the adapter and remove pointer to entity
------------------------------------------------------------------------ */
void *divas_um_idi_create_entity(dword adapter_nr, void *file)
{
divas_um_idi_entity_t *e;
diva_um_idi_adapter_t *a;
diva_os_spin_lock_magic_t old_irql;
if ((e = (divas_um_idi_entity_t *) diva_os_malloc(0, sizeof(*e)))) {
memset(e, 0x00, sizeof(*e));
if (!
(e->os_context =
diva_os_malloc(0, diva_os_get_context_size()))) {
DBG_LOG(("E(%08x) no memory for os context", e));
diva_os_free(0, e);
return NULL;
}
memset(e->os_context, 0x00, diva_os_get_context_size());
if ((diva_data_q_init(&e->data, 2048 + 512, 16))) {
diva_os_free(0, e->os_context);
diva_os_free(0, e);
return NULL;
}
if ((diva_data_q_init(&e->rc, sizeof(diva_um_idi_ind_hdr_t), 2))) {
diva_data_q_finit(&e->data);
diva_os_free(0, e->os_context);
diva_os_free(0, e);
return NULL;
}
diva_os_enter_spin_lock(&adapter_lock, &old_irql, "create_entity");
/*
Look for Adapter requested
*/
if (!(a = diva_um_idi_find_adapter(adapter_nr))) {
/*
No adapter was found, or this adapter was removed
*/
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "create_entity");
DBG_LOG(("A: no adapter(%ld)", adapter_nr));
cleanup_entity(e);
diva_os_free(0, e->os_context);
diva_os_free(0, e);
return NULL;
}
e->os_ref = file; /* link to os handle */
e->adapter = a; /* link to adapter */
list_add_tail(&e->link, &a->entity_q); /* link from adapter */
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "create_entity");
DBG_LOG(("A(%ld), create E(%08x)", adapter_nr, e));
}
return (e);
}
/* ------------------------------------------------------------------------
Unlink entity and free memory
------------------------------------------------------------------------ */
int divas_um_idi_delete_entity(int adapter_nr, void *entity)
{
divas_um_idi_entity_t *e;
diva_um_idi_adapter_t *a;
diva_os_spin_lock_magic_t old_irql;
if (!(e = (divas_um_idi_entity_t *) entity))
return (-1);
diva_os_enter_spin_lock(&adapter_lock, &old_irql, "delete_entity");
if ((a = e->adapter)) {
list_del(&e->link);
}
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "delete_entity");
diva_um_idi_stop_wdog(entity);
cleanup_entity(e);
diva_os_free(0, e->os_context);
memset(e, 0x00, sizeof(*e));
DBG_LOG(("A(%d) remove E:%08x", adapter_nr, e));
diva_os_free(0, e);
return (0);
}
/* --------------------------------------------------------------------------
Called by application to read data from IDI
-------------------------------------------------------------------------- */
int diva_um_idi_read(void *entity,
void *os_handle,
void *dst,
int max_length, divas_um_idi_copy_to_user_fn_t cp_fn)
{
divas_um_idi_entity_t *e;
diva_um_idi_adapter_t *a;
const void *data;
int length, ret = 0;
diva_um_idi_data_queue_t *q;
diva_os_spin_lock_magic_t old_irql;
diva_os_enter_spin_lock(&adapter_lock, &old_irql, "read");
e = (divas_um_idi_entity_t *) entity;
if (!e || (!(a = e->adapter)) ||
(e->status & DIVA_UM_IDI_REMOVE_PENDING) ||
(e->status & DIVA_UM_IDI_REMOVED) ||
(a->status & DIVA_UM_IDI_ADAPTER_REMOVED)) {
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "read");
DBG_ERR(("E(%08x) read failed - adapter removed", e))
return (-1);
}
DBG_TRC(("A(%d) E(%08x) read(%d)", a->adapter_nr, e, max_length));
/*
Try to read return code first
*/
data = diva_data_q_get_segment4read(&e->rc);
q = &e->rc;
/*
No return codes available, read indications now
*/
if (!data) {
if (!(e->status & DIVA_UM_IDI_RC_PENDING)) {
DBG_TRC(("A(%d) E(%08x) read data", a->adapter_nr, e));
data = diva_data_q_get_segment4read(&e->data);
q = &e->data;
}
} else {
e->status &= ~DIVA_UM_IDI_RC_PENDING;
DBG_TRC(("A(%d) E(%08x) read rc", a->adapter_nr, e));
}
if (data) {
if ((length = diva_data_q_get_segment_length(q)) >
max_length) {
/*
Not enough space to read message
*/
DBG_ERR(("A: A(%d) E(%08x) read small buffer",
a->adapter_nr, e, ret));
diva_os_leave_spin_lock(&adapter_lock, &old_irql,
"read");
return (-2);
}
/*
Copy it to user, this function does access ONLY locked an verified
memory, also we can access it witch spin lock held
*/
if ((ret = (*cp_fn) (os_handle, dst, data, length)) >= 0) {
/*
Acknowledge only if read was successful
*/
diva_data_q_ack_segment4read(q);
}
}
DBG_TRC(("A(%d) E(%08x) read=%d", a->adapter_nr, e, ret));
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "read");
return (ret);
}
int diva_um_idi_write(void *entity,
void *os_handle,
const void *src,
int length, divas_um_idi_copy_from_user_fn_t cp_fn)
{
divas_um_idi_entity_t *e;
diva_um_idi_adapter_t *a;
diva_um_idi_req_hdr_t *req;
void *data;
int ret = 0;
diva_os_spin_lock_magic_t old_irql;
diva_os_enter_spin_lock(&adapter_lock, &old_irql, "write");
e = (divas_um_idi_entity_t *) entity;
if (!e || (!(a = e->adapter)) ||
(e->status & DIVA_UM_IDI_REMOVE_PENDING) ||
(e->status & DIVA_UM_IDI_REMOVED) ||
(a->status & DIVA_UM_IDI_ADAPTER_REMOVED)) {
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "write");
DBG_ERR(("E(%08x) write failed - adapter removed", e))
return (-1);
}
DBG_TRC(("A(%d) E(%08x) write(%d)", a->adapter_nr, e, length));
if ((length < sizeof(*req)) || (length > sizeof(e->buffer))) {
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "write");
return (-2);
}
if (e->status & DIVA_UM_IDI_RC_PENDING) {
DBG_ERR(("A: A(%d) E(%08x) rc pending", a->adapter_nr, e));
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "write");
return (-1); /* should wait for RC code first */
}
/*
Copy function does access only locked verified memory,
also it can be called with spin lock held
*/
if ((ret = (*cp_fn) (os_handle, e->buffer, src, length)) < 0) {
DBG_TRC(("A: A(%d) E(%08x) write error=%d", a->adapter_nr,
e, ret));
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "write");
return (ret);
}
req = (diva_um_idi_req_hdr_t *)&e->buffer[0];
switch (req->type) {
case DIVA_UM_IDI_GET_FEATURES:{
DBG_LOG(("A(%d) get_features", a->adapter_nr));
if (!(data =
diva_data_q_get_segment4write(&e->data))) {
DBG_ERR(("A(%d) get_features, no free buffer",
a->adapter_nr));
diva_os_leave_spin_lock(&adapter_lock,
&old_irql,
"write");
return (0);
}
diva_user_mode_idi_adapter_features(a, &(((diva_um_idi_ind_hdr_t
*) data)->hdr.features));
((diva_um_idi_ind_hdr_t *) data)->type =
DIVA_UM_IDI_IND_FEATURES;
((diva_um_idi_ind_hdr_t *) data)->data_length = 0;
diva_data_q_ack_segment4write(&e->data,
sizeof(diva_um_idi_ind_hdr_t));
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "write");
diva_os_wakeup_read(e->os_context);
}
break;
case DIVA_UM_IDI_REQ:
case DIVA_UM_IDI_REQ_MAN:
case DIVA_UM_IDI_REQ_SIG:
case DIVA_UM_IDI_REQ_NET:
DBG_TRC(("A(%d) REQ(%02d)-(%02d)-(%08x)", a->adapter_nr,
req->Req, req->ReqCh,
req->type & DIVA_UM_IDI_REQ_TYPE_MASK));
switch (process_idi_request(e, req)) {
case -1:
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "write");
return (-1);
case -2:
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "write");
diva_os_wakeup_read(e->os_context);
break;
default:
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "write");
break;
}
break;
default:
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "write");
return (-1);
}
DBG_TRC(("A(%d) E(%08x) write=%d", a->adapter_nr, e, ret));
return (ret);
}
/* --------------------------------------------------------------------------
CALLBACK FROM XDI
-------------------------------------------------------------------------- */
static void diva_um_idi_xdi_callback(ENTITY *entity)
{
divas_um_idi_entity_t *e = DIVAS_CONTAINING_RECORD(entity,
divas_um_idi_entity_t,
e);
diva_os_spin_lock_magic_t old_irql;
int call_wakeup = 0;
diva_os_enter_spin_lock(&adapter_lock, &old_irql, "xdi_callback");
if (e->e.complete == 255) {
if (!(e->status & DIVA_UM_IDI_REMOVE_PENDING)) {
diva_um_idi_stop_wdog(e);
}
if ((call_wakeup = process_idi_rc(e, e->e.Rc))) {
if (e->rc_count) {
e->rc_count--;
}
}
e->e.Rc = 0;
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "xdi_callback");
if (call_wakeup) {
diva_os_wakeup_read(e->os_context);
diva_os_wakeup_close(e->os_context);
}
} else {
if (e->status & DIVA_UM_IDI_REMOVE_PENDING) {
e->e.RNum = 0;
e->e.RNR = 2;
} else {
call_wakeup = process_idi_ind(e, e->e.Ind);
}
e->e.Ind = 0;
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "xdi_callback");
if (call_wakeup) {
diva_os_wakeup_read(e->os_context);
}
}
}
static int process_idi_request(divas_um_idi_entity_t *e,
const diva_um_idi_req_hdr_t *req)
{
int assign = 0;
byte Req = (byte) req->Req;
dword type = req->type & DIVA_UM_IDI_REQ_TYPE_MASK;
if (!e->e.Id || !e->e.callback) { /* not assigned */
if (Req != ASSIGN) {
DBG_ERR(("A: A(%d) E(%08x) not assigned",
e->adapter->adapter_nr, e));
return (-1); /* NOT ASSIGNED */
} else {
switch (type) {
case DIVA_UM_IDI_REQ_TYPE_MAN:
e->e.Id = MAN_ID;
DBG_TRC(("A(%d) E(%08x) assign MAN",
e->adapter->adapter_nr, e));
break;
case DIVA_UM_IDI_REQ_TYPE_SIG:
e->e.Id = DSIG_ID;
DBG_TRC(("A(%d) E(%08x) assign SIG",
e->adapter->adapter_nr, e));
break;
case DIVA_UM_IDI_REQ_TYPE_NET:
e->e.Id = NL_ID;
DBG_TRC(("A(%d) E(%08x) assign NET",
e->adapter->adapter_nr, e));
break;
default:
DBG_ERR(("A: A(%d) E(%08x) unknown type=%08x",
e->adapter->adapter_nr, e,
type));
return (-1);
}
}
e->e.XNum = 1;
e->e.RNum = 1;
e->e.callback = diva_um_idi_xdi_callback;
e->e.X = &e->XData;
e->e.R = &e->RData;
assign = 1;
}
e->status |= DIVA_UM_IDI_RC_PENDING;
e->e.Req = Req;
e->e.ReqCh = (byte) req->ReqCh;
e->e.X->PLength = (word) req->data_length;
e->e.X->P = (byte *)&req[1]; /* Our buffer is safe */
DBG_TRC(("A(%d) E(%08x) request(%02x-%02x-%02x (%d))",
e->adapter->adapter_nr, e, e->e.Id, e->e.Req,
e->e.ReqCh, e->e.X->PLength));
e->rc_count++;
if (e->adapter && e->adapter->d.request) {
diva_um_idi_start_wdog(e);
(*(e->adapter->d.request)) (&e->e);
}
if (assign) {
if (e->e.Rc == OUT_OF_RESOURCES) {
/*
XDI has no entities more, call was not forwarded to the card,
no callback will be scheduled
*/
DBG_ERR(("A: A(%d) E(%08x) XDI out of entities",
e->adapter->adapter_nr, e));
e->e.Id = 0;
e->e.ReqCh = 0;
e->e.RcCh = 0;
e->e.Ind = 0;
e->e.IndCh = 0;
e->e.XNum = 0;
e->e.RNum = 0;
e->e.callback = NULL;
e->e.X = NULL;
e->e.R = NULL;
write_return_code(e, ASSIGN_RC | OUT_OF_RESOURCES);
return (-2);
} else {
e->status |= DIVA_UM_IDI_ASSIGN_PENDING;
}
}
return (0);
}
static int process_idi_rc(divas_um_idi_entity_t *e, byte rc)
{
DBG_TRC(("A(%d) E(%08x) rc(%02x-%02x-%02x)",
e->adapter->adapter_nr, e, e->e.Id, rc, e->e.RcCh));
if (e->status & DIVA_UM_IDI_ASSIGN_PENDING) {
e->status &= ~DIVA_UM_IDI_ASSIGN_PENDING;
if (rc != ASSIGN_OK) {
DBG_ERR(("A: A(%d) E(%08x) ASSIGN failed",
e->adapter->adapter_nr, e));
e->e.callback = NULL;
e->e.Id = 0;
e->e.Req = 0;
e->e.ReqCh = 0;
e->e.Rc = 0;
e->e.RcCh = 0;
e->e.Ind = 0;
e->e.IndCh = 0;
e->e.X = NULL;
e->e.R = NULL;
e->e.XNum = 0;
e->e.RNum = 0;
}
}
if ((e->e.Req == REMOVE) && e->e.Id && (rc == 0xff)) {
DBG_ERR(("A: A(%d) E(%08x) discard OK in REMOVE",
e->adapter->adapter_nr, e));
return (0); /* let us do it in the driver */
}
if ((e->e.Req == REMOVE) && (!e->e.Id)) { /* REMOVE COMPLETE */
e->e.callback = NULL;
e->e.Id = 0;
e->e.Req = 0;
e->e.ReqCh = 0;
e->e.Rc = 0;
e->e.RcCh = 0;
e->e.Ind = 0;
e->e.IndCh = 0;
e->e.X = NULL;
e->e.R = NULL;
e->e.XNum = 0;
e->e.RNum = 0;
e->rc_count = 0;
}
if ((e->e.Req == REMOVE) && (rc != 0xff)) { /* REMOVE FAILED */
DBG_ERR(("A: A(%d) E(%08x) REMOVE FAILED",
e->adapter->adapter_nr, e));
}
write_return_code(e, rc);
return (1);
}
static int process_idi_ind(divas_um_idi_entity_t *e, byte ind)
{
int do_wakeup = 0;
if (e->e.complete != 0x02) {
diva_um_idi_ind_hdr_t *pind =
(diva_um_idi_ind_hdr_t *)
diva_data_q_get_segment4write(&e->data);
if (pind) {
e->e.RNum = 1;
e->e.R->P = (byte *)&pind[1];
e->e.R->PLength =
(word) (diva_data_q_get_max_length(&e->data) -
sizeof(*pind));
DBG_TRC(("A(%d) E(%08x) ind_1(%02x-%02x-%02x)-[%d-%d]",
e->adapter->adapter_nr, e, e->e.Id, ind,
e->e.IndCh, e->e.RLength,
e->e.R->PLength));
} else {
DBG_TRC(("A(%d) E(%08x) ind(%02x-%02x-%02x)-RNR",
e->adapter->adapter_nr, e, e->e.Id, ind,
e->e.IndCh));
e->e.RNum = 0;
e->e.RNR = 1;
do_wakeup = 1;
}
} else {
diva_um_idi_ind_hdr_t *pind =
(diva_um_idi_ind_hdr_t *) (e->e.R->P);
DBG_TRC(("A(%d) E(%08x) ind(%02x-%02x-%02x)-[%d]",
e->adapter->adapter_nr, e, e->e.Id, ind,
e->e.IndCh, e->e.R->PLength));
pind--;
pind->type = DIVA_UM_IDI_IND;
pind->hdr.ind.Ind = ind;
pind->hdr.ind.IndCh = e->e.IndCh;
pind->data_length = e->e.R->PLength;
diva_data_q_ack_segment4write(&e->data,
(int) (sizeof(*pind) +
e->e.R->PLength));
do_wakeup = 1;
}
if ((e->status & DIVA_UM_IDI_RC_PENDING) && !e->rc.count) {
do_wakeup = 0;
}
return (do_wakeup);
}
/* --------------------------------------------------------------------------
Write return code to the return code queue of entity
-------------------------------------------------------------------------- */
static int write_return_code(divas_um_idi_entity_t *e, byte rc)
{
diva_um_idi_ind_hdr_t *prc;
if (!(prc =
(diva_um_idi_ind_hdr_t *) diva_data_q_get_segment4write(&e->rc)))
{
DBG_ERR(("A: A(%d) E(%08x) rc(%02x) lost",
e->adapter->adapter_nr, e, rc));
e->status &= ~DIVA_UM_IDI_RC_PENDING;
return (-1);
}
prc->type = DIVA_UM_IDI_IND_RC;
prc->hdr.rc.Rc = rc;
prc->hdr.rc.RcCh = e->e.RcCh;
prc->data_length = 0;
diva_data_q_ack_segment4write(&e->rc, sizeof(*prc));
return (0);
}
/* --------------------------------------------------------------------------
Return amount of entries that can be bead from this entity or
-1 if adapter was removed
-------------------------------------------------------------------------- */
int diva_user_mode_idi_ind_ready(void *entity, void *os_handle)
{
divas_um_idi_entity_t *e;
diva_um_idi_adapter_t *a;
diva_os_spin_lock_magic_t old_irql;
int ret;
if (!entity)
return (-1);
diva_os_enter_spin_lock(&adapter_lock, &old_irql, "ind_ready");
e = (divas_um_idi_entity_t *) entity;
a = e->adapter;
if ((!a) || (a->status & DIVA_UM_IDI_ADAPTER_REMOVED)) {
/*
Adapter was unloaded
*/
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "ind_ready");
return (-1); /* adapter was removed */
}
if (e->status & DIVA_UM_IDI_REMOVED) {
/*
entity was removed as result of adapter removal
user should assign this entity again
*/
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "ind_ready");
return (-1);
}
ret = e->rc.count + e->data.count;
if ((e->status & DIVA_UM_IDI_RC_PENDING) && !e->rc.count) {
ret = 0;
}
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "ind_ready");
return (ret);
}
void *diva_um_id_get_os_context(void *entity)
{
return (((divas_um_idi_entity_t *) entity)->os_context);
}
int divas_um_idi_entity_assigned(void *entity)
{
divas_um_idi_entity_t *e;
diva_um_idi_adapter_t *a;
int ret;
diva_os_spin_lock_magic_t old_irql;
diva_os_enter_spin_lock(&adapter_lock, &old_irql, "assigned?");
e = (divas_um_idi_entity_t *) entity;
if (!e || (!(a = e->adapter)) ||
(e->status & DIVA_UM_IDI_REMOVED) ||
(a->status & DIVA_UM_IDI_ADAPTER_REMOVED)) {
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "assigned?");
return (0);
}
e->status |= DIVA_UM_IDI_REMOVE_PENDING;
ret = (e->e.Id || e->rc_count
|| (e->status & DIVA_UM_IDI_ASSIGN_PENDING));
DBG_TRC(("Id:%02x, rc_count:%d, status:%08x", e->e.Id, e->rc_count,
e->status))
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "assigned?");
return (ret);
}
int divas_um_idi_entity_start_remove(void *entity)
{
divas_um_idi_entity_t *e;
diva_um_idi_adapter_t *a;
diva_os_spin_lock_magic_t old_irql;
diva_os_enter_spin_lock(&adapter_lock, &old_irql, "start_remove");
e = (divas_um_idi_entity_t *) entity;
if (!e || (!(a = e->adapter)) ||
(e->status & DIVA_UM_IDI_REMOVED) ||
(a->status & DIVA_UM_IDI_ADAPTER_REMOVED)) {
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "start_remove");
return (0);
}
if (e->rc_count) {
/*
Entity BUSY
*/
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "start_remove");
return (1);
}
if (!e->e.Id) {
/*
Remove request was already pending, and arrived now
*/
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "start_remove");
return (0); /* REMOVE was pending */
}
/*
Now send remove request
*/
e->e.Req = REMOVE;
e->e.ReqCh = 0;
e->rc_count++;
DBG_TRC(("A(%d) E(%08x) request(%02x-%02x-%02x (%d))",
e->adapter->adapter_nr, e, e->e.Id, e->e.Req,
e->e.ReqCh, e->e.X->PLength));
if (a->d.request)
(*(a->d.request)) (&e->e);
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "start_remove");
return (0);
}

View File

@ -1,44 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* $Id: um_idi.h,v 1.6 2004/03/21 17:26:01 armin Exp $ */
#ifndef __DIVA_USER_MODE_IDI_CORE_H__
#define __DIVA_USER_MODE_IDI_CORE_H__
/*
interface between UM IDI core and OS dependent part
*/
int diva_user_mode_idi_init(void);
void diva_user_mode_idi_finit(void);
void *divas_um_idi_create_entity(dword adapter_nr, void *file);
int divas_um_idi_delete_entity(int adapter_nr, void *entity);
typedef int (*divas_um_idi_copy_to_user_fn_t) (void *os_handle,
void *dst,
const void *src,
int length);
typedef int (*divas_um_idi_copy_from_user_fn_t) (void *os_handle,
void *dst,
const void *src,
int length);
int diva_um_idi_read(void *entity,
void *os_handle,
void *dst,
int max_length, divas_um_idi_copy_to_user_fn_t cp_fn);
int diva_um_idi_write(void *entity,
void *os_handle,
const void *src,
int length, divas_um_idi_copy_from_user_fn_t cp_fn);
int diva_user_mode_idi_ind_ready(void *entity, void *os_handle);
void *diva_um_id_get_os_context(void *entity);
int diva_os_get_context_size(void);
int divas_um_idi_entity_assigned(void *entity);
int divas_um_idi_entity_start_remove(void *entity);
void diva_um_idi_start_wdog(void *entity);
void diva_um_idi_stop_wdog(void *entity);
#endif

View File

@ -1,69 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* $Id: um_xdi.h,v 1.1.2.2 2002/10/02 14:38:38 armin Exp $ */
#ifndef __DIVA_USER_MODE_XDI_H__
#define __DIVA_USER_MODE_XDI_H__
/*
Contains declaratiom of structures shared between application
and user mode idi driver
*/
typedef struct _diva_um_idi_adapter_features {
dword type;
dword features;
dword channels;
dword serial_number;
char name[128];
} diva_um_idi_adapter_features_t;
#define DIVA_UM_IDI_REQ_MASK 0x0000FFFF
#define DIVA_UM_IDI_REQ_TYPE_MASK (~(DIVA_UM_IDI_REQ_MASK))
#define DIVA_UM_IDI_GET_FEATURES 1 /* trigger features indication */
#define DIVA_UM_IDI_REQ 2
#define DIVA_UM_IDI_REQ_TYPE_MAN 0x10000000
#define DIVA_UM_IDI_REQ_TYPE_SIG 0x20000000
#define DIVA_UM_IDI_REQ_TYPE_NET 0x30000000
#define DIVA_UM_IDI_REQ_MAN (DIVA_UM_IDI_REQ | DIVA_UM_IDI_REQ_TYPE_MAN)
#define DIVA_UM_IDI_REQ_SIG (DIVA_UM_IDI_REQ | DIVA_UM_IDI_REQ_TYPE_SIG)
#define DIVA_UM_IDI_REQ_NET (DIVA_UM_IDI_REQ | DIVA_UM_IDI_REQ_TYPE_NET)
/*
data_length bytes will follow this structure
*/
typedef struct _diva_um_idi_req_hdr {
dword type;
dword Req;
dword ReqCh;
dword data_length;
} diva_um_idi_req_hdr_t;
typedef struct _diva_um_idi_ind_parameters {
dword Ind;
dword IndCh;
} diva_um_idi_ind_parameters_t;
typedef struct _diva_um_idi_rc_parameters {
dword Rc;
dword RcCh;
} diva_um_idi_rc_parameters_t;
typedef union _diva_um_idi_ind {
diva_um_idi_adapter_features_t features;
diva_um_idi_ind_parameters_t ind;
diva_um_idi_rc_parameters_t rc;
} diva_um_idi_ind_t;
#define DIVA_UM_IDI_IND_FEATURES 1 /* features indication */
#define DIVA_UM_IDI_IND 2
#define DIVA_UM_IDI_IND_RC 3
/*
data_length bytes of data follow
this structure
*/
typedef struct _diva_um_idi_ind_hdr {
dword type;
diva_um_idi_ind_t hdr;
dword data_length;
} diva_um_idi_ind_hdr_t;
#endif

View File

@ -1,71 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* $Id: xdi_adapter.h,v 1.7 2004/03/21 17:26:01 armin Exp $ */
#ifndef __DIVA_OS_XDI_ADAPTER_H__
#define __DIVA_OS_XDI_ADAPTER_H__
#define DIVAS_XDI_ADAPTER_BUS_PCI 0
#define DIVAS_XDI_ADAPTER_BUS_ISA 1
typedef struct _divas_pci_card_resources {
byte bus;
byte func;
void *hdev;
dword bar[8]; /* contains context of appropriate BAR Register */
void __iomem *addr[8]; /* same bar, but mapped into memory */
dword length[8]; /* bar length */
int mem_type_id[MAX_MEM_TYPE];
unsigned int qoffset;
byte irq;
} divas_pci_card_resources_t;
typedef union _divas_card_resources {
divas_pci_card_resources_t pci;
} divas_card_resources_t;
struct _diva_os_xdi_adapter;
typedef int (*diva_init_card_proc_t)(struct _diva_os_xdi_adapter *a);
typedef int (*diva_cmd_card_proc_t)(struct _diva_os_xdi_adapter *a,
diva_xdi_um_cfg_cmd_t *data,
int length);
typedef void (*diva_xdi_clear_interrupts_proc_t)(struct
_diva_os_xdi_adapter *);
#define DIVA_XDI_MBOX_BUSY 1
#define DIVA_XDI_MBOX_WAIT_XLOG 2
typedef struct _xdi_mbox_t {
dword status;
diva_xdi_um_cfg_cmd_data_t cmd_data;
dword data_length;
void *data;
} xdi_mbox_t;
typedef struct _diva_os_idi_adapter_interface {
diva_init_card_proc_t cleanup_adapter_proc;
diva_cmd_card_proc_t cmd_proc;
} diva_os_idi_adapter_interface_t;
typedef struct _diva_os_xdi_adapter {
struct list_head link;
int CardIndex;
int CardOrdinal;
int controller; /* number of this controller */
int Bus; /* PCI, ISA, ... */
divas_card_resources_t resources;
char port_name[24];
ISDN_ADAPTER xdi_adapter;
xdi_mbox_t xdi_mbox;
diva_os_idi_adapter_interface_t interface;
struct _diva_os_xdi_adapter *slave_adapters[3];
void *slave_list;
void *proc_adapter_dir; /* adapterX proc entry */
void *proc_info; /* info proc entry */
void *proc_grp_opt; /* group_optimization */
void *proc_d_l1_down; /* dynamic_l1_down */
volatile diva_xdi_clear_interrupts_proc_t clear_interrupts_proc;
dword dsp_mask;
} diva_os_xdi_adapter_t;
#endif

View File

@ -1,128 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* $Id: xdi_msg.h,v 1.1.2.2 2001/02/16 08:40:36 armin Exp $ */
#ifndef __DIVA_XDI_UM_CFG_MESSAGE_H__
#define __DIVA_XDI_UM_CFG_MESSAGE_H__
/*
Definition of messages used to communicate between
XDI device driver and user mode configuration utility
*/
/*
As acknowledge one DWORD - card ordinal will be read from the card
*/
#define DIVA_XDI_UM_CMD_GET_CARD_ORDINAL 0
/*
no acknowledge will be generated, memory block will be written in the
memory at given offset
*/
#define DIVA_XDI_UM_CMD_WRITE_SDRAM_BLOCK 1
/*
no acknowledge will be genatated, FPGA will be programmed
*/
#define DIVA_XDI_UM_CMD_WRITE_FPGA 2
/*
As acknowledge block of SDRAM will be read in the user buffer
*/
#define DIVA_XDI_UM_CMD_READ_SDRAM 3
/*
As acknowledge dword with serial number will be read in the user buffer
*/
#define DIVA_XDI_UM_CMD_GET_SERIAL_NR 4
/*
As acknowledge struct consisting from 9 dwords with PCI info.
dword[0...7] = 8 PCI BARS
dword[9] = IRQ
*/
#define DIVA_XDI_UM_CMD_GET_PCI_HW_CONFIG 5
/*
Reset of the board + activation of primary
boot loader
*/
#define DIVA_XDI_UM_CMD_RESET_ADAPTER 6
/*
Called after code download to start adapter
at specified address
Start does set new set of features due to fact that we not know
if protocol features have changed
*/
#define DIVA_XDI_UM_CMD_START_ADAPTER 7
/*
Stop adapter, called if user
wishes to stop adapter without unload
of the driver, to reload adapter with
different protocol
*/
#define DIVA_XDI_UM_CMD_STOP_ADAPTER 8
/*
Get state of current adapter
Acknowledge is one dword with following values:
0 - adapter ready for download
1 - adapter running
2 - adapter dead
3 - out of service, driver should be restarted or hardware problem
*/
#define DIVA_XDI_UM_CMD_GET_CARD_STATE 9
/*
Reads XLOG entry from the card
*/
#define DIVA_XDI_UM_CMD_READ_XLOG_ENTRY 10
/*
Set untranslated protocol code features
*/
#define DIVA_XDI_UM_CMD_SET_PROTOCOL_FEATURES 11
typedef struct _diva_xdi_um_cfg_cmd_data_set_features {
dword features;
} diva_xdi_um_cfg_cmd_data_set_features_t;
typedef struct _diva_xdi_um_cfg_cmd_data_start {
dword offset;
dword features;
} diva_xdi_um_cfg_cmd_data_start_t;
typedef struct _diva_xdi_um_cfg_cmd_data_write_sdram {
dword ram_number;
dword offset;
dword length;
} diva_xdi_um_cfg_cmd_data_write_sdram_t;
typedef struct _diva_xdi_um_cfg_cmd_data_write_fpga {
dword fpga_number;
dword image_length;
} diva_xdi_um_cfg_cmd_data_write_fpga_t;
typedef struct _diva_xdi_um_cfg_cmd_data_read_sdram {
dword ram_number;
dword offset;
dword length;
} diva_xdi_um_cfg_cmd_data_read_sdram_t;
typedef union _diva_xdi_um_cfg_cmd_data {
diva_xdi_um_cfg_cmd_data_write_sdram_t write_sdram;
diva_xdi_um_cfg_cmd_data_write_fpga_t write_fpga;
diva_xdi_um_cfg_cmd_data_read_sdram_t read_sdram;
diva_xdi_um_cfg_cmd_data_start_t start;
diva_xdi_um_cfg_cmd_data_set_features_t features;
} diva_xdi_um_cfg_cmd_data_t;
typedef struct _diva_xdi_um_cfg_cmd {
dword adapter; /* Adapter number 1...N */
dword command;
diva_xdi_um_cfg_cmd_data_t command_data;
dword data_length; /* Plain binary data will follow */
} diva_xdi_um_cfg_cmd_t;
#endif

View File

@ -1,26 +0,0 @@
/*
*
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
*
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
static char diva_xdi_common_code_build[] = "102-52";