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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 d. P# u& E% P! t7 N
  1. [code]EDMA sample test application
    , M2 h( O0 Z# }% Y) c/ u
  2. /*
    2 P% K9 W# e% A
  3. * edma_test.c$ ]: ?! e- P& {, P. C' N# E  R
  4. *
    # |# E. D& y. ~6 e! l  [
  5. * brief  EDMA3 Test Application
    3 B+ D# l* z+ V/ n( w; o7 x2 L! i
  6. *
    ( Y# r$ C2 k: @  e
  7. *   This file contains EDMA3 Test code.
    2 E( Z1 o% }6 {! L& S' i" v$ f
  8. *. |% D0 y+ |2 h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; y. D1 M0 a% M3 s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 Y( ]# F5 ?# Z
  11. *         TO CHANGE.* S0 d6 A3 [  A, H1 G  T  ^
  12. *2 J+ _. V* c+ [3 w1 a6 W7 }4 J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 `/ D' D, ~. Y! c, h
  14. *2 A% q, g& d8 D, i" g4 D* t* G
  15. * This program is free software; you can redistribute it and/or
    ( n5 q6 R) @: ~& d" h7 Q
  16. * modify it under the terms of the GNU General Public License as5 o. o0 K& J; M; a8 r3 i& \
  17. * published by the Free Software Foundation version 2.
    % B5 l2 v; }3 w
  18. *
    " [7 L2 a1 Z2 c3 @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 O8 r* _; a1 W
  20. * kind, whether express or implied; without even the implied warranty
      e$ c2 [0 n. {  Z& E! r4 F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . V$ _! A: ~  B: L% V
  22. * GNU General Public License for more details.
    ! E% I1 }5 p2 c# G7 |$ G
  23. */
    8 b  W5 o9 {9 E0 ~6 C/ ~( z6 _# D

  24. : D3 I. w  b1 u9 c& J  K9 A
  25. #include <linux/module.h>& s! \2 S3 L' J- ~! p  I9 e% r
  26. #include <linux/init.h># `) ?1 J0 @/ j% s5 \, C
  27. #include <linux/errno.h>& u# M( P' k9 s  D! o, Q
  28. #include <linux/types.h>
    7 z* J, o6 y4 v# q- I
  29. #include <linux/interrupt.h>
    5 V# T' J! K/ t9 q  f
  30. #include <asm/io.h>
    4 x  l+ W, z+ f9 m( Z7 L6 U! c
  31. #include <linux/moduleparam.h>+ {/ u8 v8 M/ y6 R& t
  32. #include <linux/sysctl.h>
    - }" ?# q! O/ A: d
  33. #include <linux/mm.h>
    - }( ^1 M8 \0 _- h
  34. #include <linux/dma-mapping.h>4 a! K7 h$ j1 H2 j9 D0 J

  35. ; e/ P! N7 b  H/ s
  36. #include <mach/memory.h>
    8 {- s) o' r% j4 E$ S' B
  37. #include <mach/hardware.h>* l5 B0 C6 W' n! _3 K
  38. #include <mach/irqs.h>, y. p$ t5 g- f6 O* a9 A8 S
  39. #include <asm/hardware/edma.h>  @0 S- t+ ]* U2 s. G
  40. ( Y( E) X) Q) d7 q
  41. #undef EDMA3_DEBUG
    - N" o; K. V. e
  42. /*#define EDMA3_DEBUG*/! N; y/ v, f' i9 B
  43. ) {% H. T% Z6 Y" }
  44. #ifdef EDMA3_DEBUG3 B9 u! B0 ?- h* d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' P' }) Q7 `: R* O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      j- G* U5 a- l/ p. n2 L/ j5 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 f6 I+ C# T$ v
  48. #else
    $ X+ A9 W, x0 q: S
  49. #define DMA_PRINTK( x... )$ q2 s1 C; l- t; T# U
  50. #define DMA_FN_IN
    : W, i4 U6 |1 I/ `1 N2 V
  51. #define DMA_FN_OUT" B: I3 L& j2 U$ S
  52. #endif
    8 P2 E- N0 Q- A& k
  53. 9 H& A0 Z5 S) {3 g% n6 O" @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" A2 c7 u, Q# m2 F3 U
  55. #define STATIC_SHIFT                3
    8 i0 ^) u7 G& g6 a4 E$ o5 L
  56. #define TCINTEN_SHIFT               20
    . N9 a# ]* d1 m" A# d) K7 t. @5 H
  57. #define ITCINTEN_SHIFT              21
    ; `( J% K( L" h* f) w1 V3 j) X
  58. #define TCCHEN_SHIFT                22
    4 S- M2 a# \" b& r, ]
  59. #define ITCCHEN_SHIFT               238 w3 G% S4 y& q: q$ w( V- s; b

  60. 2 B$ u$ v! h7 R1 M+ y
  61. static volatile int irqraised1 = 0;& w- G4 U# V9 u7 q# {( N. i
  62. static volatile int irqraised2 = 0;0 \  `' J* ~  i  P5 z

  63. 0 @0 ~1 ~, W) F. @9 H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 @: ^6 K! G4 s3 u6 p6 ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 \. N& f: Z( g6 q0 }9 p; s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      ~( f, e  S: B% q1 O7 V7 t+ |
  67. ) T* w& G3 H2 X8 d# ~' D1 w4 j
  68. dma_addr_t dmaphyssrc1 = 0;' _6 x" P" i& C( `1 C& O
  69. dma_addr_t dmaphyssrc2 = 0;
    ! ~- K- p! _7 W# h$ @  _& I$ r
  70. dma_addr_t dmaphysdest1 = 0;4 a5 k  h+ W' V# r; }
  71. dma_addr_t dmaphysdest2 = 0;! `3 W% z& C! o8 S
  72. 4 U! Y* I# z% p  }6 j. B/ ?: L
  73. char *dmabufsrc1 = NULL;# G: `- N4 l$ }& l: e4 q- e, E: O3 {
  74. char *dmabufsrc2 = NULL;/ D$ j$ g4 P) p1 w
  75. char *dmabufdest1 = NULL;9 e9 t( ?# |2 y! O" N& d
  76. char *dmabufdest2 = NULL;; A8 F- N: K7 o9 G. j% y

  77.   q0 G4 x. U1 o' A5 W) k$ U
  78. static int acnt = 512;
    4 |$ R8 f- r% H2 e5 u" E
  79. static int bcnt = 8;
    ) n' n+ Z2 n  e2 x
  80. static int ccnt = 8;, |7 p! W% z& ?4 p7 l8 p  A

  81. - n/ g$ W: c6 k. D
  82. module_param(acnt, int, S_IRUGO);! P8 H7 x6 C& m8 \2 O2 t! t& g7 I
  83. module_param(bcnt, int, S_IRUGO);
    9 l- Y0 O3 z3 G6 c9 t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# x! `0 b# C+ V2 V

7 x; k1 K0 m7 n, K8 x- i! a, L. S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& r* I. {- i! C* @8 Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 q2 r5 F5 c& @7 K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" b) p& X& i& U; I1 O
9 u) H$ ?  e: X4 V! \/ |; G- O+ ^# |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-5 17:08 , Processed in 0.038002 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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