建立 MAG160C 逆向工程交接仓库
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
#include "core/device.hpp"
|
||||
|
||||
#include <cassert>
|
||||
#include <vector>
|
||||
|
||||
int main() {
|
||||
using mag160c::core::EndpointDescriptor;
|
||||
using mag160c::core::EndpointPair;
|
||||
using mag160c::core::EndpointType;
|
||||
|
||||
const std::vector<EndpointDescriptor> endpoints = {
|
||||
{0x01, EndpointType::Interrupt},
|
||||
{0x82, EndpointType::Bulk},
|
||||
{0x03, EndpointType::Bulk},
|
||||
};
|
||||
|
||||
EndpointPair pair{};
|
||||
assert(mag160c::core::find_bulk_pair(endpoints, &pair));
|
||||
assert(pair.bulk_in == 0x82);
|
||||
assert(pair.bulk_out == 0x03);
|
||||
|
||||
const std::vector<EndpointDescriptor> missing_out = {
|
||||
{0x82, EndpointType::Bulk},
|
||||
};
|
||||
|
||||
pair = {};
|
||||
assert(!mag160c::core::find_bulk_pair(missing_out, &pair));
|
||||
assert(!mag160c::core::find_bulk_pair(endpoints, nullptr));
|
||||
|
||||
assert(mag160c::core::is_in_endpoint(0x82));
|
||||
assert(!mag160c::core::is_in_endpoint(0x03));
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user