Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |
| 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 Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame^] | 20 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame^] | 22 | /*--------------------------------------channel numbers---------------------*/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame^] | 28 | /*--------------------------------------POF ready msg-----------------------*/ |
| 29 | /* NOTE: after booting POF sends system ready message to PC: */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame^] | 36 | #define MAX_RDY_MSG_SIZE (RDY_MAGIC_SIZE + MAX_N_TOK_BYTES) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 */ |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame^] | 43 | /* default values, if not corrected by token: */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 Morton | c721bcc | 2006-03-25 03:07:04 -0800 | [diff] [blame] | 65 | * ucSum= 0 1 unsigned char |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |
| 70 | * |
| 71 | * note: |
| 72 | * - for 16-bit FIFO add padding 0 byte to achieve even token data bytes! |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame^] | 73 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame^] | 75 | /*--------------------------------------error logger------------------------*/ |
| 76 | /* note: pof needs final 0 ! */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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) */ |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame^] | 83 | /* remaining text size = 55 */ |
| 84 | #define ERRLOG_TEXT_SIZE (ERRLOG_ENTRY_SIZE - 2 * 4 - 1) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | |
| 86 | typedef struct ErrLogEntry_tag { |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame^] | 87 | |
| 88 | /*00 */ unsigned long ulErrType; |
| 89 | |
| 90 | /*04 */ unsigned long ulErrSubtype; |
| 91 | |
| 92 | /*08 */ unsigned char ucTextSize; |
| 93 | |
Andrew Morton | c721bcc | 2006-03-25 03:07:04 -0800 | [diff] [blame] | 94 | /*09 */ unsigned char ucText[ERRLOG_TEXT_SIZE]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 95 | /* ASCIIZ of len ucTextSize-1 */ |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame^] | 96 | |
| 97 | /*40 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame^] | 107 | /*--------------------------------------DPRAM boot spooler------------------*/ |
| 108 | /* this is the struture used between pc and |
| 109 | * hyperstone to exchange boot data |
| 110 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | #define DPRAM_SPOOLER_DATA_SIZE 0x20 |
| 112 | typedef struct DpramBootSpooler_tag { |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame^] | 113 | |
| 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame^] | 129 | /*--------------------------------------HYCARD/ERGO DPRAM SoftUart----------*/ |
| 130 | /* at DPRAM offset 0x1C00: */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 131 | #define SIZE_RSV_SOFT_UART 0x1B0 /* 432 bytes reserved for SoftUart */ |
| 132 | |
| 133 | |
| 134 | #endif /* __INCE1PC_H__ */ |