mirror of
https://github.com/fail0verflow/mini.git
synced 2024-11-24 20:26:55 +01:00
correct ECC for pages read via IPC
This commit is contained in:
parent
1d66f36578
commit
5811742c07
3
nand.c
3
nand.c
@ -74,6 +74,7 @@ static u8 ipc_data[PAGE_SIZE] MEM2_BSS ALIGNED(32);
|
|||||||
static u8 ipc_ecc[ECC_BUFFER_ALLOC] MEM2_BSS ALIGNED(128); //128 alignment REQUIRED
|
static u8 ipc_ecc[ECC_BUFFER_ALLOC] MEM2_BSS ALIGNED(128); //128 alignment REQUIRED
|
||||||
|
|
||||||
static volatile int irq_flag;
|
static volatile int irq_flag;
|
||||||
|
static u32 last_page_read = 0;
|
||||||
|
|
||||||
void nand_irq(void)
|
void nand_irq(void)
|
||||||
{
|
{
|
||||||
@ -95,6 +96,7 @@ void nand_irq(void)
|
|||||||
dc_flushrange((void*)current_request.args[0], 0x40);
|
dc_flushrange((void*)current_request.args[0], 0x40);
|
||||||
break;
|
break;
|
||||||
case IPC_NAND_READ:
|
case IPC_NAND_READ:
|
||||||
|
err = nand_correct(last_page_read, ipc_data, ipc_ecc);
|
||||||
memcpy32((void*)current_request.args[1], ipc_data, PAGE_SIZE);
|
memcpy32((void*)current_request.args[1], ipc_data, PAGE_SIZE);
|
||||||
memcpy32((void*)current_request.args[2], ipc_ecc, ECC_BUFFER_SIZE);
|
memcpy32((void*)current_request.args[2], ipc_ecc, ECC_BUFFER_SIZE);
|
||||||
dc_flushrange((void*)current_request.args[1], PAGE_SIZE);
|
dc_flushrange((void*)current_request.args[1], PAGE_SIZE);
|
||||||
@ -181,6 +183,7 @@ void nand_get_status(u8 *status_buf) {
|
|||||||
|
|
||||||
void nand_read_page(u32 pageno, void *data, void *ecc) {
|
void nand_read_page(u32 pageno, void *data, void *ecc) {
|
||||||
irq_flag = 0;
|
irq_flag = 0;
|
||||||
|
last_page_read = pageno; // needed for error reporting
|
||||||
__nand_set_address(0, pageno);
|
__nand_set_address(0, pageno);
|
||||||
nand_send_command(NAND_READ_PRE, 0x1f, 0, 0);
|
nand_send_command(NAND_READ_PRE, 0x1f, 0, 0);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user