def AcpiSdt.build

bend-osdev-acpi@0.1.1.0 · header.bend:260

import bend-osdev-acpi@0.1.1.0/header.bend as Header
import Base
import bend-osdev-bytes@0.1.1.0/bytes.bend as B
import bend-osdev-acpi@0.1.1.0/checksum.bend as C

260# Building: a header and a body as a table, with the length and checksum
261# fields computed (the header's own length and checksum are ignored)
262def AcpiSdt.build(h: AcpiHeader, +body: B.Octets) -> B.Octets:
263  match h:
264    case AcpiHeader{s, l, r, c, o, t, orv, ci, cr}:
265      +len = U32.from_nat(Nat.add(36n, B.Octets.len(body)))
266      C.AcpiChecksum.fix(9n, B.Octets.append(AcpiHeader.encode(AcpiHeader{s, len, r, 0, o, t, orv, ci, cr}), body))

Uses (8)

Used by (11)