OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' X: ~; |3 X: B" }
  1. [code]EDMA sample test application
    5 v5 y6 j, F* }3 |# B6 e
  2. /*6 ?+ G+ Y, i+ j3 o
  3. * edma_test.c* u1 Y4 B" z& _9 O% q
  4. *8 b$ j/ H/ Y+ T/ c8 t, ~: I! G
  5. * brief  EDMA3 Test Application
    # @$ h& v; T0 Z7 S
  6. *
    5 }5 ^# o& ]6 u7 d1 J3 D- M
  7. *   This file contains EDMA3 Test code.$ n) `& }- `. S; A: X2 c8 D
  8. *) ^! o6 W( x. P& C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' p3 u% t6 t6 }8 t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 s3 b  o, v/ {3 k: s
  11. *         TO CHANGE.
      \9 R) [1 r7 v/ x( |) X
  12. *7 u  x3 U) x4 L8 B# k8 ]. |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 D5 @! @+ B; \4 K/ S- `
  14. *2 ]+ D$ t  q/ Z; r2 N5 `: W
  15. * This program is free software; you can redistribute it and/or4 x6 F) F; q& d* i+ X# u  @) i  Y  x. \" d
  16. * modify it under the terms of the GNU General Public License as
    2 X7 ]# i. v* }( Z; M3 t6 E
  17. * published by the Free Software Foundation version 2.& z7 B9 Q) ?  H5 U
  18. *
    2 P0 [3 }" t' B  h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      h/ x+ _- K6 b, T( I3 {/ S8 Y
  20. * kind, whether express or implied; without even the implied warranty5 `2 X# A# X8 g4 S, e, B8 B/ w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / ?( K6 T% b/ x& @7 u' X8 v& g; u
  22. * GNU General Public License for more details.
    0 s. a. h3 l7 I; t) {( G
  23. */3 P( i0 V* Q5 d/ r0 Z; r9 T

  24. 5 @0 a. R6 x+ C* L$ N
  25. #include <linux/module.h>( _9 D8 S  e0 n+ Y& d
  26. #include <linux/init.h>
    , y- x( _9 g# x5 z# t8 {
  27. #include <linux/errno.h>6 ?3 [9 b- }; u' H7 C6 o
  28. #include <linux/types.h>( e& C0 t: r/ H, ^& Q5 `# d
  29. #include <linux/interrupt.h>/ C8 I* \& L# w& D: e' X7 U" d
  30. #include <asm/io.h>
    9 V# e' N# B7 @! U* n/ x( Y- @" }
  31. #include <linux/moduleparam.h>
    % X3 d/ M% p3 @& R8 ?" q( @
  32. #include <linux/sysctl.h>  x2 {. y: s( [) \8 f. V
  33. #include <linux/mm.h>
    - p& h; `/ l# e2 Y% U3 q. `
  34. #include <linux/dma-mapping.h>
    " W' {, I! n$ o7 K" G! J8 g1 q
  35. # g% r# i5 \$ I) o
  36. #include <mach/memory.h>( F  o+ M: D6 B
  37. #include <mach/hardware.h>/ K5 [+ P1 |  c2 {" |3 h  e
  38. #include <mach/irqs.h>0 l8 g% Q, O; X" e+ V4 j
  39. #include <asm/hardware/edma.h>
    7 X7 n% M1 w: i" m, {
  40. 6 V. d/ R; T4 N: O
  41. #undef EDMA3_DEBUG
    , z  `% _' z6 w, k/ C
  42. /*#define EDMA3_DEBUG*/1 B! c& Z* w( q5 L# D* h7 m4 H7 A

  43. ! a5 T" h# g& F
  44. #ifdef EDMA3_DEBUG* v, c: f# Y  @9 k; B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & g# U9 ^9 o$ L6 q6 }/ h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& p% B# |7 G" P: b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' ]$ [8 t5 s) C/ L8 ]4 c
  48. #else: r9 a( ]$ `+ n5 N+ Z* d8 l' ~
  49. #define DMA_PRINTK( x... )
    + O! C- e8 b# J6 t2 q: i
  50. #define DMA_FN_IN
    ; Y% c) G  n) s( E. O, }1 `. E
  51. #define DMA_FN_OUT5 t5 u1 D! i, S
  52. #endif% e3 y1 b+ ~* F5 U

  53. 2 ~2 d/ u, G& @3 }8 H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); N! R! f1 }& w% ~- x) F
  55. #define STATIC_SHIFT                3  U, A- C: W% @, t
  56. #define TCINTEN_SHIFT               20
    " h5 \! Q: }" s- Y+ J" ^3 _1 j
  57. #define ITCINTEN_SHIFT              21
    3 ~4 k$ ]9 V! l" R
  58. #define TCCHEN_SHIFT                22
    6 R- b& d, l& ~6 N$ g$ S0 m
  59. #define ITCCHEN_SHIFT               23
    7 U# z% S( [1 J. `0 u" b

  60. 9 p$ N2 b6 `! K  Z  w
  61. static volatile int irqraised1 = 0;$ v$ e$ k; @6 P% @9 M
  62. static volatile int irqraised2 = 0;! Q$ v9 I4 n0 i8 Z
  63. ) q  \4 M, q5 [' a2 e, G+ a6 ]# O8 E# _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 o% \6 t; ]* D9 l' Q- S  J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 H2 z7 |5 `, n& F  r: w2 D9 E8 d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 c: t# J1 u" X+ c8 p

  67. & s$ Q% e; _# k3 k- Q
  68. dma_addr_t dmaphyssrc1 = 0;  x1 i" j/ L0 o% y8 o- D0 P
  69. dma_addr_t dmaphyssrc2 = 0;
    7 }6 R3 _% ]* T& N' }/ ~
  70. dma_addr_t dmaphysdest1 = 0;. U- ^3 ~+ v" Q
  71. dma_addr_t dmaphysdest2 = 0;7 C9 k( T  U3 J* ]: ?$ E
  72. # C# k* a: w6 c) V' I& T
  73. char *dmabufsrc1 = NULL;
    . c, }# ?2 N7 ~0 o- Z8 B
  74. char *dmabufsrc2 = NULL;" ^' R0 A/ n5 K* U: M  t
  75. char *dmabufdest1 = NULL;
    3 u7 ]9 y( P% E- z  ^6 Y
  76. char *dmabufdest2 = NULL;3 h# Y: p( }5 ^5 a

  77. . ?6 k& K$ O2 c7 q
  78. static int acnt = 512;- E9 ?4 Y  A( c4 O3 E' ~- C
  79. static int bcnt = 8;, N/ |$ M% X0 l  Q  j7 u! K) [& D
  80. static int ccnt = 8;
    ; G! c5 I& o& j, N
  81. 4 j% g# S' Q7 V
  82. module_param(acnt, int, S_IRUGO);4 R" Z0 f  K. v6 `/ o8 b1 C, |
  83. module_param(bcnt, int, S_IRUGO);2 N" z3 ^8 T$ _* ~1 }+ o& T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% S- o  \3 m) b2 e1 _; _: G
$ H( O& b( v# a5 H8 C1 Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 S5 V2 J& p/ b" N1 S2 Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ b0 R& y+ M& v& G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 k5 K# F: p% I9 b! d
+ Q! Y& I1 i- L( r! H
: D# o0 b( O7 C) a. O# h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 23:36 , Processed in 0.041980 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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