Difference between revisions of "Unit GPIO"
Line 53: | Line 53: | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
<pre style="border: 0; padding-bottom:0px;">function GPIODeviceStart(GPIO:PGPIODevice):LongWord;</pre> | <pre style="border: 0; padding-bottom:0px;">function GPIODeviceStart(GPIO:PGPIODevice):LongWord;</pre> | ||
− | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' | + | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Start the specified GPIO device and enable access</div> |
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! ''' | + | ! '''GPIO''' |
− | | | + | | The GPIO device to start |
+ | |- | ||
+ | ! '''Return''' | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
|} | |} | ||
Line 65: | Line 68: | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
<pre style="border: 0; padding-bottom:0px;">function GPIODeviceStop(GPIO:PGPIODevice):LongWord;</pre> | <pre style="border: 0; padding-bottom:0px;">function GPIODeviceStop(GPIO:PGPIODevice):LongWord;</pre> | ||
− | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' | + | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Stop the specified GPIO device and disable access</div> |
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! ''' | + | ! '''GPIO''' |
− | | | + | | The GPIO device to stop |
+ | |- | ||
+ | ! '''Return''' | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
|} | |} |
Revision as of 00:26, 7 October 2016
Return to Unit Reference
Contents
[hide]Description
GPIO devices represent the external or internal pins available on most system on chip (SoC) devices to provide control and interfacing capabilities for both hardware and software.
This unit maintains pin numbering exactly as per the SoC documentation but abstracts other features such as alternate function selects to avoid exposing chip specific values via the API.
Not all GPIO devices support the same feature set so the GPIODeviceProperties function returns a structure which describes the number of pins as well as minimum and maximum pin numbers along with a set of flags that indicate what functionality is supported by the device.
Multiple GPIO devices can be accomodated, each one is registered with this unit when the driver for the device is loaded and initialized. This unit includes functions for enumerating the devices that are available and each function takes a GPIODevice parameter to allow specifying the exact device to control.
Simplified versions of many of the functions in this unit are provided in the Platform unit to allow control of the default GPIO device and in cases where there is only one device registered these functions will provide most of the capability required.
Constants
To be documented
Type definitions
To be documented
Public variables
To be documented
Function declarations
Initialization functions
GPIO functions
function GPIODeviceStart(GPIO:PGPIODevice):LongWord;
function GPIODeviceStop(GPIO:PGPIODevice):LongWord;
function GPIODeviceRead(GPIO:PGPIODevice; Reg:LongWord):LongWord;
procedure GPIODeviceWrite(GPIO:PGPIODevice; Reg,Value:LongWord);
function GPIODeviceInputGet(GPIO:PGPIODevice; Pin:LongWord):LongWord;
function GPIODeviceInputWait(GPIO:PGPIODevice; Pin,Trigger,Timeout:LongWord):LongWord;
function GPIODeviceInputEvent(GPIO:PGPIODevice; Pin,Trigger,Flags,Timeout:LongWord; Callback:TGPIOCallback; Data:Pointer):LongWord;
function GPIODeviceInputCancel(GPIO:PGPIODevice; Pin:LongWord):LongWord;
function GPIODeviceOutputSet(GPIO:PGPIODevice; Pin,Level:LongWord):LongWord;
function GPIODevicePullGet(GPIO:PGPIODevice;Pin:LongWord):LongWord;
function GPIODevicePullSelect(GPIO:PGPIODevice; Pin,Mode:LongWord):LongWord;
function GPIODeviceFunctionGet(GPIO:PGPIODevice; Pin:LongWord):LongWord;
function GPIODeviceFunctionSelect(GPIO:PGPIODevice; Pin,Mode:LongWord):LongWord;
function GPIODeviceProperties(GPIO:PGPIODevice; Properties:PGPIOProperties):LongWord;
function GPIODeviceCreateEx(Size:LongWord):PGPIODevice;
function GPIODeviceDestroy(GPIO:PGPIODevice):LongWord;
function GPIODeviceRegister(GPIO:PGPIODevice):LongWord;
function GPIODeviceDeregister(GPIO:PGPIODevice):LongWord;
function GPIODeviceFindByName(const Name:String):PGPIODevice; inline;
function GPIODeviceFindByDescription(const Description:String):PGPIODevice; inline;
function GPIODeviceEnumerate(Callback:TGPIOEnumerate; Data:Pointer):LongWord;
function GPIODeviceNotification(GPIO:PGPIODevice; Callback:TGPIONotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
RTL GPIO functions
function SysGPIOInputGet(Pin:LongWord):LongWord;
function SysGPIOInputWait(Pin,Trigger,Timeout:LongWord):LongWord;
function SysGPIOInputEvent(Pin,Trigger,Timeout:LongWord; Callback:TGPIOCallback; Data:Pointer):LongWord;
function SysGPIOOutputSet(Pin,Level:LongWord):LongWord;
function SysGPIOPullGet(Pin:LongWord):LongWord;
function SysGPIOPullSelect(Pin,Mode:LongWord):LongWord;
function SysGPIOFunctionGet(Pin:LongWord):LongWord;
function SysGPIOFunctionSelect(Pin,Mode:LongWord):LongWord;
GPIO helper functions
function GPIODeviceGetDefault:PGPIODevice; inline;
function GPIODeviceSetDefault(GPIO:PGPIODevice):LongWord;
function GPIODeviceCheck(GPIO:PGPIODevice):PGPIODevice;
function GPIODeviceCreateEvent(GPIO:PGPIODevice; Pin:PGPIOPin; Callback:TGPIOCallback; Data:Pointer; Timeout:LongWord):PGPIOEvent;
function GPIODeviceDestroyEvent(GPIO:PGPIODevice; Event:PGPIOEvent):LongWord;
function GPIODeviceRegisterEvent(GPIO:PGPIODevice; Pin:PGPIOPin; Event:PGPIOEvent):LongWord;
function GPIODeviceDeregisterEvent(GPIO:PGPIODevice;Pin:PGPIOPin;Event:PGPIOEvent):LongWord;
procedure GPIOLog(Level:LongWord; GPIO:PGPIODevice; const AText:String);
procedure GPIOLogError(GPIO:PGPIODevice; const AText:String);
procedure GPIOLogDebug(GPIO:PGPIODevice; const AText:String);
Return to Unit Reference