|
1 | 1 | #
|
2 | 2 | # This file is part of LUNA.
|
3 | 3 | #
|
4 |
| -# Copyright (c) 2020 Great Scott Gadgets <[email protected]> |
| 4 | +# Copyright (c) 2020-2025 Great Scott Gadgets <[email protected]> |
5 | 5 | # SPDX-License-Identifier: BSD-3-Clause
|
6 | 6 |
|
7 | 7 | """ Endpoint interfaces for isochronous endpoints.
|
|
10 | 10 | interfaces to hosts via isochronous pipes.
|
11 | 11 | """
|
12 | 12 |
|
13 |
| -from amaranth import Elaboratable, Module, Signal |
| 13 | +from amaranth import * |
| 14 | +from amaranth.lib import stream, wiring |
| 15 | +from amaranth.lib .wiring import In, Out |
14 | 16 |
|
15 |
| -from ..endpoint import EndpointInterface |
16 |
| -from ...stream import StreamInterface, USBOutStreamBoundaryDetector |
17 |
| -from ....memory import TransactionalizedFIFO |
| 17 | +from ..endpoint import EndpointInterface |
| 18 | +from ...stream import USBOutStreamBoundaryDetector |
| 19 | +from ....stream.future import Packet |
| 20 | +from ....memory import TransactionalizedFIFO |
18 | 21 |
|
19 | 22 |
|
20 | 23 | class USBIsochronousStreamOutEndpoint(Elaboratable):
|
@@ -52,10 +55,13 @@ def __init__(self, *, endpoint_number, max_packet_size, buffer_size=None):
|
52 | 55 | #
|
53 | 56 | # I/O port
|
54 | 57 | #
|
55 |
| - self.stream = StreamInterface() |
| 58 | + self.stream = stream.Interface( |
| 59 | + stream.Signature( |
| 60 | + Packet(unsigned(8)) |
| 61 | + ) |
| 62 | + ) |
56 | 63 | self.interface = EndpointInterface()
|
57 | 64 |
|
58 |
| - |
59 | 65 | def elaborate(self, platform):
|
60 | 66 | m = Module()
|
61 | 67 |
|
@@ -122,17 +128,17 @@ def elaborate(self, platform):
|
122 | 128 |
|
123 | 129 | # Our stream data always comes directly out of the FIFO; and is valid
|
124 | 130 | # whenever our FIFO actually has data for us to read.
|
125 |
| - stream.valid .eq(~fifo.empty), |
126 |
| - stream.payload .eq(fifo.read_data[0:8]), |
| 131 | + stream.valid .eq(~fifo.empty), |
| 132 | + stream.p.data .eq(fifo.read_data[0:8]), |
127 | 133 |
|
128 | 134 | # Our `last` bit comes directly from the FIFO; and we know a `first` bit immediately
|
129 | 135 | # follows a `last` one.
|
130 |
| - stream.last .eq(fifo.read_data[8]), |
131 |
| - stream.first .eq(fifo.read_data[9]), |
| 136 | + stream.p.last .eq(fifo.read_data[8]), |
| 137 | + stream.p.first .eq(fifo.read_data[9]), |
132 | 138 |
|
133 |
| - # Move to the next byte in the FIFO whenever our stream is advaced. |
134 |
| - fifo.read_en .eq(stream.ready), |
135 |
| - fifo.read_commit .eq(1) |
| 139 | + # Move to the next byte in the FIFO whenever our stream is advanced. |
| 140 | + fifo.read_en .eq(stream.ready), |
| 141 | + fifo.read_commit .eq(1) |
136 | 142 | ]
|
137 | 143 |
|
138 | 144 | # Count bytes in packet.
|
|
0 commit comments