mirror of
https://github.com/RfidResearchGroup/mayhem-firmware.git
synced 2026-05-12 11:27:21 -07:00
Replace hackrf submodule (#2404)
* replaced hackrf submodule * updated hackrf submodule * replaced hackrf overlay with mayhem fork
This commit is contained in:
+1
-1
@@ -1,3 +1,3 @@
|
||||
[submodule "hackrf"]
|
||||
path = hackrf
|
||||
url = https://github.com/mossmann/hackrf.git
|
||||
url = https://github.com/portapack-mayhem/hackrf.git
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ message("Building version: ${VERSION} MD5: ${VERSION_MD5}")
|
||||
set(LICENSE_PATH ${CMAKE_CURRENT_LIST_DIR}/LICENSE)
|
||||
set(HARDWARE_PATH ${CMAKE_CURRENT_LIST_DIR}/hardware)
|
||||
|
||||
add_subdirectory(hackrf-portapack)
|
||||
add_subdirectory(hackrf/firmware)
|
||||
|
||||
set(HACKRF_FIRMWARE_DFU_FILENAME hackrf_usb.dfu)
|
||||
set(HACKRF_FIRMWARE_BIN_FILENAME hackrf_usb_ram.bin)
|
||||
|
||||
+1
-1
Submodule hackrf updated: d4ed8474e5...ce76699e91
@@ -1,93 +0,0 @@
|
||||
# Copyright 2012 Jared Boone <jared@sharebrained.com>
|
||||
#
|
||||
# This file is part of HackRF.
|
||||
#
|
||||
# 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
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
set(CMAKE_TOOLCHAIN_FILE ../toolchain-arm-cortex-m.cmake)
|
||||
|
||||
project(hackrf_usb C)
|
||||
|
||||
include(../hackrf/firmware/hackrf-common.cmake)
|
||||
|
||||
set(PATH_HACKRF_USB ../hackrf/firmware/hackrf_usb)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${PATH_HACKRF_CPLD_DATA_C}
|
||||
COMMAND ${PATH_CPLD_BITSTREAM_TOOL} --xsvf ${PATH_HACKRF_CPLD_XSVF} --hackrf-data ${PATH_HACKRF_CPLD_DATA_C}
|
||||
DEPENDS ${PATH_CPLD_BITSTREAM_TOOL} ${PATH_HACKRF_CPLD_XSVF}
|
||||
)
|
||||
|
||||
set(SRC_M4
|
||||
${PATH_HACKRF_USB}/hackrf_usb.c
|
||||
"${PATH_HACKRF_FIRMWARE_COMMON}/tuning.c"
|
||||
"${PATH_HACKRF_FIRMWARE_COMMON}/streaming.c"
|
||||
"${PATH_HACKRF_FIRMWARE_COMMON}/usb.c"
|
||||
"${PATH_HACKRF_FIRMWARE_COMMON}/usb_request.c"
|
||||
"${PATH_HACKRF_FIRMWARE_COMMON}/usb_standard_request.c"
|
||||
${PATH_HACKRF_USB}/usb_descriptor.c
|
||||
${PATH_HACKRF_USB}/usb_device.c
|
||||
${PATH_HACKRF_USB}/usb_endpoint.c
|
||||
${PATH_HACKRF_USB}/usb_api_cpld.c
|
||||
${PATH_HACKRF_USB}/usb_api_m0_state.c
|
||||
${PATH_HACKRF_USB}/usb_api_register.c
|
||||
${PATH_HACKRF_USB}/usb_api_spiflash.c
|
||||
${PATH_HACKRF_USB}/usb_api_transceiver.c
|
||||
${PATH_HACKRF_USB}/usb_api_operacake.c
|
||||
${PATH_HACKRF_USB}/usb_api_sweep.c
|
||||
${PATH_HACKRF_USB}/usb_api_ui.c
|
||||
"${PATH_HACKRF_FIRMWARE_COMMON}/usb_queue.c"
|
||||
"${PATH_HACKRF_FIRMWARE_COMMON}/fault_handler.c"
|
||||
"${PATH_HACKRF_FIRMWARE_COMMON}/cpld_jtag.c"
|
||||
"${PATH_HACKRF_FIRMWARE_COMMON}/cpld_xc2c.c"
|
||||
"${PATH_HACKRF_CPLD_DATA_C}"
|
||||
"${PATH_HACKRF_FIRMWARE_COMMON}/xapp058/lenval.c"
|
||||
"${PATH_HACKRF_FIRMWARE_COMMON}/xapp058/micro.c"
|
||||
"${PATH_HACKRF_FIRMWARE_COMMON}/xapp058/ports.c"
|
||||
"${PATH_HACKRF_FIRMWARE_COMMON}/crc.c"
|
||||
"${PATH_HACKRF_FIRMWARE_COMMON}/rom_iap.c"
|
||||
"${PATH_HACKRF_FIRMWARE_COMMON}/operacake.c"
|
||||
"${PATH_HACKRF_FIRMWARE_COMMON}/operacake_sctimer.c"
|
||||
)
|
||||
|
||||
set(SRC_M0 ${PATH_HACKRF_USB}/sgpio_m0.s)
|
||||
|
||||
if(BOARD STREQUAL "HACKRF_ONE")
|
||||
SET(SRC_M4
|
||||
${SRC_M4}
|
||||
usb_api_board_info.c
|
||||
portapack.c
|
||||
"${PATH_HACKRF_FIRMWARE_COMMON}/ui_portapack.c"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(BOARD STREQUAL "RAD1O")
|
||||
SET(SRC_M4
|
||||
${SRC_M4}
|
||||
"${PATH_HACKRF_FIRMWARE_COMMON}/rad1o/display.c"
|
||||
"${PATH_HACKRF_FIRMWARE_COMMON}/rad1o/print.c"
|
||||
"${PATH_HACKRF_FIRMWARE_COMMON}/rad1o/render.c"
|
||||
"${PATH_HACKRF_FIRMWARE_COMMON}/rad1o/decoder.c"
|
||||
"${PATH_HACKRF_FIRMWARE_COMMON}/rad1o/smallfonts.c"
|
||||
"${PATH_HACKRF_FIRMWARE_COMMON}/rad1o/draw.c"
|
||||
"${PATH_HACKRF_FIRMWARE_COMMON}/rad1o/ubuntu18.c"
|
||||
"${PATH_HACKRF_FIRMWARE_COMMON}/ui_rad1o.c"
|
||||
)
|
||||
endif()
|
||||
|
||||
DeclareTargets()
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,189 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2022 Great Scott Gadgets <info@greatscottgadgets.com>
|
||||
* Copyright 2012 Jared Boone
|
||||
* Copyright 2013 Benjamin Vernoux
|
||||
*
|
||||
* This file is part of HackRF.
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "usb_api_board_info.h"
|
||||
#include "platform_detect.h"
|
||||
#include "firmware_info.h"
|
||||
|
||||
#include <hackrf_core.h>
|
||||
#include <rom_iap.h>
|
||||
#include <usb_queue.h>
|
||||
#include <libopencm3/lpc43xx/scu.h>
|
||||
#include <libopencm3/lpc43xx/rgu.h>
|
||||
#include <libopencm3/lpc43xx/wwdt.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HACKRF_ONE
|
||||
#include "gpio_lpc.h"
|
||||
static struct gpio_t gpio_h1r9_clkout_en = GPIO(0, 9);
|
||||
static struct gpio_t gpio_h1r9_mcu_clk_en = GPIO(0, 8);
|
||||
static struct gpio_t gpio_h1r9_rx = GPIO(0, 7);
|
||||
#endif
|
||||
|
||||
usb_request_status_t usb_vendor_request_read_board_id(
|
||||
usb_endpoint_t* const endpoint,
|
||||
const usb_transfer_stage_t stage) {
|
||||
if (stage == USB_TRANSFER_STAGE_SETUP) {
|
||||
endpoint->buffer[0] = detected_platform();
|
||||
usb_transfer_schedule_block(
|
||||
endpoint->in,
|
||||
&endpoint->buffer,
|
||||
1,
|
||||
NULL,
|
||||
NULL);
|
||||
usb_transfer_schedule_ack(endpoint->out);
|
||||
}
|
||||
return USB_REQUEST_STATUS_OK;
|
||||
}
|
||||
|
||||
usb_request_status_t usb_vendor_request_read_version_string(
|
||||
usb_endpoint_t* const endpoint,
|
||||
const usb_transfer_stage_t stage) {
|
||||
uint8_t length;
|
||||
|
||||
if (stage == USB_TRANSFER_STAGE_SETUP) {
|
||||
length = (uint8_t)strlen(firmware_info.version_string);
|
||||
// The USB peripheral doesn't seem to be able to read directly from flash,
|
||||
// so copy the version string into ram first.
|
||||
memcpy(&endpoint->buffer,
|
||||
firmware_info.version_string,
|
||||
sizeof(firmware_info.version_string));
|
||||
usb_transfer_schedule_block(
|
||||
endpoint->in,
|
||||
&endpoint->buffer,
|
||||
length,
|
||||
NULL,
|
||||
NULL);
|
||||
usb_transfer_schedule_ack(endpoint->out);
|
||||
}
|
||||
return USB_REQUEST_STATUS_OK;
|
||||
}
|
||||
|
||||
static read_partid_serialno_t read_partid_serialno;
|
||||
|
||||
usb_request_status_t usb_vendor_request_read_partid_serialno(
|
||||
usb_endpoint_t* const endpoint,
|
||||
const usb_transfer_stage_t stage) {
|
||||
uint8_t length;
|
||||
iap_cmd_res_t iap_cmd_res;
|
||||
|
||||
if (stage == USB_TRANSFER_STAGE_SETUP) {
|
||||
/* Read IAP Part Number Identification */
|
||||
iap_cmd_res.cmd_param.command_code = IAP_CMD_READ_PART_ID_NO;
|
||||
iap_cmd_call(&iap_cmd_res);
|
||||
if (iap_cmd_res.status_res.status_ret != CMD_SUCCESS) {
|
||||
return USB_REQUEST_STATUS_STALL;
|
||||
}
|
||||
|
||||
read_partid_serialno.part_id[0] = iap_cmd_res.status_res.iap_result[0];
|
||||
read_partid_serialno.part_id[1] = iap_cmd_res.status_res.iap_result[1];
|
||||
|
||||
/* Read IAP Serial Number Identification */
|
||||
iap_cmd_res.cmd_param.command_code = IAP_CMD_READ_SERIAL_NO;
|
||||
iap_cmd_call(&iap_cmd_res);
|
||||
if (iap_cmd_res.status_res.status_ret != CMD_SUCCESS) {
|
||||
return USB_REQUEST_STATUS_STALL;
|
||||
}
|
||||
|
||||
read_partid_serialno.serial_no[0] = iap_cmd_res.status_res.iap_result[0];
|
||||
read_partid_serialno.serial_no[1] = iap_cmd_res.status_res.iap_result[1];
|
||||
read_partid_serialno.serial_no[2] = iap_cmd_res.status_res.iap_result[2];
|
||||
read_partid_serialno.serial_no[3] = iap_cmd_res.status_res.iap_result[3];
|
||||
|
||||
length = (uint8_t)sizeof(read_partid_serialno_t);
|
||||
usb_transfer_schedule_block(
|
||||
endpoint->in,
|
||||
&read_partid_serialno,
|
||||
length,
|
||||
NULL,
|
||||
NULL);
|
||||
usb_transfer_schedule_ack(endpoint->out);
|
||||
}
|
||||
return USB_REQUEST_STATUS_OK;
|
||||
}
|
||||
|
||||
usb_request_status_t usb_vendor_request_reset(
|
||||
usb_endpoint_t* const endpoint,
|
||||
const usb_transfer_stage_t stage) {
|
||||
if (stage == USB_TRANSFER_STAGE_SETUP) {
|
||||
#ifdef HACKRF_ONE
|
||||
/*
|
||||
* Set boot pins as inputs so that the bootloader reads them
|
||||
* correctly after the reset.
|
||||
*/
|
||||
if (detected_platform() == BOARD_ID_HACKRF1_R9) {
|
||||
gpio_input(&gpio_h1r9_mcu_clk_en);
|
||||
gpio_input(&gpio_h1r9_clkout_en);
|
||||
gpio_input(&gpio_h1r9_rx);
|
||||
}
|
||||
#endif
|
||||
usb_transfer_schedule_ack(endpoint->in);
|
||||
delay(50 * 40800);
|
||||
|
||||
SCU_SFSP2_8 = (SCU_SFSP2_8 & ~(7)) | 4;
|
||||
struct gpio_t dfu = GPIO(5, 7);
|
||||
gpio_output(&dfu);
|
||||
gpio_clear(&dfu);
|
||||
|
||||
wwdt_reset(100000);
|
||||
}
|
||||
return USB_REQUEST_STATUS_OK;
|
||||
}
|
||||
|
||||
usb_request_status_t usb_vendor_request_read_board_rev(
|
||||
usb_endpoint_t* const endpoint,
|
||||
const usb_transfer_stage_t stage) {
|
||||
if (stage == USB_TRANSFER_STAGE_SETUP) {
|
||||
endpoint->buffer[0] = detected_revision();
|
||||
usb_transfer_schedule_block(
|
||||
endpoint->in,
|
||||
&endpoint->buffer,
|
||||
1,
|
||||
NULL,
|
||||
NULL);
|
||||
usb_transfer_schedule_ack(endpoint->out);
|
||||
}
|
||||
return USB_REQUEST_STATUS_OK;
|
||||
}
|
||||
|
||||
usb_request_status_t usb_vendor_request_read_supported_platform(
|
||||
usb_endpoint_t* const endpoint,
|
||||
const usb_transfer_stage_t stage) {
|
||||
if (stage == USB_TRANSFER_STAGE_SETUP) {
|
||||
uint32_t platform = supported_platform();
|
||||
endpoint->buffer[0] = (platform >> 24) & 0xff;
|
||||
endpoint->buffer[1] = (platform >> 16) & 0xff;
|
||||
endpoint->buffer[2] = (platform >> 8) & 0xff;
|
||||
endpoint->buffer[3] = platform & 0xff;
|
||||
usb_transfer_schedule_block(
|
||||
endpoint->in,
|
||||
&endpoint->buffer,
|
||||
4,
|
||||
NULL,
|
||||
NULL);
|
||||
usb_transfer_schedule_ack(endpoint->out);
|
||||
}
|
||||
return USB_REQUEST_STATUS_OK;
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2022 Great Scott Gadgets <info@greatscottgadgets.com>
|
||||
* Copyright 2012 Jared Boone
|
||||
* Copyright 2013 Benjamin Vernoux
|
||||
*
|
||||
* This file is part of HackRF.
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __USB_API_BOARD_INFO_H__
|
||||
#define __USB_API_BOARD_INFO_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <usb_type.h>
|
||||
#include <usb_request.h>
|
||||
|
||||
typedef struct {
|
||||
uint32_t part_id[2];
|
||||
uint32_t serial_no[4];
|
||||
} read_partid_serialno_t;
|
||||
|
||||
usb_request_status_t usb_vendor_request_read_board_id(
|
||||
usb_endpoint_t* const endpoint,
|
||||
const usb_transfer_stage_t stage);
|
||||
usb_request_status_t usb_vendor_request_read_version_string(
|
||||
usb_endpoint_t* const endpoint,
|
||||
const usb_transfer_stage_t stage);
|
||||
usb_request_status_t usb_vendor_request_read_partid_serialno(
|
||||
usb_endpoint_t* const endpoint,
|
||||
const usb_transfer_stage_t stage);
|
||||
usb_request_status_t usb_vendor_request_reset(
|
||||
usb_endpoint_t* const endpoint,
|
||||
const usb_transfer_stage_t stage);
|
||||
usb_request_status_t usb_vendor_request_read_board_rev(
|
||||
usb_endpoint_t* const endpoint,
|
||||
const usb_transfer_stage_t stage);
|
||||
usb_request_status_t usb_vendor_request_read_supported_platform(
|
||||
usb_endpoint_t* const endpoint,
|
||||
const usb_transfer_stage_t stage);
|
||||
|
||||
#endif /* end of include guard: __USB_API_BOARD_INFO_H__ */
|
||||
Reference in New Issue
Block a user