Documentation ¶
Overview ¶
Package allwinner exposes the GPIO functionality that is common to all AllWinner processors.
This driver implements memory-mapped GPIO pin manipulation and leverages sysfs-gpio for edge detection.
If you are looking at the actual implementation, open doc.go for further implementation details.
Datasheets ¶
A64: http://files.pine64.org/doc/datasheet/pine64/Allwinner_A64_User_Manual_V1.0.pdf
H3: http://dl.linux-sunxi.org/H3/Allwinner_H3_Datasheet_V1.0.pdf
Physical overview: http://files.pine64.org/doc/datasheet/pine64/A64_Datasheet_V1.1.pdf
Index ¶
- Variables
- func IsA64() bool
- func IsR8() bool
- func Nanospin(t time.Duration)
- func Present() bool
- func ReadTime() time.Duration
- type Pin
- func (p *Pin) DefaultPull() gpio.Pull
- func (p *Pin) Function() string
- func (p *Pin) In(pull gpio.Pull, edge gpio.Edge) error
- func (p *Pin) Name() string
- func (p *Pin) Number() int
- func (p *Pin) Out(l gpio.Level) error
- func (p *Pin) Pull() gpio.Pull
- func (p *Pin) Read() gpio.Level
- func (p *Pin) String() string
- func (p *Pin) WaitForEdge(timeout time.Duration) bool
- type PinPL
- func (p *PinPL) DefaultPull() gpio.Pull
- func (p *PinPL) Function() string
- func (p *PinPL) In(pull gpio.Pull, edge gpio.Edge) error
- func (p *PinPL) Name() string
- func (p *PinPL) Number() int
- func (p *PinPL) Out(l gpio.Level) error
- func (p *PinPL) Pull() gpio.Pull
- func (p *PinPL) Read() gpio.Level
- func (p *PinPL) String() string
- func (p *PinPL) WaitForEdge(timeout time.Duration) bool
- Bugs
Constants ¶
This section is empty.
Variables ¶
var ( X32KFOUT *pin.BasicPin // Clock output of 32Khz crystal KEY_ADC *pin.BasicPin // 6 bits resolution ADC for key application; can work up to 250Hz conversion rate; reference voltage is 2.0V EAROUTP *pin.BasicPin // Earpiece amplifier negative differential output EAROUTN *pin.BasicPin // Earpiece amplifier positive differential output )
A64 specific pins.
var ( FEL *pin.BasicPin // Boot mode selection MIC_IN *pin.BasicPin // Microphone in MIC_GND *pin.BasicPin // Microphone ground HP_LEFT *pin.BasicPin // Left speaker out HP_RIGHT *pin.BasicPin // Right speaker out HP_COM *pin.BasicPin // Speaker common X1, X2, Y1, Y2 *pin.BasicPin // Touch screen pins )
R8 specific pins.
Functions ¶
func IsA64 ¶
func IsA64() bool
IsA64 detects whether the host CPU is an Allwinner A64 CPU.
It looks for the string "sun50iw1p1" in /proc/device-tree/compatible.
func IsR8 ¶
func IsR8() bool
IsR8 detects whether the host CPU is an Allwinner R8 CPU.
It looks for the string "sun5i-r8" in /proc/device-tree/compatible.
Types ¶
type Pin ¶
type Pin struct {
// contains filtered or unexported fields
}
Pin implements the gpio.PinIO interface for generic Allwinner CPU pins using memory mapping for gpio in/out functionality.
var (
PB0, PB1, PB2, PB3, PB4, PB5, PB6, PB7, PB8, PB9, PB10, PB11, PB12, PB13, PB14, PB15, PB16, PB17, PB18 *Pin
PC0, PC1, PC2, PC3, PC4, PC5, PC6, PC7, PC8, PC9, PC10, PC11, PC12, PC13, PC14, PC15, PC16, PC17, PC18, PC19 *Pin
PD0, PD1, PD2, PD3, PD4, PD5, PD6, PD7, PD8, PD9, PD10, PD11, PD12, PD13, PD14, PD15, PD16, PD17, PD18, PD19, PD20, PD21, PD22, PD23, PD24, PD25, PD26, PD27 *Pin
PE0, PE1, PE2, PE3, PE4, PE5, PE6, PE7, PE8, PE9, PE10, PE11, PE12, PE13, PE14, PE15, PE16, PE17 *Pin
PF0, PF1, PF2, PF3, PF4, PF5, PF6 *Pin
PG0, PG1, PG2, PG3, PG4, PG5, PG6, PG7, PG8, PG9, PG10, PG11, PG12, PG13 *Pin
PH0, PH1, PH2, PH3, PH4, PH5, PH6, PH7, PH8, PH9, PH10, PH11 *Pin
)
List of all known pins. These global variables can be used directly.
The supported functionality of each gpio differs between CPUs. For example the R8 has the LCD-DE signal on gpio PD25 but the A64 has it on PD19.
The availability of each gpio differs between CPUs. For example the R8 has 19 pins in the group PB but the A64 only has 10.
So make sure to read the datasheet for the exact right CPU.
func (*Pin) DefaultPull ¶
DefaultPull returns the default pull for the pin.
func (*Pin) In ¶
In sets the pin direction to input and optionally enables a pull-up/down resistor as well as edge detection.
Not all pins support edge detection on Allwinner processors!
Edge detection requires opening a gpio sysfs file handle. The pin will be exported at /sys/class/gpio/gpio*/. Note that the pin will not be unexported at shutdown.
func (*Pin) Read ¶
Read returns the current level of the pin. Due to the way the Allwinner hardware functions it will do this regardless of the pin's function but this should not be relied upon.
type PinPL ¶
type PinPL struct {
// contains filtered or unexported fields
}
PinPL defines one CPU supported pin in the PL group.
PinPL implements gpio.PinIO.
var PL0, PL1, PL2, PL3, PL4, PL5, PL6, PL7, PL8, PL9, PL10, PL11, PL12 *PinPL
All the pins in the PL group.
func (*PinPL) DefaultPull ¶
DefaultPull returns the default pull for the pin.
func (*PinPL) In ¶
In implemented gpio.PinIn.
This requires opening a gpio sysfs file handle. The pin will be exported at /sys/class/gpio/gpio*/. Note that the pin will not be unexported at shutdown.
Not all pins support edge detection Allwinner processors!
Notes ¶
Bugs ¶
These need to be converted to an analog.PinIO implementation once analog support is implemented.
H3 supports group PL too.
Implement using AVS_CNT0_REG on A64.
Assumes that counterCtrl & timerPLL6 is not set.