1 / 21

Studies on User Level Device Driver in Embedded Environment ( Progress Report )

Studies on User Level Device Driver in Embedded Environment ( Progress Report ). Katsuya Matsubara IGEL Co.,Ltd. Stories so far. Investigated behaviors of threads RT Task vs Non-RT Task. Switching Time(WRITE Task->Vertual DD->Read Task). Wakeup Vertual DD->Read Task).

odele
Télécharger la présentation

Studies on User Level Device Driver in Embedded Environment ( Progress Report )

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

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

  3. 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 • …. IGEL Co.,Ltd. / Renesas Solution Corp.

  4. 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 IGEL Co.,Ltd. / Renesas Solution Corp.

  5. 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. IGEL Co.,Ltd. / Renesas Solution Corp.

  6. Features Requiredfor 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 IGEL Co.,Ltd. / Renesas Solution Corp.

  7. Interrupt Receipt and Handlingin 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 IGEL Co.,Ltd. / Renesas Solution Corp.

  8. Memory Accessin 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 IGEL Co.,Ltd. / Renesas Solution Corp.

  9. Interface to Applicationsin 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 IGEL Co.,Ltd. / Renesas Solution Corp.

  10. CPU Lock, Realtimein User Level Device Drivers • With RT Threads, to Some Extent… • To be discussed IGEL Co.,Ltd. / Renesas Solution Corp.

  11. 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 2.6.13.4 • CONFIG_PREEMPT=y • Glibc 2.3.3 IGEL Co.,Ltd. / Renesas Solution Corp.

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

  13. I/O Memory Map Driver Interrupt Hook Driver SM501 UART Software Architecture Buffer Data I/O User Level UART D.Driver Terminal App Linux Kernel IGEL Co.,Ltd. / Renesas Solution Corp.

  14. 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(); ..... } IGEL Co.,Ltd. / Renesas Solution Corp.

  15. 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; } IGEL Co.,Ltd. / Renesas Solution Corp.

  16. 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)); } .... } IGEL Co.,Ltd. / Renesas Solution Corp.

  17. 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 2.6.13.4 • 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 IGEL Co.,Ltd. / Renesas Solution Corp.

  18. Experiment Results • Data Size:1MB • Buffer Size: 1KB • Baud Rate: 300 or 38400 bps • Mesured values:Average of the 10 trial results of the same experiment IGEL Co.,Ltd. / Renesas Solution Corp.

  19. 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 IGEL Co.,Ltd. / Renesas Solution Corp.

  20. 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… IGEL Co.,Ltd. / Renesas Solution Corp.

  21. Discussion IGEL Co.,Ltd. / Renesas Solution Corp.

More Related