aboutsummaryrefslogtreecommitdiffstats
path: root/usbh/src
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2019-07-28 16:46:30 -0400
committerBrian Cully <bjc@kublai.com>2019-07-28 16:46:30 -0400
commita175b1477ad6cfad765eb058dd5e2f2de8833a29 (patch)
tree96419fac102a010af090deb986c9937245836649 /usbh/src
parent0d2471fef27c6abe5cb34f59f80c5c53ba07da19 (diff)
downloadsamd21-demo-a175b1477ad6cfad765eb058dd5e2f2de8833a29.tar.gz
samd21-demo-a175b1477ad6cfad765eb058dd5e2f2de8833a29.zip
`control_req` -> `control_transfer`.
Same as in/out transfer functions now, and matches USB spec terminology.
Diffstat (limited to 'usbh/src')
-rw-r--r--usbh/src/device.rs16
-rwxr-xr-xusbh/src/lib.rs4
-rw-r--r--usbh/src/pipe.rs2
3 files changed, 13 insertions, 9 deletions
diff --git a/usbh/src/device.rs b/usbh/src/device.rs
index bdb993e..e77c9ea 100644
--- a/usbh/src/device.rs
+++ b/usbh/src/device.rs
@@ -9,6 +9,10 @@ use log::{debug, error, info, trace};
use atsamd_hal::target_device::usb;
const MAX_DEVICES: usize = 16;
+
+// TODO:
+// This may be wrong. It may be 15 additional input + 15 additional
+// output! cf ยง5.3.1.2 of USB 2.0.
const MAX_ENDPOINTS: usize = 16;
// How long to wait before talking to the device again after setting
@@ -140,7 +144,7 @@ impl Device {
let mut vol_descr =
::vcell::VolatileCell::<DeviceDescriptor>::new(Default::default());
- pipe.control_req(
+ pipe.control_transfer(
RequestType::get_descr(),
RequestCode::GetDescriptor,
WValue::from((0, DescriptorType::Device as u8)),
@@ -162,7 +166,7 @@ impl Device {
let mut vol_descr =
::vcell::VolatileCell::<ConfigurationDescriptor>::new(Default::default());
- pipe.control_req(
+ pipe.control_transfer(
RequestType::get_descr(),
RequestCode::GetDescriptor,
WValue::from((0, DescriptorType::Configuration as u8)),
@@ -177,7 +181,7 @@ impl Device {
assert!(desc.w_total_length < 64);
let buf: [u8; 64] = [0; 64];
let mut tmp = &buf[..desc.w_total_length as usize];
- pipe.control_req(
+ pipe.control_transfer(
RequestType::get_descr(),
RequestCode::GetDescriptor,
WValue::from((0, DescriptorType::Configuration as u8)),
@@ -194,7 +198,7 @@ impl Device {
debug!("+++ setting configuration");
let conf: u8 = 1;
- pipe.control_req(
+ pipe.control_transfer(
RequestType::set(),
RequestCode::SetConfiguration,
WValue::from((conf, 0)),
@@ -205,7 +209,7 @@ impl Device {
debug!(" -- configuration set");
debug!("+++ setting idle");
- pipe.control_req(
+ pipe.control_transfer(
RequestType::from((
RequestDirection::HostToDevice,
RequestKind::Class,
@@ -221,7 +225,7 @@ impl Device {
debug!("+++ setting report");
let mut rep_res: u8 = 0;
- pipe.control_req(
+ pipe.control_transfer(
RequestType::from((
RequestDirection::HostToDevice,
RequestKind::Class,
diff --git a/usbh/src/lib.rs b/usbh/src/lib.rs
index 70acc31..1cd8a1a 100755
--- a/usbh/src/lib.rs
+++ b/usbh/src/lib.rs
@@ -360,7 +360,7 @@ where
fn configure_dev(&mut self) -> Result<(), PipeErr> {
let mut pipe = self.pipe_table.pipe_for(self.usb.host_mut(), 0, 0);
let mut vol_descr = ::vcell::VolatileCell::<DeviceDescriptor>::new(Default::default());
- pipe.control_req(
+ pipe.control_transfer(
RequestType::get_descr(),
RequestCode::GetDescriptor,
WValue::from((0, DescriptorType::Device as u8)),
@@ -378,7 +378,7 @@ where
Some(device) => {
device.max_packet_size = desc.b_max_packet_size;
debug!("Setting address to {}.", device.addr);
- pipe.control_req(
+ pipe.control_transfer(
RequestType::set(),
RequestCode::SetAddress,
WValue::from((device.addr, 0)),
diff --git a/usbh/src/pipe.rs b/usbh/src/pipe.rs
index 835ba86..660a21e 100644
--- a/usbh/src/pipe.rs
+++ b/usbh/src/pipe.rs
@@ -101,7 +101,7 @@ pub(crate) struct Pipe<'a, 'b> {
pub(crate) desc: &'a mut PipeDesc,
}
impl Pipe<'_, '_> {
- pub(crate) fn control_req<T>(
+ pub(crate) fn control_transfer<T>(
&mut self,
bm_request_type: RequestType,
b_request: RequestCode,