/*
* YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
*
- * Copyright (C) 2002-2007 Aleph One Ltd.
+ * Copyright (C) 2002-2010 Aleph One Ltd.
* for Toby Churchill Ltd and Brightstar Engineering
*
* Created by Charles Manning <charles@aleph1.co.uk>
#include "yaffs_packedtags2.h"
#include "yportenv.h"
+#include "yaffs_trace.h"
#include "yaffs_tagsvalidity.h"
/* This code packs a set of extended tags into a binary structure for
}
-void yaffs_PackTags2(yaffs_PackedTags2 *pt, const yaffs_ExtendedTags *t)
+void yaffs_PackTags2(yaffs_PackedTags2 *pt, const yaffs_ExtendedTags *t, int tagsECC)
{
yaffs_PackTags2TagsPart(&pt->t, t);
-#ifndef YAFFS_IGNORE_TAGS_ECC
- {
- yaffs_ECCCalculateOther((unsigned char *)&pt->t,
+ if(tagsECC)
+ yaffs_ecc_calc_other((unsigned char *)&pt->t,
sizeof(yaffs_PackedTags2TagsPart),
&pt->ecc);
- }
-#endif
}
-void yaffs_UnpackTags2TagsPart(yaffs_ExtendedTags *t,
+void yaffs_unpack_tags2tags_part(yaffs_ExtendedTags *t,
yaffs_PackedTags2TagsPart *ptt)
{
memset(t, 0, sizeof(yaffs_ExtendedTags));
- yaffs_InitialiseTags(t);
+ yaffs_init_tags(t);
if (ptt->sequenceNumber != 0xFFFFFFFF) {
t->blockBad = 0;
}
-void yaffs_UnpackTags2(yaffs_ExtendedTags *t, yaffs_PackedTags2 *pt)
+void yaffs_unpack_tags2(yaffs_ExtendedTags *t, yaffs_PackedTags2 *pt, int tagsECC)
{
yaffs_ECCResult eccResult = YAFFS_ECC_RESULT_NO_ERROR;
- if (pt->t.sequenceNumber != 0xFFFFFFFF) {
- /* Page is in use */
-#ifndef YAFFS_IGNORE_TAGS_ECC
- {
- yaffs_ECCOther ecc;
- int result;
- yaffs_ECCCalculateOther((unsigned char *)&pt->t,
- sizeof
- (yaffs_PackedTags2TagsPart),
- &ecc);
- result =
- yaffs_ECCCorrectOther((unsigned char *)&pt->t,
- sizeof
- (yaffs_PackedTags2TagsPart),
- &pt->ecc, &ecc);
- switch (result) {
+ if (pt->t.sequenceNumber != 0xFFFFFFFF &&
+ tagsECC){
+ /* Chunk is in use and we need to do ECC */
+
+ yaffs_ECCOther ecc;
+ int result;
+ yaffs_ecc_calc_other((unsigned char *)&pt->t,
+ sizeof(yaffs_PackedTags2TagsPart),
+ &ecc);
+ result = yaffs_ecc_correct_other((unsigned char *)&pt->t,
+ sizeof(yaffs_PackedTags2TagsPart),
+ &pt->ecc, &ecc);
+ switch (result) {
case 0:
eccResult = YAFFS_ECC_RESULT_NO_ERROR;
break;
break;
default:
eccResult = YAFFS_ECC_RESULT_UNKNOWN;
- }
}
-#endif
}
- yaffs_UnpackTags2TagsPart(t, &pt->t);
+ yaffs_unpack_tags2tags_part(t, &pt->t);
t->eccResult = eccResult;
yaffs_DumpPackedTags2(pt);
yaffs_DumpTags2(t);
-
}