Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[wrt350n-kernel.git] / drivers / isdn / hysdn / ince1pc.h
blob7a36694df6d7082ddb254a3a68f5c0f7969a7357
1 /*
2 * Linux driver for HYSDN cards
3 * common definitions for both sides of the bus:
4 * - conventions both spoolers must know
5 * - channel numbers agreed upon
7 * Author M. Steinkopf
8 * Copyright 1999 by M. Steinkopf
10 * This software may be used and distributed according to the terms
11 * of the GNU General Public License, incorporated herein by reference.
15 #ifndef __INCE1PC_H__
16 #define __INCE1PC_H__
18 /* basic scalar definitions have same meanning,
19 * but their declaration location depends on environment
20 */
22 /*--------------------------------------channel numbers---------------------*/
23 #define CHAN_SYSTEM 0x0001 /* system channel (spooler to spooler) */
24 #define CHAN_ERRLOG 0x0005 /* error logger */
25 #define CHAN_CAPI 0x0064 /* CAPI interface */
26 #define CHAN_NDIS_DATA 0x1001 /* NDIS data transfer */
28 /*--------------------------------------POF ready msg-----------------------*/
29 /* NOTE: after booting POF sends system ready message to PC: */
30 #define RDY_MAGIC 0x52535953UL /* 'SYSR' reversed */
31 #define RDY_MAGIC_SIZE 4 /* size in bytes */
33 #define MAX_N_TOK_BYTES 255
35 #define MIN_RDY_MSG_SIZE RDY_MAGIC_SIZE
36 #define MAX_RDY_MSG_SIZE (RDY_MAGIC_SIZE+MAX_N_TOK_BYTES)
38 #define SYSR_TOK_END 0
39 #define SYSR_TOK_B_CHAN 1 /* nr. of B-Channels; DataLen=1; def: 2 */
40 #define SYSR_TOK_FAX_CHAN 2 /* nr. of FAX Channels; DataLen=1; def: 0 */
41 #define SYSR_TOK_MAC_ADDR 3 /* MAC-Address; DataLen=6; def: auto */
42 #define SYSR_TOK_ESC 255 /* undefined data size yet */
43 /* default values, if not corrected by token: */
44 #define SYSR_TOK_B_CHAN_DEF 2 /* assume 2 B-Channels */
45 #define SYSR_TOK_FAX_CHAN_DEF 1 /* assume 1 FAX Channel */
47 /* syntax of new SYSR token stream:
48 * channel: CHAN_SYSTEM
49 * msgsize: MIN_RDY_MSG_SIZE <= x <= MAX_RDY_MSG_SIZE
50 * RDY_MAGIC_SIZE <= x <= (RDY_MAGIC_SIZE+MAX_N_TOK_BYTES)
51 * msg : 0 1 2 3 {4 5 6 ..}
52 * S Y S R MAX_N_TOK_BYTES bytes of TokenStream
54 * TokenStream := empty
55 * | {NonEndTokenChunk} EndToken RotlCRC
56 * NonEndTokenChunk:= NonEndTokenId DataLen [Data]
57 * NonEndTokenId := 0x01 .. 0xFE 1 BYTE
58 * DataLen := 0x00 .. 0xFF 1 BYTE
59 * Data := DataLen bytes
60 * EndToken := 0x00
61 * RotlCRC := special 1 byte CRC over all NonEndTokenChunk bytes
62 * s. RotlCRC algorithm
64 * RotlCRC algorithm:
65 * ucSum= 0 1 unsigned char
66 * for all NonEndTokenChunk bytes:
67 * ROTL(ucSum,1) rotate left by 1
68 * ucSum += Char; add current byte with swap around
69 * RotlCRC= ~ucSum; invert all bits for result
71 * note:
72 * - for 16-bit FIFO add padding 0 byte to achieve even token data bytes!
73 */
75 /*--------------------------------------error logger------------------------*/
76 /* note: pof needs final 0 ! */
77 #define ERRLOG_CMD_REQ "ERRLOG ON"
78 #define ERRLOG_CMD_REQ_SIZE 10 /* with final 0 byte ! */
79 #define ERRLOG_CMD_STOP "ERRLOG OFF"
80 #define ERRLOG_CMD_STOP_SIZE 11 /* with final 0 byte ! */
82 #define ERRLOG_ENTRY_SIZE 64 /* sizeof(tErrLogEntry) */
83 /* remaining text size = 55 */
84 #define ERRLOG_TEXT_SIZE (ERRLOG_ENTRY_SIZE-2*4-1)
86 typedef struct ErrLogEntry_tag {
88 /*00 */ unsigned long ulErrType;
90 /*04 */ unsigned long ulErrSubtype;
92 /*08 */ unsigned char ucTextSize;
94 /*09 */ unsigned char ucText[ERRLOG_TEXT_SIZE];
95 /* ASCIIZ of len ucTextSize-1 */
97 /*40 */
98 } tErrLogEntry;
101 #if defined(__TURBOC__)
102 #if sizeof(tErrLogEntry) != ERRLOG_ENTRY_SIZE
103 #error size of tErrLogEntry != ERRLOG_ENTRY_SIZE
104 #endif /* */
105 #endif /* */
107 /*--------------------------------------DPRAM boot spooler------------------*/
108 /* this is the struture used between pc and
109 * hyperstone to exchange boot data
111 #define DPRAM_SPOOLER_DATA_SIZE 0x20
112 typedef struct DpramBootSpooler_tag {
114 /*00 */ unsigned char Len;
116 /*01 */ volatile unsigned char RdPtr;
118 /*02 */ unsigned char WrPtr;
120 /*03 */ unsigned char Data[DPRAM_SPOOLER_DATA_SIZE];
122 /*23 */
123 } tDpramBootSpooler;
126 #define DPRAM_SPOOLER_MIN_SIZE 5 /* Len+RdPtr+Wrptr+2*data */
127 #define DPRAM_SPOOLER_DEF_SIZE 0x23 /* current default size */
129 /*--------------------------------------HYCARD/ERGO DPRAM SoftUart----------*/
130 /* at DPRAM offset 0x1C00: */
131 #define SIZE_RSV_SOFT_UART 0x1B0 /* 432 bytes reserved for SoftUart */
134 #endif /* __INCE1PC_H__ */