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 IsA20() bool
- 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) FastOut(l gpio.Level)
- func (p *Pin) FastRead() gpio.Level
- func (p *Pin) Func() pin.Func
- func (p *Pin) Function() string
- func (p *Pin) Halt() error
- 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) PWM(gpio.Duty, physic.Frequency) error
- func (p *Pin) Pull() gpio.Pull
- func (p *Pin) Read() gpio.Level
- func (p *Pin) SetFunc(f pin.Func) error
- func (p *Pin) String() string
- func (p *Pin) SupportedFuncs() []pin.Func
- func (p *Pin) WaitForEdge(timeout time.Duration) bool
- type PinPL
- func (p *PinPL) DefaultPull() gpio.Pull
- func (p *PinPL) FastOut(l gpio.Level)
- func (p *PinPL) FastRead() gpio.Level
- func (p *PinPL) Func() pin.Func
- func (p *PinPL) Function() string
- func (p *PinPL) Halt() error
- 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) PWM(gpio.Duty, physic.Frequency) error
- func (p *PinPL) Pull() gpio.Pull
- func (p *PinPL) Read() gpio.Level
- func (p *PinPL) SetFunc(f pin.Func) error
- func (p *PinPL) String() string
- func (p *PinPL) SupportedFuncs() []pin.Func
- 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 IsA20 ¶
func IsA20() bool
IsA20 detects whether the host CPU is an Allwinner A20 CPU.
It first looks for the string "sun71-a20" in /proc/device-tree/compatible, and if that fails it checks for "Hardware : sun7i" in /proc/cpuinfo.
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 (
PA0, PA1, PA2, PA3, PA4, PA5, PA6, PA7, PA8, PA9, PA10, PA11, PA12, PA13, PA14, PA15, PA16, PA17 *Pin
PB0, PB1, PB2, PB3, PB4, PB5, PB6, PB7, PB8, PB9, PB10, PB11, PB12, PB13, PB14, PB15, PB16, PB17, PB18, PB19, PB20, PB21, PB22, PB23 *Pin
PC0, PC1, PC2, PC3, PC4, PC5, PC6, PC7, PC8, PC9, PC10, PC11, PC12, PC13, PC14, PC15, PC16, PC17, PC18, PC19, PC20, PC21, PC22, PC23, PC24 *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, PH12, PH13, PH14, PH15, PH16, PH17, PH18, PH19, PH20, PH21, PH22, PH23, PH24, PH25, PH26, PH27 *Pin
PI0, PI1, PI2, PI3, PI4, PI5, PI6, PI7, PI8, PI9, PI10, PI11, PI12, PI13, PI14, PI15, PI16, PI17, PI18, PI19, PI20, PI21 *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) FastOut ¶
FastOut sets a pin output level with Absolutely No error checking.
Out() Must be called once first before calling FastOut(), otherwise the behavior is undefined. Then FastOut() can be used for minimal CPU overhead to reach Mhz scale bit banging.
func (*Pin) FastRead ¶
FastRead return the current pin level without any error checking.
This function is very fast.
func (*Pin) In ¶
In implements gpio.PinIn.
It 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) Number ¶
Number implements pin.Pin.
It returns the GPIO pin number as represented by gpio sysfs.
func (*Pin) Read ¶
Read implements gpio.PinIn.
It returns the current pin level. This function is fast.
func (*Pin) String ¶
String implements conn.Resource.
It returns the pin name and number, ex: "PB5(37)".
func (*Pin) SupportedFuncs ¶
SupportedFuncs implements pin.PinFunc.
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 implements gpio.PinIn.
func (*PinPL) FastOut ¶
FastOut sets a pin output level with Absolutely No error checking.
See Pin.FastOut for more information.
func (*PinPL) Number ¶
Number implements pin.Pin.
It returns the GPIO pin number as represented by gpio sysfs.
func (*PinPL) String ¶
String implements conn.Resource.
It returns the pin name and number, ex: "PL5(352)".
func (*PinPL) SupportedFuncs ¶
SupportedFuncs implements pin.PinFunc.
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.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package allwinnersmoketest verifies that allwinner specific functionality work.
|
Package allwinnersmoketest verifies that allwinner specific functionality work. |