OSDN Git Service

packet loss がなぜかかなり減った
authornaruko <naruko@24ea1065-a21e-4ca1-99c9-f5125deb0858>
Mon, 14 Dec 2009 20:03:08 +0000 (20:03 +0000)
committernaruko <naruko@24ea1065-a21e-4ca1-99c9-f5125deb0858>
Mon, 14 Dec 2009 20:03:08 +0000 (20:03 +0000)
git-svn-id: svn+ssh://svn.osdn.net/svnroot/unagi@331 24ea1065-a21e-4ca1-99c9-f5125deb0858

kazzo/trunk/firmware/avr_main.c
kazzo/trunk/firmware/bus_access.c
kazzo/trunk/firmware/flashmemory.c
kazzo/trunk/firmware/kazzo_request.h
kazzo/trunk/readme.txt

index 380853f..a9e9cb3 100644 (file)
@@ -59,8 +59,8 @@ uchar usbFunctionWrite(uchar *data, uchar len)
                break;
        }
        switch(request_cpu_program.request){
-       case REQUEST_CPU_FLASH_PROGRAM:
-       case REQUEST_CPU_FLASH_CONFIG_SET:{
+       case REQUEST_FLASH_PROGRAM:
+       case REQUEST_FLASH_CONFIG_SET:{
                static uint8_t *w = cpu_buffer; //this is static pointer! be careful.
                if(request_cpu_program.offset == 0){
                        w = cpu_buffer;
@@ -70,7 +70,7 @@ uchar usbFunctionWrite(uchar *data, uchar len)
                request_cpu_program.offset += length;
                int ret = request_cpu_program.offset >= request_cpu_program.length;
                if(ret){
-                       if(request_cpu_program.request == REQUEST_CPU_FLASH_CONFIG_SET){
+                       if(request_cpu_program.request == REQUEST_FLASH_CONFIG_SET){
                                flash_config_set(cpu_buffer, flash_cpu_config);
                        }else{
                                flash_cpu_program(request_cpu_program.address, request_cpu_program.length, cpu_buffer);
@@ -82,8 +82,8 @@ uchar usbFunctionWrite(uchar *data, uchar len)
                break;
        }
        switch(request_ppu_program.request){
-       case REQUEST_PPU_FLASH_PROGRAM:
-       case REQUEST_PPU_FLASH_CONFIG_SET:{
+       case REQUEST_FLASH_PROGRAM:
+       case REQUEST_FLASH_CONFIG_SET:{
                static uint8_t *w = ppu_buffer; //static pointer
                if(request_ppu_program.offset == 0){
                        w = ppu_buffer;
@@ -93,7 +93,7 @@ uchar usbFunctionWrite(uchar *data, uchar len)
                request_ppu_program.offset += length;
                int ret = request_ppu_program.offset >= request_ppu_program.length;
                if(ret){
-                       if(request_ppu_program.request == REQUEST_PPU_FLASH_CONFIG_SET){
+                       if(request_ppu_program.request == REQUEST_FLASH_CONFIG_SET){
                                flash_config_set(ppu_buffer, flash_ppu_config);
                        }else{
                                flash_ppu_program(request_ppu_program.address, request_ppu_program.length, ppu_buffer);
@@ -143,13 +143,13 @@ usbMsgLen_t usbFunctionSetup(uchar d[8])
        case REQUEST_PPU_WRITE:
                write_command = &request_both_write;
                goto xxx_write;
-       case REQUEST_CPU_FLASH_PROGRAM:
-       case REQUEST_CPU_FLASH_CONFIG_SET:
-               write_command = &request_cpu_program;
-               goto xxx_write;
-       case REQUEST_PPU_FLASH_PROGRAM:
-       case REQUEST_PPU_FLASH_CONFIG_SET:
-               write_command = &request_ppu_program;
+       case REQUEST_FLASH_PROGRAM:
+       case REQUEST_FLASH_CONFIG_SET:
+               if(rq->wIndex.word == INDEX_CPU){
+                       write_command = &request_cpu_program;
+               }else{
+                       write_command = &request_ppu_program;
+               }
                goto xxx_write;
        xxx_write:
                write_command->request = rq->bRequest;
@@ -157,11 +157,12 @@ usbMsgLen_t usbFunctionSetup(uchar d[8])
                write_command->address = rq->wValue.word;
                write_command->offset = 0;
                return USB_NO_MSG; //goto usbFunctionWrite
-       case REQUEST_CPU_FLASH_BUFFER_GET:
-               usbMsgPtr = cpu_buffer;
-               return FLASH_PACKET_SIZE;
-       case REQUEST_PPU_FLASH_BUFFER_GET:
-               usbMsgPtr = ppu_buffer;
+       case REQUEST_FLASH_BUFFER_GET:
+               if(rq->wIndex.word == INDEX_CPU){
+                       usbMsgPtr = cpu_buffer;
+               }else{
+                       usbMsgPtr = ppu_buffer;
+               }
                return FLASH_PACKET_SIZE;
        case REQUEST_DISK_STATUS_GET:
                usbMsgPtr = status;
@@ -177,25 +178,28 @@ usbMsgLen_t usbFunctionSetup(uchar d[8])
                status[1] = flash_ppu_status();
                usbMsgPtr = status;
                return 2;
-       case REQUEST_CPU_FLASH_STATUS:
-               status[0] = flash_cpu_status();
+       case REQUEST_FLASH_STATUS:
+               if(rq->wIndex.word == INDEX_CPU){
+                       status[0] = flash_cpu_status();
+               }else{
+                       status[0] = flash_ppu_status();
+               }
                usbMsgPtr = status;
                return 1;
-       case REQUEST_PPU_FLASH_STATUS:
-               status[0] = flash_ppu_status();
+       case REQUEST_FLASH_DEVICE:
+               if(rq->wIndex.word == INDEX_CPU){
+                       flash_cpu_device_get(status);
+               }else{
+                       flash_ppu_device_get(status);
+               }
                usbMsgPtr = status;
-               return 1;
-       case REQUEST_CPU_FLASH_DEVICE:
-               flash_cpu_device_get(status);
-               return 2;
-       case REQUEST_PPU_FLASH_DEVICE:
-               flash_ppu_device_get(status);
                return 2;
-       case REQUEST_CPU_FLASH_ERASE:
-               flash_cpu_erase(rq->wValue.word);
-               return 0;
-       case REQUEST_PPU_FLASH_ERASE:
-               flash_ppu_erase(rq->wValue.word);
+       case REQUEST_FLASH_ERASE:
+               if(rq->wIndex.word == INDEX_CPU){
+                       flash_cpu_erase(rq->wValue.word);
+               }else{
+                       flash_ppu_erase(rq->wValue.word);
+               }
                return 0;
        case REQUEST_VRAM_CONNECTION:
                status[0] = vram_connection_get();
index 905a432..675a503 100644 (file)
@@ -387,7 +387,6 @@ static inline void ppu_write_waveform(uint16_t address, uint8_t data)
        address_set(address);//PPU charcter memory /CS open
        BUS_CONTROL_OUT = bit_get_negative(PPU_WR);
        DATABUS_OUT = data;
-       asm("nop"); asm("nop");
        BUS_CONTROL_OUT = BUS_CLOSE;
        address_set(0x3fff); ///CS close, use pallete area. When address bus is 0x2000-0x2fff, some cartriges enable tilemap area.
 }
index 8d45ba3..12947f3 100644 (file)
@@ -122,27 +122,14 @@ static void command_execute(const struct flash_command *c, const struct flash_se
                c++;
        }
 }
-#define COMMAND_INTERRUPT_CONTROL (0)
-#include "usbdrv.h"
 static void program(const struct flash_seqence *t)
 {
 /*     static const struct flash_command c[] = {
                {C5555, 0xaa}, {C2AAA, 0x55}, {C5555, 0xa0}, {END, 0}
        };
        command_execute(c, t);*/
-//page write device ¤Ï¤³¤³¤Ç³ä¤ê¹þ¤ß¤òÄä¤á¤ì¤Ð½ñ¤­¹þ¤ß¤¬°ÂÄꤹ¤ë¤Ï¤º¤Ê¤ó¤À¤¬¡¢ usb ¤ÎÄÌ¿®¤¬ÀÚ¤ì¤Æ¤·¤Þ¤¦
-//5 byte ¤Ê¤éÂѤ¨¤é¤ì¤ëÌÏÍÍ
-       if(COMMAND_INTERRUPT_CONTROL == 1){
-               USB_INTR_ENABLE &= ~(1<< USB_INTR_ENABLE_BIT);
-       }
        t->programmer(t->program_command);
-//     USB_INTR_ENABLE |= (1 << USB_INTR_ENABLE_BIT);
-//¤³¤ì¤Ï̵Íý
-//     USB_INTR_ENABLE &= ~(1<< USB_INTR_ENABLE_BIT);
        t->writer(t->address, t->program_unit, t->data);
-       if(COMMAND_INTERRUPT_CONTROL == 1){
-               USB_INTR_ENABLE |= (1 << USB_INTR_ENABLE_BIT);
-       }
 }
 
 static void erase(const struct flash_seqence *t)
@@ -247,9 +234,9 @@ static void process(struct flash_seqence *s)
                erase_wait(s);
                break;
        case PROGRAM:
-               //if((s->program_unit != 1) || (*(s->data) != 0xff)){
+               if((s->program_unit != 1) || (*(s->data) != 0xff)){
                        program(s);
-               //}
+               }
                s->status = TOGGLE_FIRST;
                break;
        case TOGGLE_FIRST:
index 83dd1cd..90dc668 100644 (file)
@@ -15,19 +15,19 @@ enum request{
        REQUEST_CPU_WRITE_6502, REQUEST_CPU_WRITE_FLASH,
        REQUEST_PPU_READ, REQUEST_PPU_WRITE,
        REQUEST_BOTH_FLASH_STATUS, 
-       REQUEST_CPU_FLASH_STATUS, REQUEST_CPU_FLASH_CONFIG_SET,
-       REQUEST_CPU_FLASH_PROGRAM, REQUEST_CPU_FLASH_ERASE,
-       REQUEST_CPU_FLASH_DEVICE, REQUEST_CPU_FLASH_BUFFER_GET,
-       REQUEST_PPU_FLASH_STATUS, REQUEST_PPU_FLASH_CONFIG_SET,
-       REQUEST_PPU_FLASH_PROGRAM, REQUEST_PPU_FLASH_ERASE,
-       REQUEST_PPU_FLASH_DEVICE, REQUEST_PPU_FLASH_BUFFER_GET,
+       REQUEST_FLASH_STATUS, REQUEST_FLASH_CONFIG_SET,
+       REQUEST_FLASH_PROGRAM, REQUEST_FLASH_ERASE,
+       REQUEST_FLASH_DEVICE, REQUEST_FLASH_BUFFER_GET,
        REQUEST_VRAM_CONNECTION,
 
        //future expanstion
        REQUEST_DISK_STATUS_GET, REQUEST_DISK_READ, REQUEST_DISK_WRITE
 };
+enum index{
+       INDEX_IMPLIED = 0, INDEX_CPU, INDEX_PPU, INDEX_BOTH
+};
 enum {
        READ_PACKET_SIZE = 0x0100,
-       FLASH_PACKET_SIZE = 0x0080
+       FLASH_PACKET_SIZE = 0x0100
 };
 #endif
index ea75333..76cc347 100644 (file)
@@ -18,13 +18,15 @@ firmware/
   enviroment.
 hostecho/
   source codes for kazzo_test.exe
+hostmodule/
+  module source codes for kazzo from 'unagi'
 windows_driver/
   device driver for Windows
 kazzo_test.exe
   loop back test client binary for Windows
 kazzo_mega16.hex kazzo_mega164p.hex
   firmware hex file written in S Record
-kazzo_schematics.pdf
+kazzo_schematics.pdf kazzo_schematics.png
   schematics graphic data
   notice! U1 pin number is assigned ATmega16 QFP.
 readme.txt
@@ -34,13 +36,13 @@ usbrequest.txt
 COPYING
   GPL v2 licencing document
 
-Host software 'unagi' is not included in this package. You can find 
-'unagi' from official project page.
+Host software 'unagi' is not included in this package. 'unagi's binary 
+and source codes are available from official project page.
 http://unagi.sourceforge.jp/
 
 ----AVR fusebit configuration----
-ATmega164P: low byte 0xe6, high byte 0xd9, extended byte 0xff
-  CKDIV8:1 CKOUT:1 SUT:10 CKSEL:0110
+ATmega164P: low byte 0xee, high byte 0xd9, extended byte 0xff
+  CKDIV8:1 CKOUT:1 SUT:10 CKSEL:1110
   OCDEN:1 JTAGEN:1 SPIEN:0 WDTON:1 EESAVE:1 BOOTSZ:00 BOOTRST:1
   BODLEVEL:111
 ATmega16:  low byte 0xae, high byte 0xc9