OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 12613|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # k8 G% G, b' K6 C- G: H
  1. [code]EDMA sample test application
    $ |6 I* c% a8 n$ @% Q% A0 ~2 |
  2. /*- s) n" V9 D5 i# t" ?; t4 P5 {
  3. * edma_test.c
    : o0 X. u* v, _2 u7 z" E( T1 a
  4. *
    " F* D6 w. x  e; z( e8 L
  5. * brief  EDMA3 Test Application
    & G7 I0 ?9 [/ J* V2 g) Y
  6. *
    $ s( Q. b! ]) e, z4 D/ x
  7. *   This file contains EDMA3 Test code.
    1 G% z0 f' C& G, ^, d+ c$ C2 E
  8. *
    + `8 x4 U- C. K( U: N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 b2 v$ d7 j1 P% D. G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& I* J* |, t" Y
  11. *         TO CHANGE.
    3 k) s8 C. R2 E
  12. *
    1 t4 H9 o/ Y% _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- _) X. R# _8 ?) Q0 e+ P4 f
  14. *2 H. c% u" ]3 ^# e
  15. * This program is free software; you can redistribute it and/or
    ) N: i+ Z, U) G0 z: E4 H
  16. * modify it under the terms of the GNU General Public License as4 n) B+ X& Y6 w# X) z# X
  17. * published by the Free Software Foundation version 2.) f/ V6 z5 O  b/ s: @# Q1 c9 k
  18. *
    5 M; g2 F  V7 g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , `* d  G: Z- y$ ~8 I5 D3 ]
  20. * kind, whether express or implied; without even the implied warranty2 W0 W5 L0 q, q! N: U3 q  q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + O( ~) @$ d6 O' e, H9 z
  22. * GNU General Public License for more details.
    9 P+ j5 c+ @3 B# o4 z
  23. */
    , ]3 K& R8 b; T, [
  24. 1 G& h, _  o: j- x7 W# \' s3 P
  25. #include <linux/module.h>3 d, z, H) e: A. |$ D
  26. #include <linux/init.h>
    ! P6 ]8 s9 V2 m  E2 t5 a
  27. #include <linux/errno.h>8 b3 e" G2 p* t8 m9 d' L' J8 Q& c
  28. #include <linux/types.h>, @" |0 A: ^- X7 F: [. L
  29. #include <linux/interrupt.h>7 v  |$ B1 ?5 h. L7 {( x
  30. #include <asm/io.h>3 @2 X; |/ G2 z1 V! s" H: i
  31. #include <linux/moduleparam.h>
    ! D: E( e* I0 h! F+ e! u
  32. #include <linux/sysctl.h>
    " S# g" j# P, m+ w. }- _2 k
  33. #include <linux/mm.h>
    , Y! q% [' H' {& E: I5 Q1 I
  34. #include <linux/dma-mapping.h>) J" M0 [9 |: |& ^" u' R
  35. * k; J; \/ ^1 A- H, s7 ]* I) Y
  36. #include <mach/memory.h>
    6 C5 @; N6 s( U  N- \* c
  37. #include <mach/hardware.h>
    + i9 c" f8 W- b7 T, H, Q) ]& |
  38. #include <mach/irqs.h>
    7 }, u3 J9 f" ~
  39. #include <asm/hardware/edma.h># z( I& A5 ]0 \4 U6 `! `: s
  40. 3 z' f: l# U2 A$ o, y# X& e' p2 A/ Y- n
  41. #undef EDMA3_DEBUG
    : D0 K# u6 L# M5 l; L/ [$ o
  42. /*#define EDMA3_DEBUG*/
    0 B( @, T. E- c/ V1 y5 O6 h- i. I9 t
  43. ! e/ n/ N3 g; e6 C* f
  44. #ifdef EDMA3_DEBUG( C8 d2 L9 Q: Y' ^0 h7 e) E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ A' J& d6 x2 y8 O2 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 N8 E, ]! Q, \- j# g- d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' P8 L  b/ o+ R8 \6 ]6 r
  48. #else
    5 _3 N( l- d: }
  49. #define DMA_PRINTK( x... )
    ! L8 D- ]6 d: x7 h& i; O
  50. #define DMA_FN_IN
    4 h1 [' A. w! N2 ]
  51. #define DMA_FN_OUT- y+ e+ d. Y  J. |! d" ^
  52. #endif7 @+ g9 z" x8 e8 Z! t$ K+ h, I

  53. 4 G5 X6 E# v" M) C9 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ ~' [" m8 z4 U; ]9 P
  55. #define STATIC_SHIFT                3
      t  \- e9 J8 |' c8 T
  56. #define TCINTEN_SHIFT               20
      ?: _9 L" `; M  S/ l
  57. #define ITCINTEN_SHIFT              218 `% j8 H& g  T1 J2 @
  58. #define TCCHEN_SHIFT                22
    " F& Y0 o6 q! t. a- P" @8 x7 l
  59. #define ITCCHEN_SHIFT               239 j: p0 k5 [$ l3 B; T( l

  60. ; v3 k- Q  n" L% O4 e
  61. static volatile int irqraised1 = 0;5 J* U) i: K* j6 J) r
  62. static volatile int irqraised2 = 0;' Y, p% T. j1 `; R8 F, l

  63. ! }- e" W6 r: g' L* p: T: \; n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- Q* U, n9 L6 m0 {7 C% d4 E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 d6 _. O7 e/ |0 f- _3 u( W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / a/ b( [9 `; u

  67. ' k4 ?+ \# G# X$ B- V( D8 X1 ], O# I6 E
  68. dma_addr_t dmaphyssrc1 = 0;: v0 A8 W" r/ P6 d" ~
  69. dma_addr_t dmaphyssrc2 = 0;
    ' K9 k/ v2 T5 x
  70. dma_addr_t dmaphysdest1 = 0;# t. Y$ y2 l2 ~% Q/ q! G  X
  71. dma_addr_t dmaphysdest2 = 0;: m7 o; H/ h7 J5 x0 q9 L; M# T% }

  72. # y0 Y$ y5 c! W7 C' h+ R5 `
  73. char *dmabufsrc1 = NULL;
    9 ^; x3 D' ]/ `/ r# D9 n* O
  74. char *dmabufsrc2 = NULL;
    6 N* H8 h- j5 v3 j" b
  75. char *dmabufdest1 = NULL;; K8 q3 ~4 y9 q" X
  76. char *dmabufdest2 = NULL;# S9 O$ u2 y: K+ `
  77. & _! r( O# B  V+ ^+ U* E
  78. static int acnt = 512;
    5 A! F0 \- z/ Z7 w" U4 _
  79. static int bcnt = 8;9 O* N: d# I3 ]  J5 f
  80. static int ccnt = 8;6 g) Q( B* _; T0 H' k$ V

  81. ; ?$ P5 S5 e, x& u/ X3 }  {
  82. module_param(acnt, int, S_IRUGO);- {" W0 P: d# o1 S# U- m3 T
  83. module_param(bcnt, int, S_IRUGO);3 R) P: j+ Q0 O8 {
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 P  L, V/ U  V. g2 x( J0 s$ m9 \1 ]- Z+ O' F8 C4 U5 c' ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 u% R# G2 {7 v) |. A- s
arm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ Y7 u( \4 R1 L) \9 x- T
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' y: }( }4 J: S. O. [% n6 C5 g$ _8 ^# q" S6 l, Q, ]. m* k3 {
5 ?. f; G; |& ~" f+ e) m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-3-14 18:01 , Processed in 0.040742 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表