📄 hcs.c
字号:
/*****************************************************************************//* FIle Name : hcs.c *//* Description : WiMax OFDM HCS CRC8 Encoder *//* S(x) = x^8 + x^2 + x + 1 *//* author : miffie *//* Date : Nov/02/05 *//* Copyright (c) 2005 miffie All rights reserved. *//*****************************************************************************////////////////////////////////////////////////////////////////////////////////struct binaryset hcs(struct binaryset datain ) { // struct binaryset bcrc ;char shifter ;char *btmp1 ;char tmp1 ;int ii , jj ; //Make LONG PLCP Preamble if ((btmp1 = (char *)malloc(1*sizeof(char))) == NULL) { PRINTF( " malloc failed in hcs\n") ; } //fail else { //allocated PRINTF(" hcs size=0x%x\n", datain.size ) ; shifter = 0x00 ; for (ii=0;ii<datain.size;ii++) { //for for (jj=0;jj<8;jj++) { //for tmp1 = (datain.data[ ii ]>>(7-jj)) &0x1 ; tmp1 = ((shifter &0x80) >> 7) ^ tmp1 ; shifter = (tmp1) ? shifter ^ 0x03 : shifter ; shifter = (shifter<<1) + tmp1 ; //printf("crc8 shifter=%x\n" , shifter ) ; } //for } //for bcrc.format = 1 ; bcrc.data = btmp1 ; bcrc.size = 1 ; btmp1[ 0 ] = shifter ; } //allocated return( bcrc ) ;} //hcs
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -