refactor: move function down + set #[inline(always)] for small functions
This commit is contained in:
parent
a1e180b451
commit
ba319eecff
|
@ -82,13 +82,6 @@ pub(crate) const ENDPOINTS_ALLOC_LAYOUT: [u16; MAX_ENDPOINTS] = [64, 256, 64, 64
|
||||||
pub(crate) const ONE_MS_16_MGHZ: u32 = 16000;
|
pub(crate) const ONE_MS_16_MGHZ: u32 = 16000;
|
||||||
|
|
||||||
impl<const L: usize> UsbDevice<L> {
|
impl<const L: usize> UsbDevice<L> {
|
||||||
#[inline]
|
|
||||||
pub(crate) fn get_size(&self, cs: CriticalSection<'_>) -> usize {
|
|
||||||
let usb = self.usb.borrow(cs);
|
|
||||||
|
|
||||||
(((usb.uebchx.read().bits() as u16) << 8) | (usb.uebclx.read().bits() as u16)).into()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new(pll: PLL, usb: USB_DEVICE) -> UsbBusAllocator<Self> {
|
pub fn new(pll: PLL, usb: USB_DEVICE) -> UsbBusAllocator<Self> {
|
||||||
UsbBusAllocator::new(Self {
|
UsbBusAllocator::new(Self {
|
||||||
|
@ -101,6 +94,8 @@ impl<const L: usize> UsbDevice<L> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
pub(crate) fn allocated_endpoints(&self) -> impl Iterator<Item = (usize, &USBEndpoint)> {
|
pub(crate) fn allocated_endpoints(&self) -> impl Iterator<Item = (usize, &USBEndpoint)> {
|
||||||
self.ep_table
|
self.ep_table
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -178,4 +173,11 @@ impl<const L: usize> UsbDevice<L> {
|
||||||
Err(exception) => Err(exception),
|
Err(exception) => Err(exception),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
|
pub(crate) fn get_size(&self, cs: CriticalSection<'_>) -> usize {
|
||||||
|
let usb = self.usb.borrow(cs);
|
||||||
|
|
||||||
|
(((usb.uebchx.read().bits() as u16) << 8) | (usb.uebclx.read().bits() as u16)).into()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue