blob: 7a36694df6d7082ddb254a3a68f5c0f7969a7357 [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
20 */
21
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 */
27
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 */
32
33#define MAX_N_TOK_BYTES 255
34
35#define MIN_RDY_MSG_SIZE RDY_MAGIC_SIZE
36#define MAX_RDY_MSG_SIZE (RDY_MAGIC_SIZE+MAX_N_TOK_BYTES)
37
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 */
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!
73 */
74
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 ! */
81
82#define ERRLOG_ENTRY_SIZE 64 /* sizeof(tErrLogEntry) */
83 /* remaining text size = 55 */
84#define ERRLOG_TEXT_SIZE (ERRLOG_ENTRY_SIZE-2*4-1)
85
86typedef struct ErrLogEntry_tag {
87
Andrew Mortonc721bcc2006-03-25 03:07:04 -080088/*00 */ unsigned long ulErrType;
Linus Torvalds1da177e2005-04-16 15:20:36 -070089
Andrew Mortonc721bcc2006-03-25 03:07:04 -080090/*04 */ unsigned long ulErrSubtype;
Linus Torvalds1da177e2005-04-16 15:20:36 -070091
Andrew Mortonc721bcc2006-03-25 03:07:04 -080092/*08 */ unsigned char ucTextSize;
Linus Torvalds1da177e2005-04-16 15:20:36 -070093
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 */
96
97/*40 */
98} 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
107/*--------------------------------------DPRAM boot spooler------------------*/
108 /* this is the struture used between pc and
109 * hyperstone to exchange boot data
110 */
111#define DPRAM_SPOOLER_DATA_SIZE 0x20
112typedef struct DpramBootSpooler_tag {
113
Andrew Mortonc721bcc2006-03-25 03:07:04 -0800114/*00 */ unsigned char Len;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115
Andrew Mortonc721bcc2006-03-25 03:07:04 -0800116/*01 */ volatile unsigned char RdPtr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117
Andrew Mortonc721bcc2006-03-25 03:07:04 -0800118/*02 */ unsigned char WrPtr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700119
Andrew Mortonc721bcc2006-03-25 03:07:04 -0800120/*03 */ unsigned char Data[DPRAM_SPOOLER_DATA_SIZE];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700121
122/*23 */
123} 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
129/*--------------------------------------HYCARD/ERGO DPRAM SoftUart----------*/
130 /* at DPRAM offset 0x1C00: */
131#define SIZE_RSV_SOFT_UART 0x1B0 /* 432 bytes reserved for SoftUart */
132
133
134#endif /* __INCE1PC_H__ */