interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / native / kernel / tests / test_pi5.c

34 lines · 1501 bytes Raw Blame History
1/* SPDX-License-Identifier: Apache-2.0
2 * Copyright 2026 Drake Stapleton (AIEN / aien-dev)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/* test_pi5.c -- Pi 5 build register values (dev/pi5_wdt.h) against the
18 * Linux bcm2835_wdt.c sequence: PM_WDOG = password | (secs << 16 & 0xfffff),
19 * PM_RSTC = password | (cur & ~0x30) | 0x20. */
20#include "ck_test.h"
21#include "../dev/pi5_wdt.h"
22
23int main(void)
24{
25 CHECK(ck_pi5_wdog_value(15) == (0x5a000000u | 0x000f0000u));
26 CHECK(ck_pi5_wdog_value(1) == 0x5a010000u);
27 CHECK(ck_pi5_wdog_value(16) == 0x5a000000u); /* 16 s does not fit: shows why the default is 15 */
28 CHECK(CK_PI5_WDT_S <= 15u && CK_PI5_WDT_S >= 1u);
29 CHECK(ck_pi5_rstc_arm(0x00000000u) == 0x5a000020u);
30 CHECK(ck_pi5_rstc_arm(0xffffffffu) == (0x5a000000u | 0xffffffcfu | 0x20u));
31 CHECK(ck_pi5_rstc_arm(0x00000030u) == 0x5a000020u); /* old WRCFG bits cleared first */
32 CHECK(CK_PI5_PM_PHYS == 0x107d200000ull);
33 return ck_t_verdict("test_pi5");
34}