root/drivers/isdn/teles/mod.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. teles_mod_dec_use_count
  2. teles_mod_inc_use_count
  3. teles_setup
  4. teles_init
  5. cleanup_module

   1 #include "teles.h"
   2 
   3 
   4 
   5 extern struct IsdnCard cards[];
   6 extern char   *teles_id;
   7 
   8 int             nrcards;
   9 
  10 typedef struct {
  11         byte           *membase;
  12         int             interrupt;
  13         unsigned int    iobase;
  14         unsigned int    protocol;
  15 } io_type;
  16 
  17 io_type         io[] =
  18 {
  19         {0, 0, 0, 0},
  20         {0, 0, 0, 0},
  21         {0, 0, 0, 0},
  22         {0, 0, 0, 0},
  23         {0, 0, 0, 0},
  24         {0, 0, 0, 0},
  25         {0, 0, 0, 0},
  26         {0, 0, 0, 0},
  27         {0, 0, 0, 0},
  28         {0, 0, 0, 0},
  29         {0, 0, 0, 0},
  30         {0, 0, 0, 0},
  31         {0, 0, 0, 0},
  32         {0, 0, 0, 0},
  33         {0, 0, 0, 0},
  34         {0, 0, 0, 0},
  35 };
  36 
  37 void
  38 teles_mod_dec_use_count(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  39 {
  40         MOD_DEC_USE_COUNT;
  41 }
  42 
  43 void
  44 teles_mod_inc_use_count(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  45 {
  46         MOD_INC_USE_COUNT;
  47 }
  48 
  49 #ifdef MODULE
  50 #define teles_init init_module
  51 #else
  52 void teles_setup(char *str, int *ints)
     /* [previous][next][first][last][top][bottom][index][help] */
  53 {
  54         int  i, j, argc;
  55         static char sid[20];
  56 
  57         argc = ints[0];
  58         i = 0;
  59         j = 1;
  60         while (argc && (i<16)) {
  61                 if (argc) {
  62                         io[i].iobase    = ints[j];
  63                         j++; argc--;
  64                 }
  65                 if (argc) {
  66                         io[i].interrupt = ints[j];
  67                         j++; argc--;
  68                 }
  69                 if (argc) {
  70                         io[i].membase   = (byte *)ints[j];
  71                         j++; argc--;
  72                 }
  73                 if (argc) {
  74                         io[i].protocol  = ints[j];
  75                         j++; argc--;
  76                 }
  77                 i++;
  78         }
  79         if (strlen(str)) {
  80                 strcpy(sid,str);
  81                 teles_id = sid;
  82         }
  83 }
  84 #endif
  85 
  86 int
  87 teles_init(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  88 {
  89         int             i;
  90 
  91         nrcards = 0;
  92         for (i = 0; i < 16; i++) {
  93                 if (io[i].protocol) {
  94                         cards[i].membase   = io[i].membase;
  95                         cards[i].interrupt = io[i].interrupt;
  96                         cards[i].iobase    = io[i].iobase;
  97                         cards[i].protocol  = io[i].protocol;
  98                 }
  99         }
 100         for (i = 0; i < 16; i++)
 101                 if (cards[i].protocol)
 102                         nrcards++;
 103         printk(KERN_DEBUG "teles: Total %d card%s defined\n",
 104                nrcards, (nrcards > 1) ? "s" : "");
 105         if (teles_inithardware()) {
 106                 /* Install only, if at least one card found */
 107                 Isdnl2New();
 108                 TeiNew();
 109                 CallcNew();
 110                 ll_init();
 111 
 112                 /* No symbols to export, hide all symbols */
 113                 register_symtab(NULL);
 114 
 115 #ifdef MODULE
 116                 printk(KERN_NOTICE "Teles module installed\n");
 117 #endif
 118                 return (0);
 119         } else
 120                 return -EIO;
 121 }
 122 
 123 #ifdef MODULE
 124 void
 125 cleanup_module(void)
     /* [previous][next][first][last][top][bottom][index][help] */
 126 {
 127 
 128         ll_stop();
 129         TeiFree();
 130         Isdnl2Free();
 131         CallcFree();
 132         teles_closehardware();
 133         ll_unload();
 134         printk(KERN_NOTICE "Teles module removed\n");
 135 
 136 }
 137 #endif

/* [previous][next][first][last][top][bottom][index][help] */