OSDN Git Service

並行書き込みサポート
authornaruko <naruko@24ea1065-a21e-4ca1-99c9-f5125deb0858>
Sun, 1 Nov 2009 13:35:44 +0000 (13:35 +0000)
committernaruko <naruko@24ea1065-a21e-4ca1-99c9-f5125deb0858>
Sun, 1 Nov 2009 13:35:44 +0000 (13:35 +0000)
git-svn-id: svn+ssh://svn.osdn.net/svnroot/unagi@298 24ea1065-a21e-4ca1-99c9-f5125deb0858

kazzo/trunk/avr_main.c
kazzo/trunk/flashmemory.c
kazzo/trunk/request.h

index 344b3d4..f8268d3 100644 (file)
@@ -8,7 +8,7 @@
 #include "request.h"
 
 //---- global variable ----
-static struct{
+static struct write_command{
        enum request request;
        uint16_t address, length, offset;
 }write_command;
@@ -32,7 +32,11 @@ uchar usbFunctionWrite(uchar *data, uchar len)
        case REQUEST_PPU_FLASH_PROGRAM:{
                static uint8_t *w = readbuffer;
                if(write_command.offset == 0){
-                       w = readbuffer;
+                       if(write_command.request == REQUEST_CPU_FLASH_PROGRAM){
+                               w = readbuffer;
+                       }else{
+                               w = readbuffer + 0x100;
+                       }
                }
                while(len != 0){
                        *w = *data;
@@ -45,7 +49,7 @@ uchar usbFunctionWrite(uchar *data, uchar len)
                        if(write_command.request == REQUEST_CPU_FLASH_PROGRAM){
                                flash_cpu_program(write_command.address, write_command.length, readbuffer);
                        }else{
-                               flash_ppu_program(write_command.address, write_command.length, readbuffer);
+                               flash_ppu_program(write_command.address, write_command.length, readbuffer + 0x100);
                        }
                }
                }return write_command.length == write_command.offset;
@@ -141,6 +145,11 @@ usbMsgLen_t usbFunctionSetup(uchar d[8])
        case REQUEST_DISK_WRITE:
                disk_init(DISK_WRITE);
                return 0;
+       case REQUEST_BOTH_FLASH_STATUS:
+               status[0] = flash_cpu_status();
+               status[1] = flash_ppu_status();
+               usbMsgPtr = status;
+               return 2;
        case REQUEST_CPU_FLASH_STATUS:
                status[0] = flash_cpu_status();
                usbMsgPtr = status;
index 778f8ea..9fd44d5 100644 (file)
@@ -19,7 +19,7 @@ struct flash_seqence{
        uint8_t toggle;
 };
 static struct flash_seqence seqence_cpu = {
-       .status = IDLE, .reader = cpu_read, .writer = cpu_write_flash,
+       .status = IDLE, .reader = cpu_read_6502, .writer = cpu_write_flash,
        .compare = cpu_compare
 };
 static struct flash_seqence seqence_ppu = {
@@ -192,7 +192,9 @@ static void process(struct flash_seqence *s)
                erase_wait(s);
                break;
        case PROGRAM:
-               program(s);
+               if((s->program_unit != 1) || (*(s->data) != 0xff)){
+                       program(s);
+               }
                s->status = TOGGLE_FIRST;
                break;
        case TOGGLE_FIRST:
index 7fde9ab..082b9a1 100644 (file)
@@ -7,6 +7,7 @@ enum request{
        REQUEST_CPU_WRITE_6502, REQUEST_CPU_WRITE_FLASH,
        REQUEST_PPU_READ, REQUEST_PPU_WRITE,
        REQUEST_DISK_STATUS_GET, REQUEST_DISK_READ, REQUEST_DISK_WRITE,
+       REQUEST_BOTH_FLASH_STATUS,
        REQUEST_CPU_FLASH_STATUS, REQUEST_CPU_FLASH_CONFIG_SET,
        REQUEST_CPU_FLASH_PROGRAM, REQUEST_CPU_FLASH_ERASE,
        REQUEST_PPU_FLASH_STATUS, REQUEST_PPU_FLASH_CONFIG_SET,