1
0
Fork 0

Remove console out endpoint (#22304)

This commit is contained in:
Joel Challis 2024-01-09 14:01:34 +00:00 committed by GitHub
parent ccec4867c8
commit b6b3efc14b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 66 additions and 138 deletions

View file

@ -184,41 +184,16 @@ static void raw_hid_task(void) {
* Console
******************************************************************************/
#ifdef CONSOLE_ENABLE
/** \brief Console Task
/** \brief Console Tasks
*
* FIXME: Needs doc
*/
static void Console_Task(void) {
static void console_flush_task(void) {
/* Device must be connected and configured for the task to run */
if (USB_DeviceState != DEVICE_STATE_Configured) return;
uint8_t ep = Endpoint_GetCurrentEndpoint();
# if 0
// TODO: impl receivechar()/recvchar()
Endpoint_SelectEndpoint(CONSOLE_OUT_EPNUM);
/* Check to see if a packet has been sent from the host */
if (Endpoint_IsOUTReceived())
{
/* Check to see if the packet contains data */
if (Endpoint_IsReadWriteAllowed())
{
/* Create a temporary buffer to hold the read in report from the host */
uint8_t ConsoleData[CONSOLE_EPSIZE];
/* Read Console Report Data */
Endpoint_Read_Stream_LE(&ConsoleData, sizeof(ConsoleData), NULL);
/* Process Console Report Data */
//ProcessConsoleHIDReport(ConsoleData);
}
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearOUT();
}
# endif
/* IN packet */
Endpoint_SelectEndpoint(CONSOLE_IN_EPNUM);
if (!Endpoint_IsEnabled() || !Endpoint_IsConfigured()) {
@ -237,6 +212,10 @@ static void Console_Task(void) {
Endpoint_SelectEndpoint(ep);
}
void console_task(void) {
// do nothing
}
#endif
/*******************************************************************************
@ -341,7 +320,7 @@ void EVENT_USB_Device_StartOfFrame(void) {
count = 0;
if (!console_flush) return;
Console_Task();
console_flush_task();
console_flush = false;
}
@ -381,9 +360,6 @@ void EVENT_USB_Device_ConfigurationChanged(void) {
#ifdef CONSOLE_ENABLE
/* Setup console endpoint */
ConfigSuccess &= Endpoint_ConfigureEndpoint((CONSOLE_IN_EPNUM | ENDPOINT_DIR_IN), EP_TYPE_INTERRUPT, CONSOLE_EPSIZE, 1);
# if 0
ConfigSuccess &= Endpoint_ConfigureEndpoint((CONSOLE_OUT_EPNUM | ENDPOINT_DIR_OUT), EP_TYPE_INTERRUPT, CONSOLE_EPSIZE, 1);
# endif
#endif
#ifdef MIDI_ENABLE
@ -627,7 +603,7 @@ int8_t sendchar(uint8_t c) {
// The `timed_out` state is an approximation of the ideal `is_listener_disconnected?` state.
static bool timed_out = false;
// prevents Console_Task() from running during sendchar() runs.
// prevents console_flush_task() from running during sendchar() runs.
// or char will be lost. These two function is mutually exclusive.
CONSOLE_FLUSH_SET(false);
@ -812,7 +788,7 @@ static void setup_usb(void) {
USB_Init();
// for Console_Task
// for console_flush_task
USB_Device_EnableSOFEvents();
}
@ -876,6 +852,10 @@ void protocol_pre_task(void) {
}
void protocol_post_task(void) {
#ifdef CONSOLE_ENABLE
console_task();
#endif
#ifdef MIDI_ENABLE
MIDI_Device_USBTask(&USB_MIDI_Interface);
#endif