Browse Source

Implement reset and echo requests

pull/5/head
Raphael Assenat 3 years ago
parent
commit
2d3795c29a
6 changed files with 31 additions and 1 deletions
  1. +13
    -1
      bootloader.c
  2. +5
    -0
      bootloader.h
  3. +4
    -0
      changelog.txt
  4. +7
    -0
      hiddata.c
  5. +1
    -0
      requests.h
  6. +1
    -0
      tools/.gitignore

+ 13
- 1
bootloader.c 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");
}

+ 5
- 0
bootloader.h View File

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

+ 4
- 0
changelog.txt 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)


+ 7
- 0
hiddata.c 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[]


+ 1
- 0
requests.h 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
- 0
tools/.gitignore View File

@ -0,0 +1 @@
gcn64ctl

Loading…
Cancel
Save