1 /* $Id: eicon_isa.h,v 1.1.4.1 2001/11/20 14:19:35 kai Exp $
2  *
3  * ISDN low-level module for Eicon active ISDN-Cards.
4  *
5  * Copyright 1998      by Fritz Elfert (fritz@isdn4linux.de)
6  * Copyright 1998-2000 by Armin Schindler (mac@melware.de)
7  * Copyright 1999,2000 Cytronics & Melware (info@melware.de)
8  *
9  * This software may be used and distributed according to the terms
10  * of the GNU General Public License, incorporated herein by reference.
11  *
12  */
13 
14 #ifndef eicon_isa_h
15 #define eicon_isa_h
16 
17 #ifdef __KERNEL__
18 #include <linux/config.h>
19 
20 /* Factory defaults for ISA-Cards */
21 #define EICON_ISA_MEMBASE 0xd0000
22 #define EICON_ISA_IRQ     3
23 /* shmem offset for Quadro parts */
24 #define EICON_ISA_QOFFSET 0x0800
25 
26 typedef struct {
27         __u16 length __attribute__ ((packed));   /* length of data/parameter field         */
28         __u8  P[270];                            /* data/parameter field                   */
29 } eicon_scom_PBUFFER;
30 
31 /* General communication buffer */
32 typedef struct {
33         __u8   Req;                                /* request register                       */
34 	__u8   ReqId;                              /* request task/entity identification     */
35 	__u8   Rc;                                 /* return code register                   */
36 	__u8   RcId;                               /* return code task/entity identification */
37 	__u8   Ind;                                /* Indication register                    */
38 	__u8   IndId;                              /* Indication task/entity identification  */
39 	__u8   IMask;                              /* Interrupt Mask Flag                    */
40 	__u8   RNR;                                /* Receiver Not Ready (set by PC)         */
41 	__u8   XLock;                              /* XBuffer locked Flag                    */
42 	__u8   Int;                                /* ISDN interrupt                         */
43 	__u8   ReqCh;                              /* Channel field for layer-3 Requests     */
44 	__u8   RcCh;                               /* Channel field for layer-3 Returncodes  */
45 	__u8   IndCh;                              /* Channel field for layer-3 Indications  */
46 	__u8   MInd;                               /* more data indication field             */
47 	__u16  MLength;                            /* more data total packet length          */
48 	__u8   ReadyInt;                           /* request field for ready interrupt      */
49 	__u8   Reserved[12];                       /* reserved space                         */
50 	__u8   IfType;                             /* 1 = 16k-Interface                      */
51 	__u16  Signature __attribute__ ((packed)); /* ISDN adapter Signature                 */
52 	eicon_scom_PBUFFER XBuffer;                /* Transmit Buffer                        */
53 	eicon_scom_PBUFFER RBuffer;                /* Receive Buffer                         */
54 } eicon_isa_com;
55 
56 /* struct for downloading firmware */
57 typedef struct {
58 	__u8  ctrl;
59 	__u8  card;
60 	__u8  msize;
61 	__u8  fill0;
62 	__u16 ebit __attribute__ ((packed));
63 	__u32 eloc __attribute__ ((packed));
64 	__u8  reserved[20];
65 	__u16 signature __attribute__ ((packed));
66 	__u8  fill[224];
67 	__u8  b[256];
68 } eicon_isa_boot;
69 
70 /* Shared memory */
71 typedef union {
72 	unsigned char  c[0x400];
73 	eicon_isa_com  com;
74 	eicon_isa_boot boot;
75 } eicon_isa_shmem;
76 
77 /*
78  * card's description
79  */
80 typedef struct {
81 	int               ramsize;
82 	int               irq;	    /* IRQ                        */
83 	unsigned long	  physmem;  /* physical memory address	  */
84 #ifdef CONFIG_MCA
85 	int		  io;	    /* IO-port for MCA brand      */
86 #endif /* CONFIG_MCA */
87 	void*             card;
88 	eicon_isa_shmem*  shmem;    /* Shared-memory area         */
89 	unsigned char*    intack;   /* Int-Acknowledge            */
90 	unsigned char*    stopcpu;  /* Writing here stops CPU     */
91 	unsigned char*    startcpu; /* Writing here starts CPU    */
92 	unsigned char     type;     /* card type                  */
93 	int		  channels; /* No. of channels		  */
94 	unsigned char     irqprobe; /* Flag: IRQ-probing          */
95 	unsigned char     mvalid;   /* Flag: Memory is valid      */
96 	unsigned char     ivalid;   /* Flag: IRQ is valid         */
97 	unsigned char     master;   /* Flag: Card ist Quadro 1/4  */
98 } eicon_isa_card;
99 
100 /* Offsets for special locations on standard cards */
101 #define INTACK     0x03fe
102 #define STOPCPU    0x0400
103 #define STARTCPU   0x0401
104 #define RAMSIZE    0x0400
105 /* Offsets for special location on PRI card */
106 #define INTACK_P   0x3ffc
107 #define STOPCPU_P  0x3ffe
108 #define STARTCPU_P 0x3fff
109 #define RAMSIZE_P  0x4000
110 
111 
112 extern int eicon_isa_load(eicon_isa_card *card, eicon_isa_codebuf *cb);
113 extern int eicon_isa_bootload(eicon_isa_card *card, eicon_isa_codebuf *cb);
114 extern void eicon_isa_release(eicon_isa_card *card);
115 extern void eicon_isa_printpar(eicon_isa_card *card);
116 extern void eicon_isa_transmit(eicon_isa_card *card);
117 extern int eicon_isa_find_card(int Mem, int Irq, char * Id);
118 
119 #endif  /* __KERNEL__ */
120 
121 #endif	/* eicon_isa_h */
122