📄 jnand_crc.h
字号:
#ifndef __JNAND_CRC_H__
#define __JNAND_CRC_H__
/*===========================================================================
C R C S E R V I C E S D E C L A R A T I O N S
DESCRIPTION
The following declarations are for use with the CRC Services.
Copyright(c) 1991,1992,1996 by QUALCOMM, Incorporated. All Rights Reserved.
Copyright(c) 1998,1999 by QUALCOMM, Incorporated. All Rights Reserved.
===========================================================================*/
/*===========================================================================
EDIT HISTORY FOR FILE
This section contains comments describing changes made to this file.
Notice that changes are listed in reverse chronological order.
$Header: //depot/asic/MSMSHARED/tools/jnand/jnand_crc.h#1 $ $DateTime: 2003/02/06 15:47:46 $ $Author: pingguan $
when who what, where, why
-------- --- ----------------------------------------------------------
02/06/03 pg Moved from ASWP402 server to ASWP401 server.
07/04/02 drh Removed reference to crc_30_calc as we only use the step
06/19/02 drh Removed all 16 bit references.
11/29/01 lad Added step-wise CRC30 calculation.
03/17/99 ms Removed comments related to bb_ for Virtual Boot Block.
12/16/98 jct Removed 80186 support
09/21/98 jct Incorporate ARM porting changes, cdecl changes
02/28/96 dna Changed crc_16_l_table extern to be a pointer so the
macro now accesses the table through the Boot Block jump
table.
06/21/93 jah Corrected CRC_16_L_OK to match with crc_16_l_calc().
06/07/93 jah Added prototype for crc_16_l_calc(), and improved comments
for CRC_16_L_STEP().
04/26/93 jah Added extern for crc_16_l_table[] for macro.
04/22/93 jah Added CRC definitions and macro to support CRC CCITT-16
processed LSB first.
07/09/92 jah Changed crc_16_step() from bits to bytes
06/18/92 jah Ported from brassboard and converted to table-driven.
===========================================================================*/
#include "jnand_comdef.h"
/*===========================================================================
DATA DECLARATIONS
===========================================================================*/
/* Residual CRC value to compare against return value of crc_30_calc().
** Use crc_30_calc() to calculate a 30 bit CRC, and append it to the buffer.
** When crc_30_calc() is applied to the unchanged result, it returns CRC_30_OK.
*/
#define CRC_30_OK 0x0B105AA5
/* Mask for CRC-30 polynomial:
**
** x^30+x^29+x^21+x^20+x^15+x^13+x^12+x^11+x^8+x^7+x^6+x^2+x^1+1
**
** Note: the x^30 tap is left off, it's implicit.
*/
#define CRC_30_POLYNOMIAL 0x6030B9C7
/* Seed value for CRC register. The all ones seed allows detection of
** an entire data stream of zeroes.
*/
#define CRC_30_SEED 0x3FFFFFFF
/* Seed value for CRC30 register. The CRC30 seed is inverted prior to
** being used in the step-wise CRC-30. This behaves as CRC_30_SEED.
*/
#define CRC_30_STEP_SEED (~((dword) CRC_30_SEED))
/*===========================================================================
FUNCTION DECLARATIONS
===========================================================================*/
/*===========================================================================
FUNCTION CRC_30_STEP
DESCRIPTION
This function calculates a 30-bit CRC over a specified number of data
bits. It can be used to produce a CRC and to check a CRC. The CRC value
passed in is used to continue the CRC calculation from a previous call,
this allows this routine to be used to CRC discontinuous data.
DEPENDENCIES
None
RETURN VALUE
Returns a double word holding 30 bits which are the contents of the
CRC register as calculated over the specified data bits. If this
function is being used to check a CRC, then the return value will be
equal to CRC_30_OK (defined in crc.h) if the CRC checks correctly.
NOTE: The caller is expected to mask the bottom 30 bits from the value,
SIDE EFFECTS
None
===========================================================================*/
extern dword crc_30_step
(
dword seed,
/* Either the result of a previous crc_30_step() or CRC_16_STEP_SEED
** the first time the routine is called. Note that the input is
** inverted prior to use, to counteract the inversion applied when
** it was returned as a result of the previous step.
*/
byte *buf_ptr,
/* Pointer to bytes containing the data to CRC. The bit stream starts
** in the MS bit of the first byte.
*/
word len
/* Number of data bits to calculate the CRC over */
);
#endif /* __JNAND_CRC_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -