Hello everyone,

I have 3 questions want to ask you,thanks.

1.I look at this in the api,


Uses the following header format: Bits 0-11: The packet length (what was stored 
in the tag with key len_tag_key) Bits 12-23: The header number (counts up 
everytime this function is called) Bit 24-31: 8-Bit CRC All other bits: Are set 
to zero

If the header length is smaller than 32, bits are simply left out. For this 
reason, they always start with the LSB.

However, it is recommended to stay above 32 Bits, in order to have a working 
CRC.

Q:


If I want to have a working CRC,what is the number of packet length at least?




2.I look at the code below,







    bool packet_header_default::header_formatter(
 66 >-------long packet_len,
 67         unsigned char *out,
 68
 69 >-------const std::vector<tag_t> &tags
 70     )
 71     {
 72 >-------//std::cout<<"before"<<d_mask<<std::endl;
 73       packet_len &= 0x0FFF;
 74      
 75       d_crc_impl.reset();
 76       d_crc_impl.process_bytes((void const *) &packet_len, 2);
 77       d_crc_impl.process_bytes((void const *) &d_header_number, 2);
 78       unsigned char crc = d_crc_impl();
 79       memset(out, 0x00, d_header_len);
 80       int k = 0; // Position in out
 81       for (int i = 0; i < 12 && k < d_header_len; i += d_bits_per_byte, 
k++) {
 82 >-------out[k] = (unsigned char) ((packet_len >> i) & d_mask);
 83
 84       }
 85       for (int i = 0; i < 12 && k < d_header_len; i += d_bits_per_byte, 
k++) {
 86 >-------out[k] = (unsigned char) ((d_header_number >> i) & d_mask);
 87       }
 88       for (int i = 0; i < 8 && k < d_header_len; i += d_bits_per_byte, k++) 
{
 89 >-------out[k] = (unsigned char) ((crc >> i) & d_mask);
 90       }
 91       d_header_number++;
 92       d_header_number &= 0x0FFF;
 93
 94       return true;
 95     }


If someone don't want to use the Stream CRC32 block,Packet Header Generator 
still will add the crc at bit 24-31.Is it right?I suggest the code should add a 
function to judge before add the crc at bit 24-31.


3.For example,the OFDM example.If the transmitter don't add the crc32 
block,whether the receiver will display the warning "Detected an invalid packet 
at item %1%"?


Thank you so much.
Best regards,
zswx
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to