First implementation
This commit is contained in:
52
vendor/periph.io/x/periph/host/am335x/am335x.go
generated
vendored
Normal file
52
vendor/periph.io/x/periph/host/am335x/am335x.go
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
// Copyright 2017 The Periph Authors. All rights reserved.
|
||||
// Use of this source code is governed under the Apache License, Version 2.0
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
package am335x
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"periph.io/x/periph"
|
||||
"periph.io/x/periph/host/distro"
|
||||
)
|
||||
|
||||
// Present returns true if a TM AM335x processor is detected.
|
||||
func Present() bool {
|
||||
if isArm {
|
||||
return strings.HasPrefix(distro.DTModel(), "TI AM335x")
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// driver implements periph.Driver.
|
||||
type driver struct {
|
||||
}
|
||||
|
||||
func (d *driver) String() string {
|
||||
return "am335x"
|
||||
}
|
||||
|
||||
func (d *driver) Prerequisites() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *driver) After() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *driver) Init() (bool, error) {
|
||||
if !Present() {
|
||||
return false, errors.New("am335x CPU not detected")
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
if isArm {
|
||||
periph.MustRegister(&drv)
|
||||
}
|
||||
}
|
||||
|
||||
var drv driver
|
7
vendor/periph.io/x/periph/host/am335x/am335x_arm.go
generated
vendored
Normal file
7
vendor/periph.io/x/periph/host/am335x/am335x_arm.go
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
// Copyright 2017 The Periph Authors. All rights reserved.
|
||||
// Use of this source code is governed under the Apache License, Version 2.0
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
package am335x
|
||||
|
||||
const isArm = true
|
9
vendor/periph.io/x/periph/host/am335x/am335x_other.go
generated
vendored
Normal file
9
vendor/periph.io/x/periph/host/am335x/am335x_other.go
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
// Copyright 2017 The Periph Authors. All rights reserved.
|
||||
// Use of this source code is governed under the Apache License, Version 2.0
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
// +build !arm
|
||||
|
||||
package am335x
|
||||
|
||||
const isArm = false
|
28
vendor/periph.io/x/periph/host/am335x/doc.go
generated
vendored
Normal file
28
vendor/periph.io/x/periph/host/am335x/doc.go
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
// Copyright 2017 The Periph Authors. All rights reserved.
|
||||
// Use of this source code is governed under the Apache License, Version 2.0
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
// Package am335x exposes functionality for the Texas Instruments Sitara AM335x
|
||||
// processor family.
|
||||
//
|
||||
// This processor family is found on the BeagleBone. PRU-ICSS functionality is
|
||||
// implemented in package pru.
|
||||
//
|
||||
// The GPIO pins of the AM335x CPU are grouped into 3 groups of 32 pins: GPIO0,
|
||||
// GPIO1, and GPIO2. The CPU documentation refers to GPIO in the form of
|
||||
// GPIOx_y. To get the absolute number, as exposed by sysfs, use 32*x+y to get
|
||||
// the absolute number.
|
||||
//
|
||||
// Datasheet
|
||||
//
|
||||
// Technical Reference Manual
|
||||
// https://www.ti.com/lit/ug/spruh73p/spruh73p.pdf
|
||||
//
|
||||
// Other
|
||||
//
|
||||
// Marketing page
|
||||
// https://www.ti.com/processors/sitara/arm-cortex-a8/am335x/overview.html
|
||||
//
|
||||
// Family overview
|
||||
// https://www.ti.com/lit/ds/symlink/am3359.pdf
|
||||
package am335x
|
Reference in New Issue
Block a user