ince1pc.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. #ifndef __INCE1PC_H__
  15. #define __INCE1PC_H__
  16. /* basic scalar definitions have same meanning,
  17. * but their declaration location depends on environment
  18. */
  19. /*--------------------------------------channel numbers---------------------*/
  20. #define CHAN_SYSTEM 0x0001 /* system channel (spooler to spooler) */
  21. #define CHAN_ERRLOG 0x0005 /* error logger */
  22. #define CHAN_CAPI 0x0064 /* CAPI interface */
  23. #define CHAN_NDIS_DATA 0x1001 /* NDIS data transfer */
  24. /*--------------------------------------POF ready msg-----------------------*/
  25. /* NOTE: after booting POF sends system ready message to PC: */
  26. #define RDY_MAGIC 0x52535953UL /* 'SYSR' reversed */
  27. #define RDY_MAGIC_SIZE 4 /* size in bytes */
  28. #define MAX_N_TOK_BYTES 255
  29. #define MIN_RDY_MSG_SIZE RDY_MAGIC_SIZE
  30. #define MAX_RDY_MSG_SIZE (RDY_MAGIC_SIZE + MAX_N_TOK_BYTES)
  31. #define SYSR_TOK_END 0
  32. #define SYSR_TOK_B_CHAN 1 /* nr. of B-Channels; DataLen=1; def: 2 */
  33. #define SYSR_TOK_FAX_CHAN 2 /* nr. of FAX Channels; DataLen=1; def: 0 */
  34. #define SYSR_TOK_MAC_ADDR 3 /* MAC-Address; DataLen=6; def: auto */
  35. #define SYSR_TOK_ESC 255 /* undefined data size yet */
  36. /* default values, if not corrected by token: */
  37. #define SYSR_TOK_B_CHAN_DEF 2 /* assume 2 B-Channels */
  38. #define SYSR_TOK_FAX_CHAN_DEF 1 /* assume 1 FAX Channel */
  39. /* syntax of new SYSR token stream:
  40. * channel: CHAN_SYSTEM
  41. * msgsize: MIN_RDY_MSG_SIZE <= x <= MAX_RDY_MSG_SIZE
  42. * RDY_MAGIC_SIZE <= x <= (RDY_MAGIC_SIZE+MAX_N_TOK_BYTES)
  43. * msg : 0 1 2 3 {4 5 6 ..}
  44. * S Y S R MAX_N_TOK_BYTES bytes of TokenStream
  45. *
  46. * TokenStream := empty
  47. * | {NonEndTokenChunk} EndToken RotlCRC
  48. * NonEndTokenChunk:= NonEndTokenId DataLen [Data]
  49. * NonEndTokenId := 0x01 .. 0xFE 1 BYTE
  50. * DataLen := 0x00 .. 0xFF 1 BYTE
  51. * Data := DataLen bytes
  52. * EndToken := 0x00
  53. * RotlCRC := special 1 byte CRC over all NonEndTokenChunk bytes
  54. * s. RotlCRC algorithm
  55. *
  56. * RotlCRC algorithm:
  57. * ucSum= 0 1 unsigned char
  58. * for all NonEndTokenChunk bytes:
  59. * ROTL(ucSum,1) rotate left by 1
  60. * ucSum += Char; add current byte with swap around
  61. * RotlCRC= ~ucSum; invert all bits for result
  62. *
  63. * note:
  64. * - for 16-bit FIFO add padding 0 byte to achieve even token data bytes!
  65. */
  66. /*--------------------------------------error logger------------------------*/
  67. /* note: pof needs final 0 ! */
  68. #define ERRLOG_CMD_REQ "ERRLOG ON"
  69. #define ERRLOG_CMD_REQ_SIZE 10 /* with final 0 byte ! */
  70. #define ERRLOG_CMD_STOP "ERRLOG OFF"
  71. #define ERRLOG_CMD_STOP_SIZE 11 /* with final 0 byte ! */
  72. #define ERRLOG_ENTRY_SIZE 64 /* sizeof(tErrLogEntry) */
  73. /* remaining text size = 55 */
  74. #define ERRLOG_TEXT_SIZE (ERRLOG_ENTRY_SIZE - 2 * 4 - 1)
  75. typedef struct ErrLogEntry_tag {
  76. /*00 */ unsigned long ulErrType;
  77. /*04 */ unsigned long ulErrSubtype;
  78. /*08 */ unsigned char ucTextSize;
  79. /*09 */ unsigned char ucText[ERRLOG_TEXT_SIZE];
  80. /* ASCIIZ of len ucTextSize-1 */
  81. /*40 */
  82. } tErrLogEntry;
  83. #if defined(__TURBOC__)
  84. #if sizeof(tErrLogEntry) != ERRLOG_ENTRY_SIZE
  85. #error size of tErrLogEntry != ERRLOG_ENTRY_SIZE
  86. #endif /* */
  87. #endif /* */
  88. /*--------------------------------------DPRAM boot spooler------------------*/
  89. /* this is the struture used between pc and
  90. * hyperstone to exchange boot data
  91. */
  92. #define DPRAM_SPOOLER_DATA_SIZE 0x20
  93. typedef struct DpramBootSpooler_tag {
  94. /*00 */ unsigned char Len;
  95. /*01 */ volatile unsigned char RdPtr;
  96. /*02 */ unsigned char WrPtr;
  97. /*03 */ unsigned char Data[DPRAM_SPOOLER_DATA_SIZE];
  98. /*23 */
  99. } tDpramBootSpooler;
  100. #define DPRAM_SPOOLER_MIN_SIZE 5 /* Len+RdPtr+Wrptr+2*data */
  101. #define DPRAM_SPOOLER_DEF_SIZE 0x23 /* current default size */
  102. /*--------------------------------------HYCARD/ERGO DPRAM SoftUart----------*/
  103. /* at DPRAM offset 0x1C00: */
  104. #define SIZE_RSV_SOFT_UART 0x1B0 /* 432 bytes reserved for SoftUart */
  105. #endif /* __INCE1PC_H__ */