Use a map to store endpoint descriptors. Allows easy access to a

particular endpoint number.
This commit is contained in:
Sebastian Zagrodzki
2017-04-29 12:19:34 +02:00
parent 77c176cd4c
commit 6d81ca37d3
4 changed files with 79 additions and 64 deletions

View File

@@ -44,17 +44,20 @@ var (
Number: 0,
Alternate: 0,
Class: ClassVendorSpec,
Endpoints: []EndpointInfo{{
Number: 1,
Direction: EndpointDirectionOut,
MaxPacketSize: 512,
TransferType: TransferTypeBulk,
}, {
Number: 2,
Direction: EndpointDirectionIn,
MaxPacketSize: 512,
TransferType: TransferTypeBulk,
}},
Endpoints: map[int]EndpointInfo{
1: {
Number: 1,
Direction: EndpointDirectionOut,
MaxPacketSize: 512,
TransferType: TransferTypeBulk,
},
2: {
Number: 2,
Direction: EndpointDirectionIn,
MaxPacketSize: 512,
TransferType: TransferTypeBulk,
},
},
}},
}},
}},
@@ -87,49 +90,58 @@ var (
Number: 1,
Alternate: 0,
Class: ClassVendorSpec,
Endpoints: []EndpointInfo{{
Number: 5,
Direction: EndpointDirectionOut,
MaxPacketSize: 3 * 1024,
TransferType: TransferTypeIsochronous,
UsageType: IsoUsageTypeData,
}, {
Number: 6,
Direction: EndpointDirectionIn,
MaxPacketSize: 3 * 1024,
TransferType: TransferTypeIsochronous,
UsageType: IsoUsageTypeData,
}},
Endpoints: map[int]EndpointInfo{
5: {
Number: 5,
Direction: EndpointDirectionOut,
MaxPacketSize: 3 * 1024,
TransferType: TransferTypeIsochronous,
UsageType: IsoUsageTypeData,
},
6: {
Number: 6,
Direction: EndpointDirectionIn,
MaxPacketSize: 3 * 1024,
TransferType: TransferTypeIsochronous,
UsageType: IsoUsageTypeData,
},
},
}, {
Number: 1,
Alternate: 1,
Class: ClassVendorSpec,
Endpoints: []EndpointInfo{{
Number: 5,
Direction: EndpointDirectionOut,
MaxPacketSize: 2 * 1024,
TransferType: TransferTypeIsochronous,
}, {
Number: 6,
Direction: EndpointDirectionIn,
MaxPacketSize: 2 * 1024,
TransferType: TransferTypeIsochronous,
}},
Endpoints: map[int]EndpointInfo{
5: {
Number: 5,
Direction: EndpointDirectionOut,
MaxPacketSize: 2 * 1024,
TransferType: TransferTypeIsochronous,
},
6: {
Number: 6,
Direction: EndpointDirectionIn,
MaxPacketSize: 2 * 1024,
TransferType: TransferTypeIsochronous,
},
},
}, {
Number: 1,
Alternate: 2,
Class: ClassVendorSpec,
Endpoints: []EndpointInfo{{
Number: 5,
Direction: EndpointDirectionIn,
MaxPacketSize: 1024,
TransferType: TransferTypeIsochronous,
}, {
Number: 6,
Direction: EndpointDirectionIn,
MaxPacketSize: 1024,
TransferType: TransferTypeIsochronous,
}},
Endpoints: map[int]EndpointInfo{
5: {
Number: 5,
Direction: EndpointDirectionIn,
MaxPacketSize: 1024,
TransferType: TransferTypeIsochronous,
},
6: {
Number: 6,
Direction: EndpointDirectionIn,
MaxPacketSize: 1024,
TransferType: TransferTypeIsochronous,
},
},
}},
}},
}},