blob: 717003a3bdf4957835f43eab78eff4f8abc62f5e [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* $Id: event.c,v 1.4.8.1 2001/09/23 22:24:59 kai Exp $
2 *
3 * Copyright (C) 1996 SpellCaster Telecommunications Inc.
4 *
5 * This software may be used and distributed according to the terms
6 * of the GNU General Public License, incorporated herein by reference.
7 *
8 * For more information, please contact gpl-info@spellcast.com or write:
9 *
10 * SpellCaster Telecommunications Inc.
11 * 5621 Finch Avenue East, Unit #3
12 * Scarborough, Ontario Canada
13 * M1B 2T9
14 * +1 (416) 297-8565
15 * +1 (416) 297-6433 Facsimile
16 */
17
18#include "includes.h"
19#include "hardware.h"
20#include "message.h"
21#include "card.h"
22
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#ifdef DEBUG
24static char *events[] = { "ISDN_STAT_STAVAIL",
25 "ISDN_STAT_ICALL",
26 "ISDN_STAT_RUN",
27 "ISDN_STAT_STOP",
28 "ISDN_STAT_DCONN",
29 "ISDN_STAT_BCONN",
30 "ISDN_STAT_DHUP",
31 "ISDN_STAT_BHUP",
32 "ISDN_STAT_CINF",
33 "ISDN_STAT_LOAD",
34 "ISDN_STAT_UNLOAD",
35 "ISDN_STAT_BSENT",
36 "ISDN_STAT_NODCH",
37 "ISDN_STAT_ADDCH",
38 "ISDN_STAT_CAUSE" };
39#endif
40
Joe Perches475be4d2012-02-19 19:52:38 -080041int indicate_status(int card, int event, ulong Channel, char *Data)
Linus Torvalds1da177e2005-04-16 15:20:36 -070042{
43 isdn_ctrl cmd;
44
Andrew Morton3879b6b2006-10-03 01:16:15 -070045#ifdef DEBUG
Linus Torvalds1da177e2005-04-16 15:20:36 -070046 pr_debug("%s: Indicating event %s on Channel %d\n",
Joe Perches475be4d2012-02-19 19:52:38 -080047 sc_adapter[card]->devicename, events[event - 256], Channel);
Andrew Morton3879b6b2006-10-03 01:16:15 -070048#endif
Joe Perches475be4d2012-02-19 19:52:38 -080049 if (Data != NULL) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070050 pr_debug("%s: Event data: %s\n", sc_adapter[card]->devicename,
Joe Perches475be4d2012-02-19 19:52:38 -080051 Data);
Linus Torvalds1da177e2005-04-16 15:20:36 -070052 switch (event) {
Joe Perches475be4d2012-02-19 19:52:38 -080053 case ISDN_STAT_BSENT:
54 memcpy(&cmd.parm.length, Data, sizeof(cmd.parm.length));
55 break;
56 case ISDN_STAT_ICALL:
57 memcpy(&cmd.parm.setup, Data, sizeof(cmd.parm.setup));
58 break;
59 default:
60 strcpy(cmd.parm.num, Data);
Linus Torvalds1da177e2005-04-16 15:20:36 -070061 }
62 }
63
64 cmd.command = event;
65 cmd.driver = sc_adapter[card]->driverId;
66 cmd.arg = Channel;
67 return sc_adapter[card]->card->statcallb(&cmd);
68}