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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 k/ Y' s7 T9 r7 ^
  1. [code]EDMA sample test application) o3 z4 b! H9 J: W. G
  2. /*6 {+ I2 e9 ~8 s! g* ~. U, O
  3. * edma_test.c
    & Y" z/ i4 i# l  k8 ]: X* B3 Q' Z6 w
  4. *
    + G' D; x( a- }, K6 S/ ]
  5. * brief  EDMA3 Test Application9 K8 f& N* B' ]; r5 I5 Q$ {2 y9 l- l
  6. *
    8 j! x  w3 F# _0 j
  7. *   This file contains EDMA3 Test code.# A, J7 Z& \! N# B+ H5 l
  8. *  p8 }( Z, H' d. P& _, g/ J# F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      _+ c3 d& i2 C9 y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ m3 T- y3 R. F4 E: f0 A
  11. *         TO CHANGE.
    3 R2 c/ ]7 F! v  y; M) g' H/ g
  12. *& H5 {* E+ ]" |& b' r" C8 s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 e3 ]/ {7 |6 x; u
  14. *5 V" S6 n& O0 V2 V% n' s7 ]
  15. * This program is free software; you can redistribute it and/or& v$ i( w+ o0 E  O) k0 ]- e
  16. * modify it under the terms of the GNU General Public License as% B/ Q- E6 ]# S7 h4 W: k# x* D' `
  17. * published by the Free Software Foundation version 2.
    4 L, z" O8 a3 X4 F
  18. *
    ( `; H2 D- I  @( P( ?; N/ [; S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' t- l; A) u6 L. Q( ~  u7 `) O0 O
  20. * kind, whether express or implied; without even the implied warranty
    # e0 F% {* g1 p/ O+ l6 ^- ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 a; G7 S! r( Z
  22. * GNU General Public License for more details.
    ' S* x8 A4 q# r. @
  23. */
    $ p6 E  L; Q+ o! `# [& o
  24. 8 a/ ~# l0 w9 O  c* t" q
  25. #include <linux/module.h>6 y# i( Q! _0 r; \, y( S' C/ @
  26. #include <linux/init.h>
    " V3 W. E! P2 r" v6 l3 g+ @
  27. #include <linux/errno.h>1 {7 r, L$ g2 Q! K; N/ o
  28. #include <linux/types.h>
    4 j8 i) s+ z; S) M& u
  29. #include <linux/interrupt.h>
    % l$ l: q, U3 W( Z" ]: y& X
  30. #include <asm/io.h>
    % T# h; M0 z9 T: u3 t5 u1 w
  31. #include <linux/moduleparam.h>
    4 g, n, v7 M: E) m  h
  32. #include <linux/sysctl.h>/ t9 s, }: d" ]# o  I2 B' |7 S' e  s
  33. #include <linux/mm.h>$ b- u0 U6 t) n# U- E4 T
  34. #include <linux/dma-mapping.h>
    0 m% e. R5 L1 e6 {6 m

  35. $ {) Q& ~# ?" _& B" g; _/ X. a
  36. #include <mach/memory.h>
    0 {: c8 c' z: x- I3 S$ W
  37. #include <mach/hardware.h>
    & {2 v$ r9 P- P( N/ I
  38. #include <mach/irqs.h>
    1 B2 ^8 Q# S, E2 m4 K( t
  39. #include <asm/hardware/edma.h>
    9 z" a6 o0 _+ Q  I4 K+ c$ K

  40. , }& w# C9 q& z) H; F) {& b
  41. #undef EDMA3_DEBUG
    ( O2 {& m; i+ Y6 q$ K/ U' g
  42. /*#define EDMA3_DEBUG*/2 X  Y; p9 ?. O3 s* r1 h0 j

  43. 3 }" K* k/ v' w% d
  44. #ifdef EDMA3_DEBUG
    ) {* U( a, [# ~4 o% B; n6 z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 m5 V) L2 o5 j" y- n( I0 w9 L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , l+ D& d' ^! `1 e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 x/ |. t% b  F; b: ]+ J1 Z
  48. #else" z- Z$ [$ K8 [* |& o$ D
  49. #define DMA_PRINTK( x... )
    7 n/ y/ C9 A/ g+ W* C) p4 a( n0 `
  50. #define DMA_FN_IN
      n" P- K7 p( }
  51. #define DMA_FN_OUT  m/ c2 R* D. E
  52. #endif0 a% M  [! C+ d) G1 _, Q
  53. 8 u) f, j2 S/ Z+ {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) `+ B6 h4 x$ n
  55. #define STATIC_SHIFT                3# Q9 x* {5 `& W1 r# Y
  56. #define TCINTEN_SHIFT               20* `7 n! i$ q$ }* U
  57. #define ITCINTEN_SHIFT              21
    , x1 R9 n7 G! y: @" V5 [
  58. #define TCCHEN_SHIFT                223 E" z' H. M" k* o5 j4 L, k# @
  59. #define ITCCHEN_SHIFT               23
    3 Q' B5 B) ?% X) c2 P# [' h4 N
  60. 6 j; x6 t" V. e6 B; o
  61. static volatile int irqraised1 = 0;$ g% T& C* n& u( w% P- ?/ h& w
  62. static volatile int irqraised2 = 0;7 p  g2 Y) X# P) [& p, I/ W- k

  63. 7 b8 K, @! K/ h7 E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 V9 `( I8 i% C  Q. z+ \) q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , @: Q0 y' m% ?( V$ E- T% a3 h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / u! p4 I' u* F( P

  67. 3 {+ k: C; n0 n, Y( [( Z( L
  68. dma_addr_t dmaphyssrc1 = 0;6 b8 G$ j. X/ N
  69. dma_addr_t dmaphyssrc2 = 0;
    5 C2 d" i6 O7 y4 n" `" A( h+ g  E
  70. dma_addr_t dmaphysdest1 = 0;4 i1 t. X' \# Q2 k1 Q8 v, c
  71. dma_addr_t dmaphysdest2 = 0;
    9 }$ g& n7 }' E8 ?; u6 g7 e
  72. 5 x8 M; T0 D1 k, F; v
  73. char *dmabufsrc1 = NULL;, @/ Y! Y) Z' i) t+ W
  74. char *dmabufsrc2 = NULL;
    " \& o$ _  [! g) i. G9 \9 a. ~
  75. char *dmabufdest1 = NULL;& G( |" N, G. P( x, E! k5 I
  76. char *dmabufdest2 = NULL;
    : t% p0 F7 i  q5 w. d- t6 t
  77. 3 J$ R; T3 E. T
  78. static int acnt = 512;
    ) d4 h# ~% y. y* G
  79. static int bcnt = 8;
    " p, v1 i. @/ U7 j
  80. static int ccnt = 8;
    5 V, d2 ?4 O4 ^- h& |

  81. , m/ u$ L) @. C7 l+ Y4 y  A- V0 M! Y
  82. module_param(acnt, int, S_IRUGO);: ]- s- l$ }2 v* s: b3 u% p* Y
  83. module_param(bcnt, int, S_IRUGO);5 w  j% x; W6 a+ m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 {! ^/ i5 s3 ]1 p
2 m4 ]  z9 m( [% m) G8 R; v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 w$ E* [7 Q: a$ k, varm-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 g1 w; l( Y; h) {8 e: u' r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) J; [3 N; L& H0 c
9 q# b' X! f- A, p

0 Z8 a7 O! g- m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-11 02:12 , Processed in 0.039528 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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