Implement reset and echo requests

This commit is contained in:
Raphael Assenat 2018-09-05 10:42:05 -04:00
parent b01df9f239
commit 2d3795c29a
6 changed files with 32 additions and 2 deletions

View File

@ -1,5 +1,5 @@
/* gc_n64_usb : Gamecube or N64 controller to USB adapter firmware
Copyright (C) 2007-2016 Raphael Assenat <raph@raphnet.net>
Copyright (C) 2007-2018 Raphael Assenat <raph@raphnet.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,6 +16,7 @@
*/
#include <avr/io.h>
#include "usb.h"
#include "bootloader.h"
void enterBootLoader(void)
{
@ -28,5 +29,16 @@ void enterBootLoader(void)
"ldi r30, 0x00 \n" // ZL
"ldi r31, 0xF0 \n" // ZH
"ijmp");
}
void resetFirmware(void)
{
usb_shutdown();
// jump to the application reset vector
asm volatile(
"cli \n"
"ldi r30, 0x00 \n"
"ldi r31, 0x00 \n"
"ijmp");
}

View File

@ -1,2 +1,7 @@
#ifndef _bootloader_h__
#define _bootloader_h__
void enterBootLoader(void);
void resetFirmware(void);
#endif // _bootloader_h__

View File

@ -1,3 +1,7 @@
- ??? : Version 3.5.2
- Implement reset firmware command
- Add echo feature (USB comm test)
- April 10, 2018 : Version 3.5.1
- Fix never-stopping vibration issues (Dolphin)

View File

@ -134,9 +134,16 @@ static void hiddata_processCommandBuffer(struct hiddata_ops *ops)
// printf("Process cmd 0x%02x\r\n", cmdbuf[0]);
switch(cmdbuf[0])
{
case RQ_GCN64_ECHO:
// Cmd : RQ, data[]
// Answer: RQ, data[]
break;
case RQ_GCN64_JUMP_TO_BOOTLOADER:
enterBootLoader();
break;
case RQ_RNT_RESET_FIRMWARE:
resetFirmware();
break;
case RQ_GCN64_RAW_SI_COMMAND:
// TODO : Range checking
// cmdbuf[] : RQ, CHN, LEN, data[]

View File

@ -2,6 +2,7 @@
#define _gcn64_requests_h__
/* Commands */
#define RQ_GCN64_ECHO 0x00
#define RQ_GCN64_SET_CONFIG_PARAM 0x01
#define RQ_GCN64_GET_CONFIG_PARAM 0x02
#define RQ_GCN64_SUSPEND_POLLING 0x03

1
tools/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
gcn64ctl