Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Commit

Permalink
Add experimental/host packages am335x, beagle and pruicss
Browse files Browse the repository at this point in the history
Refer to issues #199, #200 and #201.
  • Loading branch information
maruel committed Dec 22, 2017
1 parent 9157d4d commit 62456d9
Show file tree
Hide file tree
Showing 12 changed files with 249 additions and 0 deletions.
46 changes: 46 additions & 0 deletions experimental/host/am335x/am335x.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// 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"

"periph.io/x/periph"
)

// Present returns true if an am335x processor is detected.
//
// TODO(maruel): Implement.
func Present() bool {
if isArm {
return false
}
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) Init() (bool, error) {
if !Present() {
return false, errors.New("am335x CPU not detected")
}
return true, nil
}

func init() {
if isArm {
periph.MustRegister(&driver{})
}
}
7 changes: 7 additions & 0 deletions experimental/host/am335x/am335x_arm.go
Original file line number Diff line number Diff line change
@@ -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 changes: 9 additions & 0 deletions experimental/host/am335x/am335x_other.go
Original file line number Diff line number Diff line change
@@ -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
23 changes: 23 additions & 0 deletions experimental/host/am335x/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// 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 pruicss.
//
// 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
38 changes: 38 additions & 0 deletions experimental/host/beagle/beagle.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// 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 beagle

import (
"errors"

"periph.io/x/periph"
)

// driver implements periph.Driver.
type driver struct {
}

func (d *driver) String() string {
return "beagle"
}

func (d *driver) Prerequisites() []string {
return nil
}

func (d *driver) Init() (bool, error) {
if !Present() {
return false, errors.New("BeagleBoard/BeagleBone board not detected")
}
return true, nil
}

func init() {
if isArm {
periph.MustRegister(&driver{})
}
}

var _ periph.Driver = &driver{}
7 changes: 7 additions & 0 deletions experimental/host/beagle/beagle_arm.go
Original file line number Diff line number Diff line change
@@ -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 beagle

const isArm = true
9 changes: 9 additions & 0 deletions experimental/host/beagle/beagle_other.go
Original file line number Diff line number Diff line change
@@ -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 beagle

const isArm = false
15 changes: 15 additions & 0 deletions experimental/host/beagle/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// 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 beagle contains BeagleBoard/BeagleBone board family headers
// definition.
//
// While most boards uses Texas Instruments CPUs, some use CPUs from Octavo
// Systems.
//
// Physical
//
// The physical pin out is based on information at
// https://beagleboard.org/support/bone101/.
package beagle
33 changes: 33 additions & 0 deletions experimental/host/pruicss/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// 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 pruicss exposes the Programmable Real-Time Unit Subsystem and
// Industrial Communication Subsystem (PRUICSS) functionality found on many
// Texas Instruments processors.
//
// This one of the rare way of doing true realtime on a linux microcomputer.
//
// Each PRU is a 32 bits "5ns per instruction" processor running at 200MHz,
// with 8Kb of program memory and 8Kb of data memory.
//
// The PRU processor can be found on this non-exhaustive list of processors:
//
// - 2x PRUs on am3356, am3357, am3358, am3359 https://www.ti.com/product/am3359
//
// - 4x PRUs on am4376, am4377, am4378, am4379 https://www.ti.com/product/am4379
//
// - 4x PRUs on 66ak2g02; http://www.ti.com/product/66ak2g02
//
// Datasheet
//
// Technical Reference Manual starting at page 199:
// https://www.ti.com/lit/ug/spruh73p/spruh73p.pdf
//
// Help
//
// Hands-on videos
// http://beagleboard.org/pru
//
// https://elinux.org/Ti_AM33XX_PRUSSv2
package pruicss
46 changes: 46 additions & 0 deletions experimental/host/pruicss/pruicss.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// 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 pruicss

import (
"errors"

"periph.io/x/periph"
)

// Present returns true if an Texas Instrument PRU-ICSS processor is detected.
//
// TODO(maruel): Implement.
func Present() bool {
if isArm {
return false
}
return false
}

// driver implements periph.Driver.
type driver struct {
}

func (d *driver) String() string {
return "pruicss"
}

func (d *driver) Prerequisites() []string {
return nil
}

func (d *driver) Init() (bool, error) {
if !Present() {
return false, errors.New("real time PRU-ICSS CPU not detected")
}
return true, nil
}

func init() {
if isArm {
periph.MustRegister(&driver{})
}
}
7 changes: 7 additions & 0 deletions experimental/host/pruicss/pruicss_arm.go
Original file line number Diff line number Diff line change
@@ -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 pruicss

const isArm = true
9 changes: 9 additions & 0 deletions experimental/host/pruicss/pruicss_other.go
Original file line number Diff line number Diff line change
@@ -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 pruicss

const isArm = false

0 comments on commit 62456d9

Please sign in to comment.