mini/nand.h

46 lines
1.2 KiB
C
Raw Permalink Normal View History

/*
mini - a Free Software replacement for the Nintendo/BroadOn IOS.
2009-05-11 07:53:16 +02:00
low-level NAND support
Copyright (C) 2008, 2009 Hector Martin "marcan" <marcan@marcansoft.com>
2009-04-13 23:13:51 +02:00
Copyright (C) 2008, 2009 Sven Peter <svenpeter@gmail.com>
2009-05-11 07:53:16 +02:00
# This code is licensed to you under the terms of the GNU GPL, version 2;
# see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
*/
2009-05-11 07:53:16 +02:00
#ifndef __NAND_H__
#define __NAND_H__
#include "types.h"
#include "ipc.h"
2009-05-11 08:36:36 +02:00
#define PAGE_SIZE 2048
2009-03-18 18:18:14 +01:00
#define PAGE_SPARE_SIZE 64
#define ECC_BUFFER_SIZE (PAGE_SPARE_SIZE+16)
#define ECC_BUFFER_ALLOC (PAGE_SPARE_SIZE+32)
2009-05-11 08:36:36 +02:00
#define BLOCK_SIZE 64
2009-03-18 18:18:14 +01:00
#define NAND_MAX_PAGE 0x40000
void nand_irq(void);
void nand_send_command(u32 command, u32 bitmask, u32 flags, u32 num_bytes);
int nand_reset(void);
void nand_get_id(u8 *);
void nand_get_status(u8 *);
void nand_read_page(u32 pageno, void *data, void *ecc);
void nand_write_page(u32 pageno, void *data, void *ecc);
void nand_erase_block(u32 pageno);
void nand_wait(void);
#define NAND_ECC_OK 0
#define NAND_ECC_CORRECTED 1
#define NAND_ECC_UNCORRECTABLE -1
int nand_correct(u32 pageno, void *data, void *ecc);
2009-05-11 08:36:36 +02:00
void nand_initialize(void);
void nand_ipc(volatile ipc_request *req);
#endif
2009-04-13 22:13:45 +02:00