📄 test_crc16.c
字号:
/* | | Copyright disclaimer: | This software was developed at the National Institute of Standards | and Technology by employees of the Federal Government in the course | of their official duties. Pursuant to title 17 Section 105 of the | United States Code this software is not subject to copyright | protection and is in the public domain. | | We would appreciate acknowledgement if the software is used. |*//* | Project: WCDMA simulation environment | Module: Test bed for CRC routines. | Author: Tommi Makelainen, Nokia/NIST | Date: January 27, 1999 | | History: | January 27, 1999 Tommi Makelainen | Initial version. | | March 24, 1999 Tommi Makelainen | Input data for crc calculation from char to int. | */#include <stdio.h>#include <math.h>#include "crc_routines.h"#define INPUT_SIZE 200#define ARIB_CRC16 0x11021int tc_block_sizes[] = {60, 100, 120, 200};int main(int argc, char *argv[]){ int i, j, output_size, output_data[200]; int test_input[8], test_input2[24]; int test_inp_size; short int crc_value; int crc_bits[16]; test_inp_size = 8; for (i=0; i < test_inp_size; i++) { test_input[i] = i % 2; } wcdma_crctable_init (ARIB_CRC16); /* wcdma_crctable_init (0x1321); */ /* crc_value = wcdma_calc_crc(test_input, test_inp_size); */ wcdma_get_crc_value(test_input, test_inp_size, crc_bits); printf("CRC value %x\n", crc_value); for (i=0; i < test_inp_size; i++) { test_input2[i] = test_input[i]; } for (i=test_inp_size, j=0; i < (test_inp_size+16); i++, j++) { test_input2[i] = crc_bits[j]; } /* test_input2[8] = (crc_value << 16) & 0xffff0000; */ /* crc_value = wcdma_calc_crc(test_input2, test_inp_size+1); */ wcdma_get_crc_value(test_input2, test_inp_size+16, crc_bits); printf("CRC bits in decoding: "); for (i=0; i < 16; i++) { printf("%x ", crc_bits[i]); } printf("\n"); return;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -