- EEM class indented

This commit is contained in:
Wiesner András 2024-06-25 07:17:29 +02:00
parent f6e3d48476
commit d140d7c183

View File

@ -97,17 +97,17 @@ int usb_eem_process_and_return(USB_CallbackEvent *cbevt) {
uint16_t bytesLeft = eems.hostbFrameLength - eems.hostbFrameIndex; // calculate bytes left uint16_t bytesLeft = eems.hostbFrameLength - eems.hostbFrameIndex; // calculate bytes left
uint32_t writeSize = usbcore_schedule_transmission(eems.data_ep, readPtr, bytesLeft); // attempt to schedule transmission uint32_t writeSize = usbcore_schedule_transmission(eems.data_ep, readPtr, bytesLeft); // attempt to schedule transmission
//bool enableZLP = (bytesLeft < EEM_TRANSFER_UNIT) && ((bytesLeft % EEM_PCKT_SIZE) == 0); // ZLP transmission should be enabled if this was the last write and transfer size is integer multiple of the USB packet size // bool enableZLP = (bytesLeft < EEM_TRANSFER_UNIT) && ((bytesLeft % EEM_PCKT_SIZE) == 0); // ZLP transmission should be enabled if this was the last write and transfer size is integer multiple of the USB packet size
//cbevt->enable_autozlp = enableZLP; // cbevt->enable_autozlp = enableZLP;
eems.hostbFrameIndex += writeSize; // advance frame index eems.hostbFrameIndex += writeSize; // advance frame index
//MSG("U: %u T: %u\n", writeSize, bytesLeft); // MSG("U: %u T: %u\n", writeSize, bytesLeft);
// if (eems.hostbFrameIndex >= eems.hostbFrameLength) { // if (eems.hostbFrameIndex >= eems.hostbFrameLength) {
// MSG("---\n"); // MSG("---\n");
// } // }
} else { // no data is waiting for transmission } else { // no data is waiting for transmission
//usbcore_schedule_transmission(eems.data_ep, NULL, 0); // send ZLP // usbcore_schedule_transmission(eems.data_ep, NULL, 0); // send ZLP
} }
// if FIFO is empty or flushed, then send notification // if FIFO is empty or flushed, then send notification
@ -241,7 +241,7 @@ void usb_eem_process_hostbound() {
} }
// invalidate frame // invalidate frame
USB_EemFrame * oldEemFrame = eems.hostbFrame; USB_EemFrame *oldEemFrame = eems.hostbFrame;
eems.hostbFrame = NULL; eems.hostbFrame = NULL;
// release frame // release frame
@ -300,6 +300,10 @@ void usb_eem_ethernet_intercept_cb(EthInterface *intf, const RawPckt *rawPckt) {
} }
void usb_eem_set_intf(EthInterface *intf) { void usb_eem_set_intf(EthInterface *intf) {
if (!eems.initialized) {
return;
}
eems.intf = intf; // store interface eems.intf = intf; // store interface
ethinf_set_intercept_callback(intf, usb_eem_ethernet_intercept_cb); // set intercept callback ethinf_set_intercept_callback(intf, usb_eem_ethernet_intercept_cb); // set intercept callback
} }