Difference between revisions of "Example egpc"

From wiki.emacinc.com
Jump to: navigation, search
Line 1: Line 1:
 
{{todo|InProgress(11.13.13-14:31->JG+)|Jgreene|project=oe 4,oe 5,jg,md,InProgress}}
 
{{todo|InProgress(11.13.13-14:31->JG+)|Jgreene|project=oe 4,oe 5,jg,md,InProgress}}
<big>This procedure provides an overview of how to compile and run the ''egpc'' C example project. It assumes familiarity with the C programming language and is intended to be used by experienced programmers who are looking to learn the EMAC SDK.</big>
+
This is a guide to the <code>egpc</code> C example project included in the EMAC OE SDK.
  
====1. Open the ''C/C++'' editing perspective====
+
<code>egpc</code> is an application for reading/writing/configuring gpio character devices. Specifically, we read/write/configure the 3 ports (ports A, B and C) on the GPIO header.
  
====2. Open the ''egpc'' project====
+
The <code>egpc</code> project builds one executable: <code>egpc</code>.
  
====3. Build, upload and run====
+
== Opening, Building and Uploading the Project Files ==
<br /><br />
 
  
==What it does==
+
<big>1. Open the C/C++ editing perspective.</big>
  
''egpc'' reads/writes/configures the specified gpio character device using the specified arguments.
+
stub
  
usage:<br />
+
<big>2. Open the project files.</big>
egpc device d/c/i (writearg)<br />
 
ie: ./egpc /dev/egpio1 d<br />
 
  
Enter ''egpc -h'' for details.
+
stub
  
''From the comments in egpc.c''
+
<big>3. Build the project.</big>
  
    Program for reading/writing/configuring gpio character devices.
+
stub
    Code here based upon the egp, the gpio program for the SoM-5282M/SoM-100ES.
+
 
    See the usage message for information on how to use this application.
+
<big>4. Upload the executables to the target system.</big>
 +
 
 +
stub
 +
 
 +
==Usage and Behavior==
 +
 
 +
<code>egpc</code> reads/writes/configures the GPIO ports.
 +
 
 +
===Hardware Requirements===
 +
 
 +
The <code>egpc</code> C example project will run on any EMAC carrier board.
 +
 
 +
===Using <code>egpc</code>===
 +
 
 +
./egpc device d/c/i (writearg)<br />
 +
 
 +
'''device''' is /dev/porta, /dev/portb or /dev/portc
 +
'''d/c/i''' specifies the port command : d(data), c(configure), i(index)
 +
'''writearg''' is a bitmask in hex format.
 +
 
 +
If '''bitmask''' is specified then we write that value to the specified port using the specified port command. If it isn't then we read the port and print it's value.
 +
 
 +
===Usage Example. Writing to Port C===
 +
 
 +
We write a bitmask to Port C. The values are rendered in our LED strip. (note that only PortC is displayed in the LED strip. Ports A or B would require kind of device to read them; a multimeter or oscilloscope or something like that.)
 +
 
 +
./egpc /dev/portc d 0x55
 +
 
 +
 
 +
LEDs 1-8 are lit: 10101010
 +
 
 +
'''MIKE I was thinking that maybe we could have some kind of general purpose "know your board" images (I have created a few) or wiki pages. They would point out things like the GPIO header and the LED strip.'''
 +
 
 +
./egpc /dev/portc d 0xaa
 +
 
 +
LEDs 1-8 are lit: 01010101

Revision as of 14:18, 27 December 2013

TODO: {{#todo:InProgress(11.13.13-14:31->JG+)|Jgreene|oe 4,oe 5,jg,md,InProgress}}

This is a guide to the egpc C example project included in the EMAC OE SDK.

egpc is an application for reading/writing/configuring gpio character devices. Specifically, we read/write/configure the 3 ports (ports A, B and C) on the GPIO header.

The egpc project builds one executable: egpc.

Opening, Building and Uploading the Project Files

1. Open the C/C++ editing perspective.

stub

2. Open the project files.

stub

3. Build the project.

stub

4. Upload the executables to the target system.

stub

Usage and Behavior

egpc reads/writes/configures the GPIO ports.

Hardware Requirements

The egpc C example project will run on any EMAC carrier board.

Using egpc

./egpc device d/c/i (writearg)

device is /dev/porta, /dev/portb or /dev/portc d/c/i specifies the port command : d(data), c(configure), i(index) writearg is a bitmask in hex format.

If bitmask is specified then we write that value to the specified port using the specified port command. If it isn't then we read the port and print it's value.

Usage Example. Writing to Port C

We write a bitmask to Port C. The values are rendered in our LED strip. (note that only PortC is displayed in the LED strip. Ports A or B would require kind of device to read them; a multimeter or oscilloscope or something like that.)

./egpc /dev/portc d 0x55


LEDs 1-8 are lit: 10101010

MIKE I was thinking that maybe we could have some kind of general purpose "know your board" images (I have created a few) or wiki pages. They would point out things like the GPIO header and the LED strip.

./egpc /dev/portc d 0xaa

LEDs 1-8 are lit: 01010101