Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/native/kernel/dev/pi5_wdt.c # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / native / kernel / dev / pi5_wdt.c` 49 lines ยท 1465 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 /* pi5_wdt.c -- see pi5_wdt.h. Pi 5 build only. */ 18 #ifndef CK_PI5 19 #error "pi5_wdt.c is Raspberry Pi 5 only (CK_PI5); never build it for another board" 20 #endif 21 #include "pi5_wdt.h" 22 #include "ck.h" 23 24 static volatile uint8_t *pm; 25 26 static uint32_t rd(uint32_t off) { return *(volatile uint32_t *)(pm + off); } 27 static void wr(uint32_t off, uint32_t v) { *(volatile uint32_t *)(pm + off) = v; } 28 29 int ck_pi5_wdt_arm(void) 30 { 31 pm = ck_mmio_map(CK_PI5_PM_PHYS, 0x1000); 32 if (!pm) 33 return -1; 34 ck_pi5_wdt_pet(); 35 wr(CK_PI5_PM_RSTC, ck_pi5_rstc_arm(rd(CK_PI5_PM_RSTC))); 36 return 0; 37 } 38 39 void ck_pi5_wdt_pet(void) 40 { 41 if (pm) 42 wr(CK_PI5_PM_WDOG, ck_pi5_wdog_value(CK_PI5_WDT_S)); 43 } 44 45 void ck_pi5_wdt_stop(void) 46 { 47 if (pm) 48 wr(CK_PI5_PM_RSTC, CK_PI5_PM_PASSWORD | CK_PI5_PM_RSTC_RESET); 49 }