First version in isdn4linux
This commit is contained in:
parent
da76a283d9
commit
2a8035a213
|
@ -0,0 +1,138 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ISDN lowlevel-module for AVM B1-card.
|
||||
*
|
||||
* Copyright 1996 by Carsten Paeth (calle@calle.in-berlin.de)
|
||||
*
|
||||
* $Log$
|
||||
* Revision 2.2 1997/02/12 09:31:39 calle
|
||||
* new version
|
||||
*
|
||||
* Revision 1.1 1997/01/31 10:32:20 calle
|
||||
* Initial revision
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _B1LLI_H_
|
||||
#define _B1LLI_H_
|
||||
/*
|
||||
* struct for loading t4 file
|
||||
*/
|
||||
typedef struct avmb1_t4file {
|
||||
int len;
|
||||
unsigned char *data;
|
||||
} avmb1_t4file;
|
||||
|
||||
typedef struct avmb1_loaddef {
|
||||
int contr;
|
||||
avmb1_t4file t4file;
|
||||
} avmb1_loaddef;
|
||||
|
||||
typedef struct avmb1_resetdef {
|
||||
int contr;
|
||||
} avmb1_resetdef;
|
||||
|
||||
/*
|
||||
* struct for adding new cards
|
||||
*/
|
||||
typedef struct avmb1_carddef {
|
||||
int port;
|
||||
int irq;
|
||||
} avmb1_carddef;
|
||||
|
||||
#define AVMB1_LOAD 0 /* load image to card */
|
||||
#define AVMB1_ADDCARD 1 /* add a new card */
|
||||
#define AVMB1_RESETCARD 2 /* reset a card */
|
||||
|
||||
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
/*
|
||||
* card states for startup
|
||||
*/
|
||||
|
||||
#define CARD_NONE 0
|
||||
#define CARD_DETECTED 1
|
||||
#define CARD_LOADING 2
|
||||
#define CARD_INITSTATE 4
|
||||
#define CARD_RUNNING 5
|
||||
#define CARD_ACTIVE 6
|
||||
|
||||
#define AVMB1_PORTLEN 0x1f
|
||||
|
||||
#define AVM_MAXVERSION 8
|
||||
#define AVM_NBCHAN 2
|
||||
|
||||
#define AVM_NAPPS 30
|
||||
#define AVM_NPLCI 5
|
||||
#define AVM_NNCCI 6
|
||||
|
||||
/*
|
||||
* Main driver data
|
||||
*/
|
||||
|
||||
typedef struct avmb1_card {
|
||||
struct avmb1_card *next;
|
||||
int cnr;
|
||||
unsigned short port;
|
||||
unsigned irq;
|
||||
volatile unsigned short cardstate;
|
||||
int interrupt;
|
||||
int blocked;
|
||||
int versionlen;
|
||||
char versionbuf[1024];
|
||||
char *version[AVM_MAXVERSION];
|
||||
char msgbuf[128]; /* capimsg msg part */
|
||||
char databuf[2048]; /* capimsg data part */
|
||||
capi_version cversion;
|
||||
char name[10];
|
||||
} avmb1_card;
|
||||
|
||||
/*
|
||||
* Versions
|
||||
*/
|
||||
|
||||
#define VER_DRIVER 0
|
||||
#define VER_CARDTYPE 1
|
||||
#define VER_HWID 2
|
||||
#define VER_SERIAL 3
|
||||
#define VER_OPTION 4
|
||||
#define VER_PROTO 5
|
||||
#define VER_PROFILE 6
|
||||
#define VER_CAPI 7
|
||||
|
||||
|
||||
/* b1lli.c */
|
||||
int B1_detect(unsigned short base);
|
||||
void B1_reset(unsigned short base);
|
||||
int B1_load_t4file(unsigned short base, avmb1_t4file * t4file);
|
||||
int B1_loaded(unsigned short base);
|
||||
unsigned char B1_assign_irq(unsigned short base, unsigned irq);
|
||||
unsigned char B1_enable_irq(unsigned short base);
|
||||
unsigned char B1_disable_irq(unsigned short base);
|
||||
int B1_valid_irq(unsigned irq);
|
||||
void B1_handle_interrupt(avmb1_card * card);
|
||||
void B1_send_init(unsigned short port,
|
||||
unsigned int napps, unsigned int nncci, unsigned int cardnr);
|
||||
void B1_send_register(unsigned short port,
|
||||
__u16 appid, __u32 nmsg,
|
||||
__u32 nb3conn, __u32 nb3blocks, __u32 b3bsize);
|
||||
void B1_send_release(unsigned short port, __u16 appid);
|
||||
void B1_send_message(unsigned short port, struct sk_buff *skb);
|
||||
|
||||
/* b1capi.c */
|
||||
void avmb1_handle_new_ncci(avmb1_card * card,
|
||||
__u16 appl, __u32 ncci, __u32 winsize);
|
||||
void avmb1_handle_free_ncci(avmb1_card * card,
|
||||
__u16 appl, __u32 ncci);
|
||||
void avmb1_handle_capimsg(avmb1_card * card, __u16 appl, struct sk_buff *skb);
|
||||
void avmb1_card_ready(avmb1_card * card);
|
||||
|
||||
int avmb1_addcard(int port, int irq);
|
||||
int avmb1_probecard(int port, int irq);
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* _B1LLI_H_ */
|
|
@ -0,0 +1,124 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* CAPI 2.0 Interface for Linux
|
||||
*
|
||||
* Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de)
|
||||
*
|
||||
* $Log$
|
||||
* Revision 2.2 1997/02/12 09:31:39 calle
|
||||
* new version
|
||||
*
|
||||
* Revision 1.1 1997/01/31 10:32:20 calle
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_CAPI_H__
|
||||
#define __LINUX_CAPI_H__
|
||||
|
||||
#include <asm/types.h>
|
||||
#include <linux/ioctl.h>
|
||||
#ifndef __KERNEL__
|
||||
#include <linux/kernelcapi.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* CAPI_REGISTER
|
||||
*/
|
||||
|
||||
typedef struct capi_register_params { /* CAPI_REGISTER */
|
||||
__u32 level3cnt; /* No. of simulatneous user data connections */
|
||||
__u32 datablkcnt; /* No. of buffered data messages */
|
||||
__u32 datablklen; /* Size of buffered data messages */
|
||||
} capi_register_params;
|
||||
|
||||
#define CAPI_REGISTER _IOW('C',0x01,struct capi_register_params)
|
||||
|
||||
/*
|
||||
* CAPI_GET_MANUFACTURER
|
||||
*/
|
||||
|
||||
#define CAPI_MANUFACTURER_LEN 64
|
||||
|
||||
#define CAPI_GET_MANUFACTURER _IOWR('C',0x06,CAPI_MANUFACTURER_LEN)
|
||||
|
||||
/*
|
||||
* CAPI_GET_VERSION
|
||||
*/
|
||||
|
||||
typedef struct capi_version {
|
||||
__u32 majorversion;
|
||||
__u32 minorversion;
|
||||
__u32 majormanuversion;
|
||||
__u32 minormanuversion;
|
||||
} capi_version;
|
||||
|
||||
#define CAPI_GET_VERSION _IOWR('C',0x07,struct capi_version)
|
||||
|
||||
/*
|
||||
* CAPI_GET_SERIAL
|
||||
*/
|
||||
|
||||
#define CAPI_SERIAL_LEN 8
|
||||
#define CAPI_GET_SERIAL _IOWR('C',0x08, CAPI_SERIAL_LEN)
|
||||
|
||||
/*
|
||||
* CAPI_GET_PROFILE
|
||||
*/
|
||||
|
||||
typedef struct capi_profile {
|
||||
__u16 ncontroller; /* number of installed controller */
|
||||
__u16 nbchannel; /* number of B-Channels */
|
||||
__u32 goptions; /* global options */
|
||||
__u32 support1; /* B1 protocols support */
|
||||
__u32 support2; /* B2 protocols support */
|
||||
__u32 support3; /* B3 protocols support */
|
||||
__u32 reserved[6]; /* reserved */
|
||||
__u32 manu[5]; /* manufacturer specific information */
|
||||
} capi_profile;
|
||||
|
||||
#define CAPI_GET_PROFILE _IOWR('C',0x09,struct capi_profile)
|
||||
|
||||
typedef struct capi_manufacturer_cmd {
|
||||
unsigned long cmd;
|
||||
void *data;
|
||||
} capi_manufacturer_cmd;
|
||||
|
||||
/*
|
||||
* CAPI_MANUFACTURER_CMD
|
||||
*/
|
||||
|
||||
#define CAPI_MANUFACTURER_CMD _IOWR('C',0x20, struct capi_manufacturer_cmd)
|
||||
|
||||
/*
|
||||
* CAPI_GET_ERRCODE
|
||||
* capi errcode is set, * if read, write, or ioctl returns EIO,
|
||||
* ioctl returns errcode directly, and in arg, if != 0
|
||||
*/
|
||||
|
||||
#define CAPI_GET_ERRCODE _IOR('C',0x21, __u16)
|
||||
|
||||
/*
|
||||
* CAPI_INSTALLED
|
||||
*/
|
||||
#define CAPI_INSTALLED _IOR('C',0x22, __u16)
|
||||
|
||||
/*
|
||||
* member contr is input for
|
||||
* CAPI_GET_MANUFACTURER, CAPI_VERSION, CAPI_GET_SERIAL
|
||||
* and CAPI_GET_PROFILE
|
||||
*/
|
||||
typedef union capi_ioctl_struct {
|
||||
__u32 contr;
|
||||
capi_register_params rparams;
|
||||
__u8 manufacturer[CAPI_MANUFACTURER_LEN];
|
||||
capi_version version;
|
||||
__u8 serial[CAPI_SERIAL_LEN];
|
||||
capi_profile profile;
|
||||
capi_manufacturer_cmd cmd;
|
||||
__u16 errcode;
|
||||
} capi_ioctl_struct;
|
||||
|
||||
#endif /* __LINUX_CAPI_H__ */
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Kernel CAPI 2.0 Interface for Linux
|
||||
*
|
||||
* (c) Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de)
|
||||
*
|
||||
* $Log$
|
||||
* Revision 2.2 1997/02/12 09:31:39 calle
|
||||
* new version
|
||||
*
|
||||
* Revision 1.1 1997/01/31 10:32:20 calle
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
#ifndef __KERNEL_CAPI_H__
|
||||
#define __KERNEL_CAPI_H__
|
||||
|
||||
#define CAPI_MAXAPPL 20 /*
|
||||
* maximum number of applications
|
||||
*/
|
||||
#define CAPI_MAXCONTR 4 /*
|
||||
* maximum number of controller
|
||||
*/
|
||||
#define CAPI_MAXDATAWINDOW 8
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
struct capi_interface {
|
||||
int (*capi_installed) (void);
|
||||
|
||||
__u16(*capi_register) (capi_register_params * rparam, __u16 * applidp);
|
||||
__u16(*capi_release) (__u16 applid);
|
||||
__u16(*capi_put_message) (__u16 applid, struct sk_buff * msg);
|
||||
__u16(*capi_get_message) (__u16 applid, struct sk_buff ** msgp);
|
||||
__u16(*capi_set_signal) (__u16 applid,
|
||||
void (*signal) (__u16 applid, __u32 param),
|
||||
__u32 param);
|
||||
__u16(*capi_get_manufacturer) (__u16 contr, __u8 buf[CAPI_MANUFACTURER_LEN]);
|
||||
__u16(*capi_get_version) (__u16 contr, struct capi_version * verp);
|
||||
__u16(*capi_get_serial) (__u16 contr, __u8 serial[CAPI_SERIAL_LEN]);
|
||||
__u16(*capi_get_profile) (__u16 contr, struct capi_profile * profp);
|
||||
|
||||
/*
|
||||
* to init controllers, data is always in user memory
|
||||
*/
|
||||
int (*capi_manufacturer) (unsigned int cmd, void *data);
|
||||
|
||||
};
|
||||
|
||||
#define KCI_CONTRUP 0
|
||||
#define KCI_CONTRDOWN 1
|
||||
|
||||
struct capi_interface_user {
|
||||
char name[20];
|
||||
void (*callback) (unsigned int cmd, __u16 contr, void *data);
|
||||
struct capi_interface_user *next;
|
||||
};
|
||||
|
||||
struct capi_interface *attach_capi_interface(struct capi_interface_user *);
|
||||
int detach_capi_interface(struct capi_interface_user *);
|
||||
|
||||
|
||||
#define CAPI_NOERROR 0x0000
|
||||
|
||||
#define CAPI_TOOMANYAPPLS 0x1001
|
||||
#define CAPI_LOGBLKSIZETOSMALL 0x1002
|
||||
#define CAPI_BUFFEXECEEDS64K 0x1003
|
||||
#define CAPI_MSGBUFSIZETOOSMALL 0x1004
|
||||
#define CAPI_ANZLOGCONNNOTSUPPORTED 0x1005
|
||||
#define CAPI_REGRESERVED 0x1006
|
||||
#define CAPI_REGBUSY 0x1007
|
||||
#define CAPI_REGOSRESOURCEERR 0x1008
|
||||
#define CAPI_REGNOTINSTALLED 0x1009
|
||||
#define CAPI_REGCTRLERNOTSUPPORTEXTEQUIP 0x100a
|
||||
#define CAPI_REGCTRLERONLYSUPPORTEXTEQUIP 0x100b
|
||||
|
||||
#define CAPI_ILLAPPNR 0x1101
|
||||
#define CAPI_ILLCMDORSUBCMDORMSGTOSMALL 0x1102
|
||||
#define CAPI_SENDQUEUEFULL 0x1103
|
||||
#define CAPI_RECEIVEQUEUEEMPTY 0x1104
|
||||
#define CAPI_RECEIVEOVERFLOW 0x1105
|
||||
#define CAPI_UNKNOWNNOTPAR 0x1106
|
||||
#define CAPI_MSGBUSY 0x1107
|
||||
#define CAPI_MSGOSRESOURCEERR 0x1108
|
||||
#define CAPI_MSGNOTINSTALLED 0x1109
|
||||
#define CAPI_MSGCTRLERNOTSUPPORTEXTEQUIP 0x110a
|
||||
#define CAPI_MSGCTRLERONLYSUPPORTEXTEQUIP 0x110b
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* __KERNEL_CAPI_H__ */
|
Loading…
Reference in New Issue