blob: cab68361de6574459d9021bdcdc0b6e31db7f626 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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
6 *
7 * Author M. Steinkopf
8 * Copyright 1999 by M. Steinkopf
9 *
10 * This software may be used and distributed according to the terms
11 * of the GNU General Public License, incorporated herein by reference.
12 *
13 */
14
15#ifndef __INCE1PC_H__
16#define __INCE1PC_H__
17
18/* basic scalar definitions have same meanning,
19 * but their declaration location depends on environment
Joe Perches475be4d2012-02-19 19:52:38 -080020 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070021
Joe Perches475be4d2012-02-19 19:52:38 -080022/*--------------------------------------channel numbers---------------------*/
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#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 */
27
Joe Perches475be4d2012-02-19 19:52:38 -080028/*--------------------------------------POF ready msg-----------------------*/
29/* NOTE: after booting POF sends system ready message to PC: */
Linus Torvalds1da177e2005-04-16 15:20:36 -070030#define RDY_MAGIC 0x52535953UL /* 'SYSR' reversed */
31#define RDY_MAGIC_SIZE 4 /* size in bytes */
32
33#define MAX_N_TOK_BYTES 255
34
35#define MIN_RDY_MSG_SIZE RDY_MAGIC_SIZE
Joe Perches475be4d2012-02-19 19:52:38 -080036#define MAX_RDY_MSG_SIZE (RDY_MAGIC_SIZE + MAX_N_TOK_BYTES)
Linus Torvalds1da177e2005-04-16 15:20:36 -070037
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 */
Joe Perches475be4d2012-02-19 19:52:38 -080043/* default values, if not corrected by token: */
Linus Torvalds1da177e2005-04-16 15:20:36 -070044#define SYSR_TOK_B_CHAN_DEF 2 /* assume 2 B-Channels */
45#define SYSR_TOK_FAX_CHAN_DEF 1 /* assume 1 FAX Channel */
46
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
53 *
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
63 *
64 * RotlCRC algorithm:
Andrew Mortonc721bcc2006-03-25 03:07:04 -080065 * ucSum= 0 1 unsigned char
Linus Torvalds1da177e2005-04-16 15:20:36 -070066 * 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
70 *
71 * note:
72 * - for 16-bit FIFO add padding 0 byte to achieve even token data bytes!
Joe Perches475be4d2012-02-19 19:52:38 -080073 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070074
Joe Perches475be4d2012-02-19 19:52:38 -080075/*--------------------------------------error logger------------------------*/
76/* note: pof needs final 0 ! */
Linus Torvalds1da177e2005-04-16 15:20:36 -070077#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 ! */
81
82#define ERRLOG_ENTRY_SIZE 64 /* sizeof(tErrLogEntry) */
Joe Perches475be4d2012-02-19 19:52:38 -080083 /* remaining text size = 55 */
84#define ERRLOG_TEXT_SIZE (ERRLOG_ENTRY_SIZE - 2 * 4 - 1)
Linus Torvalds1da177e2005-04-16 15:20:36 -070085
86typedef struct ErrLogEntry_tag {
Joe Perches475be4d2012-02-19 19:52:38 -080087
88 /*00 */ unsigned long ulErrType;
89
90 /*04 */ unsigned long ulErrSubtype;
91
92 /*08 */ unsigned char ucTextSize;
93
Andrew Mortonc721bcc2006-03-25 03:07:04 -080094 /*09 */ unsigned char ucText[ERRLOG_TEXT_SIZE];
Linus Torvalds1da177e2005-04-16 15:20:36 -070095 /* ASCIIZ of len ucTextSize-1 */
Joe Perches475be4d2012-02-19 19:52:38 -080096
97/*40 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070098} tErrLogEntry;
99
100
101#if defined(__TURBOC__)
102#if sizeof(tErrLogEntry) != ERRLOG_ENTRY_SIZE
103#error size of tErrLogEntry != ERRLOG_ENTRY_SIZE
104#endif /* */
105#endif /* */
106
Joe Perches475be4d2012-02-19 19:52:38 -0800107/*--------------------------------------DPRAM boot spooler------------------*/
108/* this is the struture used between pc and
109 * hyperstone to exchange boot data
110 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111#define DPRAM_SPOOLER_DATA_SIZE 0x20
112typedef struct DpramBootSpooler_tag {
Joe Perches475be4d2012-02-19 19:52:38 -0800113
114 /*00 */ unsigned char Len;
115
116 /*01 */ volatile unsigned char RdPtr;
117
118 /*02 */ unsigned char WrPtr;
119
120 /*03 */ unsigned char Data[DPRAM_SPOOLER_DATA_SIZE];
121
122/*23 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700123} tDpramBootSpooler;
124
125
126#define DPRAM_SPOOLER_MIN_SIZE 5 /* Len+RdPtr+Wrptr+2*data */
127#define DPRAM_SPOOLER_DEF_SIZE 0x23 /* current default size */
128
Joe Perches475be4d2012-02-19 19:52:38 -0800129/*--------------------------------------HYCARD/ERGO DPRAM SoftUart----------*/
130/* at DPRAM offset 0x1C00: */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131#define SIZE_RSV_SOFT_UART 0x1B0 /* 432 bytes reserved for SoftUart */
132
133
134#endif /* __INCE1PC_H__ */