资源简介
我收集的电力猫设计资料 有高通的QCA6410相关资料 有设计文档有芯片手册 有电路图
代码片段和文件信息
/****************************************************************************
Copyright(c) 2005 by Intellon Corp. ALL RIGHTS RESERVED.
This Information is proprietary to Intellon Corporation Ocala Florida
(Intellon) and MAY NOT be copied by any method or incorporated into
another program without the express written consent of Intellon. This
Information or any portion thereof remains the property of Intellon. The
Information contained herein is believed to be accurate and Intellon
assumes no responsibility or liability for its use in any way and conveys
no license or title under any patent or copyright and makes no
representation or warranty that this Information is free from patent or
copyright infringement.
File: CheckSum.cpp
Author(s): Patrick Tse
Nozar Kianian Fard 2005/09/07
Contains: CheckSum Library
--
$File: //eng/sw/panther/releases/1.1.0/main/publically_disclosed/common/CheckSum.cpp $
$Revision: #1 $
$Change: 179672 $
$Author: nickk $
$DateTime: 2012/05/08 13:49:12 $
****************************************************************************/
#include “CheckSum.h“
// ---------------------------------------------------------------------------
//
// Function: CCCheckSum::VerifyCheckSum()
//
// ---------------------------------------------------------------------------
bool CCCheckSum::VerifyCheckSum(
const uint32* pBufferPtr
uint32 aLength_Wds
uint32 aGivenCheckSum
)
{
uint32 CheckSum = CCCheckSum::GenerateCheckSum( pBufferPtr aLength_Wds );
return (CheckSum == aGivenCheckSum);
}
// ---------------------------------------------------------------------------
//
// Function: CCCheckSum::GenerateCheckSum()
//
// ---------------------------------------------------------------------------
uint32 CCCheckSum::GenerateCheckSum(
const uint32* pBufferPtr
uint32 aLength_Wds
)
{
uint32 CheckSum;
uint32 vpBufferPtr = (uint32)pBufferPtr;
if (vpBufferPtr & 0x3)
{
CheckSum = CCCheckSum::Calc32bitXor( pBufferPtr aLength_Wds );
}
else
{
CheckSum = CCCheckSum::Calc32bitXor_address_word_aligned(pBufferPtr aLength_Wds );
}
CheckSum = FinalizeCumulativeChecksum( CheckSum );
return( CheckSum );// return Checksum
}
// ---------------------------------------------------------------------------
uint32 CCCheckSum::GenerateCumulativeChecksum(
uint32 aAccumulatedSoFar
const uint32 * apBufferPtr
uint32 aLength_Wds
)
{
uint32 vpBufferPtr = (uint32)apBufferPtr;
if (vpBufferPtr & 0x3)
{
return aAccumulatedSoFar ^ CCCheckSum::Calc32bitXor( apBufferPtr aLength_Wds );
}
return aAccumulatedSoFar ^ CCCheckSum::Calc32bitXor_address_word_aligned(apBufferPtr aLength_Wds );
}
uint32 CCCheckSum::FinalizeCumulativeChecksum(
uint32 aAccumulatedSoFar
) {
//-* One‘s Compliment *-//
return ~aAccumulatedSoFar;
}
// ----------------------------------------
评论
共有 条评论