Difference between revisions of "Unit GPIO"

From Ultibo.org
Jump to: navigation, search
Line 43: Line 43:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 58: Line 58:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 70: Line 70:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 82: Line 82:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 94: Line 94:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 106: Line 106:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 118: Line 118:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 130: Line 130:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 142: Line 142:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 154: Line 154:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 166: Line 166:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 178: Line 178:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 190: Line 190:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 202: Line 202:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 214: Line 214:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 253: Line 253:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 265: Line 265:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 277: Line 277:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 289: Line 289:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 301: Line 301:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 313: Line 313:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 325: Line 325:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 337: Line 337:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 352: Line 352:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 517: Line 517:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 529: Line 529:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 541: Line 541:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 553: Line 553:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 613: Line 613:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 625: Line 625:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 637: Line 637:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 649: Line 649:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 661: Line 661:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 673: Line 673:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 685: Line 685:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 697: Line 697:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}
Line 709: Line 709:
 
|-
 
|-
 
! '''Note'''
 
! '''Note'''
| To be documented
+
| None documented
 
|-
 
|-
 
|}
 
|}

Revision as of 05:29, 27 September 2016

Return to Unit Reference


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

[Expand]
procedure GPIOInit;
Description: To be documented


GPIO functions

[Expand]
function GPIODeviceStart(GPIO:PGPIODevice):LongWord;
Description: To be documented


[Expand]
function GPIODeviceStop(GPIO:PGPIODevice):LongWord;
Description: To be documented


[Expand]
function GPIODeviceRead(GPIO:PGPIODevice; Reg:LongWord):LongWord;
Description: To be documented


[Expand]
procedure GPIODeviceWrite(GPIO:PGPIODevice; Reg,Value:LongWord);
Description: To be documented


[Expand]
function GPIODeviceInputGet(GPIO:PGPIODevice; Pin:LongWord):LongWord;
Description: To be documented


[Expand]
function GPIODeviceInputWait(GPIO:PGPIODevice; Pin,Trigger,Timeout:LongWord):LongWord;
Description: To be documented


[Expand]
function GPIODeviceInputEvent(GPIO:PGPIODevice; Pin,Trigger,Flags,Timeout:LongWord; Callback:TGPIOCallback; Data:Pointer):LongWord;
Description: To be documented


[Expand]
function GPIODeviceInputCancel(GPIO:PGPIODevice; Pin:LongWord):LongWord;
Description: To be documented


[Expand]
function GPIODeviceOutputSet(GPIO:PGPIODevice; Pin,Level:LongWord):LongWord;
Description: To be documented


[Expand]
function GPIODevicePullGet(GPIO:PGPIODevice;Pin:LongWord):LongWord;
Description: To be documented


[Expand]
function GPIODevicePullSelect(GPIO:PGPIODevice; Pin,Mode:LongWord):LongWord;
Description: To be documented


[Expand]
function GPIODeviceFunctionGet(GPIO:PGPIODevice; Pin:LongWord):LongWord;
Description: To be documented


[Expand]
function GPIODeviceFunctionSelect(GPIO:PGPIODevice; Pin,Mode:LongWord):LongWord;
Description: To be documented


[Expand]
function GPIODeviceProperties(GPIO:PGPIODevice; Properties:PGPIOProperties):LongWord;
Description: To be documented


[Expand]
function GPIODeviceCreate:PGPIODevice;
Description: Create a new GPIO entry


[Expand]
function GPIODeviceCreateEx(Size:LongWord):PGPIODevice;
Description: Create a new GPIO entry


[Expand]
function GPIODeviceDestroy(GPIO:PGPIODevice):LongWord;
Description: Destroy an existing GPIO entry


[Expand]
function GPIODeviceRegister(GPIO:PGPIODevice):LongWord;
Description: Register a new GPIO in the GPIO table


[Expand]
function GPIODeviceDeregister(GPIO:PGPIODevice):LongWord;
Description: Deregister a GPIO in the GPIO table


[Expand]
function GPIODeviceFind(GPIOId:LongWord):PGPIODevice;
Description: To be documented


