mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-14 00:17:39 +00:00
Usb serial (#1648)
* enabled usb clock * added usb stack to application * fixed pll0usb clock setup * implemented serial usb handshake * implemented serial communication * integrated chibios shell * implemented device reset * implemented enter dfu mode * implemented hackrf mode command * implemented flash command * implemented memory manipulation * implemented button control * fixed mode change * improved reset behavior * implemented directory commands * implemented file commands * improved data communication * refactorings
This commit is contained in:
@@ -58,6 +58,8 @@ int main() {
|
||||
|
||||
f_close(&firmware_file);
|
||||
|
||||
LPC_RGU->RESET_CTRL[0] = (1 << 0);
|
||||
|
||||
while (1)
|
||||
__WFE();
|
||||
|
||||
|
@@ -22,6 +22,9 @@
|
||||
|
||||
#include "scsi.h"
|
||||
#include "diskio.h"
|
||||
#include <libopencm3/lpc43xx/scu.h>
|
||||
#include <libopencm3/lpc43xx/rgu.h>
|
||||
#include <libopencm3/lpc43xx/wwdt.h>
|
||||
|
||||
volatile bool usb_bulk_block_done = false;
|
||||
|
||||
@@ -281,6 +284,17 @@ void scsi_command(msd_cbw_t* msd_cbw_data) {
|
||||
case SCSI_CMD_VERIFY_10:
|
||||
status = 0;
|
||||
break;
|
||||
|
||||
case SCSI_CMD_START_STOP_UNIT:
|
||||
SCU_SFSP2_8 = (SCU_SFSP2_8 & ~(7)) | 4;
|
||||
struct gpio_t dfu = GPIO(5, 7);
|
||||
gpio_output(&dfu);
|
||||
gpio_clear(&dfu);
|
||||
|
||||
delay(50 * 40800);
|
||||
|
||||
RESET_CTRL0 = (1 << 0);
|
||||
break;
|
||||
}
|
||||
|
||||
usb_send_csw(msd_cbw_data, status);
|
||||
|
@@ -36,7 +36,7 @@ usb_request_status_t report_max_lun(
|
||||
1,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
} else if (stage == USB_TRANSFER_STAGE_DATA) {
|
||||
usb_transfer_schedule_ack(endpoint->out);
|
||||
|
||||
scsi_running = true;
|
||||
|
Reference in New Issue
Block a user