isdn: whitespace coding style cleanup

isdn source code uses a not-current coding style.

Update the coding style used on a per-line basis
so that git diff -w shows only elided blank lines
at EOF.

Done with emacs and some scripts and some typing.

Built x86 allyesconfig.
No detected change in objdump -d or size.

Signed-off-by: Joe Perches <joe@perches.com>
This commit is contained in:
Joe Perches 2012-02-19 19:52:38 -08:00
parent 0b0a635f79
commit 475be4d85a
314 changed files with 49170 additions and 49266 deletions

View File

@ -4,7 +4,7 @@
*
* Author Fritz Elfert
* Copyright by Fritz Elfert <fritz@isdn4linux.de>
*
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
@ -40,21 +40,21 @@
/* Struct for adding new cards */
typedef struct act2000_cdef {
int bus;
int port;
int irq;
char id[10];
int port;
int irq;
char id[10];
} act2000_cdef;
/* Struct for downloading firmware */
typedef struct act2000_ddef {
int length; /* Length of code */
char __user *buffer; /* Ptr. to code */
int length; /* Length of code */
char __user *buffer; /* Ptr. to code */
} act2000_ddef;
typedef struct act2000_fwid {
char isdn[4];
char revlen[2];
char revision[504];
char isdn[4];
char revlen[2];
char revision[504];
} act2000_fwid;
#if defined(__KERNEL__) || defined(__DEBUGVAR__)
@ -128,8 +128,8 @@ typedef struct act2000_chan {
typedef struct msn_entry {
char eaz;
char msn[16];
struct msn_entry * next;
char msn[16];
struct msn_entry *next;
} msn_entry;
typedef struct irq_data_isa {
@ -183,17 +183,17 @@ typedef struct act2000_card {
static inline void act2000_schedule_tx(act2000_card *card)
{
schedule_work(&card->snd_tq);
schedule_work(&card->snd_tq);
}
static inline void act2000_schedule_rx(act2000_card *card)
{
schedule_work(&card->rcv_tq);
schedule_work(&card->rcv_tq);
}
static inline void act2000_schedule_poll(act2000_card *card)
{
schedule_work(&card->poll_tq);
schedule_work(&card->poll_tq);
}
extern char *act2000_find_eaz(act2000_card *, char);

View File

@ -4,7 +4,7 @@
*
* Author Fritz Elfert
* Copyright by Fritz Elfert <fritz@isdn4linux.de>
*
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
@ -25,99 +25,99 @@
static int
act2000_isa_reset(unsigned short portbase)
{
unsigned char reg;
int i;
int found;
int serial = 0;
unsigned char reg;
int i;
int found;
int serial = 0;
found = 0;
if ((reg = inb(portbase + ISA_COR)) != 0xff) {
outb(reg | ISA_COR_RESET, portbase + ISA_COR);
mdelay(10);
outb(reg, portbase + ISA_COR);
mdelay(10);
found = 0;
if ((reg = inb(portbase + ISA_COR)) != 0xff) {
outb(reg | ISA_COR_RESET, portbase + ISA_COR);
mdelay(10);
outb(reg, portbase + ISA_COR);
mdelay(10);
for (i = 0; i < 16; i++) {
if (inb(portbase + ISA_ISR) & ISA_ISR_SERIAL)
serial |= 0x10000;
serial >>= 1;
}
if (serial == ISA_SER_ID)
found++;
}
return found;
for (i = 0; i < 16; i++) {
if (inb(portbase + ISA_ISR) & ISA_ISR_SERIAL)
serial |= 0x10000;
serial >>= 1;
}
if (serial == ISA_SER_ID)
found++;
}
return found;
}
int
act2000_isa_detect(unsigned short portbase)
{
int ret = 0;
int ret = 0;
if (request_region(portbase, ACT2000_PORTLEN, "act2000isa")) {
ret = act2000_isa_reset(portbase);
ret = act2000_isa_reset(portbase);
release_region(portbase, ISA_REGION);
}
return ret;
return ret;
}
static irqreturn_t
act2000_isa_interrupt(int dummy, void *dev_id)
{
act2000_card *card = dev_id;
u_char istatus;
act2000_card *card = dev_id;
u_char istatus;
istatus = (inb(ISA_PORT_ISR) & 0x07);
if (istatus & ISA_ISR_OUT) {
/* RX fifo has data */
istatus = (inb(ISA_PORT_ISR) & 0x07);
if (istatus & ISA_ISR_OUT) {
/* RX fifo has data */
istatus &= ISA_ISR_OUT_MASK;
outb(0, ISA_PORT_SIS);
act2000_isa_receive(card);
outb(ISA_SIS_INT, ISA_PORT_SIS);
}
if (istatus & ISA_ISR_ERR) {
/* Error Interrupt */
}
if (istatus & ISA_ISR_ERR) {
/* Error Interrupt */
istatus &= ISA_ISR_ERR_MASK;
printk(KERN_WARNING "act2000: errIRQ\n");
}
printk(KERN_WARNING "act2000: errIRQ\n");
}
if (istatus)
printk(KERN_DEBUG "act2000: ?IRQ %d %02x\n", card->irq, istatus);
return IRQ_HANDLED;
}
static void
act2000_isa_select_irq(act2000_card * card)
act2000_isa_select_irq(act2000_card *card)
{
unsigned char reg;
reg = (inb(ISA_PORT_COR) & ~ISA_COR_IRQOFF) | ISA_COR_PERR;
switch (card->irq) {
case 3:
reg = ISA_COR_IRQ03;
break;
case 5:
reg = ISA_COR_IRQ05;
break;
case 7:
reg = ISA_COR_IRQ07;
break;
case 10:
reg = ISA_COR_IRQ10;
break;
case 11:
reg = ISA_COR_IRQ11;
break;
case 12:
reg = ISA_COR_IRQ12;
break;
case 15:
reg = ISA_COR_IRQ15;
break;
case 3:
reg = ISA_COR_IRQ03;
break;
case 5:
reg = ISA_COR_IRQ05;
break;
case 7:
reg = ISA_COR_IRQ07;
break;
case 10:
reg = ISA_COR_IRQ10;
break;
case 11:
reg = ISA_COR_IRQ11;
break;
case 12:
reg = ISA_COR_IRQ12;
break;
case 15:
reg = ISA_COR_IRQ15;
break;
}
outb(reg, ISA_PORT_COR);
}
static void
act2000_isa_enable_irq(act2000_card * card)
act2000_isa_enable_irq(act2000_card *card)
{
act2000_isa_select_irq(card);
/* Enable READ irq */
@ -129,102 +129,102 @@ act2000_isa_enable_irq(act2000_card * card)
* If irq is -1, choose next free irq, else irq is given explicitly.
*/
int
act2000_isa_config_irq(act2000_card * card, short irq)
act2000_isa_config_irq(act2000_card *card, short irq)
{
int old_irq;
if (card->flags & ACT2000_FLAGS_IVALID) {
free_irq(card->irq, card);
}
card->flags &= ~ACT2000_FLAGS_IVALID;
outb(ISA_COR_IRQOFF, ISA_PORT_COR);
if (!irq)
return 0;
if (card->flags & ACT2000_FLAGS_IVALID) {
free_irq(card->irq, card);
}
card->flags &= ~ACT2000_FLAGS_IVALID;
outb(ISA_COR_IRQOFF, ISA_PORT_COR);
if (!irq)
return 0;
old_irq = card->irq;
card->irq = irq;
if (request_irq(irq, &act2000_isa_interrupt, 0, card->regname, card)) {
card->irq = old_irq;
card->flags |= ACT2000_FLAGS_IVALID;
printk(KERN_WARNING
"act2000: Could not request irq %d\n",irq);
return -EBUSY;
} else {
printk(KERN_WARNING
"act2000: Could not request irq %d\n", irq);
return -EBUSY;
} else {
act2000_isa_select_irq(card);
/* Disable READ and WRITE irq */
outb(0, ISA_PORT_SIS);
outb(0, ISA_PORT_SOS);
}
return 0;
/* Disable READ and WRITE irq */
outb(0, ISA_PORT_SIS);
outb(0, ISA_PORT_SOS);
}
return 0;
}
int
act2000_isa_config_port(act2000_card * card, unsigned short portbase)
act2000_isa_config_port(act2000_card *card, unsigned short portbase)
{
if (card->flags & ACT2000_FLAGS_PVALID) {
release_region(card->port, ISA_REGION);
card->flags &= ~ACT2000_FLAGS_PVALID;
}
if (card->flags & ACT2000_FLAGS_PVALID) {
release_region(card->port, ISA_REGION);
card->flags &= ~ACT2000_FLAGS_PVALID;
}
if (request_region(portbase, ACT2000_PORTLEN, card->regname) == NULL)
return -EBUSY;
else {
card->port = portbase;
card->flags |= ACT2000_FLAGS_PVALID;
return 0;
}
card->port = portbase;
card->flags |= ACT2000_FLAGS_PVALID;
return 0;
}
}
/*
* Release ressources, used by an adaptor.
*/
void
act2000_isa_release(act2000_card * card)
act2000_isa_release(act2000_card *card)
{
unsigned long flags;
unsigned long flags;
spin_lock_irqsave(&card->lock, flags);
if (card->flags & ACT2000_FLAGS_IVALID)
free_irq(card->irq, card);
spin_lock_irqsave(&card->lock, flags);
if (card->flags & ACT2000_FLAGS_IVALID)
free_irq(card->irq, card);
card->flags &= ~ACT2000_FLAGS_IVALID;
if (card->flags & ACT2000_FLAGS_PVALID)
release_region(card->port, ISA_REGION);
card->flags &= ~ACT2000_FLAGS_PVALID;
spin_unlock_irqrestore(&card->lock, flags);
card->flags &= ~ACT2000_FLAGS_IVALID;
if (card->flags & ACT2000_FLAGS_PVALID)
release_region(card->port, ISA_REGION);
card->flags &= ~ACT2000_FLAGS_PVALID;
spin_unlock_irqrestore(&card->lock, flags);
}
static int
act2000_isa_writeb(act2000_card * card, u_char data)
act2000_isa_writeb(act2000_card *card, u_char data)
{
u_char timeout = 40;
u_char timeout = 40;
while (timeout) {
if (inb(ISA_PORT_SOS) & ISA_SOS_READY) {
outb(data, ISA_PORT_SDO);
return 0;
} else {
timeout--;
udelay(10);
}
}
return 1;
while (timeout) {
if (inb(ISA_PORT_SOS) & ISA_SOS_READY) {
outb(data, ISA_PORT_SDO);
return 0;
} else {
timeout--;
udelay(10);
}
}
return 1;
}
static int
act2000_isa_readb(act2000_card * card, u_char * data)
act2000_isa_readb(act2000_card *card, u_char *data)
{
u_char timeout = 40;
u_char timeout = 40;
while (timeout) {
if (inb(ISA_PORT_SIS) & ISA_SIS_READY) {
*data = inb(ISA_PORT_SDI);
return 0;
} else {
timeout--;
udelay(10);
}
}
return 1;
while (timeout) {
if (inb(ISA_PORT_SIS) & ISA_SIS_READY) {
*data = inb(ISA_PORT_SDI);
return 0;
} else {
timeout--;
udelay(10);
}
}
return 1;
}
void
@ -232,11 +232,11 @@ act2000_isa_receive(act2000_card *card)
{
u_char c;
if (test_and_set_bit(ACT2000_LOCK_RX, (void *) &card->ilock) != 0)
if (test_and_set_bit(ACT2000_LOCK_RX, (void *) &card->ilock) != 0)
return;
while (!act2000_isa_readb(card, &c)) {
if (card->idat.isa.rcvidx < 8) {
card->idat.isa.rcvhdr[card->idat.isa.rcvidx++] = c;
card->idat.isa.rcvhdr[card->idat.isa.rcvidx++] = c;
if (card->idat.isa.rcvidx == 8) {
int valid = actcapi_chkhdr(card, (actcapi_msghdr *)&card->idat.isa.rcvhdr);
@ -291,14 +291,14 @@ act2000_isa_receive(act2000_card *card)
}
void
act2000_isa_send(act2000_card * card)
act2000_isa_send(act2000_card *card)
{
unsigned long flags;
struct sk_buff *skb;
actcapi_msg *msg;
int l;
if (test_and_set_bit(ACT2000_LOCK_TX, (void *) &card->ilock) != 0)
if (test_and_set_bit(ACT2000_LOCK_TX, (void *) &card->ilock) != 0)
return;
while (1) {
spin_lock_irqsave(&card->lock, flags);
@ -307,7 +307,7 @@ act2000_isa_send(act2000_card * card)
card->ack_msg = card->sbuf->data;
msg = (actcapi_msg *)card->sbuf->data;
if ((msg->hdr.cmd.cmd == 0x86) &&
(msg->hdr.cmd.subcmd == 0) ) {
(msg->hdr.cmd.subcmd == 0)) {
/* Save flags in message */
card->need_b3ack = msg->msg.data_b3_req.flags;
msg->msg.data_b3_req.flags = 0;
@ -335,7 +335,7 @@ act2000_isa_send(act2000_card * card)
}
msg = (actcapi_msg *)card->ack_msg;
if ((msg->hdr.cmd.cmd == 0x86) &&
(msg->hdr.cmd.subcmd == 0) ) {
(msg->hdr.cmd.subcmd == 0)) {
/*
* If it's user data, reset data-ptr
* and put skb into ackq.
@ -354,90 +354,90 @@ act2000_isa_send(act2000_card * card)
* Get firmware ID, check for 'ISDN' signature.
*/
static int
act2000_isa_getid(act2000_card * card)
act2000_isa_getid(act2000_card *card)
{
act2000_fwid fid;
u_char *p = (u_char *) & fid;
int count = 0;
act2000_fwid fid;
u_char *p = (u_char *)&fid;
int count = 0;
while (1) {
if (count > 510)
return -EPROTO;
if (act2000_isa_readb(card, p++))
break;
count++;
}
if (count <= 20) {
printk(KERN_WARNING "act2000: No Firmware-ID!\n");
return -ETIME;
}
*p = '\0';
fid.revlen[0] = '\0';
if (strcmp(fid.isdn, "ISDN")) {
printk(KERN_WARNING "act2000: Wrong Firmware-ID!\n");
return -EPROTO;
}
while (1) {
if (count > 510)
return -EPROTO;
if (act2000_isa_readb(card, p++))
break;
count++;
}
if (count <= 20) {
printk(KERN_WARNING "act2000: No Firmware-ID!\n");
return -ETIME;
}
*p = '\0';
fid.revlen[0] = '\0';
if (strcmp(fid.isdn, "ISDN")) {
printk(KERN_WARNING "act2000: Wrong Firmware-ID!\n");
return -EPROTO;
}
if ((p = strchr(fid.revision, '\n')))
*p = '\0';
printk(KERN_INFO "act2000: Firmware-ID: %s\n", fid.revision);
printk(KERN_INFO "act2000: Firmware-ID: %s\n", fid.revision);
if (card->flags & ACT2000_FLAGS_IVALID) {
printk(KERN_DEBUG "Enabling Interrupts ...\n");
act2000_isa_enable_irq(card);
}
return 0;
return 0;
}
/*
* Download microcode into card, check Firmware signature.
*/
int
act2000_isa_download(act2000_card * card, act2000_ddef __user * cb)
act2000_isa_download(act2000_card *card, act2000_ddef __user *cb)
{
unsigned int length;
int l;
int c;
long timeout;
u_char *b;
u_char __user *p;
u_char *buf;
act2000_ddef cblock;
unsigned int length;
int l;
int c;
long timeout;
u_char *b;
u_char __user *p;
u_char *buf;
act2000_ddef cblock;
if (!act2000_isa_reset(card->port))
return -ENXIO;
msleep_interruptible(500);
if (copy_from_user(&cblock, cb, sizeof(cblock)))
return -EFAULT;
length = cblock.length;
p = cblock.buffer;
if (!access_ok(VERIFY_READ, p, length))
return -EFAULT;
buf = kmalloc(1024, GFP_KERNEL);
if (!buf)
return -ENOMEM;
timeout = 0;
while (length) {
l = (length > 1024) ? 1024 : length;
c = 0;
b = buf;
if (copy_from_user(buf, p, l)) {
kfree(buf);
return -EFAULT;
}
while (c < l) {
if (act2000_isa_writeb(card, *b++)) {
printk(KERN_WARNING
"act2000: loader timed out"
" len=%d c=%d\n", length, c);
kfree(buf);
return -ETIME;
}
c++;
}
length -= l;
p += l;
}
kfree(buf);
msleep_interruptible(500);
return (act2000_isa_getid(card));
if (!act2000_isa_reset(card->port))
return -ENXIO;
msleep_interruptible(500);
if (copy_from_user(&cblock, cb, sizeof(cblock)))
return -EFAULT;
length = cblock.length;
p = cblock.buffer;
if (!access_ok(VERIFY_READ, p, length))
return -EFAULT;
buf = kmalloc(1024, GFP_KERNEL);
if (!buf)
return -ENOMEM;
timeout = 0;
while (length) {
l = (length > 1024) ? 1024 : length;
c = 0;
b = buf;
if (copy_from_user(buf, p, l)) {
kfree(buf);
return -EFAULT;
}
while (c < l) {
if (act2000_isa_writeb(card, *b++)) {
printk(KERN_WARNING
"act2000: loader timed out"
" len=%d c=%d\n", length, c);
kfree(buf);
return -ETIME;
}
c++;
}
length -= l;
p += l;
}
kfree(buf);
msleep_interruptible(500);
return (act2000_isa_getid(card));
}

View File

@ -4,7 +4,7 @@
*
* Author Fritz Elfert
* Copyright by Fritz Elfert <fritz@isdn4linux.de>
*
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
@ -18,9 +18,9 @@
#define ISA_POLL_LOOP 40 /* Try to read-write before give up */
typedef enum {
INT_NO_CHANGE = 0, /* Do not change the Mask */
INT_ON = 1, /* Set to Enable */
INT_OFF = 2, /* Set to Disable */
INT_NO_CHANGE = 0, /* Do not change the Mask */
INT_ON = 1, /* Set to Enable */
INT_OFF = 2, /* Set to Disable */
} ISA_INT_T;
/**************************************************************************/
@ -114,22 +114,22 @@ typedef enum {
/* Macros for accessing ports */
#define ISA_PORT_COR (card->port+ISA_COR)
#define ISA_PORT_ISR (card->port+ISA_ISR)
#define ISA_PORT_EPR (card->port+ISA_EPR)
#define ISA_PORT_EER (card->port+ISA_EER)
#define ISA_PORT_SDI (card->port+ISA_SDI)
#define ISA_PORT_SDO (card->port+ISA_SDO)
#define ISA_PORT_SIS (card->port+ISA_SIS)
#define ISA_PORT_SOS (card->port+ISA_SOS)
#define ISA_PORT_COR (card->port + ISA_COR)
#define ISA_PORT_ISR (card->port + ISA_ISR)
#define ISA_PORT_EPR (card->port + ISA_EPR)
#define ISA_PORT_EER (card->port + ISA_EER)
#define ISA_PORT_SDI (card->port + ISA_SDI)
#define ISA_PORT_SDO (card->port + ISA_SDO)
#define ISA_PORT_SIS (card->port + ISA_SIS)
#define ISA_PORT_SOS (card->port + ISA_SOS)
/* Prototypes */
extern int act2000_isa_detect(unsigned short portbase);
extern int act2000_isa_config_irq(act2000_card * card, short irq);
extern int act2000_isa_config_port(act2000_card * card, unsigned short portbase);
extern int act2000_isa_download(act2000_card * card, act2000_ddef __user * cb);
extern void act2000_isa_release(act2000_card * card);
extern int act2000_isa_config_irq(act2000_card *card, short irq);
extern int act2000_isa_config_port(act2000_card *card, unsigned short portbase);
extern int act2000_isa_download(act2000_card *card, act2000_ddef __user *cb);
extern void act2000_isa_release(act2000_card *card);
extern void act2000_isa_receive(act2000_card *card);
extern void act2000_isa_send(act2000_card *card);

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@
*
* Author Fritz Elfert
* Copyright by Fritz Elfert <fritz@isdn4linux.de>
*
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
@ -46,10 +46,10 @@ typedef struct actcapi_addr {
typedef union actcapi_infonr { /* info number */
__u16 mask; /* info-mask field */
struct bmask { /* bit definitions */
unsigned codes : 3; /* code set */
unsigned rsvd : 5; /* reserved */
unsigned svind : 1; /* single, variable length ind. */
unsigned wtype : 7; /* W-element type */
unsigned codes:3; /* code set */
unsigned rsvd:5; /* reserved */
unsigned svind:1; /* single, variable length ind. */
unsigned wtype:7; /* W-element type */
} bmask;
} actcapi_infonr;
@ -59,13 +59,13 @@ typedef union actcapi_infoel { /* info element */
__u8 display[40]; /* display contents */
__u8 uuinfo[40]; /* User-user info field */
struct cause { /* Cause information */
unsigned ext2 : 1; /* extension */
unsigned cod : 2; /* coding standard */
unsigned spare : 1; /* spare */
unsigned loc : 4; /* location */
unsigned ext1 : 1; /* extension */
unsigned cval : 7; /* Cause value */
} cause;
unsigned ext2:1; /* extension */
unsigned cod:2; /* coding standard */
unsigned spare:1; /* spare */
unsigned loc:4; /* location */
unsigned ext1:1; /* extension */
unsigned cval:7; /* Cause value */
} cause;
struct charge { /* Charging information */
__u8 toc; /* type of charging info */
__u8 unit[10]; /* charging units */
@ -111,14 +111,14 @@ typedef struct actcapi_ncpd {
* Bit 5-7 = Controller
* Bit 8-15 = NCCI
*/
#define MAKE_NCCI(plci,contr,ncci) \
((plci & 0x1f) | ((contr & 0x7) << 5) | ((ncci & 0xff) << 8))
#define MAKE_NCCI(plci, contr, ncci) \
((plci & 0x1f) | ((contr & 0x7) << 5) | ((ncci & 0xff) << 8))
#define EVAL_NCCI(fakencci,plci,contr,ncci) { \
plci = fakencci & 0x1f; \
contr = (fakencci >> 5) & 0x7; \
ncci = (fakencci >> 8) & 0xff; \
}
#define EVAL_NCCI(fakencci, plci, contr, ncci) { \
plci = fakencci & 0x1f; \
contr = (fakencci >> 5) & 0x7; \
ncci = (fakencci >> 8) & 0xff; \
}
/*
* Layout of PLCI field in a B3 DATA CAPI message is different from
@ -128,13 +128,13 @@ typedef struct actcapi_ncpd {
* Bit 5-7 = Controller
* Bit 8-15 = reserved (must be 0)
*/
#define MAKE_PLCI(plci,contr) \
((plci & 0x1f) | ((contr & 0x7) << 5))
#define MAKE_PLCI(plci, contr) \
((plci & 0x1f) | ((contr & 0x7) << 5))
#define EVAL_PLCI(fakeplci,plci,contr) { \
plci = fakeplci & 0x1f; \
contr = (fakeplci >> 5) & 0x7; \
}
#define EVAL_PLCI(fakeplci, plci, contr) { \
plci = fakeplci & 0x1f; \
contr = (fakeplci >> 5) & 0x7; \
}
typedef struct actcapi_msg {
actcapi_msghdr hdr;

File diff suppressed because it is too large Load Diff

View File

@ -164,7 +164,7 @@ static int capiminor_del_ack(struct capiminor *mp, u16 datahandle)
spin_lock_bh(&mp->ackqlock);
list_for_each_entry_safe(p, tmp, &mp->ackqueue, list) {
if (p->datahandle == datahandle) {
if (p->datahandle == datahandle) {
list_del(&p->list);
mp->nack--;
spin_unlock_bh(&mp->ackqlock);
@ -199,8 +199,8 @@ static struct capiminor *capiminor_alloc(struct capi20_appl *ap, u32 ncci)
unsigned int minor;
mp = kzalloc(sizeof(*mp), GFP_KERNEL);
if (!mp) {
printk(KERN_ERR "capi: can't alloc capiminor\n");
if (!mp) {
printk(KERN_ERR "capi: can't alloc capiminor\n");
return NULL;
}
@ -391,7 +391,7 @@ gen_data_b3_resp_for(struct capiminor *mp, struct sk_buff *skb)
struct sk_buff *nskb;
nskb = alloc_skb(CAPI_DATA_B3_RESP_LEN, GFP_KERNEL);
if (nskb) {
u16 datahandle = CAPIMSG_U16(skb->data,CAPIMSG_BASELEN+4+4+2);
u16 datahandle = CAPIMSG_U16(skb->data, CAPIMSG_BASELEN + 4 + 4 + 2);
unsigned char *s = skb_put(nskb, CAPI_DATA_B3_RESP_LEN);
capimsg_setu16(s, 0, CAPI_DATA_B3_RESP_LEN);
capimsg_setu16(s, 2, mp->ap->applid);
@ -418,7 +418,7 @@ static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb)
pr_debug("capi: currently no receiver\n");
return -1;
}
ld = tty_ldisc_ref(tty);
if (!ld) {
/* fatal error, do not requeue */
@ -459,7 +459,7 @@ static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb)
ld->ops->receive_buf(tty, skb->data, NULL, skb->len);
} else {
printk(KERN_ERR "capi: send DATA_B3_RESP failed=%x\n",
errcode);
errcode);
kfree_skb(nskb);
if (errcode == CAPI_SENDQUEUEFULL)
@ -618,7 +618,7 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb)
goto unlock_out;
}
if (CAPIMSG_SUBCOMMAND(skb->data) == CAPI_IND) {
datahandle = CAPIMSG_U16(skb->data, CAPIMSG_BASELEN+4+4+2);
datahandle = CAPIMSG_U16(skb->data, CAPIMSG_BASELEN + 4 + 4 + 2);
pr_debug("capi_signal: DATA_B3_IND %u len=%d\n",
datahandle, skb->len-CAPIMSG_LEN(skb->data));
skb_queue_tail(&mp->inqueue, skb);
@ -627,10 +627,10 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb)
} else if (CAPIMSG_SUBCOMMAND(skb->data) == CAPI_CONF) {
datahandle = CAPIMSG_U16(skb->data, CAPIMSG_BASELEN+4);
datahandle = CAPIMSG_U16(skb->data, CAPIMSG_BASELEN + 4);
pr_debug("capi_signal: DATA_B3_CONF %u 0x%x\n",
datahandle,
CAPIMSG_U16(skb->data, CAPIMSG_BASELEN+4+2));
CAPIMSG_U16(skb->data, CAPIMSG_BASELEN + 4 + 2));
kfree_skb(skb);
capiminor_del_ack(mp, datahandle);
tty = tty_port_tty_get(&mp->port);
@ -669,7 +669,7 @@ capi_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
if (file->f_flags & O_NONBLOCK)
return -EAGAIN;
err = wait_event_interruptible(cdev->recvwait,
(skb = skb_dequeue(&cdev->recvqueue)));
(skb = skb_dequeue(&cdev->recvqueue)));
if (err)
return err;
}
@ -736,7 +736,7 @@ capi_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos
}
static unsigned int
capi_poll(struct file *file, poll_table * wait)
capi_poll(struct file *file, poll_table *wait)
{
struct capidev *cdev = file->private_data;
unsigned int mask = 0;
@ -786,75 +786,75 @@ register_out:
return retval;
case CAPI_GET_VERSION:
{
if (copy_from_user(&data.contr, argp,
sizeof(data.contr)))
return -EFAULT;
cdev->errcode = capi20_get_version(data.contr, &data.version);
if (cdev->errcode)
return -EIO;
if (copy_to_user(argp, &data.version,
sizeof(data.version)))
return -EFAULT;
}
return 0;
{
if (copy_from_user(&data.contr, argp,
sizeof(data.contr)))
return -EFAULT;
cdev->errcode = capi20_get_version(data.contr, &data.version);
if (cdev->errcode)
return -EIO;
if (copy_to_user(argp, &data.version,
sizeof(data.version)))
return -EFAULT;
}
return 0;
case CAPI_GET_SERIAL:
{
if (copy_from_user(&data.contr, argp,
sizeof(data.contr)))
return -EFAULT;
cdev->errcode = capi20_get_serial (data.contr, data.serial);
{
if (copy_from_user(&data.contr, argp,
sizeof(data.contr)))
return -EFAULT;
cdev->errcode = capi20_get_serial(data.contr, data.serial);
if (cdev->errcode)
return -EIO;
if (copy_to_user(argp, data.serial,
sizeof(data.serial)))
return -EFAULT;
}
return 0;
case CAPI_GET_PROFILE:
{
if (copy_from_user(&data.contr, argp,
sizeof(data.contr)))
return -EFAULT;
if (data.contr == 0) {
cdev->errcode = capi20_get_profile(data.contr, &data.profile);
if (cdev->errcode)
return -EIO;
if (copy_to_user(argp, data.serial,
sizeof(data.serial)))
return -EFAULT;
retval = copy_to_user(argp,
&data.profile.ncontroller,
sizeof(data.profile.ncontroller));
} else {
cdev->errcode = capi20_get_profile(data.contr, &data.profile);
if (cdev->errcode)
return -EIO;
retval = copy_to_user(argp, &data.profile,
sizeof(data.profile));
}
return 0;
case CAPI_GET_PROFILE:
{
if (copy_from_user(&data.contr, argp,
sizeof(data.contr)))
return -EFAULT;
if (data.contr == 0) {
cdev->errcode = capi20_get_profile(data.contr, &data.profile);
if (cdev->errcode)
return -EIO;
retval = copy_to_user(argp,
&data.profile.ncontroller,
sizeof(data.profile.ncontroller));
} else {
cdev->errcode = capi20_get_profile(data.contr, &data.profile);
if (cdev->errcode)
return -EIO;
retval = copy_to_user(argp, &data.profile,
sizeof(data.profile));
}
if (retval)
return -EFAULT;
}
return 0;
if (retval)
return -EFAULT;
}
return 0;
case CAPI_GET_MANUFACTURER:
{
if (copy_from_user(&data.contr, argp,
sizeof(data.contr)))
return -EFAULT;
cdev->errcode = capi20_get_manufacturer(data.contr, data.manufacturer);
if (cdev->errcode)
return -EIO;
{
if (copy_from_user(&data.contr, argp,
sizeof(data.contr)))
return -EFAULT;
cdev->errcode = capi20_get_manufacturer(data.contr, data.manufacturer);
if (cdev->errcode)
return -EIO;
if (copy_to_user(argp, data.manufacturer,
sizeof(data.manufacturer)))
return -EFAULT;
if (copy_to_user(argp, data.manufacturer,
sizeof(data.manufacturer)))
return -EFAULT;
}
return 0;
}
return 0;
case CAPI_GET_ERRCODE:
data.errcode = cdev->errcode;
cdev->errcode = CAPI_NOERROR;
@ -871,15 +871,15 @@ register_out:
return -ENXIO;
case CAPI_MANUFACTURER_CMD:
{
struct capi_manufacturer_cmd mcmd;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
if (copy_from_user(&mcmd, argp, sizeof(mcmd)))
return -EFAULT;
return capi20_manufacturer(mcmd.cmd, mcmd.data);
}
return 0;
{
struct capi_manufacturer_cmd mcmd;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
if (copy_from_user(&mcmd, argp, sizeof(mcmd)))
return -EFAULT;
return capi20_manufacturer(mcmd.cmd, mcmd.data);
}
return 0;
case CAPI_SET_FLAGS:
case CAPI_CLR_FLAGS: {
@ -1070,7 +1070,7 @@ static int capinc_tty_write(struct tty_struct *tty,
mp->outbytes += skb->len;
}
skb = alloc_skb(CAPI_DATA_B3_REQ_LEN+count, GFP_ATOMIC);
skb = alloc_skb(CAPI_DATA_B3_REQ_LEN + count, GFP_ATOMIC);
if (!skb) {
printk(KERN_ERR "capinc_tty_write: alloc_skb failed\n");
spin_unlock_bh(&mp->outlock);
@ -1111,7 +1111,7 @@ static int capinc_tty_put_char(struct tty_struct *tty, unsigned char ch)
invoke_send = true;
}
skb = alloc_skb(CAPI_DATA_B3_REQ_LEN+CAPI_MAX_BLKSIZE, GFP_ATOMIC);
skb = alloc_skb(CAPI_DATA_B3_REQ_LEN + CAPI_MAX_BLKSIZE, GFP_ATOMIC);
if (skb) {
skb_reserve(skb, CAPI_DATA_B3_REQ_LEN);
*(skb_put(skb, 1)) = ch;
@ -1175,12 +1175,12 @@ static int capinc_tty_chars_in_buffer(struct tty_struct *tty)
}
static int capinc_tty_ioctl(struct tty_struct *tty,
unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{
return -ENOIOCTLCMD;
}
static void capinc_tty_set_termios(struct tty_struct *tty, struct ktermios * old)
static void capinc_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
{
pr_debug("capinc_tty_set_termios\n");
}
@ -1344,18 +1344,18 @@ static inline void capinc_tty_exit(void) { }
*/
static int capi20_proc_show(struct seq_file *m, void *v)
{
struct capidev *cdev;
struct capidev *cdev;
struct list_head *l;
mutex_lock(&capidev_list_lock);
list_for_each(l, &capidev_list) {
cdev = list_entry(l, struct capidev, list);
seq_printf(m, "0 %d %lu %lu %lu %lu\n",
cdev->ap.applid,
cdev->ap.nrecvctlpkt,
cdev->ap.nrecvdatapkt,
cdev->ap.nsentctlpkt,
cdev->ap.nsentdatapkt);
cdev->ap.applid,
cdev->ap.nrecvctlpkt,
cdev->ap.nrecvdatapkt,
cdev->ap.nsentctlpkt,
cdev->ap.nsentdatapkt);
}
mutex_unlock(&capidev_list_lock);
return 0;
@ -1450,9 +1450,9 @@ static int __init capi_init(void)
proc_init();
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
compileinfo = " (middleware)";
compileinfo = " (middleware)";
#else
compileinfo = " (no middleware)";
compileinfo = " (no middleware)";
#endif
printk(KERN_NOTICE "CAPI 2.0 started up with major %d%s\n",
capi_major, compileinfo);

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@
* per plci state machine
*/
#define ST_PLCI_NONE 0 /* P-0 */
#define ST_PLCI_OUTGOING 1 /* P-0.1 */
#define ST_PLCI_OUTGOING 1 /* P-0.1 */
#define ST_PLCI_ALLOCATED 2 /* P-1 */
#define ST_PLCI_ACTIVE 3 /* P-ACT */
#define ST_PLCI_INCOMING 4 /* P-2 */
@ -47,20 +47,20 @@
#define ST_PLCI_HELD 11 /* P-HELD */
#define EV_PLCI_CONNECT_REQ 1 /* P-0 -> P-0.1
*/
*/
#define EV_PLCI_CONNECT_CONF_ERROR 2 /* P-0.1 -> P-0
*/
*/
#define EV_PLCI_CONNECT_CONF_OK 3 /* P-0.1 -> P-1
*/
*/
#define EV_PLCI_FACILITY_IND_UP 4 /* P-0 -> P-1
*/
*/
#define EV_PLCI_CONNECT_IND 5 /* P-0 -> P-2
*/
*/
#define EV_PLCI_CONNECT_ACTIVE_IND 6 /* P-1 -> P-ACT
*/
*/
#define EV_PLCI_CONNECT_REJECT 7 /* P-2 -> P-5
P-3 -> P-5
*/
*/
#define EV_PLCI_DISCONNECT_REQ 8 /* P-1 -> P-5
P-2 -> P-5
P-3 -> P-5
@ -68,7 +68,7 @@
P-ACT -> P-5
P-Res -> P-5 (*)
P-HELD -> P-5 (*)
*/
*/
#define EV_PLCI_DISCONNECT_IND 9 /* P-1 -> P-6
P-2 -> P-6
P-3 -> P-6
@ -77,35 +77,35 @@
P-ACT -> P-6
P-Res -> P-6 (*)
P-HELD -> P-6 (*)
*/
*/
#define EV_PLCI_FACILITY_IND_DOWN 10 /* P-0.1 -> P-5
P-1 -> P-5
P-ACT -> P-5
P-2 -> P-5
P-3 -> P-5
P-4 -> P-5
*/
*/
#define EV_PLCI_DISCONNECT_RESP 11 /* P-6 -> P-0
*/
*/
#define EV_PLCI_CONNECT_RESP 12 /* P-6 -> P-0
*/
*/
#define EV_PLCI_RESUME_REQ 13 /* P-0 -> P-0.Res
*/
*/
#define EV_PLCI_RESUME_CONF_OK 14 /* P-0.Res -> P-Res
*/
*/
#define EV_PLCI_RESUME_CONF_ERROR 15 /* P-0.Res -> P-0
*/
*/
#define EV_PLCI_RESUME_IND 16 /* P-Res -> P-ACT
*/
*/
#define EV_PLCI_HOLD_IND 17 /* P-ACT -> P-HELD
*/
*/
#define EV_PLCI_RETRIEVE_IND 18 /* P-HELD -> P-ACT
*/
*/
#define EV_PLCI_SUSPEND_IND 19 /* P-ACT -> P-5
*/
*/
#define EV_PLCI_CD_IND 20 /* P-2 -> P-5
*/
*/
/*
* per ncci state machine

View File

@ -4,9 +4,9 @@
#include <linux/module.h>
#include <linux/isdn/capilli.h>
#define DBG(format, arg...) do { \
printk(KERN_DEBUG "%s: " format "\n" , __func__ , ## arg); \
} while (0)
#define DBG(format, arg...) do { \
printk(KERN_DEBUG "%s: " format "\n" , __func__ , ## arg); \
} while (0)
struct capilib_msgidqueue {
struct capilib_msgidqueue *next;
@ -28,7 +28,7 @@ struct capilib_ncci {
// ---------------------------------------------------------------------------
// NCCI Handling
static inline void mq_init(struct capilib_ncci * np)
static inline void mq_init(struct capilib_ncci *np)
{
u_int i;
np->msgidqueue = NULL;
@ -42,7 +42,7 @@ static inline void mq_init(struct capilib_ncci * np)
}
}
static inline int mq_enqueue(struct capilib_ncci * np, u16 msgid)
static inline int mq_enqueue(struct capilib_ncci *np, u16 msgid)
{
struct capilib_msgidqueue *mq;
if ((mq = np->msgidfree) == NULL)
@ -59,7 +59,7 @@ static inline int mq_enqueue(struct capilib_ncci * np, u16 msgid)
return 1;
}
static inline int mq_dequeue(struct capilib_ncci * np, u16 msgid)
static inline int mq_dequeue(struct capilib_ncci *np, u16 msgid)
{
struct capilib_msgidqueue **pp;
for (pp = &np->msgidqueue; *pp; pp = &(*pp)->next) {
@ -165,7 +165,7 @@ u16 capilib_data_b3_req(struct list_head *head, u16 applid, u32 ncci, u16 msgid)
continue;
if (np->ncci != ncci)
continue;
if (mq_enqueue(np, msgid) == 0)
return CAPI_SENDQUEUEFULL;
@ -188,7 +188,7 @@ void capilib_data_b3_conf(struct list_head *head, u16 applid, u32 ncci, u16 msgi
continue;
if (np->ncci != ncci)
continue;
if (mq_dequeue(np, msgid) == 0) {
printk(KERN_ERR "kcapi: msgid %hu ncci 0x%x not on queue\n",
msgid, ncci);

View File

@ -25,149 +25,149 @@
#ifndef CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON
char *capi_info2str(u16 reason)
{
return "..";
return "..";
}
#else
char *capi_info2str(u16 reason)
{
switch (reason) {
switch (reason) {
/*-- informative values (corresponding message was processed) -----*/
case 0x0001:
return "NCPI not supported by current protocol, NCPI ignored";
return "NCPI not supported by current protocol, NCPI ignored";
case 0x0002:
return "Flags not supported by current protocol, flags ignored";
return "Flags not supported by current protocol, flags ignored";
case 0x0003:
return "Alert already sent by another application";
return "Alert already sent by another application";
/*-- error information concerning CAPI_REGISTER -----*/
case 0x1001:
return "Too many applications";
return "Too many applications";
case 0x1002:
return "Logical block size too small, must be at least 128 Bytes";
return "Logical block size too small, must be at least 128 Bytes";
case 0x1003:
return "Buffer exceeds 64 kByte";
return "Buffer exceeds 64 kByte";
case 0x1004:
return "Message buffer size too small, must be at least 1024 Bytes";
return "Message buffer size too small, must be at least 1024 Bytes";
case 0x1005:
return "Max. number of logical connections not supported";
return "Max. number of logical connections not supported";
case 0x1006:
return "Reserved";
return "Reserved";
case 0x1007:
return "The message could not be accepted because of an internal busy condition";
return "The message could not be accepted because of an internal busy condition";
case 0x1008:
return "OS resource error (no memory ?)";
return "OS resource error (no memory ?)";
case 0x1009:
return "CAPI not installed";
return "CAPI not installed";
case 0x100A:
return "Controller does not support external equipment";
return "Controller does not support external equipment";
case 0x100B:
return "Controller does only support external equipment";
return "Controller does only support external equipment";
/*-- error information concerning message exchange functions -----*/
case 0x1101:
return "Illegal application number";
return "Illegal application number";
case 0x1102:
return "Illegal command or subcommand or message length less than 12 bytes";
return "Illegal command or subcommand or message length less than 12 bytes";
case 0x1103:
return "The message could not be accepted because of a queue full condition !! The error code does not imply that CAPI cannot receive messages directed to another controller, PLCI or NCCI";
return "The message could not be accepted because of a queue full condition !! The error code does not imply that CAPI cannot receive messages directed to another controller, PLCI or NCCI";
case 0x1104:
return "Queue is empty";
return "Queue is empty";
case 0x1105:
return "Queue overflow, a message was lost !! This indicates a configuration error. The only recovery from this error is to perform a CAPI_RELEASE";
return "Queue overflow, a message was lost !! This indicates a configuration error. The only recovery from this error is to perform a CAPI_RELEASE";
case 0x1106:
return "Unknown notification parameter";
return "Unknown notification parameter";
case 0x1107:
return "The Message could not be accepted because of an internal busy condition";
return "The Message could not be accepted because of an internal busy condition";
case 0x1108:
return "OS Resource error (no memory ?)";
return "OS Resource error (no memory ?)";
case 0x1109:
return "CAPI not installed";
return "CAPI not installed";
case 0x110A:
return "Controller does not support external equipment";
return "Controller does not support external equipment";
case 0x110B:
return "Controller does only support external equipment";
return "Controller does only support external equipment";
/*-- error information concerning resource / coding problems -----*/
case 0x2001:
return "Message not supported in current state";
return "Message not supported in current state";
case 0x2002:
return "Illegal Controller / PLCI / NCCI";
return "Illegal Controller / PLCI / NCCI";
case 0x2003:
return "Out of PLCI";
return "Out of PLCI";
case 0x2004:
return "Out of NCCI";
return "Out of NCCI";
case 0x2005:
return "Out of LISTEN";
return "Out of LISTEN";
case 0x2006:
return "Out of FAX resources (protocol T.30)";
return "Out of FAX resources (protocol T.30)";
case 0x2007:
return "Illegal message parameter coding";
return "Illegal message parameter coding";
/*-- error information concerning requested services -----*/
case 0x3001:
return "B1 protocol not supported";
case 0x3002:
return "B2 protocol not supported";
case 0x3003:
return "B3 protocol not supported";
case 0x3004:
return "B1 protocol parameter not supported";
case 0x3005:
return "B2 protocol parameter not supported";
case 0x3006:
return "B3 protocol parameter not supported";
case 0x3007:
return "B protocol combination not supported";
case 0x3008:
return "NCPI not supported";
case 0x3009:
return "CIP Value unknown";
case 0x300A:
return "Flags not supported (reserved bits)";
case 0x300B:
return "Facility not supported";
case 0x300C:
return "Data length not supported by current protocol";
case 0x300D:
return "Reset procedure not supported by current protocol";
return "B1 protocol not supported";
case 0x3002:
return "B2 protocol not supported";
case 0x3003:
return "B3 protocol not supported";
case 0x3004:
return "B1 protocol parameter not supported";
case 0x3005:
return "B2 protocol parameter not supported";
case 0x3006:
return "B3 protocol parameter not supported";
case 0x3007:
return "B protocol combination not supported";
case 0x3008:
return "NCPI not supported";
case 0x3009:
return "CIP Value unknown";
case 0x300A:
return "Flags not supported (reserved bits)";
case 0x300B:
return "Facility not supported";
case 0x300C:
return "Data length not supported by current protocol";
case 0x300D:
return "Reset procedure not supported by current protocol";
/*-- informations about the clearing of a physical connection -----*/
case 0x3301:
return "Protocol error layer 1 (broken line or B-channel removed by signalling protocol)";
case 0x3302:
return "Protocol error layer 2";
case 0x3303:
return "Protocol error layer 3";
case 0x3304:
return "Another application got that call";
case 0x3301:
return "Protocol error layer 1 (broken line or B-channel removed by signalling protocol)";
case 0x3302:
return "Protocol error layer 2";
case 0x3303:
return "Protocol error layer 3";
case 0x3304:
return "Another application got that call";
/*-- T.30 specific reasons -----*/
case 0x3311:
return "Connecting not successful (remote station is no FAX G3 machine)";
case 0x3312:
return "Connecting not successful (training error)";
case 0x3313:
return "Disconnected before transfer (remote station does not support transfer mode, e.g. resolution)";
case 0x3314:
return "Disconnected during transfer (remote abort)";
case 0x3315:
return "Disconnected during transfer (remote procedure error, e.g. unsuccessful repetition of T.30 commands)";
case 0x3316:
return "Disconnected during transfer (local tx data underrun)";
case 0x3317:
return "Disconnected during transfer (local rx data overflow)";
case 0x3318:
return "Disconnected during transfer (local abort)";
case 0x3319:
return "Illegal parameter coding (e.g. SFF coding error)";
case 0x3311:
return "Connecting not successful (remote station is no FAX G3 machine)";
case 0x3312:
return "Connecting not successful (training error)";
case 0x3313:
return "Disconnected before transfer (remote station does not support transfer mode, e.g. resolution)";
case 0x3314:
return "Disconnected during transfer (remote abort)";
case 0x3315:
return "Disconnected during transfer (remote procedure error, e.g. unsuccessful repetition of T.30 commands)";
case 0x3316:
return "Disconnected during transfer (local tx data underrun)";
case 0x3317:
return "Disconnected during transfer (local rx data overflow)";
case 0x3318:
return "Disconnected during transfer (local abort)";
case 0x3319:
return "Illegal parameter coding (e.g. SFF coding error)";
/*-- disconnect causes from the network according to ETS 300 102-1/Q.931 -----*/
case 0x3481: return "Unallocated (unassigned) number";
case 0x3482: return "No route to specified transit network";
case 0x3483: return "No route to destination";
case 0x3486: return "Channel unacceptable";
case 0x3487:
return "Call awarded and being delivered in an established channel";
case 0x3487:
return "Call awarded and being delivered in an established channel";
case 0x3490: return "Normal call clearing";
case 0x3491: return "User busy";
case 0x3492: return "No user responding";
@ -217,7 +217,7 @@ char *capi_info2str(u16 reason)
case 0x34FF: return "Interworking, unspecified";
default: return "No additional information";
}
}
}
#endif
@ -235,169 +235,169 @@ typedef struct {
static _cdef cdef[] =
{
/*00 */
{_CEND},
/*01 */
{_CEND},
/*02 */
{_CEND},
/*03 */
{_CDWORD, offsetof(_cmsg, adr.adrController)},
/*04 */
{_CMSTRUCT, offsetof(_cmsg, AdditionalInfo)},
/*05 */
{_CSTRUCT, offsetof(_cmsg, B1configuration)},
/*06 */
{_CWORD, offsetof(_cmsg, B1protocol)},
/*07 */
{_CSTRUCT, offsetof(_cmsg, B2configuration)},
/*08 */
{_CWORD, offsetof(_cmsg, B2protocol)},
/*09 */
{_CSTRUCT, offsetof(_cmsg, B3configuration)},
/*0a */
{_CWORD, offsetof(_cmsg, B3protocol)},
/*0b */
{_CSTRUCT, offsetof(_cmsg, BC)},
/*0c */
{_CSTRUCT, offsetof(_cmsg, BChannelinformation)},
/*0d */
{_CMSTRUCT, offsetof(_cmsg, BProtocol)},
/*0e */
{_CSTRUCT, offsetof(_cmsg, CalledPartyNumber)},
/*0f */
{_CSTRUCT, offsetof(_cmsg, CalledPartySubaddress)},
/*10 */
{_CSTRUCT, offsetof(_cmsg, CallingPartyNumber)},
/*11 */
{_CSTRUCT, offsetof(_cmsg, CallingPartySubaddress)},
/*12 */
{_CDWORD, offsetof(_cmsg, CIPmask)},
/*13 */
{_CDWORD, offsetof(_cmsg, CIPmask2)},
/*14 */
{_CWORD, offsetof(_cmsg, CIPValue)},
/*15 */
{_CDWORD, offsetof(_cmsg, Class)},
/*16 */
{_CSTRUCT, offsetof(_cmsg, ConnectedNumber)},
/*17 */
{_CSTRUCT, offsetof(_cmsg, ConnectedSubaddress)},
/*18 */
{_CDWORD, offsetof(_cmsg, Data)},
/*19 */
{_CWORD, offsetof(_cmsg, DataHandle)},
/*1a */
{_CWORD, offsetof(_cmsg, DataLength)},
/*1b */
{_CSTRUCT, offsetof(_cmsg, FacilityConfirmationParameter)},
/*1c */
{_CSTRUCT, offsetof(_cmsg, Facilitydataarray)},
/*1d */
{_CSTRUCT, offsetof(_cmsg, FacilityIndicationParameter)},
/*1e */
{_CSTRUCT, offsetof(_cmsg, FacilityRequestParameter)},
/*1f */
{_CWORD, offsetof(_cmsg, FacilitySelector)},
/*20 */
{_CWORD, offsetof(_cmsg, Flags)},
/*21 */
{_CDWORD, offsetof(_cmsg, Function)},
/*22 */
{_CSTRUCT, offsetof(_cmsg, HLC)},
/*23 */
{_CWORD, offsetof(_cmsg, Info)},
/*24 */
{_CSTRUCT, offsetof(_cmsg, InfoElement)},
/*25 */
{_CDWORD, offsetof(_cmsg, InfoMask)},
/*26 */
{_CWORD, offsetof(_cmsg, InfoNumber)},
/*27 */
{_CSTRUCT, offsetof(_cmsg, Keypadfacility)},
/*28 */
{_CSTRUCT, offsetof(_cmsg, LLC)},
/*29 */
{_CSTRUCT, offsetof(_cmsg, ManuData)},
/*2a */
{_CDWORD, offsetof(_cmsg, ManuID)},
/*2b */
{_CSTRUCT, offsetof(_cmsg, NCPI)},
/*2c */
{_CWORD, offsetof(_cmsg, Reason)},
/*2d */
{_CWORD, offsetof(_cmsg, Reason_B3)},
/*2e */
{_CWORD, offsetof(_cmsg, Reject)},
/*2f */
{_CSTRUCT, offsetof(_cmsg, Useruserdata)}
/*00 */
{_CEND},
/*01 */
{_CEND},
/*02 */
{_CEND},
/*03 */
{_CDWORD, offsetof(_cmsg, adr.adrController)},
/*04 */
{_CMSTRUCT, offsetof(_cmsg, AdditionalInfo)},
/*05 */
{_CSTRUCT, offsetof(_cmsg, B1configuration)},
/*06 */
{_CWORD, offsetof(_cmsg, B1protocol)},
/*07 */
{_CSTRUCT, offsetof(_cmsg, B2configuration)},
/*08 */
{_CWORD, offsetof(_cmsg, B2protocol)},
/*09 */
{_CSTRUCT, offsetof(_cmsg, B3configuration)},
/*0a */
{_CWORD, offsetof(_cmsg, B3protocol)},
/*0b */
{_CSTRUCT, offsetof(_cmsg, BC)},
/*0c */
{_CSTRUCT, offsetof(_cmsg, BChannelinformation)},
/*0d */
{_CMSTRUCT, offsetof(_cmsg, BProtocol)},
/*0e */
{_CSTRUCT, offsetof(_cmsg, CalledPartyNumber)},
/*0f */
{_CSTRUCT, offsetof(_cmsg, CalledPartySubaddress)},
/*10 */
{_CSTRUCT, offsetof(_cmsg, CallingPartyNumber)},
/*11 */
{_CSTRUCT, offsetof(_cmsg, CallingPartySubaddress)},
/*12 */
{_CDWORD, offsetof(_cmsg, CIPmask)},
/*13 */
{_CDWORD, offsetof(_cmsg, CIPmask2)},
/*14 */
{_CWORD, offsetof(_cmsg, CIPValue)},
/*15 */
{_CDWORD, offsetof(_cmsg, Class)},
/*16 */
{_CSTRUCT, offsetof(_cmsg, ConnectedNumber)},
/*17 */
{_CSTRUCT, offsetof(_cmsg, ConnectedSubaddress)},
/*18 */
{_CDWORD, offsetof(_cmsg, Data)},
/*19 */
{_CWORD, offsetof(_cmsg, DataHandle)},
/*1a */
{_CWORD, offsetof(_cmsg, DataLength)},
/*1b */
{_CSTRUCT, offsetof(_cmsg, FacilityConfirmationParameter)},
/*1c */
{_CSTRUCT, offsetof(_cmsg, Facilitydataarray)},
/*1d */
{_CSTRUCT, offsetof(_cmsg, FacilityIndicationParameter)},
/*1e */
{_CSTRUCT, offsetof(_cmsg, FacilityRequestParameter)},
/*1f */
{_CWORD, offsetof(_cmsg, FacilitySelector)},
/*20 */
{_CWORD, offsetof(_cmsg, Flags)},
/*21 */
{_CDWORD, offsetof(_cmsg, Function)},
/*22 */
{_CSTRUCT, offsetof(_cmsg, HLC)},
/*23 */
{_CWORD, offsetof(_cmsg, Info)},
/*24 */
{_CSTRUCT, offsetof(_cmsg, InfoElement)},
/*25 */
{_CDWORD, offsetof(_cmsg, InfoMask)},
/*26 */
{_CWORD, offsetof(_cmsg, InfoNumber)},
/*27 */
{_CSTRUCT, offsetof(_cmsg, Keypadfacility)},
/*28 */
{_CSTRUCT, offsetof(_cmsg, LLC)},
/*29 */
{_CSTRUCT, offsetof(_cmsg, ManuData)},
/*2a */
{_CDWORD, offsetof(_cmsg, ManuID)},
/*2b */
{_CSTRUCT, offsetof(_cmsg, NCPI)},
/*2c */
{_CWORD, offsetof(_cmsg, Reason)},
/*2d */
{_CWORD, offsetof(_cmsg, Reason_B3)},
/*2e */
{_CWORD, offsetof(_cmsg, Reject)},
/*2f */
{_CSTRUCT, offsetof(_cmsg, Useruserdata)}
};
static unsigned char *cpars[] =
{
/* ALERT_REQ */ [0x01] = "\x03\x04\x0c\x27\x2f\x1c\x01\x01",
/* CONNECT_REQ */ [0x02] = "\x03\x14\x0e\x10\x0f\x11\x0d\x06\x08\x0a\x05\x07\x09\x01\x0b\x28\x22\x04\x0c\x27\x2f\x1c\x01\x01",
/* DISCONNECT_REQ */ [0x04] = "\x03\x04\x0c\x27\x2f\x1c\x01\x01",
/* LISTEN_REQ */ [0x05] = "\x03\x25\x12\x13\x10\x11\x01",
/* INFO_REQ */ [0x08] = "\x03\x0e\x04\x0c\x27\x2f\x1c\x01\x01",
/* FACILITY_REQ */ [0x09] = "\x03\x1f\x1e\x01",
/* SELECT_B_PROTOCOL_REQ */ [0x0a] = "\x03\x0d\x06\x08\x0a\x05\x07\x09\x01\x01",
/* CONNECT_B3_REQ */ [0x0b] = "\x03\x2b\x01",
/* DISCONNECT_B3_REQ */ [0x0d] = "\x03\x2b\x01",
/* DATA_B3_REQ */ [0x0f] = "\x03\x18\x1a\x19\x20\x01",
/* RESET_B3_REQ */ [0x10] = "\x03\x2b\x01",
/* ALERT_CONF */ [0x13] = "\x03\x23\x01",
/* CONNECT_CONF */ [0x14] = "\x03\x23\x01",
/* DISCONNECT_CONF */ [0x16] = "\x03\x23\x01",
/* LISTEN_CONF */ [0x17] = "\x03\x23\x01",
/* MANUFACTURER_REQ */ [0x18] = "\x03\x2a\x15\x21\x29\x01",
/* INFO_CONF */ [0x1a] = "\x03\x23\x01",
/* FACILITY_CONF */ [0x1b] = "\x03\x23\x1f\x1b\x01",
/* SELECT_B_PROTOCOL_CONF */ [0x1c] = "\x03\x23\x01",
/* CONNECT_B3_CONF */ [0x1d] = "\x03\x23\x01",
/* DISCONNECT_B3_CONF */ [0x1f] = "\x03\x23\x01",
/* DATA_B3_CONF */ [0x21] = "\x03\x19\x23\x01",
/* RESET_B3_CONF */ [0x22] = "\x03\x23\x01",
/* CONNECT_IND */ [0x26] = "\x03\x14\x0e\x10\x0f\x11\x0b\x28\x22\x04\x0c\x27\x2f\x1c\x01\x01",
/* CONNECT_ACTIVE_IND */ [0x27] = "\x03\x16\x17\x28\x01",
/* DISCONNECT_IND */ [0x28] = "\x03\x2c\x01",
/* MANUFACTURER_CONF */ [0x2a] = "\x03\x2a\x15\x21\x29\x01",
/* INFO_IND */ [0x2c] = "\x03\x26\x24\x01",
/* FACILITY_IND */ [0x2d] = "\x03\x1f\x1d\x01",
/* CONNECT_B3_IND */ [0x2f] = "\x03\x2b\x01",
/* CONNECT_B3_ACTIVE_IND */ [0x30] = "\x03\x2b\x01",
/* DISCONNECT_B3_IND */ [0x31] = "\x03\x2d\x2b\x01",
/* DATA_B3_IND */ [0x33] = "\x03\x18\x1a\x19\x20\x01",
/* RESET_B3_IND */ [0x34] = "\x03\x2b\x01",
/* CONNECT_B3_T90_ACTIVE_IND */ [0x35] = "\x03\x2b\x01",
/* CONNECT_RESP */ [0x38] = "\x03\x2e\x0d\x06\x08\x0a\x05\x07\x09\x01\x16\x17\x28\x04\x0c\x27\x2f\x1c\x01\x01",
/* CONNECT_ACTIVE_RESP */ [0x39] = "\x03\x01",
/* DISCONNECT_RESP */ [0x3a] = "\x03\x01",
/* MANUFACTURER_IND */ [0x3c] = "\x03\x2a\x15\x21\x29\x01",
/* INFO_RESP */ [0x3e] = "\x03\x01",
/* FACILITY_RESP */ [0x3f] = "\x03\x1f\x01",
/* CONNECT_B3_RESP */ [0x41] = "\x03\x2e\x2b\x01",
/* CONNECT_B3_ACTIVE_RESP */ [0x42] = "\x03\x01",
/* DISCONNECT_B3_RESP */ [0x43] = "\x03\x01",
/* DATA_B3_RESP */ [0x45] = "\x03\x19\x01",
/* RESET_B3_RESP */ [0x46] = "\x03\x01",
/* CONNECT_B3_T90_ACTIVE_RESP */ [0x47] = "\x03\x01",
/* MANUFACTURER_RESP */ [0x4e] = "\x03\x2a\x15\x21\x29\x01",
/* ALERT_REQ */ [0x01] = "\x03\x04\x0c\x27\x2f\x1c\x01\x01",
/* CONNECT_REQ */ [0x02] = "\x03\x14\x0e\x10\x0f\x11\x0d\x06\x08\x0a\x05\x07\x09\x01\x0b\x28\x22\x04\x0c\x27\x2f\x1c\x01\x01",
/* DISCONNECT_REQ */ [0x04] = "\x03\x04\x0c\x27\x2f\x1c\x01\x01",
/* LISTEN_REQ */ [0x05] = "\x03\x25\x12\x13\x10\x11\x01",
/* INFO_REQ */ [0x08] = "\x03\x0e\x04\x0c\x27\x2f\x1c\x01\x01",
/* FACILITY_REQ */ [0x09] = "\x03\x1f\x1e\x01",
/* SELECT_B_PROTOCOL_REQ */ [0x0a] = "\x03\x0d\x06\x08\x0a\x05\x07\x09\x01\x01",
/* CONNECT_B3_REQ */ [0x0b] = "\x03\x2b\x01",
/* DISCONNECT_B3_REQ */ [0x0d] = "\x03\x2b\x01",
/* DATA_B3_REQ */ [0x0f] = "\x03\x18\x1a\x19\x20\x01",
/* RESET_B3_REQ */ [0x10] = "\x03\x2b\x01",
/* ALERT_CONF */ [0x13] = "\x03\x23\x01",
/* CONNECT_CONF */ [0x14] = "\x03\x23\x01",
/* DISCONNECT_CONF */ [0x16] = "\x03\x23\x01",
/* LISTEN_CONF */ [0x17] = "\x03\x23\x01",
/* MANUFACTURER_REQ */ [0x18] = "\x03\x2a\x15\x21\x29\x01",
/* INFO_CONF */ [0x1a] = "\x03\x23\x01",
/* FACILITY_CONF */ [0x1b] = "\x03\x23\x1f\x1b\x01",
/* SELECT_B_PROTOCOL_CONF */ [0x1c] = "\x03\x23\x01",
/* CONNECT_B3_CONF */ [0x1d] = "\x03\x23\x01",
/* DISCONNECT_B3_CONF */ [0x1f] = "\x03\x23\x01",
/* DATA_B3_CONF */ [0x21] = "\x03\x19\x23\x01",
/* RESET_B3_CONF */ [0x22] = "\x03\x23\x01",
/* CONNECT_IND */ [0x26] = "\x03\x14\x0e\x10\x0f\x11\x0b\x28\x22\x04\x0c\x27\x2f\x1c\x01\x01",
/* CONNECT_ACTIVE_IND */ [0x27] = "\x03\x16\x17\x28\x01",
/* DISCONNECT_IND */ [0x28] = "\x03\x2c\x01",
/* MANUFACTURER_CONF */ [0x2a] = "\x03\x2a\x15\x21\x29\x01",
/* INFO_IND */ [0x2c] = "\x03\x26\x24\x01",
/* FACILITY_IND */ [0x2d] = "\x03\x1f\x1d\x01",
/* CONNECT_B3_IND */ [0x2f] = "\x03\x2b\x01",
/* CONNECT_B3_ACTIVE_IND */ [0x30] = "\x03\x2b\x01",
/* DISCONNECT_B3_IND */ [0x31] = "\x03\x2d\x2b\x01",
/* DATA_B3_IND */ [0x33] = "\x03\x18\x1a\x19\x20\x01",
/* RESET_B3_IND */ [0x34] = "\x03\x2b\x01",
/* CONNECT_B3_T90_ACTIVE_IND */ [0x35] = "\x03\x2b\x01",
/* CONNECT_RESP */ [0x38] = "\x03\x2e\x0d\x06\x08\x0a\x05\x07\x09\x01\x16\x17\x28\x04\x0c\x27\x2f\x1c\x01\x01",
/* CONNECT_ACTIVE_RESP */ [0x39] = "\x03\x01",
/* DISCONNECT_RESP */ [0x3a] = "\x03\x01",
/* MANUFACTURER_IND */ [0x3c] = "\x03\x2a\x15\x21\x29\x01",
/* INFO_RESP */ [0x3e] = "\x03\x01",
/* FACILITY_RESP */ [0x3f] = "\x03\x1f\x01",
/* CONNECT_B3_RESP */ [0x41] = "\x03\x2e\x2b\x01",
/* CONNECT_B3_ACTIVE_RESP */ [0x42] = "\x03\x01",
/* DISCONNECT_B3_RESP */ [0x43] = "\x03\x01",
/* DATA_B3_RESP */ [0x45] = "\x03\x19\x01",
/* RESET_B3_RESP */ [0x46] = "\x03\x01",
/* CONNECT_B3_T90_ACTIVE_RESP */ [0x47] = "\x03\x01",
/* MANUFACTURER_RESP */ [0x4e] = "\x03\x2a\x15\x21\x29\x01",
};
/*-------------------------------------------------------*/
#define byteTLcpy(x,y) *(u8 *)(x)=*(u8 *)(y);
#define wordTLcpy(x,y) *(u16 *)(x)=*(u16 *)(y);
#define dwordTLcpy(x,y) memcpy(x,y,4);
#define structTLcpy(x,y,l) memcpy (x,y,l)
#define structTLcpyovl(x,y,l) memmove (x,y,l)
#define byteTLcpy(x, y) *(u8 *)(x) = *(u8 *)(y);
#define wordTLcpy(x, y) *(u16 *)(x) = *(u16 *)(y);
#define dwordTLcpy(x, y) memcpy(x, y, 4);
#define structTLcpy(x, y, l) memcpy(x, y, l)
#define structTLcpyovl(x, y, l) memmove(x, y, l)
#define byteTRcpy(x,y) *(u8 *)(y)=*(u8 *)(x);
#define wordTRcpy(x,y) *(u16 *)(y)=*(u16 *)(x);
#define dwordTRcpy(x,y) memcpy(y,x,4);
#define structTRcpy(x,y,l) memcpy (y,x,l)
#define structTRcpyovl(x,y,l) memmove (y,x,l)
#define byteTRcpy(x, y) *(u8 *)(y) = *(u8 *)(x);
#define wordTRcpy(x, y) *(u16 *)(y) = *(u16 *)(x);
#define dwordTRcpy(x, y) memcpy(y, x, 4);
#define structTRcpy(x, y, l) memcpy(y, x, l)
#define structTRcpyovl(x, y, l) memmove(y, x, l)
/*-------------------------------------------------------*/
static unsigned command_2_index(unsigned c, unsigned sc)
@ -414,9 +414,9 @@ static unsigned command_2_index(unsigned c, unsigned sc)
/*-------------------------------------------------------*/
#define TYP (cdef[cmsg->par[cmsg->p]].typ)
#define OFF (((u8 *)cmsg)+cdef[cmsg->par[cmsg->p]].off)
#define OFF (((u8 *)cmsg) + cdef[cmsg->par[cmsg->p]].off)
static void jumpcstruct(_cmsg * cmsg)
static void jumpcstruct(_cmsg *cmsg)
{
unsigned layer;
for (cmsg->p++, layer = 1; layer;) {
@ -433,7 +433,7 @@ static void jumpcstruct(_cmsg * cmsg)
}
}
/*-------------------------------------------------------*/
static void pars_2_message(_cmsg * cmsg)
static void pars_2_message(_cmsg *cmsg)
{
for (; TYP != _CEND; cmsg->p++) {
@ -499,7 +499,7 @@ static void pars_2_message(_cmsg * cmsg)
* Return value: 0 for success
*/
unsigned capi_cmsg2message(_cmsg * cmsg, u8 * msg)
unsigned capi_cmsg2message(_cmsg *cmsg, u8 *msg)
{
cmsg->m = msg;
cmsg->l = 8;
@ -518,7 +518,7 @@ unsigned capi_cmsg2message(_cmsg * cmsg, u8 * msg)
}
/*-------------------------------------------------------*/
static void message_2_pars(_cmsg * cmsg)
static void message_2_pars(_cmsg *cmsg)
{
for (; TYP != _CEND; cmsg->p++) {
@ -569,7 +569,7 @@ static void message_2_pars(_cmsg * cmsg)
* Return value: 0 for success
*/
unsigned capi_message2cmsg(_cmsg * cmsg, u8 * msg)
unsigned capi_message2cmsg(_cmsg *cmsg, u8 *msg)
{
memset(cmsg, 0, sizeof(_cmsg));
cmsg->m = msg;
@ -600,7 +600,7 @@ unsigned capi_message2cmsg(_cmsg * cmsg, u8 * msg)
* Return value: 0 for success
*/
unsigned capi_cmsg_header(_cmsg * cmsg, u16 _ApplId,
unsigned capi_cmsg_header(_cmsg *cmsg, u16 _ApplId,
u8 _Command, u8 _Subcommand,
u16 _Messagenumber, u32 _Controller)
{
@ -689,54 +689,54 @@ char *capi_cmd2str(u8 cmd, u8 subcmd)
static char *pnames[] =
{
/*00 */ NULL,
/*01 */ NULL,
/*02 */ NULL,
/*03 */ "Controller/PLCI/NCCI",
/*04 */ "AdditionalInfo",
/*05 */ "B1configuration",
/*06 */ "B1protocol",
/*07 */ "B2configuration",
/*08 */ "B2protocol",
/*09 */ "B3configuration",
/*0a */ "B3protocol",
/*0b */ "BC",
/*0c */ "BChannelinformation",
/*0d */ "BProtocol",
/*0e */ "CalledPartyNumber",
/*0f */ "CalledPartySubaddress",
/*10 */ "CallingPartyNumber",
/*11 */ "CallingPartySubaddress",
/*12 */ "CIPmask",
/*13 */ "CIPmask2",
/*14 */ "CIPValue",
/*15 */ "Class",
/*16 */ "ConnectedNumber",
/*17 */ "ConnectedSubaddress",
/*18 */ "Data32",
/*19 */ "DataHandle",
/*1a */ "DataLength",
/*1b */ "FacilityConfirmationParameter",
/*1c */ "Facilitydataarray",
/*1d */ "FacilityIndicationParameter",
/*1e */ "FacilityRequestParameter",
/*1f */ "FacilitySelector",
/*20 */ "Flags",
/*21 */ "Function",
/*22 */ "HLC",
/*23 */ "Info",
/*24 */ "InfoElement",
/*25 */ "InfoMask",
/*26 */ "InfoNumber",
/*27 */ "Keypadfacility",
/*28 */ "LLC",
/*29 */ "ManuData",
/*2a */ "ManuID",
/*2b */ "NCPI",
/*2c */ "Reason",
/*2d */ "Reason_B3",
/*2e */ "Reject",
/*2f */ "Useruserdata"
/*00 */ NULL,
/*01 */ NULL,
/*02 */ NULL,
/*03 */ "Controller/PLCI/NCCI",
/*04 */ "AdditionalInfo",
/*05 */ "B1configuration",
/*06 */ "B1protocol",
/*07 */ "B2configuration",
/*08 */ "B2protocol",
/*09 */ "B3configuration",
/*0a */ "B3protocol",
/*0b */ "BC",
/*0c */ "BChannelinformation",
/*0d */ "BProtocol",
/*0e */ "CalledPartyNumber",
/*0f */ "CalledPartySubaddress",
/*10 */ "CallingPartyNumber",
/*11 */ "CallingPartySubaddress",
/*12 */ "CIPmask",
/*13 */ "CIPmask2",
/*14 */ "CIPValue",
/*15 */ "Class",
/*16 */ "ConnectedNumber",
/*17 */ "ConnectedSubaddress",
/*18 */ "Data32",
/*19 */ "DataHandle",
/*1a */ "DataLength",
/*1b */ "FacilityConfirmationParameter",
/*1c */ "Facilitydataarray",
/*1d */ "FacilityIndicationParameter",
/*1e */ "FacilityRequestParameter",
/*1f */ "FacilitySelector",
/*20 */ "Flags",
/*21 */ "Function",
/*22 */ "HLC",
/*23 */ "Info",
/*24 */ "InfoElement",
/*25 */ "InfoMask",
/*26 */ "InfoNumber",
/*27 */ "Keypadfacility",
/*28 */ "LLC",
/*29 */ "ManuData",
/*2a */ "ManuID",
/*2b */ "NCPI",
/*2c */ "Reason",
/*2d */ "Reason_B3",
/*2e */ "Reject",
/*2f */ "Useruserdata"
};
@ -744,10 +744,10 @@ static char *pnames[] =
#include <stdarg.h>
/*-------------------------------------------------------*/
static _cdebbuf *bufprint(_cdebbuf *cdb, char *fmt,...)
static _cdebbuf *bufprint(_cdebbuf *cdb, char *fmt, ...)
{
va_list f;
size_t n,r;
size_t n, r;
if (!cdb)
return NULL;
@ -783,7 +783,7 @@ static _cdebbuf *bufprint(_cdebbuf *cdb, char *fmt,...)
return cdb;
}
static _cdebbuf *printstructlen(_cdebbuf *cdb, u8 * m, unsigned len)
static _cdebbuf *printstructlen(_cdebbuf *cdb, u8 *m, unsigned len)
{
unsigned hex = 0;
@ -807,7 +807,7 @@ static _cdebbuf *printstructlen(_cdebbuf *cdb, u8 * m, unsigned len)
return cdb;
}
static _cdebbuf *printstruct(_cdebbuf *cdb, u8 * m)
static _cdebbuf *printstruct(_cdebbuf *cdb, u8 *m)
{
unsigned len;
@ -940,7 +940,7 @@ void cdebbuf_free(_cdebbuf *cdb)
* The returned buffer should be freed by a call to cdebbuf_free() after use.
*/
_cdebbuf *capi_message2str(u8 * msg)
_cdebbuf *capi_message2str(u8 *msg)
{
_cdebbuf *cdb;
_cmsg *cmsg;
@ -964,10 +964,10 @@ _cdebbuf *capi_message2str(u8 * msg)
cmsg->par = cpars[command_2_index(cmsg->Command, cmsg->Subcommand)];
cdb = bufprint(cdb, "%-26s ID=%03d #0x%04x LEN=%04d\n",
mnames[command_2_index(cmsg->Command, cmsg->Subcommand)],
((unsigned short *) msg)[1],
((unsigned short *) msg)[3],
((unsigned short *) msg)[0]);
mnames[command_2_index(cmsg->Command, cmsg->Subcommand)],
((unsigned short *) msg)[1],
((unsigned short *) msg)[3],
((unsigned short *) msg)[0]);
cdb = protocol_message_2_pars(cdb, cmsg, 1);
if (unlikely(cmsg != g_cmsg))
@ -986,7 +986,7 @@ _cdebbuf *capi_message2str(u8 * msg)
* The returned buffer should be freed by a call to cdebbuf_free() after use.
*/
_cdebbuf *capi_cmsg2str(_cmsg * cmsg)
_cdebbuf *capi_cmsg2str(_cmsg *cmsg)
{
_cdebbuf *cdb;
@ -998,17 +998,17 @@ _cdebbuf *capi_cmsg2str(_cmsg * cmsg)
cmsg->l = 8;
cmsg->p = 0;
cdb = bufprint(cdb, "%s ID=%03d #0x%04x LEN=%04d\n",
mnames[command_2_index(cmsg->Command, cmsg->Subcommand)],
((u16 *) cmsg->m)[1],
((u16 *) cmsg->m)[3],
((u16 *) cmsg->m)[0]);
mnames[command_2_index(cmsg->Command, cmsg->Subcommand)],
((u16 *) cmsg->m)[1],
((u16 *) cmsg->m)[3],
((u16 *) cmsg->m)[0]);
cdb = protocol_message_2_pars(cdb, cmsg, 1);
return cdb;
}
int __init cdebug_init(void)
{
g_cmsg= kmalloc(sizeof(_cmsg), GFP_KERNEL);
g_cmsg = kmalloc(sizeof(_cmsg), GFP_KERNEL);
if (!g_cmsg)
return -ENOMEM;
g_debbuf = kmalloc(sizeof(_cdebbuf), GFP_KERNEL);
@ -1041,12 +1041,12 @@ void __exit cdebug_exit(void)
static _cdebbuf g_debbuf = {"CONFIG_CAPI_TRACE not enabled", NULL, 0, 0};
_cdebbuf *capi_message2str(u8 * msg)
_cdebbuf *capi_message2str(u8 *msg)
{
return &g_debbuf;
}
_cdebbuf *capi_cmsg2str(_cmsg * cmsg)
_cdebbuf *capi_cmsg2str(_cmsg *cmsg)
{
return &g_debbuf;
}

View File

@ -1,10 +1,10 @@
/* $Id: kcapi.c,v 1.1.2.8 2004/03/26 19:57:20 armin Exp $
*
*
* Kernel CAPI 2.0 Module
*
*
* Copyright 1999 by Carsten Paeth <calle@calle.de>
* Copyright 2002 by Kai Germaschewski <kai@germaschewski.name>
*
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
@ -55,7 +55,7 @@ struct capictr_event {
/* ------------------------------------------------------------- */
static struct capi_version driver_version = {2, 0, 1, 1<<4};
static struct capi_version driver_version = {2, 0, 1, 1 << 4};
static char driver_serial[CAPI_SERIAL_LEN] = "0004711";
static char capi_manufakturer[64] = "AVM Berlin";
@ -172,7 +172,7 @@ register_appl(struct capi_ctr *ctr, u16 applid, capi_register_params *rparam)
static void release_appl(struct capi_ctr *ctr, u16 applid)
{
DBG("applid %#x", applid);
ctr->release_appl(ctr, applid);
capi_ctr_put(ctr);
}
@ -186,7 +186,7 @@ static void notify_up(u32 contr)
mutex_lock(&capi_controller_lock);
if (showcapimsgs & 1)
printk(KERN_DEBUG "kcapi: notify up contr %d\n", contr);
printk(KERN_DEBUG "kcapi: notify up contr %d\n", contr);
ctr = get_capi_ctr_by_nr(contr);
if (ctr) {
@ -352,16 +352,16 @@ void capi_ctr_handle_message(struct capi_ctr *ctr, u16 appl,
cdb = capi_message2str(skb->data);
if (cdb) {
printk(KERN_INFO "kcapi: controller [%03d] not active, got: %s",
ctr->cnr, cdb->buf);
ctr->cnr, cdb->buf);
cdebbuf_free(cdb);
} else
printk(KERN_INFO "kcapi: controller [%03d] not active, cannot trace\n",
ctr->cnr);
ctr->cnr);
goto error;
}
cmd = CAPIMSG_COMMAND(skb->data);
subcmd = CAPIMSG_SUBCOMMAND(skb->data);
subcmd = CAPIMSG_SUBCOMMAND(skb->data);
if (cmd == CAPI_DATA_B3 && subcmd == CAPI_IND) {
ctr->nrecvdatapkt++;
if (ctr->traceflag > 2)
@ -382,13 +382,13 @@ void capi_ctr_handle_message(struct capi_ctr *ctr, u16 appl,
cdb = capi_message2str(skb->data);
if (cdb) {
printk(KERN_DEBUG "kcapi: got [%03d] %s\n",
ctr->cnr, cdb->buf);
ctr->cnr, cdb->buf);
cdebbuf_free(cdb);
} else
printk(KERN_DEBUG "kcapi: got [%03d] id#%d %s len=%u, cannot trace\n",
ctr->cnr, CAPIMSG_APPID(skb->data),
capi_cmd2str(cmd, subcmd),
CAPIMSG_LEN(skb->data));
ctr->cnr, CAPIMSG_APPID(skb->data),
capi_cmd2str(cmd, subcmd),
CAPIMSG_LEN(skb->data));
}
}
@ -400,12 +400,12 @@ void capi_ctr_handle_message(struct capi_ctr *ctr, u16 appl,
cdb = capi_message2str(skb->data);
if (cdb) {
printk(KERN_ERR "kcapi: handle_message: applid %d state released (%s)\n",
CAPIMSG_APPID(skb->data), cdb->buf);
CAPIMSG_APPID(skb->data), cdb->buf);
cdebbuf_free(cdb);
} else
printk(KERN_ERR "kcapi: handle_message: applid %d state released (%s) cannot trace\n",
CAPIMSG_APPID(skb->data),
capi_cmd2str(cmd, subcmd));
CAPIMSG_APPID(skb->data),
capi_cmd2str(cmd, subcmd));
goto error;
}
skb_queue_tail(&ap->recv_queue, skb);
@ -519,7 +519,7 @@ int attach_capi_ctr(struct capi_ctr *ctr)
if (i == CAPI_MAXCONTR) {
mutex_unlock(&capi_controller_lock);
printk(KERN_ERR "kcapi: out of controller slots\n");
return -EBUSY;
return -EBUSY;
}
capi_controller[i] = ctr;
@ -541,7 +541,7 @@ int attach_capi_ctr(struct capi_ctr *ctr)
mutex_unlock(&capi_controller_lock);
printk(KERN_NOTICE "kcapi: controller [%03d]: %s attached\n",
ctr->cnr, ctr->name);
ctr->cnr, ctr->name);
return 0;
}
@ -772,7 +772,7 @@ u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb)
u8 cmd, subcmd;
DBG("applid %#x", ap->applid);
if (ncontrollers == 0)
return CAPI_REGNOTINSTALLED;
if ((ap->applid == 0) || ap->release_in_progress)
@ -794,9 +794,9 @@ u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb)
return CAPI_SENDQUEUEFULL;
cmd = CAPIMSG_COMMAND(skb->data);
subcmd = CAPIMSG_SUBCOMMAND(skb->data);
subcmd = CAPIMSG_SUBCOMMAND(skb->data);
if (cmd == CAPI_DATA_B3 && subcmd== CAPI_REQ) {
if (cmd == CAPI_DATA_B3 && subcmd == CAPI_REQ) {
ctr->nsentdatapkt++;
ap->nsentdatapkt++;
if (ctr->traceflag > 2)
@ -819,15 +819,15 @@ u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb)
_cdebbuf *cdb = capi_message2str(skb->data);
if (cdb) {
printk(KERN_DEBUG "kcapi: put [%03d] %s\n",
CAPIMSG_CONTROLLER(skb->data),
cdb->buf);
CAPIMSG_CONTROLLER(skb->data),
cdb->buf);
cdebbuf_free(cdb);
} else
printk(KERN_DEBUG "kcapi: put [%03d] id#%d %s len=%u cannot trace\n",
CAPIMSG_CONTROLLER(skb->data),
CAPIMSG_APPID(skb->data),
capi_cmd2str(cmd, subcmd),
CAPIMSG_LEN(skb->data));
CAPIMSG_CONTROLLER(skb->data),
CAPIMSG_APPID(skb->data),
capi_cmd2str(cmd, subcmd),
CAPIMSG_LEN(skb->data));
}
}
return ctr->send_message(ctr, skb);
@ -1028,14 +1028,14 @@ static int old_capi_manufacturer(unsigned int cmd, void __user *data)
case AVMB1_ADDCARD:
case AVMB1_ADDCARD_WITH_TYPE:
if (cmd == AVMB1_ADDCARD) {
if ((retval = copy_from_user(&cdef, data,
sizeof(avmb1_carddef))))
return -EFAULT;
cdef.cardtype = AVM_CARDTYPE_B1;
if ((retval = copy_from_user(&cdef, data,
sizeof(avmb1_carddef))))
return -EFAULT;
cdef.cardtype = AVM_CARDTYPE_B1;
} else {
if ((retval = copy_from_user(&cdef, data,
sizeof(avmb1_extcarddef))))
return -EFAULT;
if ((retval = copy_from_user(&cdef, data,
sizeof(avmb1_extcarddef))))
return -EFAULT;
}
cparams.port = cdef.port;
cparams.irq = cdef.irq;
@ -1043,24 +1043,24 @@ static int old_capi_manufacturer(unsigned int cmd, void __user *data)
mutex_lock(&capi_drivers_lock);
switch (cdef.cardtype) {
case AVM_CARDTYPE_B1:
list_for_each(l, &capi_drivers) {
driver = list_entry(l, struct capi_driver, list);
if (strcmp(driver->name, "b1isa") == 0)
break;
}
break;
case AVM_CARDTYPE_T1:
list_for_each(l, &capi_drivers) {
driver = list_entry(l, struct capi_driver, list);
if (strcmp(driver->name, "t1isa") == 0)
break;
}
break;
default:
driver = NULL;
break;
switch (cdef.cardtype) {
case AVM_CARDTYPE_B1:
list_for_each(l, &capi_drivers) {
driver = list_entry(l, struct capi_driver, list);
if (strcmp(driver->name, "b1isa") == 0)
break;
}
break;
case AVM_CARDTYPE_T1:
list_for_each(l, &capi_drivers) {
driver = list_entry(l, struct capi_driver, list);
if (strcmp(driver->name, "t1isa") == 0)
break;
}
break;
default:
driver = NULL;
break;
}
if (!driver) {
printk(KERN_ERR "kcapi: driver not loaded.\n");
@ -1136,7 +1136,7 @@ static int old_capi_manufacturer(unsigned int cmd, void __user *data)
retval = wait_on_ctr_state(ctr, CAPI_CTR_RUNNING);
load_unlock_out:
load_unlock_out:
mutex_unlock(&capi_controller_lock);
return retval;
@ -1167,7 +1167,7 @@ load_unlock_out:
retval = wait_on_ctr_state(ctr, CAPI_CTR_DETECTED);
reset_unlock_out:
reset_unlock_out:
mutex_unlock(&capi_controller_lock);
return retval;
}
@ -1235,7 +1235,7 @@ int capi20_manufacturer(unsigned int cmd, void __user *data)
cparams.membase = cdef.membase;
cparams.cardnr = cdef.cardnr;
cparams.cardtype = 0;
cdef.driver[sizeof(cdef.driver)-1] = 0;
cdef.driver[sizeof(cdef.driver) - 1] = 0;
mutex_lock(&capi_drivers_lock);
@ -1246,7 +1246,7 @@ int capi20_manufacturer(unsigned int cmd, void __user *data)
}
if (driver == NULL) {
printk(KERN_ERR "kcapi: driver \"%s\" not loaded.\n",
cdef.driver);
cdef.driver);
retval = -ESRCH;
} else if (!driver->add_card) {
printk(KERN_ERR "kcapi: driver \"%s\" has no add card function.\n", cdef.driver);
@ -1260,7 +1260,7 @@ int capi20_manufacturer(unsigned int cmd, void __user *data)
default:
printk(KERN_ERR "kcapi: manufacturer command %d unknown.\n",
cmd);
cmd);
break;
}
@ -1305,7 +1305,7 @@ static int __init kcapi_init(void)
static void __exit kcapi_exit(void)
{
kcapi_proc_exit();
kcapi_proc_exit();
unregister_capictr_notifier(&capictr_nb);
cdebug_exit();

View File

@ -1,9 +1,9 @@
/*
* Kernel CAPI 2.0 Module
*
*
* Copyright 1999 by Carsten Paeth <calle@calle.de>
* Copyright 2002 by Kai Germaschewski <kai@germaschewski.name>
*
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
@ -16,9 +16,9 @@
#include <linux/isdn/capilli.h>
#ifdef KCAPI_DEBUG
#define DBG(format, arg...) do { \
printk(KERN_DEBUG "%s: " format "\n" , __func__ , ## arg); \
} while (0)
#define DBG(format, arg...) do { \
printk(KERN_DEBUG "%s: " format "\n" , __func__ , ## arg); \
} while (0)
#else
#define DBG(format, arg...) /* */
#endif
@ -49,4 +49,3 @@ static inline void kcapi_proc_init(void) { };
static inline void kcapi_proc_exit(void) { };
#endif

View File

@ -1,9 +1,9 @@
/*
* Kernel CAPI 2.0 Module - /proc/capi handling
*
*
* Copyright 1999 by Carsten Paeth <calle@calle.de>
* Copyright 2002 by Kai Germaschewski <kai@germaschewski.name>
*
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
@ -29,7 +29,7 @@ static char *state2str(unsigned short state)
// /proc/capi
// ===========================================================================
// /proc/capi/controller:
// /proc/capi/controller:
// cnr driver cardstate name driverinfo
// /proc/capi/contrstats:
// cnr nrecvctlpkt nrecvdatapkt nsentctlpkt nsentdatapkt
@ -85,7 +85,7 @@ static int contrstats_show(struct seq_file *seq, void *v)
return 0;
seq_printf(seq, "%d %lu %lu %lu %lu\n",
ctr->cnr,
ctr->cnr,
ctr->nrecvctlpkt,
ctr->nrecvdatapkt,
ctr->nsentctlpkt,
@ -134,9 +134,9 @@ static const struct file_operations proc_contrstats_ops = {
.release = seq_release,
};
// /proc/capi/applications:
// /proc/capi/applications:
// applid l3cnt dblkcnt dblklen #ncci recvqueuelen
// /proc/capi/applstats:
// /proc/capi/applstats:
// applid nrecvctlpkt nrecvdatapkt nsentctlpkt nsentdatapkt
// ---------------------------------------------------------------------------
@ -297,7 +297,7 @@ static const struct file_operations proc_driver_ops = {
// ---------------------------------------------------------------------------
void __init
void __init
kcapi_proc_init(void)
{
proc_mkdir("capi", NULL);

View File

@ -3,7 +3,7 @@
* Module init for DSS1 diversion services for i4l.
*
* Copyright 1999 by Werner Cornelius (werner@isdn4linux.de)
*
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
@ -23,13 +23,13 @@ MODULE_LICENSE("GPL");
/* structure containing interface to hl */
/****************************************/
isdn_divert_if divert_if =
{ DIVERT_IF_MAGIC, /* magic value */
DIVERT_CMD_REG, /* register cmd */
ll_callback, /* callback routine from ll */
NULL, /* command still not specified */
NULL, /* drv_to_name */
NULL, /* name_to_drv */
};
{ DIVERT_IF_MAGIC, /* magic value */
DIVERT_CMD_REG, /* register cmd */
ll_callback, /* callback routine from ll */
NULL, /* command still not specified */
NULL, /* drv_to_name */
NULL, /* name_to_drv */
};
/*************************/
/* Module interface code */
@ -38,17 +38,17 @@ isdn_divert_if divert_if =
static int __init divert_init(void)
{ int i;
if (divert_dev_init())
{ printk(KERN_WARNING "dss1_divert: cannot install device, not loaded\n");
return(-EIO);
}
if ((i = DIVERT_REG_NAME(&divert_if)) != DIVERT_NO_ERR)
{ divert_dev_deinit();
printk(KERN_WARNING "dss1_divert: error %d registering module, not loaded\n",i);
return(-EIO);
}
printk(KERN_INFO "dss1_divert module successfully installed\n");
return(0);
if (divert_dev_init())
{ printk(KERN_WARNING "dss1_divert: cannot install device, not loaded\n");
return (-EIO);
}
if ((i = DIVERT_REG_NAME(&divert_if)) != DIVERT_NO_ERR)
{ divert_dev_deinit();
printk(KERN_WARNING "dss1_divert: error %d registering module, not loaded\n", i);
return (-EIO);
}
printk(KERN_INFO "dss1_divert module successfully installed\n");
return (0);
}
/**********************/
@ -56,27 +56,26 @@ static int __init divert_init(void)
/**********************/
static void __exit divert_exit(void)
{
unsigned long flags;
int i;
unsigned long flags;
int i;
spin_lock_irqsave(&divert_lock, flags);
divert_if.cmd = DIVERT_CMD_REL; /* release */
if ((i = DIVERT_REG_NAME(&divert_if)) != DIVERT_NO_ERR)
{ printk(KERN_WARNING "dss1_divert: error %d releasing module\n",i);
spin_unlock_irqrestore(&divert_lock, flags);
return;
}
if (divert_dev_deinit())
{ printk(KERN_WARNING "dss1_divert: device busy, remove cancelled\n");
spin_unlock_irqrestore(&divert_lock, flags);
return;
}
spin_unlock_irqrestore(&divert_lock, flags);
deleterule(-1); /* delete all rules and free mem */
deleteprocs();
printk(KERN_INFO "dss1_divert module successfully removed \n");
spin_lock_irqsave(&divert_lock, flags);
divert_if.cmd = DIVERT_CMD_REL; /* release */
if ((i = DIVERT_REG_NAME(&divert_if)) != DIVERT_NO_ERR)
{ printk(KERN_WARNING "dss1_divert: error %d releasing module\n", i);
spin_unlock_irqrestore(&divert_lock, flags);
return;
}
if (divert_dev_deinit())
{ printk(KERN_WARNING "dss1_divert: device busy, remove cancelled\n");
spin_unlock_irqrestore(&divert_lock, flags);
return;
}
spin_unlock_irqrestore(&divert_lock, flags);
deleterule(-1); /* delete all rules and free mem */
deleteprocs();
printk(KERN_INFO "dss1_divert module successfully removed \n");
}
module_init(divert_init);
module_exit(divert_exit);

View File

@ -50,10 +50,10 @@ put_info_buffer(char *cp)
if (!*cp)
return;
if (!(ib = kmalloc(sizeof(struct divert_info) + strlen(cp), GFP_ATOMIC)))
return; /* no memory */
return; /* no memory */
strcpy(ib->info_start, cp); /* set output string */
ib->next = NULL;
spin_lock_irqsave( &divert_info_lock, flags );
spin_lock_irqsave(&divert_info_lock, flags);
ib->usage_cnt = if_used;
if (!divert_info_head)
divert_info_head = ib; /* new head */
@ -71,7 +71,7 @@ put_info_buffer(char *cp)
} else
break;
} /* divert_info_head->next */
spin_unlock_irqrestore( &divert_info_lock, flags );
spin_unlock_irqrestore(&divert_info_lock, flags);
wake_up_interruptible(&(rd_queue));
} /* put_info_buffer */
@ -81,7 +81,7 @@ put_info_buffer(char *cp)
/* deflection device read routine */
/**********************************/
static ssize_t
isdn_divert_read(struct file *file, char __user *buf, size_t count, loff_t * off)
isdn_divert_read(struct file *file, char __user *buf, size_t count, loff_t *off)
{
struct divert_info *inf;
int len;
@ -109,7 +109,7 @@ isdn_divert_read(struct file *file, char __user *buf, size_t count, loff_t * off
/* deflection device write routine */
/**********************************/
static ssize_t
isdn_divert_write(struct file *file, const char __user *buf, size_t count, loff_t * off)
isdn_divert_write(struct file *file, const char __user *buf, size_t count, loff_t *off)
{
return (-ENODEV);
} /* isdn_divert_write */
@ -119,7 +119,7 @@ isdn_divert_write(struct file *file, const char __user *buf, size_t count, loff_
/* select routines for various kernels */
/***************************************/
static unsigned int
isdn_divert_poll(struct file *file, poll_table * wait)
isdn_divert_poll(struct file *file, poll_table *wait)
{
unsigned int mask = 0;
@ -139,13 +139,13 @@ isdn_divert_open(struct inode *ino, struct file *filep)
{
unsigned long flags;
spin_lock_irqsave( &divert_info_lock, flags );
if_used++;
spin_lock_irqsave(&divert_info_lock, flags);
if_used++;
if (divert_info_head)
filep->private_data = &(divert_info_tail->next);
else
filep->private_data = &divert_info_head;
spin_unlock_irqrestore( &divert_info_lock, flags );
spin_unlock_irqrestore(&divert_info_lock, flags);
/* start_divert(); */
return nonseekable_open(ino, filep);
} /* isdn_divert_open */
@ -159,7 +159,7 @@ isdn_divert_close(struct inode *ino, struct file *filep)
struct divert_info *inf;
unsigned long flags;
spin_lock_irqsave( &divert_info_lock, flags );
spin_lock_irqsave(&divert_info_lock, flags);
if_used--;
inf = *((struct divert_info **) filep->private_data);
while (inf) {
@ -172,7 +172,7 @@ isdn_divert_close(struct inode *ino, struct file *filep)
divert_info_head = divert_info_head->next;
kfree(inf);
}
spin_unlock_irqrestore( &divert_info_lock, flags );
spin_unlock_irqrestore(&divert_info_lock, flags);
return (0);
} /* isdn_divert_close */
@ -191,75 +191,75 @@ static int isdn_divert_ioctl_unlocked(struct file *file, uint cmd, ulong arg)
return -EFAULT;
switch (cmd) {
case IIOCGETVER:
dioctl.drv_version = DIVERT_IIOC_VERSION; /* set version */
break;
case IIOCGETVER:
dioctl.drv_version = DIVERT_IIOC_VERSION; /* set version */
break;
case IIOCGETDRV:
if ((dioctl.getid.drvid = divert_if.name_to_drv(dioctl.getid.drvnam)) < 0)
return (-EINVAL);
break;
case IIOCGETNAM:
cp = divert_if.drv_to_name(dioctl.getid.drvid);
if (!cp)
return (-EINVAL);
if (!*cp)
return (-EINVAL);
strcpy(dioctl.getid.drvnam, cp);
break;
case IIOCGETRULE:
if (!(rulep = getruleptr(dioctl.getsetrule.ruleidx)))
return (-EINVAL);
dioctl.getsetrule.rule = *rulep; /* copy data */
break;
case IIOCMODRULE:
if (!(rulep = getruleptr(dioctl.getsetrule.ruleidx)))
return (-EINVAL);
spin_lock_irqsave(&divert_lock, flags);
*rulep = dioctl.getsetrule.rule; /* copy data */
spin_unlock_irqrestore(&divert_lock, flags);
return (0); /* no copy required */
break;
case IIOCINSRULE:
return (insertrule(dioctl.getsetrule.ruleidx, &dioctl.getsetrule.rule));
break;
case IIOCDELRULE:
return (deleterule(dioctl.getsetrule.ruleidx));
break;
case IIOCDODFACT:
return (deflect_extern_action(dioctl.fwd_ctrl.subcmd,
dioctl.fwd_ctrl.callid,
dioctl.fwd_ctrl.to_nr));
case IIOCDOCFACT:
case IIOCDOCFDIS:
case IIOCDOCFINT:
if (!divert_if.drv_to_name(dioctl.cf_ctrl.drvid))
return (-EINVAL); /* invalid driver */
if (strnlen(dioctl.cf_ctrl.msn, sizeof(dioctl.cf_ctrl.msn)) ==
sizeof(dioctl.cf_ctrl.msn))
return -EINVAL;
if (strnlen(dioctl.cf_ctrl.fwd_nr, sizeof(dioctl.cf_ctrl.fwd_nr)) ==
sizeof(dioctl.cf_ctrl.fwd_nr))
return -EINVAL;
if ((i = cf_command(dioctl.cf_ctrl.drvid,
(cmd == IIOCDOCFACT) ? 1 : (cmd == IIOCDOCFDIS) ? 0 : 2,
dioctl.cf_ctrl.cfproc,
dioctl.cf_ctrl.msn,
dioctl.cf_ctrl.service,
dioctl.cf_ctrl.fwd_nr,
&dioctl.cf_ctrl.procid)))
return (i);
break;
default:
case IIOCGETDRV:
if ((dioctl.getid.drvid = divert_if.name_to_drv(dioctl.getid.drvnam)) < 0)
return (-EINVAL);
break;
case IIOCGETNAM:
cp = divert_if.drv_to_name(dioctl.getid.drvid);
if (!cp)
return (-EINVAL);
if (!*cp)
return (-EINVAL);
strcpy(dioctl.getid.drvnam, cp);
break;
case IIOCGETRULE:
if (!(rulep = getruleptr(dioctl.getsetrule.ruleidx)))
return (-EINVAL);
dioctl.getsetrule.rule = *rulep; /* copy data */
break;
case IIOCMODRULE:
if (!(rulep = getruleptr(dioctl.getsetrule.ruleidx)))
return (-EINVAL);
spin_lock_irqsave(&divert_lock, flags);
*rulep = dioctl.getsetrule.rule; /* copy data */
spin_unlock_irqrestore(&divert_lock, flags);
return (0); /* no copy required */
break;
case IIOCINSRULE:
return (insertrule(dioctl.getsetrule.ruleidx, &dioctl.getsetrule.rule));
break;
case IIOCDELRULE:
return (deleterule(dioctl.getsetrule.ruleidx));
break;
case IIOCDODFACT:
return (deflect_extern_action(dioctl.fwd_ctrl.subcmd,
dioctl.fwd_ctrl.callid,
dioctl.fwd_ctrl.to_nr));
case IIOCDOCFACT:
case IIOCDOCFDIS:
case IIOCDOCFINT:
if (!divert_if.drv_to_name(dioctl.cf_ctrl.drvid))
return (-EINVAL); /* invalid driver */
if (strnlen(dioctl.cf_ctrl.msn, sizeof(dioctl.cf_ctrl.msn)) ==
sizeof(dioctl.cf_ctrl.msn))
return -EINVAL;
if (strnlen(dioctl.cf_ctrl.fwd_nr, sizeof(dioctl.cf_ctrl.fwd_nr)) ==
sizeof(dioctl.cf_ctrl.fwd_nr))
return -EINVAL;
if ((i = cf_command(dioctl.cf_ctrl.drvid,
(cmd == IIOCDOCFACT) ? 1 : (cmd == IIOCDOCFDIS) ? 0 : 2,
dioctl.cf_ctrl.cfproc,
dioctl.cf_ctrl.msn,
dioctl.cf_ctrl.service,
dioctl.cf_ctrl.fwd_nr,
&dioctl.cf_ctrl.procid)))
return (i);
break;
default:
return (-EINVAL);
} /* switch cmd */
return copy_to_user((void __user *)arg, &dioctl, sizeof(dioctl)) ? -EFAULT : 0;
} /* isdn_divert_ioctl */
@ -284,7 +284,7 @@ static const struct file_operations isdn_fops =
.poll = isdn_divert_poll,
.unlocked_ioctl = isdn_divert_ioctl,
.open = isdn_divert_open,
.release = isdn_divert_close,
.release = isdn_divert_close,
};
/****************************/

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
* Header for the diversion supplementary ioctl interface.
*
* Copyright 1998 by Werner Cornelius (werner@ikt.de)
*
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
@ -20,13 +20,13 @@
#define IIOCGETDRV _IO('I', 2) /* get driver number */
#define IIOCGETNAM _IO('I', 3) /* get driver name */
#define IIOCGETRULE _IO('I', 4) /* read one rule */
#define IIOCMODRULE _IO('I', 5) /* modify/replace a rule */
#define IIOCMODRULE _IO('I', 5) /* modify/replace a rule */
#define IIOCINSRULE _IO('I', 6) /* insert/append one rule */
#define IIOCDELRULE _IO('I', 7) /* delete a rule */
#define IIOCDODFACT _IO('I', 8) /* hangup/reject/alert/immediately deflect a call */
#define IIOCDOCFACT _IO('I', 9) /* activate control forwarding in PBX */
#define IIOCDOCFDIS _IO('I',10) /* deactivate control forwarding in PBX */
#define IIOCDOCFINT _IO('I',11) /* interrogate control forwarding in PBX */
#define IIOCDOCFDIS _IO('I', 10) /* deactivate control forwarding in PBX */
#define IIOCDOCFINT _IO('I', 11) /* interrogate control forwarding in PBX */
/*************************************/
/* states reported through interface */
@ -34,65 +34,65 @@
#define DEFLECT_IGNORE 0 /* ignore incoming call */
#define DEFLECT_REPORT 1 /* only report */
#define DEFLECT_PROCEED 2 /* deflect when externally triggered */
#define DEFLECT_ALERT 3 /* alert and deflect after delay */
#define DEFLECT_ALERT 3 /* alert and deflect after delay */
#define DEFLECT_REJECT 4 /* reject immediately */
#define DIVERT_ACTIVATE 5 /* diversion activate */
#define DIVERT_DEACTIVATE 6 /* diversion deactivate */
#define DIVERT_REPORT 7 /* interrogation result */
#define DEFLECT_AUTODEL 255 /* only for internal use */
#define DIVERT_REPORT 7 /* interrogation result */
#define DEFLECT_AUTODEL 255 /* only for internal use */
#define DEFLECT_ALL_IDS 0xFFFFFFFF /* all drivers selected */
typedef struct
{ ulong drvid; /* driver ids, bit mapped */
char my_msn[35]; /* desired msn, subaddr allowed */
char caller[35]; /* caller id, partial string with * + subaddr allowed */
char to_nr[35]; /* deflected to number incl. subaddress */
u_char si1,si2; /* service indicators, si1=bitmask, si1+2 0 = all */
u_char screen; /* screening: 0 = no info, 1 = info, 2 = nfo with nr */
u_char callopt; /* option for call handling:
0 = all calls
1 = only non waiting calls
2 = only waiting calls */
u_char action; /* desired action:
0 = don't report call -> ignore
1 = report call, do not allow/proceed for deflection
2 = report call, send proceed, wait max waittime secs
3 = report call, alert and deflect after waittime
4 = report call, reject immediately
actions 1-2 only take place if interface is opened
*/
u_char waittime; /* maximum wait time for proceeding */
} divert_rule;
{ ulong drvid; /* driver ids, bit mapped */
char my_msn[35]; /* desired msn, subaddr allowed */
char caller[35]; /* caller id, partial string with * + subaddr allowed */
char to_nr[35]; /* deflected to number incl. subaddress */
u_char si1, si2; /* service indicators, si1=bitmask, si1+2 0 = all */
u_char screen; /* screening: 0 = no info, 1 = info, 2 = nfo with nr */
u_char callopt; /* option for call handling:
0 = all calls
1 = only non waiting calls
2 = only waiting calls */
u_char action; /* desired action:
0 = don't report call -> ignore
1 = report call, do not allow/proceed for deflection
2 = report call, send proceed, wait max waittime secs
3 = report call, alert and deflect after waittime
4 = report call, reject immediately
actions 1-2 only take place if interface is opened
*/
u_char waittime; /* maximum wait time for proceeding */
} divert_rule;
typedef union
{ int drv_version; /* return of driver version */
struct
{ int drvid; /* id of driver */
char drvnam[30]; /* name of driver */
} getid;
struct
{ int ruleidx; /* index of rule */
divert_rule rule; /* rule parms */
} getsetrule;
struct
{ u_char subcmd; /* 0 = hangup/reject,
1 = alert,
2 = deflect */
ulong callid; /* id of call delivered by ascii output */
char to_nr[35]; /* destination when deflect,
else uus1 string (maxlen 31),
data from rule used if empty */
} fwd_ctrl;
struct
{ int drvid; /* id of driver */
u_char cfproc; /* cfu = 0, cfb = 1, cfnr = 2 */
ulong procid; /* process id returned when no error */
u_char service; /* basically coded service, 0 = all */
char msn[25]; /* desired msn, empty = all */
char fwd_nr[35];/* forwarded to number + subaddress */
} cf_ctrl;
} divert_ioctl;
{ int drv_version; /* return of driver version */
struct
{ int drvid; /* id of driver */
char drvnam[30]; /* name of driver */
} getid;
struct
{ int ruleidx; /* index of rule */
divert_rule rule; /* rule parms */
} getsetrule;
struct
{ u_char subcmd; /* 0 = hangup/reject,
1 = alert,
2 = deflect */
ulong callid; /* id of call delivered by ascii output */
char to_nr[35]; /* destination when deflect,
else uus1 string (maxlen 31),
data from rule used if empty */
} fwd_ctrl;
struct
{ int drvid; /* id of driver */
u_char cfproc; /* cfu = 0, cfb = 1, cfnr = 2 */
ulong procid; /* process id returned when no error */
u_char service; /* basically coded service, 0 = all */
char msn[25]; /* desired msn, empty = all */
char fwd_nr[35];/* forwarded to number + subaddress */
} cf_ctrl;
} divert_ioctl;
#ifdef __KERNEL__
@ -105,10 +105,10 @@ typedef union
/* structure keeping ascii info for device output */
/**************************************************/
struct divert_info
{ struct divert_info *next;
ulong usage_cnt; /* number of files still to work */
char info_start[2]; /* info string start */
};
{ struct divert_info *next;
ulong usage_cnt; /* number of files still to work */
char info_start[2]; /* info string start */
};
/**************/

View File

@ -214,7 +214,7 @@ byte_stuff:
} else if (fcs != PPP_GOODFCS) {
/* frame check error */
dev_err(cs->dev,
"Checksum failed, %u bytes corrupted!\n",
"Checksum failed, %u bytes corrupted!\n",
skb->len);
gigaset_isdn_rcv_err(bcs);
dev_kfree_skb_any(skb);
@ -543,7 +543,7 @@ static struct sk_buff *iraw_encode(struct sk_buff *skb)
/* size of new buffer (worst case = every byte must be stuffed):
* 2 * original size + room for link layer header
*/
iraw_skb = dev_alloc_skb(2*skb->len + skb->mac_len);
iraw_skb = dev_alloc_skb(2 * skb->len + skb->mac_len);
if (!iraw_skb) {
dev_kfree_skb_any(skb);
return NULL;

View File

@ -410,10 +410,10 @@ static void check_pending(struct bas_cardstate *ucs)
if (!(ucs->basstate & BS_RESETTING))
ucs->pending = 0;
break;
/*
* HD_READ_ATMESSAGE and HD_WRITE_ATMESSAGE are handled separately
* and should never end up here
*/
/*
* HD_READ_ATMESSAGE and HD_WRITE_ATMESSAGE are handled separately
* and should never end up here
*/
default:
dev_warn(&ucs->interface->dev,
"unknown pending request 0x%02x cleared\n",
@ -491,7 +491,7 @@ static void read_ctrl_callback(struct urb *urb)
numbytes = urb->actual_length;
if (unlikely(numbytes != ucs->rcvbuf_size)) {
dev_warn(cs->dev,
"control read: received %d chars, expected %d\n",
"control read: received %d chars, expected %d\n",
numbytes, ucs->rcvbuf_size);
if (numbytes > ucs->rcvbuf_size)
numbytes = ucs->rcvbuf_size;
@ -710,7 +710,7 @@ static void read_int_callback(struct urb *urb)
}
l = (unsigned) ucs->int_in_buf[1] +
(((unsigned) ucs->int_in_buf[2]) << 8);
(((unsigned) ucs->int_in_buf[2]) << 8);
gig_dbg(DEBUG_USBREQ, "<-------%d: 0x%02x (%u [0x%02x 0x%02x])",
urb->actual_length, (int)ucs->int_in_buf[0], l,
@ -770,14 +770,14 @@ static void read_int_callback(struct urb *urb)
case HD_RECEIVEATDATA_ACK: /* AT response ready to be received */
if (!l) {
dev_warn(cs->dev,
"HD_RECEIVEATDATA_ACK with length 0 ignored\n");
"HD_RECEIVEATDATA_ACK with length 0 ignored\n");
break;
}
spin_lock_irqsave(&cs->lock, flags);
if (ucs->basstate & BS_ATRDPEND) {
spin_unlock_irqrestore(&cs->lock, flags);
dev_warn(cs->dev,
"HD_RECEIVEATDATA_ACK(%d) during HD_READ_ATMESSAGE(%d) ignored\n",
"HD_RECEIVEATDATA_ACK(%d) during HD_READ_ATMESSAGE(%d) ignored\n",
l, ucs->rcvbuf_size);
break;
}
@ -878,7 +878,7 @@ static void read_iso_callback(struct urb *urb)
ubc->isoinlost += urb->iso_frame_desc[i].actual_length;
if (unlikely(urb->iso_frame_desc[i].status != 0 &&
urb->iso_frame_desc[i].status !=
-EINPROGRESS))
-EINPROGRESS))
ubc->loststatus = urb->iso_frame_desc[i].status;
urb->iso_frame_desc[i].status = 0;
urb->iso_frame_desc[i].actual_length = 0;
@ -891,7 +891,7 @@ static void read_iso_callback(struct urb *urb)
rc = usb_submit_urb(urb, GFP_ATOMIC);
if (unlikely(rc != 0 && rc != -ENODEV)) {
dev_err(bcs->cs->dev,
"could not resubmit isoc read URB: %s\n",
"could not resubmit isoc read URB: %s\n",
get_usb_rcmsg(rc));
dump_urb(DEBUG_ISO, "isoc read", urb);
error_hangup(bcs);
@ -1017,17 +1017,17 @@ static int starturbs(struct bc_state *bcs)
}
/* keep one URB free, submit the others */
for (k = 0; k < BAS_OUTURBS-1; ++k) {
for (k = 0; k < BAS_OUTURBS - 1; ++k) {
dump_urb(DEBUG_ISO, "Initial isoc write", urb);
rc = usb_submit_urb(ubc->isoouturbs[k].urb, GFP_ATOMIC);
if (rc != 0)
goto error;
}
dump_urb(DEBUG_ISO, "Initial isoc write (free)", urb);
ubc->isooutfree = &ubc->isoouturbs[BAS_OUTURBS-1];
ubc->isooutfree = &ubc->isoouturbs[BAS_OUTURBS - 1];
ubc->isooutdone = ubc->isooutovfl = NULL;
return 0;
error:
error:
stopurbs(ubc);
return rc;
}
@ -1229,7 +1229,7 @@ static void write_iso_tasklet(unsigned long data)
if (ifd->status ||
ifd->actual_length != ifd->length) {
dev_warn(cs->dev,
"isoc write: frame %d[%d/%d]: %s\n",
"isoc write: frame %d[%d/%d]: %s\n",
i, ifd->actual_length,
ifd->length,
get_usb_statmsg(ifd->status));
@ -1316,7 +1316,7 @@ static void read_iso_tasklet(unsigned long data)
ubc->isoindone = NULL;
if (unlikely(ubc->loststatus != -EINPROGRESS)) {
dev_warn(cs->dev,
"isoc read overrun, URB dropped (status: %s, %d bytes)\n",
"isoc read overrun, URB dropped (status: %s, %d bytes)\n",
get_usb_statmsg(ubc->loststatus),
ubc->isoinlost);
ubc->loststatus = -EINPROGRESS;
@ -1965,7 +1965,7 @@ static int gigaset_write_cmd(struct cardstate *cs, struct cmdbuf_t *cb)
int rc;
gigaset_dbg_buffer(cs->mstate != MS_LOCKED ?
DEBUG_TRANSCMD : DEBUG_LOCKCMD,
DEBUG_TRANSCMD : DEBUG_LOCKCMD,
"CMD Transmit", cb->len, cb->buf);
/* translate "+++" escape sequence sent as a single separate command
@ -2453,13 +2453,13 @@ static int gigaset_suspend(struct usb_interface *intf, pm_message_t message)
/* wait a bit for blocking conditions to go away */
rc = wait_event_timeout(ucs->waitqueue,
!(ucs->basstate &
(BS_B1OPEN|BS_B2OPEN|BS_ATRDPEND|BS_ATWRPEND)),
BAS_TIMEOUT*HZ/10);
!(ucs->basstate &
(BS_B1OPEN | BS_B2OPEN | BS_ATRDPEND | BS_ATWRPEND)),
BAS_TIMEOUT * HZ / 10);
gig_dbg(DEBUG_SUSPEND, "wait_event_timeout() -> %d", rc);
/* check for conditions preventing suspend */
if (ucs->basstate & (BS_B1OPEN|BS_B2OPEN|BS_ATRDPEND|BS_ATWRPEND)) {
if (ucs->basstate & (BS_B1OPEN | BS_B2OPEN | BS_ATRDPEND | BS_ATWRPEND)) {
dev_warn(cs->dev, "cannot suspend:\n");
if (ucs->basstate & BS_B1OPEN)
dev_warn(cs->dev, " B channel 1 open\n");
@ -2482,7 +2482,7 @@ static int gigaset_suspend(struct usb_interface *intf, pm_message_t message)
return rc;
}
wait_event_timeout(ucs->waitqueue, !ucs->pending,
BAS_TIMEOUT*HZ/10);
BAS_TIMEOUT * HZ / 10);
/* in case of timeout, proceed anyway */
}

View File

@ -26,17 +26,17 @@
#define CapiFacilitySpecificFunctionNotSupported 0x3011
/* missing from capicmd.h */
#define CAPI_CONNECT_IND_BASELEN (CAPI_MSG_BASELEN+4+2+8*1)
#define CAPI_CONNECT_ACTIVE_IND_BASELEN (CAPI_MSG_BASELEN+4+3*1)
#define CAPI_CONNECT_B3_IND_BASELEN (CAPI_MSG_BASELEN+4+1)
#define CAPI_CONNECT_B3_ACTIVE_IND_BASELEN (CAPI_MSG_BASELEN+4+1)
#define CAPI_DATA_B3_REQ_LEN64 (CAPI_MSG_BASELEN+4+4+2+2+2+8)
#define CAPI_DATA_B3_CONF_LEN (CAPI_MSG_BASELEN+4+2+2)
#define CAPI_DISCONNECT_IND_LEN (CAPI_MSG_BASELEN+4+2)
#define CAPI_DISCONNECT_B3_IND_BASELEN (CAPI_MSG_BASELEN+4+2+1)
#define CAPI_FACILITY_CONF_BASELEN (CAPI_MSG_BASELEN+4+2+2+1)
#define CAPI_CONNECT_IND_BASELEN (CAPI_MSG_BASELEN + 4 + 2 + 8 * 1)
#define CAPI_CONNECT_ACTIVE_IND_BASELEN (CAPI_MSG_BASELEN + 4 + 3 * 1)
#define CAPI_CONNECT_B3_IND_BASELEN (CAPI_MSG_BASELEN + 4 + 1)
#define CAPI_CONNECT_B3_ACTIVE_IND_BASELEN (CAPI_MSG_BASELEN + 4 + 1)
#define CAPI_DATA_B3_REQ_LEN64 (CAPI_MSG_BASELEN + 4 + 4 + 2 + 2 + 2 + 8)
#define CAPI_DATA_B3_CONF_LEN (CAPI_MSG_BASELEN + 4 + 2 + 2)
#define CAPI_DISCONNECT_IND_LEN (CAPI_MSG_BASELEN + 4 + 2)
#define CAPI_DISCONNECT_B3_IND_BASELEN (CAPI_MSG_BASELEN + 4 + 2 + 1)
#define CAPI_FACILITY_CONF_BASELEN (CAPI_MSG_BASELEN + 4 + 2 + 2 + 1)
/* most _CONF messages contain only Controller/PLCI/NCCI and Info parameters */
#define CAPI_STDCONF_LEN (CAPI_MSG_BASELEN+4+2)
#define CAPI_STDCONF_LEN (CAPI_MSG_BASELEN + 4 + 2)
#define CAPI_FACILITY_HANDSET 0x0000
#define CAPI_FACILITY_DTMF 0x0001
@ -97,10 +97,10 @@ struct gigaset_capi_ctr {
/* two _cmsg structures possibly used concurrently: */
_cmsg hcmsg; /* for message composition triggered from hardware */
_cmsg acmsg; /* for dissection of messages sent from application */
u8 bc_buf[MAX_BC_OCTETS+1];
u8 hlc_buf[MAX_HLC_OCTETS+1];
u8 cgpty_buf[MAX_NUMBER_DIGITS+3];
u8 cdpty_buf[MAX_NUMBER_DIGITS+2];
u8 bc_buf[MAX_BC_OCTETS + 1];
u8 hlc_buf[MAX_HLC_OCTETS + 1];
u8 cgpty_buf[MAX_NUMBER_DIGITS + 3];
u8 cdpty_buf[MAX_NUMBER_DIGITS + 2];
};
/* CIP Value table (from CAPI 2.0 standard, ch. 6.1) */
@ -109,50 +109,50 @@ static struct {
u8 *hlc;
} cip2bchlc[] = {
[1] = { "8090A3", NULL },
/* Speech (A-law) */
/* Speech (A-law) */
[2] = { "8890", NULL },
/* Unrestricted digital information */
/* Unrestricted digital information */
[3] = { "8990", NULL },
/* Restricted digital information */
/* Restricted digital information */
[4] = { "9090A3", NULL },
/* 3,1 kHz audio (A-law) */
/* 3,1 kHz audio (A-law) */
[5] = { "9190", NULL },
/* 7 kHz audio */
/* 7 kHz audio */
[6] = { "9890", NULL },
/* Video */
/* Video */
[7] = { "88C0C6E6", NULL },
/* Packet mode */
/* Packet mode */
[8] = { "8890218F", NULL },
/* 56 kbit/s rate adaptation */
/* 56 kbit/s rate adaptation */
[9] = { "9190A5", NULL },
/* Unrestricted digital information with tones/announcements */
/* Unrestricted digital information with tones/announcements */
[16] = { "8090A3", "9181" },
/* Telephony */
/* Telephony */
[17] = { "9090A3", "9184" },
/* Group 2/3 facsimile */
/* Group 2/3 facsimile */
[18] = { "8890", "91A1" },
/* Group 4 facsimile Class 1 */
/* Group 4 facsimile Class 1 */
[19] = { "8890", "91A4" },
/* Teletex service basic and mixed mode
and Group 4 facsimile service Classes II and III */
/* Teletex service basic and mixed mode
and Group 4 facsimile service Classes II and III */
[20] = { "8890", "91A8" },
/* Teletex service basic and processable mode */
/* Teletex service basic and processable mode */
[21] = { "8890", "91B1" },
/* Teletex service basic mode */
/* Teletex service basic mode */
[22] = { "8890", "91B2" },
/* International interworking for Videotex */
/* International interworking for Videotex */
[23] = { "8890", "91B5" },
/* Telex */
/* Telex */
[24] = { "8890", "91B8" },
/* Message Handling Systems in accordance with X.400 */
/* Message Handling Systems in accordance with X.400 */
[25] = { "8890", "91C1" },
/* OSI application in accordance with X.200 */
/* OSI application in accordance with X.200 */
[26] = { "9190A5", "9181" },
/* 7 kHz telephony */
/* 7 kHz telephony */
[27] = { "9190A5", "916001" },
/* Video telephony, first connection */
/* Video telephony, first connection */
[28] = { "8890", "916002" },
/* Video telephony, second connection */
/* Video telephony, second connection */
};
/*
@ -164,7 +164,7 @@ static struct {
* emit unsupported parameter warning
*/
static inline void ignore_cstruct_param(struct cardstate *cs, _cstruct param,
char *msgname, char *paramname)
char *msgname, char *paramname)
{
if (param && *param)
dev_warn(cs->dev, "%s: ignoring unsupported parameter: %s\n",
@ -259,15 +259,15 @@ static inline void dump_rawmsg(enum debuglevel level, const char *tag,
CAPIMSG_APPID(data), CAPIMSG_MSGID(data), l,
CAPIMSG_CONTROL(data));
l -= 12;
dbgline = kmalloc(3*l, GFP_ATOMIC);
dbgline = kmalloc(3 * l, GFP_ATOMIC);
if (!dbgline)
return;
for (i = 0; i < l; i++) {
dbgline[3*i] = hex_asc_hi(data[12+i]);
dbgline[3*i+1] = hex_asc_lo(data[12+i]);
dbgline[3*i+2] = ' ';
dbgline[3 * i] = hex_asc_hi(data[12 + i]);
dbgline[3 * i + 1] = hex_asc_lo(data[12 + i]);
dbgline[3 * i + 2] = ' ';
}
dbgline[3*l-1] = '\0';
dbgline[3 * l - 1] = '\0';
gig_dbg(level, " %s", dbgline);
kfree(dbgline);
if (CAPIMSG_COMMAND(data) == CAPI_DATA_B3 &&
@ -279,16 +279,16 @@ static inline void dump_rawmsg(enum debuglevel level, const char *tag,
return;
if (l > 64)
l = 64; /* arbitrary limit */
dbgline = kmalloc(3*l, GFP_ATOMIC);
dbgline = kmalloc(3 * l, GFP_ATOMIC);
if (!dbgline)
return;
data += CAPIMSG_LEN(data);
for (i = 0; i < l; i++) {
dbgline[3*i] = hex_asc_hi(data[i]);
dbgline[3*i+1] = hex_asc_lo(data[i]);
dbgline[3*i+2] = ' ';
dbgline[3 * i] = hex_asc_hi(data[i]);
dbgline[3 * i + 1] = hex_asc_lo(data[i]);
dbgline[3 * i + 2] = ' ';
}
dbgline[3*l-1] = '\0';
dbgline[3 * l - 1] = '\0';
gig_dbg(level, " %s", dbgline);
kfree(dbgline);
}
@ -301,7 +301,7 @@ static inline void dump_rawmsg(enum debuglevel level, const char *tag,
static const char *format_ie(const char *ie)
{
static char result[3*MAX_FMT_IE_LEN];
static char result[3 * MAX_FMT_IE_LEN];
int len, count;
char *pout = result;
@ -310,7 +310,7 @@ static const char *format_ie(const char *ie)
count = len = ie[0];
if (count > MAX_FMT_IE_LEN)
count = MAX_FMT_IE_LEN-1;
count = MAX_FMT_IE_LEN - 1;
while (count--) {
*pout++ = hex_asc_hi(*++ie);
*pout++ = hex_asc_lo(*ie);
@ -403,8 +403,8 @@ void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *dskb)
send_data_b3_conf(cs, &iif->ctr, ap->id, CAPIMSG_MSGID(req),
bcs->channel + 1, CAPIMSG_HANDLE_REQ(req),
(flags & ~CAPI_FLAGS_DELIVERY_CONFIRMATION) ?
CapiFlagsNotSupportedByProtocol :
CAPI_NOERROR);
CapiFlagsNotSupportedByProtocol :
CAPI_NOERROR);
}
EXPORT_SYMBOL_GPL(gigaset_skb_sent);
@ -589,7 +589,7 @@ int gigaset_isdn_icall(struct at_state_t *at_state)
}
iif->cdpty_buf[0] = i + 1;
iif->cdpty_buf[1] = 0x80; /* type / numbering plan unknown */
memcpy(iif->cdpty_buf+2, at_state->str_var[STR_ZCPN], i);
memcpy(iif->cdpty_buf + 2, at_state->str_var[STR_ZCPN], i);
iif->hcmsg.CalledPartyNumber = iif->cdpty_buf;
msgsize += iif->hcmsg.CalledPartyNumber[0];
}
@ -605,7 +605,7 @@ int gigaset_isdn_icall(struct at_state_t *at_state)
iif->cgpty_buf[0] = i + 2;
iif->cgpty_buf[1] = 0x00; /* type / numbering plan unknown */
iif->cgpty_buf[2] = 0x80; /* pres. allowed, not screened */
memcpy(iif->cgpty_buf+3, at_state->str_var[STR_NMBR], i);
memcpy(iif->cgpty_buf + 3, at_state->str_var[STR_NMBR], i);
iif->hcmsg.CallingPartyNumber = iif->cgpty_buf;
msgsize += iif->hcmsg.CallingPartyNumber[0];
}
@ -977,7 +977,7 @@ void gigaset_isdn_stop(struct cardstate *cs)
* register CAPI application
*/
static void gigaset_register_appl(struct capi_ctr *ctr, u16 appl,
capi_register_params *rp)
capi_register_params *rp)
{
struct gigaset_capi_ctr *iif
= container_of(ctr, struct gigaset_capi_ctr, ctr);
@ -1181,21 +1181,21 @@ static void do_facility_req(struct gigaset_capi_ctr *iif,
}
if (CAPIMSG_U32(pparam, 4) != 0) {
dev_notice(cs->dev,
"%s: unsupported supplementary service notification mask 0x%x\n",
"FACILITY_REQ", CAPIMSG_U32(pparam, 4));
"%s: unsupported supplementary service notification mask 0x%x\n",
"FACILITY_REQ", CAPIMSG_U32(pparam, 4));
info = CapiFacilitySpecificFunctionNotSupported;
confparam[3] = 2; /* length */
capimsg_setu16(confparam, 4,
CapiSupplementaryServiceNotSupported);
CapiSupplementaryServiceNotSupported);
}
info = CapiSuccess;
confparam[3] = 2; /* length */
capimsg_setu16(confparam, 4, CapiSuccess);
break;
/* ToDo: add supported services */
/* ToDo: add supported services */
default:
dev_notice(cs->dev,
"%s: unsupported supplementary service function 0x%04x\n",
"%s: unsupported supplementary service function 0x%04x\n",
"FACILITY_REQ", function);
info = CapiFacilitySpecificFunctionNotSupported;
/* Supplementary Service specific parameter */
@ -1318,7 +1318,7 @@ static void do_connect_req(struct gigaset_capi_ctr *iif,
cmsg->adr.adrPLCI |= (bcs->channel + 1) << 8;
/* build command table */
commands = kzalloc(AT_NUM*(sizeof *commands), GFP_KERNEL);
commands = kzalloc(AT_NUM * (sizeof *commands), GFP_KERNEL);
if (!commands)
goto oom;
@ -1353,10 +1353,10 @@ static void do_connect_req(struct gigaset_capi_ctr *iif,
commands[AT_TYPE] = kstrdup(s, GFP_KERNEL);
if (!commands[AT_TYPE])
goto oom;
commands[AT_DIAL] = kmalloc(l+3, GFP_KERNEL);
commands[AT_DIAL] = kmalloc(l + 3, GFP_KERNEL);
if (!commands[AT_DIAL])
goto oom;
snprintf(commands[AT_DIAL], l+3, "D%.*s\r", l, pp);
snprintf(commands[AT_DIAL], l + 3, "D%.*s\r", l, pp);
/* encode parameter: Calling party number */
pp = cmsg->CallingPartyNumber;
@ -1406,10 +1406,10 @@ static void do_connect_req(struct gigaset_capi_ctr *iif,
if (l) {
/* number */
commands[AT_MSN] = kmalloc(l+8, GFP_KERNEL);
commands[AT_MSN] = kmalloc(l + 8, GFP_KERNEL);
if (!commands[AT_MSN])
goto oom;
snprintf(commands[AT_MSN], l+8, "^SMSN=%*s\r", l, pp);
snprintf(commands[AT_MSN], l + 8, "^SMSN=%*s\r", l, pp);
}
}
@ -1430,13 +1430,13 @@ static void do_connect_req(struct gigaset_capi_ctr *iif,
/* determine lengths */
if (cmsg->BC && cmsg->BC[0]) /* BC specified explicitly */
lbc = 2*cmsg->BC[0];
lbc = 2 * cmsg->BC[0];
else if (cip2bchlc[cmsg->CIPValue].bc) /* BC derived from CIP */
lbc = strlen(cip2bchlc[cmsg->CIPValue].bc);
else /* no BC */
lbc = 0;
if (cmsg->HLC && cmsg->HLC[0]) /* HLC specified explicitly */
lhlc = 2*cmsg->HLC[0];
lhlc = 2 * cmsg->HLC[0];
else if (cip2bchlc[cmsg->CIPValue].hlc) /* HLC derived from CIP */
lhlc = strlen(cip2bchlc[cmsg->CIPValue].hlc);
else /* no HLC */
@ -1481,7 +1481,7 @@ static void do_connect_req(struct gigaset_capi_ctr *iif,
if (cmsg->BProtocol == CAPI_DEFAULT) {
bcs->proto2 = L2_HDLC;
dev_warn(cs->dev,
"B2 Protocol X.75 SLP unsupported, using Transparent\n");
"B2 Protocol X.75 SLP unsupported, using Transparent\n");
} else {
switch (cmsg->B1protocol) {
case 0:
@ -1492,24 +1492,24 @@ static void do_connect_req(struct gigaset_capi_ctr *iif,
break;
default:
dev_warn(cs->dev,
"B1 Protocol %u unsupported, using Transparent\n",
"B1 Protocol %u unsupported, using Transparent\n",
cmsg->B1protocol);
bcs->proto2 = L2_VOICE;
}
if (cmsg->B2protocol != 1)
dev_warn(cs->dev,
"B2 Protocol %u unsupported, using Transparent\n",
"B2 Protocol %u unsupported, using Transparent\n",
cmsg->B2protocol);
if (cmsg->B3protocol != 0)
dev_warn(cs->dev,
"B3 Protocol %u unsupported, using Transparent\n",
"B3 Protocol %u unsupported, using Transparent\n",
cmsg->B3protocol);
ignore_cstruct_param(cs, cmsg->B1configuration,
"CONNECT_REQ", "B1 Configuration");
"CONNECT_REQ", "B1 Configuration");
ignore_cstruct_param(cs, cmsg->B2configuration,
"CONNECT_REQ", "B2 Configuration");
"CONNECT_REQ", "B2 Configuration");
ignore_cstruct_param(cs, cmsg->B3configuration,
"CONNECT_REQ", "B3 Configuration");
"CONNECT_REQ", "B3 Configuration");
}
commands[AT_PROTO] = kmalloc(9, GFP_KERNEL);
if (!commands[AT_PROTO])
@ -1518,20 +1518,20 @@ static void do_connect_req(struct gigaset_capi_ctr *iif,
/* ToDo: check/encode remaining parameters */
ignore_cstruct_param(cs, cmsg->CalledPartySubaddress,
"CONNECT_REQ", "Called pty subaddr");
"CONNECT_REQ", "Called pty subaddr");
ignore_cstruct_param(cs, cmsg->CallingPartySubaddress,
"CONNECT_REQ", "Calling pty subaddr");
"CONNECT_REQ", "Calling pty subaddr");
ignore_cstruct_param(cs, cmsg->LLC,
"CONNECT_REQ", "LLC");
"CONNECT_REQ", "LLC");
if (cmsg->AdditionalInfo != CAPI_DEFAULT) {
ignore_cstruct_param(cs, cmsg->BChannelinformation,
"CONNECT_REQ", "B Channel Information");
"CONNECT_REQ", "B Channel Information");
ignore_cstruct_param(cs, cmsg->Keypadfacility,
"CONNECT_REQ", "Keypad Facility");
"CONNECT_REQ", "Keypad Facility");
ignore_cstruct_param(cs, cmsg->Useruserdata,
"CONNECT_REQ", "User-User Data");
"CONNECT_REQ", "User-User Data");
ignore_cstruct_param(cs, cmsg->Facilitydataarray,
"CONNECT_REQ", "Facility Data Array");
"CONNECT_REQ", "Facility Data Array");
}
/* encode parameter: B channel to use */
@ -1602,7 +1602,7 @@ static void do_connect_resp(struct gigaset_capi_ctr *iif,
if (oap != ap) {
spin_unlock_irqrestore(&bcs->aplock, flags);
send_disconnect_ind(bcs, oap,
CapiCallGivenToOtherApplication);
CapiCallGivenToOtherApplication);
spin_lock_irqsave(&bcs->aplock, flags);
}
}
@ -1619,7 +1619,7 @@ static void do_connect_resp(struct gigaset_capi_ctr *iif,
if (cmsg->BProtocol == CAPI_DEFAULT) {
bcs->proto2 = L2_HDLC;
dev_warn(cs->dev,
"B2 Protocol X.75 SLP unsupported, using Transparent\n");
"B2 Protocol X.75 SLP unsupported, using Transparent\n");
} else {
switch (cmsg->B1protocol) {
case 0:
@ -1630,46 +1630,46 @@ static void do_connect_resp(struct gigaset_capi_ctr *iif,
break;
default:
dev_warn(cs->dev,
"B1 Protocol %u unsupported, using Transparent\n",
"B1 Protocol %u unsupported, using Transparent\n",
cmsg->B1protocol);
bcs->proto2 = L2_VOICE;
}
if (cmsg->B2protocol != 1)
dev_warn(cs->dev,
"B2 Protocol %u unsupported, using Transparent\n",
"B2 Protocol %u unsupported, using Transparent\n",
cmsg->B2protocol);
if (cmsg->B3protocol != 0)
dev_warn(cs->dev,
"B3 Protocol %u unsupported, using Transparent\n",
"B3 Protocol %u unsupported, using Transparent\n",
cmsg->B3protocol);
ignore_cstruct_param(cs, cmsg->B1configuration,
"CONNECT_RESP", "B1 Configuration");
"CONNECT_RESP", "B1 Configuration");
ignore_cstruct_param(cs, cmsg->B2configuration,
"CONNECT_RESP", "B2 Configuration");
"CONNECT_RESP", "B2 Configuration");
ignore_cstruct_param(cs, cmsg->B3configuration,
"CONNECT_RESP", "B3 Configuration");
"CONNECT_RESP", "B3 Configuration");
}
/* ToDo: check/encode remaining parameters */
ignore_cstruct_param(cs, cmsg->ConnectedNumber,
"CONNECT_RESP", "Connected Number");
"CONNECT_RESP", "Connected Number");
ignore_cstruct_param(cs, cmsg->ConnectedSubaddress,
"CONNECT_RESP", "Connected Subaddress");
"CONNECT_RESP", "Connected Subaddress");
ignore_cstruct_param(cs, cmsg->LLC,
"CONNECT_RESP", "LLC");
"CONNECT_RESP", "LLC");
if (cmsg->AdditionalInfo != CAPI_DEFAULT) {
ignore_cstruct_param(cs, cmsg->BChannelinformation,
"CONNECT_RESP", "BChannel Information");
"CONNECT_RESP", "BChannel Information");
ignore_cstruct_param(cs, cmsg->Keypadfacility,
"CONNECT_RESP", "Keypad Facility");
"CONNECT_RESP", "Keypad Facility");
ignore_cstruct_param(cs, cmsg->Useruserdata,
"CONNECT_RESP", "User-User Data");
"CONNECT_RESP", "User-User Data");
ignore_cstruct_param(cs, cmsg->Facilitydataarray,
"CONNECT_RESP", "Facility Data Array");
"CONNECT_RESP", "Facility Data Array");
}
/* Accept call */
if (!gigaset_add_event(cs, &cs->bcs[channel-1].at_state,
if (!gigaset_add_event(cs, &cs->bcs[channel - 1].at_state,
EV_ACCEPT, NULL, 0, NULL))
return;
gigaset_schedule_event(cs);
@ -1712,7 +1712,7 @@ static void do_connect_resp(struct gigaset_capi_ctr *iif,
if (oap != ap) {
spin_unlock_irqrestore(&bcs->aplock, flags);
send_disconnect_ind(bcs, oap,
CapiCallGivenToOtherApplication);
CapiCallGivenToOtherApplication);
spin_lock_irqsave(&bcs->aplock, flags);
}
}
@ -1723,7 +1723,7 @@ static void do_connect_resp(struct gigaset_capi_ctr *iif,
/* reject call - will trigger DISCONNECT_IND for this app */
dev_info(cs->dev, "%s: Reject=%x\n",
"CONNECT_RESP", cmsg->Reject);
if (!gigaset_add_event(cs, &cs->bcs[channel-1].at_state,
if (!gigaset_add_event(cs, &cs->bcs[channel - 1].at_state,
EV_HUP, NULL, 0, NULL))
return;
gigaset_schedule_event(cs);
@ -1756,7 +1756,7 @@ static void do_connect_b3_req(struct gigaset_capi_ctr *iif,
send_conf(iif, ap, skb, CapiIllContrPlciNcci);
return;
}
bcs = &cs->bcs[channel-1];
bcs = &cs->bcs[channel - 1];
/* mark logical connection active */
bcs->apconnstate = APCONN_ACTIVE;
@ -1767,7 +1767,7 @@ static void do_connect_b3_req(struct gigaset_capi_ctr *iif,
/* NCPI parameter: not applicable for B3 Transparent */
ignore_cstruct_param(cs, cmsg->NCPI, "CONNECT_B3_REQ", "NCPI");
send_conf(iif, ap, skb, (cmsg->NCPI && cmsg->NCPI[0]) ?
CapiNcpiNotSupportedByProtocol : CapiSuccess);
CapiNcpiNotSupportedByProtocol : CapiSuccess);
}
/*
@ -1801,7 +1801,7 @@ static void do_connect_b3_resp(struct gigaset_capi_ctr *iif,
dev_kfree_skb_any(skb);
return;
}
bcs = &cs->bcs[channel-1];
bcs = &cs->bcs[channel - 1];
if (cmsg->Reject) {
/* Reject: clear B3 connect received flag */
@ -1905,7 +1905,7 @@ static void do_disconnect_req(struct gigaset_capi_ctr *iif,
return;
}
capi_cmsg2message(b3cmsg,
__skb_put(b3skb, CAPI_DISCONNECT_B3_IND_BASELEN));
__skb_put(b3skb, CAPI_DISCONNECT_B3_IND_BASELEN));
kfree(b3cmsg);
capi_ctr_handle_message(&iif->ctr, ap->id, b3skb);
}
@ -1947,7 +1947,7 @@ static void do_disconnect_b3_req(struct gigaset_capi_ctr *iif,
send_conf(iif, ap, skb, CapiIllContrPlciNcci);
return;
}
bcs = &cs->bcs[channel-1];
bcs = &cs->bcs[channel - 1];
/* reject if logical connection not active */
if (bcs->apconnstate < APCONN_ACTIVE) {
@ -1965,9 +1965,9 @@ static void do_disconnect_b3_req(struct gigaset_capi_ctr *iif,
/* NCPI parameter: not applicable for B3 Transparent */
ignore_cstruct_param(cs, cmsg->NCPI,
"DISCONNECT_B3_REQ", "NCPI");
"DISCONNECT_B3_REQ", "NCPI");
send_conf(iif, ap, skb, (cmsg->NCPI && cmsg->NCPI[0]) ?
CapiNcpiNotSupportedByProtocol : CapiSuccess);
CapiNcpiNotSupportedByProtocol : CapiSuccess);
}
/*
@ -1997,7 +1997,7 @@ static void do_data_b3_req(struct gigaset_capi_ctr *iif,
send_conf(iif, ap, skb, CapiIllContrPlciNcci);
return;
}
bcs = &cs->bcs[channel-1];
bcs = &cs->bcs[channel - 1];
if (msglen != CAPI_DATA_B3_REQ_LEN && msglen != CAPI_DATA_B3_REQ_LEN64)
dev_notice(cs->dev, "%s: unexpected length %d\n",
"DATA_B3_REQ", msglen);
@ -2040,7 +2040,7 @@ static void do_data_b3_req(struct gigaset_capi_ctr *iif,
if (!(flags & CAPI_FLAGS_DELIVERY_CONFIRMATION))
send_data_b3_conf(cs, &iif->ctr, ap->id, msgid, channel, handle,
flags ? CapiFlagsNotSupportedByProtocol
: CAPI_NOERROR);
: CAPI_NOERROR);
}
/*
@ -2258,11 +2258,11 @@ static int gigaset_proc_show(struct seq_file *m, void *v)
seq_printf(m, "%-16s %s\n", "name", ctr->name);
seq_printf(m, "%-16s %s %s\n", "dev",
dev_driver_string(cs->dev), dev_name(cs->dev));
dev_driver_string(cs->dev), dev_name(cs->dev));
seq_printf(m, "%-16s %d\n", "id", cs->myid);
if (cs->gotfwver)
seq_printf(m, "%-16s %d.%d.%d.%d\n", "firmware",
cs->fwver[0], cs->fwver[1], cs->fwver[2], cs->fwver[3]);
cs->fwver[0], cs->fwver[1], cs->fwver[2], cs->fwver[3]);
seq_printf(m, "%-16s %d\n", "channels", cs->channels);
seq_printf(m, "%-16s %s\n", "onechannel", cs->onechannel ? "yes" : "no");
@ -2315,13 +2315,13 @@ static int gigaset_proc_show(struct seq_file *m, void *v)
for (i = 0; i < cs->channels; i++) {
seq_printf(m, "[%d]%-13s %d\n", i, "corrupted",
cs->bcs[i].corrupted);
cs->bcs[i].corrupted);
seq_printf(m, "[%d]%-13s %d\n", i, "trans_down",
cs->bcs[i].trans_down);
cs->bcs[i].trans_down);
seq_printf(m, "[%d]%-13s %d\n", i, "trans_up",
cs->bcs[i].trans_up);
cs->bcs[i].trans_up);
seq_printf(m, "[%d]%-13s %d\n", i, "chstate",
cs->bcs[i].chstate);
cs->bcs[i].chstate);
switch (cs->bcs[i].proto2) {
case L2_BITSYNC:
s = "bitsync";

View File

@ -30,7 +30,7 @@
/* Module parameters */
int gigaset_debuglevel;
EXPORT_SYMBOL_GPL(gigaset_debuglevel);
module_param_named(debug, gigaset_debuglevel, int, S_IRUGO|S_IWUSR);
module_param_named(debug, gigaset_debuglevel, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(debug, "debug level");
/* driver state flags */
@ -123,7 +123,7 @@ int gigaset_enterconfigmode(struct cardstate *cs)
if (r < 0)
goto error;
}
r = setflags(cs, TIOCM_RTS|TIOCM_DTR, 800);
r = setflags(cs, TIOCM_RTS | TIOCM_DTR, 800);
if (r < 0)
goto error;
@ -131,8 +131,8 @@ int gigaset_enterconfigmode(struct cardstate *cs)
error:
dev_err(cs->dev, "error %d on setuartbits\n", -r);
cs->control_state = TIOCM_RTS|TIOCM_DTR;
cs->ops->set_modem_ctrl(cs, 0, TIOCM_RTS|TIOCM_DTR);
cs->control_state = TIOCM_RTS | TIOCM_DTR;
cs->ops->set_modem_ctrl(cs, 0, TIOCM_RTS | TIOCM_DTR);
return -1;
}
@ -591,7 +591,7 @@ int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src,
if (head > tail)
n = head - 1 - tail;
else if (head == 0)
n = (RBUFSIZE-1) - tail;
n = (RBUFSIZE - 1) - tail;
else
n = RBUFSIZE - tail;
if (!n) {
@ -911,10 +911,10 @@ int gigaset_start(struct cardstate *cs)
spin_unlock_irqrestore(&cs->lock, flags);
if (cs->mstate != MS_LOCKED) {
cs->ops->set_modem_ctrl(cs, 0, TIOCM_DTR|TIOCM_RTS);
cs->ops->set_modem_ctrl(cs, 0, TIOCM_DTR | TIOCM_RTS);
cs->ops->baud_rate(cs, B115200);
cs->ops->set_line_ctrl(cs, CS8);
cs->control_state = TIOCM_DTR|TIOCM_RTS;
cs->control_state = TIOCM_DTR | TIOCM_RTS;
}
cs->waiting = 1;

View File

@ -153,104 +153,104 @@ struct reply_t gigaset_tab_nocid[] =
* action, command */
/* initialize device, set cid mode if possible */
{RSP_INIT, -1, -1, SEQ_INIT, 100, 1, {ACT_TIMEOUT} },
{RSP_INIT, -1, -1, SEQ_INIT, 100, 1, {ACT_TIMEOUT} },
{EV_TIMEOUT, 100, 100, -1, 101, 3, {0}, "Z\r"},
{RSP_OK, 101, 103, -1, 120, 5, {ACT_GETSTRING},
"+GMR\r"},
{EV_TIMEOUT, 100, 100, -1, 101, 3, {0}, "Z\r"},
{RSP_OK, 101, 103, -1, 120, 5, {ACT_GETSTRING},
"+GMR\r"},
{EV_TIMEOUT, 101, 101, -1, 102, 5, {0}, "Z\r"},
{RSP_ERROR, 101, 101, -1, 102, 5, {0}, "Z\r"},
{EV_TIMEOUT, 101, 101, -1, 102, 5, {0}, "Z\r"},
{RSP_ERROR, 101, 101, -1, 102, 5, {0}, "Z\r"},
{EV_TIMEOUT, 102, 102, -1, 108, 5, {ACT_SETDLE1},
"^SDLE=0\r"},
{RSP_OK, 108, 108, -1, 104, -1},
{RSP_ZDLE, 104, 104, 0, 103, 5, {0}, "Z\r"},
{EV_TIMEOUT, 104, 104, -1, 0, 0, {ACT_FAILINIT} },
{RSP_ERROR, 108, 108, -1, 0, 0, {ACT_FAILINIT} },
{EV_TIMEOUT, 102, 102, -1, 108, 5, {ACT_SETDLE1},
"^SDLE=0\r"},
{RSP_OK, 108, 108, -1, 104, -1},
{RSP_ZDLE, 104, 104, 0, 103, 5, {0}, "Z\r"},
{EV_TIMEOUT, 104, 104, -1, 0, 0, {ACT_FAILINIT} },
{RSP_ERROR, 108, 108, -1, 0, 0, {ACT_FAILINIT} },
{EV_TIMEOUT, 108, 108, -1, 105, 2, {ACT_SETDLE0,
ACT_HUPMODEM,
ACT_TIMEOUT} },
{EV_TIMEOUT, 105, 105, -1, 103, 5, {0}, "Z\r"},
{EV_TIMEOUT, 108, 108, -1, 105, 2, {ACT_SETDLE0,
ACT_HUPMODEM,
ACT_TIMEOUT} },
{EV_TIMEOUT, 105, 105, -1, 103, 5, {0}, "Z\r"},
{RSP_ERROR, 102, 102, -1, 107, 5, {0}, "^GETPRE\r"},
{RSP_OK, 107, 107, -1, 0, 0, {ACT_CONFIGMODE} },
{RSP_ERROR, 107, 107, -1, 0, 0, {ACT_FAILINIT} },
{EV_TIMEOUT, 107, 107, -1, 0, 0, {ACT_FAILINIT} },
{RSP_ERROR, 102, 102, -1, 107, 5, {0}, "^GETPRE\r"},
{RSP_OK, 107, 107, -1, 0, 0, {ACT_CONFIGMODE} },
{RSP_ERROR, 107, 107, -1, 0, 0, {ACT_FAILINIT} },
{EV_TIMEOUT, 107, 107, -1, 0, 0, {ACT_FAILINIT} },
{RSP_ERROR, 103, 103, -1, 0, 0, {ACT_FAILINIT} },
{EV_TIMEOUT, 103, 103, -1, 0, 0, {ACT_FAILINIT} },
{RSP_ERROR, 103, 103, -1, 0, 0, {ACT_FAILINIT} },
{EV_TIMEOUT, 103, 103, -1, 0, 0, {ACT_FAILINIT} },
{RSP_STRING, 120, 120, -1, 121, -1, {ACT_SETVER} },
{RSP_STRING, 120, 120, -1, 121, -1, {ACT_SETVER} },
{EV_TIMEOUT, 120, 121, -1, 0, 0, {ACT_FAILVER,
ACT_INIT} },
{RSP_ERROR, 120, 121, -1, 0, 0, {ACT_FAILVER,
ACT_INIT} },
{RSP_OK, 121, 121, -1, 0, 0, {ACT_GOTVER,
ACT_INIT} },
{EV_TIMEOUT, 120, 121, -1, 0, 0, {ACT_FAILVER,
ACT_INIT} },
{RSP_ERROR, 120, 121, -1, 0, 0, {ACT_FAILVER,
ACT_INIT} },
{RSP_OK, 121, 121, -1, 0, 0, {ACT_GOTVER,
ACT_INIT} },
/* leave dle mode */
{RSP_INIT, 0, 0, SEQ_DLE0, 201, 5, {0}, "^SDLE=0\r"},
{RSP_OK, 201, 201, -1, 202, -1},
{RSP_ZDLE, 202, 202, 0, 0, 0, {ACT_DLE0} },
{RSP_NODEV, 200, 249, -1, 0, 0, {ACT_FAKEDLE0} },
{RSP_ERROR, 200, 249, -1, 0, 0, {ACT_FAILDLE0} },
{EV_TIMEOUT, 200, 249, -1, 0, 0, {ACT_FAILDLE0} },
{RSP_INIT, 0, 0, SEQ_DLE0, 201, 5, {0}, "^SDLE=0\r"},
{RSP_OK, 201, 201, -1, 202, -1},
{RSP_ZDLE, 202, 202, 0, 0, 0, {ACT_DLE0} },
{RSP_NODEV, 200, 249, -1, 0, 0, {ACT_FAKEDLE0} },
{RSP_ERROR, 200, 249, -1, 0, 0, {ACT_FAILDLE0} },
{EV_TIMEOUT, 200, 249, -1, 0, 0, {ACT_FAILDLE0} },
/* enter dle mode */
{RSP_INIT, 0, 0, SEQ_DLE1, 251, 5, {0}, "^SDLE=1\r"},
{RSP_OK, 251, 251, -1, 252, -1},
{RSP_ZDLE, 252, 252, 1, 0, 0, {ACT_DLE1} },
{RSP_ERROR, 250, 299, -1, 0, 0, {ACT_FAILDLE1} },
{EV_TIMEOUT, 250, 299, -1, 0, 0, {ACT_FAILDLE1} },
{RSP_INIT, 0, 0, SEQ_DLE1, 251, 5, {0}, "^SDLE=1\r"},
{RSP_OK, 251, 251, -1, 252, -1},
{RSP_ZDLE, 252, 252, 1, 0, 0, {ACT_DLE1} },
{RSP_ERROR, 250, 299, -1, 0, 0, {ACT_FAILDLE1} },
{EV_TIMEOUT, 250, 299, -1, 0, 0, {ACT_FAILDLE1} },
/* incoming call */
{RSP_RING, -1, -1, -1, -1, -1, {ACT_RING} },
{RSP_RING, -1, -1, -1, -1, -1, {ACT_RING} },
/* get cid */
{RSP_INIT, 0, 0, SEQ_CID, 301, 5, {0}, "^SGCI?\r"},
{RSP_OK, 301, 301, -1, 302, -1},
{RSP_ZGCI, 302, 302, -1, 0, 0, {ACT_CID} },
{RSP_ERROR, 301, 349, -1, 0, 0, {ACT_FAILCID} },
{EV_TIMEOUT, 301, 349, -1, 0, 0, {ACT_FAILCID} },
{RSP_INIT, 0, 0, SEQ_CID, 301, 5, {0}, "^SGCI?\r"},
{RSP_OK, 301, 301, -1, 302, -1},
{RSP_ZGCI, 302, 302, -1, 0, 0, {ACT_CID} },
{RSP_ERROR, 301, 349, -1, 0, 0, {ACT_FAILCID} },
{EV_TIMEOUT, 301, 349, -1, 0, 0, {ACT_FAILCID} },
/* enter cid mode */
{RSP_INIT, 0, 0, SEQ_CIDMODE, 150, 5, {0}, "^SGCI=1\r"},
{RSP_OK, 150, 150, -1, 0, 0, {ACT_CMODESET} },
{RSP_ERROR, 150, 150, -1, 0, 0, {ACT_FAILCMODE} },
{EV_TIMEOUT, 150, 150, -1, 0, 0, {ACT_FAILCMODE} },
{RSP_INIT, 0, 0, SEQ_CIDMODE, 150, 5, {0}, "^SGCI=1\r"},
{RSP_OK, 150, 150, -1, 0, 0, {ACT_CMODESET} },
{RSP_ERROR, 150, 150, -1, 0, 0, {ACT_FAILCMODE} },
{EV_TIMEOUT, 150, 150, -1, 0, 0, {ACT_FAILCMODE} },
/* leave cid mode */
{RSP_INIT, 0, 0, SEQ_UMMODE, 160, 5, {0}, "Z\r"},
{RSP_OK, 160, 160, -1, 0, 0, {ACT_UMODESET} },
{RSP_ERROR, 160, 160, -1, 0, 0, {ACT_FAILUMODE} },
{EV_TIMEOUT, 160, 160, -1, 0, 0, {ACT_FAILUMODE} },
{RSP_INIT, 0, 0, SEQ_UMMODE, 160, 5, {0}, "Z\r"},
{RSP_OK, 160, 160, -1, 0, 0, {ACT_UMODESET} },
{RSP_ERROR, 160, 160, -1, 0, 0, {ACT_FAILUMODE} },
{EV_TIMEOUT, 160, 160, -1, 0, 0, {ACT_FAILUMODE} },
/* abort getting cid */
{RSP_INIT, 0, 0, SEQ_NOCID, 0, 0, {ACT_ABORTCID} },
{RSP_INIT, 0, 0, SEQ_NOCID, 0, 0, {ACT_ABORTCID} },
/* reset */
{RSP_INIT, 0, 0, SEQ_SHUTDOWN, 504, 5, {0}, "Z\r"},
{RSP_OK, 504, 504, -1, 0, 0, {ACT_SDOWN} },
{RSP_ERROR, 501, 599, -1, 0, 0, {ACT_FAILSDOWN} },
{EV_TIMEOUT, 501, 599, -1, 0, 0, {ACT_FAILSDOWN} },
{RSP_NODEV, 501, 599, -1, 0, 0, {ACT_FAKESDOWN} },
{RSP_INIT, 0, 0, SEQ_SHUTDOWN, 504, 5, {0}, "Z\r"},
{RSP_OK, 504, 504, -1, 0, 0, {ACT_SDOWN} },
{RSP_ERROR, 501, 599, -1, 0, 0, {ACT_FAILSDOWN} },
{EV_TIMEOUT, 501, 599, -1, 0, 0, {ACT_FAILSDOWN} },
{RSP_NODEV, 501, 599, -1, 0, 0, {ACT_FAKESDOWN} },
{EV_PROC_CIDMODE, -1, -1, -1, -1, -1, {ACT_PROC_CIDMODE} },
{EV_IF_LOCK, -1, -1, -1, -1, -1, {ACT_IF_LOCK} },
{EV_IF_VER, -1, -1, -1, -1, -1, {ACT_IF_VER} },
{EV_START, -1, -1, -1, -1, -1, {ACT_START} },
{EV_STOP, -1, -1, -1, -1, -1, {ACT_STOP} },
{EV_SHUTDOWN, -1, -1, -1, -1, -1, {ACT_SHUTDOWN} },
{EV_PROC_CIDMODE, -1, -1, -1, -1, -1, {ACT_PROC_CIDMODE} },
{EV_IF_LOCK, -1, -1, -1, -1, -1, {ACT_IF_LOCK} },
{EV_IF_VER, -1, -1, -1, -1, -1, {ACT_IF_VER} },
{EV_START, -1, -1, -1, -1, -1, {ACT_START} },
{EV_STOP, -1, -1, -1, -1, -1, {ACT_STOP} },
{EV_SHUTDOWN, -1, -1, -1, -1, -1, {ACT_SHUTDOWN} },
/* misc. */
{RSP_ERROR, -1, -1, -1, -1, -1, {ACT_ERROR} },
{RSP_ZCAU, -1, -1, -1, -1, -1, {ACT_ZCAU} },
{RSP_NONE, -1, -1, -1, -1, -1, {ACT_DEBUG} },
{RSP_ANY, -1, -1, -1, -1, -1, {ACT_WARN} },
{RSP_LAST}
{RSP_ERROR, -1, -1, -1, -1, -1, {ACT_ERROR} },
{RSP_ZCAU, -1, -1, -1, -1, -1, {ACT_ZCAU} },
{RSP_NONE, -1, -1, -1, -1, -1, {ACT_DEBUG} },
{RSP_ANY, -1, -1, -1, -1, -1, {ACT_WARN} },
{RSP_LAST}
};
/* 600: start dialing, 650: dial in progress, 800: connection is up, 700: ring,
@ -261,91 +261,91 @@ struct reply_t gigaset_tab_cid[] =
* action, command */
/* dial */
{EV_DIAL, -1, -1, -1, -1, -1, {ACT_DIAL} },
{RSP_INIT, 0, 0, SEQ_DIAL, 601, 5, {ACT_CMD+AT_BC} },
{RSP_OK, 601, 601, -1, 603, 5, {ACT_CMD+AT_PROTO} },
{RSP_OK, 603, 603, -1, 604, 5, {ACT_CMD+AT_TYPE} },
{RSP_OK, 604, 604, -1, 605, 5, {ACT_CMD+AT_MSN} },
{RSP_NULL, 605, 605, -1, 606, 5, {ACT_CMD+AT_CLIP} },
{RSP_OK, 605, 605, -1, 606, 5, {ACT_CMD+AT_CLIP} },
{RSP_NULL, 606, 606, -1, 607, 5, {ACT_CMD+AT_ISO} },
{RSP_OK, 606, 606, -1, 607, 5, {ACT_CMD+AT_ISO} },
{RSP_OK, 607, 607, -1, 608, 5, {0}, "+VLS=17\r"},
{RSP_OK, 608, 608, -1, 609, -1},
{RSP_ZSAU, 609, 609, ZSAU_PROCEEDING, 610, 5, {ACT_CMD+AT_DIAL} },
{RSP_OK, 610, 610, -1, 650, 0, {ACT_DIALING} },
{EV_DIAL, -1, -1, -1, -1, -1, {ACT_DIAL} },
{RSP_INIT, 0, 0, SEQ_DIAL, 601, 5, {ACT_CMD + AT_BC} },
{RSP_OK, 601, 601, -1, 603, 5, {ACT_CMD + AT_PROTO} },
{RSP_OK, 603, 603, -1, 604, 5, {ACT_CMD + AT_TYPE} },
{RSP_OK, 604, 604, -1, 605, 5, {ACT_CMD + AT_MSN} },
{RSP_NULL, 605, 605, -1, 606, 5, {ACT_CMD + AT_CLIP} },
{RSP_OK, 605, 605, -1, 606, 5, {ACT_CMD + AT_CLIP} },
{RSP_NULL, 606, 606, -1, 607, 5, {ACT_CMD + AT_ISO} },
{RSP_OK, 606, 606, -1, 607, 5, {ACT_CMD + AT_ISO} },
{RSP_OK, 607, 607, -1, 608, 5, {0}, "+VLS=17\r"},
{RSP_OK, 608, 608, -1, 609, -1},
{RSP_ZSAU, 609, 609, ZSAU_PROCEEDING, 610, 5, {ACT_CMD + AT_DIAL} },
{RSP_OK, 610, 610, -1, 650, 0, {ACT_DIALING} },
{RSP_ERROR, 601, 610, -1, 0, 0, {ACT_ABORTDIAL} },
{EV_TIMEOUT, 601, 610, -1, 0, 0, {ACT_ABORTDIAL} },
{RSP_ERROR, 601, 610, -1, 0, 0, {ACT_ABORTDIAL} },
{EV_TIMEOUT, 601, 610, -1, 0, 0, {ACT_ABORTDIAL} },
/* optional dialing responses */
{EV_BC_OPEN, 650, 650, -1, 651, -1},
{RSP_ZVLS, 609, 651, 17, -1, -1, {ACT_DEBUG} },
{RSP_ZCTP, 610, 651, -1, -1, -1, {ACT_DEBUG} },
{RSP_ZCPN, 610, 651, -1, -1, -1, {ACT_DEBUG} },
{RSP_ZSAU, 650, 651, ZSAU_CALL_DELIVERED, -1, -1, {ACT_DEBUG} },
{EV_BC_OPEN, 650, 650, -1, 651, -1},
{RSP_ZVLS, 609, 651, 17, -1, -1, {ACT_DEBUG} },
{RSP_ZCTP, 610, 651, -1, -1, -1, {ACT_DEBUG} },
{RSP_ZCPN, 610, 651, -1, -1, -1, {ACT_DEBUG} },
{RSP_ZSAU, 650, 651, ZSAU_CALL_DELIVERED, -1, -1, {ACT_DEBUG} },
/* connect */
{RSP_ZSAU, 650, 650, ZSAU_ACTIVE, 800, -1, {ACT_CONNECT} },
{RSP_ZSAU, 651, 651, ZSAU_ACTIVE, 800, -1, {ACT_CONNECT,
ACT_NOTIFY_BC_UP} },
{RSP_ZSAU, 750, 750, ZSAU_ACTIVE, 800, -1, {ACT_CONNECT} },
{RSP_ZSAU, 751, 751, ZSAU_ACTIVE, 800, -1, {ACT_CONNECT,
ACT_NOTIFY_BC_UP} },
{EV_BC_OPEN, 800, 800, -1, 800, -1, {ACT_NOTIFY_BC_UP} },
{RSP_ZSAU, 650, 650, ZSAU_ACTIVE, 800, -1, {ACT_CONNECT} },
{RSP_ZSAU, 651, 651, ZSAU_ACTIVE, 800, -1, {ACT_CONNECT,
ACT_NOTIFY_BC_UP} },
{RSP_ZSAU, 750, 750, ZSAU_ACTIVE, 800, -1, {ACT_CONNECT} },
{RSP_ZSAU, 751, 751, ZSAU_ACTIVE, 800, -1, {ACT_CONNECT,
ACT_NOTIFY_BC_UP} },
{EV_BC_OPEN, 800, 800, -1, 800, -1, {ACT_NOTIFY_BC_UP} },
/* remote hangup */
{RSP_ZSAU, 650, 651, ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEREJECT} },
{RSP_ZSAU, 750, 751, ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEHUP} },
{RSP_ZSAU, 800, 800, ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEHUP} },
{RSP_ZSAU, 650, 651, ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEREJECT} },
{RSP_ZSAU, 750, 751, ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEHUP} },
{RSP_ZSAU, 800, 800, ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEHUP} },
/* hangup */
{EV_HUP, -1, -1, -1, -1, -1, {ACT_HUP} },
{RSP_INIT, -1, -1, SEQ_HUP, 401, 5, {0}, "+VLS=0\r"},
{RSP_OK, 401, 401, -1, 402, 5},
{RSP_ZVLS, 402, 402, 0, 403, 5},
{RSP_ZSAU, 403, 403, ZSAU_DISCONNECT_REQ, -1, -1, {ACT_DEBUG} },
{RSP_ZSAU, 403, 403, ZSAU_NULL, 0, 0, {ACT_DISCONNECT} },
{RSP_NODEV, 401, 403, -1, 0, 0, {ACT_FAKEHUP} },
{RSP_ERROR, 401, 401, -1, 0, 0, {ACT_ABORTHUP} },
{EV_TIMEOUT, 401, 403, -1, 0, 0, {ACT_ABORTHUP} },
{EV_HUP, -1, -1, -1, -1, -1, {ACT_HUP} },
{RSP_INIT, -1, -1, SEQ_HUP, 401, 5, {0}, "+VLS=0\r"},
{RSP_OK, 401, 401, -1, 402, 5},
{RSP_ZVLS, 402, 402, 0, 403, 5},
{RSP_ZSAU, 403, 403, ZSAU_DISCONNECT_REQ, -1, -1, {ACT_DEBUG} },
{RSP_ZSAU, 403, 403, ZSAU_NULL, 0, 0, {ACT_DISCONNECT} },
{RSP_NODEV, 401, 403, -1, 0, 0, {ACT_FAKEHUP} },
{RSP_ERROR, 401, 401, -1, 0, 0, {ACT_ABORTHUP} },
{EV_TIMEOUT, 401, 403, -1, 0, 0, {ACT_ABORTHUP} },
{EV_BC_CLOSED, 0, 0, -1, 0, -1, {ACT_NOTIFY_BC_DOWN} },
{EV_BC_CLOSED, 0, 0, -1, 0, -1, {ACT_NOTIFY_BC_DOWN} },
/* ring */
{RSP_ZBC, 700, 700, -1, -1, -1, {0} },
{RSP_ZHLC, 700, 700, -1, -1, -1, {0} },
{RSP_NMBR, 700, 700, -1, -1, -1, {0} },
{RSP_ZCPN, 700, 700, -1, -1, -1, {0} },
{RSP_ZCTP, 700, 700, -1, -1, -1, {0} },
{EV_TIMEOUT, 700, 700, -1, 720, 720, {ACT_ICALL} },
{EV_BC_CLOSED, 720, 720, -1, 0, -1, {ACT_NOTIFY_BC_DOWN} },
{RSP_ZBC, 700, 700, -1, -1, -1, {0} },
{RSP_ZHLC, 700, 700, -1, -1, -1, {0} },
{RSP_NMBR, 700, 700, -1, -1, -1, {0} },
{RSP_ZCPN, 700, 700, -1, -1, -1, {0} },
{RSP_ZCTP, 700, 700, -1, -1, -1, {0} },
{EV_TIMEOUT, 700, 700, -1, 720, 720, {ACT_ICALL} },
{EV_BC_CLOSED, 720, 720, -1, 0, -1, {ACT_NOTIFY_BC_DOWN} },
/*accept icall*/
{EV_ACCEPT, -1, -1, -1, -1, -1, {ACT_ACCEPT} },
{RSP_INIT, 720, 720, SEQ_ACCEPT, 721, 5, {ACT_CMD+AT_PROTO} },
{RSP_OK, 721, 721, -1, 722, 5, {ACT_CMD+AT_ISO} },
{RSP_OK, 722, 722, -1, 723, 5, {0}, "+VLS=17\r"},
{RSP_OK, 723, 723, -1, 724, 5, {0} },
{RSP_ZVLS, 724, 724, 17, 750, 50, {ACT_ACCEPTED} },
{RSP_ERROR, 721, 729, -1, 0, 0, {ACT_ABORTACCEPT} },
{EV_TIMEOUT, 721, 729, -1, 0, 0, {ACT_ABORTACCEPT} },
{RSP_ZSAU, 700, 729, ZSAU_NULL, 0, 0, {ACT_ABORTACCEPT} },
{RSP_ZSAU, 700, 729, ZSAU_ACTIVE, 0, 0, {ACT_ABORTACCEPT} },
{RSP_ZSAU, 700, 729, ZSAU_DISCONNECT_IND, 0, 0, {ACT_ABORTACCEPT} },
{EV_ACCEPT, -1, -1, -1, -1, -1, {ACT_ACCEPT} },
{RSP_INIT, 720, 720, SEQ_ACCEPT, 721, 5, {ACT_CMD + AT_PROTO} },
{RSP_OK, 721, 721, -1, 722, 5, {ACT_CMD + AT_ISO} },
{RSP_OK, 722, 722, -1, 723, 5, {0}, "+VLS=17\r"},
{RSP_OK, 723, 723, -1, 724, 5, {0} },
{RSP_ZVLS, 724, 724, 17, 750, 50, {ACT_ACCEPTED} },
{RSP_ERROR, 721, 729, -1, 0, 0, {ACT_ABORTACCEPT} },
{EV_TIMEOUT, 721, 729, -1, 0, 0, {ACT_ABORTACCEPT} },
{RSP_ZSAU, 700, 729, ZSAU_NULL, 0, 0, {ACT_ABORTACCEPT} },
{RSP_ZSAU, 700, 729, ZSAU_ACTIVE, 0, 0, {ACT_ABORTACCEPT} },
{RSP_ZSAU, 700, 729, ZSAU_DISCONNECT_IND, 0, 0, {ACT_ABORTACCEPT} },
{EV_BC_OPEN, 750, 750, -1, 751, -1},
{EV_TIMEOUT, 750, 751, -1, 0, 0, {ACT_CONNTIMEOUT} },
{EV_BC_OPEN, 750, 750, -1, 751, -1},
{EV_TIMEOUT, 750, 751, -1, 0, 0, {ACT_CONNTIMEOUT} },
/* B channel closed (general case) */
{EV_BC_CLOSED, -1, -1, -1, -1, -1, {ACT_NOTIFY_BC_DOWN} },
{EV_BC_CLOSED, -1, -1, -1, -1, -1, {ACT_NOTIFY_BC_DOWN} },
/* misc. */
{RSP_ZCON, -1, -1, -1, -1, -1, {ACT_DEBUG} },
{RSP_ZCAU, -1, -1, -1, -1, -1, {ACT_ZCAU} },
{RSP_NONE, -1, -1, -1, -1, -1, {ACT_DEBUG} },
{RSP_ANY, -1, -1, -1, -1, -1, {ACT_WARN} },
{RSP_LAST}
{RSP_ZCON, -1, -1, -1, -1, -1, {ACT_DEBUG} },
{RSP_ZCAU, -1, -1, -1, -1, -1, {ACT_ZCAU} },
{RSP_NONE, -1, -1, -1, -1, -1, {ACT_DEBUG} },
{RSP_ANY, -1, -1, -1, -1, -1, {ACT_WARN} },
{RSP_LAST}
};
@ -453,7 +453,7 @@ void gigaset_handle_modem_response(struct cardstate *cs)
case '=':
if (params > MAX_REC_PARAMS) {
dev_warn(cs->dev,
"too many parameters in response\n");
"too many parameters in response\n");
/* need last parameter (might be CID) */
params--;
}
@ -461,7 +461,7 @@ void gigaset_handle_modem_response(struct cardstate *cs)
}
rawstring = 0;
cid = params > 1 ? cid_of_response(argv[params-1]) : 0;
cid = params > 1 ? cid_of_response(argv[params - 1]) : 0;
if (cid < 0) {
gigaset_add_event(cs, &cs->at_state, RSP_INVAL,
NULL, 0, NULL);
@ -550,7 +550,7 @@ void gigaset_handle_modem_response(struct cardstate *cs)
event->parameter = zr->code;
if (!zr->str)
dev_warn(cs->dev,
"%s: unknown parameter %s after ZSAU\n",
"%s: unknown parameter %s after ZSAU\n",
__func__, argv[curarg]);
++curarg;
break;
@ -648,8 +648,8 @@ static void disconnect(struct at_state_t **at_state_p)
static inline struct at_state_t *get_free_channel(struct cardstate *cs,
int cid)
/* cids: >0: siemens-cid
0: without cid
-1: no cid assigned yet
0: without cid
-1: no cid assigned yet
*/
{
unsigned long flags;
@ -722,12 +722,12 @@ static void send_command(struct cardstate *cs, const char *cmd, int cid,
}
if (cid > 0 && cid <= 65535)
cb->len = snprintf(cb->buf, buflen,
dle ? "\020(AT%d%s\020)" : "AT%d%s",
cid, cmd);
dle ? "\020(AT%d%s\020)" : "AT%d%s",
cid, cmd);
else
cb->len = snprintf(cb->buf, buflen,
dle ? "\020(AT%s\020)" : "AT%s",
cmd);
dle ? "\020(AT%s\020)" : "AT%s",
cmd);
cb->offset = 0;
cb->next = NULL;
cb->wake_tasklet = NULL;
@ -790,7 +790,7 @@ static void bchannel_up(struct bc_state *bcs)
}
static void start_dial(struct at_state_t *at_state, void *data,
unsigned seq_index)
unsigned seq_index)
{
struct bc_state *bcs = at_state->bcs;
struct cardstate *cs = at_state->cs;
@ -937,10 +937,10 @@ static int reinit_and_retry(struct cardstate *cs, int channel)
if (channel < 0)
dev_warn(cs->dev,
"Could not enter cid mode. Reinit device and try again.\n");
"Could not enter cid mode. Reinit device and try again.\n");
else {
dev_warn(cs->dev,
"Could not get a call id. Reinit device and try again.\n");
"Could not get a call id. Reinit device and try again.\n");
cs->bcs[channel].at_state.pending_commands |= PC_CID;
}
schedule_init(cs, MS_INIT);
@ -1155,7 +1155,7 @@ static void do_action(int action, struct cardstate *cs,
at_state2 = get_free_channel(cs, ev->parameter);
if (!at_state2) {
dev_warn(cs->dev,
"RING ignored: could not allocate channel structure\n");
"RING ignored: could not allocate channel structure\n");
break;
}
@ -1372,7 +1372,7 @@ static void do_action(int action, struct cardstate *cs,
ev->parameter, at_state->ConState);
break;
/* events from the LL */
/* events from the LL */
case ACT_DIAL:
start_dial(at_state, ev->ptr, ev->parameter);
break;
@ -1385,7 +1385,7 @@ static void do_action(int action, struct cardstate *cs,
cs->commands_pending = 1;
break;
/* hotplug events */
/* hotplug events */
case ACT_STOP:
do_stop(cs);
break;
@ -1393,7 +1393,7 @@ static void do_action(int action, struct cardstate *cs,
do_start(cs);
break;
/* events from the interface */
/* events from the interface */
case ACT_IF_LOCK:
cs->cmd_result = ev->parameter ? do_lock(cs) : do_unlock(cs);
cs->waiting = 0;
@ -1412,7 +1412,7 @@ static void do_action(int action, struct cardstate *cs,
wake_up(&cs->waitqueue);
break;
/* events from the proc file system */
/* events from the proc file system */
case ACT_PROC_CIDMODE:
spin_lock_irqsave(&cs->lock, flags);
if (ev->parameter != cs->cidmode) {
@ -1431,7 +1431,7 @@ static void do_action(int action, struct cardstate *cs,
wake_up(&cs->waitqueue);
break;
/* events from the hardware drivers */
/* events from the hardware drivers */
case ACT_NOTIFY_BC_DOWN:
bchannel_down(bcs);
break;
@ -1533,15 +1533,15 @@ static void process_event(struct cardstate *cs, struct event_t *ev)
if (rcode == RSP_LAST) {
/* found nothing...*/
dev_warn(cs->dev, "%s: rcode=RSP_LAST: "
"resp_code %d in ConState %d!\n",
"resp_code %d in ConState %d!\n",
__func__, ev->type, at_state->ConState);
return;
}
if ((rcode == RSP_ANY || rcode == ev->type)
&& ((int) at_state->ConState >= rep->min_ConState)
&& (rep->max_ConState < 0
|| (int) at_state->ConState <= rep->max_ConState)
&& (rep->parameter < 0 || rep->parameter == ev->parameter))
&& ((int) at_state->ConState >= rep->min_ConState)
&& (rep->max_ConState < 0
|| (int) at_state->ConState <= rep->max_ConState)
&& (rep->parameter < 0 || rep->parameter == ev->parameter))
break;
}

View File

@ -91,11 +91,11 @@ enum debuglevel {
#ifdef CONFIG_GIGASET_DEBUG
#define gig_dbg(level, format, arg...) \
do { \
#define gig_dbg(level, format, arg...) \
do { \
if (unlikely(((enum debuglevel)gigaset_debuglevel) & (level))) \
printk(KERN_DEBUG KBUILD_MODNAME ": " format "\n", \
## arg); \
## arg); \
} while (0)
#define DEBUG_DEFAULT (DEBUG_TRANSCMD | DEBUG_CMD | DEBUG_USBREQ)
@ -164,7 +164,7 @@ void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg,
#define BAS_CORRFRAMES 4 /* flow control multiplicator */
#define BAS_INBUFSIZE (BAS_MAXFRAME * BAS_NUMFRAMES)
/* size of isoc in buf per URB */
/* size of isoc in buf per URB */
#define BAS_OUTBUFSIZE 4096 /* size of common isoc out buffer */
#define BAS_OUTBUFPAD BAS_MAXFRAME /* size of pad area for isoc out buf */
@ -473,17 +473,17 @@ struct cardstate {
int commands_pending; /* flag(s) in xxx.commands_pending have
been set */
struct tasklet_struct event_tasklet;
/* tasklet for serializing AT commands.
* Scheduled
* -> for modem reponses (and
* incoming data for M10x)
* -> on timeout
* -> after setting bits in
* xxx.at_state.pending_command
* (e.g. command from LL) */
/* tasklet for serializing AT commands.
* Scheduled
* -> for modem reponses (and
* incoming data for M10x)
* -> on timeout
* -> after setting bits in
* xxx.at_state.pending_command
* (e.g. command from LL) */
struct tasklet_struct write_tasklet;
/* tasklet for serial output
* (not used in base driver) */
/* tasklet for serial output
* (not used in base driver) */
/* event queue */
struct event_t events[MAX_EVENTS];
@ -491,7 +491,7 @@ struct cardstate {
spinlock_t ev_lock;
/* current modem response */
unsigned char respdata[MAX_RESP_SIZE+1];
unsigned char respdata[MAX_RESP_SIZE + 1];
unsigned cbytes;
/* private data of hardware drivers */

View File

@ -243,7 +243,7 @@ static int command_from_LL(isdn_ctrl *cntrl)
dev_kfree_skb(bcs->rx_skb);
gigaset_new_rx_skb(bcs);
commands = kzalloc(AT_NUM*(sizeof *commands), GFP_ATOMIC);
commands = kzalloc(AT_NUM * (sizeof *commands), GFP_ATOMIC);
if (!commands) {
gigaset_free_channel(bcs);
dev_err(cs->dev, "ISDN_CMD_DIAL: out of memory\n");
@ -261,7 +261,7 @@ static int command_from_LL(isdn_ctrl *cntrl)
if (!commands[AT_TYPE])
goto oom;
snprintf(commands[AT_DIAL], l,
"D%s\r", cntrl->parm.setup.phone+2);
"D%s\r", cntrl->parm.setup.phone + 2);
} else {
commands[AT_TYPE] = kstrdup("^SCTP=1\r", GFP_ATOMIC);
if (!commands[AT_TYPE])
@ -482,7 +482,7 @@ int gigaset_isdn_icall(struct at_state_t *at_state)
response.parm.setup.si2 = 2;
} else {
dev_warn(cs->dev, "RING ignored - unsupported BC %s\n",
at_state->str_var[STR_ZBC]);
at_state->str_var[STR_ZBC]);
return ICALL_IGNORE;
}
if (at_state->str_var[STR_NMBR]) {
@ -518,7 +518,7 @@ int gigaset_isdn_icall(struct at_state_t *at_state)
return ICALL_REJECT;
case 3: /* incomplete */
dev_warn(cs->dev,
"LL requested unsupported feature: Incomplete Number\n");
"LL requested unsupported feature: Incomplete Number\n");
return ICALL_IGNORE;
case 4: /* proceeding */
/* Gigaset will send ALERTING anyway.

View File

@ -33,10 +33,10 @@ static int if_lock(struct cardstate *cs, int *arg)
}
if (!cmd && cs->mstate == MS_LOCKED && cs->connected) {
cs->ops->set_modem_ctrl(cs, 0, TIOCM_DTR|TIOCM_RTS);
cs->ops->set_modem_ctrl(cs, 0, TIOCM_DTR | TIOCM_RTS);
cs->ops->baud_rate(cs, B115200);
cs->ops->set_line_ctrl(cs, CS8);
cs->control_state = TIOCM_DTR|TIOCM_RTS;
cs->control_state = TIOCM_DTR | TIOCM_RTS;
}
cs->waiting = 1;
@ -252,17 +252,17 @@ static int if_ioctl(struct tty_struct *tty,
break;
case GIGASET_BRKCHARS:
retval = copy_from_user(&buf,
(const unsigned char __user *) arg, 6)
(const unsigned char __user *) arg, 6)
? -EFAULT : 0;
if (retval >= 0) {
gigaset_dbg_buffer(DEBUG_IF, "GIGASET_BRKCHARS",
6, (const unsigned char *) arg);
6, (const unsigned char *) arg);
retval = cs->ops->brkchars(cs, buf);
}
break;
case GIGASET_VERSION:
retval = copy_from_user(version,
(unsigned __user *) arg, sizeof version)
(unsigned __user *) arg, sizeof version)
? -EFAULT : 0;
if (retval >= 0)
retval = if_version(cs, version);
@ -299,7 +299,7 @@ static int if_tiocmget(struct tty_struct *tty)
if (mutex_lock_interruptible(&cs->mutex))
return -ERESTARTSYS;
retval = cs->control_state & (TIOCM_RTS|TIOCM_DTR);
retval = cs->control_state & (TIOCM_RTS | TIOCM_DTR);
mutex_unlock(&cs->mutex);
@ -329,7 +329,7 @@ static int if_tiocmset(struct tty_struct *tty,
gig_dbg(DEBUG_IF, "not connected");
retval = -ENODEV;
} else {
mc = (cs->control_state | set) & ~clear & (TIOCM_RTS|TIOCM_DTR);
mc = (cs->control_state | set) & ~clear & (TIOCM_RTS | TIOCM_DTR);
retval = cs->ops->set_modem_ctrl(cs, cs->control_state, mc);
cs->control_state = mc;
}
@ -680,9 +680,9 @@ void gigaset_if_initdriver(struct gigaset_driver *drv, const char *procname,
goto enomem;
tty->magic = TTY_DRIVER_MAGIC,
tty->type = TTY_DRIVER_TYPE_SERIAL,
tty->subtype = SERIAL_TYPE_NORMAL,
tty->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
tty->type = TTY_DRIVER_TYPE_SERIAL,
tty->subtype = SERIAL_TYPE_NORMAL,
tty->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
tty->driver_name = procname;
tty->name = devname;

View File

@ -250,94 +250,94 @@ static inline void dump_bytes(enum debuglevel level, const char *tag,
*/
static const u16 stufftab[5 * 256] = {
/* previous 1s = 0: */
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x201f,
0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x203e, 0x205f,
0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x209f,
0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x207c, 0x207d, 0x20be, 0x20df,
0x0480, 0x0481, 0x0482, 0x0483, 0x0484, 0x0485, 0x0486, 0x0487, 0x0488, 0x0489, 0x048a, 0x048b, 0x048c, 0x048d, 0x048e, 0x048f,
0x0490, 0x0491, 0x0492, 0x0493, 0x0494, 0x0495, 0x0496, 0x0497, 0x0498, 0x0499, 0x049a, 0x049b, 0x049c, 0x049d, 0x049e, 0x251f,
0x04a0, 0x04a1, 0x04a2, 0x04a3, 0x04a4, 0x04a5, 0x04a6, 0x04a7, 0x04a8, 0x04a9, 0x04aa, 0x04ab, 0x04ac, 0x04ad, 0x04ae, 0x04af,
0x04b0, 0x04b1, 0x04b2, 0x04b3, 0x04b4, 0x04b5, 0x04b6, 0x04b7, 0x04b8, 0x04b9, 0x04ba, 0x04bb, 0x04bc, 0x04bd, 0x253e, 0x255f,
0x08c0, 0x08c1, 0x08c2, 0x08c3, 0x08c4, 0x08c5, 0x08c6, 0x08c7, 0x08c8, 0x08c9, 0x08ca, 0x08cb, 0x08cc, 0x08cd, 0x08ce, 0x08cf,
0x08d0, 0x08d1, 0x08d2, 0x08d3, 0x08d4, 0x08d5, 0x08d6, 0x08d7, 0x08d8, 0x08d9, 0x08da, 0x08db, 0x08dc, 0x08dd, 0x08de, 0x299f,
0x0ce0, 0x0ce1, 0x0ce2, 0x0ce3, 0x0ce4, 0x0ce5, 0x0ce6, 0x0ce7, 0x0ce8, 0x0ce9, 0x0cea, 0x0ceb, 0x0cec, 0x0ced, 0x0cee, 0x0cef,
0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6, 0x10f7, 0x20f8, 0x20f9, 0x20fa, 0x20fb, 0x257c, 0x257d, 0x29be, 0x2ddf,
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x201f,
0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x203e, 0x205f,
0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x209f,
0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x207c, 0x207d, 0x20be, 0x20df,
0x0480, 0x0481, 0x0482, 0x0483, 0x0484, 0x0485, 0x0486, 0x0487, 0x0488, 0x0489, 0x048a, 0x048b, 0x048c, 0x048d, 0x048e, 0x048f,
0x0490, 0x0491, 0x0492, 0x0493, 0x0494, 0x0495, 0x0496, 0x0497, 0x0498, 0x0499, 0x049a, 0x049b, 0x049c, 0x049d, 0x049e, 0x251f,
0x04a0, 0x04a1, 0x04a2, 0x04a3, 0x04a4, 0x04a5, 0x04a6, 0x04a7, 0x04a8, 0x04a9, 0x04aa, 0x04ab, 0x04ac, 0x04ad, 0x04ae, 0x04af,
0x04b0, 0x04b1, 0x04b2, 0x04b3, 0x04b4, 0x04b5, 0x04b6, 0x04b7, 0x04b8, 0x04b9, 0x04ba, 0x04bb, 0x04bc, 0x04bd, 0x253e, 0x255f,
0x08c0, 0x08c1, 0x08c2, 0x08c3, 0x08c4, 0x08c5, 0x08c6, 0x08c7, 0x08c8, 0x08c9, 0x08ca, 0x08cb, 0x08cc, 0x08cd, 0x08ce, 0x08cf,
0x08d0, 0x08d1, 0x08d2, 0x08d3, 0x08d4, 0x08d5, 0x08d6, 0x08d7, 0x08d8, 0x08d9, 0x08da, 0x08db, 0x08dc, 0x08dd, 0x08de, 0x299f,
0x0ce0, 0x0ce1, 0x0ce2, 0x0ce3, 0x0ce4, 0x0ce5, 0x0ce6, 0x0ce7, 0x0ce8, 0x0ce9, 0x0cea, 0x0ceb, 0x0cec, 0x0ced, 0x0cee, 0x0cef,
0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6, 0x10f7, 0x20f8, 0x20f9, 0x20fa, 0x20fb, 0x257c, 0x257d, 0x29be, 0x2ddf,
/* previous 1s = 1: */
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x200f,
0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x202f,
0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x204f,
0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x203e, 0x206f,
0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x208f,
0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x20af,
0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x20cf,
0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x207c, 0x207d, 0x20be, 0x20ef,
0x0480, 0x0481, 0x0482, 0x0483, 0x0484, 0x0485, 0x0486, 0x0487, 0x0488, 0x0489, 0x048a, 0x048b, 0x048c, 0x048d, 0x048e, 0x250f,
0x0490, 0x0491, 0x0492, 0x0493, 0x0494, 0x0495, 0x0496, 0x0497, 0x0498, 0x0499, 0x049a, 0x049b, 0x049c, 0x049d, 0x049e, 0x252f,
0x04a0, 0x04a1, 0x04a2, 0x04a3, 0x04a4, 0x04a5, 0x04a6, 0x04a7, 0x04a8, 0x04a9, 0x04aa, 0x04ab, 0x04ac, 0x04ad, 0x04ae, 0x254f,
0x04b0, 0x04b1, 0x04b2, 0x04b3, 0x04b4, 0x04b5, 0x04b6, 0x04b7, 0x04b8, 0x04b9, 0x04ba, 0x04bb, 0x04bc, 0x04bd, 0x253e, 0x256f,
0x08c0, 0x08c1, 0x08c2, 0x08c3, 0x08c4, 0x08c5, 0x08c6, 0x08c7, 0x08c8, 0x08c9, 0x08ca, 0x08cb, 0x08cc, 0x08cd, 0x08ce, 0x298f,
0x08d0, 0x08d1, 0x08d2, 0x08d3, 0x08d4, 0x08d5, 0x08d6, 0x08d7, 0x08d8, 0x08d9, 0x08da, 0x08db, 0x08dc, 0x08dd, 0x08de, 0x29af,
0x0ce0, 0x0ce1, 0x0ce2, 0x0ce3, 0x0ce4, 0x0ce5, 0x0ce6, 0x0ce7, 0x0ce8, 0x0ce9, 0x0cea, 0x0ceb, 0x0cec, 0x0ced, 0x0cee, 0x2dcf,
0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6, 0x10f7, 0x20f8, 0x20f9, 0x20fa, 0x20fb, 0x257c, 0x257d, 0x29be, 0x31ef,
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x200f,
0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x202f,
0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x204f,
0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x203e, 0x206f,
0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x208f,
0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x20af,
0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x20cf,
0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x207c, 0x207d, 0x20be, 0x20ef,
0x0480, 0x0481, 0x0482, 0x0483, 0x0484, 0x0485, 0x0486, 0x0487, 0x0488, 0x0489, 0x048a, 0x048b, 0x048c, 0x048d, 0x048e, 0x250f,
0x0490, 0x0491, 0x0492, 0x0493, 0x0494, 0x0495, 0x0496, 0x0497, 0x0498, 0x0499, 0x049a, 0x049b, 0x049c, 0x049d, 0x049e, 0x252f,
0x04a0, 0x04a1, 0x04a2, 0x04a3, 0x04a4, 0x04a5, 0x04a6, 0x04a7, 0x04a8, 0x04a9, 0x04aa, 0x04ab, 0x04ac, 0x04ad, 0x04ae, 0x254f,
0x04b0, 0x04b1, 0x04b2, 0x04b3, 0x04b4, 0x04b5, 0x04b6, 0x04b7, 0x04b8, 0x04b9, 0x04ba, 0x04bb, 0x04bc, 0x04bd, 0x253e, 0x256f,
0x08c0, 0x08c1, 0x08c2, 0x08c3, 0x08c4, 0x08c5, 0x08c6, 0x08c7, 0x08c8, 0x08c9, 0x08ca, 0x08cb, 0x08cc, 0x08cd, 0x08ce, 0x298f,
0x08d0, 0x08d1, 0x08d2, 0x08d3, 0x08d4, 0x08d5, 0x08d6, 0x08d7, 0x08d8, 0x08d9, 0x08da, 0x08db, 0x08dc, 0x08dd, 0x08de, 0x29af,
0x0ce0, 0x0ce1, 0x0ce2, 0x0ce3, 0x0ce4, 0x0ce5, 0x0ce6, 0x0ce7, 0x0ce8, 0x0ce9, 0x0cea, 0x0ceb, 0x0cec, 0x0ced, 0x0cee, 0x2dcf,
0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6, 0x10f7, 0x20f8, 0x20f9, 0x20fa, 0x20fb, 0x257c, 0x257d, 0x29be, 0x31ef,
/* previous 1s = 2: */
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x2007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x2017,
0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x2027, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x2037,
0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x2047, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x2057,
0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x2067, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x203e, 0x2077,
0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x2087, 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x2097,
0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x20a7, 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x20b7,
0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x20c7, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x20d7,
0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x20e7, 0x0078, 0x0079, 0x007a, 0x007b, 0x207c, 0x207d, 0x20be, 0x20f7,
0x0480, 0x0481, 0x0482, 0x0483, 0x0484, 0x0485, 0x0486, 0x2507, 0x0488, 0x0489, 0x048a, 0x048b, 0x048c, 0x048d, 0x048e, 0x2517,
0x0490, 0x0491, 0x0492, 0x0493, 0x0494, 0x0495, 0x0496, 0x2527, 0x0498, 0x0499, 0x049a, 0x049b, 0x049c, 0x049d, 0x049e, 0x2537,
0x04a0, 0x04a1, 0x04a2, 0x04a3, 0x04a4, 0x04a5, 0x04a6, 0x2547, 0x04a8, 0x04a9, 0x04aa, 0x04ab, 0x04ac, 0x04ad, 0x04ae, 0x2557,
0x04b0, 0x04b1, 0x04b2, 0x04b3, 0x04b4, 0x04b5, 0x04b6, 0x2567, 0x04b8, 0x04b9, 0x04ba, 0x04bb, 0x04bc, 0x04bd, 0x253e, 0x2577,
0x08c0, 0x08c1, 0x08c2, 0x08c3, 0x08c4, 0x08c5, 0x08c6, 0x2987, 0x08c8, 0x08c9, 0x08ca, 0x08cb, 0x08cc, 0x08cd, 0x08ce, 0x2997,
0x08d0, 0x08d1, 0x08d2, 0x08d3, 0x08d4, 0x08d5, 0x08d6, 0x29a7, 0x08d8, 0x08d9, 0x08da, 0x08db, 0x08dc, 0x08dd, 0x08de, 0x29b7,
0x0ce0, 0x0ce1, 0x0ce2, 0x0ce3, 0x0ce4, 0x0ce5, 0x0ce6, 0x2dc7, 0x0ce8, 0x0ce9, 0x0cea, 0x0ceb, 0x0cec, 0x0ced, 0x0cee, 0x2dd7,
0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6, 0x31e7, 0x20f8, 0x20f9, 0x20fa, 0x20fb, 0x257c, 0x257d, 0x29be, 0x41f7,
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x2007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x2017,
0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x2027, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x2037,
0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x2047, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x2057,
0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x2067, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x203e, 0x2077,
0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x2087, 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x2097,
0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x20a7, 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x20b7,
0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x20c7, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x20d7,
0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x20e7, 0x0078, 0x0079, 0x007a, 0x007b, 0x207c, 0x207d, 0x20be, 0x20f7,
0x0480, 0x0481, 0x0482, 0x0483, 0x0484, 0x0485, 0x0486, 0x2507, 0x0488, 0x0489, 0x048a, 0x048b, 0x048c, 0x048d, 0x048e, 0x2517,
0x0490, 0x0491, 0x0492, 0x0493, 0x0494, 0x0495, 0x0496, 0x2527, 0x0498, 0x0499, 0x049a, 0x049b, 0x049c, 0x049d, 0x049e, 0x2537,
0x04a0, 0x04a1, 0x04a2, 0x04a3, 0x04a4, 0x04a5, 0x04a6, 0x2547, 0x04a8, 0x04a9, 0x04aa, 0x04ab, 0x04ac, 0x04ad, 0x04ae, 0x2557,
0x04b0, 0x04b1, 0x04b2, 0x04b3, 0x04b4, 0x04b5, 0x04b6, 0x2567, 0x04b8, 0x04b9, 0x04ba, 0x04bb, 0x04bc, 0x04bd, 0x253e, 0x2577,
0x08c0, 0x08c1, 0x08c2, 0x08c3, 0x08c4, 0x08c5, 0x08c6, 0x2987, 0x08c8, 0x08c9, 0x08ca, 0x08cb, 0x08cc, 0x08cd, 0x08ce, 0x2997,
0x08d0, 0x08d1, 0x08d2, 0x08d3, 0x08d4, 0x08d5, 0x08d6, 0x29a7, 0x08d8, 0x08d9, 0x08da, 0x08db, 0x08dc, 0x08dd, 0x08de, 0x29b7,
0x0ce0, 0x0ce1, 0x0ce2, 0x0ce3, 0x0ce4, 0x0ce5, 0x0ce6, 0x2dc7, 0x0ce8, 0x0ce9, 0x0cea, 0x0ceb, 0x0cec, 0x0ced, 0x0cee, 0x2dd7,
0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6, 0x31e7, 0x20f8, 0x20f9, 0x20fa, 0x20fb, 0x257c, 0x257d, 0x29be, 0x41f7,
/* previous 1s = 3: */
0x0000, 0x0001, 0x0002, 0x2003, 0x0004, 0x0005, 0x0006, 0x200b, 0x0008, 0x0009, 0x000a, 0x2013, 0x000c, 0x000d, 0x000e, 0x201b,
0x0010, 0x0011, 0x0012, 0x2023, 0x0014, 0x0015, 0x0016, 0x202b, 0x0018, 0x0019, 0x001a, 0x2033, 0x001c, 0x001d, 0x001e, 0x203b,
0x0020, 0x0021, 0x0022, 0x2043, 0x0024, 0x0025, 0x0026, 0x204b, 0x0028, 0x0029, 0x002a, 0x2053, 0x002c, 0x002d, 0x002e, 0x205b,
0x0030, 0x0031, 0x0032, 0x2063, 0x0034, 0x0035, 0x0036, 0x206b, 0x0038, 0x0039, 0x003a, 0x2073, 0x003c, 0x003d, 0x203e, 0x207b,
0x0040, 0x0041, 0x0042, 0x2083, 0x0044, 0x0045, 0x0046, 0x208b, 0x0048, 0x0049, 0x004a, 0x2093, 0x004c, 0x004d, 0x004e, 0x209b,
0x0050, 0x0051, 0x0052, 0x20a3, 0x0054, 0x0055, 0x0056, 0x20ab, 0x0058, 0x0059, 0x005a, 0x20b3, 0x005c, 0x005d, 0x005e, 0x20bb,
0x0060, 0x0061, 0x0062, 0x20c3, 0x0064, 0x0065, 0x0066, 0x20cb, 0x0068, 0x0069, 0x006a, 0x20d3, 0x006c, 0x006d, 0x006e, 0x20db,
0x0070, 0x0071, 0x0072, 0x20e3, 0x0074, 0x0075, 0x0076, 0x20eb, 0x0078, 0x0079, 0x007a, 0x20f3, 0x207c, 0x207d, 0x20be, 0x40fb,
0x0480, 0x0481, 0x0482, 0x2503, 0x0484, 0x0485, 0x0486, 0x250b, 0x0488, 0x0489, 0x048a, 0x2513, 0x048c, 0x048d, 0x048e, 0x251b,
0x0490, 0x0491, 0x0492, 0x2523, 0x0494, 0x0495, 0x0496, 0x252b, 0x0498, 0x0499, 0x049a, 0x2533, 0x049c, 0x049d, 0x049e, 0x253b,
0x04a0, 0x04a1, 0x04a2, 0x2543, 0x04a4, 0x04a5, 0x04a6, 0x254b, 0x04a8, 0x04a9, 0x04aa, 0x2553, 0x04ac, 0x04ad, 0x04ae, 0x255b,
0x04b0, 0x04b1, 0x04b2, 0x2563, 0x04b4, 0x04b5, 0x04b6, 0x256b, 0x04b8, 0x04b9, 0x04ba, 0x2573, 0x04bc, 0x04bd, 0x253e, 0x257b,
0x08c0, 0x08c1, 0x08c2, 0x2983, 0x08c4, 0x08c5, 0x08c6, 0x298b, 0x08c8, 0x08c9, 0x08ca, 0x2993, 0x08cc, 0x08cd, 0x08ce, 0x299b,
0x08d0, 0x08d1, 0x08d2, 0x29a3, 0x08d4, 0x08d5, 0x08d6, 0x29ab, 0x08d8, 0x08d9, 0x08da, 0x29b3, 0x08dc, 0x08dd, 0x08de, 0x29bb,
0x0ce0, 0x0ce1, 0x0ce2, 0x2dc3, 0x0ce4, 0x0ce5, 0x0ce6, 0x2dcb, 0x0ce8, 0x0ce9, 0x0cea, 0x2dd3, 0x0cec, 0x0ced, 0x0cee, 0x2ddb,
0x10f0, 0x10f1, 0x10f2, 0x31e3, 0x10f4, 0x10f5, 0x10f6, 0x31eb, 0x20f8, 0x20f9, 0x20fa, 0x41f3, 0x257c, 0x257d, 0x29be, 0x46fb,
0x0000, 0x0001, 0x0002, 0x2003, 0x0004, 0x0005, 0x0006, 0x200b, 0x0008, 0x0009, 0x000a, 0x2013, 0x000c, 0x000d, 0x000e, 0x201b,
0x0010, 0x0011, 0x0012, 0x2023, 0x0014, 0x0015, 0x0016, 0x202b, 0x0018, 0x0019, 0x001a, 0x2033, 0x001c, 0x001d, 0x001e, 0x203b,
0x0020, 0x0021, 0x0022, 0x2043, 0x0024, 0x0025, 0x0026, 0x204b, 0x0028, 0x0029, 0x002a, 0x2053, 0x002c, 0x002d, 0x002e, 0x205b,
0x0030, 0x0031, 0x0032, 0x2063, 0x0034, 0x0035, 0x0036, 0x206b, 0x0038, 0x0039, 0x003a, 0x2073, 0x003c, 0x003d, 0x203e, 0x207b,
0x0040, 0x0041, 0x0042, 0x2083, 0x0044, 0x0045, 0x0046, 0x208b, 0x0048, 0x0049, 0x004a, 0x2093, 0x004c, 0x004d, 0x004e, 0x209b,
0x0050, 0x0051, 0x0052, 0x20a3, 0x0054, 0x0055, 0x0056, 0x20ab, 0x0058, 0x0059, 0x005a, 0x20b3, 0x005c, 0x005d, 0x005e, 0x20bb,
0x0060, 0x0061, 0x0062, 0x20c3, 0x0064, 0x0065, 0x0066, 0x20cb, 0x0068, 0x0069, 0x006a, 0x20d3, 0x006c, 0x006d, 0x006e, 0x20db,
0x0070, 0x0071, 0x0072, 0x20e3, 0x0074, 0x0075, 0x0076, 0x20eb, 0x0078, 0x0079, 0x007a, 0x20f3, 0x207c, 0x207d, 0x20be, 0x40fb,
0x0480, 0x0481, 0x0482, 0x2503, 0x0484, 0x0485, 0x0486, 0x250b, 0x0488, 0x0489, 0x048a, 0x2513, 0x048c, 0x048d, 0x048e, 0x251b,
0x0490, 0x0491, 0x0492, 0x2523, 0x0494, 0x0495, 0x0496, 0x252b, 0x0498, 0x0499, 0x049a, 0x2533, 0x049c, 0x049d, 0x049e, 0x253b,
0x04a0, 0x04a1, 0x04a2, 0x2543, 0x04a4, 0x04a5, 0x04a6, 0x254b, 0x04a8, 0x04a9, 0x04aa, 0x2553, 0x04ac, 0x04ad, 0x04ae, 0x255b,
0x04b0, 0x04b1, 0x04b2, 0x2563, 0x04b4, 0x04b5, 0x04b6, 0x256b, 0x04b8, 0x04b9, 0x04ba, 0x2573, 0x04bc, 0x04bd, 0x253e, 0x257b,
0x08c0, 0x08c1, 0x08c2, 0x2983, 0x08c4, 0x08c5, 0x08c6, 0x298b, 0x08c8, 0x08c9, 0x08ca, 0x2993, 0x08cc, 0x08cd, 0x08ce, 0x299b,
0x08d0, 0x08d1, 0x08d2, 0x29a3, 0x08d4, 0x08d5, 0x08d6, 0x29ab, 0x08d8, 0x08d9, 0x08da, 0x29b3, 0x08dc, 0x08dd, 0x08de, 0x29bb,
0x0ce0, 0x0ce1, 0x0ce2, 0x2dc3, 0x0ce4, 0x0ce5, 0x0ce6, 0x2dcb, 0x0ce8, 0x0ce9, 0x0cea, 0x2dd3, 0x0cec, 0x0ced, 0x0cee, 0x2ddb,
0x10f0, 0x10f1, 0x10f2, 0x31e3, 0x10f4, 0x10f5, 0x10f6, 0x31eb, 0x20f8, 0x20f9, 0x20fa, 0x41f3, 0x257c, 0x257d, 0x29be, 0x46fb,
/* previous 1s = 4: */
0x0000, 0x2001, 0x0002, 0x2005, 0x0004, 0x2009, 0x0006, 0x200d, 0x0008, 0x2011, 0x000a, 0x2015, 0x000c, 0x2019, 0x000e, 0x201d,
0x0010, 0x2021, 0x0012, 0x2025, 0x0014, 0x2029, 0x0016, 0x202d, 0x0018, 0x2031, 0x001a, 0x2035, 0x001c, 0x2039, 0x001e, 0x203d,
0x0020, 0x2041, 0x0022, 0x2045, 0x0024, 0x2049, 0x0026, 0x204d, 0x0028, 0x2051, 0x002a, 0x2055, 0x002c, 0x2059, 0x002e, 0x205d,
0x0030, 0x2061, 0x0032, 0x2065, 0x0034, 0x2069, 0x0036, 0x206d, 0x0038, 0x2071, 0x003a, 0x2075, 0x003c, 0x2079, 0x203e, 0x407d,
0x0040, 0x2081, 0x0042, 0x2085, 0x0044, 0x2089, 0x0046, 0x208d, 0x0048, 0x2091, 0x004a, 0x2095, 0x004c, 0x2099, 0x004e, 0x209d,
0x0050, 0x20a1, 0x0052, 0x20a5, 0x0054, 0x20a9, 0x0056, 0x20ad, 0x0058, 0x20b1, 0x005a, 0x20b5, 0x005c, 0x20b9, 0x005e, 0x20bd,
0x0060, 0x20c1, 0x0062, 0x20c5, 0x0064, 0x20c9, 0x0066, 0x20cd, 0x0068, 0x20d1, 0x006a, 0x20d5, 0x006c, 0x20d9, 0x006e, 0x20dd,
0x0070, 0x20e1, 0x0072, 0x20e5, 0x0074, 0x20e9, 0x0076, 0x20ed, 0x0078, 0x20f1, 0x007a, 0x20f5, 0x207c, 0x40f9, 0x20be, 0x417d,
0x0480, 0x2501, 0x0482, 0x2505, 0x0484, 0x2509, 0x0486, 0x250d, 0x0488, 0x2511, 0x048a, 0x2515, 0x048c, 0x2519, 0x048e, 0x251d,
0x0490, 0x2521, 0x0492, 0x2525, 0x0494, 0x2529, 0x0496, 0x252d, 0x0498, 0x2531, 0x049a, 0x2535, 0x049c, 0x2539, 0x049e, 0x253d,
0x04a0, 0x2541, 0x04a2, 0x2545, 0x04a4, 0x2549, 0x04a6, 0x254d, 0x04a8, 0x2551, 0x04aa, 0x2555, 0x04ac, 0x2559, 0x04ae, 0x255d,
0x04b0, 0x2561, 0x04b2, 0x2565, 0x04b4, 0x2569, 0x04b6, 0x256d, 0x04b8, 0x2571, 0x04ba, 0x2575, 0x04bc, 0x2579, 0x253e, 0x467d,
0x08c0, 0x2981, 0x08c2, 0x2985, 0x08c4, 0x2989, 0x08c6, 0x298d, 0x08c8, 0x2991, 0x08ca, 0x2995, 0x08cc, 0x2999, 0x08ce, 0x299d,
0x08d0, 0x29a1, 0x08d2, 0x29a5, 0x08d4, 0x29a9, 0x08d6, 0x29ad, 0x08d8, 0x29b1, 0x08da, 0x29b5, 0x08dc, 0x29b9, 0x08de, 0x29bd,
0x0ce0, 0x2dc1, 0x0ce2, 0x2dc5, 0x0ce4, 0x2dc9, 0x0ce6, 0x2dcd, 0x0ce8, 0x2dd1, 0x0cea, 0x2dd5, 0x0cec, 0x2dd9, 0x0cee, 0x2ddd,
0x10f0, 0x31e1, 0x10f2, 0x31e5, 0x10f4, 0x31e9, 0x10f6, 0x31ed, 0x20f8, 0x41f1, 0x20fa, 0x41f5, 0x257c, 0x46f9, 0x29be, 0x4b7d
0x0000, 0x2001, 0x0002, 0x2005, 0x0004, 0x2009, 0x0006, 0x200d, 0x0008, 0x2011, 0x000a, 0x2015, 0x000c, 0x2019, 0x000e, 0x201d,
0x0010, 0x2021, 0x0012, 0x2025, 0x0014, 0x2029, 0x0016, 0x202d, 0x0018, 0x2031, 0x001a, 0x2035, 0x001c, 0x2039, 0x001e, 0x203d,
0x0020, 0x2041, 0x0022, 0x2045, 0x0024, 0x2049, 0x0026, 0x204d, 0x0028, 0x2051, 0x002a, 0x2055, 0x002c, 0x2059, 0x002e, 0x205d,
0x0030, 0x2061, 0x0032, 0x2065, 0x0034, 0x2069, 0x0036, 0x206d, 0x0038, 0x2071, 0x003a, 0x2075, 0x003c, 0x2079, 0x203e, 0x407d,
0x0040, 0x2081, 0x0042, 0x2085, 0x0044, 0x2089, 0x0046, 0x208d, 0x0048, 0x2091, 0x004a, 0x2095, 0x004c, 0x2099, 0x004e, 0x209d,
0x0050, 0x20a1, 0x0052, 0x20a5, 0x0054, 0x20a9, 0x0056, 0x20ad, 0x0058, 0x20b1, 0x005a, 0x20b5, 0x005c, 0x20b9, 0x005e, 0x20bd,
0x0060, 0x20c1, 0x0062, 0x20c5, 0x0064, 0x20c9, 0x0066, 0x20cd, 0x0068, 0x20d1, 0x006a, 0x20d5, 0x006c, 0x20d9, 0x006e, 0x20dd,
0x0070, 0x20e1, 0x0072, 0x20e5, 0x0074, 0x20e9, 0x0076, 0x20ed, 0x0078, 0x20f1, 0x007a, 0x20f5, 0x207c, 0x40f9, 0x20be, 0x417d,
0x0480, 0x2501, 0x0482, 0x2505, 0x0484, 0x2509, 0x0486, 0x250d, 0x0488, 0x2511, 0x048a, 0x2515, 0x048c, 0x2519, 0x048e, 0x251d,
0x0490, 0x2521, 0x0492, 0x2525, 0x0494, 0x2529, 0x0496, 0x252d, 0x0498, 0x2531, 0x049a, 0x2535, 0x049c, 0x2539, 0x049e, 0x253d,
0x04a0, 0x2541, 0x04a2, 0x2545, 0x04a4, 0x2549, 0x04a6, 0x254d, 0x04a8, 0x2551, 0x04aa, 0x2555, 0x04ac, 0x2559, 0x04ae, 0x255d,
0x04b0, 0x2561, 0x04b2, 0x2565, 0x04b4, 0x2569, 0x04b6, 0x256d, 0x04b8, 0x2571, 0x04ba, 0x2575, 0x04bc, 0x2579, 0x253e, 0x467d,
0x08c0, 0x2981, 0x08c2, 0x2985, 0x08c4, 0x2989, 0x08c6, 0x298d, 0x08c8, 0x2991, 0x08ca, 0x2995, 0x08cc, 0x2999, 0x08ce, 0x299d,
0x08d0, 0x29a1, 0x08d2, 0x29a5, 0x08d4, 0x29a9, 0x08d6, 0x29ad, 0x08d8, 0x29b1, 0x08da, 0x29b5, 0x08dc, 0x29b9, 0x08de, 0x29bd,
0x0ce0, 0x2dc1, 0x0ce2, 0x2dc5, 0x0ce4, 0x2dc9, 0x0ce6, 0x2dcd, 0x0ce8, 0x2dd1, 0x0cea, 0x2dd5, 0x0cec, 0x2dd9, 0x0cee, 0x2ddd,
0x10f0, 0x31e1, 0x10f2, 0x31e5, 0x10f4, 0x31e9, 0x10f6, 0x31ed, 0x20f8, 0x41f1, 0x20fa, 0x41f5, 0x257c, 0x46f9, 0x29be, 0x4b7d
};
/* hdlc_bitstuff_byte
@ -598,22 +598,22 @@ static inline void hdlc_frag(struct bc_state *bcs, unsigned inbits)
* bit 7 set if there are 5 or more "interior" consecutive '1' bits
*/
static const unsigned char bitcounts[256] = {
0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04,
0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x05,
0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04,
0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x80, 0x06,
0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04,
0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x05,
0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04,
0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x80, 0x81, 0x80, 0x07,
0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x10, 0x13, 0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x10, 0x14,
0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x10, 0x13, 0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x10, 0x15,
0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x10, 0x13, 0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x10, 0x14,
0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x10, 0x13, 0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x90, 0x16,
0x20, 0x21, 0x20, 0x22, 0x20, 0x21, 0x20, 0x23, 0x20, 0x21, 0x20, 0x22, 0x20, 0x21, 0x20, 0x24,
0x20, 0x21, 0x20, 0x22, 0x20, 0x21, 0x20, 0x23, 0x20, 0x21, 0x20, 0x22, 0x20, 0x21, 0x20, 0x25,
0x30, 0x31, 0x30, 0x32, 0x30, 0x31, 0x30, 0x33, 0x30, 0x31, 0x30, 0x32, 0x30, 0x31, 0x30, 0x34,
0x40, 0x41, 0x40, 0x42, 0x40, 0x41, 0x40, 0x43, 0x50, 0x51, 0x50, 0x52, 0x60, 0x61, 0x70, 0x78
0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04,
0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x05,
0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04,
0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x80, 0x06,
0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04,
0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x05,
0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04,
0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x80, 0x81, 0x80, 0x07,
0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x10, 0x13, 0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x10, 0x14,
0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x10, 0x13, 0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x10, 0x15,
0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x10, 0x13, 0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x10, 0x14,
0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x10, 0x13, 0x10, 0x11, 0x10, 0x12, 0x10, 0x11, 0x90, 0x16,
0x20, 0x21, 0x20, 0x22, 0x20, 0x21, 0x20, 0x23, 0x20, 0x21, 0x20, 0x22, 0x20, 0x21, 0x20, 0x24,
0x20, 0x21, 0x20, 0x22, 0x20, 0x21, 0x20, 0x23, 0x20, 0x21, 0x20, 0x22, 0x20, 0x21, 0x20, 0x25,
0x30, 0x31, 0x30, 0x32, 0x30, 0x31, 0x30, 0x33, 0x30, 0x31, 0x30, 0x32, 0x30, 0x31, 0x30, 0x34,
0x40, 0x41, 0x40, 0x42, 0x40, 0x41, 0x40, 0x43, 0x50, 0x51, 0x50, 0x52, 0x60, 0x61, 0x70, 0x78
};
/* hdlc_unpack

View File

@ -35,7 +35,7 @@ static ssize_t set_cidmode(struct device *dev, struct device_attribute *attr,
if (!isspace(*end++))
return -EINVAL;
if (value < 0 || value > 1)
return -EINVAL;
return -EINVAL;
if (mutex_lock_interruptible(&cs->mutex))
return -ERESTARTSYS;
@ -56,7 +56,7 @@ static ssize_t set_cidmode(struct device *dev, struct device_attribute *attr,
return count;
}
static DEVICE_ATTR(cidmode, S_IRUGO|S_IWUSR, show_cidmode, set_cidmode);
static DEVICE_ATTR(cidmode, S_IRUGO | S_IWUSR, show_cidmode, set_cidmode);
/* free sysfs for device */
void gigaset_free_dev_sysfs(struct cardstate *cs)

View File

@ -246,7 +246,7 @@ static int gigaset_write_cmd(struct cardstate *cs, struct cmdbuf_t *cb)
unsigned long flags;
gigaset_dbg_buffer(cs->mstate != MS_LOCKED ?
DEBUG_TRANSCMD : DEBUG_LOCKCMD,
DEBUG_TRANSCMD : DEBUG_LOCKCMD,
"CMD Transmit", cb->len, cb->buf);
spin_lock_irqsave(&cs->cmdlock, flags);
@ -773,8 +773,8 @@ static int __init ser_gigaset_init(void)
/* allocate memory for our driver state and initialize it */
driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS,
GIGASET_MODULENAME, GIGASET_DEVNAME,
&ops, THIS_MODULE);
GIGASET_MODULENAME, GIGASET_DEVNAME,
&ops, THIS_MODULE);
if (!driver)
goto error;

View File

@ -184,7 +184,7 @@ static int set_value(struct cardstate *cs, u8 req, u16 val)
(unsigned)req, (unsigned)val);
r = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x12, 0x41,
0xf /*?*/, 0, NULL, 0, 2000 /*?*/);
/* no idea what this does */
/* no idea what this does */
if (r < 0) {
dev_err(&udev->dev, "error %d on request 0x12\n", -r);
return r;
@ -365,7 +365,7 @@ static void gigaset_read_int_callback(struct urb *urb)
src = cs->hw.usb->rcvbuf;
if (unlikely(*src))
dev_warn(cs->dev,
"%s: There was no leading 0, but 0x%02x!\n",
"%s: There was no leading 0, but 0x%02x!\n",
__func__, (unsigned) *src);
++src; /* skip leading 0x00 */
--numbytes;
@ -465,7 +465,7 @@ static int send_cb(struct cardstate *cs, struct cmdbuf_t *cb)
usb_fill_bulk_urb(ucs->bulk_out_urb, ucs->udev,
usb_sndbulkpipe(ucs->udev,
ucs->bulk_out_endpointAddr & 0x0f),
ucs->bulk_out_endpointAddr & 0x0f),
cb->buf + cb->offset, count,
gigaset_write_bulk_callback, cs);
@ -499,7 +499,7 @@ static int gigaset_write_cmd(struct cardstate *cs, struct cmdbuf_t *cb)
unsigned long flags;
gigaset_dbg_buffer(cs->mstate != MS_LOCKED ?
DEBUG_TRANSCMD : DEBUG_LOCKCMD,
DEBUG_TRANSCMD : DEBUG_LOCKCMD,
"CMD Transmit", cb->len, cb->buf);
spin_lock_irqsave(&cs->cmdlock, flags);

View File

@ -44,12 +44,12 @@ static void avmcs_detach(struct pcmcia_device *p_dev);
static int avmcs_probe(struct pcmcia_device *p_dev)
{
/* General socket configuration */
p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
p_dev->config_index = 1;
p_dev->config_regs = PRESENT_OPTION;
/* General socket configuration */
p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
p_dev->config_index = 1;
p_dev->config_regs = PRESENT_OPTION;
return avmcs_config(p_dev);
return avmcs_config(p_dev);
} /* avmcs_attach */
@ -69,75 +69,75 @@ static int avmcs_configcheck(struct pcmcia_device *p_dev, void *priv_data)
static int avmcs_config(struct pcmcia_device *link)
{
int i = -1;
char devname[128];
int cardtype;
int (*addcard)(unsigned int port, unsigned irq);
int i = -1;
char devname[128];
int cardtype;
int (*addcard)(unsigned int port, unsigned irq);
devname[0] = 0;
if (link->prod_id[1])
strlcpy(devname, link->prod_id[1], sizeof(devname));
/*
* find IO port
*/
if (pcmcia_loop_config(link, avmcs_configcheck, NULL))
return -ENODEV;
do {
if (!link->irq) {
/* undo */
pcmcia_disable_device(link);
break;
}
devname[0] = 0;
if (link->prod_id[1])
strlcpy(devname, link->prod_id[1], sizeof(devname));
/*
* configure the PCMCIA socket
*/
i = pcmcia_enable_device(link);
* find IO port
*/
if (pcmcia_loop_config(link, avmcs_configcheck, NULL))
return -ENODEV;
do {
if (!link->irq) {
/* undo */
pcmcia_disable_device(link);
break;
}
/*
* configure the PCMCIA socket
*/
i = pcmcia_enable_device(link);
if (i != 0) {
pcmcia_disable_device(link);
break;
}
} while (0);
if (devname[0]) {
char *s = strrchr(devname, ' ');
if (!s)
s = devname;
else s++;
if (strcmp("M1", s) == 0) {
cardtype = AVM_CARDTYPE_M1;
} else if (strcmp("M2", s) == 0) {
cardtype = AVM_CARDTYPE_M2;
} else {
cardtype = AVM_CARDTYPE_B1;
}
} else
cardtype = AVM_CARDTYPE_B1;
/* If any step failed, release any partially configured state */
if (i != 0) {
pcmcia_disable_device(link);
break;
avmcs_release(link);
return -ENODEV;
}
} while (0);
if (devname[0]) {
char *s = strrchr(devname, ' ');
if (!s)
s = devname;
else s++;
if (strcmp("M1", s) == 0) {
cardtype = AVM_CARDTYPE_M1;
} else if (strcmp("M2", s) == 0) {
cardtype = AVM_CARDTYPE_M2;
} else {
cardtype = AVM_CARDTYPE_B1;
}
} else
cardtype = AVM_CARDTYPE_B1;
/* If any step failed, release any partially configured state */
if (i != 0) {
avmcs_release(link);
return -ENODEV;
}
switch (cardtype) {
case AVM_CARDTYPE_M1: addcard = b1pcmcia_addcard_m1; break;
case AVM_CARDTYPE_M2: addcard = b1pcmcia_addcard_m2; break;
switch (cardtype) {
case AVM_CARDTYPE_M1: addcard = b1pcmcia_addcard_m1; break;
case AVM_CARDTYPE_M2: addcard = b1pcmcia_addcard_m2; break;
default:
case AVM_CARDTYPE_B1: addcard = b1pcmcia_addcard_b1; break;
}
if ((i = (*addcard)(link->resource[0]->start, link->irq)) < 0) {
dev_err(&link->dev,
"avm_cs: failed to add AVM-Controller at i/o %#x, irq %d\n",
(unsigned int) link->resource[0]->start, link->irq);
avmcs_release(link);
return -ENODEV;
}
return 0;
case AVM_CARDTYPE_B1: addcard = b1pcmcia_addcard_b1; break;
}
if ((i = (*addcard)(link->resource[0]->start, link->irq)) < 0) {
dev_err(&link->dev,
"avm_cs: failed to add AVM-Controller at i/o %#x, irq %d\n",
(unsigned int) link->resource[0]->start, link->irq);
avmcs_release(link);
return -ENODEV;
}
return 0;
} /* avmcs_config */

View File

@ -44,16 +44,16 @@ enum avmcardtype {
};
typedef struct avmcard_dmabuf {
long size;
u8 *dmabuf;
dma_addr_t dmaaddr;
long size;
u8 *dmabuf;
dma_addr_t dmaaddr;
} avmcard_dmabuf;
typedef struct avmcard_dmainfo {
u32 recvlen;
avmcard_dmabuf recvbuf;
avmcard_dmabuf recvbuf;
avmcard_dmabuf sendbuf;
avmcard_dmabuf sendbuf;
struct sk_buff_head send_queue;
struct pci_dev *pcidev;
@ -61,22 +61,22 @@ typedef struct avmcard_dmainfo {
typedef struct avmctrl_info {
char cardname[32];
int versionlen;
char versionbuf[1024];
char *version[AVM_MAXVERSION];
char infobuf[128]; /* for function procinfo */
struct avmcard *card;
struct capi_ctr capi_ctrl;
struct list_head ncci_head;
} avmctrl_info;
typedef struct avmcard {
char name[32];
spinlock_t lock;
unsigned int port;
unsigned irq;
@ -103,95 +103,95 @@ typedef struct avmcard {
extern int b1_irq_table[16];
/*
* LLI Messages to the ISDN-ControllerISDN Controller
* LLI Messages to the ISDN-ControllerISDN Controller
*/
#define SEND_POLL 0x72 /*
* after load <- RECEIVE_POLL
* after load <- RECEIVE_POLL
*/
#define SEND_INIT 0x11 /*
* first message <- RECEIVE_INIT
* int32 NumApplications int32
* NumNCCIs int32 BoardNumber
* first message <- RECEIVE_INIT
* int32 NumApplications int32
* NumNCCIs int32 BoardNumber
*/
#define SEND_REGISTER 0x12 /*
* register an application int32
* ApplIDId int32 NumMessages
* int32 NumB3Connections int32
* NumB3Blocks int32 B3Size
*
* AnzB3Connection != 0 &&
* AnzB3Blocks >= 1 && B3Size >= 1
* register an application int32
* ApplIDId int32 NumMessages
* int32 NumB3Connections int32
* NumB3Blocks int32 B3Size
*
* AnzB3Connection != 0 &&
* AnzB3Blocks >= 1 && B3Size >= 1
*/
#define SEND_RELEASE 0x14 /*
* deregister an application int32
* ApplID
* deregister an application int32
* ApplID
*/
#define SEND_MESSAGE 0x15 /*
* send capi-message int32 length
* capi-data ...
* send capi-message int32 length
* capi-data ...
*/
#define SEND_DATA_B3_REQ 0x13 /*
* send capi-data-message int32
* MsgLength capi-data ... int32
* B3Length data ....
* send capi-data-message int32
* MsgLength capi-data ... int32
* B3Length data ....
*/
#define SEND_CONFIG 0x21 /*
*/
*/
#define SEND_POLLACK 0x73 /* T1 Watchdog */
/*
* LLI Messages from the ISDN-ControllerISDN Controller
* LLI Messages from the ISDN-ControllerISDN Controller
*/
#define RECEIVE_POLL 0x32 /*
* <- after SEND_POLL
* <- after SEND_POLL
*/
#define RECEIVE_INIT 0x27 /*
* <- after SEND_INIT int32 length
* byte total length b1struct board
* driver revision b1struct card
* type b1struct reserved b1struct
* serial number b1struct driver
* capability b1struct d-channel
* protocol b1struct CAPI-2.0
* profile b1struct capi version
* <- after SEND_INIT int32 length
* byte total length b1struct board
* driver revision b1struct card
* type b1struct reserved b1struct
* serial number b1struct driver
* capability b1struct d-channel
* protocol b1struct CAPI-2.0
* profile b1struct capi version
*/
#define RECEIVE_MESSAGE 0x21 /*
* <- after SEND_MESSAGE int32
* AppllID int32 Length capi-data
* ....
* <- after SEND_MESSAGE int32
* AppllID int32 Length capi-data
* ....
*/
#define RECEIVE_DATA_B3_IND 0x22 /*
* received data int32 AppllID
* int32 Length capi-data ...
* int32 B3Length data ...
* received data int32 AppllID
* int32 Length capi-data ...
* int32 B3Length data ...
*/
#define RECEIVE_START 0x23 /*
* Handshake
* Handshake
*/
#define RECEIVE_STOP 0x24 /*
* Handshake
* Handshake
*/
#define RECEIVE_NEW_NCCI 0x25 /*
* int32 AppllID int32 NCCI int32
* WindowSize
* int32 AppllID int32 NCCI int32
* WindowSize
*/
#define RECEIVE_FREE_NCCI 0x26 /*
* int32 AppllID int32 NCCI
* int32 AppllID int32 NCCI
*/
#define RECEIVE_RELEASE 0x26 /*
* int32 AppllID int32 0xffffffff
* int32 AppllID int32 0xffffffff
*/
#define RECEIVE_TASK_READY 0x31 /*
* int32 tasknr
* int32 Length Taskname ...
* int32 tasknr
* int32 Length Taskname ...
*/
#define RECEIVE_DEBUGMSG 0x71 /*
* int32 Length message
*
* int32 Length message
*
*/
#define RECEIVE_POLLDWORD 0x75 /* t1pci in dword mode */
@ -264,7 +264,7 @@ static inline void b1_put_byte(unsigned int base, unsigned char val)
static inline int b1_save_put_byte(unsigned int base, unsigned char val)
{
unsigned long stop = jiffies + 2 * HZ;
while (!b1_tx_empty(base) && time_before(jiffies,stop));
while (!b1_tx_empty(base) && time_before(jiffies, stop));
if (!b1_tx_empty(base)) return -1;
b1outp(base, B1_WRITE, val);
return 0;
@ -298,21 +298,21 @@ static inline void b1_put_slice(unsigned int base,
}
static void b1_wr_reg(unsigned int base,
unsigned int reg,
unsigned int reg,
unsigned int value)
{
b1_put_byte(base, WRITE_REGISTER);
b1_put_word(base, reg);
b1_put_word(base, value);
b1_put_word(base, reg);
b1_put_word(base, value);
}
static inline unsigned int b1_rd_reg(unsigned int base,
unsigned int reg)
unsigned int reg)
{
b1_put_byte(base, READ_REGISTER);
b1_put_word(base, reg);
return b1_get_word(base);
b1_put_word(base, reg);
return b1_get_word(base);
}
static inline void b1_reset(unsigned int base)
@ -338,13 +338,13 @@ static inline void b1_set_test_bit(unsigned int base,
enum avmcardtype cardtype,
int onoff)
{
b1_wr_reg(base, B1_STAT0(cardtype), onoff ? 0x21 : 0x20);
b1_wr_reg(base, B1_STAT0(cardtype), onoff ? 0x21 : 0x20);
}
static inline int b1_get_test_bit(unsigned int base,
enum avmcardtype cardtype)
enum avmcardtype cardtype)
{
return (b1_rd_reg(base, B1_STAT0(cardtype)) & 0x01) != 0;
return (b1_rd_reg(base, B1_STAT0(cardtype)) & 0x01) != 0;
}
/* ---------------------------------------------------------------- */
@ -391,7 +391,7 @@ static inline void t1outp(unsigned int base,
}
static inline unsigned char t1inp(unsigned int base,
unsigned short offset)
unsigned short offset)
{
return inb(base + offset);
}
@ -415,42 +415,42 @@ static inline unsigned int t1_get_slice(unsigned int base,
#endif
len = i = b1_get_word(base);
if (t1_isfastlink(base)) {
if (t1_isfastlink(base)) {
int status;
while (i > 0) {
status = t1_fifostatus(base) & (T1F_IREADY|T1F_IHALF);
status = t1_fifostatus(base) & (T1F_IREADY | T1F_IHALF);
if (i >= FIFO_INPBSIZE) status |= T1F_IFULL;
switch (status) {
case T1F_IREADY|T1F_IHALF|T1F_IFULL:
insb(base+B1_READ, dp, FIFO_INPBSIZE);
dp += FIFO_INPBSIZE;
i -= FIFO_INPBSIZE;
case T1F_IREADY | T1F_IHALF | T1F_IFULL:
insb(base + B1_READ, dp, FIFO_INPBSIZE);
dp += FIFO_INPBSIZE;
i -= FIFO_INPBSIZE;
#ifdef FASTLINK_DEBUG
wcnt += FIFO_INPBSIZE;
wcnt += FIFO_INPBSIZE;
#endif
break;
case T1F_IREADY|T1F_IHALF:
insb(base+B1_READ,dp, i);
break;
case T1F_IREADY | T1F_IHALF:
insb(base + B1_READ, dp, i);
#ifdef FASTLINK_DEBUG
wcnt += i;
wcnt += i;
#endif
dp += i;
i = 0;
break;
default:
*dp++ = b1_get_byte(base);
i--;
dp += i;
i = 0;
break;
default:
*dp++ = b1_get_byte(base);
i--;
#ifdef FASTLINK_DEBUG
bcnt++;
bcnt++;
#endif
break;
break;
}
}
}
#ifdef FASTLINK_DEBUG
if (wcnt)
printk(KERN_DEBUG "b1lli(0x%x): get_slice l=%d w=%d b=%d\n",
base, len, wcnt, bcnt);
if (wcnt)
printk(KERN_DEBUG "b1lli(0x%x): get_slice l=%d w=%d b=%d\n",
base, len, wcnt, bcnt);
#endif
} else {
while (i-- > 0)
@ -464,26 +464,26 @@ static inline void t1_put_slice(unsigned int base,
{
unsigned i = len;
b1_put_word(base, i);
if (t1_isfastlink(base)) {
if (t1_isfastlink(base)) {
int status;
while (i > 0) {
status = t1_fifostatus(base) & (T1F_OREADY|T1F_OHALF);
status = t1_fifostatus(base) & (T1F_OREADY | T1F_OHALF);
if (i >= FIFO_OUTBSIZE) status |= T1F_OEMPTY;
switch (status) {
case T1F_OREADY|T1F_OHALF|T1F_OEMPTY:
outsb(base+B1_WRITE, dp, FIFO_OUTBSIZE);
dp += FIFO_OUTBSIZE;
i -= FIFO_OUTBSIZE;
break;
case T1F_OREADY|T1F_OHALF:
outsb(base+B1_WRITE, dp, i);
dp += i;
i = 0;
break;
default:
b1_put_byte(base, *dp++);
i--;
break;
case T1F_OREADY | T1F_OHALF | T1F_OEMPTY:
outsb(base + B1_WRITE, dp, FIFO_OUTBSIZE);
dp += FIFO_OUTBSIZE;
i -= FIFO_OUTBSIZE;
break;
case T1F_OREADY | T1F_OHALF:
outsb(base + B1_WRITE, dp, i);
dp += i;
i = 0;
break;
default:
b1_put_byte(base, *dp++);
i--;
break;
}
}
} else {
@ -494,18 +494,18 @@ static inline void t1_put_slice(unsigned int base,
static inline void t1_disable_irq(unsigned int base)
{
t1outp(base, T1_IRQMASTER, 0x00);
t1outp(base, T1_IRQMASTER, 0x00);
}
static inline void t1_reset(unsigned int base)
{
/* reset T1 Controller */
b1_reset(base);
/* disable irq on HEMA */
t1outp(base, B1_INSTAT, 0x00);
t1outp(base, B1_OUTSTAT, 0x00);
t1outp(base, T1_IRQMASTER, 0x00);
/* reset HEMA board configuration */
/* reset T1 Controller */
b1_reset(base);
/* disable irq on HEMA */
t1outp(base, B1_INSTAT, 0x00);
t1outp(base, B1_OUTSTAT, 0x00);
t1outp(base, T1_IRQMASTER, 0x00);
/* reset HEMA board configuration */
t1outp(base, T1_RESETBOARD, 0xf);
}
@ -513,29 +513,29 @@ static inline void b1_setinterrupt(unsigned int base, unsigned irq,
enum avmcardtype cardtype)
{
switch (cardtype) {
case avm_t1isa:
t1outp(base, B1_INSTAT, 0x00);
t1outp(base, B1_INSTAT, 0x02);
t1outp(base, T1_IRQMASTER, 0x08);
break;
case avm_b1isa:
b1outp(base, B1_INSTAT, 0x00);
b1outp(base, B1_RESET, b1_irq_table[irq]);
b1outp(base, B1_INSTAT, 0x02);
break;
default:
case avm_m1:
case avm_m2:
case avm_b1pci:
b1outp(base, B1_INSTAT, 0x00);
b1outp(base, B1_RESET, 0xf0);
b1outp(base, B1_INSTAT, 0x02);
break;
case avm_c4:
case avm_t1pci:
b1outp(base, B1_RESET, 0xf0);
break;
}
case avm_t1isa:
t1outp(base, B1_INSTAT, 0x00);
t1outp(base, B1_INSTAT, 0x02);
t1outp(base, T1_IRQMASTER, 0x08);
break;
case avm_b1isa:
b1outp(base, B1_INSTAT, 0x00);
b1outp(base, B1_RESET, b1_irq_table[irq]);
b1outp(base, B1_INSTAT, 0x02);
break;
default:
case avm_m1:
case avm_m2:
case avm_b1pci:
b1outp(base, B1_INSTAT, 0x00);
b1outp(base, B1_RESET, 0xf0);
b1outp(base, B1_INSTAT, 0x02);
break;
case avm_c4:
case avm_t1pci:
b1outp(base, B1_RESET, 0xf0);
break;
}
}
/* b1.c */
@ -543,14 +543,14 @@ avmcard *b1_alloc_card(int nr_controllers);
void b1_free_card(avmcard *card);
int b1_detect(unsigned int base, enum avmcardtype cardtype);
void b1_getrevision(avmcard *card);
int b1_load_t4file(avmcard *card, capiloaddatapart * t4file);
int b1_load_config(avmcard *card, capiloaddatapart * config);
int b1_load_t4file(avmcard *card, capiloaddatapart *t4file);
int b1_load_config(avmcard *card, capiloaddatapart *config);
int b1_loaded(avmcard *card);
int b1_load_firmware(struct capi_ctr *ctrl, capiloaddata *data);
void b1_reset_ctr(struct capi_ctr *ctrl);
void b1_register_appl(struct capi_ctr *ctrl, u16 appl,
capi_register_params *rp);
capi_register_params *rp);
void b1_release_appl(struct capi_ctr *ctrl, u16 appl);
u16 b1_send_message(struct capi_ctr *ctrl, struct sk_buff *skb);
void b1_parse_version(avmctrl_info *card);
@ -572,8 +572,8 @@ int b1dma_load_firmware(struct capi_ctr *ctrl, capiloaddata *data);
void b1dma_reset_ctr(struct capi_ctr *ctrl);
void b1dma_remove_ctr(struct capi_ctr *ctrl);
void b1dma_register_appl(struct capi_ctr *ctrl,
u16 appl,
capi_register_params *rp);
u16 appl,
capi_register_params *rp);
void b1dma_release_appl(struct capi_ctr *ctrl, u16 appl);
u16 b1dma_send_message(struct capi_ctr *ctrl, struct sk_buff *skb);
extern const struct file_operations b1dmactl_proc_fops;

View File

@ -1,7 +1,7 @@
/* $Id: b1.c,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $
*
*
* Common module for AVM B1 cards.
*
*
* Copyright 1999 by Carsten Paeth <calle@calle.de>
*
* This software may be used and distributed according to the terms
@ -60,7 +60,7 @@ int b1_irq_table[16] =
112, /* irq 15 */
};
/* ------------------------------------------------------------- */
/* ------------------------------------------------------------- */
avmcard *b1_alloc_card(int nr_controllers)
{
@ -104,13 +104,13 @@ int b1_detect(unsigned int base, enum avmcardtype cardtype)
int onoff, i;
/*
* Statusregister 0000 00xx
* Statusregister 0000 00xx
*/
if ((inb(base + B1_INSTAT) & 0xfc)
|| (inb(base + B1_OUTSTAT) & 0xfc))
return 1;
/*
* Statusregister 0000 001x
* Statusregister 0000 001x
*/
b1outp(base, B1_INSTAT, 0x2); /* enable irq */
/* b1outp(base, B1_OUTSTAT, 0x2); */
@ -118,38 +118,38 @@ int b1_detect(unsigned int base, enum avmcardtype cardtype)
/* || (inb(base + B1_OUTSTAT) & 0xfe) != 0x2 */)
return 2;
/*
* Statusregister 0000 000x
* Statusregister 0000 000x
*/
b1outp(base, B1_INSTAT, 0x0); /* disable irq */
b1outp(base, B1_OUTSTAT, 0x0);
if ((inb(base + B1_INSTAT) & 0xfe)
|| (inb(base + B1_OUTSTAT) & 0xfe))
return 3;
for (onoff = !0, i= 0; i < 10 ; i++) {
for (onoff = !0, i = 0; i < 10; i++) {
b1_set_test_bit(base, cardtype, onoff);
if (b1_get_test_bit(base, cardtype) != onoff)
return 4;
return 4;
onoff = !onoff;
}
if (cardtype == avm_m1)
return 0;
return 0;
if ((b1_rd_reg(base, B1_STAT1(cardtype)) & 0x0f) != 0x01)
return 5;
if ((b1_rd_reg(base, B1_STAT1(cardtype)) & 0x0f) != 0x01)
return 5;
return 0;
}
void b1_getrevision(avmcard *card)
{
card->class = inb(card->port + B1_ANALYSE);
card->revision = inb(card->port + B1_REVISION);
card->class = inb(card->port + B1_ANALYSE);
card->revision = inb(card->port + B1_REVISION);
}
#define FWBUF_SIZE 256
int b1_load_t4file(avmcard *card, capiloaddatapart * t4file)
int b1_load_t4file(avmcard *card, capiloaddatapart *t4file)
{
unsigned char buf[FWBUF_SIZE];
unsigned char *dp;
@ -168,7 +168,7 @@ int b1_load_t4file(avmcard *card, capiloaddatapart * t4file)
for (i = 0; i < FWBUF_SIZE; i++)
if (b1_save_put_byte(base, buf[i]) < 0) {
printk(KERN_ERR "%s: corrupted firmware file ?\n",
card->name);
card->name);
return -EIO;
}
left -= FWBUF_SIZE;
@ -184,14 +184,14 @@ int b1_load_t4file(avmcard *card, capiloaddatapart * t4file)
for (i = 0; i < left; i++)
if (b1_save_put_byte(base, buf[i]) < 0) {
printk(KERN_ERR "%s: corrupted firmware file ?\n",
card->name);
card->name);
return -EIO;
}
}
return 0;
}
int b1_load_config(avmcard *card, capiloaddatapart * config)
int b1_load_config(avmcard *card, capiloaddatapart *config)
{
unsigned char buf[FWBUF_SIZE];
unsigned char *dp;
@ -202,9 +202,9 @@ int b1_load_config(avmcard *card, capiloaddatapart * config)
left = config->len;
if (left) {
b1_put_byte(base, SEND_CONFIG);
b1_put_word(base, 1);
b1_put_word(base, 1);
b1_put_byte(base, SEND_CONFIG);
b1_put_word(base, left);
b1_put_word(base, left);
}
while (left > FWBUF_SIZE) {
if (config->user) {
@ -215,7 +215,7 @@ int b1_load_config(avmcard *card, capiloaddatapart * config)
}
for (i = 0; i < FWBUF_SIZE; ) {
b1_put_byte(base, SEND_CONFIG);
for (j=0; j < 4; j++) {
for (j = 0; j < 4; j++) {
b1_put_byte(base, buf[i++]);
}
}
@ -231,7 +231,7 @@ int b1_load_config(avmcard *card, capiloaddatapart * config)
}
for (i = 0; i < left; ) {
b1_put_byte(base, SEND_CONFIG);
for (j=0; j < 4; j++) {
for (j = 0; j < 4; j++) {
if (i < left)
b1_put_byte(base, buf[i++]);
else
@ -255,7 +255,7 @@ int b1_loaded(avmcard *card)
}
if (!b1_tx_empty(base)) {
printk(KERN_ERR "%s: b1_loaded: tx err, corrupted t4 file ?\n",
card->name);
card->name);
return 0;
}
b1_put_byte(base, SEND_POLL);
@ -265,7 +265,7 @@ int b1_loaded(avmcard *card)
return 1;
}
printk(KERN_ERR "%s: b1_loaded: got 0x%x, firmware not running\n",
card->name, ans);
card->name, ans);
return 0;
}
}
@ -288,7 +288,7 @@ int b1_load_firmware(struct capi_ctr *ctrl, capiloaddata *data)
if ((retval = b1_load_t4file(card, &data->firmware))) {
b1_reset(port);
printk(KERN_ERR "%s: failed to load t4file!!\n",
card->name);
card->name);
return retval;
}
@ -298,7 +298,7 @@ int b1_load_firmware(struct capi_ctr *ctrl, capiloaddata *data)
if ((retval = b1_load_config(card, &data->configuration))) {
b1_reset(port);
printk(KERN_ERR "%s: failed to load config!!\n",
card->name);
card->name);
return retval;
}
}
@ -312,7 +312,7 @@ int b1_load_firmware(struct capi_ctr *ctrl, capiloaddata *data)
b1_setinterrupt(port, card->irq, card->cardtype);
b1_put_byte(port, SEND_INIT);
b1_put_word(port, CAPI_MAXAPPL);
b1_put_word(port, AVM_NCCI_PER_CHANNEL*2);
b1_put_word(port, AVM_NCCI_PER_CHANNEL * 2);
b1_put_word(port, ctrl->cnr - 1);
spin_unlock_irqrestore(&card->lock, flags);
@ -337,8 +337,8 @@ void b1_reset_ctr(struct capi_ctr *ctrl)
}
void b1_register_appl(struct capi_ctr *ctrl,
u16 appl,
capi_register_params *rp)
u16 appl,
capi_register_params *rp)
{
avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);
avmcard *card = cinfo->card;
@ -353,7 +353,7 @@ void b1_register_appl(struct capi_ctr *ctrl,
spin_lock_irqsave(&card->lock, flags);
b1_put_byte(port, SEND_REGISTER);
b1_put_word(port, appl);
b1_put_word(port, 1024 * (nconn+1));
b1_put_word(port, 1024 * (nconn + 1));
b1_put_word(port, nconn);
b1_put_word(port, rp->datablkcnt);
b1_put_word(port, rp->datablklen);
@ -430,7 +430,7 @@ void b1_parse_version(avmctrl_info *cinfo)
cinfo->version[j] = &cinfo->versionbuf[i + 1];
strlcpy(ctrl->serial, cinfo->version[VER_SERIAL], sizeof(ctrl->serial));
memcpy(&ctrl->profile, cinfo->version[VER_PROFILE],sizeof(capi_profile));
memcpy(&ctrl->profile, cinfo->version[VER_PROFILE], sizeof(capi_profile));
strlcpy(ctrl->manu, "AVM GmbH", sizeof(ctrl->manu));
dversion = cinfo->version[VER_DRIVER];
ctrl->version.majorversion = 2;
@ -439,49 +439,49 @@ void b1_parse_version(avmctrl_info *cinfo)
ctrl->version.majormanuversion |= ((dversion[2] - '0') & 0xf);
ctrl->version.minormanuversion = (dversion[3] - '0') << 4;
ctrl->version.minormanuversion |=
(dversion[5] - '0') * 10 + ((dversion[6] - '0') & 0xf);
(dversion[5] - '0') * 10 + ((dversion[6] - '0') & 0xf);
profp = &ctrl->profile;
flag = ((u8 *)(profp->manu))[1];
switch (flag) {
case 0: if (cinfo->version[VER_CARDTYPE])
strcpy(cinfo->cardname, cinfo->version[VER_CARDTYPE]);
else strcpy(cinfo->cardname, "B1");
strcpy(cinfo->cardname, cinfo->version[VER_CARDTYPE]);
else strcpy(cinfo->cardname, "B1");
break;
case 3: strcpy(cinfo->cardname,"PCMCIA B"); break;
case 4: strcpy(cinfo->cardname,"PCMCIA M1"); break;
case 5: strcpy(cinfo->cardname,"PCMCIA M2"); break;
case 6: strcpy(cinfo->cardname,"B1 V3.0"); break;
case 7: strcpy(cinfo->cardname,"B1 PCI"); break;
case 3: strcpy(cinfo->cardname, "PCMCIA B"); break;
case 4: strcpy(cinfo->cardname, "PCMCIA M1"); break;
case 5: strcpy(cinfo->cardname, "PCMCIA M2"); break;
case 6: strcpy(cinfo->cardname, "B1 V3.0"); break;
case 7: strcpy(cinfo->cardname, "B1 PCI"); break;
default: sprintf(cinfo->cardname, "AVM?%u", (unsigned int)flag); break;
}
printk(KERN_NOTICE "%s: card %d \"%s\" ready.\n",
card->name, ctrl->cnr, cinfo->cardname);
}
printk(KERN_NOTICE "%s: card %d \"%s\" ready.\n",
card->name, ctrl->cnr, cinfo->cardname);
flag = ((u8 *)(profp->manu))[3];
if (flag)
flag = ((u8 *)(profp->manu))[3];
if (flag)
printk(KERN_NOTICE "%s: card %d Protocol:%s%s%s%s%s%s%s\n",
card->name,
ctrl->cnr,
(flag & 0x01) ? " DSS1" : "",
(flag & 0x02) ? " CT1" : "",
(flag & 0x04) ? " VN3" : "",
(flag & 0x08) ? " NI1" : "",
(flag & 0x10) ? " AUSTEL" : "",
(flag & 0x20) ? " ESS" : "",
(flag & 0x40) ? " 1TR6" : ""
card->name,
ctrl->cnr,
(flag & 0x01) ? " DSS1" : "",
(flag & 0x02) ? " CT1" : "",
(flag & 0x04) ? " VN3" : "",
(flag & 0x08) ? " NI1" : "",
(flag & 0x10) ? " AUSTEL" : "",
(flag & 0x20) ? " ESS" : "",
(flag & 0x40) ? " 1TR6" : ""
);
flag = ((u8 *)(profp->manu))[5];
flag = ((u8 *)(profp->manu))[5];
if (flag)
printk(KERN_NOTICE "%s: card %d Linetype:%s%s%s%s\n",
card->name,
ctrl->cnr,
(flag & 0x01) ? " point to point" : "",
(flag & 0x02) ? " point to multipoint" : "",
(flag & 0x08) ? " leased line without D-channel" : "",
(flag & 0x04) ? " leased line with D-channel" : ""
card->name,
ctrl->cnr,
(flag & 0x01) ? " point to point" : "",
(flag & 0x02) ? " point to multipoint" : "",
(flag & 0x08) ? " leased line without D-channel" : "",
(flag & 0x04) ? " leased line with D-channel" : ""
);
}
@ -521,13 +521,13 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr)
spin_unlock_irqrestore(&card->lock, flags);
if (MsgLen < 30) { /* not CAPI 64Bit */
memset(card->msgbuf+MsgLen, 0, 30-MsgLen);
memset(card->msgbuf + MsgLen, 0, 30-MsgLen);
MsgLen = 30;
CAPIMSG_SETLEN(card->msgbuf, 30);
}
if (!(skb = alloc_skb(DataB3Len + MsgLen, GFP_ATOMIC))) {
printk(KERN_ERR "%s: incoming packet dropped\n",
card->name);
card->name);
} else {
memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen);
memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len);
@ -541,7 +541,7 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr)
MsgLen = b1_get_slice(card->port, card->msgbuf);
if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) {
printk(KERN_ERR "%s: incoming packet dropped\n",
card->name);
card->name);
spin_unlock_irqrestore(&card->lock, flags);
} else {
memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen);
@ -573,7 +573,7 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr)
break;
case RECEIVE_START:
/* b1_put_byte(card->port, SEND_POLLACK); */
/* b1_put_byte(card->port, SEND_POLLACK); */
spin_unlock_irqrestore(&card->lock, flags);
capi_ctr_resume_output(ctrl);
break;
@ -600,24 +600,24 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr)
MsgLen = b1_get_slice(card->port, card->msgbuf);
spin_unlock_irqrestore(&card->lock, flags);
card->msgbuf[MsgLen] = 0;
while ( MsgLen > 0
&& ( card->msgbuf[MsgLen-1] == '\n'
|| card->msgbuf[MsgLen-1] == '\r')) {
card->msgbuf[MsgLen-1] = 0;
while (MsgLen > 0
&& (card->msgbuf[MsgLen - 1] == '\n'
|| card->msgbuf[MsgLen - 1] == '\r')) {
card->msgbuf[MsgLen - 1] = 0;
MsgLen--;
}
printk(KERN_INFO "%s: task %d \"%s\" ready.\n",
card->name, ApplId, card->msgbuf);
card->name, ApplId, card->msgbuf);
break;
case RECEIVE_DEBUGMSG:
MsgLen = b1_get_slice(card->port, card->msgbuf);
spin_unlock_irqrestore(&card->lock, flags);
card->msgbuf[MsgLen] = 0;
while ( MsgLen > 0
&& ( card->msgbuf[MsgLen-1] == '\n'
|| card->msgbuf[MsgLen-1] == '\r')) {
card->msgbuf[MsgLen-1] = 0;
while (MsgLen > 0
&& (card->msgbuf[MsgLen - 1] == '\n'
|| card->msgbuf[MsgLen - 1] == '\r')) {
card->msgbuf[MsgLen - 1] = 0;
MsgLen--;
}
printk(KERN_INFO "%s: DEBUG: %s\n", card->name, card->msgbuf);
@ -630,7 +630,7 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr)
default:
spin_unlock_irqrestore(&card->lock, flags);
printk(KERN_ERR "%s: b1_interrupt: 0x%x ???\n",
card->name, b1cmd);
card->name, b1cmd);
return IRQ_HANDLED;
}
return IRQ_HANDLED;
@ -671,29 +671,29 @@ static int b1ctl_proc_show(struct seq_file *m, void *v)
seq_printf(m, "%-16s %s\n", "ver_serial", s);
if (card->cardtype != avm_m1) {
flag = ((u8 *)(ctrl->profile.manu))[3];
if (flag)
flag = ((u8 *)(ctrl->profile.manu))[3];
if (flag)
seq_printf(m, "%-16s%s%s%s%s%s%s%s\n",
"protocol",
(flag & 0x01) ? " DSS1" : "",
(flag & 0x02) ? " CT1" : "",
(flag & 0x04) ? " VN3" : "",
(flag & 0x08) ? " NI1" : "",
(flag & 0x10) ? " AUSTEL" : "",
(flag & 0x20) ? " ESS" : "",
(flag & 0x40) ? " 1TR6" : ""
);
"protocol",
(flag & 0x01) ? " DSS1" : "",
(flag & 0x02) ? " CT1" : "",
(flag & 0x04) ? " VN3" : "",
(flag & 0x08) ? " NI1" : "",
(flag & 0x10) ? " AUSTEL" : "",
(flag & 0x20) ? " ESS" : "",
(flag & 0x40) ? " 1TR6" : ""
);
}
if (card->cardtype != avm_m1) {
flag = ((u8 *)(ctrl->profile.manu))[5];
flag = ((u8 *)(ctrl->profile.manu))[5];
if (flag)
seq_printf(m, "%-16s%s%s%s%s\n",
"linetype",
(flag & 0x01) ? " point to point" : "",
(flag & 0x02) ? " point to multipoint" : "",
(flag & 0x08) ? " leased line without D-channel" : "",
(flag & 0x04) ? " leased line with D-channel" : ""
);
"linetype",
(flag & 0x01) ? " point to point" : "",
(flag & 0x02) ? " point to multipoint" : "",
(flag & 0x08) ? " leased line without D-channel" : "",
(flag & 0x04) ? " leased line with D-channel" : ""
);
}
seq_printf(m, "%-16s %s\n", "cardname", cinfo->cardname);
@ -750,12 +750,12 @@ avmcard_dma_alloc(char *name, struct pci_dev *pdev, long rsize, long ssize)
return p;
err_free_consistent:
err_free_consistent:
pci_free_consistent(p->pcidev, p->recvbuf.size,
p->recvbuf.dmabuf, p->recvbuf.dmaaddr);
err_kfree:
err_kfree:
kfree(p);
err:
err:
return NULL;
}
@ -800,7 +800,7 @@ static int __init b1_init(void)
if ((p = strchr(revision, ':')) != NULL && p[1]) {
strlcpy(rev, p + 2, 32);
if ((p = strchr(rev, '$')) != NULL && p > rev)
*(p-1) = 0;
*(p - 1) = 0;
} else
strcpy(rev, "1.0");

View File

@ -1,9 +1,9 @@
/* $Id: b1dma.c,v 1.1.2.3 2004/02/10 01:07:12 keil Exp $
*
*
* Common module for AVM B1 cards that support dma with AMCC
*
*
* Copyright 2000 by Carsten Paeth <calle@calle.de>
*
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
@ -110,11 +110,11 @@ static int b1dma_tolink(avmcard *card, void *buf, unsigned int len)
unsigned long stop = jiffies + 1 * HZ; /* maximum wait time 1 sec */
unsigned char *s = (unsigned char *)buf;
while (len--) {
while ( !b1dma_tx_empty(card->port)
while (!b1dma_tx_empty(card->port)
&& time_before(jiffies, stop));
if (!b1dma_tx_empty(card->port))
if (!b1dma_tx_empty(card->port))
return -1;
t1outp(card->port, 0x01, *s++);
t1outp(card->port, 0x01, *s++);
}
return 0;
}
@ -124,11 +124,11 @@ static int b1dma_fromlink(avmcard *card, void *buf, unsigned int len)
unsigned long stop = jiffies + 1 * HZ; /* maximum wait time 1 sec */
unsigned char *s = (unsigned char *)buf;
while (len--) {
while ( !b1dma_rx_full(card->port)
while (!b1dma_rx_full(card->port)
&& time_before(jiffies, stop));
if (!b1dma_rx_full(card->port))
if (!b1dma_rx_full(card->port))
return -1;
*s++ = t1inp(card->port, 0x00);
*s++ = t1inp(card->port, 0x00);
}
return 0;
}
@ -136,7 +136,7 @@ static int b1dma_fromlink(avmcard *card, void *buf, unsigned int len)
static int WriteReg(avmcard *card, u32 reg, u8 val)
{
u8 cmd = 0x00;
if ( b1dma_tolink(card, &cmd, 1) == 0
if (b1dma_tolink(card, &cmd, 1) == 0
&& b1dma_tolink(card, &reg, 4) == 0) {
u32 tmp = val;
return b1dma_tolink(card, &tmp, 4);
@ -147,7 +147,7 @@ static int WriteReg(avmcard *card, u32 reg, u8 val)
static u8 ReadReg(avmcard *card, u32 reg)
{
u8 cmd = 0x01;
if ( b1dma_tolink(card, &cmd, 1) == 0
if (b1dma_tolink(card, &cmd, 1) == 0
&& b1dma_tolink(card, &reg, 4) == 0) {
u32 tmp;
if (b1dma_fromlink(card, &tmp, 4) == 0)
@ -258,30 +258,30 @@ static int b1dma_detect(avmcard *card)
b1dma_writel(card, 0xffffffff, AMCC_RXPTR);
b1dma_writel(card, 0xffffffff, AMCC_TXPTR);
if ( b1dma_readl(card, AMCC_RXPTR) != 0xfffffffc
if (b1dma_readl(card, AMCC_RXPTR) != 0xfffffffc
|| b1dma_readl(card, AMCC_TXPTR) != 0xfffffffc)
return 2;
b1dma_writel(card, 0x0, AMCC_RXPTR);
b1dma_writel(card, 0x0, AMCC_TXPTR);
if ( b1dma_readl(card, AMCC_RXPTR) != 0x0
if (b1dma_readl(card, AMCC_RXPTR) != 0x0
|| b1dma_readl(card, AMCC_TXPTR) != 0x0)
return 3;
t1outp(card->port, 0x10, 0x00);
t1outp(card->port, 0x07, 0x00);
t1outp(card->port, 0x02, 0x02);
t1outp(card->port, 0x03, 0x02);
if ( (t1inp(card->port, 0x02) & 0xFE) != 0x02
if ((t1inp(card->port, 0x02) & 0xFE) != 0x02
|| t1inp(card->port, 0x3) != 0x03)
return 4;
t1outp(card->port, 0x02, 0x00);
t1outp(card->port, 0x03, 0x00);
if ( (t1inp(card->port, 0x02) & 0xFE) != 0x00
if ((t1inp(card->port, 0x02) & 0xFE) != 0x00
|| t1inp(card->port, 0x3) != 0x01)
return 5;
@ -294,28 +294,28 @@ int t1pci_detect(avmcard *card)
if ((ret = b1dma_detect(card)) != 0)
return ret;
/* Transputer test */
if ( WriteReg(card, 0x80001000, 0x11) != 0
if (WriteReg(card, 0x80001000, 0x11) != 0
|| WriteReg(card, 0x80101000, 0x22) != 0
|| WriteReg(card, 0x80201000, 0x33) != 0
|| WriteReg(card, 0x80301000, 0x44) != 0)
return 6;
if ( ReadReg(card, 0x80001000) != 0x11
if (ReadReg(card, 0x80001000) != 0x11
|| ReadReg(card, 0x80101000) != 0x22
|| ReadReg(card, 0x80201000) != 0x33
|| ReadReg(card, 0x80301000) != 0x44)
return 7;
if ( WriteReg(card, 0x80001000, 0x55) != 0
if (WriteReg(card, 0x80001000, 0x55) != 0
|| WriteReg(card, 0x80101000, 0x66) != 0
|| WriteReg(card, 0x80201000, 0x77) != 0
|| WriteReg(card, 0x80301000, 0x88) != 0)
return 8;
if ( ReadReg(card, 0x80001000) != 0x55
if (ReadReg(card, 0x80001000) != 0x55
|| ReadReg(card, 0x80101000) != 0x66
|| ReadReg(card, 0x80201000) != 0x77
|| ReadReg(card, 0x80301000) != 0x88)
@ -330,20 +330,20 @@ int b1pciv4_detect(avmcard *card)
if ((ret = b1dma_detect(card)) != 0)
return ret;
for (i=0; i < 5 ; i++) {
for (i = 0; i < 5; i++) {
if (WriteReg(card, 0x80A00000, 0x21) != 0)
return 6;
if ((ReadReg(card, 0x80A00000) & 0x01) != 0x01)
return 7;
}
for (i=0; i < 5 ; i++) {
for (i = 0; i < 5; i++) {
if (WriteReg(card, 0x80A00000, 0x20) != 0)
return 8;
if ((ReadReg(card, 0x80A00000) & 0x01) != 0x00)
return 9;
}
return 0;
}
@ -373,7 +373,7 @@ static void b1dma_dispatch_tx(avmcard *card)
u16 len;
u32 txlen;
void *p;
skb = skb_dequeue(&dma->send_queue);
len = CAPIMSG_LEN(skb->data);
@ -398,13 +398,13 @@ static void b1dma_dispatch_tx(avmcard *card)
printk(KERN_DEBUG "tx: put msg len=%d\n", txlen);
#endif
} else {
txlen = skb->len-2;
txlen = skb->len - 2;
#ifdef AVM_B1DMA_POLLDEBUG
if (skb->data[2] == SEND_POLLACK)
printk(KERN_INFO "%s: send ack\n", card->name);
#endif
#ifdef AVM_B1DMA_DEBUG
printk(KERN_DEBUG "tx: put 0x%x len=%d\n",
printk(KERN_DEBUG "tx: put 0x%x len=%d\n",
skb->data[2], txlen);
#endif
skb_copy_from_linear_data_offset(skb, 2, dma->sendbuf.dmabuf,
@ -430,7 +430,7 @@ static void queue_pollack(avmcard *card)
skb = alloc_skb(3, GFP_ATOMIC);
if (!skb) {
printk(KERN_CRIT "%s: no memory, lost poll ack\n",
card->name);
card->name);
return;
}
p = skb->data;
@ -450,14 +450,14 @@ static void b1dma_handle_rx(avmcard *card)
avmcard_dmainfo *dma = card->dma;
struct capi_ctr *ctrl = &cinfo->capi_ctrl;
struct sk_buff *skb;
void *p = dma->recvbuf.dmabuf+4;
void *p = dma->recvbuf.dmabuf + 4;
u32 ApplId, MsgLen, DataB3Len, NCCI, WindowSize;
u8 b1cmd = _get_byte(&p);
#ifdef AVM_B1DMA_DEBUG
printk(KERN_DEBUG "rx: 0x%x %lu\n", b1cmd, (unsigned long)dma->recvlen);
#endif
switch (b1cmd) {
case RECEIVE_DATA_B3_IND:
@ -466,13 +466,13 @@ static void b1dma_handle_rx(avmcard *card)
DataB3Len = _get_slice(&p, card->databuf);
if (MsgLen < 30) { /* not CAPI 64Bit */
memset(card->msgbuf+MsgLen, 0, 30-MsgLen);
memset(card->msgbuf + MsgLen, 0, 30 - MsgLen);
MsgLen = 30;
CAPIMSG_SETLEN(card->msgbuf, 30);
}
if (!(skb = alloc_skb(DataB3Len+MsgLen, GFP_ATOMIC))) {
if (!(skb = alloc_skb(DataB3Len + MsgLen, GFP_ATOMIC))) {
printk(KERN_ERR "%s: incoming packet dropped\n",
card->name);
card->name);
} else {
memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen);
memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len);
@ -486,14 +486,14 @@ static void b1dma_handle_rx(avmcard *card)
MsgLen = _get_slice(&p, card->msgbuf);
if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) {
printk(KERN_ERR "%s: incoming packet dropped\n",
card->name);
card->name);
} else {
memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen);
if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_CONF) {
spin_lock(&card->lock);
capilib_data_b3_conf(&cinfo->ncci_head, ApplId,
CAPIMSG_NCCI(skb->data),
CAPIMSG_MSGID(skb->data));
CAPIMSG_NCCI(skb->data),
CAPIMSG_MSGID(skb->data));
spin_unlock(&card->lock);
}
capi_ctr_handle_message(ctrl, ApplId, skb);
@ -550,23 +550,23 @@ static void b1dma_handle_rx(avmcard *card)
ApplId = (unsigned) _get_word(&p);
MsgLen = _get_slice(&p, card->msgbuf);
card->msgbuf[MsgLen] = 0;
while ( MsgLen > 0
&& ( card->msgbuf[MsgLen-1] == '\n'
|| card->msgbuf[MsgLen-1] == '\r')) {
card->msgbuf[MsgLen-1] = 0;
while (MsgLen > 0
&& (card->msgbuf[MsgLen - 1] == '\n'
|| card->msgbuf[MsgLen - 1] == '\r')) {
card->msgbuf[MsgLen - 1] = 0;
MsgLen--;
}
printk(KERN_INFO "%s: task %d \"%s\" ready.\n",
card->name, ApplId, card->msgbuf);
card->name, ApplId, card->msgbuf);
break;
case RECEIVE_DEBUGMSG:
MsgLen = _get_slice(&p, card->msgbuf);
card->msgbuf[MsgLen] = 0;
while ( MsgLen > 0
&& ( card->msgbuf[MsgLen-1] == '\n'
|| card->msgbuf[MsgLen-1] == '\r')) {
card->msgbuf[MsgLen-1] = 0;
while (MsgLen > 0
&& (card->msgbuf[MsgLen - 1] == '\n'
|| card->msgbuf[MsgLen - 1] == '\r')) {
card->msgbuf[MsgLen - 1] = 0;
MsgLen--;
}
printk(KERN_INFO "%s: DEBUG: %s\n", card->name, card->msgbuf);
@ -574,7 +574,7 @@ static void b1dma_handle_rx(avmcard *card)
default:
printk(KERN_ERR "%s: b1dma_interrupt: 0x%x ???\n",
card->name, b1cmd);
card->name, b1cmd);
return;
}
}
@ -594,7 +594,7 @@ static void b1dma_handle_interrupt(avmcard *card)
return;
}
newcsr = card->csr | (status & ALL_INT);
newcsr = card->csr | (status & ALL_INT);
if (status & TX_TC_INT) newcsr &= ~EN_TX_TC_INT;
if (status & RX_TC_INT) newcsr &= ~EN_RX_TC_INT;
b1dma_writel(card, newcsr, AMCC_INTCSR);
@ -602,23 +602,23 @@ static void b1dma_handle_interrupt(avmcard *card)
if ((status & RX_TC_INT) != 0) {
struct avmcard_dmainfo *dma = card->dma;
u32 rxlen;
if (card->dma->recvlen == 0) {
rxlen = b1dma_readl(card, AMCC_RXLEN);
if (card->dma->recvlen == 0) {
rxlen = b1dma_readl(card, AMCC_RXLEN);
if (rxlen == 0) {
dma->recvlen = *((u32 *)dma->recvbuf.dmabuf);
rxlen = (dma->recvlen + 3) & ~3;
b1dma_writel(card, dma->recvbuf.dmaaddr+4, AMCC_RXPTR);
b1dma_writel(card, dma->recvbuf.dmaaddr + 4, AMCC_RXPTR);
b1dma_writel(card, rxlen, AMCC_RXLEN);
#ifdef AVM_B1DMA_DEBUG
} else {
printk(KERN_ERR "%s: rx not complete (%d).\n",
card->name, rxlen);
card->name, rxlen);
#endif
}
} else {
spin_unlock(&card->lock);
b1dma_handle_rx(card);
dma->recvlen = 0;
dma->recvlen = 0;
spin_lock(&card->lock);
b1dma_writel(card, dma->recvbuf.dmaaddr, AMCC_RXPTR);
b1dma_writel(card, 4, AMCC_RXLEN);
@ -659,7 +659,7 @@ static int b1dma_loaded(avmcard *card)
}
if (!b1_tx_empty(base)) {
printk(KERN_ERR "%s: b1dma_loaded: tx err, corrupted t4 file ?\n",
card->name);
card->name);
return 0;
}
b1_put_byte(base, SEND_POLLACK);
@ -686,7 +686,7 @@ static void b1dma_send_init(avmcard *card)
skb = alloc_skb(15, GFP_ATOMIC);
if (!skb) {
printk(KERN_CRIT "%s: no memory, lost register appl.\n",
card->name);
card->name);
return;
}
p = skb->data;
@ -694,7 +694,7 @@ static void b1dma_send_init(avmcard *card)
_put_byte(&p, 0);
_put_byte(&p, SEND_INIT);
_put_word(&p, CAPI_MAXAPPL);
_put_word(&p, AVM_NCCI_PER_CHANNEL*30);
_put_word(&p, AVM_NCCI_PER_CHANNEL * 30);
_put_word(&p, card->cardnr - 1);
skb_put(skb, (u8 *)p - (u8 *)skb->data);
@ -712,7 +712,7 @@ int b1dma_load_firmware(struct capi_ctr *ctrl, capiloaddata *data)
if ((retval = b1_load_t4file(card, &data->firmware))) {
b1dma_reset(card);
printk(KERN_ERR "%s: failed to load t4file!!\n",
card->name);
card->name);
return retval;
}
@ -720,7 +720,7 @@ int b1dma_load_firmware(struct capi_ctr *ctrl, capiloaddata *data)
if ((retval = b1_load_config(card, &data->configuration))) {
b1dma_reset(card);
printk(KERN_ERR "%s: failed to load config!!\n",
card->name);
card->name);
return retval;
}
}
@ -733,8 +733,8 @@ int b1dma_load_firmware(struct capi_ctr *ctrl, capiloaddata *data)
card->csr = AVM_FLAG;
b1dma_writel(card, card->csr, AMCC_INTCSR);
b1dma_writel(card, EN_A2P_TRANSFERS|EN_P2A_TRANSFERS|A2P_HI_PRIORITY|
P2A_HI_PRIORITY|RESET_A2P_FLAGS|RESET_P2A_FLAGS,
b1dma_writel(card, EN_A2P_TRANSFERS | EN_P2A_TRANSFERS | A2P_HI_PRIORITY |
P2A_HI_PRIORITY | RESET_A2P_FLAGS | RESET_P2A_FLAGS,
AMCC_MCSR);
t1outp(card->port, 0x07, 0x30);
t1outp(card->port, 0x10, 0xF0);
@ -745,7 +745,7 @@ int b1dma_load_firmware(struct capi_ctr *ctrl, capiloaddata *data)
card->csr |= EN_RX_TC_INT;
b1dma_writel(card, card->csr, AMCC_INTCSR);
b1dma_send_init(card);
b1dma_send_init(card);
return 0;
}
@ -757,7 +757,7 @@ void b1dma_reset_ctr(struct capi_ctr *ctrl)
unsigned long flags;
spin_lock_irqsave(&card->lock, flags);
b1dma_reset(card);
b1dma_reset(card);
memset(cinfo->version, 0, sizeof(cinfo->version));
capilib_release(&cinfo->ncci_head);
@ -768,8 +768,8 @@ void b1dma_reset_ctr(struct capi_ctr *ctrl)
/* ------------------------------------------------------------- */
void b1dma_register_appl(struct capi_ctr *ctrl,
u16 appl,
capi_register_params *rp)
u16 appl,
capi_register_params *rp)
{
avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);
avmcard *card = cinfo->card;
@ -785,7 +785,7 @@ void b1dma_register_appl(struct capi_ctr *ctrl,
skb = alloc_skb(23, GFP_ATOMIC);
if (!skb) {
printk(KERN_CRIT "%s: no memory, lost register appl.\n",
card->name);
card->name);
return;
}
p = skb->data;
@ -793,7 +793,7 @@ void b1dma_register_appl(struct capi_ctr *ctrl,
_put_byte(&p, 0);
_put_byte(&p, SEND_REGISTER);
_put_word(&p, appl);
_put_word(&p, 1024 * (nconn+1));
_put_word(&p, 1024 * (nconn + 1));
_put_word(&p, nconn);
_put_word(&p, rp->datablkcnt);
_put_word(&p, rp->datablklen);
@ -819,7 +819,7 @@ void b1dma_release_appl(struct capi_ctr *ctrl, u16 appl)
skb = alloc_skb(7, GFP_ATOMIC);
if (!skb) {
printk(KERN_CRIT "%s: no memory, lost release appl.\n",
card->name);
card->name);
return;
}
p = skb->data;
@ -841,7 +841,7 @@ u16 b1dma_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
avmcard *card = cinfo->card;
u16 retval = CAPI_NOERROR;
if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_REQ) {
if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_REQ) {
unsigned long flags;
spin_lock_irqsave(&card->lock, flags);
retval = capilib_data_b3_req(&cinfo->ncci_head,
@ -850,7 +850,7 @@ u16 b1dma_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
CAPIMSG_MSGID(skb->data));
spin_unlock_irqrestore(&card->lock, flags);
}
if (retval == CAPI_NOERROR)
if (retval == CAPI_NOERROR)
b1dma_queue_tx(card, skb);
return retval;
@ -893,29 +893,29 @@ static int b1dmactl_proc_show(struct seq_file *m, void *v)
seq_printf(m, "%-16s %s\n", "ver_serial", s);
if (card->cardtype != avm_m1) {
flag = ((u8 *)(ctrl->profile.manu))[3];
if (flag)
flag = ((u8 *)(ctrl->profile.manu))[3];
if (flag)
seq_printf(m, "%-16s%s%s%s%s%s%s%s\n",
"protocol",
(flag & 0x01) ? " DSS1" : "",
(flag & 0x02) ? " CT1" : "",
(flag & 0x04) ? " VN3" : "",
(flag & 0x08) ? " NI1" : "",
(flag & 0x10) ? " AUSTEL" : "",
(flag & 0x20) ? " ESS" : "",
(flag & 0x40) ? " 1TR6" : ""
);
"protocol",
(flag & 0x01) ? " DSS1" : "",
(flag & 0x02) ? " CT1" : "",
(flag & 0x04) ? " VN3" : "",
(flag & 0x08) ? " NI1" : "",
(flag & 0x10) ? " AUSTEL" : "",
(flag & 0x20) ? " ESS" : "",
(flag & 0x40) ? " 1TR6" : ""
);
}
if (card->cardtype != avm_m1) {
flag = ((u8 *)(ctrl->profile.manu))[5];
flag = ((u8 *)(ctrl->profile.manu))[5];
if (flag)
seq_printf(m, "%-16s%s%s%s%s\n",
"linetype",
(flag & 0x01) ? " point to point" : "",
(flag & 0x02) ? " point to multipoint" : "",
(flag & 0x08) ? " leased line without D-channel" : "",
(flag & 0x04) ? " leased line with D-channel" : ""
);
"linetype",
(flag & 0x01) ? " point to point" : "",
(flag & 0x02) ? " point to multipoint" : "",
(flag & 0x08) ? " leased line without D-channel" : "",
(flag & 0x04) ? " leased line with D-channel" : ""
);
}
seq_printf(m, "%-16s %s\n", "cardname", cinfo->cardname);
@ -977,7 +977,7 @@ static int __init b1dma_init(void)
if ((p = strchr(revision, ':')) != NULL && p[1]) {
strlcpy(rev, p + 2, sizeof(rev));
if ((p = strchr(rev, '$')) != NULL && p > rev)
*(p-1) = 0;
*(p - 1) = 0;
} else
strcpy(rev, "1.0");

View File

@ -1,9 +1,9 @@
/* $Id: b1isa.c,v 1.1.2.3 2004/02/10 01:07:12 keil Exp $
*
*
* Module for AVM B1 ISA-card.
*
*
* Copyright 1999 by Carsten Paeth <calle@calle.de>
*
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
@ -80,7 +80,7 @@ static int b1isa_probe(struct pci_dev *pdev)
card->cardtype = avm_b1isa;
sprintf(card->name, "b1isa-%x", card->port);
if ( card->port != 0x150 && card->port != 0x250
if (card->port != 0x150 && card->port != 0x250
&& card->port != 0x300 && card->port != 0x340) {
printk(KERN_WARNING "b1isa: invalid port 0x%x.\n", card->port);
retval = -EINVAL;
@ -136,13 +136,13 @@ static int b1isa_probe(struct pci_dev *pdev)
pci_set_drvdata(pdev, cinfo);
return 0;
err_free_irq:
err_free_irq:
free_irq(card->irq, card);
err_release_region:
err_release_region:
release_region(card->port, AVMB1_PORTLEN);
err_free:
err_free:
b1_free_card(card);
err:
err:
return retval;
}
@ -206,7 +206,7 @@ static int __init b1isa_init(void)
if ((p = strchr(revision, ':')) != NULL && p[1]) {
strlcpy(rev, p + 2, 32);
if ((p = strchr(rev, '$')) != NULL && p > rev)
*(p-1) = 0;
*(p - 1) = 0;
} else
strcpy(rev, "1.0");

View File

@ -1,9 +1,9 @@
/* $Id: b1pci.c,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $
*
*
* Module for AVM B1 PCI-card.
*
*
* Copyright 1999 by Carsten Paeth <calle@calle.de>
*
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
@ -79,7 +79,7 @@ static int b1pci_probe(struct capicardparams *p, struct pci_dev *pdev)
card->port = p->port;
card->irq = p->irq;
card->cardtype = avm_b1pci;
if (!request_region(card->port, AVMB1_PORTLEN, card->name)) {
printk(KERN_WARNING "b1pci: ports 0x%03x-0x%03x in use.\n",
card->port, card->port + AVMB1_PORTLEN);
@ -96,14 +96,14 @@ static int b1pci_probe(struct capicardparams *p, struct pci_dev *pdev)
}
b1_reset(card->port);
b1_getrevision(card);
retval = request_irq(card->irq, b1_interrupt, IRQF_SHARED, card->name, card);
if (retval) {
printk(KERN_ERR "b1pci: unable to get IRQ %d.\n", card->irq);
retval = -EBUSY;
goto err_release_region;
}
cinfo->capi_ctrl.driver_name = "b1pci";
cinfo->capi_ctrl.driverdata = cinfo;
cinfo->capi_ctrl.register_appl = b1_register_appl;
@ -133,13 +133,13 @@ static int b1pci_probe(struct capicardparams *p, struct pci_dev *pdev)
pci_set_drvdata(pdev, card);
return 0;
err_free_irq:
err_free_irq:
free_irq(card->irq, card);
err_release_region:
err_release_region:
release_region(card->port, AVMB1_PORTLEN);
err_free:
err_free:
b1_free_card(card);
err:
err:
return retval;
}
@ -193,7 +193,7 @@ static int b1pciv4_probe(struct capicardparams *p, struct pci_dev *pdev)
goto err;
}
card->dma = avmcard_dma_alloc("b1pci", pdev, 2048+128, 2048+128);
card->dma = avmcard_dma_alloc("b1pci", pdev, 2048 + 128, 2048 + 128);
if (!card->dma) {
printk(KERN_WARNING "b1pci: dma alloc.\n");
retval = -ENOMEM;
@ -267,17 +267,17 @@ static int b1pciv4_probe(struct capicardparams *p, struct pci_dev *pdev)
pci_set_drvdata(pdev, card);
return 0;
err_free_irq:
err_free_irq:
free_irq(card->irq, card);
err_unmap:
err_unmap:
iounmap(card->mbase);
err_release_region:
err_release_region:
release_region(card->port, AVMB1_PORTLEN);
err_free_dma:
err_free_dma:
avmcard_dma_free(card->dma);
err_free:
err_free:
b1_free_card(card);
err:
err:
return retval;
}
@ -287,13 +287,13 @@ static void b1pciv4_remove(struct pci_dev *pdev)
avmcard *card = pci_get_drvdata(pdev);
avmctrl_info *cinfo = card->ctrlinfo;
b1dma_reset(card);
b1dma_reset(card);
detach_capi_ctr(&cinfo->capi_ctrl);
free_irq(card->irq, card);
iounmap(card->mbase);
release_region(card->port, AVMB1_PORTLEN);
avmcard_dma_free(card->dma);
avmcard_dma_free(card->dma);
b1_free_card(card);
}
@ -326,7 +326,7 @@ static int __devinit b1pci_pci_probe(struct pci_dev *pdev,
retval = b1pci_probe(&param, pdev);
#endif
if (retval != 0) {
printk(KERN_ERR "b1pci: no AVM-B1 V4 at i/o %#x, irq %d, mem %#x detected\n",
printk(KERN_ERR "b1pci: no AVM-B1 V4 at i/o %#x, irq %d, mem %#x detected\n",
param.port, param.irq, param.membase);
}
} else {
@ -337,7 +337,7 @@ static int __devinit b1pci_pci_probe(struct pci_dev *pdev,
param.port, param.irq);
retval = b1pci_probe(&param, pdev);
if (retval != 0) {
printk(KERN_ERR "b1pci: no AVM-B1 at i/o %#x, irq %d detected\n",
printk(KERN_ERR "b1pci: no AVM-B1 at i/o %#x, irq %d detected\n",
param.port, param.irq);
}
}
@ -385,7 +385,7 @@ static int __init b1pci_init(void)
if ((p = strchr(revision, ':')) != NULL && p[1]) {
strlcpy(rev, p + 2, 32);
if ((p = strchr(rev, '$')) != NULL && p > rev)
*(p-1) = 0;
*(p - 1) = 0;
} else
strcpy(rev, "1.0");

View File

@ -1,9 +1,9 @@
/* $Id: b1pcmcia.c,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $
*
*
* Module for AVM B1/M1/M2 PCMCIA-card.
*
*
* Copyright 1999 by Carsten Paeth <calle@calle.de>
*
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
@ -74,9 +74,9 @@ static int b1pcmcia_add_card(unsigned int port, unsigned irq,
cinfo = card->ctrlinfo;
switch (cardtype) {
case avm_m1: sprintf(card->name, "m1-%x", port); break;
case avm_m2: sprintf(card->name, "m2-%x", port); break;
default: sprintf(card->name, "b1pcmcia-%x", port); break;
case avm_m1: sprintf(card->name, "m1-%x", port); break;
case avm_m2: sprintf(card->name, "m2-%x", port); break;
default: sprintf(card->name, "b1pcmcia-%x", port); break;
}
card->port = port;
card->irq = irq;
@ -117,9 +117,9 @@ static int b1pcmcia_add_card(unsigned int port, unsigned irq,
goto err_free_irq;
}
switch (cardtype) {
case avm_m1: cardname = "M1"; break;
case avm_m2: cardname = "M2"; break;
default : cardname = "B1 PCMCIA"; break;
case avm_m1: cardname = "M1"; break;
case avm_m2: cardname = "M2"; break;
default: cardname = "B1 PCMCIA"; break;
}
printk(KERN_INFO "b1pcmcia: AVM %s at i/o %#x, irq %d, revision %d\n",
@ -128,11 +128,11 @@ static int b1pcmcia_add_card(unsigned int port, unsigned irq,
list_add(&card->list, &cards);
return cinfo->capi_ctrl.cnr;
err_free_irq:
err_free_irq:
free_irq(card->irq, card);
err_free:
err_free:
b1_free_card(card);
err:
err:
return retval;
}
@ -175,7 +175,7 @@ int b1pcmcia_delcard(unsigned int port, unsigned irq)
{
struct list_head *l;
avmcard *card;
list_for_each(l, &cards) {
card = list_entry(l, avmcard, list);
if (card->port == port && card->irq == irq) {
@ -204,7 +204,7 @@ static int __init b1pcmcia_init(void)
if ((p = strchr(revision, ':')) != NULL && p[1]) {
strlcpy(rev, p + 2, 32);
if ((p = strchr(rev, '$')) != NULL && p > rev)
*(p-1) = 0;
*(p - 1) = 0;
} else
strcpy(rev, "1.0");

View File

@ -1,7 +1,7 @@
/* $Id: c4.c,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $
*
*
* Module for AVM C4 & C2 card.
*
*
* Copyright 1999 by Carsten Paeth <calle@calle.de>
*
* This software may be used and distributed according to the terms
@ -129,8 +129,8 @@ static void c4_dispatch_tx(avmcard *card);
/* ------------------------------------------------------------- */
#define RESET_TIMEOUT (15*HZ) /* 15 sec */
#define PEEK_POKE_TIMEOUT (HZ/10) /* 0.1 sec */
#define RESET_TIMEOUT (15 * HZ) /* 15 sec */
#define PEEK_POKE_TIMEOUT (HZ / 10) /* 0.1 sec */
/* ------------------------------------------------------------- */
@ -148,7 +148,7 @@ static inline int wait_for_doorbell(avmcard *card, unsigned long t)
unsigned long stop;
stop = jiffies + t;
while (c4inmeml(card->mbase+DOORBELL) != 0xffffffff) {
while (c4inmeml(card->mbase + DOORBELL) != 0xffffffff) {
if (!time_before(jiffies, stop))
return -1;
mb();
@ -159,40 +159,40 @@ static inline int wait_for_doorbell(avmcard *card, unsigned long t)
static int c4_poke(avmcard *card, unsigned long off, unsigned long value)
{
if (wait_for_doorbell(card, HZ/10) < 0)
return -1;
c4outmeml(card->mbase+MBOX_PEEK_POKE, off);
c4outmeml(card->mbase+DOORBELL, DBELL_ADDR);
if (wait_for_doorbell(card, HZ/10) < 0)
if (wait_for_doorbell(card, HZ / 10) < 0)
return -1;
c4outmeml(card->mbase+MBOX_PEEK_POKE, value);
c4outmeml(card->mbase+DOORBELL, DBELL_DATA | DBELL_ADDR);
c4outmeml(card->mbase + MBOX_PEEK_POKE, off);
c4outmeml(card->mbase + DOORBELL, DBELL_ADDR);
if (wait_for_doorbell(card, HZ / 10) < 0)
return -1;
c4outmeml(card->mbase + MBOX_PEEK_POKE, value);
c4outmeml(card->mbase + DOORBELL, DBELL_DATA | DBELL_ADDR);
return 0;
}
static int c4_peek(avmcard *card, unsigned long off, unsigned long *valuep)
{
if (wait_for_doorbell(card, HZ/10) < 0)
if (wait_for_doorbell(card, HZ / 10) < 0)
return -1;
c4outmeml(card->mbase+MBOX_PEEK_POKE, off);
c4outmeml(card->mbase+DOORBELL, DBELL_RNWR | DBELL_ADDR);
c4outmeml(card->mbase + MBOX_PEEK_POKE, off);
c4outmeml(card->mbase + DOORBELL, DBELL_RNWR | DBELL_ADDR);
if (wait_for_doorbell(card, HZ/10) < 0)
if (wait_for_doorbell(card, HZ / 10) < 0)
return -1;
*valuep = c4inmeml(card->mbase+MBOX_PEEK_POKE);
*valuep = c4inmeml(card->mbase + MBOX_PEEK_POKE);
return 0;
}
/* ------------------------------------------------------------- */
static int c4_load_t4file(avmcard *card, capiloaddatapart * t4file)
static int c4_load_t4file(avmcard *card, capiloaddatapart *t4file)
{
u32 val;
unsigned char *dp;
@ -202,7 +202,7 @@ static int c4_load_t4file(avmcard *card, capiloaddatapart * t4file)
dp = t4file->data;
left = t4file->len;
while (left >= sizeof(u32)) {
if (t4file->user) {
if (t4file->user) {
if (copy_from_user(&val, dp, sizeof(val)))
return -EFAULT;
} else {
@ -210,7 +210,7 @@ static int c4_load_t4file(avmcard *card, capiloaddatapart * t4file)
}
if (c4_poke(card, loadoff, val)) {
printk(KERN_ERR "%s: corrupted firmware file ?\n",
card->name);
card->name);
return -EIO;
}
left -= sizeof(u32);
@ -227,7 +227,7 @@ static int c4_load_t4file(avmcard *card, capiloaddatapart * t4file)
}
if (c4_poke(card, loadoff, val)) {
printk(KERN_ERR "%s: corrupted firmware file ?\n",
card->name);
card->name);
return -EIO;
}
}
@ -297,13 +297,13 @@ static void c4_reset(avmcard *card)
{
unsigned long stop;
c4outmeml(card->mbase+DOORBELL, DBELL_RESET_ARM);
c4outmeml(card->mbase + DOORBELL, DBELL_RESET_ARM);
stop = jiffies + HZ*10;
while (c4inmeml(card->mbase+DOORBELL) != 0xffffffff) {
stop = jiffies + HZ * 10;
while (c4inmeml(card->mbase + DOORBELL) != 0xffffffff) {
if (!time_before(jiffies, stop))
return;
c4outmeml(card->mbase+DOORBELL, DBELL_ADDR);
c4outmeml(card->mbase + DOORBELL, DBELL_ADDR);
mb();
}
@ -317,89 +317,89 @@ static int c4_detect(avmcard *card)
{
unsigned long stop, dummy;
c4outmeml(card->mbase+PCI_OUT_INT_MASK, 0x0c);
if (c4inmeml(card->mbase+PCI_OUT_INT_MASK) != 0x0c)
c4outmeml(card->mbase + PCI_OUT_INT_MASK, 0x0c);
if (c4inmeml(card->mbase + PCI_OUT_INT_MASK) != 0x0c)
return 1;
c4outmeml(card->mbase+DOORBELL, DBELL_RESET_ARM);
c4outmeml(card->mbase + DOORBELL, DBELL_RESET_ARM);
stop = jiffies + HZ*10;
while (c4inmeml(card->mbase+DOORBELL) != 0xffffffff) {
stop = jiffies + HZ * 10;
while (c4inmeml(card->mbase + DOORBELL) != 0xffffffff) {
if (!time_before(jiffies, stop))
return 2;
c4outmeml(card->mbase+DOORBELL, DBELL_ADDR);
c4outmeml(card->mbase + DOORBELL, DBELL_ADDR);
mb();
}
c4_poke(card, DC21285_ARMCSR_BASE + CHAN_1_CONTROL, 0);
c4_poke(card, DC21285_ARMCSR_BASE + CHAN_2_CONTROL, 0);
c4outmeml(card->mbase+MAILBOX_0, 0x55aa55aa);
if (c4inmeml(card->mbase+MAILBOX_0) != 0x55aa55aa) return 3;
c4outmeml(card->mbase + MAILBOX_0, 0x55aa55aa);
if (c4inmeml(card->mbase + MAILBOX_0) != 0x55aa55aa) return 3;
c4outmeml(card->mbase+MAILBOX_0, 0xaa55aa55);
if (c4inmeml(card->mbase+MAILBOX_0) != 0xaa55aa55) return 4;
c4outmeml(card->mbase + MAILBOX_0, 0xaa55aa55);
if (c4inmeml(card->mbase + MAILBOX_0) != 0xaa55aa55) return 4;
if (c4_poke(card, DC21285_ARMCSR_BASE+DBELL_SA_MASK, 0)) return 5;
if (c4_poke(card, DC21285_ARMCSR_BASE+DBELL_PCI_MASK, 0)) return 6;
if (c4_poke(card, DC21285_ARMCSR_BASE+SA_CONTROL, SA_CTL_ALLRIGHT))
if (c4_poke(card, DC21285_ARMCSR_BASE + DBELL_SA_MASK, 0)) return 5;
if (c4_poke(card, DC21285_ARMCSR_BASE + DBELL_PCI_MASK, 0)) return 6;
if (c4_poke(card, DC21285_ARMCSR_BASE + SA_CONTROL, SA_CTL_ALLRIGHT))
return 7;
if (c4_poke(card, DC21285_ARMCSR_BASE+XBUS_CYCLE, INIT_XBUS_CYCLE))
if (c4_poke(card, DC21285_ARMCSR_BASE + XBUS_CYCLE, INIT_XBUS_CYCLE))
return 8;
if (c4_poke(card, DC21285_ARMCSR_BASE+XBUS_STROBE, INIT_XBUS_STROBE))
if (c4_poke(card, DC21285_ARMCSR_BASE + XBUS_STROBE, INIT_XBUS_STROBE))
return 8;
if (c4_poke(card, DC21285_ARMCSR_BASE+DRAM_TIMING, 0)) return 9;
if (c4_poke(card, DC21285_ARMCSR_BASE + DRAM_TIMING, 0)) return 9;
mdelay(1);
mdelay(1);
if (c4_peek(card, DC21285_DRAM_A0MR, &dummy)) return 10;
if (c4_peek(card, DC21285_DRAM_A1MR, &dummy)) return 11;
if (c4_peek(card, DC21285_DRAM_A2MR, &dummy)) return 12;
if (c4_peek(card, DC21285_DRAM_A3MR, &dummy)) return 13;
if (c4_poke(card, DC21285_DRAM_A0MR+CAS_OFFSET, 0)) return 14;
if (c4_poke(card, DC21285_DRAM_A1MR+CAS_OFFSET, 0)) return 15;
if (c4_poke(card, DC21285_DRAM_A2MR+CAS_OFFSET, 0)) return 16;
if (c4_poke(card, DC21285_DRAM_A3MR+CAS_OFFSET, 0)) return 17;
if (c4_poke(card, DC21285_DRAM_A0MR + CAS_OFFSET, 0)) return 14;
if (c4_poke(card, DC21285_DRAM_A1MR + CAS_OFFSET, 0)) return 15;
if (c4_poke(card, DC21285_DRAM_A2MR + CAS_OFFSET, 0)) return 16;
if (c4_poke(card, DC21285_DRAM_A3MR + CAS_OFFSET, 0)) return 17;
mdelay(1);
mdelay(1);
if (c4_poke(card, DC21285_ARMCSR_BASE+DRAM_TIMING, DRAM_TIMING_DEF))
if (c4_poke(card, DC21285_ARMCSR_BASE + DRAM_TIMING, DRAM_TIMING_DEF))
return 18;
if (c4_poke(card, DC21285_ARMCSR_BASE+DRAM_ADDR_SIZE_0,DRAM_AD_SZ_DEF0))
if (c4_poke(card, DC21285_ARMCSR_BASE + DRAM_ADDR_SIZE_0, DRAM_AD_SZ_DEF0))
return 19;
if (c4_poke(card, DC21285_ARMCSR_BASE+DRAM_ADDR_SIZE_1,DRAM_AD_SZ_NULL))
if (c4_poke(card, DC21285_ARMCSR_BASE + DRAM_ADDR_SIZE_1, DRAM_AD_SZ_NULL))
return 20;
if (c4_poke(card, DC21285_ARMCSR_BASE+DRAM_ADDR_SIZE_2,DRAM_AD_SZ_NULL))
if (c4_poke(card, DC21285_ARMCSR_BASE + DRAM_ADDR_SIZE_2, DRAM_AD_SZ_NULL))
return 21;
if (c4_poke(card, DC21285_ARMCSR_BASE+DRAM_ADDR_SIZE_3,DRAM_AD_SZ_NULL))
if (c4_poke(card, DC21285_ARMCSR_BASE + DRAM_ADDR_SIZE_3, DRAM_AD_SZ_NULL))
return 22;
/* Transputer test */
if ( c4_poke(card, 0x000000, 0x11111111)
if (c4_poke(card, 0x000000, 0x11111111)
|| c4_poke(card, 0x400000, 0x22222222)
|| c4_poke(card, 0x800000, 0x33333333)
|| c4_poke(card, 0xC00000, 0x44444444))
|| c4_poke(card, 0x800000, 0x33333333)
|| c4_poke(card, 0xC00000, 0x44444444))
return 23;
if ( c4_peek(card, 0x000000, &dummy) || dummy != 0x11111111
if (c4_peek(card, 0x000000, &dummy) || dummy != 0x11111111
|| c4_peek(card, 0x400000, &dummy) || dummy != 0x22222222
|| c4_peek(card, 0x800000, &dummy) || dummy != 0x33333333
|| c4_peek(card, 0xC00000, &dummy) || dummy != 0x44444444)
|| c4_peek(card, 0x800000, &dummy) || dummy != 0x33333333
|| c4_peek(card, 0xC00000, &dummy) || dummy != 0x44444444)
return 24;
if ( c4_poke(card, 0x000000, 0x55555555)
if (c4_poke(card, 0x000000, 0x55555555)
|| c4_poke(card, 0x400000, 0x66666666)
|| c4_poke(card, 0x800000, 0x77777777)
|| c4_poke(card, 0xC00000, 0x88888888))
|| c4_poke(card, 0x800000, 0x77777777)
|| c4_poke(card, 0xC00000, 0x88888888))
return 25;
if ( c4_peek(card, 0x000000, &dummy) || dummy != 0x55555555
if (c4_peek(card, 0x000000, &dummy) || dummy != 0x55555555
|| c4_peek(card, 0x400000, &dummy) || dummy != 0x66666666
|| c4_peek(card, 0x800000, &dummy) || dummy != 0x77777777
|| c4_peek(card, 0xC00000, &dummy) || dummy != 0x88888888)
|| c4_peek(card, 0x800000, &dummy) || dummy != 0x77777777
|| c4_peek(card, 0xC00000, &dummy) || dummy != 0x88888888)
return 26;
return 0;
@ -451,26 +451,26 @@ static void c4_dispatch_tx(avmcard *card)
printk(KERN_DEBUG "%s: tx put msg len=%d\n", card->name, txlen);
#endif
} else {
txlen = skb->len-2;
txlen = skb->len - 2;
#ifdef AVM_C4_POLLDEBUG
if (skb->data[2] == SEND_POLLACK)
printk(KERN_INFO "%s: ack to c4\n", card->name);
#endif
#ifdef AVM_C4_DEBUG
printk(KERN_DEBUG "%s: tx put 0x%x len=%d\n",
card->name, skb->data[2], txlen);
card->name, skb->data[2], txlen);
#endif
skb_copy_from_linear_data_offset(skb, 2, dma->sendbuf.dmabuf,
skb->len - 2);
}
txlen = (txlen + 3) & ~3;
c4outmeml(card->mbase+MBOX_DOWN_ADDR, dma->sendbuf.dmaaddr);
c4outmeml(card->mbase+MBOX_DOWN_LEN, txlen);
c4outmeml(card->mbase + MBOX_DOWN_ADDR, dma->sendbuf.dmaaddr);
c4outmeml(card->mbase + MBOX_DOWN_LEN, txlen);
card->csr |= DBELL_DOWN_ARM;
c4outmeml(card->mbase+DOORBELL, DBELL_DOWN_ARM);
c4outmeml(card->mbase + DOORBELL, DBELL_DOWN_ARM);
dev_kfree_skb_any(skb);
}
@ -485,7 +485,7 @@ static void queue_pollack(avmcard *card)
skb = alloc_skb(3, GFP_ATOMIC);
if (!skb) {
printk(KERN_CRIT "%s: no memory, lost poll ack\n",
card->name);
card->name);
return;
}
p = skb->data;
@ -514,9 +514,9 @@ static void c4_handle_rx(avmcard *card)
#ifdef AVM_C4_DEBUG
printk(KERN_DEBUG "%s: rx 0x%x len=%lu\n", card->name,
b1cmd, (unsigned long)dma->recvlen);
b1cmd, (unsigned long)dma->recvlen);
#endif
switch (b1cmd) {
case RECEIVE_DATA_B3_IND:
@ -528,13 +528,13 @@ static void c4_handle_rx(avmcard *card)
ctrl = &card->ctrlinfo[cidx].capi_ctrl;
if (MsgLen < 30) { /* not CAPI 64Bit */
memset(card->msgbuf+MsgLen, 0, 30-MsgLen);
memset(card->msgbuf + MsgLen, 0, 30 - MsgLen);
MsgLen = 30;
CAPIMSG_SETLEN(card->msgbuf, 30);
}
if (!(skb = alloc_skb(DataB3Len+MsgLen, GFP_ATOMIC))) {
if (!(skb = alloc_skb(DataB3Len + MsgLen, GFP_ATOMIC))) {
printk(KERN_ERR "%s: incoming packet dropped\n",
card->name);
card->name);
} else {
memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen);
memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len);
@ -553,7 +553,7 @@ static void c4_handle_rx(avmcard *card)
if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) {
printk(KERN_ERR "%s: incoming packet dropped\n",
card->name);
card->name);
} else {
memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen);
if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_CONF)
@ -570,7 +570,7 @@ static void c4_handle_rx(avmcard *card)
ApplId = _get_word(&p);
NCCI = _get_word(&p);
WindowSize = _get_word(&p);
cidx = (NCCI&0x7f) - card->cardnr;
cidx = (NCCI & 0x7f) - card->cardnr;
if (cidx >= card->nlogcontr) cidx = 0;
capilib_new_ncci(&card->ctrlinfo[cidx].ncci_head, ApplId, NCCI, WindowSize);
@ -583,7 +583,7 @@ static void c4_handle_rx(avmcard *card)
NCCI = _get_word(&p);
if (NCCI != 0xffffffff) {
cidx = (NCCI&0x7f) - card->cardnr;
cidx = (NCCI & 0x7f) - card->cardnr;
if (cidx >= card->nlogcontr) cidx = 0;
capilib_free_ncci(&card->ctrlinfo[cidx].ncci_head, ApplId, NCCI);
}
@ -595,14 +595,14 @@ static void c4_handle_rx(avmcard *card)
#endif
if (!suppress_pollack)
queue_pollack(card);
for (cidx=0; cidx < card->nr_controllers; cidx++) {
for (cidx = 0; cidx < card->nr_controllers; cidx++) {
ctrl = &card->ctrlinfo[cidx].capi_ctrl;
capi_ctr_resume_output(ctrl);
}
break;
case RECEIVE_STOP:
for (cidx=0; cidx < card->nr_controllers; cidx++) {
for (cidx = 0; cidx < card->nr_controllers; cidx++) {
ctrl = &card->ctrlinfo[cidx].capi_ctrl;
capi_ctr_suspend_output(ctrl);
}
@ -610,14 +610,14 @@ static void c4_handle_rx(avmcard *card)
case RECEIVE_INIT:
cidx = card->nlogcontr;
cidx = card->nlogcontr;
if (cidx >= card->nr_controllers) {
printk(KERN_ERR "%s: card with %d controllers ??\n",
card->name, cidx+1);
card->name, cidx + 1);
break;
}
card->nlogcontr++;
cinfo = &card->ctrlinfo[cidx];
card->nlogcontr++;
cinfo = &card->ctrlinfo[cidx];
ctrl = &cinfo->capi_ctrl;
cinfo->versionlen = _get_slice(&p, cinfo->versionbuf);
b1_parse_version(cinfo);
@ -632,23 +632,23 @@ static void c4_handle_rx(avmcard *card)
ApplId = (unsigned) _get_word(&p);
MsgLen = _get_slice(&p, card->msgbuf);
card->msgbuf[MsgLen] = 0;
while ( MsgLen > 0
&& ( card->msgbuf[MsgLen-1] == '\n'
|| card->msgbuf[MsgLen-1] == '\r')) {
card->msgbuf[MsgLen-1] = 0;
while (MsgLen > 0
&& (card->msgbuf[MsgLen - 1] == '\n'
|| card->msgbuf[MsgLen - 1] == '\r')) {
card->msgbuf[MsgLen - 1] = 0;
MsgLen--;
}
printk(KERN_INFO "%s: task %d \"%s\" ready.\n",
card->name, ApplId, card->msgbuf);
card->name, ApplId, card->msgbuf);
break;
case RECEIVE_DEBUGMSG:
MsgLen = _get_slice(&p, card->msgbuf);
card->msgbuf[MsgLen] = 0;
while ( MsgLen > 0
&& ( card->msgbuf[MsgLen-1] == '\n'
|| card->msgbuf[MsgLen-1] == '\r')) {
card->msgbuf[MsgLen-1] = 0;
while (MsgLen > 0
&& (card->msgbuf[MsgLen - 1] == '\n'
|| card->msgbuf[MsgLen - 1] == '\r')) {
card->msgbuf[MsgLen - 1] = 0;
MsgLen--;
}
printk(KERN_INFO "%s: DEBUG: %s\n", card->name, card->msgbuf);
@ -656,7 +656,7 @@ static void c4_handle_rx(avmcard *card)
default:
printk(KERN_ERR "%s: c4_interrupt: 0x%x ???\n",
card->name, b1cmd);
card->name, b1cmd);
return;
}
}
@ -669,16 +669,16 @@ static irqreturn_t c4_handle_interrupt(avmcard *card)
u32 status;
spin_lock_irqsave(&card->lock, flags);
status = c4inmeml(card->mbase+DOORBELL);
status = c4inmeml(card->mbase + DOORBELL);
if (status & DBELL_RESET_HOST) {
u_int i;
c4outmeml(card->mbase+PCI_OUT_INT_MASK, 0x0c);
c4outmeml(card->mbase + PCI_OUT_INT_MASK, 0x0c);
spin_unlock_irqrestore(&card->lock, flags);
if (card->nlogcontr == 0)
return IRQ_HANDLED;
printk(KERN_ERR "%s: unexpected reset\n", card->name);
for (i=0; i < card->nr_controllers; i++) {
for (i = 0; i < card->nr_controllers; i++) {
avmctrl_info *cinfo = &card->ctrlinfo[i];
memset(cinfo->version, 0, sizeof(cinfo->version));
spin_lock_irqsave(&card->lock, flags);
@ -695,23 +695,23 @@ static irqreturn_t c4_handle_interrupt(avmcard *card)
spin_unlock_irqrestore(&card->lock, flags);
return IRQ_HANDLED;
}
c4outmeml(card->mbase+DOORBELL, status);
c4outmeml(card->mbase + DOORBELL, status);
if ((status & DBELL_UP_HOST) != 0) {
card->dma->recvlen = c4inmeml(card->mbase+MBOX_UP_LEN);
c4outmeml(card->mbase+MBOX_UP_LEN, 0);
card->dma->recvlen = c4inmeml(card->mbase + MBOX_UP_LEN);
c4outmeml(card->mbase + MBOX_UP_LEN, 0);
c4_handle_rx(card);
card->dma->recvlen = 0;
c4outmeml(card->mbase+MBOX_UP_LEN, card->dma->recvbuf.size);
c4outmeml(card->mbase+DOORBELL, DBELL_UP_ARM);
c4outmeml(card->mbase + MBOX_UP_LEN, card->dma->recvbuf.size);
c4outmeml(card->mbase + DOORBELL, DBELL_UP_ARM);
}
if ((status & DBELL_DOWN_HOST) != 0) {
card->csr &= ~DBELL_DOWN_ARM;
c4_dispatch_tx(card);
c4_dispatch_tx(card);
} else if (card->csr & DBELL_DOWN_HOST) {
if (c4inmeml(card->mbase+MBOX_DOWN_LEN) == 0) {
card->csr &= ~DBELL_DOWN_ARM;
if (c4inmeml(card->mbase + MBOX_DOWN_LEN) == 0) {
card->csr &= ~DBELL_DOWN_ARM;
c4_dispatch_tx(card);
}
}
@ -737,7 +737,7 @@ static void c4_send_init(avmcard *card)
skb = alloc_skb(15, GFP_ATOMIC);
if (!skb) {
printk(KERN_CRIT "%s: no memory, lost register appl.\n",
card->name);
card->name);
return;
}
p = skb->data;
@ -745,7 +745,7 @@ static void c4_send_init(avmcard *card)
_put_byte(&p, 0);
_put_byte(&p, SEND_INIT);
_put_word(&p, CAPI_MAXAPPL);
_put_word(&p, AVM_NCCI_PER_CHANNEL*30);
_put_word(&p, AVM_NCCI_PER_CHANNEL * 30);
_put_word(&p, card->cardnr - 1);
skb_put(skb, (u8 *)p - (u8 *)skb->data);
@ -761,10 +761,10 @@ static int queue_sendconfigword(avmcard *card, u32 val)
unsigned long flags;
void *p;
skb = alloc_skb(3+4, GFP_ATOMIC);
skb = alloc_skb(3 + 4, GFP_ATOMIC);
if (!skb) {
printk(KERN_CRIT "%s: no memory, send config\n",
card->name);
card->name);
return -ENOMEM;
}
p = skb->data;
@ -787,10 +787,10 @@ static int queue_sendconfig(avmcard *card, char cval[4])
unsigned long flags;
void *p;
skb = alloc_skb(3+4, GFP_ATOMIC);
skb = alloc_skb(3 + 4, GFP_ATOMIC);
if (!skb) {
printk(KERN_CRIT "%s: no memory, send config\n",
card->name);
card->name);
return -ENOMEM;
}
p = skb->data;
@ -804,20 +804,20 @@ static int queue_sendconfig(avmcard *card, char cval[4])
skb_put(skb, (u8 *)p - (u8 *)skb->data);
skb_queue_tail(&card->dma->send_queue, skb);
spin_lock_irqsave(&card->lock, flags);
c4_dispatch_tx(card);
spin_unlock_irqrestore(&card->lock, flags);
return 0;
}
static int c4_send_config(avmcard *card, capiloaddatapart * config)
static int c4_send_config(avmcard *card, capiloaddatapart *config)
{
u8 val[4];
unsigned char *dp;
u_int left;
int retval;
if ((retval = queue_sendconfigword(card, 1)) != 0)
return retval;
if ((retval = queue_sendconfigword(card, config->len)) != 0)
@ -826,7 +826,7 @@ static int c4_send_config(avmcard *card, capiloaddatapart * config)
dp = config->data;
left = config->len;
while (left >= sizeof(u32)) {
if (config->user) {
if (config->user) {
if (copy_from_user(val, dp, sizeof(val)))
return -EFAULT;
} else {
@ -860,37 +860,37 @@ static int c4_load_firmware(struct capi_ctr *ctrl, capiloaddata *data)
if ((retval = c4_load_t4file(card, &data->firmware))) {
printk(KERN_ERR "%s: failed to load t4file!!\n",
card->name);
card->name);
c4_reset(card);
return retval;
}
card->csr = 0;
c4outmeml(card->mbase+MBOX_UP_LEN, 0);
c4outmeml(card->mbase+MBOX_DOWN_LEN, 0);
c4outmeml(card->mbase+DOORBELL, DBELL_INIT);
c4outmeml(card->mbase + MBOX_UP_LEN, 0);
c4outmeml(card->mbase + MBOX_DOWN_LEN, 0);
c4outmeml(card->mbase + DOORBELL, DBELL_INIT);
mdelay(1);
c4outmeml(card->mbase+DOORBELL,
DBELL_UP_HOST | DBELL_DOWN_HOST | DBELL_RESET_HOST);
c4outmeml(card->mbase + DOORBELL,
DBELL_UP_HOST | DBELL_DOWN_HOST | DBELL_RESET_HOST);
c4outmeml(card->mbase+PCI_OUT_INT_MASK, 0x08);
c4outmeml(card->mbase + PCI_OUT_INT_MASK, 0x08);
card->dma->recvlen = 0;
c4outmeml(card->mbase+MBOX_UP_ADDR, card->dma->recvbuf.dmaaddr);
c4outmeml(card->mbase+MBOX_UP_LEN, card->dma->recvbuf.size);
c4outmeml(card->mbase+DOORBELL, DBELL_UP_ARM);
c4outmeml(card->mbase + MBOX_UP_ADDR, card->dma->recvbuf.dmaaddr);
c4outmeml(card->mbase + MBOX_UP_LEN, card->dma->recvbuf.size);
c4outmeml(card->mbase + DOORBELL, DBELL_UP_ARM);
if (data->configuration.len > 0 && data->configuration.data) {
retval = c4_send_config(card, &data->configuration);
if (retval) {
printk(KERN_ERR "%s: failed to set config!!\n",
card->name);
card->name);
c4_reset(card);
return retval;
}
}
c4_send_init(card);
c4_send_init(card);
return 0;
}
@ -905,11 +905,11 @@ static void c4_reset_ctr(struct capi_ctr *ctrl)
spin_lock_irqsave(&card->lock, flags);
c4_reset(card);
c4_reset(card);
spin_unlock_irqrestore(&card->lock, flags);
for (i=0; i < card->nr_controllers; i++) {
for (i = 0; i < card->nr_controllers; i++) {
cinfo = &card->ctrlinfo[i];
memset(cinfo->version, 0, sizeof(cinfo->version));
capi_ctr_down(&cinfo->capi_ctrl);
@ -926,9 +926,9 @@ static void c4_remove(struct pci_dev *pdev)
if (!card)
return;
c4_reset(card);
c4_reset(card);
for (i=0; i < card->nr_controllers; i++) {
for (i = 0; i < card->nr_controllers; i++) {
cinfo = &card->ctrlinfo[i];
detach_capi_ctr(&cinfo->capi_ctrl);
}
@ -936,8 +936,8 @@ static void c4_remove(struct pci_dev *pdev)
free_irq(card->irq, card);
iounmap(card->mbase);
release_region(card->port, AVMB1_PORTLEN);
avmcard_dma_free(card->dma);
pci_set_drvdata(pdev, NULL);
avmcard_dma_free(card->dma);
pci_set_drvdata(pdev, NULL);
b1_free_card(card);
}
@ -945,8 +945,8 @@ static void c4_remove(struct pci_dev *pdev)
static void c4_register_appl(struct capi_ctr *ctrl,
u16 appl,
capi_register_params *rp)
u16 appl,
capi_register_params *rp)
{
avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);
avmcard *card = cinfo->card;
@ -965,7 +965,7 @@ static void c4_register_appl(struct capi_ctr *ctrl,
skb = alloc_skb(23, GFP_ATOMIC);
if (!skb) {
printk(KERN_CRIT "%s: no memory, lost register appl.\n",
card->name);
card->name);
return;
}
p = skb->data;
@ -973,14 +973,14 @@ static void c4_register_appl(struct capi_ctr *ctrl,
_put_byte(&p, 0);
_put_byte(&p, SEND_REGISTER);
_put_word(&p, appl);
_put_word(&p, 1024 * (nconn+1));
_put_word(&p, 1024 * (nconn + 1));
_put_word(&p, nconn);
_put_word(&p, rp->datablkcnt);
_put_word(&p, rp->datablklen);
skb_put(skb, (u8 *)p - (u8 *)skb->data);
skb_queue_tail(&card->dma->send_queue, skb);
spin_lock_irqsave(&card->lock, flags);
c4_dispatch_tx(card);
spin_unlock_irqrestore(&card->lock, flags);
@ -1005,7 +1005,7 @@ static void c4_release_appl(struct capi_ctr *ctrl, u16 appl)
skb = alloc_skb(7, GFP_ATOMIC);
if (!skb) {
printk(KERN_CRIT "%s: no memory, lost release appl.\n",
card->name);
card->name);
return;
}
p = skb->data;
@ -1098,29 +1098,29 @@ static int c4_proc_show(struct seq_file *m, void *v)
seq_printf(m, "%-16s %s\n", "ver_serial", s);
if (card->cardtype != avm_m1) {
flag = ((u8 *)(ctrl->profile.manu))[3];
if (flag)
flag = ((u8 *)(ctrl->profile.manu))[3];
if (flag)
seq_printf(m, "%-16s%s%s%s%s%s%s%s\n",
"protocol",
(flag & 0x01) ? " DSS1" : "",
(flag & 0x02) ? " CT1" : "",
(flag & 0x04) ? " VN3" : "",
(flag & 0x08) ? " NI1" : "",
(flag & 0x10) ? " AUSTEL" : "",
(flag & 0x20) ? " ESS" : "",
(flag & 0x40) ? " 1TR6" : ""
);
"protocol",
(flag & 0x01) ? " DSS1" : "",
(flag & 0x02) ? " CT1" : "",
(flag & 0x04) ? " VN3" : "",
(flag & 0x08) ? " NI1" : "",
(flag & 0x10) ? " AUSTEL" : "",
(flag & 0x20) ? " ESS" : "",
(flag & 0x40) ? " 1TR6" : ""
);
}
if (card->cardtype != avm_m1) {
flag = ((u8 *)(ctrl->profile.manu))[5];
flag = ((u8 *)(ctrl->profile.manu))[5];
if (flag)
seq_printf(m, "%-16s%s%s%s%s\n",
"linetype",
(flag & 0x01) ? " point to point" : "",
(flag & 0x02) ? " point to multipoint" : "",
(flag & 0x08) ? " leased line without D-channel" : "",
(flag & 0x04) ? " leased line with D-channel" : ""
);
"linetype",
(flag & 0x01) ? " point to point" : "",
(flag & 0x02) ? " point to multipoint" : "",
(flag & 0x08) ? " leased line without D-channel" : "",
(flag & 0x04) ? " leased line with D-channel" : ""
);
}
seq_printf(m, "%-16s %s\n", "cardname", cinfo->cardname);
@ -1156,7 +1156,7 @@ static int c4_add_card(struct capicardparams *p, struct pci_dev *dev,
retval = -ENOMEM;
goto err;
}
card->dma = avmcard_dma_alloc("c4", dev, 2048+128, 2048+128);
card->dma = avmcard_dma_alloc("c4", dev, 2048 + 128, 2048 + 128);
if (!card->dma) {
printk(KERN_WARNING "c4: no memory.\n");
retval = -ENOMEM;
@ -1195,12 +1195,12 @@ static int c4_add_card(struct capicardparams *p, struct pci_dev *dev,
retval = request_irq(card->irq, c4_interrupt, IRQF_SHARED, card->name, card);
if (retval) {
printk(KERN_ERR "c4: unable to get IRQ %d.\n",card->irq);
printk(KERN_ERR "c4: unable to get IRQ %d.\n", card->irq);
retval = -EBUSY;
goto err_unmap;
}
for (i=0; i < nr_controllers ; i++) {
for (i = 0; i < nr_controllers; i++) {
cinfo = &card->ctrlinfo[i];
cinfo->capi_ctrl.owner = THIS_MODULE;
cinfo->capi_ctrl.driver_name = "c4";
@ -1233,17 +1233,17 @@ static int c4_add_card(struct capicardparams *p, struct pci_dev *dev,
pci_set_drvdata(dev, card);
return 0;
err_free_irq:
err_free_irq:
free_irq(card->irq, card);
err_unmap:
err_unmap:
iounmap(card->mbase);
err_release_region:
err_release_region:
release_region(card->port, AVMB1_PORTLEN);
err_free_dma:
err_free_dma:
avmcard_dma_free(card->dma);
err_free:
err_free:
b1_free_card(card);
err:
err:
return retval;
}
@ -1265,10 +1265,10 @@ static int __devinit c4_probe(struct pci_dev *dev,
param.port = pci_resource_start(dev, 1);
param.irq = dev->irq;
param.membase = pci_resource_start(dev, 0);
printk(KERN_INFO "c4: PCI BIOS reports AVM-C%d at i/o %#x, irq %d, mem %#x\n",
nr, param.port, param.irq, param.membase);
retval = c4_add_card(&param, dev, nr);
if (retval != 0) {
printk(KERN_ERR "c4: no AVM-C%d at i/o %#x, irq %d detected, mem %#x\n",
@ -1280,10 +1280,10 @@ static int __devinit c4_probe(struct pci_dev *dev,
}
static struct pci_driver c4_pci_driver = {
.name = "c4",
.id_table = c4_pci_tbl,
.probe = c4_probe,
.remove = c4_remove,
.name = "c4",
.id_table = c4_pci_tbl,
.probe = c4_probe,
.remove = c4_remove,
};
static struct capi_driver capi_driver_c2 = {
@ -1305,7 +1305,7 @@ static int __init c4_init(void)
if ((p = strchr(revision, ':')) != NULL && p[1]) {
strlcpy(rev, p + 2, 32);
if ((p = strchr(rev, '$')) != NULL && p > rev)
*(p-1) = 0;
*(p - 1) = 0;
} else
strcpy(rev, "1.0");

View File

@ -1,9 +1,9 @@
/* $Id: t1isa.c,v 1.1.2.3 2004/02/10 01:07:12 keil Exp $
*
*
* Module for AVM T1 HEMA-card.
*
*
* Copyright 1999 by Carsten Paeth <calle@calle.de>
*
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
@ -67,7 +67,7 @@ static int t1_detectandinit(unsigned int base, unsigned irq, int cardnr)
int i;
reverse_cardnr = ((cardnr & 0x01) << 3) | ((cardnr & 0x02) << 1)
| ((cardnr & 0x04) >> 1) | ((cardnr & 0x08) >> 3);
| ((cardnr & 0x04) >> 1) | ((cardnr & 0x08) >> 3);
cregs[0] = (HEMA_VERSION_ID << 4) | (reverse_cardnr & 0xf);
cregs[1] = 0x00; /* fast & slow link connected to CON1 */
cregs[2] = 0x05; /* fast link 20MBit, slow link 20 MBit */
@ -86,50 +86,50 @@ static int t1_detectandinit(unsigned int base, unsigned irq, int cardnr)
/* board reset */
t1outp(base, T1_RESETBOARD, 0xf);
mdelay(100);
dummy = t1inp(base, T1_FASTLINK+T1_OUTSTAT); /* first read */
dummy = t1inp(base, T1_FASTLINK + T1_OUTSTAT); /* first read */
/* write config */
dummy = (base >> 4) & 0xff;
for (i=1;i<=0xf;i++) t1outp(base, i, dummy);
for (i = 1; i <= 0xf; i++) t1outp(base, i, dummy);
t1outp(base, HEMA_PAL_ID & 0xf, dummy);
t1outp(base, HEMA_PAL_ID >> 4, cregs[0]);
for(i=1;i<7;i++) t1outp(base, 0, cregs[i]);
for (i = 1; i < 7; i++) t1outp(base, 0, cregs[i]);
t1outp(base, ((base >> 4)) & 0x3, cregs[7]);
/* restore_flags(flags); */
mdelay(100);
t1outp(base, T1_FASTLINK+T1_RESETLINK, 0);
t1outp(base, T1_SLOWLINK+T1_RESETLINK, 0);
t1outp(base, T1_FASTLINK + T1_RESETLINK, 0);
t1outp(base, T1_SLOWLINK + T1_RESETLINK, 0);
mdelay(10);
t1outp(base, T1_FASTLINK+T1_RESETLINK, 1);
t1outp(base, T1_SLOWLINK+T1_RESETLINK, 1);
t1outp(base, T1_FASTLINK + T1_RESETLINK, 1);
t1outp(base, T1_SLOWLINK + T1_RESETLINK, 1);
mdelay(100);
t1outp(base, T1_FASTLINK+T1_RESETLINK, 0);
t1outp(base, T1_SLOWLINK+T1_RESETLINK, 0);
t1outp(base, T1_FASTLINK + T1_RESETLINK, 0);
t1outp(base, T1_SLOWLINK + T1_RESETLINK, 0);
mdelay(10);
t1outp(base, T1_FASTLINK+T1_ANALYSE, 0);
t1outp(base, T1_FASTLINK + T1_ANALYSE, 0);
mdelay(5);
t1outp(base, T1_SLOWLINK+T1_ANALYSE, 0);
t1outp(base, T1_SLOWLINK + T1_ANALYSE, 0);
if (t1inp(base, T1_FASTLINK+T1_OUTSTAT) != 0x1) /* tx empty */
if (t1inp(base, T1_FASTLINK + T1_OUTSTAT) != 0x1) /* tx empty */
return 1;
if (t1inp(base, T1_FASTLINK+T1_INSTAT) != 0x0) /* rx empty */
if (t1inp(base, T1_FASTLINK + T1_INSTAT) != 0x0) /* rx empty */
return 2;
if (t1inp(base, T1_FASTLINK+T1_IRQENABLE) != 0x0)
if (t1inp(base, T1_FASTLINK + T1_IRQENABLE) != 0x0)
return 3;
if ((t1inp(base, T1_FASTLINK+T1_FIFOSTAT) & 0xf0) != 0x70)
if ((t1inp(base, T1_FASTLINK + T1_FIFOSTAT) & 0xf0) != 0x70)
return 4;
if ((t1inp(base, T1_FASTLINK+T1_IRQMASTER) & 0x0e) != 0)
if ((t1inp(base, T1_FASTLINK + T1_IRQMASTER) & 0x0e) != 0)
return 5;
if ((t1inp(base, T1_FASTLINK+T1_IDENT) & 0x7d) != 1)
if ((t1inp(base, T1_FASTLINK + T1_IDENT) & 0x7d) != 1)
return 6;
if (t1inp(base, T1_SLOWLINK+T1_OUTSTAT) != 0x1) /* tx empty */
if (t1inp(base, T1_SLOWLINK + T1_OUTSTAT) != 0x1) /* tx empty */
return 7;
if ((t1inp(base, T1_SLOWLINK+T1_IRQMASTER) & 0x0e) != 0)
if ((t1inp(base, T1_SLOWLINK + T1_IRQMASTER) & 0x0e) != 0)
return 8;
if ((t1inp(base, T1_SLOWLINK+T1_IDENT) & 0x7d) != 0)
if ((t1inp(base, T1_SLOWLINK + T1_IDENT) & 0x7d) != 0)
return 9;
return 0;
return 0;
}
static irqreturn_t t1isa_interrupt(int interrupt, void *devptr)
@ -163,13 +163,13 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr)
spin_unlock_irqrestore(&card->lock, flags);
if (MsgLen < 30) { /* not CAPI 64Bit */
memset(card->msgbuf+MsgLen, 0, 30-MsgLen);
memset(card->msgbuf + MsgLen, 0, 30 - MsgLen);
MsgLen = 30;
CAPIMSG_SETLEN(card->msgbuf, 30);
}
if (!(skb = alloc_skb(DataB3Len+MsgLen, GFP_ATOMIC))) {
if (!(skb = alloc_skb(DataB3Len + MsgLen, GFP_ATOMIC))) {
printk(KERN_ERR "%s: incoming packet dropped\n",
card->name);
card->name);
} else {
memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen);
memcpy(skb_put(skb, DataB3Len), card->databuf, DataB3Len);
@ -184,7 +184,7 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr)
if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) {
spin_unlock_irqrestore(&card->lock, flags);
printk(KERN_ERR "%s: incoming packet dropped\n",
card->name);
card->name);
} else {
memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen);
if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3)
@ -242,24 +242,24 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr)
MsgLen = t1_get_slice(card->port, card->msgbuf);
spin_unlock_irqrestore(&card->lock, flags);
card->msgbuf[MsgLen] = 0;
while ( MsgLen > 0
&& ( card->msgbuf[MsgLen-1] == '\n'
|| card->msgbuf[MsgLen-1] == '\r')) {
card->msgbuf[MsgLen-1] = 0;
while (MsgLen > 0
&& (card->msgbuf[MsgLen - 1] == '\n'
|| card->msgbuf[MsgLen - 1] == '\r')) {
card->msgbuf[MsgLen - 1] = 0;
MsgLen--;
}
printk(KERN_INFO "%s: task %d \"%s\" ready.\n",
card->name, ApplId, card->msgbuf);
card->name, ApplId, card->msgbuf);
break;
case RECEIVE_DEBUGMSG:
MsgLen = t1_get_slice(card->port, card->msgbuf);
spin_unlock_irqrestore(&card->lock, flags);
card->msgbuf[MsgLen] = 0;
while ( MsgLen > 0
&& ( card->msgbuf[MsgLen-1] == '\n'
|| card->msgbuf[MsgLen-1] == '\r')) {
card->msgbuf[MsgLen-1] = 0;
while (MsgLen > 0
&& (card->msgbuf[MsgLen - 1] == '\n'
|| card->msgbuf[MsgLen - 1] == '\r')) {
card->msgbuf[MsgLen - 1] = 0;
MsgLen--;
}
printk(KERN_INFO "%s: DEBUG: %s\n", card->name, card->msgbuf);
@ -273,7 +273,7 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr)
default:
spin_unlock_irqrestore(&card->lock, flags);
printk(KERN_ERR "%s: b1_interrupt: 0x%x ???\n",
card->name, b1cmd);
card->name, b1cmd);
return IRQ_NONE;
}
}
@ -296,7 +296,7 @@ static int t1isa_load_firmware(struct capi_ctr *ctrl, capiloaddata *data)
if ((retval = b1_load_t4file(card, &data->firmware))) {
b1_reset(port);
printk(KERN_ERR "%s: failed to load t4file!!\n",
card->name);
card->name);
return retval;
}
@ -304,7 +304,7 @@ static int t1isa_load_firmware(struct capi_ctr *ctrl, capiloaddata *data)
if ((retval = b1_load_config(card, &data->configuration))) {
b1_reset(port);
printk(KERN_ERR "%s: failed to load config!!\n",
card->name);
card->name);
return retval;
}
}
@ -318,7 +318,7 @@ static int t1isa_load_firmware(struct capi_ctr *ctrl, capiloaddata *data)
b1_setinterrupt(port, card->irq, card->cardtype);
b1_put_byte(port, SEND_INIT);
b1_put_word(port, CAPI_MAXAPPL);
b1_put_word(port, AVM_NCCI_PER_CHANNEL*30);
b1_put_word(port, AVM_NCCI_PER_CHANNEL * 30);
b1_put_word(port, ctrl->cnr - 1);
spin_unlock_irqrestore(&card->lock, flags);
@ -347,7 +347,7 @@ static void t1isa_remove(struct pci_dev *pdev)
{
avmctrl_info *cinfo = pci_get_drvdata(pdev);
avmcard *card;
if (!cinfo)
return;
@ -393,7 +393,7 @@ static int t1isa_probe(struct pci_dev *pdev, int cardnr)
printk(KERN_WARNING "t1isa: invalid port 0x%x.\n", card->port);
retval = -EINVAL;
goto err_free;
}
}
if (hema_irq_table[card->irq & 0xf] == 0) {
printk(KERN_WARNING "t1isa: irq %d not valid.\n", card->irq);
retval = -EINVAL;
@ -412,7 +412,7 @@ static int t1isa_probe(struct pci_dev *pdev, int cardnr)
goto err_release_region;
}
if ((retval = t1_detectandinit(card->port, card->irq, card->cardnr)) != 0) {
if ((retval = t1_detectandinit(card->port, card->irq, card->cardnr)) != 0) {
printk(KERN_INFO "t1isa: NO card at 0x%x (%d)\n",
card->port, retval);
retval = -ENODEV;
@ -445,13 +445,13 @@ static int t1isa_probe(struct pci_dev *pdev, int cardnr)
pci_set_drvdata(pdev, cinfo);
return 0;
err_free_irq:
err_free_irq:
free_irq(card->irq, card);
err_release_region:
err_release_region:
release_region(card->port, AVMB1_PORTLEN);
err_free:
err_free:
b1_free_card(card);
err:
err:
return retval;
}
@ -555,7 +555,7 @@ static int __init t1isa_init(void)
if ((p = strchr(revision, ':')) != NULL && p[1]) {
strlcpy(rev, p + 2, 32);
if ((p = strchr(rev, '$')) != NULL && p > rev)
*(p-1) = 0;
*(p - 1) = 0;
} else
strcpy(rev, "1.0");

View File

@ -1,9 +1,9 @@
/* $Id: t1pci.c,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $
*
*
* Module for AVM T1 PCI-card.
*
*
* Copyright 1999 by Carsten Paeth <calle@calle.de>
*
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
@ -59,7 +59,7 @@ static int t1pci_add_card(struct capicardparams *p, struct pci_dev *pdev)
goto err;
}
card->dma = avmcard_dma_alloc("t1pci", pdev, 2048+128, 2048+128);
card->dma = avmcard_dma_alloc("t1pci", pdev, 2048 + 128, 2048 + 128);
if (!card->dma) {
printk(KERN_WARNING "t1pci: no memory.\n");
retval = -ENOMEM;
@ -136,17 +136,17 @@ static int t1pci_add_card(struct capicardparams *p, struct pci_dev *pdev)
pci_set_drvdata(pdev, card);
return 0;
err_free_irq:
err_free_irq:
free_irq(card->irq, card);
err_unmap:
err_unmap:
iounmap(card->mbase);
err_release_region:
err_release_region:
release_region(card->port, AVMB1_PORTLEN);
err_free_dma:
err_free_dma:
avmcard_dma_free(card->dma);
err_free:
err_free:
b1_free_card(card);
err:
err:
return retval;
}
@ -157,7 +157,7 @@ static void t1pci_remove(struct pci_dev *pdev)
avmcard *card = pci_get_drvdata(pdev);
avmctrl_info *cinfo = card->ctrlinfo;
b1dma_reset(card);
b1dma_reset(card);
detach_capi_ctr(&cinfo->capi_ctrl);
free_irq(card->irq, card);
@ -217,10 +217,10 @@ static int __devinit t1pci_probe(struct pci_dev *dev,
}
static struct pci_driver t1pci_pci_driver = {
.name = "t1pci",
.id_table = t1pci_pci_tbl,
.probe = t1pci_probe,
.remove = t1pci_remove,
.name = "t1pci",
.id_table = t1pci_pci_tbl,
.probe = t1pci_probe,
.remove = t1pci_remove,
};
static struct capi_driver capi_driver_t1pci = {
@ -237,7 +237,7 @@ static int __init t1pci_init(void)
if ((p = strchr(revision, ':')) != NULL && p[1]) {
strlcpy(rev, p + 2, 32);
if ((p = strchr(rev, '$')) != NULL && p > rev)
*(p-1) = 0;
*(p - 1) = 0;
} else
strcpy(rev, "1.0");

View File

@ -1,74 +1,74 @@
/*
*
Copyright (c) Eicon Networks, 2002.
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
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 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.
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.
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
#ifndef _INC_CAPI20
#define _INC_CAPI20
/* operations on message queues */
/* the common device type for CAPI20 drivers */
/* 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 */
/* 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 */
/* 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)
/* 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;
word MessageBufferSize;
word maxLogicalConnection;
word maxBDataBlocks;
word maxBDataLen;
};
struct divas_capi_version {
word CapiMajor;
word CapiMinor;
word ManuMajor;
word ManuMinor;
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;
word Number;
word Channels;
dword Global_Options;
dword B1_Protocols;
dword B2_Protocols;
dword B3_Protocols;
} API_PROFILE;
/* ISDN Common API message types */
/* ISDN Common API message types */
#define _ALERT_R 0x8001
#define _CONNECT_R 0x8002
#define _CONNECT_I 0x8202
@ -93,9 +93,9 @@ typedef struct api_profile_s {
#define _CONNECT_B3_T90_ACTIVE_I 0x8288
#define _MANUFACTURER_R 0x80ff
#define _MANUFACTURER_I 0x82ff
/* OR this to convert a REQUEST to a CONFIRM */
/* OR this to convert a REQUEST to a CONFIRM */
#define CONFIRM 0x0100
/* OR this to convert a INDICATION to a RESPONSE */
/* OR this to convert a INDICATION to a RESPONSE */
#define RESPONSE 0x0100
/*------------------------------------------------------------------*/
/* diehl isdn private MANUFACTURER codes */
@ -115,248 +115,248 @@ typedef struct api_profile_s {
/*------------------------------------------------------------------*/
/* parameter structures */
/*------------------------------------------------------------------*/
/* ALERT-REQUEST */
/* ALERT-REQUEST */
typedef struct {
byte structs[0]; /* Additional Info */
byte structs[0]; /* Additional Info */
} _ALT_REQP;
/* ALERT-CONFIRM */
/* ALERT-CONFIRM */
typedef struct {
word Info;
word Info;
} _ALT_CONP;
/* CONNECT-REQUEST */
/* 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 */
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 */
/* CONNECT-CONFIRM */
typedef struct {
word Info;
word Info;
} _CON_CONP;
/* CONNECT-INDICATION */
/* 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 */
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 */
/* CONNECT-RESPONSE */
typedef struct {
word Accept;
byte structs[0]; /* B_protocol,
Connected party number,
Connected party subaddress,
LLC */
word Accept;
byte structs[0]; /* B_protocol,
Connected party number,
Connected party subaddress,
LLC */
} _CON_RESP;
/* CONNECT-ACTIVE-INDICATION */
/* CONNECT-ACTIVE-INDICATION */
typedef struct {
byte structs[0]; /* Connected party number,
Connected party subaddress,
LLC */
byte structs[0]; /* Connected party number,
Connected party subaddress,
LLC */
} _CON_A_INDP;
/* CONNECT-ACTIVE-RESPONSE */
/* CONNECT-ACTIVE-RESPONSE */
typedef struct {
byte structs[0]; /* empty */
byte structs[0]; /* empty */
} _CON_A_RESP;
/* DISCONNECT-REQUEST */
/* DISCONNECT-REQUEST */
typedef struct {
byte structs[0]; /* Additional Info */
byte structs[0]; /* Additional Info */
} _DIS_REQP;
/* DISCONNECT-CONFIRM */
/* DISCONNECT-CONFIRM */
typedef struct {
word Info;
word Info;
} _DIS_CONP;
/* DISCONNECT-INDICATION */
/* DISCONNECT-INDICATION */
typedef struct {
word Info;
word Info;
} _DIS_INDP;
/* DISCONNECT-RESPONSE */
/* DISCONNECT-RESPONSE */
typedef struct {
byte structs[0]; /* empty */
byte structs[0]; /* empty */
} _DIS_RESP;
/* LISTEN-REQUEST */
/* LISTEN-REQUEST */
typedef struct {
dword Info_Mask;
dword CIP_Mask;
byte structs[0]; /* Calling party number,
Calling party subaddress */
dword Info_Mask;
dword CIP_Mask;
byte structs[0]; /* Calling party number,
Calling party subaddress */
} _LIS_REQP;
/* LISTEN-CONFIRM */
/* LISTEN-CONFIRM */
typedef struct {
word Info;
word Info;
} _LIS_CONP;
/* INFO-REQUEST */
/* INFO-REQUEST */
typedef struct {
byte structs[0]; /* Called party number,
Additional Info */
byte structs[0]; /* Called party number,
Additional Info */
} _INF_REQP;
/* INFO-CONFIRM */
/* INFO-CONFIRM */
typedef struct {
word Info;
word Info;
} _INF_CONP;
/* INFO-INDICATION */
/* INFO-INDICATION */
typedef struct {
word Number;
byte structs[0]; /* Info element */
word Number;
byte structs[0]; /* Info element */
} _INF_INDP;
/* INFO-RESPONSE */
/* INFO-RESPONSE */
typedef struct {
byte structs[0]; /* empty */
byte structs[0]; /* empty */
} _INF_RESP;
/* SELECT-B-REQUEST */
/* SELECT-B-REQUEST */
typedef struct {
byte structs[0]; /* B-protocol */
byte structs[0]; /* B-protocol */
} _SEL_B_REQP;
/* SELECT-B-CONFIRM */
/* SELECT-B-CONFIRM */
typedef struct {
word Info;
word Info;
} _SEL_B_CONP;
/* FACILITY-REQUEST */
/* FACILITY-REQUEST */
typedef struct {
word Selector;
byte structs[0]; /* Facility parameters */
word Selector;
byte structs[0]; /* Facility parameters */
} _FAC_REQP;
/* FACILITY-CONFIRM STRUCT FOR SUPPLEMENT. SERVICES */
/* FACILITY-CONFIRM STRUCT FOR SUPPLEMENT. SERVICES */
typedef struct {
byte struct_length;
word function;
byte length;
word SupplementaryServiceInfo;
dword SupportedServices;
byte struct_length;
word function;
byte length;
word SupplementaryServiceInfo;
dword SupportedServices;
} _FAC_CON_STRUCTS;
/* FACILITY-CONFIRM */
/* FACILITY-CONFIRM */
typedef struct {
word Info;
word Selector;
byte structs[0]; /* Facility parameters */
word Info;
word Selector;
byte structs[0]; /* Facility parameters */
} _FAC_CONP;
/* FACILITY-INDICATION */
/* FACILITY-INDICATION */
typedef struct {
word Selector;
byte structs[0]; /* Facility parameters */
word Selector;
byte structs[0]; /* Facility parameters */
} _FAC_INDP;
/* FACILITY-RESPONSE */
/* FACILITY-RESPONSE */
typedef struct {
word Selector;
byte structs[0]; /* Facility parameters */
word Selector;
byte structs[0]; /* Facility parameters */
} _FAC_RESP;
/* CONNECT-B3-REQUEST */
/* CONNECT-B3-REQUEST */
typedef struct {
byte structs[0]; /* NCPI */
byte structs[0]; /* NCPI */
} _CON_B3_REQP;
/* CONNECT-B3-CONFIRM */
/* CONNECT-B3-CONFIRM */
typedef struct {
word Info;
word Info;
} _CON_B3_CONP;
/* CONNECT-B3-INDICATION */
/* CONNECT-B3-INDICATION */
typedef struct {
byte structs[0]; /* NCPI */
byte structs[0]; /* NCPI */
} _CON_B3_INDP;
/* CONNECT-B3-RESPONSE */
/* CONNECT-B3-RESPONSE */
typedef struct {
word Accept;
byte structs[0]; /* NCPI */
word Accept;
byte structs[0]; /* NCPI */
} _CON_B3_RESP;
/* CONNECT-B3-ACTIVE-INDICATION */
/* CONNECT-B3-ACTIVE-INDICATION */
typedef struct {
byte structs[0]; /* NCPI */
byte structs[0]; /* NCPI */
} _CON_B3_A_INDP;
/* CONNECT-B3-ACTIVE-RESPONSE */
/* CONNECT-B3-ACTIVE-RESPONSE */
typedef struct {
byte structs[0]; /* empty */
byte structs[0]; /* empty */
} _CON_B3_A_RESP;
/* DISCONNECT-B3-REQUEST */
/* DISCONNECT-B3-REQUEST */
typedef struct {
byte structs[0]; /* NCPI */
byte structs[0]; /* NCPI */
} _DIS_B3_REQP;
/* DISCONNECT-B3-CONFIRM */
/* DISCONNECT-B3-CONFIRM */
typedef struct {
word Info;
word Info;
} _DIS_B3_CONP;
/* DISCONNECT-B3-INDICATION */
/* DISCONNECT-B3-INDICATION */
typedef struct {
word Info;
byte structs[0]; /* NCPI */
word Info;
byte structs[0]; /* NCPI */
} _DIS_B3_INDP;
/* DISCONNECT-B3-RESPONSE */
/* DISCONNECT-B3-RESPONSE */
typedef struct {
byte structs[0]; /* empty */
byte structs[0]; /* empty */
} _DIS_B3_RESP;
/* DATA-B3-REQUEST */
/* DATA-B3-REQUEST */
typedef struct {
dword Data;
word Data_Length;
word Number;
word Flags;
dword Data;
word Data_Length;
word Number;
word Flags;
} _DAT_B3_REQP;
/* DATA-B3-REQUEST 64 BIT Systems */
/* DATA-B3-REQUEST 64 BIT Systems */
typedef struct {
dword Data;
word Data_Length;
word Number;
word Flags;
void *pData;
dword Data;
word Data_Length;
word Number;
word Flags;
void *pData;
} _DAT_B3_REQ64P;
/* DATA-B3-CONFIRM */
/* DATA-B3-CONFIRM */
typedef struct {
word Number;
word Info;
word Number;
word Info;
} _DAT_B3_CONP;
/* DATA-B3-INDICATION */
/* DATA-B3-INDICATION */
typedef struct {
dword Data;
word Data_Length;
word Number;
word Flags;
dword Data;
word Data_Length;
word Number;
word Flags;
} _DAT_B3_INDP;
/* DATA-B3-INDICATION 64 BIT Systems */
/* DATA-B3-INDICATION 64 BIT Systems */
typedef struct {
dword Data;
word Data_Length;
word Number;
word Flags;
void *pData;
dword Data;
word Data_Length;
word Number;
word Flags;
void *pData;
} _DAT_B3_IND64P;
/* DATA-B3-RESPONSE */
/* DATA-B3-RESPONSE */
typedef struct {
word Number;
word Number;
} _DAT_B3_RESP;
/* RESET-B3-REQUEST */
/* RESET-B3-REQUEST */
typedef struct {
byte structs[0]; /* NCPI */
byte structs[0]; /* NCPI */
} _RES_B3_REQP;
/* RESET-B3-CONFIRM */
/* RESET-B3-CONFIRM */
typedef struct {
word Info;
word Info;
} _RES_B3_CONP;
/* RESET-B3-INDICATION */
/* RESET-B3-INDICATION */
typedef struct {
byte structs[0]; /* NCPI */
byte structs[0]; /* NCPI */
} _RES_B3_INDP;
/* RESET-B3-RESPONSE */
/* RESET-B3-RESPONSE */
typedef struct {
byte structs[0]; /* empty */
byte structs[0]; /* empty */
} _RES_B3_RESP;
/* CONNECT-B3-T90-ACTIVE-INDICATION */
/* CONNECT-B3-T90-ACTIVE-INDICATION */
typedef struct {
byte structs[0]; /* NCPI */
byte structs[0]; /* NCPI */
} _CON_B3_T90_A_INDP;
/* CONNECT-B3-T90-ACTIVE-RESPONSE */
/* CONNECT-B3-T90-ACTIVE-RESPONSE */
typedef struct {
word Reject;
byte structs[0]; /* NCPI */
word Reject;
byte structs[0]; /* NCPI */
} _CON_B3_T90_A_RESP;
/*------------------------------------------------------------------*/
/* message structure */
@ -364,64 +364,64 @@ typedef struct {
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;
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 */
@ -696,4 +696,4 @@ struct _API_MSG {
/* function prototypes */
/*------------------------------------------------------------------*/
/*------------------------------------------------------------------*/
#endif /* _INC_CAPI20 */
#endif /* _INC_CAPI20 */

File diff suppressed because it is too large Load Diff

View File

@ -1,29 +1,29 @@
/*
*
Copyright (c) Eicon Networks, 2002.
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
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 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.
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.
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_
#ifndef CAPIDTMF_H_
#define CAPIDTMF_H_
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
@ -48,32 +48,32 @@
#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;
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;
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); }
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
#endif

View File

@ -2,10 +2,10 @@
*
* ISDN interface module for Eicon active cards DIVA.
* CAPI Interface common functions
*
* Copyright 2000-2003 by Armin Schindler (mac@melware.de)
*
* 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.
*
@ -43,7 +43,7 @@ static diva_os_spin_lock_t api_lock;
static LIST_HEAD(cards);
static dword notify_handle;
static void DIRequest(ENTITY * e);
static void DIRequest(ENTITY *e);
static DESCRIPTOR MAdapter;
static DESCRIPTOR DAdapter;
static byte ControllerMap[MAX_DESCRIPTORS + 1];
@ -160,7 +160,7 @@ static int find_free_id(void)
break;
num++;
}
return(num + 1);
return (num + 1);
}
/*
@ -176,23 +176,23 @@ static diva_card *find_card_by_ctrl(word controller)
if (ControllerMap[card->Id] == controller) {
if (card->remove_in_progress)
card = NULL;
return(card);
return (card);
}
}
return (diva_card *) 0;
}
/*
* Buffer RX/TX
* Buffer RX/TX
*/
void *TransmitBufferSet(APPL * appl, dword ref)
void *TransmitBufferSet(APPL *appl, dword ref)
{
appl->xbuffer_used[ref] = true;
DBG_PRV1(("%d:xbuf_used(%d)", appl->Id, ref + 1))
return (void *)(long)ref;
return (void *)(long)ref;
}
void *TransmitBufferGet(APPL * appl, void *p)
void *TransmitBufferGet(APPL *appl, void *p)
{
if (appl->xbuffer_internal[(dword)(long)p])
return appl->xbuffer_internal[(dword)(long)p];
@ -200,13 +200,13 @@ void *TransmitBufferGet(APPL * appl, void *p)
return appl->xbuffer_ptr[(dword)(long)p];
}
void TransmitBufferFree(APPL * appl, void *p)
void TransmitBufferFree(APPL *appl, void *p)
{
appl->xbuffer_used[(dword)(long)p] = false;
DBG_PRV1(("%d:xbuf_free(%d)", appl->Id, ((dword)(long)p) + 1))
}
}
void *ReceiveBufferGet(APPL * appl, int Num)
void *ReceiveBufferGet(APPL *appl, int Num)
{
return &appl->ReceiveBuffer[Num * appl->MaxDataLength];
}
@ -217,12 +217,12 @@ void *ReceiveBufferGet(APPL * appl, int Num)
void api_remove_complete(void)
{
DBG_PRV1(("api_remove_complete"))
}
}
/*
* main function called by message.c
*/
void sendf(APPL * appl, word command, dword Id, word Number, byte * format, ...)
void sendf(APPL *appl, word command, dword Id, word Number, byte *format, ...)
{
word i, j;
word length = 12, dlength = 0;
@ -240,14 +240,14 @@ void sendf(APPL * appl, word command, dword Id, word Number, byte * format, ...)
DBG_PRV1(("sendf(a=%d,cmd=%x,format=%s)",
appl->Id, command, (byte *) format))
PUT_WORD(&msg.header.appl_id, appl->Id);
PUT_WORD(&msg.header.appl_id, appl->Id);
PUT_WORD(&msg.header.command, command);
if ((byte) (command >> 8) == 0x82)
Number = appl->Number++;
PUT_WORD(&msg.header.number, Number);
PUT_DWORD(&msg.header.controller, Id);
write = (byte *) & msg;
write = (byte *)&msg;
write += 12;
va_start(ap, format);
@ -287,16 +287,16 @@ void sendf(APPL * appl, word command, dword Id, word Number, byte * format, ...)
if (command == _DATA_B3_I)
dlength = GET_WORD(
((byte *) & msg.info.data_b3_ind.Data_Length));
((byte *)&msg.info.data_b3_ind.Data_Length));
if (!(dmb = diva_os_alloc_message_buffer(length + dlength,
(void **) &write))) {
(void **) &write))) {
DBG_ERR(("sendf: alloc_message_buffer failed, incoming msg dropped."))
return;
return;
}
/* copy msg header to sk_buff */
memcpy(write, (byte *) & msg, length);
memcpy(write, (byte *)&msg, length);
/* if DATA_B3_IND, copy data too */
if (command == _DATA_B3_I) {
@ -318,10 +318,10 @@ void sendf(APPL * appl, word command, dword Id, word Number, byte * format, ...)
if (myDriverDebugHandle.dbgMask & DL_BLK) {
xlog("\x00\x02", &msg, 0x81, length);
for (i = 0; i < dlength; i += 256) {
DBG_BLK((((char *)(long)GET_DWORD(&msg.info.data_b3_ind.Data)) + i,
((dlength - i) < 256) ? (dlength - i) : 256))
if (!(myDriverDebugHandle.dbgMask & DL_PRV0))
break; /* not more if not explicitly requested */
DBG_BLK((((char *)(long)GET_DWORD(&msg.info.data_b3_ind.Data)) + i,
((dlength - i) < 256) ? (dlength - i) : 256))
if (!(myDriverDebugHandle.dbgMask & DL_PRV0))
break; /* not more if not explicitly requested */
}
}
break;
@ -333,7 +333,7 @@ void sendf(APPL * appl, word command, dword Id, word Number, byte * format, ...)
if (!(card = find_card_by_ctrl(write[8] & 0x7f))) {
DBG_ERR(("sendf - controller %d not found, incoming msg dropped",
write[8] & 0x7f))
diva_os_free_message_buffer(dmb);
diva_os_free_message_buffer(dmb);
return;
}
/* send capi msg to capi layer */
@ -388,7 +388,7 @@ static void clean_adapter(int id, struct list_head *free_mem_q)
* remove a card, but ensures consistent state of LI tables
* in the time adapter is removed
*/
static void divacapi_remove_card(DESCRIPTOR * d)
static void divacapi_remove_card(DESCRIPTOR *d)
{
diva_card *card = NULL;
diva_os_spin_lock_magic_t old_irql;
@ -427,14 +427,14 @@ static void divacapi_remove_card(DESCRIPTOR * d)
clean_adapter(card->Id - 1, &free_mem_q);
DBG_TRC(("DelAdapterMap (%d) -> (%d)",
ControllerMap[card->Id], card->Id))
ControllerMap[card->Id] = 0;
ControllerMap[card->Id], card->Id))
ControllerMap[card->Id] = 0;
DBG_TRC(("adapter remove, max_adapter=%d",
max_adapter));
max_adapter));
diva_os_leave_spin_lock(&api_lock, &old_irql, "remove card");
/* After releasing the lock, we can free the memory */
diva_os_free (0, card);
diva_os_free(0, card);
}
/* free queued memory areas */
@ -469,13 +469,13 @@ rescan:
/*
* sync_callback
*/
static void sync_callback(ENTITY * e)
static void sync_callback(ENTITY *e)
{
diva_os_spin_lock_magic_t old_irql;
DBG_TRC(("cb:Id=%x,Rc=%x,Ind=%x", e->Id, e->Rc, e->Ind))
diva_os_enter_spin_lock(&api_lock, &old_irql, "sync_callback");
diva_os_enter_spin_lock(&api_lock, &old_irql, "sync_callback");
callback(e);
diva_os_leave_spin_lock(&api_lock, &old_irql, "sync_callback");
}
@ -483,7 +483,7 @@ static void sync_callback(ENTITY * e)
/*
* add a new card
*/
static int diva_add_card(DESCRIPTOR * d)
static int diva_add_card(DESCRIPTOR *d)
{
int k = 0, i = 0;
diva_os_spin_lock_magic_t old_irql;
@ -492,19 +492,19 @@ static int diva_add_card(DESCRIPTOR * d)
DIVA_CAPI_ADAPTER *a = NULL;
IDI_SYNC_REQ sync_req;
char serial[16];
void* mem_to_free;
void *mem_to_free;
LI_CONFIG *new_li_config_table;
int j;
if (!(card = (diva_card *) diva_os_malloc(0, sizeof(diva_card)))) {
DBG_ERR(("diva_add_card: failed to allocate card struct."))
return (0);
return (0);
}
memset((char *) card, 0x00, sizeof(diva_card));
memcpy(&card->d, d, sizeof(DESCRIPTOR));
sync_req.GetName.Req = 0;
sync_req.GetName.Rc = IDI_SYNC_REQ_GET_NAME;
card->d.request((ENTITY *) & sync_req);
card->d.request((ENTITY *)&sync_req);
strlcpy(card->name, sync_req.GetName.name, sizeof(card->name));
ctrl = &card->capi_ctrl;
strcpy(ctrl->name, card->name);
@ -517,14 +517,14 @@ static int diva_add_card(DESCRIPTOR * d)
if (attach_capi_ctr(ctrl)) {
DBG_ERR(("diva_add_card: failed to attach controller."))
diva_os_free(0, card);
diva_os_free(0, card);
return (0);
}
diva_os_enter_spin_lock(&api_lock, &old_irql, "find id");
card->Id = find_free_id();
diva_os_leave_spin_lock(&api_lock, &old_irql, "find id");
strlcpy(ctrl->manu, M_COMPANY, sizeof(ctrl->manu));
ctrl->version.majorversion = 2;
ctrl->version.minorversion = 0;
@ -533,7 +533,7 @@ static int diva_add_card(DESCRIPTOR * d)
sync_req.GetSerial.Req = 0;
sync_req.GetSerial.Rc = IDI_SYNC_REQ_GET_SERIAL;
sync_req.GetSerial.serial = 0;
card->d.request((ENTITY *) & sync_req);
card->d.request((ENTITY *)&sync_req);
if ((i = ((sync_req.GetSerial.serial & 0xff000000) >> 24))) {
sprintf(serial, "%ld-%d",
sync_req.GetSerial.serial & 0x00ffffff, i + 1);
@ -550,15 +550,15 @@ static int diva_add_card(DESCRIPTOR * d)
DBG_TRC(("AddAdapterMap (%d) -> (%d)", ctrl->cnr, card->Id))
sync_req.xdi_capi_prms.Req = 0;
sync_req.xdi_capi_prms.Req = 0;
sync_req.xdi_capi_prms.Rc = IDI_SYNC_REQ_XDI_GET_CAPI_PARAMS;
sync_req.xdi_capi_prms.info.structure_length =
sizeof(diva_xdi_get_capi_parameters_t);
card->d.request((ENTITY *) & sync_req);
sizeof(diva_xdi_get_capi_parameters_t);
card->d.request((ENTITY *)&sync_req);
a->flag_dynamic_l1_down =
sync_req.xdi_capi_prms.info.flag_dynamic_l1_down;
sync_req.xdi_capi_prms.info.flag_dynamic_l1_down;
a->group_optimization_enabled =
sync_req.xdi_capi_prms.info.group_optimization_enabled;
sync_req.xdi_capi_prms.info.group_optimization_enabled;
a->request = DIRequest; /* card->d.request; */
a->max_plci = card->d.channels + 30;
a->max_listen = (card->d.channels > 2) ? 8 : 2;
@ -566,7 +566,7 @@ static int diva_add_card(DESCRIPTOR * d)
(a->plci =
(PLCI *) diva_os_malloc(0, sizeof(PLCI) * a->max_plci))) {
DBG_ERR(("diva_add_card: failed alloc plci struct."))
memset(a, 0, sizeof(DIVA_CAPI_ADAPTER));
memset(a, 0, sizeof(DIVA_CAPI_ADAPTER));
return (0);
}
memset(a->plci, 0, sizeof(PLCI) * a->max_plci);
@ -625,13 +625,13 @@ static int diva_add_card(DESCRIPTOR * d)
(LI_CONFIG *) diva_os_malloc(0, ((k * sizeof(LI_CONFIG) + 3) & ~3) + (2 * k) * ((k + 3) & ~3));
if (new_li_config_table == NULL) {
DBG_ERR(("diva_add_card: failed alloc li_config table."))
memset(a, 0, sizeof(DIVA_CAPI_ADAPTER));
memset(a, 0, sizeof(DIVA_CAPI_ADAPTER));
return (0);
}
/* Prevent access to line interconnect table in process update */
diva_os_enter_spin_lock(&api_lock, &old_irql, "add card");
j = 0;
for (i = 0; i < k; i++) {
if ((i >= a->li_base) && (i < a->li_base + a->li_channels))
@ -659,11 +659,11 @@ static int diva_add_card(DESCRIPTOR * d)
memset(&new_li_config_table[i].coef_table[a->li_base], 0, a->li_channels);
if (a->li_base + a->li_channels < k) {
memcpy(&new_li_config_table[i].flag_table[a->li_base +
a->li_channels],
a->li_channels],
&li_config_table[j].flag_table[a->li_base],
k - (a->li_base + a->li_channels));
memcpy(&new_li_config_table[i].coef_table[a->li_base +
a->li_channels],
a->li_channels],
&li_config_table[j].coef_table[a->li_base],
k - (a->li_base + a->li_channels));
}
@ -689,7 +689,7 @@ static int diva_add_card(DESCRIPTOR * d)
diva_os_leave_spin_lock(&api_lock, &old_irql, "add card");
if (mem_to_free) {
diva_os_free (0, mem_to_free);
diva_os_free(0, mem_to_free);
}
i = 0;
@ -722,7 +722,7 @@ static int diva_add_card(DESCRIPTOR * d)
* register appl
*/
static void diva_register_appl(struct capi_ctr *ctrl, __u16 appl,
capi_register_params * rp)
capi_register_params *rp)
{
APPL *this;
word bnum, xnum;
@ -737,38 +737,38 @@ static void diva_register_appl(struct capi_ctr *ctrl, __u16 appl,
if (diva_os_in_irq()) {
DBG_ERR(("CAPI_REGISTER - in irq context !"))
return;
return;
}
DBG_TRC(("application register Id=%d", appl))
if (appl > MAX_APPL) {
DBG_ERR(("CAPI_REGISTER - appl.Id exceeds MAX_APPL"))
return;
}
if (appl > MAX_APPL) {
DBG_ERR(("CAPI_REGISTER - appl.Id exceeds MAX_APPL"))
return;
}
if (nconn <= 0)
nconn = ctrl->profile.nbchannel * -nconn;
if (nconn == 0)
if (nconn == 0)
nconn = ctrl->profile.nbchannel;
DBG_LOG(("CAPI_REGISTER - Id = %d", appl))
DBG_LOG((" MaxLogicalConnections = %d(%d)", nconn, rp->level3cnt))
DBG_LOG((" MaxBDataBuffers = %d", rp->datablkcnt))
DBG_LOG((" MaxBDataLength = %d", rp->datablklen))
DBG_LOG((" MaxLogicalConnections = %d(%d)", nconn, rp->level3cnt))
DBG_LOG((" MaxBDataBuffers = %d", rp->datablkcnt))
DBG_LOG((" MaxBDataLength = %d", rp->datablklen))
if (nconn < 1 ||
nconn > 255 ||
rp->datablklen < 80 ||
rp->datablklen > 2150 || rp->datablkcnt > 255) {
DBG_ERR(("CAPI_REGISTER - invalid parameters"))
return;
}
if (nconn < 1 ||
nconn > 255 ||
rp->datablklen < 80 ||
rp->datablklen > 2150 || rp->datablkcnt > 255) {
DBG_ERR(("CAPI_REGISTER - invalid parameters"))
return;
}
if (application[appl - 1].Id == appl) {
DBG_LOG(("CAPI_REGISTER - appl already registered"))
return; /* appl already registered */
return; /* appl already registered */
}
/* alloc memory */
@ -785,10 +785,10 @@ static void diva_register_appl(struct capi_ctr *ctrl, __u16 appl,
mem_len += xnum * rp->datablklen; /* xbuffer_ptr[xnum] */
DBG_LOG((" Allocated Memory = %d", mem_len))
if (!(p = diva_os_malloc(0, mem_len))) {
DBG_ERR(("CAPI_REGISTER - memory allocation failed"))
return;
}
if (!(p = diva_os_malloc(0, mem_len))) {
DBG_ERR(("CAPI_REGISTER - memory allocation failed"))
return;
}
memset(p, 0, mem_len);
DataNCCI = (void *)p;
@ -853,10 +853,10 @@ static void diva_release_appl(struct capi_ctr *ctrl, __u16 appl)
DBG_TRC(("application %d(%d) cleanup", this->Id, appl))
if (diva_os_in_irq()) {
DBG_ERR(("CAPI_RELEASE - in irq context !"))
return;
}
if (diva_os_in_irq()) {
DBG_ERR(("CAPI_RELEASE - in irq context !"))
return;
}
diva_os_enter_spin_lock(&api_lock, &old_irql, "release_appl");
if (this->Id) {
@ -876,7 +876,7 @@ static void diva_release_appl(struct capi_ctr *ctrl, __u16 appl)
* send message
*/
static u16 diva_send_message(struct capi_ctr *ctrl,
diva_os_message_buffer_s * dmb)
diva_os_message_buffer_s *dmb)
{
int i = 0;
word ret = 0;
@ -891,14 +891,14 @@ static u16 diva_send_message(struct capi_ctr *ctrl,
if (diva_os_in_irq()) {
DBG_ERR(("CAPI_SEND_MSG - in irq context !"))
return CAPI_REGOSRESOURCEERR;
return CAPI_REGOSRESOURCEERR;
}
DBG_PRV1(("Write - appl = %d, cmd = 0x%x", this->Id, command))
if (card->remove_in_progress) {
DBG_ERR(("CAPI_SEND_MSG - remove in progress!"))
return CAPI_REGOSRESOURCEERR;
}
if (card->remove_in_progress) {
DBG_ERR(("CAPI_SEND_MSG - remove in progress!"))
return CAPI_REGOSRESOURCEERR;
}
diva_os_enter_spin_lock(&api_lock, &old_irql, "send message");
@ -909,7 +909,7 @@ static u16 diva_send_message(struct capi_ctr *ctrl,
/* patch controller number */
msg->header.controller = ControllerMap[card->Id]
| (msg->header.controller & 0x80); /* preserve external controller bit */
| (msg->header.controller & 0x80); /* preserve external controller bit */
switch (command) {
default:
@ -937,15 +937,15 @@ static u16 diva_send_message(struct capi_ctr *ctrl,
|| GET_WORD(&msg->info.data_b3_req.Data_Length) >
(length - clength)) {
DBG_ERR(("Write - invalid message size"))
retval = CAPI_ILLCMDORSUBCMDORMSGTOSMALL;
retval = CAPI_ILLCMDORSUBCMDORMSGTOSMALL;
goto write_end;
}
for (i = 0; i < (MAX_DATA_B3 * this->MaxNCCI)
&& this->xbuffer_used[i]; i++);
&& this->xbuffer_used[i]; i++);
if (i == (MAX_DATA_B3 * this->MaxNCCI)) {
DBG_ERR(("Write - too many data pending"))
retval = CAPI_SENDQUEUEFULL;
retval = CAPI_SENDQUEUEFULL;
goto write_end;
}
msg->info.data_b3_req.Data = i;
@ -959,13 +959,13 @@ static u16 diva_send_message(struct capi_ctr *ctrl,
&& (myDriverDebugHandle.dbgMask & DL_XLOG)) {
int j;
for (j = 0; j <
GET_WORD(&msg->info.data_b3_req.Data_Length);
GET_WORD(&msg->info.data_b3_req.Data_Length);
j += 256) {
DBG_BLK((((char *) this->xbuffer_ptr[i]) + j,
((GET_WORD(&msg->info.data_b3_req.Data_Length) - j) <
((GET_WORD(&msg->info.data_b3_req.Data_Length) - j) <
256) ? (GET_WORD(&msg->info.data_b3_req.Data_Length) - j) : 256))
if (!(myDriverDebugHandle.dbgMask & DL_PRV0))
break; /* not more if not explicitly requested */
if (!(myDriverDebugHandle.dbgMask & DL_PRV0))
break; /* not more if not explicitly requested */
}
}
#endif
@ -984,19 +984,19 @@ static u16 diva_send_message(struct capi_ctr *ctrl,
break;
case _BAD_MSG:
DBG_ERR(("Write - bad message"))
retval = CAPI_ILLCMDORSUBCMDORMSGTOSMALL;
retval = CAPI_ILLCMDORSUBCMDORMSGTOSMALL;
break;
case _QUEUE_FULL:
DBG_ERR(("Write - queue full"))
retval = CAPI_SENDQUEUEFULL;
retval = CAPI_SENDQUEUEFULL;
break;
default:
DBG_ERR(("Write - api_put returned unknown error"))
retval = CAPI_UNKNOWNNOTPAR;
retval = CAPI_UNKNOWNNOTPAR;
break;
}
write_end:
write_end:
diva_os_leave_spin_lock(&api_lock, &old_irql, "send message");
if (retval == CAPI_NOERROR)
diva_os_free_message_buffer(dmb);
@ -1007,7 +1007,7 @@ static u16 diva_send_message(struct capi_ctr *ctrl,
/*
* cards request function
*/
static void DIRequest(ENTITY * e)
static void DIRequest(ENTITY *e)
{
DIVA_CAPI_ADAPTER *a = &(adapter[(byte) e->user[0]]);
diva_card *os_card = (diva_card *) a->os_card;
@ -1022,7 +1022,7 @@ static void DIRequest(ENTITY * e)
/*
* callback function from didd
*/
static void didd_callback(void *context, DESCRIPTOR * adapter, int removal)
static void didd_callback(void *context, DESCRIPTOR *adapter, int removal)
{
if (adapter->type == IDI_DADAPTER) {
DBG_ERR(("Notification about IDI_DADAPTER change ! Oops."));
@ -1071,17 +1071,17 @@ static int divacapi_connect_didd(void)
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;
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);
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 > 0) && (DIDD_Table[x].type < 16)) { /* IDI Adapter found */
else if ((DIDD_Table[x].type > 0) && (DIDD_Table[x].type < 16)) { /* IDI Adapter found */
diva_add_card(&DIDD_Table[x]);
}
}
@ -1105,12 +1105,12 @@ static void divacapi_disconnect_didd(void)
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);
DAdapter.request((ENTITY *)&req);
}
/*
* we do not provide date/time here,
* the application should do this.
* the application should do this.
*/
int fax_head_line_time(char *buffer)
{
@ -1124,19 +1124,19 @@ static int DIVA_INIT_FUNCTION init_main_structs(void)
{
if (!(mapped_msg = (CAPI_MSG *) diva_os_malloc(0, MAX_MSG_SIZE))) {
DBG_ERR(("init: failed alloc mapped_msg."))
return 0;
return 0;
}
if (!(adapter = diva_os_malloc(0, sizeof(DIVA_CAPI_ADAPTER) * MAX_DESCRIPTORS))) {
DBG_ERR(("init: failed alloc adapter struct."))
diva_os_free(0, mapped_msg);
diva_os_free(0, mapped_msg);
return 0;
}
memset(adapter, 0, sizeof(DIVA_CAPI_ADAPTER) * MAX_DESCRIPTORS);
if (!(application = diva_os_malloc(0, sizeof(APPL) * MAX_APPL))) {
DBG_ERR(("init: failed alloc application struct."))
diva_os_free(0, mapped_msg);
diva_os_free(0, mapped_msg);
diva_os_free(0, adapter);
return 0;
}
@ -1176,7 +1176,7 @@ static void do_api_remove_start(void)
if (ret)
DBG_ERR(("could not remove signaling ID's"))
}
}
/*
* init
@ -1190,13 +1190,13 @@ int DIVA_INIT_FUNCTION init_capifunc(void)
if (!init_main_structs()) {
DBG_ERR(("init: failed to init main structs."))
diva_os_destroy_spin_lock(&api_lock, "capifunc");
diva_os_destroy_spin_lock(&api_lock, "capifunc");
return (0);
}
if (!divacapi_connect_didd()) {
DBG_ERR(("init: failed to connect to DIDD."))
do_api_remove_start();
do_api_remove_start();
divacapi_remove_cards();
remove_main_structs();
diva_os_destroy_spin_lock(&api_lock, "capifunc");

View File

@ -2,8 +2,8 @@
*
* ISDN interface module for Eicon active cards DIVA.
* CAPI Interface common functions
*
* Copyright 2000-2003 by Armin Schindler (mac@melware.de)
*
* 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

View File

@ -2,10 +2,10 @@
*
* ISDN interface module for Eicon active cards DIVA.
* CAPI Interface
*
* Copyright 2000-2003 by Armin Schindler (mac@melware.de)
*
* 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.
*/
@ -28,7 +28,7 @@
static char *main_revision = "$Revision: 1.24 $";
static char *DRIVERNAME =
"Eicon DIVA - CAPI Interface driver (http://www.melware.net)";
"Eicon DIVA - CAPI Interface driver (http://www.melware.net)";
static char *DRIVERLNAME = "divacapi";
MODULE_DESCRIPTION("CAPI driver for Eicon DIVA cards");
@ -69,7 +69,7 @@ diva_os_message_buffer_s *diva_os_alloc_message_buffer(unsigned long size,
/*
* free a message buffer
*/
void diva_os_free_message_buffer(diva_os_message_buffer_s * dmb)
void diva_os_free_message_buffer(diva_os_message_buffer_s *dmb)
{
kfree_skb(dmb);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +1,26 @@
/*
*
Copyright (c) Eicon Networks, 2002.
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
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 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.
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.
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";
static char diva_capi_common_code_build[] = "102-28";

View File

@ -1,26 +1,25 @@
/*
*
Copyright (c) Eicon Networks, 2002.
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
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 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.
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.
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"
@ -30,337 +29,336 @@
#include "divasync.h"
#include "dadapter.h"
/* --------------------------------------------------------------------------
Adapter array change notification framework
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;
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];
static didd_adapter_change_notification_t \
NotificationTable[DIVA_DIDD_MAX_NOTIFICATIONS];
/* --------------------------------------------------------------------------
Array to held adapter information
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
Shadow IDI_DIMAINT
and 'shadow' debug stuff
-------------------------------------------------------------------------- */
static void no_printf (unsigned char * format, ...)
static void no_printf(unsigned char *format, ...)
{
#ifdef EBUG
va_list ap;
va_start (ap, format);
va_start(ap, format);
debug((format, ap));
va_end (ap);
va_end(ap);
#endif
}
/* -------------------------------------------------------------------------
Portable debug Library
------------------------------------------------------------------------- */
Portable debug Library
------------------------------------------------------------------------- */
#include "debuglib.c"
static DESCRIPTOR MAdapter = {IDI_DIMAINT, /* Adapter Type */
0x00, /* Channels */
0x0000, /* Features */
(IDI_CALL)no_printf};
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 }
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 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 };
0x00, /* Channels */
0x0000, /* Features */
diva_dadapter_request };
/* --------------------------------------------------------------------------
LOCALS
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 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
Should be called as first step, after driver init
-------------------------------------------------------------------------- */
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);
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");
}
/* --------------------------------------------------------------------------
DAdapter request function.
This function does process only synchronous requests, and is used
for reception/registration of new interfaces
Should be called as last step, if driver does unload
-------------------------------------------------------------------------- */
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;
}
void diva_didd_load_time_finit(void) {
diva_os_destroy_spin_lock(&didd_spin, "didd");
}
/* --------------------------------------------------------------------------
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);
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);
}
/* --------------------------------------------------------------------------
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))
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);
}
/* --------------------------------------------------------------------------
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);
}
}
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);
}
/* --------------------------------------------------------------------------
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:
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:
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):
*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
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);
-------------------------------------------------------------------------- */
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,33 +1,33 @@
/*
*
Copyright (c) Eicon Networks, 2002.
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
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 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.
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.
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);
void diva_didd_load_time_init(void);
void diva_didd_load_time_finit(void);
#define NEW_MAX_DESCRIPTORS 64

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +1,23 @@
/*
*
Copyright (c) Eicon Technology Corporation, 2000.
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 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 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.
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.
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__
@ -31,35 +31,35 @@
#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;
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);
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);
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
@ -72,7 +72,7 @@ int diva_get_trace_filter (int max_length, char* filter);
/*
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 */
@ -86,5 +86,3 @@ int diva_get_trace_filter (int max_length, char* filter);
#define DIVA_MGT_DBG_IFC_AUDIO 0x00000400 /* Audio Tap trace for all channels */
# endif /* DEBUG_IF___H */

View File

@ -1,26 +1,26 @@
/*
*
Copyright (c) Eicon Networks, 2002.
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
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 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.
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.
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.
*
*/
@ -29,35 +29,35 @@
#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) ; \
} }
#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) ;
} }
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)
@ -76,81 +76,81 @@ DBG_FUNC(PRV2)
DBG_FUNC(PRV3)
/*****************************************************************************/
int
DbgRegister (char *drvName, char *drvTag, unsigned long dbgMask)
DbgRegister(char *drvName, char *drvTag, unsigned long dbgMask)
{
int len;
int len;
/*
* deregister (if already registered) and zero out myDriverDebugHandle
*/
DbgDeregister () ;
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) ;
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) ;
}
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) ;
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)
DbgSetLevel(unsigned long dbgMask)
{
myDriverDebugHandle.dbgMask = dbgMask | (DL_EVL | DL_FTL | DL_LOG) ;
myDriverDebugHandle.dbgMask = dbgMask | (DL_EVL | DL_FTL | DL_LOG);
}
/*****************************************************************************/
void
DbgDeregister (void)
DbgDeregister(void)
{
if ( myDriverDebugHandle.dbg_end )
{
(myDriverDebugHandle.dbg_end)(&myDriverDebugHandle) ;
}
memset (&myDriverDebugHandle, 0, sizeof(myDriverDebugHandle)) ;
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);
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,26 +1,26 @@
/*
*
Copyright (c) Eicon Networks, 2002.
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
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 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.
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.
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__)
@ -103,43 +103,43 @@
#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);
#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 *, ...) ;
#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, ...) ;
extern void myDbgPrint_EVL(long, ...);
DBG_DECL(REG)
DBG_DECL(MEM)
DBG_DECL(SPL)
@ -156,34 +156,34 @@ DBG_DECL(PRV0)
DBG_DECL(PRV1)
DBG_DECL(PRV2)
DBG_DECL(PRV3)
#ifdef _KERNEL_DBG_PRINT_
#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 ; \
} }
#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 ; \
} }
#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 ; \
} }
#define DBG_EVL_ID(args) \
{ if ((myDriverDebugHandle.dbgMask) & (unsigned long)DL_EVL) \
{ myDbgPrint_EVL args; \
} }
#endif /* DIVA_NO_DEBUGLIB */
@ -214,109 +214,109 @@ DBG_DECL(PRV3)
* 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)
#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) ;
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_ *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 */
{ 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 */
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 ;
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_ ;
{ 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 !
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;
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
Function used for xlog-style debug
------------------------------------------------------------- */
#define XDI_USE_XLOG 1
void xdi_dbg_xlog (char* x, ...);
void xdi_dbg_xlog(char *x, ...);
#endif /* DIVA_NO_DEBUGLIB */
#endif /* __DEBUGLIB_H__ */

View File

@ -1,54 +1,54 @@
/*
*
Copyright (c) Eicon Networks, 2002.
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
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 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.
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.
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)
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_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:
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);
int diva_dfifo_create(void *start, int length);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +1,26 @@
/*
*
Copyright (c) Eicon Networks, 2002.
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
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 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.
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.
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.
*
*/
/*
@ -35,83 +35,83 @@
#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 */
/* 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);
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);
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];
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);
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);
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);
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

View File

@ -1,34 +1,34 @@
/*
*
Copyright (c) Eicon Networks, 2002.
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
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 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.
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.
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)
#if !defined(dtrc)
#define dtrc(a)
#endif
#if !defined (dbug)
#if !defined(dbug)
#define dbug(a)
#endif
#if !defined USE_EXTENDED_DEBUGS

View File

@ -1,31 +1,31 @@
/*
*
Copyright (c) Eicon Networks, 2002.
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
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 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.
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.
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_
#ifndef _DI_DEFS_
#define _DI_DEFS_
/* typedefs for our data structures */
/* 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 */
@ -38,72 +38,72 @@ typedef struct get_para_s GET_PARA;
#define IDI_CALL_ENTITY_T
/* typedef void ( * IDI_CALL)(ENTITY *); */
/* --------------------------------------------------------
IDI_CALL
IDI_CALL
-------------------------------------------------------- */
typedef void (IDI_CALL_LINK_T * IDI_CALL)(ENTITY IDI_CALL_ENTITY_T *);
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 */
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];
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 */
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 */
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;
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 */
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;
byte type;
byte channels;
word features;
IDI_CALL request;
} DESCRIPTOR;
/* descriptor type field coding */
/* descriptor type field coding */
#define IDI_ADAPTER_S 1
#define IDI_ADAPTER_PR 2
#define IDI_ADAPTER_DIVA 3
@ -113,7 +113,7 @@ typedef struct {
#define IDI_DADAPTER 0xfd
#define IDI_DIDDPNP 0xfe
#define IDI_DIMAINT 0xff
/* Hardware IDs ISA PNP */
/* 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
@ -123,7 +123,7 @@ typedef struct {
#define HW_ID_DIVA20_U 9
#define HW_ID_DIVA30 10
#define HW_ID_DIVA30_U 11
/* Hardware IDs PCI */
/* 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 */
@ -153,16 +153,16 @@ typedef struct {
#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 */
/* 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);
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
@ -177,5 +177,5 @@ typedef void (IDI_CALL_LINK_T* didd_adapter_change_callback_t)( void IDI_CAL
#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
typedef void (IDI_CALL_LINK_T *_IDI_CALL)(void *, ENTITY *);
#endif

View File

@ -1,26 +1,26 @@
/*
*
Copyright (c) Eicon Networks, 2002.
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
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 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.
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.
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";
static char diva_didd_common_code_build[] = "102-51";

View File

@ -1,12 +1,12 @@
/* $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)
*
* 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.
*/
@ -28,12 +28,12 @@ static DESCRIPTOR _DAdapter;
/*
* didd callback function
*/
static void *didd_callback(void *context, DESCRIPTOR * adapter,
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);
return (NULL);
} else if (adapter->type == IDI_DIMAINT) {
if (removal) {
DbgDeregister();
@ -62,10 +62,10 @@ static int DIVA_INIT_FUNCTION connect_didd(void)
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;
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);
_DAdapter.request((ENTITY *)&req);
if (req.didd_notify.e.Rc != 0xff)
return (0);
notify_handle = req.didd_notify.info.handle;
@ -86,7 +86,7 @@ static void DIVA_EXIT_FUNCTION disconnect_didd(void)
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);
_DAdapter.request((ENTITY *)&req);
}
/*
@ -98,7 +98,7 @@ int DIVA_INIT_FUNCTION diddfunc_init(void)
if (!connect_didd()) {
DBG_ERR(("init: failed to connect to DIDD."))
diva_didd_load_time_finit();
diva_didd_load_time_finit();
return (0);
}
return (1);

View File

@ -28,12 +28,12 @@
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);
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) ; }
#define DivaIdiReqFunc(N) \
static void DivaIdiRequest##N(ENTITY *e) \
{ if (IoAdapters[N]) (*IoAdapters[N]->DIRequest)(IoAdapters[N], e); }
/*
** Create own 32 Adapters
@ -91,44 +91,44 @@ typedef struct _diva_supported_cards_info {
static diva_supported_cards_info_t divas_supported_cards[] = {
#ifdef CONFIG_ISDN_DIVAS_PRIPCI
/*
PRI Cards
*/
PRI Cards
*/
{CARDTYPE_DIVASRV_P_30M_PCI, diva_pri_init_card},
/*
PRI Rev.2 Cards
*/
PRI Rev.2 Cards
*/
{CARDTYPE_DIVASRV_P_30M_V2_PCI, diva_pri_init_card},
/*
PRI Rev.2 VoIP Cards
*/
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
*/
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
*/
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
*/
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
*/
BRI
*/
{CARDTYPE_MAESTRA_PCI, diva_bri_init_card},
#endif
/*
EOL
*/
EOL
*/
{-1}
};
@ -150,18 +150,18 @@ static int diva_find_free_adapters(int base, int nr)
return (0);
}
static diva_os_xdi_adapter_t *diva_q_get_next(struct list_head * what)
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);
return (a);
}
/* --------------------------------------------------------------------------
Add card to the card list
Add card to the card list
-------------------------------------------------------------------------- */
void *diva_driver_add_card(void *pdev, unsigned long CardOrdinal)
{
@ -203,7 +203,7 @@ void *diva_driver_add_card(void *pdev, unsigned long CardOrdinal)
[CardOrdinal].Name,
pdiva->controller))
diva_os_enter_spin_lock(&adapter_lock, &old_irql, "add card");
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);
@ -214,11 +214,11 @@ void *diva_driver_add_card(void *pdev, unsigned long CardOrdinal)
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 */
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;
break;
}
}
@ -230,10 +230,10 @@ void *diva_driver_add_card(void *pdev, unsigned long CardOrdinal)
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "add card");
/*
Not able to add adapter - remove it and return error
*/
Not able to add adapter - remove it and return error
*/
DBG_ERR(("can not alloc request array"))
diva_driver_remove_card(pdiva);
diva_driver_remove_card(pdiva);
return NULL;
}
@ -243,7 +243,7 @@ void *diva_driver_add_card(void *pdev, unsigned long CardOrdinal)
}
/* --------------------------------------------------------------------------
Called on driver load, MAIN, main, DriverEntry
Called on driver load, MAIN, main, DriverEntry
-------------------------------------------------------------------------- */
int divasa_xdi_driver_entry(void)
{
@ -255,7 +255,7 @@ int divasa_xdi_driver_entry(void)
}
/* --------------------------------------------------------------------------
Remove adapter from list
Remove adapter from list
-------------------------------------------------------------------------- */
static diva_os_xdi_adapter_t *get_and_remove_from_queue(void)
{
@ -274,7 +274,7 @@ static diva_os_xdi_adapter_t *get_and_remove_from_queue(void)
}
/* --------------------------------------------------------------------------
Remove card from the card list
Remove card from the card list
-------------------------------------------------------------------------- */
void diva_driver_remove_card(void *pdiva)
{
@ -318,7 +318,7 @@ void diva_driver_remove_card(void *pdiva)
}
/* --------------------------------------------------------------------------
Create diva PCI adapter and init internal adapter structures
Create diva PCI adapter and init internal adapter structures
-------------------------------------------------------------------------- */
static void *divas_create_pci_card(int handle, void *pci_dev_handle)
{
@ -328,10 +328,10 @@ static void *divas_create_pci_card(int handle, void *pci_dev_handle)
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;
}
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));
@ -344,9 +344,9 @@ static void *divas_create_pci_card(int handle, void *pci_dev_handle)
a->resources.pci.hdev = pci_dev_handle;
/*
Add master adapter first, so slave adapters will receive higher
numbers as master adapter
*/
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");
@ -364,7 +364,7 @@ static void *divas_create_pci_card(int handle, void *pci_dev_handle)
}
/* --------------------------------------------------------------------------
Called on driver unload FINIT, finit, Unload
Called on driver unload FINIT, finit, Unload
-------------------------------------------------------------------------- */
void divasa_xdi_driver_unload(void)
{
@ -398,11 +398,11 @@ void *diva_xdi_open_adapter(void *os_handle, const void __user *src,
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;
return NULL;
}
if ((*cp_fn) (os_handle, &msg, src, sizeof(msg)) <= 0) {
DBG_ERR(("A: A(?) open, write error"))
return NULL;
return NULL;
}
diva_os_enter_spin_lock(&adapter_lock, &old_irql, "open_adapter");
list_for_each(tmp, &adapter_queue) {
@ -415,7 +415,7 @@ void *diva_xdi_open_adapter(void *os_handle, const void __user *src,
if (!a) {
DBG_ERR(("A: A(%d) open, adapter not found", msg.adapter))
}
}
return (a);
}
@ -443,19 +443,19 @@ diva_xdi_write(void *adapter, void *os_handle, const void __user *src,
if (a->xdi_mbox.status & DIVA_XDI_MBOX_BUSY) {
DBG_ERR(("A: A(%d) write, mbox busy", a->controller))
return (-1);
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);
return (-3);
}
if (!(data = diva_os_malloc(0, length))) {
DBG_ERR(("A: A(%d) write, ENOMEM", a->controller))
return (-2);
return (-2);
}
length = (*cp_fn) (os_handle, data, src, length);
@ -467,7 +467,7 @@ diva_xdi_write(void *adapter, void *os_handle, const void __user *src,
} else {
DBG_ERR(("A: A(%d) write error (%d)", a->controller,
length))
}
}
diva_os_free(0, data);
@ -486,23 +486,23 @@ diva_xdi_read(void *adapter, void *os_handle, void __user *dst,
if (!(a->xdi_mbox.status & DIVA_XDI_MBOX_BUSY)) {
DBG_ERR(("A: A(%d) rx mbox empty", a->controller))
return (-1);
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);
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);
return (-3);
}
ret = (*cp_fn) (os_handle, dst, a->xdi_mbox.data,
a->xdi_mbox.data_length);
a->xdi_mbox.data_length);
if (ret > 0) {
diva_os_free(0, a->xdi_mbox.data);
a->xdi_mbox.data = NULL;
@ -577,33 +577,33 @@ void diva_xdi_display_adapter_features(int 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"))
}
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)
void diva_add_slave_adapter(diva_os_xdi_adapter_t *a)
{
diva_os_spin_lock_magic_t old_irql;
@ -612,7 +612,7 @@ void diva_add_slave_adapter(diva_os_xdi_adapter_t * a)
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "add_slave");
}
int diva_card_read_xlog(diva_os_xdi_adapter_t * a)
int diva_card_read_xlog(diva_os_xdi_adapter_t *a)
{
diva_get_xlog_t *req;
byte *data;

View File

@ -1,12 +1,12 @@
/* $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)
*
* 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.
*/
@ -27,7 +27,7 @@
static char *main_revision = "$Revision: 1.13.6.4 $";
static char *DRIVERNAME =
"Eicon DIVA - DIDD table (http://www.melware.net)";
"Eicon DIVA - DIDD table (http://www.melware.net)";
static char *DRIVERLNAME = "divadidd";
char *DRIVERRELEASE_DIDD = "2.0";
@ -72,7 +72,7 @@ static int divadidd_proc_show(struct seq_file *m, void *v)
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);
diva_didd_common_code_build, DIVA_BUILD);
seq_printf(m, "revision : %s\n", getrev(tmprev));
return 0;
@ -137,7 +137,7 @@ static int DIVA_INIT_FUNCTION divadidd_init(void)
goto out;
}
out:
out:
return (ret);
}

View File

@ -1,26 +1,26 @@
/*
*
Copyright (c) Eicon Networks, 2002.
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
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 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.
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.
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"
@ -28,67 +28,67 @@
/*
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 */
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;
*/
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);
}
*/
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;
*/
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);
*/
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;
*/
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_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);
void *diva_get_entry_handle(struct _diva_dma_map_entry *pmap, int nr) {
return (pmap[nr].addr_handle);
}

View File

@ -1,48 +1,48 @@
/*
*
Copyright (c) Eicon Networks, 2002.
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
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 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.
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.
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);
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);
*/
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

@ -4,9 +4,9 @@
#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);
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);

View File

@ -1,26 +1,26 @@
/*
*
Copyright (c) Eicon Networks, 2002.
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
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 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.
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.
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.
*
*/
@ -29,8 +29,8 @@
@ -82,7 +82,7 @@
#define CODEC_PERMANENT 0x02
#define ADV_VOICE 0x03
#define MAX_CIP_TYPES 5 /* kind of CIP types for group optimization */
#define C_IND_MASK_DWORDS ((MAX_APPL+32) >> 5)
#define C_IND_MASK_DWORDS ((MAX_APPL + 32) >> 5)
#define FAX_CONNECT_INFO_BUFFER_SIZE 256
@ -116,289 +116,289 @@ typedef struct msn_config_max_s MSN_CONFIG_MAX;
typedef struct msn_ld_s MSN_LD;
struct manufacturer_profile_s {
dword private_options;
dword rtp_primary_payloads;
dword rtp_additional_payloads;
dword private_options;
dword rtp_primary_payloads;
dword rtp_additional_payloads;
};
struct fax_ncpi_s {
word options;
word format;
word options;
word format;
};
struct msn_config_s {
byte msn[MAX_CPN_MASK_SIZE];
byte msn[MAX_CPN_MASK_SIZE];
};
struct msn_config_max_s {
MSN_CONFIG msn_conf[MAX_MSN_CONFIG];
MSN_CONFIG msn_conf[MAX_MSN_CONFIG];
};
struct msn_ld_s {
dword low;
dword high;
dword low;
dword high;
};
struct api_parse_s {
word length;
byte * info;
word length;
byte *info;
};
struct api_save_s {
API_PARSE parms[MAX_MSG_PARMS+1];
byte info[MAX_MSG_SIZE];
API_PARSE parms[MAX_MSG_PARMS + 1];
byte info[MAX_MSG_SIZE];
};
struct _DATA_B3_DESC {
word Handle;
word Number;
word Flags;
word Length;
void * P;
word Handle;
word Number;
word Flags;
word Length;
void *P;
};
struct _DATA_ACK_DESC {
word Handle;
word Number;
word Handle;
word Number;
};
typedef void (* t_std_internal_command)(dword Id, PLCI *plci, byte Rc);
typedef void (*t_std_internal_command)(dword Id, PLCI *plci, byte Rc);
/************************************************************************/
/* Don't forget to adapt dos.asm after changing the _APPL structure!!!! */
struct _APPL {
word Id;
word NullCREnable;
word CDEnable;
dword S_Handle;
word Id;
word NullCREnable;
word CDEnable;
dword S_Handle;
LIST_ENTRY s_function;
dword s_context;
word s_count;
APPL * s_next;
byte * xbuffer_used;
void ** xbuffer_internal;
void ** xbuffer_ptr;
LIST_ENTRY s_function;
dword s_context;
word s_count;
APPL *s_next;
byte *xbuffer_used;
void **xbuffer_internal;
void **xbuffer_ptr;
byte * queue;
word queue_size;
word queue_free;
word queue_read;
word queue_write;
word queue_signal;
byte msg_lost;
byte appl_flags;
word Number;
byte *queue;
word queue_size;
word queue_free;
word queue_read;
word queue_write;
word queue_signal;
byte msg_lost;
byte appl_flags;
word Number;
word MaxBuffer;
byte MaxNCCI;
byte MaxNCCIData;
word MaxDataLength;
word NCCIDataFlowCtrlTimer;
byte * ReceiveBuffer;
word * DataNCCI;
word * DataFlags;
word MaxBuffer;
byte MaxNCCI;
byte MaxNCCIData;
word MaxDataLength;
word NCCIDataFlowCtrlTimer;
byte *ReceiveBuffer;
word *DataNCCI;
word *DataFlags;
};
struct _PLCI {
ENTITY Sig;
ENTITY NL;
word RNum;
word RFlags;
BUFFERS RData[2];
BUFFERS XData[1];
BUFFERS NData[2];
ENTITY Sig;
ENTITY NL;
word RNum;
word RFlags;
BUFFERS RData[2];
BUFFERS XData[1];
BUFFERS NData[2];
DIVA_CAPI_ADAPTER *adapter;
APPL *appl;
PLCI *relatedPTYPLCI;
byte Id;
byte State;
byte sig_req;
byte nl_req;
byte SuppState;
byte channels;
byte tel;
byte B1_resource;
byte B2_prot;
byte B3_prot;
DIVA_CAPI_ADAPTER *adapter;
APPL *appl;
PLCI *relatedPTYPLCI;
byte Id;
byte State;
byte sig_req;
byte nl_req;
byte SuppState;
byte channels;
byte tel;
byte B1_resource;
byte B2_prot;
byte B3_prot;
word command;
word m_command;
word internal_command;
word number;
word req_in_start;
word req_in;
word req_out;
word msg_in_write_pos;
word msg_in_read_pos;
word msg_in_wrap_pos;
word command;
word m_command;
word internal_command;
word number;
word req_in_start;
word req_in;
word req_out;
word msg_in_write_pos;
word msg_in_read_pos;
word msg_in_wrap_pos;
void * data_sent_ptr;
byte data_sent;
byte send_disc;
byte sig_global_req;
byte sig_remove_id;
byte nl_global_req;
byte nl_remove_id;
byte b_channel;
byte adv_nl;
byte manufacturer;
byte call_dir;
byte hook_state;
byte spoofed_msg;
byte ptyState;
byte cr_enquiry;
word hangup_flow_ctrl_timer;
void *data_sent_ptr;
byte data_sent;
byte send_disc;
byte sig_global_req;
byte sig_remove_id;
byte nl_global_req;
byte nl_remove_id;
byte b_channel;
byte adv_nl;
byte manufacturer;
byte call_dir;
byte hook_state;
byte spoofed_msg;
byte ptyState;
byte cr_enquiry;
word hangup_flow_ctrl_timer;
word ncci_ring_list;
byte inc_dis_ncci_table[MAX_CHANNELS_PER_PLCI];
t_std_internal_command internal_command_queue[MAX_INTERNAL_COMMAND_LEVELS];
dword c_ind_mask_table[C_IND_MASK_DWORDS];
dword group_optimization_mask_table[C_IND_MASK_DWORDS];
byte RBuffer[200];
dword msg_in_queue[MSG_IN_QUEUE_SIZE/sizeof(dword)];
API_SAVE saved_msg;
API_SAVE B_protocol;
byte fax_connect_info_length;
byte fax_connect_info_buffer[FAX_CONNECT_INFO_BUFFER_SIZE];
byte fax_edata_ack_length;
word nsf_control_bits;
byte ncpi_state;
byte ncpi_buffer[NCPI_BUFFER_SIZE];
word ncci_ring_list;
byte inc_dis_ncci_table[MAX_CHANNELS_PER_PLCI];
t_std_internal_command internal_command_queue[MAX_INTERNAL_COMMAND_LEVELS];
dword c_ind_mask_table[C_IND_MASK_DWORDS];
dword group_optimization_mask_table[C_IND_MASK_DWORDS];
byte RBuffer[200];
dword msg_in_queue[MSG_IN_QUEUE_SIZE/sizeof(dword)];
API_SAVE saved_msg;
API_SAVE B_protocol;
byte fax_connect_info_length;
byte fax_connect_info_buffer[FAX_CONNECT_INFO_BUFFER_SIZE];
byte fax_edata_ack_length;
word nsf_control_bits;
byte ncpi_state;
byte ncpi_buffer[NCPI_BUFFER_SIZE];
byte internal_req_buffer[INTERNAL_REQ_BUFFER_SIZE];
byte internal_ind_buffer[INTERNAL_IND_BUFFER_SIZE + 3];
dword requested_options_conn;
dword requested_options;
word B1_facilities;
API_SAVE *adjust_b_parms_msg;
word adjust_b_facilities;
word adjust_b_command;
word adjust_b_ncci;
word adjust_b_mode;
word adjust_b_state;
byte adjust_b_restore;
byte internal_req_buffer[INTERNAL_REQ_BUFFER_SIZE];
byte internal_ind_buffer[INTERNAL_IND_BUFFER_SIZE + 3];
dword requested_options_conn;
dword requested_options;
word B1_facilities;
API_SAVE *adjust_b_parms_msg;
word adjust_b_facilities;
word adjust_b_command;
word adjust_b_ncci;
word adjust_b_mode;
word adjust_b_state;
byte adjust_b_restore;
byte dtmf_rec_active;
word dtmf_rec_pulse_ms;
word dtmf_rec_pause_ms;
byte dtmf_send_requests;
word dtmf_send_pulse_ms;
word dtmf_send_pause_ms;
word dtmf_cmd;
word dtmf_msg_number_queue[8];
byte dtmf_parameter_length;
byte dtmf_parameter_buffer[DTMF_PARAMETER_BUFFER_SIZE];
byte dtmf_rec_active;
word dtmf_rec_pulse_ms;
word dtmf_rec_pause_ms;
byte dtmf_send_requests;
word dtmf_send_pulse_ms;
word dtmf_send_pause_ms;
word dtmf_cmd;
word dtmf_msg_number_queue[8];
byte dtmf_parameter_length;
byte dtmf_parameter_buffer[DTMF_PARAMETER_BUFFER_SIZE];
t_capidtmf_state capidtmf_state;
t_capidtmf_state capidtmf_state;
byte li_bchannel_id; /* BRI: 1..2, PRI: 1..32 */
byte li_channel_bits;
byte li_notify_update;
word li_cmd;
word li_write_command;
word li_write_channel;
word li_plci_b_write_pos;
word li_plci_b_read_pos;
word li_plci_b_req_pos;
dword li_plci_b_queue[LI_PLCI_B_QUEUE_ENTRIES];
byte li_bchannel_id; /* BRI: 1..2, PRI: 1..32 */
byte li_channel_bits;
byte li_notify_update;
word li_cmd;
word li_write_command;
word li_write_channel;
word li_plci_b_write_pos;
word li_plci_b_read_pos;
word li_plci_b_req_pos;
dword li_plci_b_queue[LI_PLCI_B_QUEUE_ENTRIES];
word ec_cmd;
word ec_idi_options;
word ec_tail_length;
word ec_cmd;
word ec_idi_options;
word ec_tail_length;
byte tone_last_indication_code;
byte tone_last_indication_code;
byte vswitchstate;
byte vsprot;
byte vsprotdialect;
byte notifiedcall; /* Flag if it is a spoofed call */
byte vswitchstate;
byte vsprot;
byte vsprotdialect;
byte notifiedcall; /* Flag if it is a spoofed call */
int rx_dma_descriptor;
dword rx_dma_magic;
int rx_dma_descriptor;
dword rx_dma_magic;
};
struct _NCCI {
byte data_out;
byte data_pending;
byte data_ack_out;
byte data_ack_pending;
DATA_B3_DESC DBuffer[MAX_DATA_B3];
DATA_ACK_DESC DataAck[MAX_DATA_ACK];
byte data_out;
byte data_pending;
byte data_ack_out;
byte data_ack_pending;
DATA_B3_DESC DBuffer[MAX_DATA_B3];
DATA_ACK_DESC DataAck[MAX_DATA_ACK];
};
struct _DIVA_CAPI_ADAPTER {
IDI_CALL request;
byte Id;
byte max_plci;
byte max_listen;
byte listen_active;
PLCI *plci;
byte ch_ncci[MAX_NL_CHANNEL+1];
byte ncci_ch[MAX_NCCI+1];
byte ncci_plci[MAX_NCCI+1];
byte ncci_state[MAX_NCCI+1];
byte ncci_next[MAX_NCCI+1];
NCCI ncci[MAX_NCCI+1];
IDI_CALL request;
byte Id;
byte max_plci;
byte max_listen;
byte listen_active;
PLCI *plci;
byte ch_ncci[MAX_NL_CHANNEL + 1];
byte ncci_ch[MAX_NCCI + 1];
byte ncci_plci[MAX_NCCI + 1];
byte ncci_state[MAX_NCCI + 1];
byte ncci_next[MAX_NCCI + 1];
NCCI ncci[MAX_NCCI + 1];
byte ch_flow_control[MAX_NL_CHANNEL+1]; /* Used by XON protocol */
byte ch_flow_control_pending;
byte ch_flow_plci[MAX_NL_CHANNEL+1];
int last_flow_control_ch;
byte ch_flow_control[MAX_NL_CHANNEL + 1]; /* Used by XON protocol */
byte ch_flow_control_pending;
byte ch_flow_plci[MAX_NL_CHANNEL + 1];
int last_flow_control_ch;
dword Info_Mask[MAX_APPL];
dword CIP_Mask[MAX_APPL];
dword Info_Mask[MAX_APPL];
dword CIP_Mask[MAX_APPL];
dword Notification_Mask[MAX_APPL];
PLCI *codec_listen[MAX_APPL];
dword requested_options_table[MAX_APPL];
API_PROFILE profile;
MANUFACTURER_PROFILE man_profile;
dword manufacturer_features;
dword Notification_Mask[MAX_APPL];
PLCI *codec_listen[MAX_APPL];
dword requested_options_table[MAX_APPL];
API_PROFILE profile;
MANUFACTURER_PROFILE man_profile;
dword manufacturer_features;
byte AdvCodecFLAG;
PLCI *AdvCodecPLCI;
PLCI *AdvSignalPLCI;
APPL *AdvSignalAppl;
byte TelOAD[23];
byte TelOSA[23];
byte scom_appl_disable;
PLCI *automatic_lawPLCI;
byte automatic_law;
byte u_law;
byte AdvCodecFLAG;
PLCI *AdvCodecPLCI;
PLCI *AdvSignalPLCI;
APPL *AdvSignalAppl;
byte TelOAD[23];
byte TelOSA[23];
byte scom_appl_disable;
PLCI *automatic_lawPLCI;
byte automatic_law;
byte u_law;
byte adv_voice_coef_length;
byte adv_voice_coef_buffer[ADV_VOICE_COEF_BUFFER_SIZE];
byte adv_voice_coef_length;
byte adv_voice_coef_buffer[ADV_VOICE_COEF_BUFFER_SIZE];
byte li_pri;
byte li_channels;
word li_base;
byte li_pri;
byte li_channels;
word li_base;
byte adapter_disabled;
byte group_optimization_enabled; /* use application groups if enabled */
dword sdram_bar;
byte flag_dynamic_l1_down; /* for hunt groups:down layer 1 if no appl present*/
byte FlowControlIdTable[256];
byte FlowControlSkipTable[256];
void* os_card; /* pointer to associated OS dependent adapter structure */
byte adapter_disabled;
byte group_optimization_enabled; /* use application groups if enabled */
dword sdram_bar;
byte flag_dynamic_l1_down; /* for hunt groups:down layer 1 if no appl present*/
byte FlowControlIdTable[256];
byte FlowControlSkipTable[256];
void *os_card; /* pointer to associated OS dependent adapter structure */
};
@ -451,23 +451,23 @@ struct _DIVA_CAPI_ADAPTER {
typedef struct t30_info_s T30_INFO;
struct t30_info_s {
byte code;
byte rate_div_2400;
byte resolution;
byte data_format;
byte pages_low;
byte pages_high;
byte operating_mode;
byte control_bits_low;
byte control_bits_high;
byte feature_bits_low;
byte feature_bits_high;
byte recording_properties;
byte universal_6;
byte universal_7;
byte station_id_len;
byte head_line_len;
byte station_id[T30_MAX_STATION_ID_LENGTH];
byte code;
byte rate_div_2400;
byte resolution;
byte data_format;
byte pages_low;
byte pages_high;
byte operating_mode;
byte control_bits_low;
byte control_bits_high;
byte feature_bits_low;
byte feature_bits_high;
byte recording_properties;
byte universal_6;
byte universal_7;
byte station_id_len;
byte head_line_len;
byte station_id[T30_MAX_STATION_ID_LENGTH];
/* byte head_line[]; */
/* byte sub_sep_length; */
/* byte sub_sep_field[]; */
@ -528,13 +528,13 @@ struct t30_info_s {
#define T30_OPERATING_MODE_CAPI_NEG 4
#define T30_OPERATING_MODE_COUNT 5
/* EDATA transmit messages */
/* EDATA transmit messages */
#define EDATA_T30_DIS 0x01
#define EDATA_T30_FTT 0x02
#define EDATA_T30_MCF 0x03
#define EDATA_T30_PARAMETERS 0x04
/* EDATA receive messages */
/* EDATA receive messages */
#define EDATA_T30_DCS 0x81
#define EDATA_T30_TRAIN_OK 0x82
#define EDATA_T30_EOP 0x83
@ -639,11 +639,11 @@ struct t30_info_s {
typedef struct async_s ASYNC_FORMAT;
struct async_s {
unsigned pe: 1;
unsigned parity:2;
unsigned spare: 2;
unsigned stp: 1;
unsigned ch_len:2; /* 3th octett in CAI */
unsigned pe:1;
unsigned parity:2;
unsigned spare:2;
unsigned stp:1;
unsigned ch_len:2; /* 3th octett in CAI */
};
@ -686,14 +686,14 @@ struct async_s {
/*------------------------------------------------------------------*/
/* Capi IE + Msg types */
/*------------------------------------------------------------------*/
#define ESC_CAUSE 0x800|CAU /* Escape cause element */
#define ESC_MSGTYPE 0x800|MSGTYPEIE /* Escape message type */
#define ESC_CHI 0x800|CHI /* Escape channel id */
#define ESC_LAW 0x800|BC /* Escape law info */
#define ESC_CR 0x800|CRIE /* Escape CallReference */
#define ESC_PROFILE 0x800|PROFILEIE /* Escape profile */
#define ESC_SSEXT 0x800|SSEXTIE /* Escape Supplem. Serv.*/
#define ESC_VSWITCH 0x800|VSWITCHIE /* Escape VSwitch */
#define ESC_CAUSE 0x800 | CAU /* Escape cause element */
#define ESC_MSGTYPE 0x800 | MSGTYPEIE /* Escape message type */
#define ESC_CHI 0x800 | CHI /* Escape channel id */
#define ESC_LAW 0x800 | BC /* Escape law info */
#define ESC_CR 0x800 | CRIE /* Escape CallReference */
#define ESC_PROFILE 0x800 | PROFILEIE /* Escape profile */
#define ESC_SSEXT 0x800 | SSEXTIE /* Escape Supplem. Serv.*/
#define ESC_VSWITCH 0x800 | VSWITCHIE /* Escape VSwitch */
#define CST 0x14 /* Call State i.e. */
#define PI 0x1E /* Progress Indicator */
#define NI 0x27 /* Notification Ind */
@ -903,25 +903,25 @@ struct async_s {
typedef struct li_config_s LI_CONFIG;
struct xconnect_card_address_s {
dword low;
dword high;
dword low;
dword high;
};
struct xconnect_transfer_address_s {
struct xconnect_card_address_s card_address;
dword offset;
struct xconnect_card_address_s card_address;
dword offset;
};
struct li_config_s {
DIVA_CAPI_ADAPTER *adapter;
PLCI *plci;
struct xconnect_transfer_address_s send_b;
struct xconnect_transfer_address_s send_pc;
byte *flag_table; /* dword aligned and sized */
byte *coef_table; /* dword aligned and sized */
byte channel;
byte curchnl;
byte chflags;
DIVA_CAPI_ADAPTER *adapter;
PLCI *plci;
struct xconnect_transfer_address_s send_b;
struct xconnect_transfer_address_s send_pc;
byte *flag_table; /* dword aligned and sized */
byte *coef_table; /* dword aligned and sized */
byte channel;
byte curchnl;
byte chflags;
};
extern LI_CONFIG *li_config_table;
@ -1110,33 +1110,33 @@ extern word li_total_channels;
#define B1_PIAFS 29
#define B2_PIAFS 29
#define PRIVATE_PIAFS 29
#define PRIVATE_PIAFS 29
/*
B2 configuration for PIAFS:
+---------------------+------+-----------------------------------------+
| PIAFS Protocol | byte | Bit 1 - Protocol Speed |
| Speed configuration | | 0 - 32K |
| | | 1 - 64K (default) |
| | | Bit 2 - Variable Protocol Speed |
| | | 0 - Speed is fix |
| | | 1 - Speed is variable (default) |
+---------------------+------+-----------------------------------------+
| Direction | word | Enable compression/decompression for |
| | | 0: All direction |
| | | 1: disable outgoing data |
| | | 2: disable incomming data |
| | | 3: disable both direction (default) |
+---------------------+------+-----------------------------------------+
| Number of code | word | Parameter P1 of V.42bis in accordance |
| words | | with V.42bis |
+---------------------+------+-----------------------------------------+
| Maximum String | word | Parameter P2 of V.42bis in accordance |
| Length | | with V.42bis |
+---------------------+------+-----------------------------------------+
| control (UDATA) | byte | enable PIAFS control communication |
| abilities | | |
+---------------------+------+-----------------------------------------+
+---------------------+------+-----------------------------------------+
| PIAFS Protocol | byte | Bit 1 - Protocol Speed |
| Speed configuration | | 0 - 32K |
| | | 1 - 64K (default) |
| | | Bit 2 - Variable Protocol Speed |
| | | 0 - Speed is fix |
| | | 1 - Speed is variable (default) |
+---------------------+------+-----------------------------------------+
| Direction | word | Enable compression/decompression for |
| | | 0: All direction |
| | | 1: disable outgoing data |
| | | 2: disable incomming data |
| | | 3: disable both direction (default) |
+---------------------+------+-----------------------------------------+
| Number of code | word | Parameter P1 of V.42bis in accordance |
| words | | with V.42bis |
+---------------------+------+-----------------------------------------+
| Maximum String | word | Parameter P2 of V.42bis in accordance |
| Length | | with V.42bis |
+---------------------+------+-----------------------------------------+
| control (UDATA) | byte | enable PIAFS control communication |
| abilities | | |
+---------------------+------+-----------------------------------------+
*/
#define PIAFS_UDATA_ABILITIES 0x80

View File

@ -38,7 +38,7 @@ 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)";
"Eicon DIVA - MAINT module (http://www.melware.net)";
static char *DRIVERLNAME = "diva_mnt";
static char *DEVNAME = "DivasMAINT";
char *DRIVERRELEASE_MNT = "2.0";
@ -86,7 +86,7 @@ int diva_os_copy_from_user(void *os_handle, void *dst, const void __user *src,
/*
* get time
*/
void diva_os_get_time(dword * sec, dword * usec)
void diva_os_get_time(dword *sec, dword *usec)
{
struct timeval tv;
@ -115,7 +115,7 @@ void diva_os_get_time(dword * sec, dword * usec)
/*
* device node operations
*/
static unsigned int maint_poll(struct file *file, poll_table * wait)
static unsigned int maint_poll(struct file *file, poll_table *wait)
{
unsigned int mask = 0;
@ -153,18 +153,18 @@ static int maint_close(struct inode *ino, struct file *filep)
/* 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)
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)
size_t count, loff_t *ppos)
{
return (maint_read_write(buf, (int) count));
}
@ -238,7 +238,7 @@ static int DIVA_INIT_FUNCTION maint_init(void)
DRIVERLNAME, buffer, (buffer_length / 1024),
(diva_dbg_mem == 0) ? "internal" : "external", major);
out:
out:
return (ret);
}
@ -255,4 +255,3 @@ static void DIVA_EXIT_FUNCTION maint_exit(void)
module_init(maint_init);
module_exit(maint_exit);

View File

@ -34,7 +34,7 @@ static DESCRIPTOR DAdapter;
static DESCRIPTOR MAdapter;
/* --------------------------------------------------------------------------
MAINT driver connector section
MAINT driver connector section
-------------------------------------------------------------------------- */
static void no_printf(unsigned char *x, ...)
{
@ -74,17 +74,17 @@ void diva_xdi_didd_register_adapter(int card)
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));
/* 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);
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;
}
}
@ -99,11 +99,11 @@ void diva_xdi_didd_remove_adapter(int card)
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.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);
(IDI_CALL) Requests[card - 1];
DAdapter.request((ENTITY *)&req);
memset(&(a->IdTable), 0x00, 256);
}
@ -115,7 +115,7 @@ 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
@ -130,7 +130,7 @@ static void stop_dbg(void)
/*
* didd callback function
*/
static void *didd_callback(void *context, DESCRIPTOR * adapter,
static void *didd_callback(void *context, DESCRIPTOR *adapter,
int removal)
{
if (adapter->type == IDI_DADAPTER) {
@ -168,10 +168,10 @@ static int DIVA_INIT_FUNCTION connect_didd(void)
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;
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);
DAdapter.request((ENTITY *)&req);
if (req.didd_notify.e.Rc != 0xff) {
stop_dbg();
return (0);
@ -203,7 +203,7 @@ static void disconnect_didd(void)
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);
DAdapter.request((ENTITY *)&req);
}
/*
@ -214,10 +214,10 @@ int DIVA_INIT_FUNCTION divasfunc_init(int dbgmask)
char *version;
debugmask = dbgmask;
if (!connect_didd()) {
DBG_ERR(("divasfunc: failed to connect to DIDD."))
return (0);
return (0);
}
version = diva_xdi_common_code_build;

View File

@ -1,7 +1,7 @@
/* $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
* User Mode IDI Interface
*
* Copyright 2000-2003 by Armin Schindler (mac@melware.de)
* Copyright 2000-2003 Cytronics & Melware (info@melware.de)
@ -71,10 +71,10 @@ static char *getrev(const char *revision)
* LOCALS
*/
static ssize_t um_idi_read(struct file *file, char __user *buf, size_t count,
loff_t * offset);
loff_t *offset);
static ssize_t um_idi_write(struct file *file, const char __user *buf,
size_t count, loff_t * offset);
static unsigned int um_idi_poll(struct file *file, poll_table * wait);
size_t count, loff_t *offset);
static unsigned int 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);
@ -194,7 +194,7 @@ static int DIVA_INIT_FUNCTION divasi_init(void)
}
printk(KERN_INFO "%s: started with major %d\n", DRIVERLNAME, major);
out:
out:
return (ret);
}
@ -228,7 +228,7 @@ divas_um_idi_copy_to_user(void *os_handle, void *dst, const void *src,
}
static ssize_t
um_idi_read(struct file *file, char __user *buf, size_t count, loff_t * offset)
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;
@ -292,7 +292,7 @@ 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);
divas_um_idi_create_entity((dword) adapter_nr, (void *) file);
if (!(file->private_data = e)) {
return (0);
@ -310,7 +310,7 @@ static int um_idi_open_adapter(struct file *file, int adapter_nr)
static ssize_t
um_idi_write(struct file *file, const char __user *buf, size_t count,
loff_t * offset)
loff_t *offset)
{
diva_um_idi_os_context_t *p_os;
int ret = -EINVAL;
@ -331,8 +331,8 @@ um_idi_write(struct file *file, const char __user *buf, size_t count,
}
if (!(p_os =
(diva_um_idi_os_context_t *) diva_um_id_get_os_context(file->
private_data)))
(diva_um_idi_os_context_t *) diva_um_id_get_os_context(file->
private_data)))
{
return (-ENODEV);
}
@ -367,7 +367,7 @@ um_idi_write(struct file *file, const char __user *buf, size_t count,
return (ret);
}
static unsigned int um_idi_poll(struct file *file, poll_table * wait)
static unsigned int um_idi_poll(struct file *file, poll_table *wait)
{
diva_um_idi_os_context_t *p_os;
@ -417,7 +417,7 @@ static int um_idi_release(struct inode *inode, struct file *file)
}
if (!(p_os =
(diva_um_idi_os_context_t *) diva_um_id_get_os_context(file->private_data))) {
(diva_um_idi_os_context_t *) diva_um_id_get_os_context(file->private_data))) {
ret = -ENODEV;
goto out;
}
@ -434,7 +434,7 @@ static int um_idi_release(struct inode *inode, struct file *file)
goto out;
}
out:
out:
return (ret);
}
@ -446,14 +446,14 @@ int diva_os_get_context_size(void)
void diva_os_wakeup_read(void *os_context)
{
diva_um_idi_os_context_t *p_os =
(diva_um_idi_os_context_t *) os_context;
(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;
(diva_um_idi_os_context_t *) os_context;
wake_up_interruptible(&p_os->close_wait);
}
@ -466,7 +466,7 @@ void diva_um_timer_function(unsigned long data)
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
@ -481,30 +481,30 @@ static int remove_entity(void *entity)
if (!entity) {
DBG_FTL(("Zero entity on remove"))
return (0);
return (0);
}
if (!(p_os =
(diva_um_idi_os_context_t *)
diva_um_id_get_os_context(entity))) {
(diva_um_idi_os_context_t *)
diva_um_id_get_os_context(entity))) {
DBG_FTL(("Zero entity os context on remove"))
return (0);
return (0);
}
if (!divas_um_idi_entity_assigned(entity) || p_os->aborted) {
/*
Entity is not assigned, also can be removed
*/
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);
/*
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);
@ -542,7 +542,7 @@ static int remove_entity(void *entity)
DBG_TRC(("E(%08x) remove complete, aborted:%d", entity,
p_os->aborted))
diva_um_idi_stop_wdog(entity);
diva_um_idi_stop_wdog(entity);
p_os->aborted = 0;

View File

@ -50,7 +50,7 @@ module_param(dbgmask, int, 0);
MODULE_PARM_DESC(dbgmask, "initial debug mask");
static char *DRIVERNAME =
"Eicon DIVA Server driver (http://www.melware.net)";
"Eicon DIVA Server driver (http://www.melware.net)";
static char *DRIVERLNAME = "divas";
static char *DEVNAME = "Divas";
char *DRIVERRELEASE_DIVAS = "2.0";
@ -68,7 +68,7 @@ typedef struct _diva_os_thread_dpc {
} diva_os_thread_dpc_t;
/* --------------------------------------------------------------------------
PCI driver interface section
PCI driver interface section
-------------------------------------------------------------------------- */
/*
vendor, device Vendor and device ID to match (or PCI_ANY_ID)
@ -77,7 +77,7 @@ typedef struct _diva_os_thread_dpc {
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
@ -109,41 +109,41 @@ typedef struct _diva_os_thread_dpc {
/*
This table should be sorted by PCI device ID
*/
*/
static struct pci_device_id divas_pci_tbl[] = {
/* Diva Server BRI-2M PCI 0xE010 */
{ PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_MAESTRA),
CARDTYPE_MAESTRA_PCI },
CARDTYPE_MAESTRA_PCI },
/* Diva Server 4BRI-8M PCI 0xE012 */
{ PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_MAESTRAQ),
CARDTYPE_DIVASRV_Q_8M_PCI },
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 },
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 },
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 },
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 },
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 },
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 },
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 },
CARDTYPE_DIVASRV_VOICE_P_30M_V2_PCI },
/* Diva Server 2FX 0xE01A */
{ PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_2F),
CARDTYPE_DIVASRV_B_2F_PCI },
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 },
CARDTYPE_DIVASRV_VOICE_B_2M_V2_PCI },
{ 0, } /* 0 terminated list. */
};
MODULE_DEVICE_TABLE(pci, divas_pci_tbl);
@ -197,7 +197,7 @@ void divas_get_version(char *p)
}
/* --------------------------------------------------------------------------
PCI Bus services
PCI Bus services
-------------------------------------------------------------------------- */
byte diva_os_get_pci_bus(void *pci_dev_handle)
{
@ -332,10 +332,10 @@ void PCIread(byte bus, byte func, int offset, void *data, int length,
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,
dma_addr_t *dma_handle,
void **addr_handle)
{
void *addr = pci_alloc_consistent(hwdev, size, dma_handle);
@ -350,7 +350,7 @@ void diva_init_dma_map(void *hdev,
{
struct pci_dev *pdev = (struct pci_dev *) hdev;
struct _diva_dma_map_entry *pmap =
diva_alloc_dma_map(hdev, nentries);
diva_alloc_dma_map(hdev, nentries);
if (pmap) {
int i;
@ -381,7 +381,7 @@ void diva_init_dma_map(void *hdev,
/*
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;
@ -403,14 +403,14 @@ void diva_free_dma_map(void *hdev, struct _diva_dma_map_entry *pmap)
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
** I/O port utilities
*********************************************************/
int
@ -420,7 +420,7 @@ diva_os_register_io_port(void *adapter, int on, unsigned long port,
if (on) {
if (!request_region(port, length, name)) {
DBG_ERR(("A: I/O: can't register port=%08x", port))
return (-1);
return (-1);
}
} else {
release_region(port, length);
@ -443,7 +443,7 @@ void divasa_unmap_pci_bar(void __iomem *bar)
}
/*********************************************************
** I/O port access
** I/O port access
*********************************************************/
byte __inline__ inpp(void __iomem *addr)
{
@ -476,7 +476,7 @@ void __inline__ outpp(void __iomem *addr, word p)
}
/* --------------------------------------------------------------------------
IRQ request / remove
IRQ request / remove
-------------------------------------------------------------------------- */
int diva_os_register_irq(void *context, byte irq, const char *name)
{
@ -491,7 +491,7 @@ void diva_os_remove_irq(void *context, byte irq)
}
/* --------------------------------------------------------------------------
DPC framework implementation
DPC framework implementation
-------------------------------------------------------------------------- */
static void diva_os_dpc_proc(unsigned long context)
{
@ -501,7 +501,7 @@ static void diva_os_dpc_proc(unsigned long context)
(*(pisr->callback)) (pisr, pisr->callback_context);
}
int diva_os_initialize_soft_isr(diva_os_soft_isr_t * psoft_isr,
int diva_os_initialize_soft_isr(diva_os_soft_isr_t *psoft_isr,
diva_os_soft_isr_callback_t callback,
void *callback_context)
{
@ -520,11 +520,11 @@ int diva_os_initialize_soft_isr(diva_os_soft_isr_t * psoft_isr,
return (0);
}
int diva_os_schedule_soft_isr(diva_os_soft_isr_t * psoft_isr)
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;
(diva_os_thread_dpc_t *) psoft_isr->object;
tasklet_schedule(&pdpc->divas_task);
}
@ -532,16 +532,16 @@ int diva_os_schedule_soft_isr(diva_os_soft_isr_t * psoft_isr)
return (1);
}
int diva_os_cancel_soft_isr(diva_os_soft_isr_t * psoft_isr)
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)
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;
(diva_os_thread_dpc_t *) psoft_isr->object;
void *mem;
tasklet_kill(&pdpc->divas_task);
@ -589,7 +589,7 @@ static int divas_release(struct inode *inode, struct file *file)
}
static ssize_t divas_write(struct file *file, const char __user *buf,
size_t count, loff_t * ppos)
size_t count, loff_t *ppos)
{
int ret = -EINVAL;
@ -620,7 +620,7 @@ static ssize_t divas_write(struct file *file, const char __user *buf,
}
static ssize_t divas_read(struct file *file, char __user *buf,
size_t count, loff_t * ppos)
size_t count, loff_t *ppos)
{
int ret = -EINVAL;
@ -650,7 +650,7 @@ static ssize_t divas_read(struct file *file, char __user *buf,
return (ret);
}
static unsigned int divas_poll(struct file *file, poll_table * wait)
static unsigned int divas_poll(struct file *file, poll_table *wait)
{
if (!file->private_data) {
return (POLLERR);
@ -686,7 +686,7 @@ static int DIVA_INIT_FUNCTION divas_register_chrdev(void)
}
/* --------------------------------------------------------------------------
PCI driver section
PCI driver section
-------------------------------------------------------------------------- */
static int __devinit divas_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent)
@ -698,9 +698,9 @@ static int __devinit divas_init_one(struct pci_dev *pdev,
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);
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",
@ -708,12 +708,12 @@ static int __devinit divas_init_one(struct pci_dev *pdev,
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);
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);
}
@ -723,9 +723,9 @@ static int __devinit divas_init_one(struct pci_dev *pdev,
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);
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);
}
@ -735,12 +735,12 @@ static int __devinit divas_init_one(struct pci_dev *pdev,
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);
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);
}
@ -755,8 +755,8 @@ static void __devexit divas_remove_one(struct pci_dev *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);
printk(KERN_INFO "%s: bus: %08x fn: %08x removal.\n",
DRIVERLNAME, pdev->bus->number, pdev->devfn);
if (pdiva) {
diva_driver_remove_card(pdiva);
@ -765,7 +765,7 @@ static void __devexit divas_remove_one(struct pci_dev *pdev)
}
/* --------------------------------------------------------------------------
Driver Load / Startup
Driver Load / Startup
-------------------------------------------------------------------------- */
static int DIVA_INIT_FUNCTION divas_init(void)
{
@ -824,12 +824,12 @@ static int DIVA_INIT_FUNCTION divas_init(void)
}
printk(KERN_INFO "%s: started with major %d\n", DRIVERLNAME, major);
out:
out:
return (ret);
}
/* --------------------------------------------------------------------------
Driver Unload
Driver Unload
-------------------------------------------------------------------------- */
static void DIVA_EXIT_FUNCTION divas_exit(void)
{

View File

@ -55,7 +55,7 @@ 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)
divas_read(struct file *file, char __user *buf, size_t count, loff_t *off)
{
int len = 0;
int cadapter;
@ -94,12 +94,12 @@ divas_read(struct file *file, char __user *buf, size_t count, loff_t * off)
}
static ssize_t
divas_write(struct file *file, const char __user *buf, size_t count, loff_t * off)
divas_write(struct file *file, const char __user *buf, size_t count, loff_t *off)
{
return (-ENODEV);
}
static unsigned int divas_poll(struct file *file, poll_table * wait)
static unsigned int divas_poll(struct file *file, poll_table *wait)
{
return (POLLERR);
}
@ -127,7 +127,7 @@ static const struct file_operations divas_fops = {
int create_divas_proc(void)
{
divas_proc_entry = proc_create(divas_proc_name, S_IFREG | S_IRUGO,
proc_net_eicon, &divas_fops);
proc_net_eicon, &divas_fops);
if (!divas_proc_entry)
return (0);
@ -155,11 +155,11 @@ static ssize_t grp_opt_proc_write(struct file *file, const char __user *buffer,
switch (c) {
case '0':
IoAdapter->capi_cfg.cfg_1 &=
~DIVA_XDI_CAPI_CFG_1_GROUP_POPTIMIZATION_ON;
~DIVA_XDI_CAPI_CFG_1_GROUP_POPTIMIZATION_ON;
break;
case '1':
IoAdapter->capi_cfg.cfg_1 |=
DIVA_XDI_CAPI_CFG_1_GROUP_POPTIMIZATION_ON;
DIVA_XDI_CAPI_CFG_1_GROUP_POPTIMIZATION_ON;
break;
default:
return (-EINVAL);
@ -182,11 +182,11 @@ static ssize_t d_l1_down_proc_write(struct file *file, const char __user *buffer
switch (c) {
case '0':
IoAdapter->capi_cfg.cfg_1 &=
~DIVA_XDI_CAPI_CFG_1_DYNAMIC_L1_ON;
~DIVA_XDI_CAPI_CFG_1_DYNAMIC_L1_ON;
break;
case '1':
IoAdapter->capi_cfg.cfg_1 |=
DIVA_XDI_CAPI_CFG_1_DYNAMIC_L1_ON;
DIVA_XDI_CAPI_CFG_1_DYNAMIC_L1_ON;
break;
default:
return (-EINVAL);
@ -202,9 +202,9 @@ static int d_l1_down_proc_show(struct seq_file *m, void *v)
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");
(IoAdapter->capi_cfg.
cfg_1 & DIVA_XDI_CAPI_CFG_1_DYNAMIC_L1_ON) ? "1" :
"0");
return 0;
}
@ -228,9 +228,9 @@ static int grp_opt_proc_show(struct seq_file *m, void *v)
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");
(IoAdapter->capi_cfg.
cfg_1 & DIVA_XDI_CAPI_CFG_1_GROUP_POPTIMIZATION_ON)
? "1" : "0");
return 0;
}
@ -281,7 +281,7 @@ static int info_proc_show(struct seq_file *m, void *v)
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);
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);
@ -289,8 +289,8 @@ static int info_proc_show(struct seq_file *m, void *v)
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");
(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);
@ -298,15 +298,15 @@ static int info_proc_show(struct seq_file *m, void *v)
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]);
"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]);
" / length : %d",
a->resources.pci.
length[i]);
}
seq_putc(m, '\n');
}
@ -314,7 +314,7 @@ static int info_proc_show(struct seq_file *m, void *v)
}
if ((!a->xdi_adapter.port) &&
((!a->xdi_adapter.ram) ||
(!a->xdi_adapter.reset)
(!a->xdi_adapter.reset)
|| (!a->xdi_adapter.cfg))) {
if (!IoAdapter->irq_info.irq_nr) {
p = "slave";
@ -352,9 +352,9 @@ static const struct file_operations info_proc_fops = {
*/
/* --------------------------------------------------------------------------
Create adapter directory and files in proc file system
Create adapter directory and files in proc file system
-------------------------------------------------------------------------- */
int create_adapter_proc(diva_os_xdi_adapter_t * a)
int create_adapter_proc(diva_os_xdi_adapter_t *a)
{
struct proc_dir_entry *de, *pe;
char tmp[16];
@ -385,9 +385,9 @@ int create_adapter_proc(diva_os_xdi_adapter_t * a)
}
/* --------------------------------------------------------------------------
Remove adapter directory and files in proc file system
Remove adapter directory and files in proc file system
-------------------------------------------------------------------------- */
void remove_adapter_proc(diva_os_xdi_adapter_t * a)
void remove_adapter_proc(diva_os_xdi_adapter_t *a)
{
char tmp[16];

View File

@ -1,29 +1,29 @@
/*
*
Copyright (c) Eicon Networks, 2002.
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
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 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.
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.
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
#ifndef __DIVA_SYNC__H
#define __DIVA_SYNC__H
#define IDI_SYNC_REQ_REMOVE 0x00
#define IDI_SYNC_REQ_GET_NAME 0x01
@ -59,26 +59,26 @@
/******************************************************************************/
#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
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;
dword buffer_length_in_bytes;
byte *features;
} diva_xdi_get_extended_xdi_features_t;
/*
features[0]
*/
features[0]
*/
#define DIVA_XDI_EXTENDED_FEATURES_VALID 0x01
#define DIVA_XDI_EXTENDED_FEATURE_CMA 0x02
#define DIVA_XDI_EXTENDED_FEATURE_SDRAM_BAR 0x04
@ -91,17 +91,17 @@ typedef struct _diva_xdi_get_extended_xdi_features {
/******************************************************************************/
#define IDI_SYNC_REQ_XDI_GET_ADAPTER_SDRAM_BAR 0x93
typedef struct _diva_xdi_get_adapter_sdram_bar {
dword 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;
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
@ -111,11 +111,11 @@ typedef struct _diva_xdi_get_capi_parameters {
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;
dword logical_adapter_number;
dword controller;
dword total_controllers;
} diva_xdi_get_logical_adapter_number_s_t;
/******************************************************************************/
#define IDI_SYNC_REQ_UP1DM_OPERATION 0x96
@ -124,10 +124,10 @@ typedef struct _diva_xdi_get_logical_adapter_number {
#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;
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
@ -137,22 +137,22 @@ typedef struct _diva_xdi_dma_descriptor_operation {
#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;
dword handle; /* Notification handle */
void *callback;
void *context;
} diva_didd_adapter_notify_t;
typedef struct _diva_didd_add_adapter {
void * descriptor;
void *descriptor;
} diva_didd_add_adapter_t;
typedef struct _diva_didd_remove_adapter {
IDI_CALL p_request;
IDI_CALL p_request;
} diva_didd_remove_adapter_t;
typedef struct _diva_didd_read_adapter_array {
void * buffer;
dword length;
void *buffer;
dword length;
} diva_didd_read_adapter_array_t;
typedef struct _diva_didd_get_cfg_lib_ifc {
void* ifc;
void *ifc;
} diva_didd_get_cfg_lib_ifc_t;
/******************************************************************************/
#define IDI_SYNC_REQ_XDI_GET_STREAM 0x91
@ -163,31 +163,31 @@ typedef struct _diva_didd_get_cfg_lib_ifc {
#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);
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;
/******************************************************************************/
/*
@ -196,37 +196,37 @@ typedef struct _diva_xdi_stream_interface {
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 */
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 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 */
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 */
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
@ -234,22 +234,22 @@ typedef struct
*/
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 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 */
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
@ -271,36 +271,36 @@ typedef struct
#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 */
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 */
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 */
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
@ -308,50 +308,50 @@ typedef struct
#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 ;
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 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 ;
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 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 ;
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) ;
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) ;
typedef void (*USB_RECV_NOTIFY)(void *Ipac, void *msg);
typedef void (*USB_XMIT_NOTIFY)(void *Ipac, unsigned char PipeIndex);
/******************************************************************************/
/*
* Parameter description for synchronous requests.
@ -361,129 +361,129 @@ typedef void ( * USB_XMIT_NOTIFY) (void *Ipac, unsigned char PipeIndex) ;
*/
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;
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;
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;
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 */
#endif /* __DIVA_SYNC__H */

View File

@ -14,7 +14,7 @@
#include "dqueue.h"
int
diva_data_q_init(diva_um_idi_data_queue_t * q,
diva_data_q_init(diva_um_idi_data_queue_t *q,
int max_length, int max_segments)
{
int i;
@ -38,7 +38,7 @@ diva_data_q_init(diva_um_idi_data_queue_t * q,
return (0);
}
int diva_data_q_finit(diva_um_idi_data_queue_t * q)
int diva_data_q_finit(diva_um_idi_data_queue_t *q)
{
int i;
@ -54,12 +54,12 @@ int diva_data_q_finit(diva_um_idi_data_queue_t * q)
return (0);
}
int diva_data_q_get_max_length(const diva_um_idi_data_queue_t * q)
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)
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;
@ -70,7 +70,7 @@ 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)
diva_data_q_ack_segment4write(diva_um_idi_data_queue_t *q, int length)
{
if (q->segment_pending) {
q->length[q->write] = length;
@ -92,12 +92,12 @@ const void *diva_data_q_get_segment4read(const diva_um_idi_data_queue_t *
return NULL;
}
int diva_data_q_get_segment_length(const diva_um_idi_data_queue_t * q)
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)
void diva_data_q_ack_segment4read(diva_um_idi_data_queue_t *q)
{
if (q->count) {
q->length[q->read] = 0;

View File

@ -16,16 +16,16 @@ typedef struct _diva_um_idi_data_queue {
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 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 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);
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,33 +1,33 @@
/*
*
Copyright (c) Eicon Networks, 2002.
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
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 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.
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.
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_
#ifndef DSP_DEFS_H_
#define DSP_DEFS_H_
#include "dspdids.h"
/*---------------------------------------------------------------------------*/
#define dsp_download_reserve_space(fp,length)
#define dsp_download_reserve_space(fp, length)
/*****************************************************************************/
/*
* OS file access abstraction layer
@ -35,25 +35,25 @@
* 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 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) ;
{ 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 */
@ -93,109 +93,109 @@ extern void OsCloseFile (OsFileHandle *fp) ;
#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;
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;
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;
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 */
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 */
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 */
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 */
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;
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;
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
@ -204,7 +204,7 @@ typedef struct tag_dsp_portable_download_desc /* be sure to keep native alignmen
#define DSP_DOWNLOAD_MAX_SEGMENTS 16
#define DSP_UDATA_REQUEST_RECONFIGURE 0
/*
parameters:
parameters:
<word> reconfigure delay (in 8kHz samples)
<word> reconfigure code
<byte> reconfigure hdlc preamble flags
@ -229,11 +229,11 @@ parameters:
#define DSP_RECONFIGURE_V17_12000 11
#define DSP_RECONFIGURE_V17_14400 12
/*
data indications if transparent framer
data indications if transparent framer
<byte> data 0
<byte> data 1
...
data indications if HDLC framer
data indications if HDLC framer
<byte> data 0
<byte> data 1
...
@ -243,17 +243,17 @@ data indications if HDLC framer
*/
#define DSP_UDATA_INDICATION_SYNC 0
/*
returns:
returns:
<word> time of sync (sampled from counter at 8kHz)
*/
#define DSP_UDATA_INDICATION_DCD_OFF 1
/*
returns:
returns:
<word> time of DCD off (sampled from counter at 8kHz)
*/
#define DSP_UDATA_INDICATION_DCD_ON 2
/*
returns:
returns:
<word> time of DCD on (sampled from counter at 8kHz)
<byte> connected norm
<word> connected options
@ -261,12 +261,12 @@ returns:
*/
#define DSP_UDATA_INDICATION_CTS_OFF 3
/*
returns:
returns:
<word> time of CTS off (sampled from counter at 8kHz)
*/
#define DSP_UDATA_INDICATION_CTS_ON 4
/*
returns:
returns:
<word> time of CTS on (sampled from counter at 8kHz)
<byte> connected norm
<word> connected options
@ -292,10 +292,10 @@ returns:
#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) ;
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_ */
#endif /* DSP_DEFS_H_ */

View File

@ -4,8 +4,8 @@
#define __DIVA_PRI_HOST_TEST_DSPS_H__
/*
DSP registers on maestra pri
*/
DSP registers on maestra pri
*/
#define DSP1_PORT (0x00)
#define DSP2_PORT (0x8)
#define DSP3_PORT (0x800)
@ -39,9 +39,9 @@
#define DSP_ADR_OFFS 0x80
/*------------------------------------------------------------------
Dsp related definitions
Dsp related definitions
------------------------------------------------------------------ */
#define DSP_SIGNATURE_PROBE_WORD 0x5a5a
#define dsp_make_address_ex(pm,address) ((word)((pm) ? (address) : (address) + 0x4000))
#define dsp_make_address_ex(pm, address) ((word)((pm) ? (address) : (address) + 0x4000))
#endif

View File

@ -1,26 +1,26 @@
/*
*
Copyright (c) Eicon Networks, 2002.
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
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 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.
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.
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_

View File

@ -1,26 +1,26 @@
/*
*
Copyright (c) Eicon Networks, 2002.
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
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 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.
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.
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__
@ -35,6 +35,6 @@
#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);
void diva_os_set_qBri_functions(PISDN_ADAPTER IoAdapter);
void diva_os_set_qBri2_functions(PISDN_ADAPTER IoAdapter);
#endif

View File

@ -1,37 +1,37 @@
/*
*
Copyright (c) Eicon Networks, 2002.
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
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 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.
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.
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
*/
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);
Prepare OS dependent part of BRI functions
*/
void diva_os_prepare_maestra_functions(PISDN_ADAPTER IoAdapter);
#endif

View File

@ -1,38 +1,38 @@
/*
*
Copyright (c) Eicon Networks, 2002.
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
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 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.
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.
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
*/
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);
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

@ -11,17 +11,17 @@
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_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];
byte buffer[2048 + 512];
} divas_um_idi_entity_t;

View File

@ -1,51 +1,51 @@
/*
*
Copyright (c) Eicon Networks, 2002.
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
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 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.
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.
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);
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
*/
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) ;
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) ;
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);
Free all system resources accessed by xdiLoadFile and xdiLoadArchive
-------------------------------------------------------------------------- */
void xdiFreeFile(void *handle);
#endif

View File

@ -1,7 +1,7 @@
/* $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
* User Mode IDI Interface
*
* Copyright 2000-2003 by Armin Schindler (mac@melware.de)
* Copyright 2000-2003 Cytronics & Melware (info@melware.de)
@ -58,7 +58,7 @@ static diva_os_spin_lock_t ll_lock;
/*
* find card in list
*/
static udiva_card *find_card_in_list(DESCRIPTOR * d)
static udiva_card *find_card_in_list(DESCRIPTOR *d)
{
udiva_card *card;
struct list_head *tmp;
@ -80,7 +80,7 @@ static udiva_card *find_card_in_list(DESCRIPTOR * d)
/*
* new card
*/
static void um_new_card(DESCRIPTOR * d)
static void um_new_card(DESCRIPTOR *d)
{
int adapter_nr = 0;
udiva_card *card = NULL;
@ -94,10 +94,10 @@ static void um_new_card(DESCRIPTOR * d)
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);
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;
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");
@ -113,7 +113,7 @@ static void um_new_card(DESCRIPTOR * d)
/*
* remove card
*/
static void um_remove_card(DESCRIPTOR * d)
static void um_remove_card(DESCRIPTOR *d)
{
diva_os_spin_lock_magic_t old_irql;
udiva_card *card = NULL;
@ -154,7 +154,7 @@ rescan:
/*
* DIDD notify callback
*/
static void *didd_callback(void *context, DESCRIPTOR * adapter,
static void *didd_callback(void *context, DESCRIPTOR *adapter,
int removal)
{
if (adapter->type == IDI_DADAPTER) {
@ -196,10 +196,10 @@ static int DIVA_INIT_FUNCTION connect_didd(void)
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;
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);
DAdapter.request((ENTITY *)&req);
if (req.didd_notify.e.Rc != 0xff) {
stop_dbg();
return (0);
@ -234,7 +234,7 @@ static void DIVA_EXIT_FUNCTION disconnect_didd(void)
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);
DAdapter.request((ENTITY *)&req);
}
/*

File diff suppressed because it is too large Load Diff

View File

@ -1,308 +1,308 @@
/*
*
Copyright (c) Eicon Networks, 2002.
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
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 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.
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.
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
*/
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)
-------------------------------------------------------------------------- */
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 ;
dword Num;
DEVICE_NAME DeviceName[4];
PISDN_ADAPTER QuadroAdapter[4];
} ADAPTER_LIST_ENTRY, *PADAPTER_LIST_ENTRY;
/* --------------------------------------------------------------------------
Special OS memory support structures
-------------------------------------------------------------------------- */
Special OS memory support structures
-------------------------------------------------------------------------- */
#define MAX_MAPPED_ENTRIES 8
typedef struct {
void * Address;
dword Length;
} ADAPTER_MEMORY ;
void *Address;
dword Length;
} ADAPTER_MEMORY;
/* --------------------------------------------------------------------------
Configuration of XDI clients carried by XDI
-------------------------------------------------------------------------- */
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;
byte cfg_1;
} diva_xdi_capi_cfg_t;
/* --------------------------------------------------------------------------
Main data structure kept per adapter
-------------------------------------------------------------------------- */
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;
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
Entity table
--------------------------------------------------------------------- */
struct e_info_s {
ENTITY * e;
byte next; /* chaining index */
word assign_ref; /* assign reference */
ENTITY *e;
byte next; /* chaining index */
word assign_ref; /* assign reference */
};
/* ---------------------------------------------------------------------
S-cards shared ram structure for loading
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];
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
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);
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
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);
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
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);
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
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 *) ;
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
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) ;
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,26 +1,26 @@
/*
*
Copyright (c) Eicon Networks, 2002.
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
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 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.
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.
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"
@ -31,196 +31,196 @@
#include "divasync.h"
#include "di.h"
#if !defined USE_EXTENDED_DEBUGS
#include "dimaint.h"
#include "dimaint.h"
#else
#define dprintf
#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);
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
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;
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,
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]),
ULongToPtr(a->tx_stream[Id] + a->tx_pos[Id]),
#else
(void*)(a->tx_stream[Id] + a->tx_pos[Id]),
(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,
(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),
ULongToPtr(a->tx_stream[Id] + a->tx_pos[Id] + 4),
#else
(void*)(a->tx_stream[Id] + a->tx_pos[Id] + 4),
(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,
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]),
ULongToPtr(a->tx_stream[Id] + a->tx_pos[Id]),
#else
(void*)(a->tx_stream[Id] + a->tx_pos[Id]),
(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);
(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,
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]),
ULongToPtr(a->rx_stream[Id] + a->rx_pos[Id]),
#else
(void*)(a->rx_stream[Id] + a->rx_pos[Id]),
(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,
(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),
ULongToPtr(a->rx_stream[Id] + a->rx_pos[Id] + 4),
#else
(void*)(a->rx_stream[Id] + a->rx_pos[Id] + 4),
(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,
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]),
ULongToPtr(a->rx_stream[Id] + a->rx_pos[Id]),
#else
(void*)(a->rx_stream[Id] + a->rx_pos[Id]),
(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);
(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
Does check if one of streams had caused interrupt and does
wake up corresponding application
--------------------------------------------------------------------- */
void pr_stream (ADAPTER * a) {
void pr_stream(ADAPTER *a) {
}
#endif /* } */

View File

@ -1,25 +1,25 @@
/*
*
Copyright (c) Eicon Networks, 2000.
Copyright (c) Eicon Networks, 2000.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 1.9
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 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.
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.
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__
@ -35,9 +35,9 @@ typedef struct _diva_trace_ie {
} diva_trace_ie_t;
/*
Structure used to represent "State\\BX\\Modem" directory
to user.
*/
Structure used to represent "State\\BX\\Modem" directory
to user.
*/
typedef struct _diva_trace_modem_state {
dword ChannelNumber;
@ -70,8 +70,8 @@ typedef struct _diva_trace_modem_state {
} diva_trace_modem_state_t;
/*
Representation of "State\\BX\\FAX" directory
*/
Representation of "State\\BX\\FAX" directory
*/
typedef struct _diva_trace_fax_state {
dword ChannelNumber;
dword Event;
@ -90,9 +90,9 @@ typedef struct _diva_trace_fax_state {
} diva_trace_fax_state_t;
/*
Structure used to represent Interface State in the abstract
and interface/D-channel protocol independent form.
*/
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];
@ -164,18 +164,18 @@ typedef struct _diva_prot_statistics {
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_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.
*/
Structure used to represent "State\\BX" directory
to user.
*/
typedef struct _diva_trace_line_state {
dword ChannelNumber;
@ -192,9 +192,9 @@ typedef struct _diva_trace_line_state {
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;
diva_trace_ie_t call_BC;
diva_trace_ie_t call_HLC;
diva_trace_ie_t call_LLC;
dword Charges;
@ -205,11 +205,11 @@ typedef struct _diva_trace_line_state {
char UserID[DIVA_TRACE_LINE_TYPE_LEN];
diva_trace_modem_state_t modem;
diva_trace_fax_state_t fax;
diva_trace_fax_state_t fax;
diva_trace_interface_state_t* pInterface;
diva_trace_interface_state_t *pInterface;
diva_ifc_statistics_t* pInterfaceStat;
diva_ifc_statistics_t *pInterfaceStat;
} diva_trace_line_state_t;
@ -222,115 +222,114 @@ typedef struct _diva_trace_line_state {
#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);
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
*/
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;
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);
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 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 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);
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);
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);
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;
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;
DivaSTraceGetHandle_proc_t DivaSTraceGetHandle;
DivaSTraceSetAudioTap_proc_t DivaSTraceSetAudioTap;
DivaSTraceSetBChannel_proc_t DivaSTraceSetBChannel;
DivaSTraceSetDChannel_proc_t DivaSTraceSetDChannel;
DivaSTraceSetDChannel_proc_t DivaSTraceSetInfo;
DivaSTraceGetOutgoingCallStatistics_proc_t \
DivaSTraceGetOutgoingCallStatistics;
DivaSTraceGetOutgoingCallStatistics;
DivaSTraceGetIncomingCallStatistics_proc_t \
DivaSTraceGetIncomingCallStatistics;
DivaSTraceGetIncomingCallStatistics;
DivaSTraceGetModemStatistics_proc_t \
DivaSTraceGetModemStatistics;
DivaSTraceGetModemStatistics;
DivaSTraceGetFaxStatistics_proc_t \
DivaSTraceGetFaxStatistics;
DivaSTraceGetFaxStatistics;
DivaSTraceGetBLayer1Statistics_proc_t \
DivaSTraceGetBLayer1Statistics;
DivaSTraceGetBLayer1Statistics;
DivaSTraceGetBLayer2Statistics_proc_t \
DivaSTraceGetBLayer2Statistics;
DivaSTraceGetBLayer2Statistics;
DivaSTraceGetDLayer1Statistics_proc_t \
DivaSTraceGetDLayer1Statistics;
DivaSTraceGetDLayer1Statistics;
DivaSTraceGetDLayer2Statistics_proc_t \
DivaSTraceGetDLayer2Statistics;
DivaSTraceClearCall_proc_t DivaSTraceClearCall;
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);
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,52 +1,52 @@
/*
*
Copyright (c) Eicon Networks, 2000.
Copyright (c) Eicon Networks, 2000.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 1.9
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 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.
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.
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);
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 */
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
@ -54,27 +54,27 @@ typedef struct _diva_strace_path2action {
typedef struct _diva_strace_context {
diva_strace_library_interface_t instance;
int Adapter;
void* hAdapter;
int Adapter;
void *hAdapter;
int Channels;
int req_busy;
int req_busy;
ENTITY e;
IDI_CALL request;
BUFFERS XData;
BUFFERS RData;
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;
int removal_state;
int general_b_ch_event;
int general_fax_event;
int general_mdm_event;
byte rc_ok;
byte rc_ok;
/*
Initialization request state machine
*/
Initialization request state machine
*/
int ChannelsTraceActive;
int ModemTraceActive;
int FaxTraceActive;
@ -93,8 +93,8 @@ typedef struct _diva_strace_context {
int l2_trace;
/*
Trace\Event Enable
*/
Trace\Event Enable
*/
word trace_event_mask;
word current_trace_event_mask;
@ -112,7 +112,7 @@ typedef struct _diva_strace_context {
int parse_entries;
int cur_parse_entry;
diva_strace_path2action_t* parse_table;
diva_strace_path2action_t *parse_table;
diva_trace_library_user_interface_t user_proc_table;
@ -169,4 +169,3 @@ typedef struct _diva_man_var_header {
} diva_man_var_header_t;
#endif

View File

@ -1,25 +1,25 @@
/*
*
Copyright (c) Eicon Networks, 2002.
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 1.9
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 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.
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.
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 */
@ -104,9 +104,9 @@
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 */
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 */
/*------------------------------------------------------------------*/

View File

@ -1,26 +1,26 @@
/*
*
Copyright (c) Eicon Networks, 2002.
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
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 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.
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.
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__
@ -30,18 +30,18 @@
#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
===================================================================== */
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
@ -129,14 +129,14 @@ DCD_ON Message:
#define DSP_CONNECTED_OPTION_MASK_COMPRESSION 0x0320
#define DSP_UDATA_INDICATION_DISCONNECT 5
/*
returns:
returns:
<byte> cause
*/
/* ==========================================================
DLC: B2 modem configuration
DLC: B2 modem configuration
========================================================== */
/*
Fields in assign DLC information element for modem protocol V.42/MNP:
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)
@ -172,10 +172,10 @@ Fields in assign DLC information element for modem protocol V.42/MNP:
#define DLC_MODEMPROT_APPL_EARLY_CONNECT 0x01
#define DLC_MODEMPROT_APPL_PASS_INDICATIONS 0x02
/* ==========================================================
CAI parameters used for the modem L1 configuration
CAI parameters used for the modem L1 configuration
========================================================== */
/*
Fields in assign CAI information element:
Fields in assign CAI information element:
<byte> length of information element
<byte> info field and B-channel hardware
<byte> rate adaptation bit rate
@ -311,21 +311,21 @@ Fields in assign CAI information element:
#define DSP_CAI_MODEM_SPEAKER_VOLUME_MAX 0x0c
#define DSP_CAI_MODEM_SPEAKER_VOLUME_MASK 0x0c
/* ==========================================================
DCD/CTS State
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
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
CAPI B2 Config Constants
========================================================== */
#define MDM_B2_DISABLE_V42bis 0x0001
#define MDM_B2_DISABLE_MNP 0x0002
@ -333,7 +333,7 @@ Fields in assign CAI information element:
#define MDM_B2_DISABLE_V42 0x0008
#define MDM_B2_DISABLE_COMP 0x0010
/* ==========================================================
CAPI B1 Config Constants
CAPI B1 Config Constants
========================================================== */
#define MDM_CAPI_DISABLE_RETRAIN 0x0001
#define MDM_CAPI_DISABLE_RING_TONE 0x0002

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +1,26 @@
/*
*
Copyright (c) Eicon Networks, 2002.
Copyright (c) Eicon Networks, 2002.
*
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
This source file is supplied for the use with
Eicon Networks range of DIVA Server Adapters.
*
Eicon File Revision : 2.1
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 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.
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.
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.
*
*/
/*----------------------------------------------------------------------------
@ -68,30 +68,30 @@
/* 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;
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 */
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) */
@ -150,11 +150,11 @@ struct mp_load {
#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 */
/*the GT64010 internal regs where mapped */
/*
* GT64010 internal registers
*/
/* DRAM device coding */
/* 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*/
@ -163,7 +163,7 @@ struct mp_load {
#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 */
/* 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 */
@ -172,20 +172,20 @@ struct mp_load {
#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 */
/* 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) */
/* 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) */
/* 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. */
/* 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 */

View File

@ -27,7 +27,7 @@ static dword notify_handle;
static DESCRIPTOR DAdapter;
static DESCRIPTOR MAdapter;
static DESCRIPTOR MaintDescriptor =
{ IDI_DIMAINT, 0, 0, (IDI_CALL) diva_maint_prtComp };
{ 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);
@ -44,7 +44,7 @@ static void no_printf(unsigned char *x, ...)
/*
* DIDD callback function
*/
static void *didd_callback(void *context, DESCRIPTOR * adapter,
static void *didd_callback(void *context, DESCRIPTOR *adapter,
int removal)
{
if (adapter->type == IDI_DADAPTER) {
@ -87,20 +87,20 @@ static int DIVA_INIT_FUNCTION connect_didd(void)
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;
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);
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;
IDI_SYNC_REQ_DIDD_ADD_ADAPTER;
req.didd_add_adapter.info.descriptor =
(void *) &MaintDescriptor;
DAdapter.request((ENTITY *) & req);
(void *) &MaintDescriptor;
DAdapter.request((ENTITY *)&req);
if (req.didd_add_adapter.e.Rc != 0xff)
return (0);
} else if ((DIDD_Table[x].type > 0)
@ -121,13 +121,13 @@ static void DIVA_EXIT_FUNCTION disconnect_didd(void)
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);
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);
(IDI_CALL) MaintDescriptor.request;
DAdapter.request((ENTITY *)&req);
}
/*
@ -147,9 +147,9 @@ int maint_read_write(void __user *buf, int count)
return (-EFAULT);
}
cmd = *(dword *) & data[0]; /* command */
id = *(dword *) & data[4]; /* driver id */
mask = *(dword *) & data[8]; /* mask or size */
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:
@ -178,19 +178,19 @@ int maint_read_write(void __user *buf, int count)
}
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
*/
/*
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, "*");
ret = diva_set_trace_filter(1, "*");
} else if (mask < sizeof(data)) {
if (diva_os_copy_from_user(NULL, data, (char __user *)buf+12, mask)) {
if (diva_os_copy_from_user(NULL, data, (char __user *)buf + 12, mask)) {
ret = -EFAULT;
} else {
ret = diva_set_trace_filter ((int)mask, data);
ret = diva_set_trace_filter((int)mask, data);
}
} else {
ret = -EINVAL;
@ -198,8 +198,8 @@ int maint_read_write(void __user *buf, int count)
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))
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;
@ -207,88 +207,88 @@ int maint_read_write(void __user *buf, int count)
break;
case DITRACE_READ_TRACE_ENTRY:{
diva_os_spin_lock_magic_t old_irql;
word size;
diva_dbg_entry_head_t *pmsg;
byte *pbuf;
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);
}
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;
for (;;) {
if (!(pmsg =
diva_maint_get_message(&size, &old_irql))) {
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) {
if (size > mask) {
diva_maint_ack_message(0, &old_irql);
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 = 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;
} else {
ret = written;
}
diva_os_free(0, pbuf);
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:
@ -316,7 +316,7 @@ int DIVA_INIT_FUNCTION mntfunc_init(int *buffer_length, void **buffer,
} else {
while ((*buffer_length >= (64 * 1024))
&&
(!(*buffer = diva_os_malloc (0, *buffer_length)))) {
(!(*buffer = diva_os_malloc(0, *buffer_length)))) {
*buffer_length -= 1024;
}
@ -328,7 +328,7 @@ int DIVA_INIT_FUNCTION mntfunc_init(int *buffer_length, void **buffer,
if (diva_maint_init(*buffer, *buffer_length, (diva_dbg_mem == 0))) {
if (!diva_dbg_mem) {
diva_os_free (0, *buffer);
diva_os_free(0, *buffer);
}
DBG_ERR(("init: maint init failed"));
return (0);
@ -338,7 +338,7 @@ int DIVA_INIT_FUNCTION mntfunc_init(int *buffer_length, void **buffer,
DBG_ERR(("init: failed to connect to DIDD."));
diva_maint_finit();
if (!diva_dbg_mem) {
diva_os_free (0, *buffer);
diva_os_free(0, *buffer);
}
return (0);
}
@ -362,7 +362,7 @@ void DIVA_EXIT_FUNCTION mntfunc_finit(void)
disconnect_didd();
if ((buffer = diva_maint_finit())) {
diva_os_free (0, buffer);
diva_os_free(0, buffer);
}
memset(&MAdapter, 0, sizeof(MAdapter));

View File

@ -27,12 +27,12 @@ static dword diva_xdiLoadFileLength = 0;
extern void prepare_qBri_functions(PISDN_ADAPTER IoAdapter);
extern void prepare_qBri2_functions(PISDN_ADAPTER IoAdapter);
extern void diva_xdi_display_adapter_features(int card);
extern void diva_add_slave_adapter(diva_os_xdi_adapter_t * a);
extern void diva_add_slave_adapter(diva_os_xdi_adapter_t *a);
extern int qBri_FPGA_download(PISDN_ADAPTER IoAdapter);
extern void start_qBri_hardware(PISDN_ADAPTER IoAdapter);
extern int diva_card_read_xlog(diva_os_xdi_adapter_t * a);
extern int diva_card_read_xlog(diva_os_xdi_adapter_t *a);
/*
** LOCALS
@ -57,23 +57,23 @@ static unsigned long _4bri_v2_bri_bar_length[4] = {
};
static int diva_4bri_cleanup_adapter(diva_os_xdi_adapter_t * a);
static int _4bri_get_serial_number(diva_os_xdi_adapter_t * a);
static int diva_4bri_cleanup_adapter(diva_os_xdi_adapter_t *a);
static int _4bri_get_serial_number(diva_os_xdi_adapter_t *a);
static int diva_4bri_cmd_card_proc(struct _diva_os_xdi_adapter *a,
diva_xdi_um_cfg_cmd_t * cmd,
diva_xdi_um_cfg_cmd_t *cmd,
int length);
static int diva_4bri_cleanup_slave_adapters(diva_os_xdi_adapter_t * a);
static int diva_4bri_write_fpga_image(diva_os_xdi_adapter_t * a,
byte * data, dword length);
static int diva_4bri_cleanup_slave_adapters(diva_os_xdi_adapter_t *a);
static int diva_4bri_write_fpga_image(diva_os_xdi_adapter_t *a,
byte *data, dword length);
static int diva_4bri_reset_adapter(PISDN_ADAPTER IoAdapter);
static int diva_4bri_write_sdram_block(PISDN_ADAPTER IoAdapter,
dword address,
const byte * data,
const byte *data,
dword length, dword limit);
static int diva_4bri_start_adapter(PISDN_ADAPTER IoAdapter,
dword start_address, dword features);
static int check_qBri_interrupt(PISDN_ADAPTER IoAdapter);
static int diva_4bri_stop_adapter(diva_os_xdi_adapter_t * a);
static int diva_4bri_stop_adapter(diva_os_xdi_adapter_t *a);
static int _4bri_is_rev_2_card(int card_ordinal)
{
@ -112,8 +112,8 @@ static void diva_4bri_set_addresses(diva_os_xdi_adapter_t *a)
a->resources.pci.mem_type_id[MEM_TYPE_PROM] = 0;
/*
Set up hardware related pointers
*/
Set up hardware related pointers
*/
a->xdi_adapter.Address = a->resources.pci.addr[2]; /* BAR2 SDRAM */
a->xdi_adapter.Address += c_offset;
@ -121,15 +121,15 @@ static void diva_4bri_set_addresses(diva_os_xdi_adapter_t *a)
a->xdi_adapter.ram = a->resources.pci.addr[2]; /* BAR2 SDRAM */
a->xdi_adapter.ram += c_offset + (offset - MQ_SHARED_RAM_SIZE);
a->xdi_adapter.reset = a->resources.pci.addr[0]; /* BAR0 CONFIG */
/*
ctlReg contains the register address for the MIPS CPU reset control
*/
ctlReg contains the register address for the MIPS CPU reset control
*/
a->xdi_adapter.ctlReg = a->resources.pci.addr[3]; /* BAR3 CNTRL */
/*
prom contains the register address for FPGA and EEPROM programming
*/
prom contains the register address for FPGA and EEPROM programming
*/
a->xdi_adapter.prom = &a->xdi_adapter.reset[0x6E];
}
@ -141,7 +141,7 @@ static void diva_4bri_set_addresses(diva_os_xdi_adapter_t *a)
**
** Called by master adapter, that will initialize and add slave adapters
*/
int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
int diva_4bri_init_card(diva_os_xdi_adapter_t *a)
{
int bar, i;
byte __iomem *p;
@ -168,48 +168,48 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
DBG_TRC(("SDRAM_LENGTH=%08x, tasks=%d, factor=%d",
bar_length[2], tasks, factor))
/*
Get Serial Number
The serial number of 4BRI is accessible in accordance with PCI spec
via command register located in configuration space, also we do not
have to map any BAR before we can access it
*/
if (!_4bri_get_serial_number(a)) {
DBG_ERR(("A: 4BRI can't get Serial Number"))
diva_4bri_cleanup_adapter(a);
return (-1);
}
/*
Get Serial Number
The serial number of 4BRI is accessible in accordance with PCI spec
via command register located in configuration space, also we do not
have to map any BAR before we can access it
*/
if (!_4bri_get_serial_number(a)) {
DBG_ERR(("A: 4BRI can't get Serial Number"))
diva_4bri_cleanup_adapter(a);
return (-1);
}
/*
Set properties
*/
Set properties
*/
a->xdi_adapter.Properties = CardProperties[a->CardOrdinal];
DBG_LOG(("Load %s, SN:%ld, bus:%02x, func:%02x",
a->xdi_adapter.Properties.Name,
a->xdi_adapter.serialNo,
a->resources.pci.bus, a->resources.pci.func))
/*
First initialization step: get and check hardware resoures.
Do not map resources and do not access card at this step
*/
for (bar = 0; bar < 4; 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]
|| (a->resources.pci.bar[bar] == 0xFFFFFFF0)) {
DBG_ERR(
("A: invalid bar[%d]=%08x", bar,
a->resources.pci.bar[bar]))
return (-1);
/*
First initialization step: get and check hardware resoures.
Do not map resources and do not access card at this step
*/
for (bar = 0; bar < 4; 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]
|| (a->resources.pci.bar[bar] == 0xFFFFFFF0)) {
DBG_ERR(
("A: invalid bar[%d]=%08x", bar,
a->resources.pci.bar[bar]))
return (-1);
}
}
}
a->resources.pci.irq =
(byte) divasa_get_pci_irq(a->resources.pci.bus,
a->resources.pci.func,
a->resources.pci.hdev);
(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);
@ -218,30 +218,30 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
a->xdi_adapter.sdram_bar = a->resources.pci.bar[2];
/*
Map all MEMORY BAR's
*/
Map all MEMORY BAR's
*/
for (bar = 0; bar < 4; bar++) {
if (bar != 1) { /* ignore I/O */
a->resources.pci.addr[bar] =
divasa_remap_pci_bar(a, bar, a->resources.pci.bar[bar],
bar_length[bar]);
divasa_remap_pci_bar(a, bar, a->resources.pci.bar[bar],
bar_length[bar]);
if (!a->resources.pci.addr[bar]) {
DBG_ERR(("A: 4BRI: can't map bar[%d]", bar))
diva_4bri_cleanup_adapter(a);
diva_4bri_cleanup_adapter(a);
return (-1);
}
}
}
/*
Register I/O port
*/
Register I/O port
*/
sprintf(&a->port_name[0], "DIVA 4BRI %ld", (long) a->xdi_adapter.serialNo);
if (diva_os_register_io_port(a, 1, a->resources.pci.bar[1],
bar_length[1], &a->port_name[0], 1)) {
DBG_ERR(("A: 4BRI: can't register bar[1]"))
diva_4bri_cleanup_adapter(a);
diva_4bri_cleanup_adapter(a);
return (-1);
}
@ -249,23 +249,23 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
(void *) (unsigned long) a->resources.pci.bar[1];
/*
Set cleanup pointer for base adapter only, so slave adapter
will be unable to get cleanup
*/
Set cleanup pointer for base adapter only, so slave adapter
will be unable to get cleanup
*/
a->interface.cleanup_adapter_proc = diva_4bri_cleanup_adapter;
/*
Create slave adapters
*/
Create slave adapters
*/
if (tasks > 1) {
if (!(a->slave_adapters[0] =
(diva_os_xdi_adapter_t *) diva_os_malloc(0, sizeof(*a))))
(diva_os_xdi_adapter_t *) diva_os_malloc(0, sizeof(*a))))
{
diva_4bri_cleanup_adapter(a);
return (-1);
}
if (!(a->slave_adapters[1] =
(diva_os_xdi_adapter_t *) diva_os_malloc(0, sizeof(*a))))
(diva_os_xdi_adapter_t *) diva_os_malloc(0, sizeof(*a))))
{
diva_os_free(0, a->slave_adapters[0]);
a->slave_adapters[0] = NULL;
@ -273,7 +273,7 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
return (-1);
}
if (!(a->slave_adapters[2] =
(diva_os_xdi_adapter_t *) diva_os_malloc(0, sizeof(*a))))
(diva_os_xdi_adapter_t *) diva_os_malloc(0, sizeof(*a))))
{
diva_os_free(0, a->slave_adapters[0]);
diva_os_free(0, a->slave_adapters[1]);
@ -293,10 +293,10 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
adapter_list[3] = a->slave_adapters[2];
/*
Allocate slave list
*/
Allocate slave list
*/
quadro_list =
(PADAPTER_LIST_ENTRY) diva_os_malloc(0, sizeof(*quadro_list));
(PADAPTER_LIST_ENTRY) diva_os_malloc(0, sizeof(*quadro_list));
if (!(a->slave_list = quadro_list)) {
for (i = 0; i < (tasks - 1); i++) {
diva_os_free(0, a->slave_adapters[i]);
@ -308,14 +308,14 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
memset(quadro_list, 0x00, sizeof(*quadro_list));
/*
Set interfaces
*/
Set interfaces
*/
a->xdi_adapter.QuadroList = quadro_list;
for (i = 0; i < tasks; i++) {
adapter_list[i]->xdi_adapter.ControllerNumber = i;
adapter_list[i]->xdi_adapter.tasks = tasks;
quadro_list->QuadroAdapter[i] =
&adapter_list[i]->xdi_adapter;
&adapter_list[i]->xdi_adapter;
}
for (i = 0; i < tasks; i++) {
@ -324,21 +324,21 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
diva_current->dsp_mask = 0x00000003;
diva_current->xdi_adapter.a.io =
&diva_current->xdi_adapter;
&diva_current->xdi_adapter;
diva_current->xdi_adapter.DIRequest = request;
diva_current->interface.cmd_proc = diva_4bri_cmd_card_proc;
diva_current->xdi_adapter.Properties =
CardProperties[a->CardOrdinal];
CardProperties[a->CardOrdinal];
diva_current->CardOrdinal = a->CardOrdinal;
diva_current->xdi_adapter.Channels =
CardProperties[a->CardOrdinal].Channels;
CardProperties[a->CardOrdinal].Channels;
diva_current->xdi_adapter.e_max =
CardProperties[a->CardOrdinal].E_info;
CardProperties[a->CardOrdinal].E_info;
diva_current->xdi_adapter.e_tbl =
diva_os_malloc(0,
diva_current->xdi_adapter.e_max *
sizeof(E_INFO));
diva_os_malloc(0,
diva_current->xdi_adapter.e_max *
sizeof(E_INFO));
if (!diva_current->xdi_adapter.e_tbl) {
diva_4bri_cleanup_slave_adapters(a);
@ -370,8 +370,8 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
strcpy(diva_current->xdi_adapter.req_soft_isr. dpc_thread_name, "kdivas4brid");
if (diva_os_initialize_soft_isr (&diva_current->xdi_adapter.req_soft_isr, DIDpcRoutine,
&diva_current->xdi_adapter)) {
if (diva_os_initialize_soft_isr(&diva_current->xdi_adapter.req_soft_isr, DIDpcRoutine,
&diva_current->xdi_adapter)) {
diva_4bri_cleanup_slave_adapters(a);
diva_4bri_cleanup_adapter(a);
for (i = 1; i < (tasks - 1); i++) {
@ -381,10 +381,10 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
}
/*
Do not initialize second DPC - only one thread will be created
*/
Do not initialize second DPC - only one thread will be created
*/
diva_current->xdi_adapter.isr_soft_isr.object =
diva_current->xdi_adapter.req_soft_isr.object;
diva_current->xdi_adapter.req_soft_isr.object;
}
if (v2) {
@ -397,12 +397,12 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
diva_current = adapter_list[i];
if (i)
memcpy(&diva_current->resources, &a->resources, sizeof(divas_card_resources_t));
diva_current->resources.pci.qoffset = (a->xdi_adapter.MemorySize >> factor);
diva_current->resources.pci.qoffset = (a->xdi_adapter.MemorySize >> factor);
}
/*
Set up hardware related pointers
*/
Set up hardware related pointers
*/
a->xdi_adapter.cfg = (void *) (unsigned long) a->resources.pci.bar[0]; /* BAR0 CONFIG */
a->xdi_adapter.port = (void *) (unsigned long) a->resources.pci.bar[1]; /* BAR1 */
a->xdi_adapter.ctlReg = (void *) (unsigned long) a->resources.pci.bar[3]; /* BAR3 CNTRL */
@ -415,21 +415,21 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
Slave->sdram_bar = a->xdi_adapter.sdram_bar;
if (i) {
Slave->serialNo = ((dword) (Slave->ControllerNumber << 24)) |
a->xdi_adapter.serialNo;
a->xdi_adapter.serialNo;
Slave->cardType = a->xdi_adapter.cardType;
}
}
/*
reset contains the base address for the PLX 9054 register set
*/
reset contains the base address for the PLX 9054 register set
*/
p = DIVA_OS_MEM_ATTACH_RESET(&a->xdi_adapter);
WRITE_BYTE(&p[PLX9054_INTCSR], 0x00); /* disable PCI interrupts */
DIVA_OS_MEM_DETACH_RESET(&a->xdi_adapter, p);
/*
Set IRQ handler
*/
Set IRQ handler
*/
a->xdi_adapter.irq_info.irq_nr = a->resources.pci.irq;
sprintf(a->xdi_adapter.irq_info.irq_name, "DIVA 4BRI %ld",
(long) a->xdi_adapter.serialNo);
@ -447,8 +447,8 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
a->xdi_adapter.irq_info.registered = 1;
/*
Add three slave adapters
*/
Add three slave adapters
*/
if (tasks > 1) {
diva_add_slave_adapter(adapter_list[1]);
diva_add_slave_adapter(adapter_list[2]);
@ -466,33 +466,33 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
** this is guaranteed by design: cleanup callback is set
** by master adapter only
*/
static int diva_4bri_cleanup_adapter(diva_os_xdi_adapter_t * a)
static int diva_4bri_cleanup_adapter(diva_os_xdi_adapter_t *a)
{
int bar;
/*
Stop adapter if running
*/
Stop adapter if running
*/
if (a->xdi_adapter.Initialized) {
diva_4bri_stop_adapter(a);
}
/*
Remove IRQ handler
*/
Remove IRQ 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;
/*
Free DPC's and spin locks on all adapters
*/
Free DPC's and spin locks on all adapters
*/
diva_4bri_cleanup_slave_adapters(a);
/*
Unmap all BARS
*/
Unmap all BARS
*/
for (bar = 0; bar < 4; bar++) {
if (bar != 1) {
if (a->resources.pci.bar[bar]
@ -505,8 +505,8 @@ static int diva_4bri_cleanup_adapter(diva_os_xdi_adapter_t * a)
}
/*
Unregister I/O
*/
Unregister I/O
*/
if (a->resources.pci.bar[1] && a->resources.pci.addr[1]) {
diva_os_register_io_port(a, 0, a->resources.pci.bar[1],
_4bri_is_rev_2_card(a->
@ -526,7 +526,7 @@ static int diva_4bri_cleanup_adapter(diva_os_xdi_adapter_t * a)
return (0);
}
static int _4bri_get_serial_number(diva_os_xdi_adapter_t * a)
static int _4bri_get_serial_number(diva_os_xdi_adapter_t *a)
{
dword data[64];
dword serNo;
@ -551,13 +551,13 @@ static int _4bri_get_serial_number(diva_os_xdi_adapter_t * a)
}
if (j >= 5) {
DBG_ERR(("EEPROM[%d] read failed (0x%x)", i * 4, addr))
return (0);
return (0);
}
PCIread(Bus, Slot, 0x50, &data[i], sizeof(data[i]), hdev);
}
DBG_BLK(((char *) &data[0], sizeof(data)))
serNo = data[32];
serNo = data[32];
if (serNo == 0 || serNo == 0xffffffff)
serNo = data[63];
@ -572,13 +572,13 @@ static int _4bri_get_serial_number(diva_os_xdi_adapter_t * a)
DBG_REG(("Serial No. : %ld", a->xdi_adapter.serialNo))
return (serNo);
return (serNo);
}
/*
** Release resources of slave adapters
*/
static int diva_4bri_cleanup_slave_adapters(diva_os_xdi_adapter_t * a)
static int diva_4bri_cleanup_slave_adapters(diva_os_xdi_adapter_t *a)
{
diva_os_xdi_adapter_t *adapter_list[4];
diva_os_xdi_adapter_t *diva_current;
@ -625,24 +625,24 @@ static int diva_4bri_cleanup_slave_adapters(diva_os_xdi_adapter_t * a)
static int
diva_4bri_cmd_card_proc(struct _diva_os_xdi_adapter *a,
diva_xdi_um_cfg_cmd_t * cmd, int length)
diva_xdi_um_cfg_cmd_t *cmd, int length)
{
int ret = -1;
if (cmd->adapter != a->controller) {
DBG_ERR(("A: 4bri_cmd, invalid controller=%d != %d",
cmd->adapter, a->controller))
return (-1);
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);
diva_os_malloc(0, a->xdi_mbox.data_length);
if (a->xdi_mbox.data) {
*(dword *) a->xdi_mbox.data =
(dword) a->CardOrdinal;
(dword) a->CardOrdinal;
a->xdi_mbox.status = DIVA_XDI_MBOX_BUSY;
ret = 0;
}
@ -651,10 +651,10 @@ diva_4bri_cmd_card_proc(struct _diva_os_xdi_adapter *a,
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);
diva_os_malloc(0, a->xdi_mbox.data_length);
if (a->xdi_mbox.data) {
*(dword *) a->xdi_mbox.data =
(dword) a->xdi_adapter.serialNo;
(dword) a->xdi_adapter.serialNo;
a->xdi_mbox.status = DIVA_XDI_MBOX_BUSY;
ret = 0;
}
@ -663,11 +663,11 @@ diva_4bri_cmd_card_proc(struct _diva_os_xdi_adapter *a,
case DIVA_XDI_UM_CMD_GET_PCI_HW_CONFIG:
if (!a->xdi_adapter.ControllerNumber) {
/*
Only master adapter can access hardware config
*/
Only master adapter can access hardware config
*/
a->xdi_mbox.data_length = sizeof(dword) * 9;
a->xdi_mbox.data =
diva_os_malloc(0, a->xdi_mbox.data_length);
diva_os_malloc(0, a->xdi_mbox.data_length);
if (a->xdi_mbox.data) {
int i;
dword *data = (dword *) a->xdi_mbox.data;
@ -686,7 +686,7 @@ diva_4bri_cmd_card_proc(struct _diva_os_xdi_adapter *a,
if (!a->xdi_adapter.ControllerNumber) {
a->xdi_mbox.data_length = sizeof(dword);
a->xdi_mbox.data =
diva_os_malloc(0, a->xdi_mbox.data_length);
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.ram
@ -709,11 +709,11 @@ diva_4bri_cmd_card_proc(struct _diva_os_xdi_adapter *a,
case DIVA_XDI_UM_CMD_WRITE_FPGA:
if (!a->xdi_adapter.ControllerNumber) {
ret =
diva_4bri_write_fpga_image(a,
(byte *) & cmd[1],
cmd->command_data.
write_fpga.
image_length);
diva_4bri_write_fpga_image(a,
(byte *)&cmd[1],
cmd->command_data.
write_fpga.
image_length);
}
break;
@ -754,12 +754,12 @@ diva_4bri_cmd_card_proc(struct _diva_os_xdi_adapter *a,
case DIVA_XDI_UM_CMD_SET_PROTOCOL_FEATURES:
if (!a->xdi_adapter.ControllerNumber) {
a->xdi_adapter.features =
cmd->command_data.features.features;
cmd->command_data.features.features;
a->xdi_adapter.a.protocol_capabilities =
a->xdi_adapter.features;
a->xdi_adapter.features;
DBG_TRC(("Set raw protocol features (%08x)",
a->xdi_adapter.features))
ret = 0;
ret = 0;
}
break;
@ -777,16 +777,16 @@ diva_4bri_cmd_card_proc(struct _diva_os_xdi_adapter *a,
if (!a->xdi_adapter.ControllerNumber
&& a->xdi_adapter.Address) {
if (
(a->xdi_mbox.data_length =
cmd->command_data.read_sdram.length)) {
(a->xdi_mbox.data_length =
cmd->command_data.read_sdram.length)) {
if (
(a->xdi_mbox.data_length +
cmd->command_data.read_sdram.offset) <
a->xdi_adapter.MemorySize) {
(a->xdi_mbox.data_length +
cmd->command_data.read_sdram.offset) <
a->xdi_adapter.MemorySize) {
a->xdi_mbox.data =
diva_os_malloc(0,
a->xdi_mbox.
data_length);
diva_os_malloc(0,
a->xdi_mbox.
data_length);
if (a->xdi_mbox.data) {
byte __iomem *p = DIVA_OS_MEM_ATTACH_ADDRESS(&a->xdi_adapter);
byte __iomem *src = p;
@ -810,7 +810,7 @@ diva_4bri_cmd_card_proc(struct _diva_os_xdi_adapter *a,
default:
DBG_ERR(("A: A(%d) invalid cmd=%d", a->controller,
cmd->command))
}
}
return (ret);
}
@ -838,7 +838,7 @@ void diva_os_set_qBri2_functions(PISDN_ADAPTER IoAdapter)
}
static int
diva_4bri_write_fpga_image(diva_os_xdi_adapter_t * a, byte * data,
diva_4bri_write_fpga_image(diva_os_xdi_adapter_t *a, byte *data,
dword length)
{
int ret;
@ -865,12 +865,12 @@ static int diva_4bri_reset_adapter(PISDN_ADAPTER IoAdapter)
if (IoAdapter->Initialized) {
DBG_ERR(("A: A(%d) can't reset 4BRI adapter - please stop first",
IoAdapter->ANum))
return (-1);
return (-1);
}
/*
Forget all entities on all adapters
*/
Forget all entities on all adapters
*/
for (i = 0; ((i < IoAdapter->tasks) && IoAdapter->QuadroList); i++) {
Slave = IoAdapter->QuadroList->QuadroAdapter[i];
Slave->e_count = 0;
@ -908,7 +908,7 @@ static int diva_4bri_reset_adapter(PISDN_ADAPTER IoAdapter)
static int
diva_4bri_write_sdram_block(PISDN_ADAPTER IoAdapter,
dword address,
const byte * data, dword length, dword limit)
const byte *data, dword length, dword limit)
{
byte __iomem *p = DIVA_OS_MEM_ATTACH_ADDRESS(IoAdapter);
byte __iomem *mem = p;
@ -917,7 +917,7 @@ diva_4bri_write_sdram_block(PISDN_ADAPTER IoAdapter,
DIVA_OS_MEM_DETACH_ADDRESS(IoAdapter, p);
DBG_ERR(("A: A(%d) write 4BRI address=0x%08lx",
IoAdapter->ANum, address + length))
return (-1);
return (-1);
}
mem += address;
@ -939,14 +939,14 @@ diva_4bri_start_adapter(PISDN_ADAPTER IoAdapter,
byte __iomem *p;
/*
start adapter
*/
start adapter
*/
start_qBri_hardware(IoAdapter);
p = DIVA_OS_MEM_ATTACH_RAM(IoAdapter);
/*
wait for signature in shared memory (max. 3 seconds)
*/
wait for signature in shared memory (max. 3 seconds)
*/
signature = (volatile word __iomem *) (&p[0x1E]);
for (i = 0; i < 300; ++i) {
@ -954,23 +954,23 @@ diva_4bri_start_adapter(PISDN_ADAPTER IoAdapter,
if (READ_WORD(&signature[0]) == 0x4447) {
DBG_TRC(("Protocol startup time %d.%02d seconds",
(i / 100), (i % 100)))
started = 1;
started = 1;
break;
}
}
for (i = 1; i < IoAdapter->tasks; i++) {
IoAdapter->QuadroList->QuadroAdapter[i]->features =
IoAdapter->features;
IoAdapter->features;
IoAdapter->QuadroList->QuadroAdapter[i]->a.
protocol_capabilities = IoAdapter->features;
protocol_capabilities = IoAdapter->features;
}
if (!started) {
DBG_FTL(("%s: Adapter selftest failed, signature=%04x",
IoAdapter->Properties.Name,
READ_WORD(&signature[0])))
DIVA_OS_MEM_DETACH_RAM(IoAdapter, p);
DIVA_OS_MEM_DETACH_RAM(IoAdapter, p);
(*(IoAdapter->trapFnc)) (IoAdapter);
IoAdapter->stop(IoAdapter);
return (-1);
@ -985,9 +985,9 @@ diva_4bri_start_adapter(PISDN_ADAPTER IoAdapter,
if (check_qBri_interrupt(IoAdapter)) {
DBG_ERR(("A: A(%d) interrupt test failed",
IoAdapter->ANum))
for (i = 0; i < IoAdapter->tasks; i++) {
IoAdapter->QuadroList->QuadroAdapter[i]->Initialized = 0;
}
for (i = 0; i < IoAdapter->tasks; i++) {
IoAdapter->QuadroList->QuadroAdapter[i]->Initialized = 0;
}
IoAdapter->stop(IoAdapter);
return (-1);
}
@ -999,7 +999,7 @@ diva_4bri_start_adapter(PISDN_ADAPTER IoAdapter,
DBG_LOG(("A(%d) %s adapter successfully started",
IoAdapter->QuadroList->QuadroAdapter[i]->ANum,
(IoAdapter->tasks == 1) ? "BRI 2.0" : "4BRI"))
diva_xdi_didd_register_adapter(IoAdapter->QuadroList->QuadroAdapter[i]->ANum);
diva_xdi_didd_register_adapter(IoAdapter->QuadroList->QuadroAdapter[i]->ANum);
IoAdapter->QuadroList->QuadroAdapter[i]->Properties.Features = (word) features;
}
@ -1022,8 +1022,8 @@ static int check_qBri_interrupt(PISDN_ADAPTER IoAdapter)
WRITE_BYTE(&p[PLX9054_INTCSR], PLX9054_INT_ENABLE);
DIVA_OS_MEM_DETACH_RESET(IoAdapter, p);
/*
interrupt test
*/
interrupt test
*/
a->ReadyInt = 1;
a->ram_out(a, &PR_RAM->ReadyInt, 1);
@ -1034,14 +1034,14 @@ static int check_qBri_interrupt(PISDN_ADAPTER IoAdapter)
dword volatile __iomem *qBriIrq;
byte __iomem *p;
/*
Reset on-board interrupt register
*/
Reset on-board interrupt register
*/
IoAdapter->IrqCount = 0;
p = DIVA_OS_MEM_ATTACH_CTLREG(IoAdapter);
qBriIrq = (dword volatile __iomem *) (&p[_4bri_is_rev_2_card
(IoAdapter->
cardType) ? (MQ2_BREG_IRQ_TEST)
: (MQ_BREG_IRQ_TEST)]);
(IoAdapter->
cardType) ? (MQ2_BREG_IRQ_TEST)
: (MQ_BREG_IRQ_TEST)]);
WRITE_DWORD(qBriIrq, MQ_IRQ_REQ_OFF);
DIVA_OS_MEM_DETACH_CTLREG(IoAdapter, p);
@ -1056,13 +1056,13 @@ static int check_qBri_interrupt(PISDN_ADAPTER IoAdapter)
#endif /* SUPPORT_INTERRUPT_TEST_ON_4BRI */
}
static void diva_4bri_clear_interrupts(diva_os_xdi_adapter_t * a)
static void diva_4bri_clear_interrupts(diva_os_xdi_adapter_t *a)
{
PISDN_ADAPTER IoAdapter = &a->xdi_adapter;
/*
clear any pending interrupt
*/
clear any pending interrupt
*/
IoAdapter->disIrq(IoAdapter);
IoAdapter->tst_irq(&IoAdapter->a);
@ -1070,13 +1070,13 @@ static void diva_4bri_clear_interrupts(diva_os_xdi_adapter_t * a)
IoAdapter->tst_irq(&IoAdapter->a);
/*
kill pending dpcs
*/
kill pending dpcs
*/
diva_os_cancel_soft_isr(&IoAdapter->req_soft_isr);
diva_os_cancel_soft_isr(&IoAdapter->isr_soft_isr);
}
static int diva_4bri_stop_adapter(diva_os_xdi_adapter_t * a)
static int diva_4bri_stop_adapter(diva_os_xdi_adapter_t *a)
{
PISDN_ADAPTER IoAdapter = &a->xdi_adapter;
int i;
@ -1088,7 +1088,7 @@ static int diva_4bri_stop_adapter(diva_os_xdi_adapter_t * a)
if (!IoAdapter->Initialized) {
DBG_ERR(("A: A(%d) can't stop PRI adapter - not running",
IoAdapter->ANum))
return (-1); /* nothing to stop */
return (-1); /* nothing to stop */
}
for (i = 0; i < IoAdapter->tasks; i++) {
@ -1096,8 +1096,8 @@ static int diva_4bri_stop_adapter(diva_os_xdi_adapter_t * a)
}
/*
Disconnect Adapters from DIDD
*/
Disconnect Adapters from DIDD
*/
for (i = 0; i < IoAdapter->tasks; i++) {
diva_xdi_didd_remove_adapter(IoAdapter->QuadroList->QuadroAdapter[i]->ANum);
}
@ -1105,8 +1105,8 @@ static int diva_4bri_stop_adapter(diva_os_xdi_adapter_t * a)
i = 100;
/*
Stop interrupts
*/
Stop interrupts
*/
a->clear_interrupts_proc = diva_4bri_clear_interrupts;
IoAdapter->a.ReadyInt = 1;
IoAdapter->a.ram_inc(&IoAdapter->a, &PR_RAM->ReadyInt);
@ -1119,12 +1119,12 @@ static int diva_4bri_stop_adapter(diva_os_xdi_adapter_t * a)
a->clear_interrupts_proc = NULL;
DBG_ERR(("A: A(%d) no final interrupt from 4BRI adapter",
IoAdapter->ANum))
}
}
IoAdapter->a.ReadyInt = 0;
/*
Stop and reset adapter
*/
Stop and reset adapter
*/
IoAdapter->stop(IoAdapter);
return (0);

View File

@ -3,6 +3,6 @@
#ifndef __DIVA_OS_4_BRI_H__
#define __DIVA_OS_4_BRI_H__
int diva_4bri_init_card(diva_os_xdi_adapter_t * a);
int diva_4bri_init_card(diva_os_xdi_adapter_t *a);
#endif

View File

@ -23,7 +23,7 @@
*/
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);
extern int diva_card_read_xlog(diva_os_xdi_adapter_t *a);
/*
** LOCALS
@ -33,20 +33,20 @@ static int bri_bar_length[3] = {
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_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);
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);
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 int diva_bri_stop_adapter(diva_os_xdi_adapter_t *a);
static void diva_bri_set_addresses(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;
@ -54,7 +54,7 @@ static void diva_bri_set_addresses(diva_os_xdi_adapter_t * a)
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];
@ -72,7 +72,7 @@ static void diva_bri_set_addresses(diva_os_xdi_adapter_t * a)
** BAR1 - I/O Addr - 0x80
** BAR2 - I/O Addr - 0x20
*/
int diva_bri_init_card(diva_os_xdi_adapter_t * a)
int diva_bri_init_card(diva_os_xdi_adapter_t *a)
{
int bar;
dword bar2 = 0, bar2_length = 0xffffffff;
@ -82,75 +82,75 @@ int diva_bri_init_card(diva_os_xdi_adapter_t * a)
byte __iomem *p;
/*
Set properties
*/
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);
/*
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);
(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
*/
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
*/
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
*/
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
*/
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
*/
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);
}
/*
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);
@ -158,7 +158,7 @@ int diva_bri_init_card(diva_os_xdi_adapter_t * a)
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);
diva_bri_cleanup_adapter(a);
return (-1);
}
a->resources.pci.addr[1] = (void *) (unsigned long) a->resources.pci.bar[1];
@ -167,33 +167,33 @@ int diva_bri_init_card(diva_os_xdi_adapter_t * a)
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);
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
*/
Set all memory areas
*/
diva_bri_set_addresses(a);
/*
Get Serial Number
*/
Get Serial Number
*/
a->xdi_adapter.serialNo = diva_bri_get_serial_number(a);
/*
Register I/O ports with correct name now
*/
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
*/
Initialize OS dependent objects
*/
if (diva_os_initialize_spin_lock
(&a->xdi_adapter.isr_spin_lock, "isr")) {
diva_bri_cleanup_adapter(a);
@ -213,13 +213,13 @@ int diva_bri_init_card(diva_os_xdi_adapter_t * a)
return (-1);
}
/*
Do not initialize second DPC - only one thread will be created
*/
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
*/
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));
@ -230,8 +230,8 @@ int diva_bri_init_card(diva_os_xdi_adapter_t * a)
memset(a->xdi_adapter.e_tbl, 0x00, a->xdi_adapter.e_max * sizeof(E_INFO));
/*
Set up interface
*/
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;
@ -246,8 +246,8 @@ int diva_bri_init_card(diva_os_xdi_adapter_t * a)
a->dsp_mask = 0x00000003;
/*
Set IRQ handler
*/
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);
@ -265,7 +265,7 @@ int diva_bri_init_card(diva_os_xdi_adapter_t * a)
}
static int diva_bri_cleanup_adapter(diva_os_xdi_adapter_t * a)
static int diva_bri_cleanup_adapter(diva_os_xdi_adapter_t *a)
{
int i;
@ -274,8 +274,8 @@ static int diva_bri_cleanup_adapter(diva_os_xdi_adapter_t * a)
}
/*
Remove ISR Handler
*/
Remove ISR Handler
*/
if (a->xdi_adapter.irq_info.registered) {
diva_os_remove_irq(a, a->xdi_adapter.irq_info.irq_nr);
}
@ -300,8 +300,8 @@ static int diva_bri_cleanup_adapter(diva_os_xdi_adapter_t * a)
}
/*
Free OS objects
*/
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);
@ -312,8 +312,8 @@ static int diva_bri_cleanup_adapter(diva_os_xdi_adapter_t * a)
diva_os_destroy_spin_lock(&a->xdi_adapter.data_spin_lock, "rm");
/*
Free memory
*/
Free memory
*/
if (a->xdi_adapter.e_tbl) {
diva_os_free(0, a->xdi_adapter.e_tbl);
a->xdi_adapter.e_tbl = NULL;
@ -329,7 +329,7 @@ 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)
static dword diva_bri_get_serial_number(diva_os_xdi_adapter_t *a)
{
dword serNo = 0;
byte __iomem *confIO;
@ -345,7 +345,7 @@ static dword diva_bri_get_serial_number(diva_os_xdi_adapter_t * a)
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);
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);
@ -354,14 +354,14 @@ static dword diva_bri_get_serial_number(diva_os_xdi_adapter_t * a)
DBG_LOG(("Serial Number=%ld", serNo))
return (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)
static int diva_bri_reregister_io(diva_os_xdi_adapter_t *a)
{
int i;
@ -380,10 +380,10 @@ static int diva_bri_reregister_io(diva_os_xdi_adapter_t * a)
a->resources.pci.length[i],
&a->port_name[0], i)) {
DBG_ERR(("A: failed to reregister BAR[%d]", i))
return (-1);
return (-1);
}
a->resources.pci.addr[i] =
(void *) (unsigned long) a->resources.pci.bar[i];
(void *) (unsigned long) a->resources.pci.bar[i];
}
return (0);
@ -394,24 +394,24 @@ static int diva_bri_reregister_io(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)
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);
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);
diva_os_malloc(0, a->xdi_mbox.data_length);
if (a->xdi_mbox.data) {
*(dword *) a->xdi_mbox.data =
(dword) a->CardOrdinal;
(dword) a->CardOrdinal;
a->xdi_mbox.status = DIVA_XDI_MBOX_BUSY;
ret = 0;
}
@ -420,10 +420,10 @@ diva_bri_cmd_card_proc(struct _diva_os_xdi_adapter *a,
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);
diva_os_malloc(0, a->xdi_mbox.data_length);
if (a->xdi_mbox.data) {
*(dword *) a->xdi_mbox.data =
(dword) a->xdi_adapter.serialNo;
(dword) a->xdi_adapter.serialNo;
a->xdi_mbox.status = DIVA_XDI_MBOX_BUSY;
ret = 0;
}
@ -432,7 +432,7 @@ diva_bri_cmd_card_proc(struct _diva_os_xdi_adapter *a,
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);
diva_os_malloc(0, a->xdi_mbox.data_length);
if (a->xdi_mbox.data) {
int i;
dword *data = (dword *) a->xdi_mbox.data;
@ -449,7 +449,7 @@ diva_bri_cmd_card_proc(struct _diva_os_xdi_adapter *a,
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);
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) {
@ -474,7 +474,7 @@ diva_bri_cmd_card_proc(struct _diva_os_xdi_adapter *a,
ret = diva_bri_write_sdram_block(&a->xdi_adapter,
cmd->command_data.
write_sdram.offset,
(byte *) & cmd[1],
(byte *)&cmd[1],
cmd->command_data.
write_sdram.length);
break;
@ -489,9 +489,9 @@ diva_bri_cmd_card_proc(struct _diva_os_xdi_adapter *a,
case DIVA_XDI_UM_CMD_SET_PROTOCOL_FEATURES:
a->xdi_adapter.features =
cmd->command_data.features.features;
cmd->command_data.features.features;
a->xdi_adapter.a.protocol_capabilities =
a->xdi_adapter.features;
a->xdi_adapter.features;
DBG_TRC(
("Set raw protocol features (%08x)",
a->xdi_adapter.features)) ret = 0;
@ -530,18 +530,18 @@ static int diva_bri_reset_adapter(PISDN_ADAPTER IoAdapter)
diva_os_wait(100);
Port = DIVA_OS_MEM_ATTACH_PORT(IoAdapter);
addrHi = Port +
((IoAdapter->Properties.Bus == BUS_PCI) ? M_PCI_ADDRH : ADDRH);
((IoAdapter->Properties.Bus == BUS_PCI) ? M_PCI_ADDRH : ADDRH);
addrLo = Port + ADDR;
ioaddr = Port + DATA;
/*
recover
*/
recover
*/
outpp(addrHi, (byte) 0);
outppw(addrLo, (word) 0);
outppw(ioaddr, (word) 0);
/*
clear shared memory
*/
clear shared memory
*/
outpp(addrHi,
(byte) (
(IoAdapter->MemoryBase + IoAdapter->MemorySize -
@ -551,8 +551,8 @@ static int diva_bri_reset_adapter(PISDN_ADAPTER IoAdapter)
diva_os_wait(100);
/*
clear signature
*/
clear signature
*/
outpp(addrHi,
(byte) (
(IoAdapter->MemoryBase + IoAdapter->MemorySize -
@ -568,8 +568,8 @@ static int diva_bri_reset_adapter(PISDN_ADAPTER IoAdapter)
DIVA_OS_MEM_DETACH_PORT(IoAdapter, Port);
/*
Forget all outstanding entities
*/
Forget all outstanding entities
*/
IoAdapter->e_count = 0;
if (IoAdapter->e_tbl) {
memset(IoAdapter->e_tbl, 0x00,
@ -602,7 +602,7 @@ 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)
dword address, const byte *data, dword length)
{
byte __iomem *addrHi, *addrLo, *ioaddr;
byte __iomem *Port;
@ -613,7 +613,7 @@ diva_bri_write_sdram_block(PISDN_ADAPTER IoAdapter,
Port = DIVA_OS_MEM_ATTACH_PORT(IoAdapter);
addrHi = Port +
((IoAdapter->Properties.Bus == BUS_PCI) ? M_PCI_ADDRH : ADDRH);
((IoAdapter->Properties.Bus == BUS_PCI) ? M_PCI_ADDRH : ADDRH);
addrLo = Port + ADDR;
ioaddr = Port + DATA;
@ -651,9 +651,9 @@ diva_bri_start_adapter(PISDN_ADAPTER IoAdapter,
sprintf(IoAdapter->Name, "A(%d)", (int) IoAdapter->ANum);
DBG_LOG(("A(%d) start BRI", IoAdapter->ANum))
Port = DIVA_OS_MEM_ATTACH_PORT(IoAdapter);
Port = DIVA_OS_MEM_ATTACH_PORT(IoAdapter);
addrHi = Port +
((IoAdapter->Properties.Bus == BUS_PCI) ? M_PCI_ADDRH : ADDRH);
((IoAdapter->Properties.Bus == BUS_PCI) ? M_PCI_ADDRH : ADDRH);
addrLo = Port + ADDR;
ioaddr = Port + DATA;
@ -666,20 +666,20 @@ diva_bri_start_adapter(PISDN_ADAPTER IoAdapter,
DIVA_OS_MEM_DETACH_PORT(IoAdapter, Port);
/*
start the protocol code
*/
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);
((IoAdapter->Properties.Bus == BUS_PCI) ? M_PCI_ADDRH : ADDRH);
addrLo = Port + ADDR;
ioaddr = Port + DATA;
/*
wait for signature (max. 3 seconds)
*/
wait for signature (max. 3 seconds)
*/
for (i = 0; i < 300; ++i) {
diva_os_wait(10);
outpp(addrHi,
@ -693,7 +693,7 @@ diva_bri_start_adapter(PISDN_ADAPTER IoAdapter,
DBG_LOG(
("Protocol startup time %d.%02d seconds",
(i / 100), (i % 100)))
started = 1;
started = 1;
break;
}
}
@ -703,15 +703,15 @@ diva_bri_start_adapter(PISDN_ADAPTER IoAdapter,
DBG_FTL(("A: A(%d) %s: Adapter selftest failed 0x%04X",
IoAdapter->ANum, IoAdapter->Properties.Name,
test))
(*(IoAdapter->trapFnc)) (IoAdapter);
(*(IoAdapter->trapFnc)) (IoAdapter);
return (-1);
}
IoAdapter->Initialized = 1;
/*
Check Interrupt
*/
Check Interrupt
*/
IoAdapter->IrqCount = 0;
a->ReadyInt = 1;
@ -729,7 +729,7 @@ diva_bri_start_adapter(PISDN_ADAPTER IoAdapter,
DBG_ERR(
("A: A(%d) interrupt test failed",
IoAdapter->ANum))
IoAdapter->Initialized = 0;
IoAdapter->Initialized = 0;
IoAdapter->stop(IoAdapter);
return (-1);
}
@ -737,21 +737,21 @@ diva_bri_start_adapter(PISDN_ADAPTER IoAdapter,
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);
/*
Register with DIDD
*/
diva_xdi_didd_register_adapter(IoAdapter->ANum);
return (0);
}
static void diva_bri_clear_interrupts(diva_os_xdi_adapter_t * a)
static void diva_bri_clear_interrupts(diva_os_xdi_adapter_t *a)
{
PISDN_ADAPTER IoAdapter = &a->xdi_adapter;
/*
clear any pending interrupt
*/
clear any pending interrupt
*/
IoAdapter->disIrq(IoAdapter);
IoAdapter->tst_irq(&IoAdapter->a);
@ -759,8 +759,8 @@ static void diva_bri_clear_interrupts(diva_os_xdi_adapter_t * a)
IoAdapter->tst_irq(&IoAdapter->a);
/*
kill pending dpcs
*/
kill pending dpcs
*/
diva_os_cancel_soft_isr(&IoAdapter->req_soft_isr);
diva_os_cancel_soft_isr(&IoAdapter->isr_soft_isr);
}
@ -768,7 +768,7 @@ static void diva_bri_clear_interrupts(diva_os_xdi_adapter_t * a)
/*
** Stop card
*/
static int diva_bri_stop_adapter(diva_os_xdi_adapter_t * a)
static int diva_bri_stop_adapter(diva_os_xdi_adapter_t *a)
{
PISDN_ADAPTER IoAdapter = &a->xdi_adapter;
int i = 100;
@ -779,18 +779,18 @@ static int diva_bri_stop_adapter(diva_os_xdi_adapter_t * a)
if (!IoAdapter->Initialized) {
DBG_ERR(("A: A(%d) can't stop BRI adapter - not running",
IoAdapter->ANum))
return (-1); /* nothing to stop */
return (-1); /* nothing to stop */
}
IoAdapter->Initialized = 0;
/*
Disconnect Adapter from DIDD
*/
Disconnect Adapter from DIDD
*/
diva_xdi_didd_remove_adapter(IoAdapter->ANum);
/*
Stop interrupts
*/
Stop interrupts
*/
a->clear_interrupts_proc = diva_bri_clear_interrupts;
IoAdapter->a.ReadyInt = 1;
IoAdapter->a.ram_inc(&IoAdapter->a, &PR_RAM->ReadyInt);
@ -802,12 +802,12 @@ static int diva_bri_stop_adapter(diva_os_xdi_adapter_t * 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
*/
Stop and reset adapter
*/
IoAdapter->stop(IoAdapter);
return (0);

View File

@ -3,6 +3,6 @@
#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);
int diva_bri_init_card(diva_os_xdi_adapter_t *a);
#endif

View File

@ -1,16 +1,16 @@
/* $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)
* 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__
#ifndef __OS_CAPI_H__
#define __OS_CAPI_H__
#include <linux/capi.h>

Some files were not shown because too many files have changed in this diff Show More