Skip to content
Snippets Groups Projects
Commit 90b7ffa1 authored by Pitchaiah Murugan's avatar Pitchaiah Murugan
Browse files

add memset and not to write ecc data on ff pages

parent f439422e
No related branches found
No related tags found
No related merge requests found
......@@ -311,7 +311,6 @@ int main(int argc, char **argv)
printf("OOB_ECC_LEN %d\n", oob_ecc_len);
printf("OOB_ECC_OFS %d\n", oob_ecc_ofs);
while (!feof(in_file))
{
......@@ -331,7 +330,8 @@ int main(int argc, char **argv)
goto exit;
}
if (numBytesRead != (sector_sz ) * SECTORS_PER_PAGE) break; // skip if byte is less than bytes read from fread api.
if (numBytesRead != (sector_sz)*SECTORS_PER_PAGE)
break; // skip if byte is less than bytes read from fread api.
memset(cmp_buffer, 0, sector_sz * SECTORS_PER_PAGE);
......@@ -341,10 +341,13 @@ int main(int argc, char **argv)
for(i=0; i < 2048; i++)
printf("0x%X\t", cmp_buffer[i]); */
for (i = 0; i != SECTORS_PER_PAGE; ++i)
for (i = 0; i < SECTOR_SZ * SECTORS_PER_PAGE; i += 4)
{
if (*(uint32_t *)(page_buffer + i) != 0xffffffff)
{
for (i = 0; i != SECTORS_PER_PAGE; ++i)
{
swap(&page_buffer[(i + 1) * sector_sz], &page_buffer[sector_sz * SECTORS_PER_PAGE + (i * oob_sz)], oob_sz);
......@@ -352,16 +355,20 @@ int main(int argc, char **argv)
encode_bch(bch, &page_buffer[i * sector_sz], sector_sz + oob_ecc_ofs, ecc);
swap(&page_buffer[(i + 1) * sector_sz], &page_buffer[sector_sz * SECTORS_PER_PAGE + (i * oob_sz)], oob_sz);
for (j = 0; j < oob_ecc_len; j++)
{
page_buffer[sector_sz * SECTORS_PER_PAGE + ((i + 1) * oob_sz) - oob_ecc_len + j] = ecc[j];
}
//page_buffer[sector_sz * SECTORS_PER_PAGE + ((i + 1) * oob_sz) - oob_ecc_len +] |= ecc[oob_ecc_len - 1] >> 4;
//fwrite(page_buffer, (sector_sz + oob_sz) * SECTORS_PER_PAGE, 1, out_file);
//goto exit;
//sector_oob[oob_ecc_ofs + oob_ecc_len - 1] |= ecc[oob_ecc_len - 1] >> 4;
}
}
break;
}
fwrite(page_buffer, (sector_sz + oob_sz) * SECTORS_PER_PAGE, 1, out_file);
......@@ -382,7 +389,6 @@ int main(int argc, char **argv)
/* printf("block No %d\r\n", blocks_num); */
blocks_num++;
}
}
exit:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment