card.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /* $Id: card.h,v 1.1.10.1 2001/09/23 22:24:59 kai Exp $
  2. *
  3. * Driver parameters for SpellCaster ISA ISDN adapters
  4. *
  5. * Copyright (C) 1996 SpellCaster Telecommunications Inc.
  6. *
  7. * This software may be used and distributed according to the terms
  8. * of the GNU General Public License, incorporated herein by reference.
  9. *
  10. * For more information, please contact gpl-info@spellcast.com or write:
  11. *
  12. * SpellCaster Telecommunications Inc.
  13. * 5621 Finch Avenue East, Unit #3
  14. * Scarborough, Ontario Canada
  15. * M1B 2T9
  16. * +1 (416) 297-8565
  17. * +1 (416) 297-6433 Facsimile
  18. */
  19. #ifndef CARD_H
  20. #define CARD_H
  21. /*
  22. * We need these if they're not already included
  23. */
  24. #include <linux/timer.h>
  25. #include <linux/time.h>
  26. #include <linux/isdnif.h>
  27. #include <linux/irqreturn.h>
  28. #include "message.h"
  29. #include "scioc.h"
  30. /*
  31. * Amount of time to wait for a reset to complete
  32. */
  33. #define CHECKRESET_TIME msecs_to_jiffies(4000)
  34. /*
  35. * Amount of time between line status checks
  36. */
  37. #define CHECKSTAT_TIME msecs_to_jiffies(8000)
  38. /*
  39. * The maximum amount of time to wait for a message response
  40. * to arrive. Use exclusively by send_and_receive
  41. */
  42. #define SAR_TIMEOUT msecs_to_jiffies(10000)
  43. /*
  44. * Macro to determine is a card id is valid
  45. */
  46. #define IS_VALID_CARD(x) ((x >= 0) && (x <= cinst))
  47. /*
  48. * Per channel status and configuration
  49. */
  50. typedef struct {
  51. int l2_proto;
  52. int l3_proto;
  53. char dn[50];
  54. unsigned long first_sendbuf; /* Offset of first send buffer */
  55. unsigned int num_sendbufs; /* Number of send buffers */
  56. unsigned int free_sendbufs; /* Number of free sendbufs */
  57. unsigned int next_sendbuf; /* Next sequential buffer */
  58. char eazlist[50]; /* Set with SETEAZ */
  59. char sillist[50]; /* Set with SETSIL */
  60. int eazclear; /* Don't accept calls if TRUE */
  61. } bchan;
  62. /*
  63. * Everything you want to know about the adapter ...
  64. */
  65. typedef struct {
  66. int model;
  67. int driverId; /* LL Id */
  68. char devicename[20]; /* The device name */
  69. isdn_if *card; /* ISDN4Linux structure */
  70. bchan *channel; /* status of the B channels */
  71. char nChannels; /* Number of channels */
  72. unsigned int interrupt; /* Interrupt number */
  73. int iobase; /* I/O Base address */
  74. int ioport[MAX_IO_REGS]; /* Index to I/O ports */
  75. int shmem_pgport; /* port for the exp mem page reg. */
  76. int shmem_magic; /* adapter magic number */
  77. unsigned int rambase; /* Shared RAM base address */
  78. unsigned int ramsize; /* Size of shared memory */
  79. RspMessage async_msg; /* Async response message */
  80. int want_async_messages; /* Snoop the Q ? */
  81. unsigned char seq_no; /* Next send seq. number */
  82. struct timer_list reset_timer; /* Check reset timer */
  83. struct timer_list stat_timer; /* Check startproc timer */
  84. unsigned char nphystat; /* Latest PhyStat info */
  85. unsigned char phystat; /* Last PhyStat info */
  86. HWConfig_pl hwconfig; /* Hardware config info */
  87. char load_ver[11]; /* CommManage Version string */
  88. char proc_ver[11]; /* CommEngine Version */
  89. int StartOnReset; /* Indicates startproc after reset */
  90. int EngineUp; /* Indicates CommEngine Up */
  91. int trace_mode; /* Indicate if tracing is on */
  92. spinlock_t lock; /* local lock */
  93. } board;
  94. extern board *sc_adapter[];
  95. extern int cinst;
  96. void memcpy_toshmem(int card, void *dest, const void *src, size_t n);
  97. void memcpy_fromshmem(int card, void *dest, const void *src, size_t n);
  98. int get_card_from_id(int driver);
  99. int indicate_status(int card, int event, ulong Channel, char *Data);
  100. irqreturn_t interrupt_handler(int interrupt, void *cardptr);
  101. int sndpkt(int devId, int channel, int ack, struct sk_buff *data);
  102. void rcvpkt(int card, RspMessage *rcvmsg);
  103. int command(isdn_ctrl *cmd);
  104. int reset(int card);
  105. int startproc(int card);
  106. int send_and_receive(int card, unsigned int procid, unsigned char type,
  107. unsigned char class, unsigned char code,
  108. unsigned char link, unsigned char data_len,
  109. unsigned char *data, RspMessage *mesgdata, int timeout);
  110. void flushreadfifo(int card);
  111. int sendmessage(int card, unsigned int procid, unsigned int type,
  112. unsigned int class, unsigned int code, unsigned int link,
  113. unsigned int data_len, unsigned int *data);
  114. int receivemessage(int card, RspMessage *rspmsg);
  115. int sc_ioctl(int card, scs_ioctl *data);
  116. int setup_buffers(int card, int c);
  117. void sc_check_reset(unsigned long data);
  118. void check_phystat(unsigned long data);
  119. #endif /* CARD_H */