OSDN Git Service

appened flash programming testrun
authornaruko <naruko@24ea1065-a21e-4ca1-99c9-f5125deb0858>
Fri, 15 Jan 2010 12:28:54 +0000 (12:28 +0000)
committernaruko <naruko@24ea1065-a21e-4ca1-99c9-f5125deb0858>
Fri, 15 Jan 2010 12:28:54 +0000 (12:28 +0000)
git-svn-id: svn+ssh://svn.osdn.net/svnroot/unagi@346 24ea1065-a21e-4ca1-99c9-f5125deb0858

client/trunk/anago/Makefile
client/trunk/anago/anago.c
client/trunk/anago/flash_device.c
client/trunk/anago/flashcore.nut
client/trunk/anago/reader_dummy.c
client/trunk/anago/script_flash.c
client/trunk/anago/script_flash.h

index c6af2c1..516cac7 100644 (file)
@@ -4,7 +4,7 @@ SQUIRREL = ../SQUIRREL2
 KAZZO = ../../kazzo/firmware
 VPATH = ..
 #CFLAGS = -g -O0
-CFLAGS = -O2
+CFLAGS = -O2 -DNDEBUG
 CFLAGS += -Wall -Werror -I.. -I$(LIBUSB)/include -I$(SQUIRREL)/include -I$(KAZZO) -DDEBUG=1 -DANAGO=1
 LDFLAG = -L. -L$(LIBUSB)/lib/gcc -L$(SQUIRREL)/lib
 CC = gcc
index 3f16897..f6c37c0 100644 (file)
@@ -97,6 +97,7 @@ static void program(int c, char **v)
        switch(v[1][0]){
        case 'a':
                config.reader = &DRIVER_DUMMY;
+               config.testrun = true;
                break;
        case 'F':
                config.compare = true;
index 05b7e35..50dde3e 100644 (file)
@@ -17,6 +17,7 @@ static void call(HSQUIRRELVM v, const char *devicename)
                sq_pushstring(v, _SC(devicename), -1);
                SQRESULT r = sq_call(v, 2, SQTrue, SQTrue);
                assert(r == SQ_OK);
+               r++; //avoid unused variable with -DNDEBUG
        }
 }
 static bool long_get(HSQUIRRELVM v, const char *field, long *ret)
index 988be95..2853bef 100644 (file)
@@ -22,7 +22,8 @@ function loopsize_get(t, trans, image_size, device_size)
        }
        return loop;
 }
