23
23
24
24
from luna import top_level_cli
25
25
from luna .usb2 import (USBDevice ,
26
- USBIsochronousInMemoryEndpoint ,
27
- USBIsochronousOutStreamEndpoint ,
28
- USBIsochronousInStreamEndpoint ,
26
+ USBIsochronousInEndpoint ,
27
+ USBIsochronousStreamOutEndpoint ,
28
+ USBIsochronousStreamInEndpoint ,
29
29
USBStreamInEndpoint ,
30
30
USBStreamOutEndpoint )
31
31
@@ -354,17 +354,17 @@ def elaborate(self, platform):
354
354
(setup .type == USBRequestType .RESERVED )
355
355
control_ep .add_request_handler (StallOnlyRequestHandler (stall_condition ))
356
356
357
- ep1_out = USBIsochronousOutStreamEndpoint (
357
+ ep1_out = USBIsochronousStreamOutEndpoint (
358
358
endpoint_number = 1 , # EP 1 OUT
359
359
max_packet_size = self .MAX_PACKET_SIZE )
360
360
usb .add_endpoint (ep1_out )
361
361
362
- ep1_in = USBIsochronousInMemoryEndpoint (
362
+ ep1_in = USBIsochronousInEndpoint (
363
363
endpoint_number = 1 , # EP 1 IN
364
364
max_packet_size = 4 )
365
365
usb .add_endpoint (ep1_in )
366
366
367
- ep2_in = USBIsochronousInStreamEndpoint (
367
+ ep2_in = USBIsochronousStreamInEndpoint (
368
368
endpoint_number = 2 , # EP 2 IN
369
369
max_packet_size = self .MAX_PACKET_SIZE )
370
370
usb .add_endpoint (ep2_in )
@@ -388,12 +388,12 @@ def elaborate(self, platform):
388
388
with m .If (audio_in_frame_bytes_counting ):
389
389
m .d .usb += audio_in_frame_bytes .eq (audio_in_frame_bytes + 1 )
390
390
391
- with m .If (ep1_out .stream .first ):
391
+ with m .If (ep1_out .stream .payload . first ):
392
392
m .d .usb += [
393
393
audio_in_frame_bytes .eq (1 ),
394
394
audio_in_frame_bytes_counting .eq (1 ),
395
395
]
396
- with m .Elif (ep1_out .stream .last ):
396
+ with m .Elif (ep1_out .stream .payload . last ):
397
397
m .d .usb += audio_in_frame_bytes_counting .eq (0 )
398
398
399
399
# Connect our device as a high speed device
@@ -476,11 +476,10 @@ def detect_active_audio_in(m, name: str, usb, ep2_in):
476
476
477
477
usb_audio_in_active = detect_active_audio_in (m , "usb" , usb , ep2_in )
478
478
479
- m .d .comb += [
480
- # Wire USB <-> stream synchronizers
481
- usb_to_channel_stream .usb_stream_in .stream_eq (ep1_out .stream ),
482
- ep2_in .stream .stream_eq (channels_to_usb_stream .usb_stream_out ),
479
+ wiring .connect (m , wiring .flipped (usb_to_channel_stream .usb_stream_in ), ep1_out .stream )
480
+ wiring .connect (m , wiring .flipped (ep2_in .stream ), channels_to_usb_stream .usb_stream_out )
483
481
482
+ m .d .comb += [
484
483
channels_to_usb_stream .no_channels_in .eq (self .NR_CHANNELS ),
485
484
channels_to_usb_stream .data_requested_in .eq (ep2_in .data_requested ),
486
485
channels_to_usb_stream .frame_finished_in .eq (ep2_in .frame_finished ),
@@ -585,14 +584,14 @@ def detect_active_audio_in(m, name: str, usb, ep2_in):
585
584
#usb_to_channel_stream.channel_stream_out.valid,
586
585
#usb_to_channel_stream.garbage_seen_out,
587
586
588
- # interface from IsochronousOutStreamEndpoint
587
+ # interface from IsochronousStreamOutEndpoint
589
588
#usb_to_channel_stream.usb_stream_in.first,
590
589
#usb_to_channel_stream.usb_stream_in.valid,
591
590
#usb_to_channel_stream.usb_stream_in.payload,
592
591
#usb_to_channel_stream.usb_stream_in.last,
593
592
#usb_to_channel_stream.usb_stream_in.ready,
594
593
595
- # interface to IsochronousOutStreamEndpoint
594
+ # interface to IsochronousStreamOutEndpoint
596
595
#ep1_out.interface.rx.next,
597
596
#ep1_out.interface.rx.valid,
598
597
#ep1_out.interface.rx.payload,
0 commit comments