Intel Embedded System Design Contest

Similar documents
USB -Keyboard Guide by DeadPool2 Last update: August 2, 2018

Pipes. Pipes Implement a FIFO. Pipes (cont d) SWE 545. Pipes. A FIFO (First In, First Out) buffer is like a. Pipes are uni-directional

CSE 333 SECTION 3. POSIX I/O Functions

CS Operating Systems Lab 3: UNIX Processes

UNIX System Calls. Sys Calls versus Library Func

TIP570-SW-95 QNX-Neutrino Device Driver TIP570 16/8 Channel 12 Bit ADC and 8 Channel 12 Bit DAC on SBS PCI40 Carrier

A: We see the ps auxw execute and print on screen. The program holds the command in buffer then it is printed on screen.

CSE 333 SECTION 3. POSIX I/O Functions

everything is a file main.c a.out /dev/sda1 /dev/tty2 /proc/cpuinfo file descriptor int

Lecture 23: System-Level I/O

SSE3052: Embedded Systems Practice

Universidad Carlos III de Madrid Computer Science and Engineering Department Operating Systems Course

EAN-GPIO and I 2 C. PN: EAN-GPIO-and-I 2 C 2/28/2018. SightLine Applications, Inc.

Introduction to Supercomputing

COMP 2355 Introduction to Systems Programming

Important Dates. October 27 th Homework 2 Due. October 29 th Midterm

CSC 271 Software I: Utilities and Internals

CSC209H Lecture 6. Dan Zingaro. February 11, 2015

Why files? 1. Storing a large amount of data 2. Long-term data retention 3. Access to the various processes in parallel

Programming the DMCC in C

File I/O. Dong-kun Shin Embedded Software Laboratory Sungkyunkwan University Embedded Software Lab.

Software Development With Emacs: The Edit-Compile-Debug Cycle

Grove Analog Moisture Sensor on BeagleBone Guide

File and Directories. Advanced Programming in the UNIX Environment

JetBox 95xx/ 93xx Linux Auto Run Function

Chapter 7 File Operations

System Programming. Pipes I

Matt Ramsay CS 375 EXAM 2 Part 1

518 Lecture Notes Week 3

Recitation 8: Tshlab + VM

System Calls and I/O Appendix. Copyright : University of Illinois CS 241 Staff 1

All the scoring jobs will be done by script

Friday, February 10, Lab Notes

UNIVERSITY OF NEBRASKA AT OMAHA Computer Science 4500/8506 Operating Systems Fall Programming Assignment 1 (updated 9/16/2017)

Pointers and scanf() Steven R. Bagley

The CCB gpio-104 device-driver

Friday, September 16, Lab Notes. Command line arguments More pre-processor options Programs: Finish Program 1, begin Program 2 due next week

Computer Science & Engineering Department I. I. T. Kharagpur

OPTO32A 24 Input Bit, 8 Output Bit Optical Isolator Board

Inter-Process Communication. Disclaimer: some slides are adopted from the book authors slides with permission 1

PCI-AIO01. User s Manual

York University Faculty Science and Engineering Fall 2008

Experiment 6 The Real World Interface

All the scoring jobs will be done by script

UNIVERSITY OF NEBRASKA AT OMAHA Computer Science 4500/8506 Operating Systems Summer 2016 Programming Assignment 1 Introduction The purpose of this

Internet of Things: Using MRAA to Abstract Platform I/O Capabilities

DSP-Series 20MHz DSP Configuration

F28HS2 Hardware-Software Interface. Lecture 3 - Programming in C 3

Contents. IPC (Inter-Process Communication) Representation of open files in kernel I/O redirection Anonymous Pipe Named Pipe (FIFO)

CS C Primer. Tyler Szepesi. January 16, 2013

EL2310 Scientific Programming LAB2: C lab session. Patric Jensfelt, Andrzej Pronobis

Operating systems for embedded systems. Embedded Operating Systems

Anne Bracy CS 3410 Computer Science Cornell University

MMAP AND PIPE. UNIX Programming 2015 Fall by Euiseong Seo

User Guide Guangzhou Zhiyuan Electronics Stock Co., LTD

Computer Systems Assignment 2: Fork and Threads Package

unsigned char memory[] STACK ¼ 0x xC of address space globals function KERNEL code local variables

PRINCIPLES OF OPERATING SYSTEMS

UNIX I/O. Computer Systems: A Programmer's Perspective, Randal E. Bryant and David R. O'Hallaron Prentice Hall, 3 rd edition, 2016, Chapter 10

BOOLEAN EXPRESSIONS CONTROL FLOW (IF-ELSE) INPUT/OUTPUT. Problem Solving with Computers-I

Beyond this course. Machine code. Readings: CP:AMA 2.1, 15.4

Soliton SCTS Extender

Lab 5: Inter-Process Communication