-function program(
+
+function testrun(
        d, mapper, 
        cpu_trans, cpu_image_size, cpu_device_size,
        ppu_trans, ppu_image_size, ppu_device_size
@@ -35,13 +36,31 @@ function program(
        }
        local cpu_loop = loopsize_get(board.cpu, cpu_trans, cpu_image_size, cpu_device_size);
        local ppu_loop = loopsize_get(board.ppu, ppu_trans, ppu_image_size, ppu_device_size);
-       local co_cpu = newthread(cpu_transfer);
-       local co_ppu = newthread(ppu_transfer);
        if(board.vram_mirrorfind == true){
                vram_mirrorfind(d);
        }
        initalize(d, board.cpu.banksize, board.ppu.banksize);
        if(cpu_trans != trans_empty){
+               cpu_transfer(d, cpu_loop.start, cpu_loop.end, board.cpu.banksize);
+       }
+       if(ppu_trans != trans_empty){
+               ppu_transfer(d, ppu_loop.start, ppu_loop.end, board.ppu.banksize);
+       }
+}
+
+function program(
+       d, mapper, 
+       cpu_trans, cpu_image_size, cpu_device_size,
+       ppu_trans, ppu_image_size, ppu_device_size
+)
+{
+       local trans_empty = 0;
+       local cpu_loop = loopsize_get(board.cpu, cpu_trans, cpu_image_size, cpu_device_size);
+       local ppu_loop = loopsize_get(board.ppu, ppu_trans, ppu_image_size, ppu_device_size);
+       local co_cpu = newthread(cpu_transfer);
+       local co_ppu = newthread(ppu_transfer);
+       initalize(d, board.cpu.banksize, board.ppu.banksize);
+       if(cpu_trans != trans_empty){
                cpu_erase(d);
        }
        if(ppu_trans != trans_empty){
@@ -53,8 +72,8 @@ function program(
                co_cpu.call(d, cpu_loop.start, cpu_loop.end, board.cpu.banksize);
        }
        if(ppu_trans != trans_empty){
+               //ppu_transfer(d, ppu_loop.start, ppu_loop.end, board.ppu.banksize);
                co_ppu.call(d, ppu_loop.start, ppu_loop.end, board.ppu.banksize);
        }
        program_main(d, co_cpu, co_ppu)
 }
-
index 5eb8082..7d29457 100644 (file)
@@ -29,12 +29,14 @@ static long dummy_cpu_flash_program(long address, long length, const u8 *data, b
 {
        int i = 0x10;
        printf("%s %06x\n", __FUNCTION__, (int) address);
-       while(i != 0){
-               printf("%02x ", *data);
-               data++;
-               i--;
+       if(0){
+               while(i != 0){
+                       printf("%02x ", *data);
+                       data++;
+                       i--;
+               }
+               printf("\n");
        }
-       printf("\n");
        return 0x100;
 }
 
@@ -61,12 +63,14 @@ static long dummy_ppu_flash_program(long address, long length, const u8 *data, b
 {
        int i = 0x10;
        printf("%s %06x\n", __FUNCTION__, (int) address);
-       while(i != 0){
-               printf("%02x ", *data);
-               data++;
-               i--;
+       if(0){
+               while(i != 0){
+                       printf("%02x ", *data);
+                       data++;
+                       i--;
+               }
+               printf("\n");
        }
-       printf("\n");
        return 0x100;
 }
 
index a060b2a..5e1f8d2 100644 (file)
@@ -33,7 +33,7 @@ struct anago_driver{
        void (*const flash_status)(uint8_t s[2]);
        uint8_t (*const vram_connection)(void);
        const enum vram_mirroring vram_mirroring;
-       bool compare;
+       bool compare, testrun;
 };
 
 static SQInteger vram_mirrorfind(HSQUIRRELVM v)
@@ -288,7 +288,7 @@ static SQInteger program_main(HSQUIRRELVM v)
                                return 0;
                        }
                }
-               if(console_update == true){
+               if((console_update == true) && (d->testrun == false)){
                        progress_draw(d->order_cpu.programming.offset, d->order_cpu.programming.count, d->order_ppu.programming.offset, d->order_ppu.programming.count);
                }
        }
@@ -336,7 +336,7 @@ static SQInteger ppu_program_count(HSQUIRRELVM v)
        return program_count(v, &d->order_ppu, &range_address, &range_length);
 }
 
-static bool script_execute(HSQUIRRELVM v, struct config_flash *c, struct anago_driver *d)
+static bool script_execute(HSQUIRRELVM v, const char *function, struct config_flash *c, struct anago_driver *d)
 {
        bool ret = true;
        if(SQ_FAILED(sqstd_dofile(v, _SC("flashcore.nut"), SQFalse, SQTrue))){
@@ -347,7 +347,7 @@ static bool script_execute(HSQUIRRELVM v, struct config_flash *c, struct anago_d
                ret = false;
        }else{
                SQRESULT r = qr_call(
-                       v, "program", (SQUserPointer) d, true, 
+                       v, function, (SQUserPointer) d, true, 
                        1 + 3 * 2, c->rom.mappernum, 
                        d->order_cpu.memory->transtype, d->order_cpu.memory->size, d->order_cpu.device->capacity,
                        d->order_ppu.memory->transtype, d->order_ppu.memory->size, d->order_ppu.device->capacity
@@ -393,7 +393,8 @@ void script_flash_execute(struct config_flash *c)
                .flash_status = c->reader->flash_status,
                .vram_connection = c->reader->vram_connection,
                .vram_mirroring = c->rom.mirror,
-               .compare = c->compare
+               .compare = c->compare,
+               .testrun = c->testrun
        };
        {
                static const char *functionname[] = {
@@ -413,7 +414,7 @@ void script_flash_execute(struct config_flash *c)
                qr_function_register_global(v, "ppu_command", ppu_command);
                qr_function_register_global(v, "vram_mirrorfind", vram_mirrorfind);
                
-               if(script_execute(v, c, &d) == false){
+               if(script_execute(v, "testrun", c, &d) == false){
                        qr_close(v);
                        return;
                }
@@ -444,7 +445,7 @@ void script_flash_execute(struct config_flash *c)
                qr_function_register_global(v, "program_main", program_main);
                qr_function_register_global(v, "erase_wait", erase_wait);
                qr_function_register_global(v, "vram_mirrorfind", script_nop);
-               script_execute(v, c, &d);
+               script_execute(v, "program", c, &d);
                qr_close(v);
        }
 }
index 7d1775b..e1d24c5 100644 (file)
@@ -5,7 +5,7 @@ struct config_flash{
        struct flash_device flash_cpu, flash_ppu;
        const struct reader_driver *reader;
        struct romimage rom;
-       bool compare;
+       bool compare, testrun;
 };
 void script_flash_execute(struct config_flash *c);
 #endif