ti50

package
v0.0.0-...-683b059 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Overview

Package ti50 implements remote libraries for ti50 testing.

Index

Constants

View Source
const (
	// ConsoleUart is the rawuart port.
	ConsoleUart = "console"
	// ConsoleBaud is the baud rate to use to access the ConsoleUart.
	ConsoleBaud = 115200
)
View Source
const (
	// WorkstationMode indicates that the DevBoard under test is connected to the host.
	WorkstationMode string = "workstation"
	// LabMode indicates that the DevBoard under test is connected to a CrOS box in the lab.
	LabMode string = "lab"
)

Variables

View Source
var ErrReadTimeout = errors.New("read timeout")

ErrReadTimeout indicates that a read operation exceeded the readTimeout configured on the port. Subsequent reads may still succeed depending on the state of the port.

Functions

func GetTi50TestBoard

func GetTi50TestBoard(ctx context.Context, dut *dut.DUT, rpcHint *testing.RPCHint, mode, spiflash string, bufLen int, readTimeout time.Duration) (ti50.DevBoard, *rpc.Client, error)

GetTi50TestBoard gets a DevBoard for testing in either lab or workstation modes. TODO(b/197998755): Move into a precondition.

func ListRemoteUltraDebugTargets

func ListRemoteUltraDebugTargets(ctx context.Context, dut *dut.DUT) ([]string, error)

ListRemoteUltraDebugTargets returns a possibly empty list of UD devices.

func ParseTi50TestMode

func ParseTi50TestMode(ctx context.Context, mode string) string

ParseTi50TestMode gets the mode or uses the default.

func ParseTi50TestSpiflash

func ParseTi50TestSpiflash(ctx context.Context, spiflash string) string

ParseTi50TestSpiflash gets the spiflash or uses the default.

Types

type DUTControlAndreiboard

type DUTControlAndreiboard struct {
	*common.Andreiboard
	// contains filtered or unexported fields
}

DUTControlAndreiboard controls an Andreiboard through dutcontrol grpc..

func NewDUTControlAndreiboard

func NewDUTControlAndreiboard(grpcConn *grpc.ClientConn, bufSize int, readTimeout time.Duration) *DUTControlAndreiboard

NewDUTControlAndreiboard creates a DUTControlAndreiboard.

grpcConn should be to a host running the dutcontrol service. bufSize should be set to the max outstanding chars waiting to be read. readTimeout should be set to the max expected duration between char outputs.

Example: conn, err := grpc.DialContext(ctx, hostPort, grpc.WithInsecure())

if err != nil {
    return nil, err
}

defer conn.Close(ctx) board := NewDUTControlAndreiboard(conn, 4096, 200 * time.Millisecond) defer board.Close(ctx)

func (*DUTControlAndreiboard) FlashImage

func (a *DUTControlAndreiboard) FlashImage(ctx context.Context, image string) (err error)

FlashImage flashes image at the specified path on localhost to the board.

func (*DUTControlAndreiboard) PlainCommand

func (a *DUTControlAndreiboard) PlainCommand(ctx context.Context, cmd string, args ...string) (output []byte, err error)

PlainCommand executes a opentitantool subcommand that uses no file arguments.

func (*DUTControlAndreiboard) Reset

Reset resets the board via spiflash, causing the image to reboot.

type DUTControlPort

type DUTControlPort struct {
	// contains filtered or unexported fields
}

DUTControlPort is a dutcontrol console port.

func (*DUTControlPort) Close

func (p *DUTControlPort) Close(ctx context.Context) error

Close closes the port.

func (*DUTControlPort) Flush

func (p *DUTControlPort) Flush(ctx context.Context) error

Flush un-read/written bytes.

func (*DUTControlPort) Read

func (p *DUTControlPort) Read(ctx context.Context, buf []byte) (n int, err error)

Read bytes into buffer and return number of bytes read. Bytes already written to the port shall be moved into buf, up to its size.

func (*DUTControlPort) Write

func (p *DUTControlPort) Write(ctx context.Context, buf []byte) (int, error)

Write bytes from buffer and return number of bytes written. It returns a non-nil error when n != len(b), nil otherwise.

type DUTControlRawUARTPortOpener

type DUTControlRawUARTPortOpener struct {
	// The dutcontrol grpc client.
	Client dutcontrol.DutControlClient
	// The uart number or an alias defined in the OpenTitanTool conf json file.
	Uart string
	// The baud rate.
	Baud int
	// The max size of received serial data.
	DataLen int
	// The timeout for a read operation.
	ReadTimeout time.Duration
}

DUTControlRawUARTPortOpener opens a raw UART port through the dutcontrol grpc client.

Example: conn, err := grpc.DialContext(ctx, hostPort, grpc.WithInsecure())

if err != nil {
    return nil, err
}

defer conn.Close(ctx) client := dutcontrol.NewDutControlClient(conn) opener := &DUTControlRawUARTPortOpener(client, "console", 115200, 1024, 200 * time.Millisecond) port, err := opener.OpenPort(ctx)

func (*DUTControlRawUARTPortOpener) OpenPort

OpenPort opens and returns the port.

type RemoteAndreiboard

type RemoteAndreiboard struct {
	*common.Andreiboard
	// contains filtered or unexported fields
}

RemoteAndreiboard controls a labstation-connected Andreiboard.

func NewRemoteAndreiboard

func NewRemoteAndreiboard(dut *dut.DUT, grpcConn *grpc.ClientConn, targetDevice string, bufSize int, spiFlash string, readTimeout time.Duration) *RemoteAndreiboard

NewRemoteAndreiboard creates a RemoteAndreiboard.

dut should have UltraDebug drivers installed, used to drive the Andreiboard. bufSize should be set to the max outstanding chars waiting to be read. spiFlash is the path on the localhost, it will be copied to the dut. readTimeout should be set to the max expected duration between char outputs.

Example:

rpcClient, err := rpc.Dial(ctx, s.DUT(), s.RPCHint())
if err != nil {
    s.Fatal("rpcDial: ", err)
}
defer rpcClient.Close(ctx)

board := NewRemoteAndreiboard(s.DUT(), rpcClient.Conn, "/path/to/UDTarget", 4096, "/path/to/spiflash" 2 * time.Second)
defer board.Close(ctx)

func (*RemoteAndreiboard) Close

func (a *RemoteAndreiboard) Close(ctx context.Context) error

Close and free resources.

func (*RemoteAndreiboard) FlashImage

func (a *RemoteAndreiboard) FlashImage(ctx context.Context, image string) error

FlashImage flashes image at the specified path on localhost to the board.

func (*RemoteAndreiboard) Reset

func (a *RemoteAndreiboard) Reset(ctx context.Context) error

Reset resets the board via spiflash, causing the image to reboot.

Directories

Path Synopsis
Package dutcontrol is generated from dutcontrol.proto in the ti50 repository.
Package dutcontrol is generated from dutcontrol.proto in the ti50 repository.
Package fixture provides ti50 devboard related fixtures.
Package fixture provides ti50 devboard related fixtures.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL