mirror of
https://github.com/fail0verflow/mini.git
synced 2024-11-16 08:29:25 +01:00
formatting fixes
This commit is contained in:
parent
49660bd39f
commit
b23b1890dd
30
nand.c
30
nand.c
@ -125,7 +125,7 @@ int nand_reset(void)
|
|||||||
void nand_get_id(u8 *idbuf) {
|
void nand_get_id(u8 *idbuf) {
|
||||||
__nand_set_address(0,0);
|
__nand_set_address(0,0);
|
||||||
|
|
||||||
dc_invalidaterange(idbuf, 0x40);
|
dc_invalidaterange(idbuf, 0x40);
|
||||||
|
|
||||||
__nand_setup_dma(idbuf, (u8 *)-1);
|
__nand_setup_dma(idbuf, (u8 *)-1);
|
||||||
nand_send_command(NAND_CHIPID, 1, NAND_FLAGS_IRQ | NAND_FLAGS_RD, 0x40);
|
nand_send_command(NAND_CHIPID, 1, NAND_FLAGS_IRQ | NAND_FLAGS_RD, 0x40);
|
||||||
@ -139,15 +139,15 @@ 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) {
|
||||||
NAND_debug("nand_read_page(%u, %p, %p)\n", pageno, data, ecc);
|
NAND_debug("nand_read_page(%u, %p, %p)\n", pageno, data, ecc);
|
||||||
__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);
|
||||||
|
|
||||||
dc_invalidaterange(data, 0x800);
|
dc_invalidaterange(data, 0x800);
|
||||||
dc_invalidaterange(ecc, 0x50);
|
dc_invalidaterange(ecc, 0x50);
|
||||||
|
|
||||||
__nand_setup_dma(data, ecc);
|
__nand_setup_dma(data, ecc);
|
||||||
nand_send_command(NAND_READ_POST, 0, NAND_FLAGS_IRQ | NAND_FLAGS_WAIT | NAND_FLAGS_RD | NAND_FLAGS_ECC, 0x840);
|
nand_send_command(NAND_READ_POST, 0, NAND_FLAGS_IRQ | NAND_FLAGS_WAIT | NAND_FLAGS_RD | NAND_FLAGS_ECC, 0x840);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nand_wait() {
|
void nand_wait() {
|
||||||
@ -158,8 +158,8 @@ void nand_wait() {
|
|||||||
void nand_write_page(u32 pageno, void *data, void *ecc) {
|
void nand_write_page(u32 pageno, void *data, void *ecc) {
|
||||||
NAND_debug("nand_write_page(%u, %p, %p)\n", pageno, data, ecc);
|
NAND_debug("nand_write_page(%u, %p, %p)\n", pageno, data, ecc);
|
||||||
if ((pageno < 0x200) || (pageno >= NAND_PAGE_MAX)) {
|
if ((pageno < 0x200) || (pageno >= NAND_PAGE_MAX)) {
|
||||||
printf("Error: nand_write to page %d forbidden\n", pageno);
|
printf("Error: nand_write to page %d forbidden\n", pageno);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dc_flushrange(data, 0x800);
|
dc_flushrange(data, 0x800);
|
||||||
dc_flushrange(ecc, 0x40);
|
dc_flushrange(ecc, 0x40);
|
||||||
@ -173,13 +173,13 @@ void nand_write_page(u32 pageno, void *data, void *ecc) {
|
|||||||
|
|
||||||
#ifdef NAND_SUPPORT_ERASE
|
#ifdef NAND_SUPPORT_ERASE
|
||||||
void nand_erase_block(u32 pageno) {
|
void nand_erase_block(u32 pageno) {
|
||||||
NAND_debug("nand_erase_block(%d)\n", pageno);
|
NAND_debug("nand_erase_block(%d)\n", pageno);
|
||||||
if ((pageno < 0x200) || (pageno >= NAND_PAGE_MAX)) {
|
if ((pageno < 0x200) || (pageno >= NAND_PAGE_MAX)) {
|
||||||
printf("Error: nand_erase to page %d forbidden\n", pageno);
|
printf("Error: nand_erase to page %d forbidden\n", pageno);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
__nand_set_address(0, pageno);
|
__nand_set_address(0, pageno);
|
||||||
nand_send_command(NAND_ERASE_PRE, 0x1c, 0, 0);
|
nand_send_command(NAND_ERASE_PRE, 0x1c, 0, 0);
|
||||||
nand_send_command(NAND_ERASE_POST, 0, NAND_FLAGS_IRQ | NAND_FLAGS_WAIT, 0);
|
nand_send_command(NAND_ERASE_POST, 0, NAND_FLAGS_IRQ | NAND_FLAGS_WAIT, 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user