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