interplane.Get Omega
Read in your language

rtl8127-omega

aien-dev/rtl8127-omega

Brought by drakestapleton

branch main Branches Tags History

rtl8127-omega / om / rtl8127 / hw.om

29 lines · 911 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0
2note hw.om: READ-ONLY hardware backend for rtl8127.om (rtlrd, rtlwr, rtldly, rtlbar), for the probe tool.
3note
4note It reads the chip through a read-only map of PCI BAR 2 (sysfs resource2). Omega's mapget reads aligned 32-bit words only, so a byte
5note or 16-bit register is read as its 32-bit word and shifted. rtlwr exits 90: nothing here may write to a real chip. A driver that
6note writes needs two things Omega does not have at the pinned compiler yet; see docs/GAPS.md.
7note Handle of the BAR mapping: hm[0].
8global hm long 2
9
10fn rtlrd off ulong w ulong to ulong
11base = and off not ulong 3
12v = mapget get hm 0 base 4
13sh = mul sub off base 8
14if eq w 4
15ret v
16end
17if eq w 2
18ret and shr v sh 65535
19end
20ret and shr v sh 255
21end
22fn rtlwr off ulong w ulong v ulong to void
23exit int 90
24end
25fn rtldly us ulong to void
26d = sleepns long mul us 1000
27end
28fn rtlbar to void
29end