2006/1/201IGEL Co.,Ltd. / Renesas Solution Corp. Studies on User Level Device Driver in Embedded Environment ( Progress Report ) Katsuya Matsubara IGEL.

Slides:



Advertisements
Similar presentations
Chapter 5 Input/Output 5.1 Principles of I/O hardware
Advertisements

Chapter 4 Device Management and Disk Scheduling DEVICE MANAGEMENT Content I/O device overview I/O device overview I/O organization and architecture I/O.
Principles of I/O Hardware I/O Devices Block devices, Character devices, Others Speed Device Controllers Separation of electronic from mechanical components.
Lecture 101 Lecture 10: Kernel Modules and Device Drivers ECE 412: Microcomputer Laboratory.
Device Drivers. Linux Device Drivers Linux supports three types of hardware device: character, block and network –character devices: R/W without buffering.
RT_FIFO, Device driver.
USERSPACE I/O Reporter: R 張凱富.
Tutorial 3 - Linux Interrupt Handling -
The Linux Kernel: Memory Management
Model for Supporting High Integrity and Fault Tolerance Brian Dobbing, Aonix Europe Ltd Chief Technical Consultant.
Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators.
Contiki A Lightweight and Flexible Operating System for Tiny Networked Sensors Presented by: Jeremy Schiff.
I/O Devices and Drivers
OS Fall ’ 02 Introduction Operating Systems Fall 2002.
1 Soft Timers: Efficient Microsecond Software Timer Support For Network Processing Mohit Aron and Peter Druschel Rice University Presented By Jonathan.
I/O Hardware n Incredible variety of I/O devices n Common concepts: – Port – connection point to the computer – Bus (daisy chain or shared direct access)
Threads 1 CS502 Spring 2006 Threads CS-502 Spring 2006.
OS Spring’03 Introduction Operating Systems Spring 2003.
Real-Time Kernels and Operating Systems. Operating System: Software that coordinates multiple tasks in processor, including peripheral interfacing Types.
1 When to Switch Processes 3 triggers –System call, Interrupt and Trap System call –when a user program invokes a system call. e.g., a system call that.
ThreadsThreads operating systems. ThreadsThreads A Thread, or thread of execution, is the sequence of instructions being executed. A process may have.
I/O Tanenbaum, ch. 5 p. 329 – 427 Silberschatz, ch. 13 p
CSE 451: Operating Systems Autumn 2013 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
Chapter 3 Operating Systems Introduction to CS 1 st Semester, 2015 Sanghyun Park.
OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements.
Cpr E 308 Input/Output Recall: OS must abstract out all the details of specific I/O devices Today –Block and Character Devices –Hardware Issues – Programmed.
Hardware Definitions –Port: Point of connection –Bus: Interface Daisy Chain (A=>B=>…=>X) Shared Direct Device Access –Controller: Device Electronics –Registers:
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
LINUX System : Lecture 7 Bong-Soo Sohn Lecture notes acknowledgement : The design of UNIX Operating System.
Fall 2013 SILICON VALLEY UNIVERSITY CONFIDENTIAL 1 Introduction to Embedded Systems Dr. Jerry Shiao, Silicon Valley University.
Operating Systems 1 K. Salah Module 1.2: Fundamental Concepts Interrupts System Calls.
System Components ● There are three main protected modules of the System  The Hardware Abstraction Layer ● A virtual machine to configure all devices.
Real Time System with MVL. © 2007 MontaVista Confidential | Overview of MontaVista Agenda Why Linux Real Time? Linux Kernel Scheduler Linux RT technology.
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
OSes: 2. Structs 1 Operating Systems v Objective –to give a (selective) overview of computer system architectures Certificate Program in Software Development.
Device Driver Concepts Digital UNIX Internals II Device Driver Concepts Chapter 13.
Introduction Contain two or more CPU share common memory and peripherals. Provide greater system throughput. Multiple processor executing simultaneous.
Operating Systems: Summary INF1060: Introduction to Operating Systems and Data Communication.
Low Overhead Real-Time Computing General Purpose OS’s can be highly unpredictable Linux response times seen in the 100’s of milliseconds Work around this.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
CSCI/CMPE 4334 Operating Systems Review: Exam 1 1.
Embedded Real-Time Systems
CSCE451/851 Introduction to Operating Systems
Introduction to Operating Systems Concepts
Input/Output (I/O) Important OS function – control I/O
Chapter 13: I/O Systems.
Kernel Design & Implementation
Module 12: I/O Systems I/O hardware Application I/O Interface
Linux Realtime Preemption and Its Impact on ULDD* - Progress Report -
CS 6560: Operating Systems Design
Protection of System Resources
CSCI 315 Operating Systems Design
Making Virtual Memory Real: The Linux-x86-64 way
I/O Systems I/O Hardware Application I/O Interface
Operating Systems Chapter 5: Input/Output Management
Operating System Concepts
13: I/O Systems I/O hardwared Application I/O Interface
CS703 - Advanced Operating Systems
CSE 451: Operating Systems Spring 2012 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
Chapter 2: The Linux System Part 3
Linux Architecture Overview.
LINUX System : Lecture 7 Lecture notes acknowledgement : The design of UNIX Operating System.
February 5, 2004 Adrienne Noble
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Outline Device Management Device Manager Design Buffering
System Calls System calls are the user API to the OS
Chapter 1: Introduction CSS503 Systems Programming
Module 12: I/O Systems I/O hardwared Application I/O Interface
Presentation transcript:

