Create unified adapter managing multiple controllers.
21 {
22
23 if (hwControllers.
empty()) {
24 FL_WARN(
"SpiChannelEngineAdapter::create: No controllers provided");
25 return nullptr;
26 }
27
28 if (hwControllers.
size() != priorities.
size() || hwControllers.
size() != names.
size()) {
29 FL_WARN(
"SpiChannelEngineAdapter::create: Size mismatch in arguments");
30 return nullptr;
31 }
32
33 if (!adapterName || adapterName[0] == '\0') {
34 FL_WARN(
"SpiChannelEngineAdapter::create: Empty adapter name");
35 return nullptr;
36 }
37
38
40
41
42 for (
size_t i = 0; i < hwControllers.
size(); i++) {
43 if (!hwControllers[i]) {
44 FL_WARN(
"SpiChannelEngineAdapter: Null controller at index " << i);
45 continue;
46 }
47
48 adapter->mControllers.emplace_back(hwControllers[i], priorities[i], names[i]);
49
50 FL_DBG(
"SpiChannelEngineAdapter: Registered controller '" << names[i] <<
"' (priority " << priorities[i] <<
", lanes: " << (
static_cast<int>(hwControllers[i]->getLaneCount())) <<
")");
51 }
52
53 if (adapter->mControllers.empty()) {
54 FL_WARN(
"SpiChannelEngineAdapter: No valid controllers registered");
55 return nullptr;
56 }
57
58 for (auto& ctrl : adapter->mControllers) {
60 }
61
62 return adapter;
63}
static void streamCompletionThunk(void *context) FL_NO_EXCEPT
fl::size size() const FL_NO_EXCEPT
bool empty() const FL_NO_EXCEPT
shared_ptr< T > make_shared(Args &&... args) FL_NO_EXCEPT