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;
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);
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;
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);
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;
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;
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();
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)
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:
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
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
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