Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
3.3 KiB

  1. /* A private header file used by nabtslib.c; this is not part of the
  2. public interface. */
  3. #ifndef NABTSLIB_H
  4. #define NABTSLIB_H
  5. /* How many bytes are in a bundle before FEC is added? */
  6. #define BUNDLE_SMALL (26*14)
  7. /* How many bytes are in a bundle after FEC is added? */
  8. #define BUNDLE_LARGE (28*16)
  9. extern void nabtslib_exit();
  10. typedef enum {FEC_OK, FEC_CORRECTABLE, FEC_UNCORRECTABLE, MISSING} fec_stat;
  11. #ifdef linux
  12. int NabtsFecReceiveData(int nField, int nTimeMsec, int scan_line,
  13. unsigned char *pbData, int nDataLen);
  14. #endif
  15. extern unsigned char hamming_encode[16];
  16. typedef enum {fec_status_ok, fec_status_onebyte, fec_status_multibyte,
  17. fec_status_2byte, fec_status_missing} fec_status;
  18. typedef struct {
  19. fec_status status; /* status of the current FEC info */
  20. int err; /* the current checksum error */
  21. short errl[2]; /* the galois_log[] of the two bytes of
  22. the checksum error */
  23. int byte[2]; /* the locations of the error bytes
  24. (byte[1] is only valid if
  25. status == fec_status_2byte) */
  26. int byte_val[2]; /* the values to XOR into the above bytes
  27. to make the checksum error 0 */
  28. int score; /* the number of bits changed by this
  29. correction */
  30. int really_onebyte; /* We can compute the optimal
  31. correction (the one which will
  32. change the least number of bits).
  33. However, we don't do this if we
  34. don't have to (it's slow). If
  35. status is fec_status_2byte, we have
  36. done so; if status is
  37. fec_status_multibyte, we have not.
  38. If status is fec_status_onebyte, we
  39. need to look at really_onebyte to
  40. see if the current correction is
  41. optimal. */
  42. } fec_info;
  43. typedef struct {
  44. int not_full;
  45. unsigned char vals[28];
  46. } Packet;
  47. typedef struct _stream_struct {
  48. int stream_addr;
  49. Packet pack[32];
  50. fec_info horz[32];
  51. int last_index;
  52. struct _stream_struct *next;
  53. int count;
  54. int dead_time;
  55. int confAvgSum;
  56. int confAvgCount;
  57. } Stream;
  58. extern int decode_hamming(unsigned char Val);
  59. extern int remove_parity(unsigned char *pVal);
  60. extern int find_err_val(int err_byte, int byte_csum_err, int check_ind);
  61. extern int compute_csum_horiz(unsigned char *vals, int len);
  62. extern int compute_csum_vert(unsigned char *vals, int len);
  63. extern fec_stat check_checksum_horiz(unsigned char *vals, int len, fec_info *inf);
  64. extern int process_line(unsigned char *);
  65. extern void init_inv2_coeffs();
  66. extern void erase_packet(Stream *str, int i);
  67. extern void complete_bundle(Stream *str, NFECCallback cb, void *ctx, NFECState *st);
  68. extern void init_nzbits_arr();
  69. extern unsigned char nzbits_arr[256];
  70. typedef struct {
  71. int missing;
  72. unsigned char vals[28];
  73. } VBI_Packet;
  74. #define MAX_RECENT_ADDRS 16
  75. /* typedef'd to NFECState in nabtsapi.h */
  76. struct nfec_state_str {
  77. int *pGroupAddrs;
  78. int nGroupAddrs;
  79. Stream *streams;
  80. /* The following is just some scratch space for
  81. complete_bundle()... it's too big to put on the stack, if I make
  82. it a global then my code isn't reentrant, and I don't want to
  83. bother with allocating and freeing it each time complete_bundle()
  84. is called (besides, this is probably more efficient) */
  85. fec_info vert[28];
  86. struct {
  87. int addr;
  88. int count;
  89. } recent_addrs[MAX_RECENT_ADDRS];
  90. int n_recent_addrs;
  91. int field_count;
  92. };
  93. #define PROFILE_VALIDATE
  94. #ifdef PROFILE_VALIDATE
  95. extern int g_nValidate;
  96. #endif
  97. #endif /* NABTSLIB_H */