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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   K3 r7 \, ^1 B3 c6 P6 l
  1. [code]EDMA sample test application% J9 s1 O5 q1 _4 O
  2. /*
    6 h% y* ?9 M; N) Q. E
  3. * edma_test.c
    5 X* w' z6 }$ a1 x- |$ P- U
  4. *
    . L& p* ?( K" V6 }4 y: [# Q
  5. * brief  EDMA3 Test Application* T8 f' a3 y4 V8 @
  6. *; L! @; M0 p; g" j! a/ G5 X2 b
  7. *   This file contains EDMA3 Test code.1 o8 K4 n" Q: S/ u, ^, i& b# g  l
  8. *
    , z9 `% V- X( F4 ^) O! ?/ M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ v  O- R" B1 p0 r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / j. Y" ?7 t0 J0 r" N7 \
  11. *         TO CHANGE.3 Q0 g2 o/ I* @$ o
  12. *8 k* N2 n. @7 c2 w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" K9 J2 x. }( ]3 \. W) Z
  14. *! a+ `1 X# _3 m
  15. * This program is free software; you can redistribute it and/or+ g" ]1 a$ n) ]+ d( b& _
  16. * modify it under the terms of the GNU General Public License as
    ( e% _$ p& |- |6 Y1 Q. d$ h
  17. * published by the Free Software Foundation version 2.2 P3 L- ^5 c& W( W0 s0 ~2 }
  18. *
    ) c3 n* V' U5 ]- Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 L# n# c6 o% v
  20. * kind, whether express or implied; without even the implied warranty9 T2 P1 T3 a: S2 C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 [( V0 S# }. ]
  22. * GNU General Public License for more details.  s. o! K& M- d; C: k4 ~5 T5 l# M
  23. */  a9 t& ]5 A8 R, v8 A* d

  24. 0 v" G6 A! Z" e: P
  25. #include <linux/module.h>
    " z4 e" [* M8 s: H' g2 }1 |; a
  26. #include <linux/init.h>0 J' a0 S! z3 [% K; ~2 T
  27. #include <linux/errno.h>$ j$ n) k! u) O1 K7 T4 z4 P) n+ A
  28. #include <linux/types.h>
    1 [7 ]* T0 N+ G  `$ f9 b. Q
  29. #include <linux/interrupt.h>
    . Y6 B8 H  M* _
  30. #include <asm/io.h>- L; U7 V  ~* M3 ^" b, o. K
  31. #include <linux/moduleparam.h>
    % Q- ?9 ?( z0 }3 G3 e  s5 G  D, d; R
  32. #include <linux/sysctl.h>
    " g" F8 v4 n5 o  y: w  ^
  33. #include <linux/mm.h>' V$ q; Y7 T/ B6 j( D6 D
  34. #include <linux/dma-mapping.h>
    % O+ {2 x8 y) F8 [

  35. # W; x% j* D4 E3 n& ]
  36. #include <mach/memory.h>
    5 [/ j- H, K: \2 _- P, h% c
  37. #include <mach/hardware.h>/ V" K) ~$ Y- g, R) a& B) [6 q) F$ ?
  38. #include <mach/irqs.h>
    + j/ [6 Y* W6 l( B7 |
  39. #include <asm/hardware/edma.h>
    $ Q4 `/ W5 N, s" H" Q
  40. . j6 g5 s& \+ ~" j" z6 b/ X
  41. #undef EDMA3_DEBUG$ M1 |5 _  b% Q
  42. /*#define EDMA3_DEBUG*/# \  j6 N' U$ Y1 h- r0 Z

  43. & G5 u1 y8 D7 j, W& Z
  44. #ifdef EDMA3_DEBUG
    . O: T2 Z* N: m& a8 k3 y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 o/ {4 S+ }0 y0 @( i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 G8 g4 L; e6 b4 t! u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & a5 h2 D5 a3 D2 V1 P; ?- R
  48. #else9 n& M# j4 U" i+ H4 U. U0 j
  49. #define DMA_PRINTK( x... )
      i3 ^; z6 C0 x" L$ S
  50. #define DMA_FN_IN: D# k4 S- s2 T0 I) Z/ B# J+ }
  51. #define DMA_FN_OUT; H' ~+ e. ^# k
  52. #endif
    1 c4 k* c* b* l/ l

  53. % w" }' `- z# }' M8 x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # q5 k) u+ k/ s, a* [
  55. #define STATIC_SHIFT                3
    ; s; R, E* G# p" a
  56. #define TCINTEN_SHIFT               202 J7 q5 O' m( Y9 M; T' ~
  57. #define ITCINTEN_SHIFT              21$ R5 K2 r* o. v. J& @: L
  58. #define TCCHEN_SHIFT                22
    2 G) i. m, b$ R7 h
  59. #define ITCCHEN_SHIFT               23
    ! a6 c; I. h' ^  D$ h" d; I1 O
  60. ) M/ g$ a8 a, u+ }* @  q
  61. static volatile int irqraised1 = 0;: D. t- n7 |% y; W- ]5 p
  62. static volatile int irqraised2 = 0;8 P' _: X6 B' y& N) `* A
  63. " }0 s! r8 T% B7 i' w* r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 }: q* y2 s8 M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 R' L$ g2 o! E, }1 |& c# _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      [" \# O/ N, ^
  67. % k( k3 |, G: c9 c
  68. dma_addr_t dmaphyssrc1 = 0;1 _  x5 \1 [! j6 p' H
  69. dma_addr_t dmaphyssrc2 = 0;7 V; s. a. a, y
  70. dma_addr_t dmaphysdest1 = 0;) a  V- e% J. @) A2 F
  71. dma_addr_t dmaphysdest2 = 0;8 U$ o* m7 n9 I6 a7 }* z
  72. / _/ [" W; W+ Z
  73. char *dmabufsrc1 = NULL;; _3 u8 ]" H! Q9 r: n$ j7 |3 D! J
  74. char *dmabufsrc2 = NULL;6 w% F$ b; _2 Y+ r0 a, w$ P; j, I
  75. char *dmabufdest1 = NULL;
    * k0 {8 I8 `6 p8 K; d4 @7 X
  76. char *dmabufdest2 = NULL;2 Q! `0 Z# V" V8 m$ J

  77. 7 K" Y8 R9 C- Y, Q
  78. static int acnt = 512;: h5 j- ~7 T  B
  79. static int bcnt = 8;) c* ^2 v" M) o  O; M- S
  80. static int ccnt = 8;  w4 X. |  _( Q) Z! M9 @
  81. ) _7 Q5 e3 p" B2 R4 W3 E" m
  82. module_param(acnt, int, S_IRUGO);
    ! H/ V) G+ C9 e: j! r
  83. module_param(bcnt, int, S_IRUGO);
    7 Y- G" a. D# L% a' i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 V: W! y4 L0 ]. H3 V+ N$ n# Y/ y' ]
4 Y: n. b9 U, g7 l, Y8 `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; R  h$ Y, Y+ N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ U- {3 [- l  ~5 s" B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' y. o2 ?  b; \: D
& J4 H( p! ?$ T$ I

% C0 O( X2 \# x) s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 22:53 , Processed in 0.044601 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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