[Core] Refactor ChibiOS USB endpoints to be fully async (#21656)

This commit is contained in:
Stefan Kerkmann
2024-02-28 12:00:27 +01:00
committed by GitHub
parent b43f6cb7ef
commit 0e02b0c41e
12 changed files with 1311 additions and 1134 deletions

View File

@ -1,25 +1,21 @@
/*
* (c) 2015 flabberast <s3+flabbergast@sdfeu.org>
*
* Based on the following work:
* - Guillaume Duc's raw hid example (MIT License)
* https://github.com/guiduc/usb-hid-chibios-example
* - PJRC Teensy examples (MIT License)
* https://www.pjrc.com/teensy/usb_keyboard.html
* - hasu's TMK keyboard code (GPL v2 and some code Modified BSD)
* https://github.com/tmk/tmk_keyboard/
* - ChibiOS demo code (Apache 2.0 License)
* http://www.chibios.org
*
* Since some GPL'd code is used, this work is licensed under
* GPL v2 or later.
*/
// Copyright 2023 Stefan Kerkmann (@KarlK90)
// Copyright 2020 Ryan (@fauxpark)
// Copyright 2020 Joel Challis (@zvecr)
// Copyright 2018 James Laird-Wah
// Copyright 2016 Fredizzimo
// Copyright 2016 Giovanni Di Sirio
// SPDX-License-Identifier: GPL-3.0-or-later OR Apache-2.0
#pragma once
#include <ch.h>
#include <hal.h>
#include "usb_device_state.h"
#include "usb_descriptor.h"
#include "usb_driver.h"
#include "usb_endpoints.h"
/* -------------------------
* General USB driver header
* -------------------------
@ -36,6 +32,8 @@ void init_usb_driver(USBDriver *usbp);
/* Restart the USB driver and bus */
void restart_usb_driver(USBDriver *usbp);
bool send_report(usb_endpoint_in_lut_t endpoint, void *report, size_t size);
/* ---------------
* USB Event queue
* ---------------
@ -58,3 +56,14 @@ void usb_event_queue_task(void);
int8_t sendchar(uint8_t c);
#endif /* CONSOLE_ENABLE */
/* --------------
* Virtser header
* --------------
*/
#if defined(VIRTSER_ENABLE)
bool virtser_usb_request_cb(USBDriver *usbp);
#endif