Unix Basics Compiling and Using. CMPT 300 Operating Systems I Summer Segment 2: Unix Basics. Melissa O Neill

Operating systems for embedded systems

Owner s Manual for the. ClockMaster. Models: CM2-100-PCI

Project 2: Shell with History1

CS240: Programming in C

System Programming. Introduction to Unix

Preview. Process Control. What is process? Process identifier The fork() System Call File Sharing Race Condition. COSC350 System Software, Fall

CS 33. Shells and Files. CS33 Intro to Computer Systems XX 1 Copyright 2017 Thomas W. Doeppner. All rights reserved.

PCI-AIO02. User s Manual

File Descriptors and Piping

TPMC860-SW-82. Linux Device Driver. 4 Channel Isolated Serial Interface RS232 Version 1.4.x. User Manual. Issue 1.4.

CS 3013 Operating Systems WPI, A Term Assigned: Friday, August 31, 2007 Due: Monday, September 17, 2007

Chapter 10. The UNIX System Interface

arm light distance . The ADC is noisy, so its output randomly varies by ±1.

CONTROL THE GPIO PINS ON THE DELL EMBEDDED BOX PC 5000 IN UBUNTU LINUX

CanBarry PI V 1.0 INDUSTRIAL BERRY.

Operating systems. Lecture 9

COL100 Lab 2. I semester Week 2, Open the web-browser and visit the page and visit the COL100 course page.

This is a tutorial about sensing the environment using a Raspberry Pi. measure a digital input (from a button) output a digital signal (to an LED)

CpSc 1010, Fall 2014 Lab 10: Command-Line Parameters (Week of 10/27/2014)

15-213/18-243, Spring 2011 Exam 2

C programming for beginners

Contents. Programming Assignment 0 review & NOTICE. File IO & File IO exercise. What will be next project?

Worksheet 4 Basic Input functions and Mathematical Operators

Lecture 3. Introduction to Unix Systems Programming: Unix File I/O System Calls

Introduction to Linux

PetaLinux SDK User Guide. Application Development Guide

CARRIER-SW-82. Linux Device Driver. IPAC Carrier Version 2.2.x. User Manual. Issue November 2017

Roadmap. CPU management. Memory management. Disk management. Other topics. Process, thread, synchronization, scheduling. Virtual memory, demand paging

Shared Memory Memory mapped files

C-String Library Functions

#include <stdio.h> int main() { char s[] = Hsjodi, *p; for (p = s + 5; p >= s; p--) --*p; puts(s); return 0;

Procedures, Parameters, Values and Variables. Steven R. Bagley

SU2017. LAB 1 (May 4/9) Introduction to C, Function Declaration vs. Definition, Basic I/O (scanf/printf, getchar/putchar)

프로세스간통신 (Interprocess communication) i 숙명여대창병모

From Java to C. Thanks to Randal E. Bryant and David R. O'Hallaron (Carnegie-Mellon University) for providing the basis for these slides

BIL 104E Introduction to Scientific and Engineering Computing. Lecture 14

Transcription:

Intel Embedded System Design Contest Technical Notes FPGA Peripheral Linux Driver Usage Notes Rev 0.00 Date: 2012/03/13 Technical Notes Document Information TYPE Key words Abstract FPGA, Peripherals, driver CONTENT This document describes how to use FPGA peripheral drivers www.zlg.cn Guangzhou ZHIYUAN Electronics Stock Co., Ltd.

Revision History Version Rev. Date Modifications 1.00 2012-3-13 Original version. i Revision History

Content Chapter 1: LED Driver... 1 1.1 Function... 1 1.2 How to use... 1 Chapter 2: Toggle Switch... 2 2.1 Function... 2 2.2 How to use... 2 Charter 3: 12-bit ADC... 3 3.1 Function... 3 3.2 How to use... 3 Charter 4: 8-bit ADC... 4 4.1 Function... 4 4.2 How to use... 4 Charter 5: 10-bit DAC... 5 5.1 Function... 5 5.2 How to use... 5 Charter 6: Buttons... 6 6.1 Function... 6 6.2 How to use... 6 ii Content

Chapter 1: LED Driver 1.1 Function The LED driver controls the states of 8 LEDs. 1.2 How to use The LED driver provides the operation interfaces to LEDs for user application; these interfaces are saved as files in the following directories: /sys/class/leds/zlge6x5c:red:0/ /sys/class/leds/zlge6x5c:red:1/ /sys/class/leds/zlge6x5c:red:2/ /sys/class/leds/zlge6x5c:red:3/ /sys/class/leds/zlge6x5c:red:4/ /sys/class/leds/zlge6x5c:red:5/ /sys/class/leds/zlge6x5c:red:6/ /sys/class/leds/zlge6x5c:red:7/ Each of these directories is corresponding to one LED, and each directory contains one file named brightness, writing a 0 to this file means to turn off the LED, writing a numerical string that more than 0 means to turn on the LED. For example: Turn off LED0: # echo 0 > /sys/class/leds/zlge6x5c:red:0/brightness Turn on LED0 # echo 1 > /sys/class/leds/zlge6x5c:red:0/brightness Notes: User should determine the actual state of the LED based on the test results; FPGA firmware does not provide a default state for each LED. 1 Chapter 1: LED Driver

