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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - x6 l1 ]6 _3 b) g, K1 a/ S7 s
  1. [code]EDMA sample test application- X2 v$ I* |& u) M
  2. /*( d6 M0 |) D6 v/ z
  3. * edma_test.c# ^& Q7 V. E; o" n7 k7 [6 p1 }
  4. *% P3 U* N! w4 K. W
  5. * brief  EDMA3 Test Application5 r6 z  m5 [4 o; u: C* [
  6. *8 C+ G! ?5 h3 `: _" C6 ]  H
  7. *   This file contains EDMA3 Test code.+ P; {# Z- I' n& W
  8. *
    % R/ l  s; T8 l# Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 E2 c3 c- Z1 O8 ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 N9 D" r5 t! e0 _! U
  11. *         TO CHANGE.
    + }, |% F" |1 ~
  12. *- z( J% A4 Q2 \9 ~) s' }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 Y4 `0 Q% x- a4 `
  14. */ l! f% L9 w6 Q4 ~' [8 j
  15. * This program is free software; you can redistribute it and/or
    + u% S+ p! S* S6 F( S2 T2 |
  16. * modify it under the terms of the GNU General Public License as
    " a" R5 G$ U, X& ]2 ^7 ~- s
  17. * published by the Free Software Foundation version 2.
    3 o* z, ]2 y' u3 e' }
  18. *
    ! U' K' s$ L( i# ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 {$ R" W4 O( P8 n7 G' [
  20. * kind, whether express or implied; without even the implied warranty8 S8 h. |! S( A' j( w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * T' p  D& k: x' m
  22. * GNU General Public License for more details.7 M% L& T- ]% I, G3 F
  23. */+ z/ d/ Q0 J4 a- N
  24. 8 @, F8 w$ P1 }: o
  25. #include <linux/module.h>
    ( B$ Q# s! B+ q! R2 `0 \& S) m
  26. #include <linux/init.h>
    / `; Z/ A' D: Y2 ^2 Q
  27. #include <linux/errno.h>
    4 k: @. C/ t% F
  28. #include <linux/types.h>/ [1 A9 [$ g+ J) H/ p1 D: M/ w
  29. #include <linux/interrupt.h>
    ; u0 c! }6 i( f! C, T, T
  30. #include <asm/io.h>9 B) W3 n; u! V0 o7 l7 l
  31. #include <linux/moduleparam.h>
    & ]0 }0 t& U, [! l( y( b
  32. #include <linux/sysctl.h>
    " R% }; @  l9 z; f2 v" U
  33. #include <linux/mm.h>
    - m4 d- h. a1 ~0 h/ w/ L
  34. #include <linux/dma-mapping.h>' t1 T( X: ^  u. o& u; Y, y0 ~

  35. 1 e3 A+ `: h. W# Z- r7 ]/ A
  36. #include <mach/memory.h>
    # \& S( H2 i4 n$ }" t) x! [
  37. #include <mach/hardware.h># x: R- n" [7 z. v9 D% b- A
  38. #include <mach/irqs.h>
      B: y% a% ], H2 D$ v6 H( }9 U8 H/ O
  39. #include <asm/hardware/edma.h>
    6 A3 h# Y6 [) ?" _1 `6 y1 p

  40. % W; r9 P- B7 D% h% H
  41. #undef EDMA3_DEBUG+ T" W9 C' ^, I; f7 @9 ^9 [' o
  42. /*#define EDMA3_DEBUG*/' d3 G1 Y% a! [; R6 Z$ U
  43. 5 u: W6 v: N* y* x! Z
  44. #ifdef EDMA3_DEBUG: b; O# v+ _* X. ^/ V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " ^$ L( ?6 [6 U( [5 h1 c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ Q$ n+ y, L8 b) S4 J9 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ Q3 s. [, T3 |, y
  48. #else. V/ a6 C7 m6 `3 e% ?3 f
  49. #define DMA_PRINTK( x... )
    ! V! }6 ~4 @  m3 H5 p& q
  50. #define DMA_FN_IN$ R; t' Y8 o% B, O
  51. #define DMA_FN_OUT$ R7 ~. {8 q" J+ V; P+ v
  52. #endif/ D' ?9 N4 ^" N8 B; V
  53. ( o3 y5 r4 ^5 M5 K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# j* d$ n+ @: v8 K% B! X
  55. #define STATIC_SHIFT                3
    + T2 z2 `/ `, V! Y) [; }7 b6 p
  56. #define TCINTEN_SHIFT               20
    ! ~" h: H* i" ]+ n: Z0 q: x3 s+ z
  57. #define ITCINTEN_SHIFT              21# U1 W" f1 @- C/ L% W
  58. #define TCCHEN_SHIFT                22) T" L9 F# _6 y. \: L2 n
  59. #define ITCCHEN_SHIFT               23
    1 x: F1 E  \7 d7 q

  60. 2 z1 {& F' _6 p! I& p& s$ d4 D
  61. static volatile int irqraised1 = 0;3 e- E7 B% ^! X
  62. static volatile int irqraised2 = 0;
    & N" l% Y  m$ W! T2 D5 S$ c

  63. 7 R  B' x9 h4 t7 L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' s& I( b0 Y7 P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 b( G( p" o5 x+ p$ B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; l! C% w$ {" [' f

  67.   Q( B& P2 Q( o
  68. dma_addr_t dmaphyssrc1 = 0;
    , e& J6 i! r4 e' \+ z" s+ g) h
  69. dma_addr_t dmaphyssrc2 = 0;$ n% k' J* f& F! x5 k3 h
  70. dma_addr_t dmaphysdest1 = 0;% T7 q6 N9 q0 D! B" F  U( U
  71. dma_addr_t dmaphysdest2 = 0;
    ; {' g; {4 H; T+ {: w% {% R

  72.   G6 c+ I) p: T, N/ H5 d  S5 E
  73. char *dmabufsrc1 = NULL;3 n8 S2 X) E8 ]5 r! a+ I
  74. char *dmabufsrc2 = NULL;
    . U& m: L% x1 x) [; s( F; x6 N4 M
  75. char *dmabufdest1 = NULL;: d! e0 q+ C/ V
  76. char *dmabufdest2 = NULL;7 t# b0 P. e* `! j
  77. ' ~; Q4 a7 \/ \% n
  78. static int acnt = 512;) |% L1 G" x5 s
  79. static int bcnt = 8;
    5 j- `, p/ X/ R* k  X
  80. static int ccnt = 8;" z$ A( n% |; Q

  81. * k. Y) q# a# l0 T, `7 n# ^3 h
  82. module_param(acnt, int, S_IRUGO);8 y) ]  ]3 B+ J" j2 j
  83. module_param(bcnt, int, S_IRUGO);
    4 @) E4 C# m) O1 n+ n6 A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 I, B" w0 N7 f1 K) z/ O& x

6 C2 l0 g" m% V      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ S  F4 Q5 H1 E0 W4 Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 y) p" Z( m% X) g" s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ }* ^+ a( E* G. E/ k: _  h* k; Q) t2 ?& l: {
) k+ {5 A3 c1 h; d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-20 17:27 , Processed in 0.050375 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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