ether2ser 0.1.0
Ethernet <-> synchronous V.24 bridge firmware for RP2040 + W5500
Loading...
Searching...
No Matches
error.c
Go to the documentation of this file.
1/*
2 * ether2ser — Ethernet <-> synchronous V.24 (RS-232/V.28) bridge
3 *
4 * File: src/system/error.c
5 * Purpose: Handles panic states.
6 *
7 * SPDX-License-Identifier: Apache-2.0
8 *
9 * Copyright (c) 2026 Florian <f.leuze@outlook.de>
10 */
11
12// Related headers
13#include "error.h"
14
15// Standard library headers
16#include <stdbool.h>
17
18// Library Headers
19#include "hardware/watchdog.h"
20#include "pico/platform/common.h"
21#include "pico/time.h"
22
23// Project Headers
24#include "system/common.h"
25
26// Generated headers
27
28#define WATCHDOG_PANIC_REBOOT_TIME_MS 50U
29
31{
32 LOG_ERROR("[FATAL] reason=%d\r\n", (int)reason);
33
34 // delay_ms gives log time to flush on USB CDC.
36 watchdog_reboot(0, 0, WATCHDOG_PANIC_REBOOT_TIME_MS);
37 while (true)
38 {
39 tight_loop_contents();
40 }
41}
#define LOG_ERROR(...)
Definition common.h:163
#define FLUSH_LOG_BEFORE_REBOOT_MS
Time to wait before rebooting to allow the logs to flush.
Definition common.h:57
#define WATCHDOG_PANIC_REBOOT_TIME_MS
Definition error.c:28
void fatal_panic(e2s_error_t reason)
Print error message and panic.
Definition error.c:30
e2s_error_t
Common error codes returned by ether2ser modules.
Definition error.h:27