From ed479d2a8728dc12f1f78170cacfaf542cd0b44e Mon Sep 17 00:00:00 2001 From: Sean Nelson Date: Wed, 24 Mar 2010 23:14:32 +0000 Subject: Convert chips' message printing to msg_c* Fixed suggestions by Carl-Daniel Corresponding to flashrom svn r982. Signed-off-by: Sean Nelson Acked-by: Carl-Daniel Hailfinger --- stm50flw0x0x.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'stm50flw0x0x.c') diff --git a/stm50flw0x0x.c b/stm50flw0x0x.c index 3300969..8a00308 100644 --- a/stm50flw0x0x.c +++ b/stm50flw0x0x.c @@ -61,19 +61,19 @@ int unlock_block_stm50flw0x0x(struct flashchip *flash, int offset) // unlock each 4k-sector for (j = 0; j < 0x10000; j += 0x1000) { - printf_debug("unlocking at 0x%x\n", offset + j); + msg_cdbg("unlocking at 0x%x\n", offset + j); chip_writeb(unlock_sector, wrprotect + offset + j); if (chip_readb(wrprotect + offset + j) != unlock_sector) { - printf("Cannot unlock sector @ 0x%x\n", + msg_cerr("Cannot unlock sector @ 0x%x\n", offset + j); return -1; } } } else { - printf_debug("unlocking at 0x%x\n", offset); + msg_cdbg("unlocking at 0x%x\n", offset); chip_writeb(unlock_sector, wrprotect + offset); if (chip_readb(wrprotect + offset) != unlock_sector) { - printf("Cannot unlock sector @ 0x%x\n", offset); + msg_cerr("Cannot unlock sector @ 0x%x\n", offset); return -1; } } @@ -87,7 +87,7 @@ int unlock_stm50flw0x0x(struct flashchip *flash) for (i = 0; i < flash->total_size * 1024; i+= flash->page_size) { if(unlock_block_stm50flw0x0x(flash, i)) { - fprintf(stderr, "UNLOCK FAILED!\n"); + msg_cerr("UNLOCK FAILED!\n"); return -1; } } @@ -101,7 +101,7 @@ int erase_sector_stm50flw0x0x(struct flashchip *flash, unsigned int sector, unsi // clear status register chip_writeb(0x50, bios); - printf_debug("Erase at 0x%lx\n", bios); + msg_cdbg("Erase at 0x%lx\n", bios); // now start it chip_writeb(0x32, bios); chip_writeb(0xd0, bios); @@ -110,10 +110,10 @@ int erase_sector_stm50flw0x0x(struct flashchip *flash, unsigned int sector, unsi wait_82802ab(flash->virtual_memory); if (check_erased_range(flash, sector, sectorsize)) { - fprintf(stderr, "ERASE FAILED!\n"); + msg_cerr("ERASE FAILED!\n"); return -1; } - printf("DONE BLOCK 0x%x\n", sector); + msg_cinfo("DONE BLOCK 0x%x\n", sector); return 0; } @@ -130,21 +130,20 @@ int erase_chip_stm50flw0x0x(struct flashchip *flash, unsigned int addr, unsigned return -1; } - printf("Erasing page:\n"); + msg_cinfo("Erasing page:\n"); for (i = 0; i < total_size / page_size; i++) { - printf - ("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); - printf("%04d at address: 0x%08x ", i, i * page_size); + msg_cinfo("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); + msg_cinfo("%04d at address: 0x%08x ", i, i * page_size); //if (unlock_block_stm50flw0x0x(flash, i * page_size)) { - // fprintf(stderr, "UNLOCK FAILED!\n"); + // msg_cerr("UNLOCK FAILED!\n"); // return -1; //} if (erase_block_82802ab(flash, i * page_size, page_size)) { - fprintf(stderr, "ERASE FAILED!\n"); + msg_cerr("ERASE FAILED!\n"); return -1; } } - printf("\n"); + msg_cinfo("\n"); return 0; } -- cgit v1.1