Skip to content

Commit

Permalink
Implement missing USB functions as not-implemented warnings so everyt…
Browse files Browse the repository at this point in the history
…hing works as before on non-rp platforms for now
  • Loading branch information
M3gaFr3ak committed Sep 25, 2024
1 parent e3cd9e9 commit 07972ee
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 8 deletions.
25 changes: 22 additions & 3 deletions embassy-nrf/src/usb/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ use cortex_m::peripheral::NVIC;
use embassy_hal_internal::{into_ref, PeripheralRef};
use embassy_sync::waitqueue::AtomicWaker;
use embassy_usb_driver as driver;
use embassy_usb_driver::{Direction, EndpointAddress, EndpointError, EndpointInfo, EndpointType, Event, Unsupported};
use embassy_usb_driver::{
Direction, EndpointAddress, EndpointError, EndpointInfo, EndpointType, Event, SynchronizationType, Unsupported,
UsageType,
};
use pac::usbd::RegisterBlock;

use self::vbus_detect::VbusDetect;
Expand Down Expand Up @@ -166,6 +169,14 @@ impl<'d, T: Instance, V: VbusDetect + 'd> driver::Driver<'d> for Driver<'d, T, V
},
)
}

fn grow_endpoint_in_buffer(&mut self, ep: &mut Self::EndpointIn, new_max_packet_size: u16) {
warn!("Not implemented yet!!!");
}

fn grow_endpoint_out_buffer(&mut self, ep: &mut Self::EndpointOut, new_max_packet_size: u16) {
warn!("Not implemented yet!!!");
}
}

/// USB bus.
Expand Down Expand Up @@ -307,11 +318,19 @@ impl<'d, T: Instance, V: VbusDetect> driver::Bus for Bus<'d, T, V> {
}

fn endpoint_set_buffersize(&mut self, ep_addr: EndpointAddress, buf_size: u16) {
todo!();
warn!("Not implemented yet!!!");
}

fn endpoint_set_sync_type(&mut self, ep_addr: EndpointAddress, synchronization_type: SynchronizationType) {
warn!("Not implemented yet!!!");
}

fn endpoint_set_usage_type(&mut self, ep_addr: EndpointAddress, usage_type: UsageType) {
warn!("Not implemented yet!!!");
}

fn endpoint_set_type(&mut self, ep_addr: EndpointAddress, ep_type: EndpointType) {
todo!();
warn!("Not implemented yet!!!");
}

fn endpoint_set_enabled(&mut self, ep_addr: EndpointAddress, enabled: bool) {
Expand Down
26 changes: 25 additions & 1 deletion embassy-stm32/src/usb/otg.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use core::marker::PhantomData;

use embassy_hal_internal::{into_ref, Peripheral};
use embassy_usb_driver::{EndpointAddress, EndpointAllocError, EndpointType, Event, Unsupported};
use embassy_usb_driver::{EndpointAddress, EndpointAllocError, EndpointType, Event, SynchronizationType, Unsupported, UsageType};
use embassy_usb_synopsys_otg::otg_v1::vals::Dspd;
use embassy_usb_synopsys_otg::otg_v1::Otg;
pub use embassy_usb_synopsys_otg::Config;
Expand Down Expand Up @@ -234,6 +234,14 @@ impl<'d, T: Instance> embassy_usb_driver::Driver<'d> for Driver<'d, T> {
cp,
)
}

fn grow_endpoint_in_buffer(&mut self, ep: &mut Self::EndpointIn, new_max_packet_size: u16) {
warn!("Not implemented yet!!!");
}

fn grow_endpoint_out_buffer(&mut self, ep: &mut Self::EndpointOut, new_max_packet_size: u16) {
warn!("Not implemented yet!!!");
}
}

/// USB bus.
Expand Down Expand Up @@ -320,6 +328,22 @@ impl<'d, T: Instance> embassy_usb_driver::Bus for Bus<'d, T> {
self.inner.endpoint_is_stalled(ep_addr)
}

fn endpoint_set_buffersize(&mut self, ep_addr: EndpointAddress, buf_size: u16) {
warn!("Not implemented yet!!!");
}

fn endpoint_set_sync_type(&mut self, ep_addr: EndpointAddress, synchronization_type: SynchronizationType) {
warn!("Not implemented yet!!!");
}

