1 |
/**************************************************************************** |
2 |
* F i l e D a t a |
3 |
* $Id: crc_cm.c,v 1.1 2004/07/02 09:01:35 sebastiani Exp $ |
4 |
* $Revision: 1.1 $ |
5 |
* $Date: 2004/07/02 09:01:35 $ |
6 |
* $RCSfile: crc_cm.c,v $ |
7 |
* |
8 |
**************************************************************************** |
9 |
* S W D e v e l o p m e n t E n v i r o n m e n t |
10 |
* |
11 |
* $Author: sebastiani $ |
12 |
* : |
13 |
**************************************************************************** |
14 |
* U p d a t i n g |
15 |
|
16 |
* $Log: crc_cm.c,v $ |
17 |
* Revision 1.1 2004/07/02 09:01:35 sebastiani |
18 |
* *** empty log message *** |
19 |
* |
20 |
* Revision 1.4 2004/05/20 16:03:52 faber |
21 |
* ACQ flow dev continuing |
22 |
* |
23 |
* Revision 1.3 2004/05/20 12:24:44 faber |
24 |
* getchar bugfixed |
25 |
* |
26 |
* Revision 1.2 2004/05/20 10:47:17 faber |
27 |
* printf stderr |
28 |
|
29 |
* Revision 1.1 2004/02/26 16:30:07 faber |
30 |
* crc.c added |
31 |
* |
32 |
* Revision 1.1 2003/10/03 16:12:26 faber |
33 |
* *** empty log message *** |
34 |
* |
35 |
* |
36 |
*****************************************************************************/ |
37 |
|
38 |
|
39 |
/* #include "CM_Common_INFN.h" */ |
40 |
#include "DAQ_IDAQ_INFN.h" |
41 |
#include <stdio.h> |
42 |
|
43 |
DAQ_DECLBUF(B,1024*1024); |
44 |
|
45 |
int main(void) { |
46 |
int c; |
47 |
unsigned short crc=0; |
48 |
unsigned char b; |
49 |
|
50 |
status_code s; |
51 |
DAQ_BUFFER_INIT(B); |
52 |
// fprintf(stderr,"\n-------\n "); |
53 |
while( (c=getchar()) != EOF) { |
54 |
if(B.len < B.size) { |
55 |
B.buf[B.len++]=c; |
56 |
/* |
57 |
fprintf(stderr,"%02X ",c); |
58 |
if(B.len % 16 == 0) { |
59 |
fprintf(stderr,"\n"); |
60 |
} |
61 |
*/ |
62 |
} |
63 |
else |
64 |
return 1; |
65 |
} |
66 |
// fprintf(stderr,"\n [Size: %d]\n",B.len); |
67 |
B.crc16=CM_Compute_CRC16(0,B.buf, B.len); |
68 |
b=B.crc16 & 0xff; |
69 |
|
70 |
printf("%02X %04X",b,B.crc16); |
71 |
return 0; |
72 |
} |