[Expand]
function GPIODeviceFindByName(const Name:String):PGPIODevice; inline;
Description: To be documented


[Expand]
function GPIODeviceFindByDescription(const Description:String):PGPIODevice; inline;
Description: To be documented


[Expand]
function GPIODeviceEnumerate(Callback:TGPIOEnumerate; Data:Pointer):LongWord;
Description: To be documented


[Expand]
function GPIODeviceNotification(GPIO:PGPIODevice; Callback:TGPIONotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Description: To be documented


RTL GPIO functions

[Expand]
function SysGPIOAvailable:Boolean;
Description: Check if a GPIO device is available


[Expand]
function SysGPIOInputGet(Pin:LongWord):LongWord;
Description: Get the current state of a GPIO input pin


[Expand]
function SysGPIOInputWait(Pin,Trigger,Timeout:LongWord):LongWord;
Description: Wait for the state of a GPIO input pin to change


[Expand]
function SysGPIOInputEvent(Pin,Trigger,Timeout:LongWord; Callback:TGPIOCallback; Data:Pointer):LongWord;
Description: Schedule a function to be called when the state of a GPIO input pin changes


[Expand]
function SysGPIOOutputSet(Pin,Level:LongWord):LongWord; 
Description: Set the state of a GPIO output pin


[Expand]
function SysGPIOPullGet(Pin:LongWord):LongWord;
Description: Get the current pull state of a GPIO pin


[Expand]
function SysGPIOPullSelect(Pin,Mode:LongWord):LongWord;
Description: Change the pull state of a GPIO pin


[Expand]
function SysGPIOFunctionGet(Pin:LongWord):LongWord;
Description: Get the current function of a GPIO pin


[Expand]
function SysGPIOFunctionSelect(Pin,Mode:LongWord):LongWord;
Description: Change the function of a GPIO pin


GPIO helper functions

[Expand]
function GPIOGetCount:LongWord; inline;
Description: Get the current GPIO count


[Expand]
function GPIODeviceGetDefault:PGPIODevice; inline;
Description: Get the current default GPIO device


[Expand]
function GPIODeviceSetDefault(GPIO:PGPIODevice):LongWord;
Description: Set the current default GPIO device


[Expand]
function GPIODeviceCheck(GPIO:PGPIODevice):PGPIODevice;
Description: Check if the supplied GPIO is in the GPIO table


[Expand]
function GPIODeviceCreateEvent(GPIO:PGPIODevice; Pin:PGPIOPin; Callback:TGPIOCallback; Data:Pointer; Timeout:LongWord):PGPIOEvent;
Description: Create a new event using the supplied parameters


[Expand]
function GPIODeviceDestroyEvent(GPIO:PGPIODevice; Event:PGPIOEvent):LongWord;
Description: Destroy an existing event


[Expand]
function GPIODeviceRegisterEvent(GPIO:PGPIODevice; Pin:PGPIOPin; Event:PGPIOEvent):LongWord;
Description: Register an event in the event list of the supplied Pin


[Expand]
function GPIODeviceDeregisterEvent(GPIO:PGPIODevice;Pin:PGPIOPin;Event:PGPIOEvent):LongWord;
Description: Deregister an event in the event list of the supplied Pin


[Expand]
procedure GPIOLog(Level:LongWord; GPIO:PGPIODevice; const AText:String);
Description: To be documented


[Expand]
procedure GPIOLogInfo(GPIO:PGPIODevice; const AText:String);
Description: To be documented


[Expand]
procedure GPIOLogError(GPIO:PGPIODevice; const AText:String);
Description: To be documented


[Expand]
procedure GPIOLogDebug(GPIO:PGPIODevice; const AText:String);
Description: To be documented


[Expand]
function GPIOPinToString(Pin:LongWord):String;
Description: To be documented


[Expand]
function GPIOLevelToString(Level:LongWord):String;
Description: To be documented


[Expand]
function GPIOTriggerToString(Trigger:LongWord):String;
Description: To be documented


[Expand]
function GPIOPullToString(Value:LongWord):String;
Description: To be documented


[Expand]
function GPIOFunctionToString(Value:LongWord):String;
Description: To be documented


Return to Unit Reference