|
|
|
@ -33,6 +33,7 @@
|
|
|
|
#include "edac/AMBEFEC.h"
|
|
|
|
#include "edac/AMBEFEC.h"
|
|
|
|
#include "edac/Golay24128.h"
|
|
|
|
#include "edac/Golay24128.h"
|
|
|
|
#include "edac/Hamming.h"
|
|
|
|
#include "edac/Hamming.h"
|
|
|
|
|
|
|
|
#include "Log.h"
|
|
|
|
#include "Utils.h"
|
|
|
|
#include "Utils.h"
|
|
|
|
|
|
|
|
|
|
|
|
using namespace edac;
|
|
|
|
using namespace edac;
|
|
|
|
@ -611,20 +612,23 @@ uint32_t AMBEFEC::measureNXDNBER(uint8_t* bytes) const
|
|
|
|
/// <param name="a"></param>
|
|
|
|
/// <param name="a"></param>
|
|
|
|
/// <param name="b"></param>
|
|
|
|
/// <param name="b"></param>
|
|
|
|
/// <param name="c"></param>
|
|
|
|
/// <param name="c"></param>
|
|
|
|
/// <param name="ignoreParity"></param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
uint32_t AMBEFEC::regenerate(uint32_t& a, uint32_t& b, uint32_t& c, bool ignoreParity) const
|
|
|
|
uint32_t AMBEFEC::regenerate(uint32_t& a, uint32_t& b, uint32_t& c) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint32_t old_a = a;
|
|
|
|
uint32_t old_a = a;
|
|
|
|
uint32_t old_b = b;
|
|
|
|
uint32_t old_b = b;
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t data;
|
|
|
|
uint32_t data;
|
|
|
|
bool valid = Golay24128::decode24128(a, data);
|
|
|
|
bool valid = Golay24128::decode24128(a, data);
|
|
|
|
if (!valid && !ignoreParity) {
|
|
|
|
if (!valid) {
|
|
|
|
|
|
|
|
uint32_t errsA = Utils::countBits32(data ^ a);
|
|
|
|
|
|
|
|
#if DEBUG_AMBEFEC
|
|
|
|
|
|
|
|
LogDebug(LOG_HOST, "AMBEFEC::regnerate() invalid A block, errsA = %u, a = %6X, b = %6X, c = %6X", errsA, a, b, c);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
a = 0xF00292U;
|
|
|
|
a = 0xF00292U;
|
|
|
|
b = 0x0E0B20U;
|
|
|
|
b = 0x0E0B20U;
|
|
|
|
c = 0x000000U;
|
|
|
|
c = 0x000000U;
|
|
|
|
return 10U; // An invalid A block gives an error count of 10
|
|
|
|
return errsA;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
a = Golay24128::encode24128(data);
|
|
|
|
a = Golay24128::encode24128(data);
|
|
|
|
@ -643,7 +647,9 @@ uint32_t AMBEFEC::regenerate(uint32_t& a, uint32_t& b, uint32_t& c, bool ignoreP
|
|
|
|
|
|
|
|
|
|
|
|
v = b ^ old_b;
|
|
|
|
v = b ^ old_b;
|
|
|
|
uint32_t errsB = Utils::countBits32(v);
|
|
|
|
uint32_t errsB = Utils::countBits32(v);
|
|
|
|
|
|
|
|
#if DEBUG_AMBEFEC
|
|
|
|
|
|
|
|
LogDebug(LOG_HOST, "AMBEFEC::regnerate() errsA = %u, a = %6X, errsB = %u, b = %6X, c = %6X", errsA, a, errsB, b, c);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
if (errsA >= 4U || ((errsA + errsB) >= 6U && errsA >= 2U)) {
|
|
|
|
if (errsA >= 4U || ((errsA + errsB) >= 6U && errsA >= 2U)) {
|
|
|
|
a = 0xF00292U;
|
|
|
|
a = 0xF00292U;
|
|
|
|
b = 0x0E0B20U;
|
|
|
|
b = 0x0E0B20U;
|
|
|
|
|