Documentation ¶
Overview ¶
Package ti50 implements remote libraries for ti50 testing.
Index ¶
- Constants
- Variables
- func GetTi50TestBoard(ctx context.Context, dut *dut.DUT, rpcHint *testing.RPCHint, ...) (ti50.DevBoard, *rpc.Client, error)
- func ListRemoteUltraDebugTargets(ctx context.Context, dut *dut.DUT) ([]string, error)
- func ParseTi50TestMode(ctx context.Context, mode string) string
- func ParseTi50TestSpiflash(ctx context.Context, spiflash string) string
- type DUTControlAndreiboard
- type DUTControlPort
- type DUTControlRawUARTPortOpener
- type RemoteAndreiboard
Constants ¶
const ( // ConsoleUart is the rawuart port. ConsoleUart = "console" // ConsoleBaud is the baud rate to use to access the ConsoleUart. ConsoleBaud = 115200 )
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 ¶
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 ¶
ListRemoteUltraDebugTargets returns a possibly empty list of UD devices.
func ParseTi50TestMode ¶
ParseTi50TestMode gets the mode 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.
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.
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)
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.
Source Files ¶
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. |