Hardware USB Gecko Serial Protocol

gudenau

Largely ignored
OP
Member
Joined
Jul 7, 2010
Messages
3,882
Trophies
2
Location
/dev/random
Website
www.gudenau.net
XP
5,379
Country
United States
I have been having a hard time figuring out the protocol, I can get one bhte commands working but that is about it. The gecko.net source is a little confusing, as well as the code handler's; then the wiki has what I was able to figure out myself.

Any help?
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
When you say wiki do you mean http://wiibrew.org/wiki/USB_Gecko ?
The PDF link on that does not work but still seems available on http://www.furmans.com.ua/drivers/D2XXPG34.pdf

Afraid I never went far with the USB gecko so I am not sure what I can do from memory. I also have to go do something so sitting here and puzzling things out is not what I am going to be able to sit here and do

http://geckowii.googlecode.com/svn/trunk/GeckoDotNET/Gecko dNet/USBGecko.cs
Code seems to be GPL v2
Code:
    public class USBGecko
    {
        #if DIRECT
            #if MONO
                private LFTDI PFTDI;
            #else  
                private D2XXWrapper PFTDI;
            #endif
        #else   
            private FTDI PFTDI;
        #endif

        #region base constants
        private const UInt32    packetsize = 0xF800;
        private const UInt32 uplpacketsize = 0xF80;

        private const Byte      cmd_poke08 = 0x01;
        private const Byte      cmd_poke16 = 0x02;
        private const Byte     cmd_pokemem = 0x03;
        private const Byte     cmd_readmem = 0x04;
        private const Byte       cmd_pause = 0x06;
        private const Byte    cmd_unfreeze = 0x07;
        private const Byte  cmd_breakpoint = 0x09;
        private const Byte cmd_breakpointx = 0x10;
        private const Byte    cmd_sendregs = 0x2F;
        private const Byte     cmd_getregs = 0x30;
        private const Byte    cmd_cancelbp = 0x38;
        private const Byte  cmd_sendcheats = 0x40;
        private const Byte      cmd_upload = 0x41;
        private const Byte        cmd_hook = 0x42;
        private const Byte   cmd_hookpause = 0x43;
        private const Byte        cmd_step = 0x44;
        private const Byte      cmd_status = 0x50;
        private const Byte   cmd_cheatexec = 0x60;
        private const Byte cmd_nbreakpoint = 0x89;
        private const Byte     cmd_version = 0x99;

        private const Byte         GCBPHit = 0x11;
        private const Byte           GCACK = 0xAA;
        private const Byte         GCRETRY = 0xBB;
        private const Byte          GCFAIL = 0xCC;
        private const Byte          GCDONE = 0xFF;

        private const Byte        GCNewVer = 0x80;

        private static readonly Byte[] GCAllowedVersions = new Byte[] { GCNewVer };

        private const Byte       BPExecute = 0x03;
        private const Byte          BPRead = 0x05;
        private const Byte         BPWrite = 0x06;
        private const Byte     BPReadWrite = 0x07;
        #endregion

        private event GeckoProgress PChunkUpdate;

        public event GeckoProgress chunkUpdate
        {
            add
            {
                PChunkUpdate += value;
            }
            remove
            {
                PChunkUpdate -= value;
            }
        }

        private bool PConnected;

        public bool connected
        {
            get
            {
                return PConnected;
            }
        }

        private bool PCancelDump;

        public bool CancelDump
        {
            get
            {
                return PCancelDump;
            }
            set
            {
                PCancelDump = value;
            }
        }

        public USBGecko()
        {
            #if DIRECT
                #if MONO
                    PFTDI = new LFTDI();
                #else
                    PFTDI = new D2XXWrapper();
                #endif
            #else   
                PFTDI = new FTDI();
            #endif
            PConnected = false;
            PChunkUpdate = null;
        }

        ~ USBGecko()
        {
            if (PConnected)
                Disconnect();
        }

        protected bool InitGecko()
        {
          UInt32 FT_PURGE_RX = 1;
            UInt32 FT_PURGE_TX = 2;

            FT_STATUS ftStatus = FT_STATUS.FT_OK;
            //Reset device
            ftStatus = PFTDI.ResetDevice();
         if (ftStatus != FT_STATUS.FT_OK)
            {
                Disconnect();
                throw new EUSBGeckoException(EUSBErrorCode.FTDIResetError);
            }
            //Purge RX buffers
            ftStatus = PFTDI.Purge(FT_PURGE_RX);
        if (ftStatus != FT_STATUS.FT_OK)
            {
                Disconnect();
                throw new EUSBGeckoException(EUSBErrorCode.FTDIPurgeRxError);
            }
            //Purge TX buffers
            ftStatus = PFTDI.Purge(FT_PURGE_TX);
       if (ftStatus != FT_STATUS.FT_OK)
            {
                Disconnect();
                throw new EUSBGeckoException(EUSBErrorCode.FTDIPurgeTxError);
            }

            return true;
        }

From the wiibrew link above, not a full breakdown but a decent start
Code:
01 [4 bytes address] [4 bytes data] = Write a byte to memory
02 [4 bytes address] [4 bytes data] = Write a word (16 bits) to memory
03 [4 bytes address] [4 bytes data] = Write a double word (32 bits) to memory
04 [4 bytes high addr] [4 bytes low addr] = Read bytes from memory
06 = Freeze program
07 = Unfreeze program
08 = Resume program, but remain frozen (single frame advance)
NOTE THIS IS A WORK IN PROGRESS
09 [data] = Breakpoints (ibp)
10 [data] = Breakpoints (dbp)
2f [data] = upbpdata
30 [data?] = getbpdata
38 [data] = cancelbreakpoints
40 [data] = sendcheats
41 [data] = uploadcode
44 [data] = breakpoints (step)
50 [data] = pausestatus
60 [data] = executecodes
89 [data] = breakpoints (aligned dbp)
99 [data] = versionnumber
 

gudenau

Largely ignored
OP
Member
Joined
Jul 7, 2010
Messages
3,882
Trophies
2
Location
/dev/random
Website
www.gudenau.net
XP
5,379
Country
United States
When you say wiki do you mean http://wiibrew.org/wiki/USB_Gecko ?
The PDF link on that does not work but still seems available on http://www.furmans.com.ua/drivers/D2XXPG34.pdf

Afraid I never went far with the USB gecko so I am not sure what I can do from memory. I also have to go do something so sitting here and puzzling things out is not what I am going to be able to sit here and do

http://geckowii.googlecode.com/svn/trunk/GeckoDotNET/Gecko dNet/USBGecko.cs
Code seems to be GPL v2
Code:
    public class USBGecko
    {
        #if DIRECT
            #if MONO
                private LFTDI PFTDI;
            #else 
                private D2XXWrapper PFTDI;
            #endif
        #else  
            private FTDI PFTDI;
        #endif

        #region base constants
        private const UInt32    packetsize = 0xF800;
        private const UInt32 uplpacketsize = 0xF80;

        private const Byte      cmd_poke08 = 0x01;
        private const Byte      cmd_poke16 = 0x02;
        private const Byte     cmd_pokemem = 0x03;
        private const Byte     cmd_readmem = 0x04;
        private const Byte       cmd_pause = 0x06;
        private const Byte    cmd_unfreeze = 0x07;
        private const Byte  cmd_breakpoint = 0x09;
        private const Byte cmd_breakpointx = 0x10;
        private const Byte    cmd_sendregs = 0x2F;
        private const Byte     cmd_getregs = 0x30;
        private const Byte    cmd_cancelbp = 0x38;
        private const Byte  cmd_sendcheats = 0x40;
        private const Byte      cmd_upload = 0x41;
        private const Byte        cmd_hook = 0x42;
        private const Byte   cmd_hookpause = 0x43;
        private const Byte        cmd_step = 0x44;
        private const Byte      cmd_status = 0x50;
        private const Byte   cmd_cheatexec = 0x60;
        private const Byte cmd_nbreakpoint = 0x89;
        private const Byte     cmd_version = 0x99;

        private const Byte         GCBPHit = 0x11;
        private const Byte           GCACK = 0xAA;
        private const Byte         GCRETRY = 0xBB;
        private const Byte          GCFAIL = 0xCC;
        private const Byte          GCDONE = 0xFF;

        private const Byte        GCNewVer = 0x80;

        private static readonly Byte[] GCAllowedVersions = new Byte[] { GCNewVer };

        private const Byte       BPExecute = 0x03;
        private const Byte          BPRead = 0x05;
        private const Byte         BPWrite = 0x06;
        private const Byte     BPReadWrite = 0x07;
        #endregion

        private event GeckoProgress PChunkUpdate;

        public event GeckoProgress chunkUpdate
        {
            add
            {
                PChunkUpdate += value;
            }
            remove
            {
                PChunkUpdate -= value;
            }
        }

        private bool PConnected;

        public bool connected
        {
            get
            {
                return PConnected;
            }
        }

        private bool PCancelDump;

        public bool CancelDump
        {
            get
            {
                return PCancelDump;
            }
            set
            {
                PCancelDump = value;
            }
        }

        public USBGecko()
        {
            #if DIRECT
                #if MONO
                    PFTDI = new LFTDI();
                #else
                    PFTDI = new D2XXWrapper();
                #endif
            #else  
                PFTDI = new FTDI();
            #endif
            PConnected = false;
            PChunkUpdate = null;
        }

        ~ USBGecko()
        {
            if (PConnected)
                Disconnect();
        }

        protected bool InitGecko()
        {
          UInt32 FT_PURGE_RX = 1;
            UInt32 FT_PURGE_TX = 2;

            FT_STATUS ftStatus = FT_STATUS.FT_OK;
            //Reset device
            ftStatus = PFTDI.ResetDevice();
         if (ftStatus != FT_STATUS.FT_OK)
            {
                Disconnect();
                throw new EUSBGeckoException(EUSBErrorCode.FTDIResetError);
            }
            //Purge RX buffers
            ftStatus = PFTDI.Purge(FT_PURGE_RX);
        if (ftStatus != FT_STATUS.FT_OK)
            {
                Disconnect();
                throw new EUSBGeckoException(EUSBErrorCode.FTDIPurgeRxError);
            }
            //Purge TX buffers
            ftStatus = PFTDI.Purge(FT_PURGE_TX);
       if (ftStatus != FT_STATUS.FT_OK)
            {
                Disconnect();
                throw new EUSBGeckoException(EUSBErrorCode.FTDIPurgeTxError);
            }

            return true;
        }

From the wiibrew link above, not a full breakdown but a decent start
I got that stuff, I am trying to use read block command, but all I get back is ACKs.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    OctoAori20 @ OctoAori20: Nice nice-