?? 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 + -