stm32_pins: botloader guards

This commit is contained in:
Andrey Gusakov 2024-05-09 15:09:58 +03:00 committed by rusefillc
parent 207a3d8c98
commit e8a0ee051a
1 changed files with 7 additions and 1 deletions

View File

@ -67,13 +67,16 @@ const char *portname(ioportid_t port) {
}
static int getPortIndex(ioportid_t port) {
efiAssert(ObdCode::CUSTOM_ERR_ASSERT, port != NULL, "null port", -1);
for (size_t idx = 0; idx < efi::size(ports); idx++) {
if (ports[idx].port == port) {
return idx;
}
}
#if ! EFI_BOOTLOADER
firmwareError(ObdCode::CUSTOM_ERR_UNKNOWN_PORT, "unknown port");
#endif
return -1;
}
@ -97,7 +100,10 @@ ioportid_t getHwPort(const char *msg, brain_pin_e brainPin) {
return ports[idx].port;
}
#if ! EFI_BOOTLOADER
firmwareError(ObdCode::CUSTOM_ERR_UNKNOWN_PORT, "unknown port");
#endif
return nullptr;
}