dreamcast/maple/maple_port.hpp
Zack Buhman 9801557535 maple: slightly refactor maple command initialization
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.
2024-05-21 15:05:25 -05:00

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;
}
}