mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2024-12-13 19:54:39 +00:00
added copy of hackrf usb stack
This commit is contained in:
parent
9540776afd
commit
8dd68a0811
@ -235,6 +235,7 @@ set(CPPSRC
|
|||||||
apps/ui_encoders.cpp
|
apps/ui_encoders.cpp
|
||||||
apps/ui_fileman.cpp
|
apps/ui_fileman.cpp
|
||||||
apps/ui_flash_utility.cpp
|
apps/ui_flash_utility.cpp
|
||||||
|
apps/ui_sd_over_usb.cpp
|
||||||
apps/ui_freqman.cpp
|
apps/ui_freqman.cpp
|
||||||
apps/ui_jammer.cpp
|
apps/ui_jammer.cpp
|
||||||
apps/ui_keyfob.cpp
|
apps/ui_keyfob.cpp
|
||||||
|
49
firmware/application/apps/ui_sd_over_usb.cpp
Normal file
49
firmware/application/apps/ui_sd_over_usb.cpp
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
||||||
|
* Copyright (C) 2023 Bernd Herzog
|
||||||
|
*
|
||||||
|
* This file is part of PortaPack.
|
||||||
|
*
|
||||||
|
* 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 "ui_sd_over_usb.hpp"
|
||||||
|
#include "portapack_shared_memory.hpp"
|
||||||
|
|
||||||
|
namespace ui {
|
||||||
|
|
||||||
|
SdOverUsbView::SdOverUsbView(NavigationView& nav) : nav_ (nav) {
|
||||||
|
baseband::run_image(portapack::spi_flash::image_tag_usb_sd);
|
||||||
|
add_children({
|
||||||
|
&labels,
|
||||||
|
&button_close
|
||||||
|
});
|
||||||
|
|
||||||
|
button_close.on_select = [this](Button&) {
|
||||||
|
nav_.pop();
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
SdOverUsbView::~SdOverUsbView() {
|
||||||
|
baseband::shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SdOverUsbView::focus() {
|
||||||
|
button_close.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace ui */
|
63
firmware/application/apps/ui_sd_over_usb.hpp
Normal file
63
firmware/application/apps/ui_sd_over_usb.hpp
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
||||||
|
* Copyright (C) 2023 Bernd Herzog
|
||||||
|
*
|
||||||
|
* This file is part of PortaPack.
|
||||||
|
*
|
||||||
|
* 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 __UI_SD_OVER_USB_H__
|
||||||
|
#define __UI_SD_OVER_USB_H__
|
||||||
|
|
||||||
|
#include "ui_widget.hpp"
|
||||||
|
#include "ui_navigation.hpp"
|
||||||
|
#include "string_format.hpp"
|
||||||
|
#include "ff.h"
|
||||||
|
#include "baseband_api.hpp"
|
||||||
|
#include "core_control.hpp"
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
namespace ui {
|
||||||
|
|
||||||
|
class SdOverUsbView : public View {
|
||||||
|
public:
|
||||||
|
SdOverUsbView(NavigationView& nav);
|
||||||
|
~SdOverUsbView();
|
||||||
|
|
||||||
|
void focus() override;
|
||||||
|
|
||||||
|
std::string title() const override { return "Flash Utility"; };
|
||||||
|
|
||||||
|
private:
|
||||||
|
NavigationView& nav_;
|
||||||
|
|
||||||
|
Labels labels {
|
||||||
|
{ { 4, 4 }, "Use USB", Color::white() }
|
||||||
|
};
|
||||||
|
|
||||||
|
Button button_close {
|
||||||
|
{ 2 * 8, 15 * 16, 12 * 8, 3 * 16 },
|
||||||
|
"Close"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} /* namespace ui */
|
||||||
|
|
||||||
|
#endif /*__UI_SD_OVER_USB_H__*/
|
@ -71,6 +71,7 @@
|
|||||||
#include "ui_view_wav.hpp"
|
#include "ui_view_wav.hpp"
|
||||||
#include "ui_whipcalc.hpp"
|
#include "ui_whipcalc.hpp"
|
||||||
#include "ui_flash_utility.hpp"
|
#include "ui_flash_utility.hpp"
|
||||||
|
#include "ui_sd_over_usb.hpp"
|
||||||
|
|
||||||
//#include "acars_app.hpp"
|
//#include "acars_app.hpp"
|
||||||
#include "ais_app.hpp"
|
#include "ais_app.hpp"
|
||||||
@ -614,8 +615,8 @@ UtilitiesMenuView::UtilitiesMenuView(NavigationView& nav) {
|
|||||||
{ "Antenna length", ui::Color::green(), &bitmap_icon_tools_antenna, [&nav](){ nav.push<WhipCalcView>(); } },
|
{ "Antenna length", ui::Color::green(), &bitmap_icon_tools_antenna, [&nav](){ nav.push<WhipCalcView>(); } },
|
||||||
|
|
||||||
{ "Wipe SD card", ui::Color::red(), &bitmap_icon_tools_wipesd, [&nav](){ nav.push<WipeSDView>(); } },
|
{ "Wipe SD card", ui::Color::red(), &bitmap_icon_tools_wipesd, [&nav](){ nav.push<WipeSDView>(); } },
|
||||||
{ "Flash Utility", ui::Color::red(), &bitmap_icon_temperature, [&nav](){ nav.push<FlashUtilityView>(); } },
|
{ "Flash Utility", ui::Color::red(), &bitmap_icon_temperature, [&nav](){ nav.push<FlashUtilityView>(); } },
|
||||||
|
{ "SD over USB", ui::Color::yellow(), &bitmap_icon_hackrf, [&nav](){ nav.push<SdOverUsbView>(); } },
|
||||||
});
|
});
|
||||||
set_max_rows(2); // allow wider buttons
|
set_max_rows(2); // allow wider buttons
|
||||||
}
|
}
|
||||||
|
@ -515,6 +515,31 @@ set(MODE_CPPSRC
|
|||||||
)
|
)
|
||||||
DeclareTargets(PFUT flash_utility)
|
DeclareTargets(PFUT flash_utility)
|
||||||
|
|
||||||
|
### SD over USB ${PATH_HACKRF_FIRMWARE}
|
||||||
|
|
||||||
|
set(MODE_INCDIR
|
||||||
|
${HACKRF_PATH}/firmware
|
||||||
|
${HACKRF_PATH}/firmware/common
|
||||||
|
${HACKRF_PATH}/firmware/libopencm3/include
|
||||||
|
)
|
||||||
|
set(MODE_CPPSRC
|
||||||
|
sd_over_usb/proc_sd_over_usb.cpp
|
||||||
|
|
||||||
|
sd_over_usb/sd_over_usb.c
|
||||||
|
sd_over_usb/usb_descriptor.c
|
||||||
|
sd_over_usb/usb_device.c
|
||||||
|
sd_over_usb/usb_endpoint.c
|
||||||
|
|
||||||
|
${HACKRF_PATH}/firmware/common/usb.c
|
||||||
|
${HACKRF_PATH}/firmware/common/usb_queue.c
|
||||||
|
${HACKRF_PATH}/firmware/common/usb_request.c
|
||||||
|
${HACKRF_PATH}/firmware/common/usb_standard_request.c
|
||||||
|
${HACKRF_PATH}/firmware/libopencm3/lib/cm3/nvic.c
|
||||||
|
${HACKRF_PATH}/firmware/libopencm3/lib/cm3/sync.c
|
||||||
|
|
||||||
|
)
|
||||||
|
DeclareTargets(PUSB sd_over_usb)
|
||||||
|
|
||||||
### HackRF "factory" firmware
|
### HackRF "factory" firmware
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
|
49
firmware/baseband/sd_over_usb/proc_sd_over_usb.cpp
Normal file
49
firmware/baseband/sd_over_usb/proc_sd_over_usb.cpp
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
||||||
|
* Copyright (C) 2023 Bernd Herzog
|
||||||
|
*
|
||||||
|
* This file is part of PortaPack.
|
||||||
|
*
|
||||||
|
* 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 "ch.h"
|
||||||
|
#include "hal.h"
|
||||||
|
|
||||||
|
#include "proc_sd_over_usb.hpp"
|
||||||
|
|
||||||
|
#include "debug.hpp"
|
||||||
|
#include "portapack_shared_memory.hpp"
|
||||||
|
#include "event_m4.hpp"
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
void start_usb(void);
|
||||||
|
void stop_usb(void);
|
||||||
|
void irq_usb(void);
|
||||||
|
|
||||||
|
CH_IRQ_HANDLER(Vector60) {
|
||||||
|
irq_usb();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
EventDispatcher event_dispatcher { std::make_unique<USBProcessor>() };
|
||||||
|
HALT_UNTIL_DEBUGGING();
|
||||||
|
start_usb();
|
||||||
|
event_dispatcher.run();
|
||||||
|
stop_usb();
|
||||||
|
return 0;
|
||||||
|
}
|
48
firmware/baseband/sd_over_usb/proc_sd_over_usb.hpp
Normal file
48
firmware/baseband/sd_over_usb/proc_sd_over_usb.hpp
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
||||||
|
* Copyright (C) 2023 Bernd Herzog
|
||||||
|
*
|
||||||
|
* This file is part of PortaPack.
|
||||||
|
*
|
||||||
|
* 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 __UI_PROC_SD_OVER_USB_H__
|
||||||
|
#define __UI_PROC_SD_OVER_USB_H__
|
||||||
|
|
||||||
|
#include "portapack_shared_memory.hpp"
|
||||||
|
#include "baseband_processor.hpp"
|
||||||
|
#include "baseband_thread.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
class USBProcessor : public BasebandProcessor {
|
||||||
|
public:
|
||||||
|
void execute(const buffer_c8_t&) override {};
|
||||||
|
|
||||||
|
//void on_message(const Message* const p) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
|
||||||
|
//bool configured { false };
|
||||||
|
|
||||||
|
//BasebandThread baseband_thread { 3072000, this, NORMALPRIO + 20, baseband::Direction::Transmit };
|
||||||
|
|
||||||
|
|
||||||
|
//RequestSignalMessage sig_message { RequestSignalMessage::Signal::FillRequest };
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*__UI_PROC_SD_OVER_USB_H__*/
|
77
firmware/baseband/sd_over_usb/sd_over_usb.c
Normal file
77
firmware/baseband/sd_over_usb/sd_over_usb.c
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
#include "sd_over_usb.h"
|
||||||
|
|
||||||
|
//extern usb_request_handlers_t usb_request_handlers;
|
||||||
|
|
||||||
|
|
||||||
|
usb_request_status_t dummy(
|
||||||
|
usb_endpoint_t* const endpoint,
|
||||||
|
const usb_transfer_stage_t stage)
|
||||||
|
{
|
||||||
|
(void)(endpoint);
|
||||||
|
(void)(stage);
|
||||||
|
return USB_REQUEST_STATUS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static usb_request_handler_fn vendor_request_handler[] = {
|
||||||
|
NULL,
|
||||||
|
dummy // USB_WCID_VENDOR_REQ
|
||||||
|
};
|
||||||
|
|
||||||
|
static const uint32_t vendor_request_handler_count =
|
||||||
|
sizeof(vendor_request_handler) / sizeof(vendor_request_handler[0]);
|
||||||
|
|
||||||
|
usb_request_status_t usb_vendor_request(
|
||||||
|
usb_endpoint_t* const endpoint,
|
||||||
|
const usb_transfer_stage_t stage)
|
||||||
|
{
|
||||||
|
usb_request_status_t status = USB_REQUEST_STATUS_STALL;
|
||||||
|
|
||||||
|
if (endpoint->setup.request < vendor_request_handler_count) {
|
||||||
|
usb_request_handler_fn handler =
|
||||||
|
vendor_request_handler[endpoint->setup.request];
|
||||||
|
if (handler) {
|
||||||
|
status = handler(endpoint, stage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
const usb_request_handlers_t usb_request_handlers = {
|
||||||
|
.standard = usb_standard_request,
|
||||||
|
.class = 0,
|
||||||
|
.vendor = usb_vendor_request,
|
||||||
|
.reserved = 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void start_usb(void) {
|
||||||
|
usb_peripheral_reset();
|
||||||
|
|
||||||
|
usb_device_init(0, &usb_device);
|
||||||
|
|
||||||
|
usb_queue_init(&usb_endpoint_control_out_queue);
|
||||||
|
usb_queue_init(&usb_endpoint_control_in_queue);
|
||||||
|
usb_queue_init(&usb_endpoint_bulk_out_queue);
|
||||||
|
usb_queue_init(&usb_endpoint_bulk_in_queue);
|
||||||
|
|
||||||
|
usb_endpoint_init(&usb_endpoint_control_out);
|
||||||
|
usb_endpoint_init(&usb_endpoint_control_in);
|
||||||
|
|
||||||
|
nvic_set_priority(NVIC_USB0_IRQ, 255);
|
||||||
|
|
||||||
|
usb_run(&usb_device);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void stop_usb(void) {
|
||||||
|
usb_peripheral_reset();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void irq_usb(void) {
|
||||||
|
usb0_isr();
|
||||||
|
}
|
39
firmware/baseband/sd_over_usb/sd_over_usb.h
Normal file
39
firmware/baseband/sd_over_usb/sd_over_usb.h
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2023 Bernd Herzog
|
||||||
|
*
|
||||||
|
* 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_SD_OVER_USB_H__
|
||||||
|
#define __USB_SD_OVER_USB_H__
|
||||||
|
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <common/usb.h>
|
||||||
|
#include <common/usb_request.h>
|
||||||
|
#include <common/usb_standard_request.h>
|
||||||
|
#include "usb_device.h"
|
||||||
|
#include "usb_endpoint.h"
|
||||||
|
#include <libopencm3/lpc43xx/m4/nvic.h>
|
||||||
|
|
||||||
|
void start_usb(void);
|
||||||
|
void stop_usb(void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __USB_SD_OVER_USB_H__ */
|
39
firmware/baseband/sd_over_usb/usb_bulk_buffer.h
Normal file
39
firmware/baseband/sd_over_usb/usb_bulk_buffer.h
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* 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_BULK_BUFFER_H__
|
||||||
|
#define __USB_BULK_BUFFER_H__
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define USB_BULK_BUFFER_SIZE 0x8000
|
||||||
|
#define USB_BULK_BUFFER_MASK 0x7FFF
|
||||||
|
|
||||||
|
/* Address of usb_bulk_buffer is set in ldscripts. If you change the name of this
|
||||||
|
* variable, it won't be where it needs to be in the processor's address space,
|
||||||
|
* unless you also adjust the ldscripts.
|
||||||
|
*/
|
||||||
|
extern uint8_t usb_bulk_buffer[USB_BULK_BUFFER_SIZE];
|
||||||
|
|
||||||
|
#endif /*__USB_BULK_BUFFER_H__*/
|
314
firmware/baseband/sd_over_usb/usb_descriptor.c
Normal file
314
firmware/baseband/sd_over_usb/usb_descriptor.c
Normal file
@ -0,0 +1,314 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2012-2022 Great Scott Gadgets <info@greatscottgadgets.com>
|
||||||
|
* Copyright 2012 Jared Boone
|
||||||
|
*
|
||||||
|
* 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 <stdint.h>
|
||||||
|
|
||||||
|
#include "usb_type.h"
|
||||||
|
#include "usb_descriptor.h"
|
||||||
|
|
||||||
|
#define USB_VENDOR_ID (0x1D50)
|
||||||
|
|
||||||
|
#ifdef HACKRF_ONE
|
||||||
|
#define USB_PRODUCT_ID (0x6089)
|
||||||
|
#elif JAWBREAKER
|
||||||
|
#define USB_PRODUCT_ID (0x604B)
|
||||||
|
#elif RAD1O
|
||||||
|
#define USB_PRODUCT_ID (0xCC15)
|
||||||
|
#else
|
||||||
|
#define USB_PRODUCT_ID (0xFFFF)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define USB_API_VERSION (0x0107)
|
||||||
|
|
||||||
|
#define USB_WORD(x) (x & 0xFF), ((x >> 8) & 0xFF)
|
||||||
|
|
||||||
|
#define USB_MAX_PACKET0 (64)
|
||||||
|
#define USB_MAX_PACKET_BULK_FS (64)
|
||||||
|
#define USB_MAX_PACKET_BULK_HS (512)
|
||||||
|
|
||||||
|
#define USB_BULK_IN_EP_ADDR (0x81)
|
||||||
|
#define USB_BULK_OUT_EP_ADDR (0x02)
|
||||||
|
|
||||||
|
#define USB_STRING_LANGID (0x0409)
|
||||||
|
|
||||||
|
uint8_t usb_descriptor_device[] = {
|
||||||
|
18, // bLength
|
||||||
|
USB_DESCRIPTOR_TYPE_DEVICE, // bDescriptorType
|
||||||
|
USB_WORD(0x0200), // bcdUSB
|
||||||
|
0x00, // bDeviceClass
|
||||||
|
0x00, // bDeviceSubClass
|
||||||
|
0x00, // bDeviceProtocol
|
||||||
|
USB_MAX_PACKET0, // bMaxPacketSize0
|
||||||
|
USB_WORD(USB_VENDOR_ID), // idVendor
|
||||||
|
USB_WORD(USB_PRODUCT_ID), // idProduct
|
||||||
|
USB_WORD(USB_API_VERSION), // bcdDevice
|
||||||
|
0x01, // iManufacturer
|
||||||
|
0x02, // iProduct
|
||||||
|
0x04, // iSerialNumber
|
||||||
|
0x01 // bNumConfigurations
|
||||||
|
};
|
||||||
|
|
||||||
|
uint8_t usb_descriptor_device_qualifier[] = {
|
||||||
|
10, // bLength
|
||||||
|
USB_DESCRIPTOR_TYPE_DEVICE_QUALIFIER, // bDescriptorType
|
||||||
|
USB_WORD(0x0200), // bcdUSB
|
||||||
|
0x00, // bDeviceClass
|
||||||
|
0x00, // bDeviceSubClass
|
||||||
|
0x00, // bDeviceProtocol
|
||||||
|
64, // bMaxPacketSize0
|
||||||
|
0x01, // bNumOtherSpeedConfigurations
|
||||||
|
0x00 // bReserved
|
||||||
|
};
|
||||||
|
|
||||||
|
uint8_t usb_descriptor_configuration_full_speed[] = {
|
||||||
|
9, // bLength
|
||||||
|
USB_DESCRIPTOR_TYPE_CONFIGURATION, // bDescriptorType
|
||||||
|
USB_WORD(32), // wTotalLength
|
||||||
|
0x01, // bNumInterfaces
|
||||||
|
0x01, // bConfigurationValue
|
||||||
|
0x03, // iConfiguration
|
||||||
|
0x80, // bmAttributes: USB-powered
|
||||||
|
250, // bMaxPower: 500mA
|
||||||
|
|
||||||
|
9, // bLength
|
||||||
|
USB_DESCRIPTOR_TYPE_INTERFACE, // bDescriptorType
|
||||||
|
0x00, // bInterfaceNumber
|
||||||
|
0x00, // bAlternateSetting
|
||||||
|
0x02, // bNumEndpoints
|
||||||
|
0xFF, // bInterfaceClass: vendor-specific
|
||||||
|
0xFF, // bInterfaceSubClass
|
||||||
|
0xFF, // bInterfaceProtocol: vendor-specific
|
||||||
|
0x00, // iInterface
|
||||||
|
|
||||||
|
7, // bLength
|
||||||
|
USB_DESCRIPTOR_TYPE_ENDPOINT, // bDescriptorType
|
||||||
|
USB_BULK_IN_EP_ADDR, // bEndpointAddress
|
||||||
|
0x02, // bmAttributes: BULK
|
||||||
|
USB_WORD(USB_MAX_PACKET_BULK_FS), // wMaxPacketSize
|
||||||
|
0x00, // bInterval: no NAK
|
||||||
|
|
||||||
|
7, // bLength
|
||||||
|
USB_DESCRIPTOR_TYPE_ENDPOINT, // bDescriptorType
|
||||||
|
USB_BULK_OUT_EP_ADDR, // bEndpointAddress
|
||||||
|
0x02, // bmAttributes: BULK
|
||||||
|
USB_WORD(USB_MAX_PACKET_BULK_FS), // wMaxPacketSize
|
||||||
|
0x00, // bInterval: no NAK
|
||||||
|
|
||||||
|
0, // TERMINATOR
|
||||||
|
};
|
||||||
|
|
||||||
|
uint8_t usb_descriptor_configuration_high_speed[] = {
|
||||||
|
9, // bLength
|
||||||
|
USB_DESCRIPTOR_TYPE_CONFIGURATION, // bDescriptorType
|
||||||
|
USB_WORD(32), // wTotalLength
|
||||||
|
0x01, // bNumInterfaces
|
||||||
|
0x01, // bConfigurationValue
|
||||||
|
0x03, // iConfiguration
|
||||||
|
0x80, // bmAttributes: USB-powered
|
||||||
|
250, // bMaxPower: 500mA
|
||||||
|
|
||||||
|
9, // bLength
|
||||||
|
USB_DESCRIPTOR_TYPE_INTERFACE, // bDescriptorType
|
||||||
|
0x00, // bInterfaceNumber
|
||||||
|
0x00, // bAlternateSetting
|
||||||
|
0x02, // bNumEndpoints
|
||||||
|
0xFF, // bInterfaceClass: vendor-specific
|
||||||
|
0xFF, // bInterfaceSubClass
|
||||||
|
0xFF, // bInterfaceProtocol: vendor-specific
|
||||||
|
0x00, // iInterface
|
||||||
|
|
||||||
|
7, // bLength
|
||||||
|
USB_DESCRIPTOR_TYPE_ENDPOINT, // bDescriptorType
|
||||||
|
USB_BULK_IN_EP_ADDR, // bEndpointAddress
|
||||||
|
0x02, // bmAttributes: BULK
|
||||||
|
USB_WORD(USB_MAX_PACKET_BULK_HS), // wMaxPacketSize
|
||||||
|
0x00, // bInterval: no NAK
|
||||||
|
|
||||||
|
7, // bLength
|
||||||
|
USB_DESCRIPTOR_TYPE_ENDPOINT, // bDescriptorType
|
||||||
|
USB_BULK_OUT_EP_ADDR, // bEndpointAddress
|
||||||
|
0x02, // bmAttributes: BULK
|
||||||
|
USB_WORD(USB_MAX_PACKET_BULK_HS), // wMaxPacketSize
|
||||||
|
0x00, // bInterval: no NAK
|
||||||
|
|
||||||
|
0, // TERMINATOR
|
||||||
|
};
|
||||||
|
|
||||||
|
uint8_t usb_descriptor_string_languages[] = {
|
||||||
|
0x04, // bLength
|
||||||
|
USB_DESCRIPTOR_TYPE_STRING, // bDescriptorType
|
||||||
|
USB_WORD(USB_STRING_LANGID), // wLANGID
|
||||||
|
};
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
uint8_t usb_descriptor_string_manufacturer[] = {
|
||||||
|
40, // bLength
|
||||||
|
USB_DESCRIPTOR_TYPE_STRING, // bDescriptorType
|
||||||
|
'G', 0x00,
|
||||||
|
'r', 0x00,
|
||||||
|
'e', 0x00,
|
||||||
|
'a', 0x00,
|
||||||
|
't', 0x00,
|
||||||
|
' ', 0x00,
|
||||||
|
'S', 0x00,
|
||||||
|
'c', 0x00,
|
||||||
|
'o', 0x00,
|
||||||
|
't', 0x00,
|
||||||
|
't', 0x00,
|
||||||
|
' ', 0x00,
|
||||||
|
'G', 0x00,
|
||||||
|
'a', 0x00,
|
||||||
|
'd', 0x00,
|
||||||
|
'g', 0x00,
|
||||||
|
'e', 0x00,
|
||||||
|
't', 0x00,
|
||||||
|
's', 0x00,
|
||||||
|
};
|
||||||
|
|
||||||
|
uint8_t usb_descriptor_string_product[] = {
|
||||||
|
#ifdef HACKRF_ONE
|
||||||
|
22, // bLength
|
||||||
|
USB_DESCRIPTOR_TYPE_STRING, // bDescriptorType
|
||||||
|
'H', 0x00,
|
||||||
|
'a', 0x00,
|
||||||
|
'c', 0x00,
|
||||||
|
'k', 0x00,
|
||||||
|
'R', 0x00,
|
||||||
|
'F', 0x00,
|
||||||
|
' ', 0x00,
|
||||||
|
'O', 0x00,
|
||||||
|
'n', 0x00,
|
||||||
|
'e', 0x00,
|
||||||
|
#elif JAWBREAKER
|
||||||
|
36, // bLength
|
||||||
|
USB_DESCRIPTOR_TYPE_STRING, // bDescriptorType
|
||||||
|
'H', 0x00,
|
||||||
|
'a', 0x00,
|
||||||
|
'c', 0x00,
|
||||||
|
'k', 0x00,
|
||||||
|
'R', 0x00,
|
||||||
|
'F', 0x00,
|
||||||
|
' ', 0x00,
|
||||||
|
'J', 0x00,
|
||||||
|
'a', 0x00,
|
||||||
|
'w', 0x00,
|
||||||
|
'b', 0x00,
|
||||||
|
'r', 0x00,
|
||||||
|
'e', 0x00,
|
||||||
|
'a', 0x00,
|
||||||
|
'k', 0x00,
|
||||||
|
'e', 0x00,
|
||||||
|
'r', 0x00,
|
||||||
|
#elif RAD1O
|
||||||
|
12, // bLength
|
||||||
|
USB_DESCRIPTOR_TYPE_STRING, // bDescriptorType
|
||||||
|
'r', 0x00,
|
||||||
|
'a', 0x00,
|
||||||
|
'd', 0x00,
|
||||||
|
'1', 0x00,
|
||||||
|
'o', 0x00,
|
||||||
|
#else
|
||||||
|
14, // bLength
|
||||||
|
USB_DESCRIPTOR_TYPE_STRING, // bDescriptorType
|
||||||
|
'H', 0x00,
|
||||||
|
'a', 0x00,
|
||||||
|
'c', 0x00,
|
||||||
|
'k', 0x00,
|
||||||
|
'R', 0x00,
|
||||||
|
'F', 0x00,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
uint8_t usb_descriptor_string_config_description[] = {
|
||||||
|
24, // bLength
|
||||||
|
USB_DESCRIPTOR_TYPE_STRING, // bDescriptorType
|
||||||
|
'T', 0x00,
|
||||||
|
'r', 0x00,
|
||||||
|
'a', 0x00,
|
||||||
|
'n', 0x00,
|
||||||
|
's', 0x00,
|
||||||
|
'c', 0x00,
|
||||||
|
'e', 0x00,
|
||||||
|
'i', 0x00,
|
||||||
|
'v', 0x00,
|
||||||
|
'e', 0x00,
|
||||||
|
'r', 0x00,
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef DFU_MODE
|
||||||
|
uint8_t usb_descriptor_string_serial_number[] = {
|
||||||
|
30, // bLength
|
||||||
|
USB_DESCRIPTOR_TYPE_STRING, // bDescriptorType
|
||||||
|
'R', 0x00,
|
||||||
|
'u', 0x00,
|
||||||
|
'n', 0x00,
|
||||||
|
'n', 0x00,
|
||||||
|
'i', 0x00,
|
||||||
|
'n', 0x00,
|
||||||
|
'g', 0x00,
|
||||||
|
'F', 0x00,
|
||||||
|
'r', 0x00,
|
||||||
|
'o', 0x00,
|
||||||
|
'm', 0x00,
|
||||||
|
'R', 0x00,
|
||||||
|
'A', 0x00,
|
||||||
|
'M', 0x00,
|
||||||
|
};
|
||||||
|
#else
|
||||||
|
uint8_t usb_descriptor_string_serial_number[USB_DESCRIPTOR_STRING_SERIAL_BUF_LEN];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uint8_t* usb_descriptor_strings[] = {
|
||||||
|
usb_descriptor_string_languages,
|
||||||
|
usb_descriptor_string_manufacturer,
|
||||||
|
usb_descriptor_string_product,
|
||||||
|
usb_descriptor_string_config_description,
|
||||||
|
usb_descriptor_string_serial_number,
|
||||||
|
0, // TERMINATOR
|
||||||
|
};
|
||||||
|
|
||||||
|
uint8_t wcid_string_descriptor[] = {
|
||||||
|
18, // bLength
|
||||||
|
USB_DESCRIPTOR_TYPE_STRING, // bDescriptorType
|
||||||
|
'M', 0x00,
|
||||||
|
'S', 0x00,
|
||||||
|
'F', 0x00,
|
||||||
|
'T', 0x00,
|
||||||
|
'1', 0x00,
|
||||||
|
'0', 0x00,
|
||||||
|
'0', 0x00,
|
||||||
|
USB_WCID_VENDOR_REQ, // vendor request code for further descriptor
|
||||||
|
0x00
|
||||||
|
};
|
||||||
|
|
||||||
|
uint8_t wcid_feature_descriptor[] = {
|
||||||
|
0x28, 0x00, 0x00, 0x00, // bLength
|
||||||
|
USB_WORD(0x0100), // WCID version
|
||||||
|
USB_WORD(0x0004), // WICD descriptor index
|
||||||
|
0x01, // bNumSections
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Reserved
|
||||||
|
0x00, // bInterfaceNumber
|
||||||
|
0x01, // Reserved
|
||||||
|
'W', 'I', 'N', 'U', 'S', 'B', 0x00,0x00, // Compatible ID, padded with zeros
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Sub-compatible ID
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00 // Reserved
|
||||||
|
};
|
42
firmware/baseband/sd_over_usb/usb_descriptor.h
Normal file
42
firmware/baseband/sd_over_usb/usb_descriptor.h
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2012-2022 Great Scott Gadgets <info@greatscottgadgets.com>
|
||||||
|
* Copyright 2012 Jared Boone
|
||||||
|
*
|
||||||
|
* 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 <stdint.h>
|
||||||
|
|
||||||
|
extern uint8_t usb_descriptor_device[];
|
||||||
|
extern uint8_t usb_descriptor_device_qualifier[];
|
||||||
|
extern uint8_t usb_descriptor_configuration_full_speed[];
|
||||||
|
extern uint8_t usb_descriptor_configuration_high_speed[];
|
||||||
|
extern uint8_t usb_descriptor_string_languages[];
|
||||||
|
extern uint8_t usb_descriptor_string_manufacturer[];
|
||||||
|
extern uint8_t usb_descriptor_string_product[];
|
||||||
|
|
||||||
|
#define USB_DESCRIPTOR_STRING_SERIAL_LEN 32
|
||||||
|
#define USB_DESCRIPTOR_STRING_SERIAL_BUF_LEN \
|
||||||
|
(USB_DESCRIPTOR_STRING_SERIAL_LEN * 2 + 2) /* UTF-16LE */
|
||||||
|
extern uint8_t usb_descriptor_string_serial_number[];
|
||||||
|
|
||||||
|
extern uint8_t* usb_descriptor_strings[];
|
||||||
|
|
||||||
|
#define USB_WCID_VENDOR_REQ 0x19
|
||||||
|
extern uint8_t wcid_string_descriptor[];
|
||||||
|
extern uint8_t wcid_feature_descriptor[];
|
56
firmware/baseband/sd_over_usb/usb_device.c
Normal file
56
firmware/baseband/sd_over_usb/usb_device.c
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* 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_device.h"
|
||||||
|
|
||||||
|
#include <usb_type.h>
|
||||||
|
|
||||||
|
#include "usb_descriptor.h"
|
||||||
|
|
||||||
|
usb_configuration_t usb_configuration_high_speed = {
|
||||||
|
.number = 1,
|
||||||
|
.speed = USB_SPEED_HIGH,
|
||||||
|
.descriptor = usb_descriptor_configuration_high_speed,
|
||||||
|
};
|
||||||
|
|
||||||
|
usb_configuration_t usb_configuration_full_speed = {
|
||||||
|
.number = 1,
|
||||||
|
.speed = USB_SPEED_FULL,
|
||||||
|
.descriptor = usb_descriptor_configuration_full_speed,
|
||||||
|
};
|
||||||
|
|
||||||
|
usb_configuration_t* usb_configurations[] = {
|
||||||
|
&usb_configuration_high_speed,
|
||||||
|
&usb_configuration_full_speed,
|
||||||
|
0,
|
||||||
|
};
|
||||||
|
|
||||||
|
usb_device_t usb_device = {
|
||||||
|
.descriptor = usb_descriptor_device,
|
||||||
|
.descriptor_strings = usb_descriptor_strings,
|
||||||
|
.qualifier_descriptor = usb_descriptor_device_qualifier,
|
||||||
|
.configurations = &usb_configurations,
|
||||||
|
.configuration = 0,
|
||||||
|
.wcid_string_descriptor = wcid_string_descriptor,
|
||||||
|
.wcid_feature_descriptor = wcid_feature_descriptor,
|
||||||
|
};
|
31
firmware/baseband/sd_over_usb/usb_device.h
Normal file
31
firmware/baseband/sd_over_usb/usb_device.h
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2012-2013 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_DEVICE_H__
|
||||||
|
#define __USB_DEVICE_H__
|
||||||
|
|
||||||
|
#include <usb_type.h>
|
||||||
|
|
||||||
|
extern usb_device_t usb_device;
|
||||||
|
|
||||||
|
#endif /* end of include guard: __USB_DEVICE_H__ */
|
70
firmware/baseband/sd_over_usb/usb_endpoint.c
Normal file
70
firmware/baseband/sd_over_usb/usb_endpoint.c
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* 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_endpoint.h"
|
||||||
|
|
||||||
|
#include <usb_request.h>
|
||||||
|
|
||||||
|
#include "usb_device.h"
|
||||||
|
|
||||||
|
usb_endpoint_t usb_endpoint_control_out = {
|
||||||
|
.address = 0x00,
|
||||||
|
.device = &usb_device,
|
||||||
|
.in = &usb_endpoint_control_in,
|
||||||
|
.out = &usb_endpoint_control_out,
|
||||||
|
.setup_complete = usb_setup_complete,
|
||||||
|
.transfer_complete = usb_control_out_complete,
|
||||||
|
};
|
||||||
|
USB_DEFINE_QUEUE(usb_endpoint_control_out, 4);
|
||||||
|
|
||||||
|
usb_endpoint_t usb_endpoint_control_in = {
|
||||||
|
.address = 0x80,
|
||||||
|
.device = &usb_device,
|
||||||
|
.in = &usb_endpoint_control_in,
|
||||||
|
.out = &usb_endpoint_control_out,
|
||||||
|
.setup_complete = 0,
|
||||||
|
.transfer_complete = usb_control_in_complete,
|
||||||
|
};
|
||||||
|
static USB_DEFINE_QUEUE(usb_endpoint_control_in, 4);
|
||||||
|
|
||||||
|
// NOTE: Endpoint number for IN and OUT are different. I wish I had some
|
||||||
|
// evidence that having BULK IN and OUT on separate endpoint numbers was
|
||||||
|
// actually a good idea. Seems like everybody does it that way, but why?
|
||||||
|
|
||||||
|
usb_endpoint_t usb_endpoint_bulk_in = {
|
||||||
|
.address = 0x81,
|
||||||
|
.device = &usb_device,
|
||||||
|
.in = &usb_endpoint_bulk_in,
|
||||||
|
.out = 0,
|
||||||
|
.setup_complete = 0,
|
||||||
|
.transfer_complete = usb_queue_transfer_complete};
|
||||||
|
static USB_DEFINE_QUEUE(usb_endpoint_bulk_in, 1);
|
||||||
|
|
||||||
|
usb_endpoint_t usb_endpoint_bulk_out = {
|
||||||
|
.address = 0x02,
|
||||||
|
.device = &usb_device,
|
||||||
|
.in = 0,
|
||||||
|
.out = &usb_endpoint_bulk_out,
|
||||||
|
.setup_complete = 0,
|
||||||
|
.transfer_complete = usb_queue_transfer_complete};
|
||||||
|
static USB_DEFINE_QUEUE(usb_endpoint_bulk_out, 1);
|
42
firmware/baseband/sd_over_usb/usb_endpoint.h
Normal file
42
firmware/baseband/sd_over_usb/usb_endpoint.h
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2012-2013 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_ENDPOINT_H__
|
||||||
|
#define __USB_ENDPOINT_H__
|
||||||
|
|
||||||
|
#include <usb_type.h>
|
||||||
|
#include <usb_queue.h>
|
||||||
|
|
||||||
|
extern usb_endpoint_t usb_endpoint_control_out;
|
||||||
|
extern USB_DECLARE_QUEUE(usb_endpoint_control_out);
|
||||||
|
|
||||||
|
extern usb_endpoint_t usb_endpoint_control_in;
|
||||||
|
extern USB_DECLARE_QUEUE(usb_endpoint_control_in);
|
||||||
|
|
||||||
|
extern usb_endpoint_t usb_endpoint_bulk_in;
|
||||||
|
extern USB_DECLARE_QUEUE(usb_endpoint_bulk_in);
|
||||||
|
|
||||||
|
extern usb_endpoint_t usb_endpoint_bulk_out;
|
||||||
|
extern USB_DECLARE_QUEUE(usb_endpoint_bulk_out);
|
||||||
|
|
||||||
|
#endif /* end of include guard: __USB_ENDPOINT_H__ */
|
@ -107,6 +107,7 @@ constexpr image_tag_t image_tag_siggen { 'P', 'S', 'I', 'G' };
|
|||||||
constexpr image_tag_t image_tag_sstv_tx { 'P', 'S', 'T', 'X' };
|
constexpr image_tag_t image_tag_sstv_tx { 'P', 'S', 'T', 'X' };
|
||||||
constexpr image_tag_t image_tag_tones { 'P', 'T', 'O', 'N' };
|
constexpr image_tag_t image_tag_tones { 'P', 'T', 'O', 'N' };
|
||||||
constexpr image_tag_t image_tag_flash_utility { 'P', 'F', 'U', 'T' };
|
constexpr image_tag_t image_tag_flash_utility { 'P', 'F', 'U', 'T' };
|
||||||
|
constexpr image_tag_t image_tag_usb_sd { 'P', 'U', 'S', 'B' };
|
||||||
|
|
||||||
constexpr image_tag_t image_tag_noop { 'P', 'N', 'O', 'P' };
|
constexpr image_tag_t image_tag_noop { 'P', 'N', 'O', 'P' };
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user