From 941d772e9fd7d430bc960475c4a10e93d97fa2e2 Mon Sep 17 00:00:00 2001 From: Bernhard Urban Date: Sun, 13 Dec 2009 23:03:35 +0100 Subject: [PATCH] nicer output; still don't work as desired :/ --- pkernel/main.c | 53 +++++++++++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/pkernel/main.c b/pkernel/main.c index 2a5cae2..a001e87 100644 --- a/pkernel/main.c +++ b/pkernel/main.c @@ -8,6 +8,15 @@ void main(void) unsigned char error = 0; unsigned char global_error = 0; unsigned int i, baseaddr; + unsigned int toflash[] = {0x9b00, + 0x0d4e, + 0xcff1, + 0x1601, + 0x9b05, + 0x04c7, + 0xc106, + 0x1656, + 0xe0fb}; //len = 9 /* Enable Clock Monitor */ CSCFG_MONCKI = 1; @@ -38,6 +47,7 @@ void main(void) Puts4(" \n\n"); Puts4("\n\n********** Welcome to FUJITSU FLASH Programming Demo **********\n"); +#if 0 i = 0; baseaddr = 0xf4000; for (; i <0x30; i+=4) { @@ -46,32 +56,35 @@ void main(void) Puts4(error == 1 ? "[success] " : "[failed] "); Puthex4(baseaddr + i, 6); } - - Puts4("Write simpleprog to 0xf4000 ... "); - error = FLASH_WriteHalfWord(0xf4000,0x9b00); - error = FLASH_WriteHalfWord(0xf4002,0x0d4e); - error = FLASH_WriteHalfWord(0xf4004,0xcff1); - error = FLASH_WriteHalfWord(0xf4006,0x1601); - error = FLASH_WriteHalfWord(0xf4008,0x9b05); - error = FLASH_WriteHalfWord(0xf4010,0x04c7); - error = FLASH_WriteHalfWord(0xf4012,0xc106); - error = FLASH_WriteHalfWord(0xf4014,0x1656); - error = FLASH_WriteHalfWord(0xf4016,0xe0fb); - if( error == 1 ) - { - Puts4("done.\n"); - } - else +#endif + i=0; + Puts4("\nCurrent Content of FLASH at 0xf4000 ... 0xf401F:\n"); + while(i < 0x20) { - global_error = 1; - Puts4("failed.\n"); + Puts4("0x"); Puthex4( *(unsigned char *)(0xf4000 + i), 2); Puts4(" "); + i++; + if( (i % 0x10) == 0 ) Puts4("\n"); } - + Puts4("\n"); + + + i = 0; + baseaddr = 0xf4000; + for(; i<9; i++) { + Puts4("\nwrite: "); + error = FLASH_WriteHalfWord(baseaddr + (2*i), toflash[i]); + Puts4(error == 1 ? "[sucess] " : "[failed] "); + Puts4("0x"); + Puthex4(toflash[i], 4); + Puts4(" @0x"); + Puthex4(baseaddr + (2*i), 6); + } + i=0; Puts4("\nCurrent Content of FLASH at 0xf4000 ... 0xf401F:\n"); while(i < 0x20) { - Puts4("0x"); Puthex4( *(unsigned char *)(0xf4000 + i), 2); Puts4(" "); + Puts4("0x"); Puthex4( *(unsigned char *)(0xf4000 + i), 2); Puts4(" "); i++; if( (i % 0x10) == 0 ) Puts4("\n"); } -- 2.25.1