1 /***************************************************************************** 2 * sdladrv.h SDLA Support Module. Kernel API Definitions. 3 * 4 * Author: Gideon Hack 5 * 6 * Copyright: (c) 1995-2000 Sangoma Technologies Inc. 7 * 8 * This program is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU General Public License 10 * as published by the Free Software Foundation; either version 11 * 2 of the License, or (at your option) any later version. 12 * ============================================================================ 13 * Jun 02, 1999 Gideon Hack Added support for the S514 PCI adapter. 14 * Dec 11, 1996 Gene Kozin Complete overhaul. 15 * Oct 17, 1996 Gene Kozin Minor bug fixes. 16 * Jun 12, 1996 Gene Kozin Added support for S503 card. 17 * Dec 06, 1995 Gene Kozin Initial version. 18 *****************************************************************************/ 19 #ifndef _SDLADRV_H 20 #define _SDLADRV_H 21 22 #include <linux/version.h> 23 24 #ifndef KERNEL_VERSION 25 #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) 26 #endif 27 28 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0) 29 #define LINUX_2_4 30 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) 31 #define LINUX_2_1 32 #else 33 #define LINUX_2_0 34 #endif 35 36 #define SDLA_MAXIORANGE 4 /* maximum I/O port range */ 37 #define SDLA_WINDOWSIZE 0x2000 /* default dual-port memory window size */ 38 /****** Data Structures *****************************************************/ 39 40 /*---------------------------------------------------------------------------- 41 * Adapter hardware configuration. Pointer to this structure is passed to all 42 * APIs. 43 */ 44 typedef struct sdlahw 45 { 46 unsigned type; /* adapter type */ 47 unsigned fwid; /* firmware ID */ 48 unsigned port; /* adapter I/O port base */ 49 int irq; /* interrupt request level */ 50 char S514_cpu_no[1]; /* PCI CPU Number */ 51 unsigned char S514_slot_no; /* PCI Slot Number */ 52 char auto_pci_cfg; /* Autodetect PCI Slot */ 53 #if defined(LINUX_2_1) || defined(LINUX_2_4) 54 struct pci_dev *pci_dev; /* PCI device */ 55 #else 56 unsigned char pci_bus; /* PCI bus number */ 57 unsigned char pci_dev_func; /* PCI device/function number */ 58 #endif 59 void * dpmbase; /* dual-port memory base */ 60 unsigned dpmsize; /* dual-port memory size */ 61 unsigned pclk; /* CPU clock rate, kHz */ 62 unsigned long memory; /* memory size */ 63 unsigned long vector; /* local offset of the DPM window */ 64 unsigned io_range; /* I/O port range */ 65 unsigned char regs[SDLA_MAXIORANGE]; /* was written to registers */ 66 unsigned reserved[5]; 67 } sdlahw_t; 68 69 /****** Function Prototypes *************************************************/ 70 71 extern int sdla_setup (sdlahw_t* hw, void* sfm, unsigned len); 72 extern int sdla_down (sdlahw_t* hw); 73 extern int sdla_inten (sdlahw_t* hw); 74 extern int sdla_intde (sdlahw_t* hw); 75 extern int sdla_intack (sdlahw_t* hw); 76 extern void S514_intack (sdlahw_t* hw, u32 int_status); 77 extern void read_S514_int_stat (sdlahw_t* hw, u32* int_status); 78 extern int sdla_intr (sdlahw_t* hw); 79 extern int sdla_mapmem (sdlahw_t* hw, unsigned long addr); 80 extern int sdla_peek (sdlahw_t* hw, unsigned long addr, void* buf, 81 unsigned len); 82 extern int sdla_poke (sdlahw_t* hw, unsigned long addr, void* buf, 83 unsigned len); 84 extern int sdla_exec (void* opflag); 85 86 extern unsigned wanpipe_hw_probe(void); 87 88 #endif /* _SDLADRV_H */ 89