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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 H6 y. ~/ V& Y7 @- F! h. `! J
  1. [code]EDMA sample test application0 `9 U$ t" g" V* v
  2. /*0 r; f% S2 p0 L! ^1 w! n& |. Q
  3. * edma_test.c
      ~/ p- w: N% u7 ?$ t
  4. *. V' e. M/ L: T* E- p" L* K
  5. * brief  EDMA3 Test Application
    ) J( h  s9 H6 O- I
  6. *, s7 I" _9 E5 Q
  7. *   This file contains EDMA3 Test code.
    7 F; ?2 w, ?  `  P
  8. *! h( R0 a+ `8 k3 {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; e+ b! {& d7 r( |6 e* X& {0 f; U8 Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 k6 U: E9 b. o2 @/ L7 u! J- G+ p
  11. *         TO CHANGE.
    ' I* m$ w# k0 }; |& S+ R; W
  12. *
    ! H. k$ b" |$ ~1 q0 Y$ y4 P" k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- [" a0 f. A! b* G7 V1 a
  14. *1 q2 ]2 N/ \$ b4 H7 T
  15. * This program is free software; you can redistribute it and/or
    4 @# _4 K* ]0 F! x0 R9 I
  16. * modify it under the terms of the GNU General Public License as
    : k0 Z2 g& s! i- q. o  U' c' |
  17. * published by the Free Software Foundation version 2.
    ; L: B# \2 M8 J1 H* V( _
  18. *
    ) r* N+ I  V6 [! d' J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) y& M" e2 m. _' ^
  20. * kind, whether express or implied; without even the implied warranty
    ! l8 Y, r" A2 B7 K4 V  h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : W, {8 {& m2 L* H' I& x
  22. * GNU General Public License for more details.
    - Y# N2 C$ W8 I4 S" w
  23. */
    . K; ~$ g% `% \# n4 \5 t) [

  24. 0 o7 F  p& `* |0 A1 D; K3 `% C
  25. #include <linux/module.h>
    , p7 _7 ], R/ `( P/ r% {9 ]
  26. #include <linux/init.h>
    7 k5 E! L/ ^4 `3 p& r; M: D. ^
  27. #include <linux/errno.h>
    ) G$ u/ t; _/ s# G" G& U
  28. #include <linux/types.h>( Q. v+ h' I/ [8 u' |1 X4 n
  29. #include <linux/interrupt.h>
    0 S$ w9 c6 Z4 F4 Y- r; ^
  30. #include <asm/io.h>
    * h+ Z6 K+ C8 M6 U6 Z# C, I# x
  31. #include <linux/moduleparam.h>4 f5 N/ ?" S- J7 u
  32. #include <linux/sysctl.h>, D' u1 K7 F, [5 e5 [- U5 G
  33. #include <linux/mm.h>$ E+ x" ]4 A* N
  34. #include <linux/dma-mapping.h>+ k( X& x! v3 O, T( J; M

  35. + `' P7 r. i7 P- \: t, X5 z
  36. #include <mach/memory.h>* j2 Y7 g1 ^: m9 v$ {" W
  37. #include <mach/hardware.h>6 X, m3 \$ k; n+ N. o; Q
  38. #include <mach/irqs.h>
    7 F3 K: P' w1 C. Q, Q
  39. #include <asm/hardware/edma.h>
    7 i% v, K" [: m2 l& L0 Z
  40. 9 V; U# p: B9 Y8 f- e; k' w
  41. #undef EDMA3_DEBUG
    ; H; d& r- n3 S! \2 N
  42. /*#define EDMA3_DEBUG*/
    $ R$ s+ L- Z. W2 G

  43. % z: K; R6 B  _5 O6 s7 f+ h
  44. #ifdef EDMA3_DEBUG
    , k" u  E2 @. ]: }$ z/ b) A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 p) l& F# K( X5 t3 i5 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 L2 @  m6 L' J- _0 {/ {" r' z0 L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 n" s# R# J6 j4 H
  48. #else& h# i- z" x& u, W  m9 y0 ?
  49. #define DMA_PRINTK( x... )
      S, v( V2 T! p  l( i& Z
  50. #define DMA_FN_IN
    9 N6 w; W3 j/ F  T& r4 w0 i  B" ~
  51. #define DMA_FN_OUT
    7 s1 q9 Z* Y+ b
  52. #endif
    3 a& X) L8 D; n, f# @

  53. # _/ l; W3 t% z  O8 Q9 h8 M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 Z8 g' n% z% e' [6 `
  55. #define STATIC_SHIFT                3
    : I3 j5 n0 ?: ?0 k6 Q- v
  56. #define TCINTEN_SHIFT               20
    2 `; u  B: ]6 R" a4 W& g
  57. #define ITCINTEN_SHIFT              21
    * N5 C1 {* j+ m
  58. #define TCCHEN_SHIFT                22
    2 N! P1 W9 M- Z) J) `
  59. #define ITCCHEN_SHIFT               23
    ' Z6 v- v& c! E) S# V* \
  60. ( j$ ]4 W& j2 k- o2 }7 e, e
  61. static volatile int irqraised1 = 0;( L9 s/ C( _  v3 l& V
  62. static volatile int irqraised2 = 0;- V4 o; o8 R3 u. j' n5 F
  63. ! v2 b1 r! ~, n, g. y0 H& j" f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 a, M# I/ }" S! U) O- e/ [. h6 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + P/ a# z& G* C% ^- }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * }/ y$ ]" o" V

  67. . F. g. Q9 u8 n+ q( _  P
  68. dma_addr_t dmaphyssrc1 = 0;: f3 Y& h7 q: V
  69. dma_addr_t dmaphyssrc2 = 0;4 L7 ^0 U7 i0 _0 }8 O  z9 w
  70. dma_addr_t dmaphysdest1 = 0;* i) \! L5 @& K9 j/ N9 ^
  71. dma_addr_t dmaphysdest2 = 0;
    & i+ B! J: k0 x6 p' k. u0 V

  72. ) l+ c. p+ p" M+ n
  73. char *dmabufsrc1 = NULL;
    2 F4 ^) w! y% w# P" J- u, x% F
  74. char *dmabufsrc2 = NULL;* [- m6 T5 X; s- J1 q3 r
  75. char *dmabufdest1 = NULL;
    1 s$ N0 C* D- Z) q( f+ i& ^
  76. char *dmabufdest2 = NULL;
    3 Y8 a% M8 {# Y$ t8 n% M
  77. 1 P) I6 k/ i- t) N# F0 C
  78. static int acnt = 512;  r! }: Q) s' L0 {
  79. static int bcnt = 8;0 Y* f0 j% W" a. G( X
  80. static int ccnt = 8;
    " B9 M0 a9 q( v4 W
  81. # m  p1 A+ P1 S2 b: y- `+ l# C
  82. module_param(acnt, int, S_IRUGO);+ ?/ H' p/ B0 _3 h; {/ E, E! t
  83. module_param(bcnt, int, S_IRUGO);" c, w) n/ L- ]$ H* q' D0 }$ H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) i6 ^1 t  k! [
- h3 p& x9 L1 ?& D+ \4 Y- O! j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- r0 \3 e( d/ t. E  v9 Garm-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 b4 ]0 n- `9 e- Y8 U  U7 |7 m1 B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 S* O# g, q1 ?0 c* ]! C/ c: X* X8 g3 q

* ]2 g: n- S- A  j! I9 L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-21 05:12 , Processed in 0.045378 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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