gitlab.com/apertussolutions/u-root@v7.0.0+incompatible/cmds/core/io/ports.go (about) 1 // Copyright 2012-2020 the u-root Authors. All rights reserved 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // +build amd64 386 6 7 package main 8 9 import ( 10 "github.com/u-root/u-root/pkg/memio" 11 ) 12 13 func init() { 14 usageMsg += `io (in{b,w,l} address)... 15 io (out{b,w,l} address value)... 16 ` 17 addCmd(readCmds, "inb", &cmd{in, 16, 8}) 18 addCmd(readCmds, "inw", &cmd{in, 16, 16}) 19 addCmd(readCmds, "inl", &cmd{in, 16, 32}) 20 addCmd(writeCmds, "outb", &cmd{out, 16, 8}) 21 addCmd(writeCmds, "outw", &cmd{out, 16, 16}) 22 addCmd(writeCmds, "outl", &cmd{out, 16, 32}) 23 } 24 25 func in(addr int64, data memio.UintN) error { 26 return memio.In(uint16(addr), data) 27 } 28 29 func out(addr int64, data memio.UintN) error { 30 return memio.Out(uint16(addr), data) 31 }