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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 h, c8 r% n/ i- k2 I( P
  1. [code]EDMA sample test application* A% p5 r. l# z2 q  D9 W$ O* Y( [
  2. /*5 h+ U5 X! s, l4 R6 C# A1 e
  3. * edma_test.c4 W! P; ~: z9 p3 G1 q
  4. *1 u) N% v* z, H" B: X
  5. * brief  EDMA3 Test Application
    % `3 v2 L3 F- H
  6. *
    , P5 d& x5 g3 c
  7. *   This file contains EDMA3 Test code.: [1 m8 ~# i9 y
  8. *
    9 b; u7 t: s0 h, C7 R  \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 {, Q% Y( T+ r! r% u7 G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) |. m( w% B  t6 A- l$ h
  11. *         TO CHANGE.
    3 R; z) j- s3 a7 A" T5 u3 \, t
  12. *
    8 D; q5 o" j, d! U' C' ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - l* M3 |) \; Y: y9 W1 d! @
  14. *
    % f0 V6 G" ?, Y
  15. * This program is free software; you can redistribute it and/or
    / |# X7 z: H1 w+ @: _
  16. * modify it under the terms of the GNU General Public License as% L4 t6 i' q- a4 e) w$ W1 G
  17. * published by the Free Software Foundation version 2.
    - ?, ^, ]) W3 b( P9 B- \. b0 N1 q8 p
  18. *
    $ O0 Q8 k/ c9 P( E& y% ?- z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # g5 R4 L  X* R: k
  20. * kind, whether express or implied; without even the implied warranty# z9 @* Z4 ^( v$ H- g/ g/ O$ n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ `9 ]3 x1 I( E3 W+ _2 T
  22. * GNU General Public License for more details./ U2 d" i1 i% R8 D" q3 w; I8 G
  23. */
      J7 @5 J2 t$ y; r; I$ ~* F
  24. + h5 S! @$ Y: f" W
  25. #include <linux/module.h>
    ; p' x$ l. G' H
  26. #include <linux/init.h>
    " F) k1 B: v* M2 M5 ]* s
  27. #include <linux/errno.h>
    ( Q0 f  [# f0 v9 z
  28. #include <linux/types.h># V* F$ Z1 s  q7 k. p
  29. #include <linux/interrupt.h>
    , q4 d6 _' d- k; c- u$ W7 Z% t
  30. #include <asm/io.h>9 ?2 j" i4 j; |* n" i
  31. #include <linux/moduleparam.h>: u& m$ _! }) h7 _" z
  32. #include <linux/sysctl.h>
    % h# W; i# e! C& Y( b/ k
  33. #include <linux/mm.h>3 r- K5 b/ g% Q. x3 o5 R) s! g
  34. #include <linux/dma-mapping.h>3 b1 a' ?  k+ \
  35. 1 M# Y& g& V4 ^+ B- e' C2 B
  36. #include <mach/memory.h>8 z" a. R: X* F( l6 F+ j# b3 q4 m
  37. #include <mach/hardware.h># i" \9 o0 J/ m0 M+ N+ Z. \; f
  38. #include <mach/irqs.h>
    ' [! \' L6 {7 a8 t, Z8 |
  39. #include <asm/hardware/edma.h>
    5 I. P) r* e3 ^  t2 N5 T' O

  40. 4 O0 i' j) ^& r1 w5 G' j
  41. #undef EDMA3_DEBUG
    1 a% t7 b# U1 |) l) K
  42. /*#define EDMA3_DEBUG*/
    ' I4 B4 J) v0 ]* O
  43. 0 r  F; ]0 Z4 O8 a% a3 G
  44. #ifdef EDMA3_DEBUG
    - P, Q1 s* b/ i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 c2 b8 _$ E6 B$ J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : p+ [8 ]  S* W4 d- F" a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # w8 @5 ^" t0 f) K" F- v/ x1 B
  48. #else
    0 c0 t; C" ^6 a/ `) s1 a
  49. #define DMA_PRINTK( x... )
    1 Y3 ]; {0 z6 ?/ C; r/ x  B5 r
  50. #define DMA_FN_IN
    * O0 `) Y9 s" g
  51. #define DMA_FN_OUT% y: v5 m# s6 k, b7 i0 d
  52. #endif( f* c0 P3 U; ~+ H
  53. & Q1 z' y( `, h" d" p4 c9 {; A! S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / d, `' z; O1 p  A3 h# t! K
  55. #define STATIC_SHIFT                3+ N; k# {2 f: N- ^& g
  56. #define TCINTEN_SHIFT               20
    $ T6 W8 Y6 B5 {' \& S8 ^
  57. #define ITCINTEN_SHIFT              21
    ( ]) D% g8 i' n& i. h
  58. #define TCCHEN_SHIFT                22  ], S' r. v  k$ g9 y: p0 b
  59. #define ITCCHEN_SHIFT               23
    5 v9 {# r  m3 j$ V: D. R
  60. . n4 i) Q0 L6 ]% q& f2 e: O
  61. static volatile int irqraised1 = 0;& y& u& d% a2 k& n
  62. static volatile int irqraised2 = 0;1 I4 }/ t5 O) X- E! W

  63. 0 u' v( `; t' X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 y$ H. i! g) m! L$ z& y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! J6 ^; ?. s. h& e) ?" L( E; ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: y1 v3 `4 W6 P" E  h9 m3 b0 o; j

  67. ' u) @# w8 R6 ^; C3 k
  68. dma_addr_t dmaphyssrc1 = 0;, z1 B$ D7 I) M. q  j0 A
  69. dma_addr_t dmaphyssrc2 = 0;
    ; A' |1 g2 x9 r3 V' z. `
  70. dma_addr_t dmaphysdest1 = 0;
    & \# g7 j! T% ]3 @0 H* K, ~" O
  71. dma_addr_t dmaphysdest2 = 0;
    $ H6 E1 W2 g) A5 O, |1 _% F2 Y; d
  72. & G- ~8 L* j) O5 z+ Z8 E, g- x
  73. char *dmabufsrc1 = NULL;
    " r2 W8 s5 G7 F( `/ I$ P# P* h
  74. char *dmabufsrc2 = NULL;7 Z$ f3 u0 `* k1 R- N3 W
  75. char *dmabufdest1 = NULL;( X1 z: b, X. S% z  F# T( C
  76. char *dmabufdest2 = NULL;
    1 K) _) u2 k- f* @. Z3 C1 r
  77. 1 a' V) T3 {& X3 T  ]
  78. static int acnt = 512;0 \% h6 x- M7 l  j  [9 r
  79. static int bcnt = 8;9 u! o# m) d  [8 R9 a
  80. static int ccnt = 8;
    * I1 a" v3 e, K+ z, e( f2 I

  81. 6 t' k# J" p. g4 c0 Z4 d$ y1 S; u
  82. module_param(acnt, int, S_IRUGO);! D! D; k. q$ w+ w- ?
  83. module_param(bcnt, int, S_IRUGO);
    8 E" l1 Q+ n0 a2 V2 n# z5 |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  o0 G+ g% m* m. \# y

7 O3 r4 Y0 [$ B9 n) F! p1 c6 A      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! r$ ?* U6 ?- W  k+ |. [: d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 h& Z" |; w7 W% R- e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 U1 E( R- T* q6 ^4 J9 b2 Z8 y+ I

* X4 Z! z2 c% X. O
- e2 n5 Y- X/ A6 a" v+ Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-22 17:20 , Processed in 0.040240 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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