2006/1/201IGEL Co.,Ltd. / Renesas Solution Corp. Studies on User Level Device Driver in Embedded Environment ( Progress Report ) Katsuya Matsubara IGEL Co.,Ltd.

2006/1/202IGEL Co.,Ltd. / Renesas Solution Corp. Stories so far Investigated behaviors of threads –RT Task vs Non-RT Task Number of Load Tasks Switching Time(WRITE Task->Vertual DD->Read Task)Wakeup Vertual DD->Read Task) Response Time(microsec)

2006/1/203IGEL Co.,Ltd. / Renesas Solution Corp. Background and Objectives Want to implement device drivers in user level –Easy to devleop –Reduce system down due to driver bugs – ( Avoid GPL ) Some issues on implementing user level device drivers –Access to I/O memory, physical memory –Forwarding of Interupttion Requests ( IRQ ) –Response performance to interuption – ‥‥ New features in Kernel 2.6 –NPTL(Native POSIX Thread Library) –Sceduler improvement ( O(1) scheduler etc. ) –Kernel preemption –….

2006/1/204IGEL Co.,Ltd. / Renesas Solution Corp. Facts in Development of Embedded Software More development of drivers for new devices Applications directly control devices –To minimize latency –More intimate relation between devices and applications, thant desktop PC applications Hiding hardware specification

2006/1/205IGEL Co.,Ltd. / Renesas Solution Corp. User Level Device Drivers Implementing Device Drivers in User Space Expected effects –Use of abundant tools/libraries (e.g. files) –Ease of development and debugging –Less system hang ups –Less distance to applications –…. Related research –Peter Chubb, “Get more device drivers out of kernel,” OLS2004.

2006/1/206IGEL Co.,Ltd. / Renesas Solution Corp. Features Required for Device Drivers Access to I/O Memory –Device control through register I/O, data I/O Interrupt Receipt and Handling Physical Memory Allocation and Access –Necessary for devices which access directly to memory using DMA, etc. –In case of DMA, allocation of consecutive memory may be required Lock of CPU , Realtime Interface to Applications

2006/1/207IGEL Co.,Ltd. / Renesas Solution Corp. Interrupt Receipt and Handling in User Level Device Drivers Interrupt Reciept by File I/O –Prepare device files for each interrupt number –read() the device file and block until interrupt occurs

2006/1/208IGEL Co.,Ltd. / Renesas Solution Corp. Memory Access in User Level Device Drivers Direct Access to I/O Memory with Memory Map(mmap) –open(), mmap() the /dev/mem or specific device file –Once mmap’ed, then accessible as usual For Physical Memory, Allocate, then mmap

2006/1/209IGEL Co.,Ltd. / Renesas Solution Corp. Interface to Applications in User Level Device Drivers As User Level Device Driver can Exist in the Same User Space as Applications, Such Interfaces as Interprocess Communications, Shared Memory, etc. can Implementable Easy to Integrate with Applications