Chapter 2: Toggle Switch 2.1 Function The Toggle Switch driver can indicate the status of the toggle switches. 2.2 How to use The Toggle Switch driver provides the operation interface to toggle switch for user application; this interface is saved as a file in the following directory: /sys/bus/pci/devices/0000:01:00.0/zlge6x5c-switch/ User can get the current status of the switch by reading the switch file. For the lowest four bits, each bit represents a status of a switch. For example: cat /sys/bus/pci/devices/0000:01:00.0/zlge6x5c-switch/switch 2 Chapter 2: Toggle switch

Charter 3: 12-bit ADC 3.1 Function The ADC can convert the analogue signal to digital signal, if a voltage is inputted to the related pin, the corresponding voltage value would read out by the device, the range of voltage is 0~3.3 V. 3.2 How to use User can get the A/D conversion value by reading the following file: /sys/bus/pci/devices/0000:01:00.0/zlge6x5c-adc12bit/value This value is not the voltage value. In order to get the actual voltage value, user should use the following equation: volt = value * 3.3 / 4095 With in the equation, the value is the AD conversion value obtained from the file. Notes: The accuracy of the data depends on the hardware specification. 3 Chapter 3: 12-bit ADC

Charter 4: 8-bit ADC 4.1 Function The ADC can convert the analogue signal to digital signal, if a voltage is inputted to the related pin, the corresponding voltage value would read out by the device, the range of voltage is 0~3.3 V. 4.2 How to use User can get the A/D conversion value by reading the following file: /sys/bus/pci/devices/0000:01:00.0/zlge6x5c-adc8bit/value This value is not the voltage value. In order to get the actual voltage value, user should use the following equation: volt = value * 3.3 / 255 With in the equation, the value is the AD conversion value obtained from the file. Notes: The accuracy of the data depends on the hardware specification. 4 Chapter 4: 8-bit ADC

Charter 5: 10-bit DAC 5.1 Function The DAC can convert the digital signal into analog signal. After calculation using a conversion equation, user can write the result value to the register of the DAC to let it output a required voltage. But the range of this voltage must be [-1, +1]V. 5.2 How to use User can write value to the following file to access the register: /sys/bus/pci/devices/0000:01:00.0/zlge6x5c-dac10bit/value The equation for voltage value conversion: value = ((volt * 1024) + 1023 ) / 2 after calculation, user should round in the result to get an integer value. The volt within the equation is the required output voltage, and its range should be between -1V and 1 V. Notes: The accuracy of the data depends on the hardware specification. 5 Chapter 5: 10-bit DAC

Charter 6: Buttons 6.1 Function The key value corresponding to each button is listed below: SW4 KEY_LEFT SW6 KEY_UP SW3 KEY_DOWN SW5 KEY_RIGHT Long press is supported. 6.2 How to use Since the return values of the buttons are configured to be the same with the arrow keys on a common computer keyboard, so if user presses a button, the same response to a corresponding arrow key would appear on the graphical user interface. User application can also get this key value by reading event device node. The name of event device node is generated dynamically. Following is the source codes for basic button operations. #include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <linux/input.h> int main(int argc, char *argv[]) { char *dev; int fd, ret; struct input_event event; if (argc > 1) dev = argv[1]; else dev = "/dev/input/by-path/pci-0000:01:00.0-platform-zlge6x5c-button-event"; fd = open(dev, O_RDWR); if (fd < 0) { perror("open failed"); return -1; /* open the device node*/ 6 Chapter 6: Buttons

} } while (1) { ret = read(fd, &event, sizeof(event)); if (ret < 0) { perror("read failed"); close(fd); return -1; } switch (event.type) { case EV_SYN: printf("[%d.%d] ------------ Report Sync ------------\n", event.time.tv_sec, event.time.tv_usec); break; case EV_MSC: printf("[%d.%d] type %d (Misc), code %d (ScanCode), value %d\n", event.time.tv_sec, event.time.tv_usec, event.type, event.code, event.value); case EV_KEY: printf("[%d.%d] type = %d, code = %d, value = %d\n", event.time.tv_sec, event.time.tv_usec, event.type, event.code, event.value); } } return 0; To check the name of a device node: $ cd /dev/input/by-path $ ls l pci-0000:01:00.0-platform-zlge6x5c-button-event Then the name of device node for buttons will be listed out. 7 Chapter 6: Buttons