gitee.com/mirrors_u-root/u-root@v7.0.0+incompatible/pkg/memio/ports_test.go (about)

     1  // Copyright 2012-2019 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 linux,amd64 linux,386
     6  
     7  package memio
     8  
     9  import (
    10  	"fmt"
    11  	"log"
    12  )
    13  
    14  func ExampleIn() {
    15  	var data Uint8
    16  	if err := In(0x3f8, &data); err != nil {
    17  		log.Fatal(err)
    18  	}
    19  	fmt.Printf("%v\n", data)
    20  }
    21  
    22  func ExampleOut() {
    23  	data := Uint8('A')
    24  	if err := Out(0x3f8, &data); err != nil {
    25  		log.Fatal(err)
    26  	}
    27  }