2006/1/2010IGEL Co.,Ltd. / Renesas Solution Corp. CPU Lock, Realtime in User Level Device Drivers With RT Threads, to Some Extent… To be discussed

2006/1/2011IGEL Co.,Ltd. / Renesas Solution Corp. Implementation ( Serial Driver ) Implementation Environment –RTS7751R2D Renesas SH4 SM501 companion chip embedding UART –8250 compatible –2 modes: 1 byte I/O and FIFO buffer I/O –Linux CONFIG_PREEMPT=y Glibc 2.3.3

2006/1/2012IGEL Co.,Ltd. / Renesas Solution Corp. Processing Interrupt Handling –Receiving Data –Emptying Send Buffer[?] I/O Memory Access –SM501 Register I/O

2006/1/2013IGEL Co.,Ltd. / Renesas Solution Corp. Linux Kernel Software Architecture I/O Memory Map DriverInterrupt Hook DriverSM501 UART Terminal App User Level UART D.Driver Data I/O Buffer

2006/1/2014IGEL Co.,Ltd. / Renesas Solution Corp. Interrupt Hook Driver static int irqhook_proc_open(struct inode *inop, struct file *filp) {... request_irq(ipp->irq, irqhook_proc_irq_handler, SA_INTERRUPT, ipp->devname, ipp);... } static ssize_t irqhook_proc_read(struct file *filp, char __user *bufp, size_t len, loff_t *ppos) {.... prepare_to_wait(&ipp->q, &wait, TASK_INTERRUPTIBLE); pending = atomic_read(&ipp->count); if (pending == 0) schedule();..... }

2006/1/2015IGEL Co.,Ltd. / Renesas Solution Corp. I/O Memory Map Driver int iommap_mmap(struct file *filp, struct vm_area_struct *vma) { size_t size = vma->vm_end - vma->vm_start; unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; vma->vm_flags |= VM_RESERVED; vma->vm_flags |= VM_IO; vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); /* Map each page to users' virtual memory space */ if (io_remap_page_range(vma, vma->vm_start, offset, size, vma->vm_page_prot)) return -EAGAIN; return 0; }

2006/1/2016IGEL Co.,Ltd. / Renesas Solution Corp. UART Driver while (1) {.... if (read(fd, &n_pending, sizeof(int) > 0) { if ((status = SM501_UART0_LINESTAT(&iomem)) & 0x01) { do { buffer[count]= SM501_UART0_RXBUFF(&iomem); status = SM501_UART0_LINESTAT(&iomem); count++; if(count >= BUFFER_SIZE){ loop++; count = 0; if(loop >= LOOP_COUNT) goto end; } while((status & 0x01)&&(max_count-- > 0)); }.... }

2006/1/2017IGEL Co.,Ltd. / Renesas Solution Corp. Experiment Just started experimenting… Serial I/O –Measured throughput with 1MB READ/WRITE for serial device –Used SM501 byte I/O mode –Kernel drivers are those included in –User level device driver was executed as RT task –User level device driver was integrated with serial I/O process –Connected R2D board and note PC(TeraTerm) with serial cross cable

2006/1/2018IGEL Co.,Ltd. / Renesas Solution Corp. Experiment Results 38.4kbps300bps ReadWriteReadWrite User Level DD29.95kbps30.68kbps210.70bps213.34bps Kernel Level DD 29.69kbps28.08kbps232.82bps232.70bps Data Size : 1MB Buffer Size : 1KB Baud Rate : 300 or bps Mesured values : Average of the 10 trial results of the same experiment

2006/1/2019IGEL Co.,Ltd. / Renesas Solution Corp. Impressions Negligible Overhead At least in Low Load Environment (where no one intervenes)? –ULDD is rather faster for 38.4kbps –Deserves analysis – My action item System Stability, Ease of Coding and Debugging, and Abundance of User Land Features are Attractive

2006/1/2020IGEL Co.,Ltd. / Renesas Solution Corp. Issues Behavior in Heavy Load Environment –RT tasks / Non-RT tasks Comparison with PC Environment Evaluation with Other Devices Summary of Characteristics of Kernel Level Device Drivers and User Level Device Drivers Seeking for Novelty…

2006/1/2021IGEL Co.,Ltd. / Renesas Solution Corp. Discussion