This adopts a "writer" concept, vaguely inspired by the ta parameter writer. This might turn out to be not a great idea if the response/offsets for heterogenous commands are too inconvenient to keep track of. This breaks every example that uses maple--only example/maple_controller is updated to use the new interface.
26 lines
644 B
C++
26 lines
644 B
C++
#pragma once
|
|
|
|
#include "maple_bus_bits.hpp"
|
|
|
|
constexpr inline uint32_t ap_port_select(const uint32_t port)
|
|
{
|
|
switch (port) {
|
|
default: [[fallthrough]];
|
|
case 0: return ap::port_select::a;
|
|
case 1: return ap::port_select::b;
|
|
case 2: return ap::port_select::c;
|
|
case 3: return ap::port_select::d;
|
|
}
|
|
}
|
|
|
|
constexpr inline uint32_t host_instruction_port_select(const uint32_t port)
|
|
{
|
|
switch (port) {
|
|
default: [[fallthrough]];
|
|
case 0: return host_instruction::port_select::a;
|
|
case 1: return host_instruction::port_select::b;
|
|
case 2: return host_instruction::port_select::c;
|
|
case 3: return host_instruction::port_select::d;
|
|
}
|
|
}
|