This method will configure a UsbEndpointTransferDescriptor based on various flags. However, DTD structures can only be modified while they are not in an active state. This method returns true if it succeeded in modifying the dtd or false if something went wrong.
(
transfer_queue: &mut UsbEndpointTransferDescriptor,
addr: u32,
len: u32,
notify: bool,
)
| 372 | /// This method returns true if it succeeded in modifying the dtd |
| 373 | /// or false if something went wrong. |
| 374 | pub fn usb_prepare_transfer( |
| 375 | transfer_queue: &mut UsbEndpointTransferDescriptor, |
| 376 | addr: u32, |
| 377 | len: u32, |
| 378 | notify: bool, |
| 379 | ) -> bool { |
| 380 | if (transfer_queue.status & 0x80) == 0 { |
| 381 | transfer_queue.next = 1; |
| 382 | transfer_queue.status = (len << 16) | (1 << 7); |
| 383 | transfer_queue.pointer0 = addr; |
| 384 | transfer_queue.pointer1 = addr + 4096; |
| 385 | transfer_queue.pointer2 = addr + 8192; |
| 386 | transfer_queue.pointer3 = addr + 12288; |
| 387 | transfer_queue.pointer4 = addr + 16384; |
| 388 | |
| 389 | if notify { |
| 390 | transfer_queue.status |= 1 << 15; |
| 391 | } |
| 392 | |
| 393 | return true; |
| 394 | } |
| 395 | |
| 396 | // Something went wrong. |
| 397 | return false; |
| 398 | } |
| 399 | |
| 400 | /// This method will enqueue the transfer descriptor into the endpoint |
| 401 | /// and prime it for receiving new data. |
no outgoing calls
no test coverage detected