io.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. /*
  2. *
  3. Copyright (c) Eicon Networks, 2002.
  4. *
  5. This source file is supplied for the use with
  6. Eicon Networks range of DIVA Server Adapters.
  7. *
  8. Eicon File Revision : 2.1
  9. *
  10. This program is free software; you can redistribute it and/or modify
  11. it under the terms of the GNU General Public License as published by
  12. the Free Software Foundation; either version 2, or (at your option)
  13. any later version.
  14. *
  15. This program is distributed in the hope that it will be useful,
  16. but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
  17. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  18. See the GNU General Public License for more details.
  19. *
  20. You should have received a copy of the GNU General Public License
  21. along with this program; if not, write to the Free Software
  22. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  23. *
  24. */
  25. #ifndef __DIVA_XDI_COMMON_IO_H_INC__ /* { */
  26. #define __DIVA_XDI_COMMON_IO_H_INC__
  27. /*
  28. maximum = 16 adapters
  29. */
  30. #define DI_MAX_LINKS MAX_ADAPTER
  31. #define ISDN_MAX_NUM_LEN 60
  32. /* --------------------------------------------------------------------------
  33. structure for quadro card management (obsolete for
  34. systems that do provide per card load event)
  35. -------------------------------------------------------------------------- */
  36. typedef struct {
  37. dword Num;
  38. DEVICE_NAME DeviceName[4];
  39. PISDN_ADAPTER QuadroAdapter[4];
  40. } ADAPTER_LIST_ENTRY, *PADAPTER_LIST_ENTRY;
  41. /* --------------------------------------------------------------------------
  42. Special OS memory support structures
  43. -------------------------------------------------------------------------- */
  44. #define MAX_MAPPED_ENTRIES 8
  45. typedef struct {
  46. void *Address;
  47. dword Length;
  48. } ADAPTER_MEMORY;
  49. /* --------------------------------------------------------------------------
  50. Configuration of XDI clients carried by XDI
  51. -------------------------------------------------------------------------- */
  52. #define DIVA_XDI_CAPI_CFG_1_DYNAMIC_L1_ON 0x01
  53. #define DIVA_XDI_CAPI_CFG_1_GROUP_POPTIMIZATION_ON 0x02
  54. typedef struct _diva_xdi_capi_cfg {
  55. byte cfg_1;
  56. } diva_xdi_capi_cfg_t;
  57. /* --------------------------------------------------------------------------
  58. Main data structure kept per adapter
  59. -------------------------------------------------------------------------- */
  60. struct _ISDN_ADAPTER {
  61. void (*DIRequest)(PISDN_ADAPTER, ENTITY *);
  62. int State; /* from NT4 1.srv, a good idea, but a poor achievement */
  63. int Initialized;
  64. int RegisteredWithDidd;
  65. int Unavailable; /* callback function possible? */
  66. int ResourcesClaimed;
  67. int PnpBiosConfigUsed;
  68. dword Logging;
  69. dword features;
  70. char ProtocolIdString[80];
  71. /*
  72. remember mapped memory areas
  73. */
  74. ADAPTER_MEMORY MappedMemory[MAX_MAPPED_ENTRIES];
  75. CARD_PROPERTIES Properties;
  76. dword cardType;
  77. dword protocol_id; /* configured protocol identifier */
  78. char protocol_name[8]; /* readable name of protocol */
  79. dword BusType;
  80. dword BusNumber;
  81. dword slotNumber;
  82. dword slotId;
  83. dword ControllerNumber; /* for QUADRO cards only */
  84. PISDN_ADAPTER MultiMaster; /* for 4-BRI card only - use MultiMaster or QuadroList */
  85. PADAPTER_LIST_ENTRY QuadroList; /* for QUADRO card only */
  86. PDEVICE_OBJECT DeviceObject;
  87. dword DeviceId;
  88. diva_os_adapter_irq_info_t irq_info;
  89. dword volatile IrqCount;
  90. int trapped;
  91. dword DspCodeBaseAddr;
  92. dword MaxDspCodeSize;
  93. dword downloadAddr;
  94. dword DspCodeBaseAddrTable[4]; /* add. for MultiMaster */
  95. dword MaxDspCodeSizeTable[4]; /* add. for MultiMaster */
  96. dword downloadAddrTable[4]; /* add. for MultiMaster */
  97. dword MemoryBase;
  98. dword MemorySize;
  99. byte __iomem *Address;
  100. byte __iomem *Config;
  101. byte __iomem *Control;
  102. byte __iomem *reset;
  103. byte __iomem *port;
  104. byte __iomem *ram;
  105. byte __iomem *cfg;
  106. byte __iomem *prom;
  107. byte __iomem *ctlReg;
  108. struct pc_maint *pcm;
  109. diva_os_dependent_devica_name_t os_name;
  110. byte Name[32];
  111. dword serialNo;
  112. dword ANum;
  113. dword ArchiveType; /* ARCHIVE_TYPE_NONE ..._SINGLE ..._USGEN ..._MULTI */
  114. char *ProtocolSuffix; /* internal protocolfile table */
  115. char Archive[32];
  116. char Protocol[32];
  117. char AddDownload[32]; /* Dsp- or other additional download files */
  118. char Oad1[ISDN_MAX_NUM_LEN];
  119. char Osa1[ISDN_MAX_NUM_LEN];
  120. char Oad2[ISDN_MAX_NUM_LEN];
  121. char Osa2[ISDN_MAX_NUM_LEN];
  122. char Spid1[ISDN_MAX_NUM_LEN];
  123. char Spid2[ISDN_MAX_NUM_LEN];
  124. byte nosig;
  125. byte BriLayer2LinkCount; /* amount of TEI's that adapter will support in P2MP mode */
  126. dword Channels;
  127. dword tei;
  128. dword nt2;
  129. dword TerminalCount;
  130. dword WatchDog;
  131. dword Permanent;
  132. dword BChMask; /* B channel mask for unchannelized modes */
  133. dword StableL2;
  134. dword DidLen;
  135. dword NoOrderCheck;
  136. dword ForceLaw; /* VoiceCoding - default:0, a-law: 1, my-law: 2 */
  137. dword SigFlags;
  138. dword LowChannel;
  139. dword NoHscx30;
  140. dword ProtVersion;
  141. dword crc4;
  142. dword L1TristateOrQsig; /* enable Layer 1 Tristate (bit 2)Or Qsig params (bit 0,1)*/
  143. dword InitialDspInfo;
  144. dword ModemGuardTone;
  145. dword ModemMinSpeed;
  146. dword ModemMaxSpeed;
  147. dword ModemOptions;
  148. dword ModemOptions2;
  149. dword ModemNegotiationMode;
  150. dword ModemModulationsMask;
  151. dword ModemTransmitLevel;
  152. dword FaxOptions;
  153. dword FaxMaxSpeed;
  154. dword Part68LevelLimiter;
  155. dword UsEktsNumCallApp;
  156. byte UsEktsFeatAddConf;
  157. byte UsEktsFeatRemoveConf;
  158. byte UsEktsFeatCallTransfer;
  159. byte UsEktsFeatMsgWaiting;
  160. byte QsigDialect;
  161. byte ForceVoiceMailAlert;
  162. byte DisableAutoSpid;
  163. byte ModemCarrierWaitTimeSec;
  164. byte ModemCarrierLossWaitTimeTenthSec;
  165. byte PiafsLinkTurnaroundInFrames;
  166. byte DiscAfterProgress;
  167. byte AniDniLimiter[3];
  168. byte TxAttenuation; /* PRI/E1 only: attenuate TX signal */
  169. word QsigFeatures;
  170. dword GenerateRingtone;
  171. dword SupplementaryServicesFeatures;
  172. dword R2Dialect;
  173. dword R2CasOptions;
  174. dword FaxV34Options;
  175. dword DisabledDspMask;
  176. dword AdapterTestMask;
  177. dword DspImageLength;
  178. word AlertToIn20mSecTicks;
  179. word ModemEyeSetup;
  180. byte R2CtryLength;
  181. byte CCBSRelTimer;
  182. byte *PcCfgBufferFile;/* flexible parameter via file */
  183. byte *PcCfgBuffer; /* flexible parameter via multistring */
  184. diva_os_dump_file_t dump_file; /* dump memory to file at lowest irq level */
  185. diva_os_board_trace_t board_trace; /* traces from the board */
  186. diva_os_spin_lock_t isr_spin_lock;
  187. diva_os_spin_lock_t data_spin_lock;
  188. diva_os_soft_isr_t req_soft_isr;
  189. diva_os_soft_isr_t isr_soft_isr;
  190. diva_os_atomic_t in_dpc;
  191. PBUFFER RBuffer; /* Copy of receive lookahead buffer */
  192. word e_max;
  193. word e_count;
  194. E_INFO *e_tbl;
  195. word assign; /* list of pending ASSIGNs */
  196. word head; /* head of request queue */
  197. word tail; /* tail of request queue */
  198. ADAPTER a; /* not a separate structure */
  199. void (*out)(ADAPTER *a);
  200. byte (*dpc)(ADAPTER *a);
  201. byte (*tst_irq)(ADAPTER *a);
  202. void (*clr_irq)(ADAPTER *a);
  203. int (*load)(PISDN_ADAPTER);
  204. int (*mapmem)(PISDN_ADAPTER);
  205. int (*chkIrq)(PISDN_ADAPTER);
  206. void (*disIrq)(PISDN_ADAPTER);
  207. void (*start)(PISDN_ADAPTER);
  208. void (*stop)(PISDN_ADAPTER);
  209. void (*rstFnc)(PISDN_ADAPTER);
  210. void (*trapFnc)(PISDN_ADAPTER);
  211. dword (*DetectDsps)(PISDN_ADAPTER);
  212. void (*os_trap_nfy_Fnc)(PISDN_ADAPTER, dword);
  213. diva_os_isr_callback_t diva_isr_handler;
  214. dword sdram_bar; /* must be 32 bit */
  215. dword fpga_features;
  216. volatile int pcm_pending;
  217. volatile void *pcm_data;
  218. diva_xdi_capi_cfg_t capi_cfg;
  219. dword tasks;
  220. void *dma_map;
  221. int (*DivaAdapterTestProc)(PISDN_ADAPTER);
  222. void *AdapterTestMemoryStart;
  223. dword AdapterTestMemoryLength;
  224. const byte *cfg_lib_memory_init;
  225. dword cfg_lib_memory_init_length;
  226. };
  227. /* ---------------------------------------------------------------------
  228. Entity table
  229. --------------------------------------------------------------------- */
  230. struct e_info_s {
  231. ENTITY *e;
  232. byte next; /* chaining index */
  233. word assign_ref; /* assign reference */
  234. };
  235. /* ---------------------------------------------------------------------
  236. S-cards shared ram structure for loading
  237. --------------------------------------------------------------------- */
  238. struct s_load {
  239. byte ctrl;
  240. byte card;
  241. byte msize;
  242. byte fill0;
  243. word ebit;
  244. word elocl;
  245. word eloch;
  246. byte reserved[20];
  247. word signature;
  248. byte fill[224];
  249. byte b[256];
  250. };
  251. #define PR_RAM ((struct pr_ram *)0)
  252. #define RAM ((struct dual *)0)
  253. /* ---------------------------------------------------------------------
  254. platform specific conversions
  255. --------------------------------------------------------------------- */
  256. extern void *PTR_P(ADAPTER *a, ENTITY *e, void *P);
  257. extern void *PTR_X(ADAPTER *a, ENTITY *e);
  258. extern void *PTR_R(ADAPTER *a, ENTITY *e);
  259. extern void CALLBACK(ADAPTER *a, ENTITY *e);
  260. extern void set_ram(void **adr_ptr);
  261. /* ---------------------------------------------------------------------
  262. ram access functions for io mapped cards
  263. --------------------------------------------------------------------- */
  264. byte io_in(ADAPTER *a, void *adr);
  265. word io_inw(ADAPTER *a, void *adr);
  266. void io_in_buffer(ADAPTER *a, void *adr, void *P, word length);
  267. void io_look_ahead(ADAPTER *a, PBUFFER *RBuffer, ENTITY *e);
  268. void io_out(ADAPTER *a, void *adr, byte data);
  269. void io_outw(ADAPTER *a, void *adr, word data);
  270. void io_out_buffer(ADAPTER *a, void *adr, void *P, word length);
  271. void io_inc(ADAPTER *a, void *adr);
  272. void bri_in_buffer(PISDN_ADAPTER IoAdapter, dword Pos,
  273. void *Buf, dword Len);
  274. int bri_out_buffer(PISDN_ADAPTER IoAdapter, dword Pos,
  275. void *Buf, dword Len, int Verify);
  276. /* ---------------------------------------------------------------------
  277. ram access functions for memory mapped cards
  278. --------------------------------------------------------------------- */
  279. byte mem_in(ADAPTER *a, void *adr);
  280. word mem_inw(ADAPTER *a, void *adr);
  281. void mem_in_buffer(ADAPTER *a, void *adr, void *P, word length);
  282. void mem_look_ahead(ADAPTER *a, PBUFFER *RBuffer, ENTITY *e);
  283. void mem_out(ADAPTER *a, void *adr, byte data);
  284. void mem_outw(ADAPTER *a, void *adr, word data);
  285. void mem_out_buffer(ADAPTER *a, void *adr, void *P, word length);
  286. void mem_inc(ADAPTER *a, void *adr);
  287. void mem_in_dw(ADAPTER *a, void *addr, dword *data, int dwords);
  288. void mem_out_dw(ADAPTER *a, void *addr, const dword *data, int dwords);
  289. /* ---------------------------------------------------------------------
  290. functions exported by io.c
  291. --------------------------------------------------------------------- */
  292. extern IDI_CALL Requests[MAX_ADAPTER];
  293. extern void DIDpcRoutine(struct _diva_os_soft_isr *psoft_isr,
  294. void *context);
  295. extern void request(PISDN_ADAPTER, ENTITY *);
  296. /* ---------------------------------------------------------------------
  297. trapFn helpers, used to recover debug trace from dead card
  298. --------------------------------------------------------------------- */
  299. typedef struct {
  300. word *buf;
  301. word cnt;
  302. word out;
  303. } Xdesc;
  304. extern void dump_trap_frame(PISDN_ADAPTER IoAdapter, byte __iomem *exception);
  305. extern void dump_xlog_buffer(PISDN_ADAPTER IoAdapter, Xdesc *xlogDesc);
  306. /* --------------------------------------------------------------------- */
  307. #endif /* } __DIVA_XDI_COMMON_IO_H_INC__ */