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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ G4 F7 d1 J) h6 N
  1. [code]EDMA sample test application
    8 C- G; ~) d+ {) Q0 O4 i- C. I
  2. /*7 v7 c- |, |4 s1 I2 `" Q, \' X/ @
  3. * edma_test.c
    ) y5 [1 x0 d9 |! V2 v
  4. *
    6 O4 o# |6 G6 P  V7 w
  5. * brief  EDMA3 Test Application+ M3 N1 K4 C" u0 R. C( k
  6. *
    5 ~, x) O( Y1 m/ V4 ~  T
  7. *   This file contains EDMA3 Test code.6 |% M+ A' ~1 ]! s* b$ x, b* T
  8. *
    # ~, \9 m5 j7 L7 L" z1 G/ y' @1 M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - S0 O3 U. e3 e0 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 |# ^6 @! p8 o3 E5 F6 y* M) |
  11. *         TO CHANGE.+ x" Z6 ~% m. d2 N' J
  12. *
    % [$ b  J" O; W) N, O' j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / Z' e" K1 V. ^* J6 i- m1 q
  14. *
    # `+ d  G+ l7 W9 g9 V
  15. * This program is free software; you can redistribute it and/or% t2 @3 ~; Q) r4 n" q
  16. * modify it under the terms of the GNU General Public License as
    4 @3 r+ b. m, v* d7 E. V7 `+ M1 M2 Z' S
  17. * published by the Free Software Foundation version 2.& t% f6 f. C1 ^
  18. *( i1 R+ O/ K$ a7 G3 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # J. F0 \. s+ A* `! |: R& {5 u+ q* e
  20. * kind, whether express or implied; without even the implied warranty% f3 L2 C7 {5 q8 L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 u9 F' X, ]" A. a; v
  22. * GNU General Public License for more details.$ r# l" w; M, a4 Q7 A; f5 J
  23. */
    ; x4 s* _# V. y3 P$ w
  24. & \4 _: Q  g5 h$ @( J( i' x
  25. #include <linux/module.h>
    - y8 |4 ]2 x' r/ X% N6 s
  26. #include <linux/init.h>8 U3 r7 j8 f+ k$ D% g
  27. #include <linux/errno.h>
      t4 N3 S3 p, `# j& f
  28. #include <linux/types.h>: c5 H. g# U4 S5 V* f! o# K3 _
  29. #include <linux/interrupt.h>
    $ u3 \! R1 G/ J5 `
  30. #include <asm/io.h>9 ]; l  Y4 I, f; b7 j
  31. #include <linux/moduleparam.h>
    2 \$ Y9 L& x( W2 B8 ?4 G
  32. #include <linux/sysctl.h>- {* f: e$ Q( }- O0 @% [0 D
  33. #include <linux/mm.h>6 T" w1 a; T" \# J) v6 N* B
  34. #include <linux/dma-mapping.h>
    2 L& c* }0 G6 Z* T4 W3 t+ ]

  35. 8 \+ Y" i4 c) @% K  G! U; c
  36. #include <mach/memory.h>
    , m" }+ r+ G( O6 F$ z1 e
  37. #include <mach/hardware.h>
    * E* I; U0 }! x; T! D
  38. #include <mach/irqs.h>
    2 k0 ~2 Q* m( H5 D, i: \
  39. #include <asm/hardware/edma.h>) N. [" I" u+ r2 a* [# x

  40. * a0 [2 O, n% p" m' q. c  ~+ o
  41. #undef EDMA3_DEBUG5 c; `/ V9 q7 u' e9 c
  42. /*#define EDMA3_DEBUG*/
    % S6 d) U% ]5 F  H+ _0 Q
  43. 2 r) P, p/ ]% m4 _
  44. #ifdef EDMA3_DEBUG- N' @8 a: y2 f7 F7 l- `* K5 \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - t. Z$ d& U: i; o, S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " o5 r' l: _3 r. K( [2 D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! G9 G0 i$ w3 [2 j4 q9 u3 _
  48. #else
    4 N* {8 C6 R1 |8 [5 R: q
  49. #define DMA_PRINTK( x... )# q4 u6 ?" t  A' R) v0 X
  50. #define DMA_FN_IN
    + z+ b! ?( _5 S) O6 z+ u
  51. #define DMA_FN_OUT
    : D, k4 c: t& @; |2 q! E
  52. #endif
    7 \" `- U6 W0 n& q0 O+ S9 B

  53. 0 V% B* z3 f' S6 V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 v0 j2 |6 ~7 T' P
  55. #define STATIC_SHIFT                3
    & _1 \! R/ x3 P& z
  56. #define TCINTEN_SHIFT               20  T9 p; X- e, Z! i
  57. #define ITCINTEN_SHIFT              21
    0 N- H* u7 C( P. B& k/ P
  58. #define TCCHEN_SHIFT                224 v. `* X8 c1 D7 B! `/ e' o% l) U
  59. #define ITCCHEN_SHIFT               23  g9 e- ?, E- l

  60. . ~5 r% l, s- `  D
  61. static volatile int irqraised1 = 0;
    ! Z! A: n2 e0 p" w% J
  62. static volatile int irqraised2 = 0;
    2 Z2 ?# H  j* r/ t% B9 |- Y- B
  63. 6 B. Q3 m0 O( j: c' Q- b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- F# k* T1 I* |& O+ l* ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + r* W* d4 D2 G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. S: C6 a1 X; k7 A

  67. " H  A) a2 ?3 ?8 E, n, A
  68. dma_addr_t dmaphyssrc1 = 0;
    $ T8 i  d9 ?) O
  69. dma_addr_t dmaphyssrc2 = 0;
    - @" N% y( @2 m' r0 S9 t8 b9 h
  70. dma_addr_t dmaphysdest1 = 0;
    6 o: X" |+ g9 ?! g- I$ f+ Y$ x5 [
  71. dma_addr_t dmaphysdest2 = 0;! p, Y& _/ o+ ]* R' P

  72. & ]( i9 L5 F; {% G2 Y
  73. char *dmabufsrc1 = NULL;) n( y- r/ \* W
  74. char *dmabufsrc2 = NULL;$ L' R3 Z  k$ V' e/ q* y5 D
  75. char *dmabufdest1 = NULL;; v  T, H$ G, y2 n3 \
  76. char *dmabufdest2 = NULL;9 M) ~# h4 g( W7 s( C, k

  77. ! I8 t7 b# N: Q4 \; i. ]
  78. static int acnt = 512;- y% g4 _3 A/ P
  79. static int bcnt = 8;* C& Z5 M7 ^3 ]* n3 a
  80. static int ccnt = 8;2 A  y1 q0 G  s( s# S7 x

  81. ; D. ]; u: v1 t, [: O6 ?& }) }( p
  82. module_param(acnt, int, S_IRUGO);
    ' O% }) h0 m. ^- q4 ~
  83. module_param(bcnt, int, S_IRUGO);
    6 ^" ~, g: ?1 _  ]+ Z0 C4 K; t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! E1 s; @5 h5 Y" F) Q
. N$ i9 j7 X9 K4 ]% b( p  ^9 I9 H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" C0 D8 @$ w% |2 X# n- b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ L$ Q* b, ]4 O* f     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& ~! |7 f5 h! {
5 p1 C: j2 s+ l% T4 c6 s' ^5 p2 g! C7 m3 @& h" Y/ p! y% \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 01:17 , Processed in 0.039343 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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