rtl8127-omega
aien-dev/rtl8127-omega
Brought by drakestapleton
rtl8127-omega / om / rtl8127 / hw.om
| 1 | note SPDX-License-Identifier: Apache-2.0 |
| 2 | note hw.om: READ-ONLY hardware backend for rtl8127.om (rtlrd, rtlwr, rtldly, rtlbar), for the probe tool. |
| 3 | note |
| 4 | note 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 |
| 5 | note 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 |
| 6 | note writes needs two things Omega does not have at the pinned compiler yet; see docs/GAPS.md. |
| 7 | note Handle of the BAR mapping: hm[0]. |
| 8 | global hm long 2 |
| 9 | |
| 10 | fn rtlrd off ulong w ulong to ulong |
| 11 | base = and off not ulong 3 |
| 12 | v = mapget get hm 0 base 4 |
| 13 | sh = mul sub off base 8 |
| 14 | if eq w 4 |
| 15 | ret v |
| 16 | end |
| 17 | if eq w 2 |
| 18 | ret and shr v sh 65535 |
| 19 | end |
| 20 | ret and shr v sh 255 |
| 21 | end |
| 22 | fn rtlwr off ulong w ulong v ulong to void |
| 23 | exit int 90 |
| 24 | end |
| 25 | fn rtldly us ulong to void |
| 26 | d = sleepns long mul us 1000 |
| 27 | end |
| 28 | fn rtlbar to void |
| 29 | end |