1/* $Id: event.c,v 1.1.1.1 2008/10/15 03:26:34 james26_jang 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#define __NO_VERSION__ 19#include "includes.h" 20#include "hardware.h" 21#include "message.h" 22#include "card.h" 23 24extern int cinst; 25extern board *adapter[]; 26 27#ifdef DEBUG 28static char *events[] = { "ISDN_STAT_STAVAIL", 29 "ISDN_STAT_ICALL", 30 "ISDN_STAT_RUN", 31 "ISDN_STAT_STOP", 32 "ISDN_STAT_DCONN", 33 "ISDN_STAT_BCONN", 34 "ISDN_STAT_DHUP", 35 "ISDN_STAT_BHUP", 36 "ISDN_STAT_CINF", 37 "ISDN_STAT_LOAD", 38 "ISDN_STAT_UNLOAD", 39 "ISDN_STAT_BSENT", 40 "ISDN_STAT_NODCH", 41 "ISDN_STAT_ADDCH", 42 "ISDN_STAT_CAUSE" }; 43#endif 44 45int indicate_status(int card, int event,ulong Channel,char *Data) 46{ 47 isdn_ctrl cmd; 48 49 pr_debug("%s: Indicating event %s on Channel %d\n", 50 adapter[card]->devicename, events[event-256], Channel); 51 if (Data != NULL){ 52 pr_debug("%s: Event data: %s\n", adapter[card]->devicename, 53 Data); 54 switch (event) { 55 case ISDN_STAT_BSENT: 56 memcpy(&cmd.parm.length, Data, sizeof(cmd.parm.length)); 57 break; 58 case ISDN_STAT_ICALL: 59 memcpy(&cmd.parm.setup, Data, sizeof(cmd.parm.setup)); 60 break; 61 default: 62 strcpy(cmd.parm.num, Data); 63 } 64 } 65 66 cmd.command = event; 67 cmd.driver = adapter[card]->driverId; 68 cmd.arg = Channel; 69 return adapter[card]->card->statcallb(&cmd); 70} 71