Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 #include <stdio.h> #include <stdlib.h> #include <string.h> // strip_vme_utc_data.c WDST 16/04/2015 // this program is used to remove UTCs from the vme log data // so the file may be used for simple file comparison. int main(int argc, char *argv[]){ FILE *fp1; // vme log file FILE *fp2; // sanitised vme log file char str1[16]; // vector from IP file char str2[16]; // vector to OP file char word_value[4]; // data value char utc_token[] = "8000"; // utc token char same; // unsigned long l; // vector counter // int j; // loop counter if(argc!=3){ printf("Usage: strip_vme_utc_data <vme input file> <vme output file>\n"); exit(1); } // open first file if((fp1 = fopen(argv[1],"rb"))==NULL){ printf("Cannot open first file.\n"); exit(1); } // open second file if((fp2 = fopen(argv[2],"wb"))==NULL){ printf("Cannot open second file.\n"); exit(1); } // write header // fprintf(fp2,"Reference Data \n"); // compare the files while(!feof(fp1)) { fscanf (fp1, "%s", &str1); //get time if(ferror(fp1)) { printf("Error reading first file. \n"); break; } fscanf (fp1, "%s", &str1); //get data strncpy(word_value, str1,sizeof(str1)); // strncpy(word_value, str1, sizeof(str1)); printf("Data is %s\n",word_value); if(strcmp(word_value,utc_token) == 0){ // it is a utc token fscanf (fp1, "%s", &str1); //get time fscanf (fp1, "%s", &str1); //get UTC data 1 fscanf (fp1, "%s", &str1); //get time fscanf (fp1, "%s", &str1); //get UTC data 2 fscanf (fp1, "%s", &str1); //get time fscanf (fp1, "%s", &str1); //get UTC data 3 fscanf (fp1, "%s", &str1); //get time fscanf (fp1, "%s", &str1); //get UTC data 4 fscanf (fp1, "%s", &str1); //get time fscanf (fp1, "%s", &str1); //get UTC data 5 fscanf (fp1, "%s", &str1); //get time fscanf (fp1, "%s", &str1); //get Lost vme count fscanf (fp1, "%s", &str1); //get time fscanf (fp1, "%s", &str1); //get Lost vme count2 fscanf (fp1, "%s", &str1); //get time fscanf (fp1, "%s", &str1); //get vme data // strncpy(word_value, str1,4); strncpy(word_value, str1, sizeof(str1)); } fprintf(fp2,"%s\n",word_value); } // end of while if(fclose(fp1)==EOF){ printf("Error closing first file.\n"); exit(1); } if(fclose(fp2)==EOF){ printf("Error closing second file.\n"); exit(1); } return(0); }
Can AAAA AAAA xxxx 8000 appear anywhere in the payload?
Regards, Dan.
aa aa aa aa aa aa aa aa aa aa aa aa 21 43 33 20 f0 82 1f 20 9e 69 c3 a6 76 d6 20 80 20 20 01 20 ad de ef be 20 20 04 37 34 77 20 20 77 ca e1 ab 20 20 ab d1 1c 01 20 a1 20 20 5b d1 1e e7 20 f0 20 20 ea 1d 20 20 df 01 1d 1e aa aa 55 55 aa aa ad de ef be 20 20 04 37 34 77 20 20 77 ca e1 ab 20 20 ab d1 1c 01 20 a1 20 20 5b d1 1e e7 20 f0 20 20 ea 1d 20 20 df 01 1d 1e aa aa 55 55 aa aa ad de ef be 20 20 aa aa aa aa aa aa aa aa aa aa aa aa 21 43 36 20 d3 2a 1f 20 9e 69 c3 a6 78 d6 20 80 20 20 02 20 04 37 34 77 20 20 77 ca e1 ab 20 20 ab d1 1c 01 20 a1 20 20 5b d1 1e e7 20 f0 20 20 ea 1d 20 20 df 01 1d 1e aa aa 55 55 aa aa ad de ef be 20 20 04 37 34 77 20 20 77 ca e1 ab 20 20 ab d1 1c 01 20 a1 20 20 5b d1 1e e7 20 f0 20 20 ea 1d 20 20 df 01 1d 1e aa aa 55 55 aa aa ad de ef be 20 20 04 37 34 77 20 20 77 ca e1 ab 20 20 aa aa aa aa aa aa aa aa aa aa aa aa 21 43 35 20 b4 54 1f 20 9e 69 c3 a6 7a d6 20 80 20 20 03 20 ab d1 1c 01 20 a1 20 20 5b d1 1e e7 20 f0 20 20 ea 1d 20 20 df 01 1d 1e aa aa 55 55 aa aa ad de ef be 20 20 04 37 34 77 20 20 77 ca e1 ab 20 20 ab d1 1c 01 20 a1 20 20 5b d1 1e e7 20 f0 20 20 ea 1d 20 20 df 01 1d 1e aa aa 55 55 aa aa ad de ef be 20 20 04 37 34 77 20 20 77 ca e1 ab 20 20 ab d1 1c 01 20 a1 20 20 5b d1 aa aa aa aa aa aa aa aa aa aa aa aa 21 43 36 20 b1 0b 1f 20 9e 69 c3 a6 7c d6 20 80 20 20 04 20 1e e7 20 f0 20 20 ea 1d 20 20 df 01 1d 1e aa aa 55 55 aa aa ad de ef be 20 20 04 37 34 77 20 20 77 ca e1 ab 20 20 ab d1 1c 01 20 a1 20 20 5b d1 1e e7 20 f0 20 20 ea 1d 20 20 df 01 1d 1e aa aa 55 55 aa aa ad de ef be 20 20 04 37 34 77 20 20 77 ca e1 ab 20 20 ab d1 1c 01 20 a1 20 20 5b d1 1e e7 20 f0 20 20 ea 1d 20 20 df 01 aa aa aa aa aa aa aa aa aa aa aa aa 21 43 36 20 6f 24 1f 20 9e 69 c3 a6 7e d6 20 80 20 20 05 20 1d 1e aa aa 55 55 aa aa ad de ef be 20 20 04 37 34 77 20 20 77 ca e1 ab 20 20 ab d1 1c 01 20 a1 20 20 5b d1 1e e7 20 f0 20 20 ea 1d 20 20 df 01 1d 1e aa aa 55 55 aa aa ad de ef be 20 20 04 37 34 77 20 20 77 ca e1 ab 20 20 ab d1 1c 01 20 a1 20 20 5b d1 1e e7 20 f0 20 20 ea 1d 20 20 df 01 1d 1e aa aa 55 55 aa aa ad de ef be aa aa aa aa aa aa aa aa aa aa aa aa 21 43 37 20 dc 20 1f 20 9e 69 c3 a6 80 d6 20 80 20 20 06 20 20 20 04 37 34 77 20 20 77 ca e1 ab 20 20 ab d1 1c 01 20 a1 20 20 5b d1 1e e7 20 f0 20 20 ea 1d 20 20 df 01 1d 1e aa aa 55 55 aa aa ad de ef be 20 20 04 37 34 77 20 20 77 ca e1 ab 20 20 ab d1 1c 01 20 a1 20 20 5b d1 1e e7 20 f0 20 20 ea 1d 20 20 df 01 1d 1e aa aa 55 55 aa aa ad de ef be 20 20 04 37 34 77 20 20 77 ca e1 ab 20 20 aa aa aa aa aa aa aa aa aa aa aa aa 21 43 35 20 b4 54 1f 20 9e 69 c3 a6 82 d6 20 80 20 20 07 20 ab d1 1c 01 20 a1 20 20 5b d1 1e e7 20 f0 20 20 ea 1d 20 20 df 01 1d 1e aa aa 55 55 aa aa
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 package vme_data_pkg is type array_2d is array (1 to 24) of std_logic_vector(15 downto 0); CONSTANT vme_data1 : array_2d := (X"DEAD", X"BEEF", X"0000", X"3704", X"7734", X"0000", X"CA77", X"ABE1", X"0000", X"D1AB", X"011C", X"A100", X"0000", X"D15B", X"E71E", X"F000", X"0000", X"1DEA", X"0000", X"01DF", X"1E1D", X"AAAA", X"5555", X"AAAA" ); end package vme_data_pkg;
As can be seen in the snipet - ad de ef be is suppose to be deadbeaf. I think this may have to do with the sampling on the rising edge & falling edge & then being writen to the compact flash in the wrong order. This is not a problem in the system because when reading back data over a bus the fpga vhdl code automatically reorders the data. However I'm in a situation where I'm taking the data directly from the compact flash.
Code C - [expand] 1 2 3 4 5 6 7 8 while (ReadByte(fp_r, &buffer)) { /* Endian Switch */ temp = buffer[1]; buffer[1] = buffer[0]; buffer[0]=temp; /* Write data to the file */ fwrite((void*) buffer, 1, 2, fp_w); }
aa aa aa aa aa aa aa aa aa aa aa aa 43 21
00 35 - word length
54 b4 - checksum
00 1f - utcword 1
69 9e - utcword 2
a6 c3 - utcword 3
d6 b1 - utcword 4
80 00 - utcword 5
00 00 - utcword 6
00 1f - utc flag
d1 ab - DATA
01 1c
a1 00
00 00
d1 5b
e7 1e
f0 00
00 00
1d ea
00 00
01 df
1e 1d
aa aa
55 55
aa aa
de ad
be ef
00 00
37 04
77 34
00 00
ca 77
ab e1
00 00
d1 ab
01 1c
a1 00
00 00
d1 5b
e7 1e
f0 00
00 00
1d ea
00 00
01 df
1e 1d
aa aa
55 55
aa aa
de ad
be ef
00 00
37 04
77 34
00 00
ca 77
ab e1
00 00
d1 ab
01 1c
a1 00
00 00
d1 5b - DATA
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?