47xx EVGPIO: Difference between revisions

From embeddedTS Manuals
(Created page with "This board features the EVGPIO core (Event Driven GPIO) which allows a low bandwidth mechanism to monitor all FPGA DIO on a shared interrupt. The most common mechanism for mo...")
 
No edit summary
Line 1: Line 1:
This board features the EVGPIO core (Event Driven GPIO) which allows a low bandwidth mechanism to monitor all FPGA DIO on a shared interrupt.
This board features the EVGPIO core (Event Driven GPIO) which allows a low bandwidth mechanism to monitor all FPGA DIO on a shared interrupt. All DIO are accessed atomically through two registers.  The data register is used to read dio state changes, set output values, and data direction.  The mask register is used to set which DIO will trigger the IRQ and provide state changes to the data register.  We provide "evgpioctl" which can be used to access these DIO:


The most common mechanism for monitoring for changes of state among many inputs involves having software poll lots of 16-bit registers and use boolean bitwise operations to query interested pin states. An EVGPIO core is instead constantly monitoring inputs for posedges or negedges and will deliver an 8-bit opcode of the following format when a delta from the previously sent state is detected.
<pre>
# evgpioctl --help
Usage: evgpioctl [OPTIONS] ...
EVGPIO utility


The EVGPIO registers follow this format:
  -i, --getin  <dio>    Returns the input value of a DIO
  -s, --setout <dio>    Sets a DIO output value high
  -l, --clrout <dio>    Sets a DIO output value low
  -o, --ddrout <dio>    Set DIO to an output
  -d, --ddrin <dio>    Set DIO to an input
  -m, --setmask <dio>  Mask out a DIO so it does not provide input
                        event changes and trigger the shared IRQ
  -c, --clrmask <dio>  Clear the mask from a DIO so it provides input
                        event changes and trigger the shared IRQ
  -w, --watch          Prints csv output when any unmasked DIO changes
                        <dio>,<1=high,0=low>
</pre>
 
This provides a simple interface that can be used in scripts, or wrapped for higher level software access.
<source lang=bash>
# Set DIO 31 to a high output
evgpioctl --ddrout 31 --setout 31
 
# Set DIO 31 to a low output
evgpioctl --setout 31
 
# Read the value of DIO 30
evgpioctl --ddrin 30 --getin 30
 
# The input return values are parsable and can be used easily in scripts:
eval $(evgpioctl --getin 30)
echo $dio30
</source>
 
The sources for this utility are available here:
* [ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7700-linux/sources/evgpio.c evgpio.c]
* [ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7700-linux/sources/evgpio.h evgpio.h]
* [ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7700-linux/sources/evgpioctl.c evgpioctl.c]
 
You can also manipulate the EVGPIO data and mask registers directly in your application.
Setting a pin direction, output value, and reading input changes are accessed through the EVPGIO data register.
{| class=wikitable
{| class=wikitable
|+ EVPIO Regs
|+ EVGPIO Data Register
|-
|-
! Bits
! Bits
! Usage
! Description
|-
| 15:9
| Reserved (Write 0)
|-
| 8
| Indicates pending read data <ref> When writing, write 0.  During a read this indicates if this read includes new valid changes. </ref>
|-
|-
| 7
| 7
|  
| Value
{|
|-
! Value
! Meaning
|-
|-
| 1
| 6
| Low to high event
| Data Direction / Data <ref>When this is 0 the value will set the data direction to an input (value=0) or output (value=1).  When this is a 1, the value will set the data output (value=0 low, value=1 high).  During a read this value is always 0.</ref>
|-
|-
| 0
| 5:0
| High to low event
| DIO number
|}
|}


<references />
The second register is the IRQ mask.  This is used to set which DIO will update the data register and trigger an IRQ on change.
{| class=wikitable
|+ EVGPIO Mask Register
|-
! Bits
! Description
|-
| 15:8
| Reserved (Write 0)
|-
| 7
| Mask Set (0 = irq enabled, 1 = irq disabled)
|-
| 6
| Reserved (Write 0)
|-
|-
| 6:0
| 5:0
| Input number
| DIO number
|}
|}

Revision as of 11:14, 10 September 2013

This board features the EVGPIO core (Event Driven GPIO) which allows a low bandwidth mechanism to monitor all FPGA DIO on a shared interrupt. All DIO are accessed atomically through two registers. The data register is used to read dio state changes, set output values, and data direction. The mask register is used to set which DIO will trigger the IRQ and provide state changes to the data register. We provide "evgpioctl" which can be used to access these DIO:

# evgpioctl --help
Usage: evgpioctl [OPTIONS] ...
EVGPIO utility

  -i, --getin  <dio>    Returns the input value of a DIO
  -s, --setout <dio>    Sets a DIO output value high
  -l, --clrout <dio>    Sets a DIO output value low
  -o, --ddrout <dio>    Set DIO to an output
  -d, --ddrin <dio>     Set DIO to an input
  -m, --setmask <dio>   Mask out a DIO so it does not provide input
                        event changes and trigger the shared IRQ
  -c, --clrmask <dio>   Clear the mask from a DIO so it provides input
                        event changes and trigger the shared IRQ
  -w, --watch           Prints csv output when any unmasked DIO changes
                        <dio>,<1=high,0=low>

This provides a simple interface that can be used in scripts, or wrapped for higher level software access.

# Set DIO 31 to a high output
evgpioctl --ddrout 31 --setout 31

# Set DIO 31 to a low output
evgpioctl --setout 31

# Read the value of DIO 30
evgpioctl --ddrin 30 --getin 30

# The input return values are parsable and can be used easily in scripts:
eval $(evgpioctl --getin 30)
echo $dio30

The sources for this utility are available here:

You can also manipulate the EVGPIO data and mask registers directly in your application. Setting a pin direction, output value, and reading input changes are accessed through the EVPGIO data register.

EVGPIO Data Register
Bits Description
15:9 Reserved (Write 0)
8 Indicates pending read data [1]
7 Value
6 Data Direction / Data [2]
5:0 DIO number
  1. When writing, write 0. During a read this indicates if this read includes new valid changes.
  2. When this is 0 the value will set the data direction to an input (value=0) or output (value=1). When this is a 1, the value will set the data output (value=0 low, value=1 high). During a read this value is always 0.

The second register is the IRQ mask. This is used to set which DIO will update the data register and trigger an IRQ on change.

EVGPIO Mask Register
Bits Description
15:8 Reserved (Write 0)
7 Mask Set (0 = irq enabled, 1 = irq disabled)
6 Reserved (Write 0)
5:0 DIO number