fn endpoint_set_usage_type(&mut self, ep_addr: EndpointAddress, usage_type: UsageType) {
warn!("Not implemented yet!!!");
}

fn endpoint_set_type(&mut self, ep_addr: EndpointAddress, ep_type: EndpointType) {
warn!("Not implemented yet!!!");
}

fn endpoint_set_enabled(&mut self, ep_addr: EndpointAddress, enabled: bool) {
self.inner.endpoint_set_enabled(ep_addr, enabled)
}
Expand Down
21 changes: 19 additions & 2 deletions embassy-stm32/src/usb/usb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,15 @@ impl<'d, T: Instance> driver::Driver<'d> for Driver<'d, T> {
},
)
}

fn grow_endpoint_in_buffer(&mut self, ep: &mut Self::EndpointIn, new_max_packet_size: u16) {
warn!("Not implemented yet!!!");
}


fn grow_endpoint_out_buffer(&mut self, ep: &mut Self::EndpointOut, new_max_packet_size: u16) {
warn!("Not implemented yet!!!");
}
}

/// USB bus.
Expand Down Expand Up @@ -643,11 +652,19 @@ impl<'d, T: Instance> driver::Bus for Bus<'d, T> {
}

fn endpoint_set_buffersize(&mut self, ep_addr: EndpointAddress, buf_size: u16) {
todo!();
warn!("Not implemented yet!!!");
}

fn endpoint_set_sync_type(&mut self, ep_addr: EndpointAddress, synchronization_type: SynchronizationType) {
warn!("Not implemented yet!!!");
}

fn endpoint_set_usage_type(&mut self, ep_addr: EndpointAddress, usage_type: UsageType) {
warn!("Not implemented yet!!!");
}

fn endpoint_set_type(&mut self, ep_addr: EndpointAddress, ep_type: EndpointType) {
todo!();
warn!("Not implemented yet!!!");
}

fn endpoint_set_enabled(&mut self, ep_addr: EndpointAddress, enabled: bool) {
Expand Down
27 changes: 25 additions & 2 deletions embassy-usb-synopsys-otg/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ use core::task::Poll;

use embassy_sync::waitqueue::AtomicWaker;
use embassy_usb_driver::{
Bus as _, Direction, EndpointAddress, EndpointAllocError, EndpointError, EndpointIn, EndpointInfo, EndpointOut,
EndpointType, Event, Unsupported,
Bus as _, Direction, EndpointAddress, EndpointAllocError, EndpointError, EndpointIn, EndpointInfo, EndpointOut, EndpointType, Event, SynchronizationType, Unsupported, UsageType
};

pub mod otg_v1;
Expand Down Expand Up @@ -496,6 +495,14 @@ impl<'d, const MAX_EP_COUNT: usize> embassy_usb_driver::Driver<'d> for Driver<'d
},
)
}

fn grow_endpoint_in_buffer(&mut self, ep: &mut Self::EndpointIn, new_max_packet_size: u16) {
warn!("Not implemented yet!!!");
}

fn grow_endpoint_out_buffer(&mut self, ep: &mut Self::EndpointOut, new_max_packet_size: u16) {
warn!("Not implemented yet!!!");
}
}

/// USB bus.
Expand Down Expand Up @@ -881,6 +888,22 @@ impl<'d, const MAX_EP_COUNT: usize> embassy_usb_driver::Bus for Bus<'d, MAX_EP_C
}
}

fn endpoint_set_buffersize(&mut self, ep_addr: EndpointAddress, buf_size: u16) {
warn!("Not implemented yet!!!");
}

fn endpoint_set_sync_type(&mut self, ep_addr: EndpointAddress, synchronization_type: SynchronizationType) {
warn!("Not implemented yet!!!");
}

fn endpoint_set_usage_type(&mut self, ep_addr: EndpointAddress, usage_type: UsageType) {
warn!("Not implemented yet!!!");
}

fn endpoint_set_type(&mut self, ep_addr: EndpointAddress, ep_type: EndpointType) {
warn!("Not implemented yet!!!");
}

fn endpoint_set_enabled(&mut self, ep_addr: EndpointAddress, enabled: bool) {
trace!("endpoint_set_enabled ep={:?} en={}", ep_addr, enabled);

Expand Down

0 comments on commit 07972ee

Please sign in to comment.