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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; M7 L; G( z: ~, j/ n( o
  1. [code]EDMA sample test application: ?- q4 g: V8 q- M7 W2 z$ j
  2. /*0 j: u2 y1 B! Q0 H
  3. * edma_test.c
    0 {, @* p+ A5 |5 l. G
  4. *
    . x; v$ w& @$ q$ T, B$ s
  5. * brief  EDMA3 Test Application
    8 Z! V' z2 q* }8 _4 w5 Z
  6. *
    ' p0 b  A7 F0 \
  7. *   This file contains EDMA3 Test code., V6 x% k. U2 s$ h* u+ |. z
  8. *
    $ P" M0 X) K+ |! J' ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! K+ e* A: b# w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 @3 T1 `6 p9 Y1 U  r" I' u
  11. *         TO CHANGE.) y5 a1 E" Y8 @* y
  12. *
    + T' M0 n/ N* t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 z2 j4 U  B0 e2 Z4 h9 `# N
  14. *' @# {* e. x9 r( `" |6 O% J
  15. * This program is free software; you can redistribute it and/or
    / R. I  Z% M6 o1 J1 _) h
  16. * modify it under the terms of the GNU General Public License as
    . g0 I* f1 m' E0 _7 N7 T0 ^
  17. * published by the Free Software Foundation version 2.9 U) W  E/ |7 D0 K, z
  18. *  W" F7 L3 M$ I, C. ?5 ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 p0 a) Y& h) i
  20. * kind, whether express or implied; without even the implied warranty
    " i6 S& `* @$ n0 Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 {/ h2 t$ s# D; \
  22. * GNU General Public License for more details.
      X. Z2 w5 @, C, {+ Q9 \- l
  23. */
    5 q! @! {5 T. E
  24. 0 z2 \# C$ \9 n7 m+ V8 b
  25. #include <linux/module.h>
    & k# t0 i7 M+ o6 @3 ~
  26. #include <linux/init.h>' z- W) a! c6 ^. U8 b3 {* `0 t
  27. #include <linux/errno.h>
    / q$ U; l# W' c
  28. #include <linux/types.h>' e3 E9 p) a% u7 z1 k6 [$ B. K( M
  29. #include <linux/interrupt.h>2 ?$ \7 K8 ~/ S3 j
  30. #include <asm/io.h>
    8 u* {1 ]0 N# y; _. x. D6 b5 f' N
  31. #include <linux/moduleparam.h>
    2 r+ [' G# b! p9 x  y# r
  32. #include <linux/sysctl.h>9 O$ ]% V( |0 n; P7 }) u
  33. #include <linux/mm.h>
    4 `8 S. w7 G9 K* ]& s
  34. #include <linux/dma-mapping.h>) P& U6 m+ N% c' G1 L

  35. & Q( U6 h, {+ n" j' o# Y
  36. #include <mach/memory.h>
    # x1 `; j0 V2 G* k6 I+ n# u) x* }
  37. #include <mach/hardware.h>
    " x' d& h: @9 D( o: t( p) c! X
  38. #include <mach/irqs.h>
    * {/ f, d0 k* h" L+ f# ~& s
  39. #include <asm/hardware/edma.h>
    # x4 G+ ~7 k1 n, z8 k. K7 ~* O
  40. 4 g) C( t/ n  c8 Z. S
  41. #undef EDMA3_DEBUG2 o. K9 `  \/ K2 l
  42. /*#define EDMA3_DEBUG*/5 T1 G- r" w, j: h# `  g
  43. 0 |5 F# W- R: r; r5 i
  44. #ifdef EDMA3_DEBUG* m( F7 E) N+ P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  D, L# }+ Z  X- a; a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 O2 |/ h7 R) b( @% k8 M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ K) G% @2 T) v2 _( n2 u
  48. #else
    1 W9 F6 W/ u& U# V% Z( b- `9 d; w
  49. #define DMA_PRINTK( x... )
    , g) |- ?' a# I8 B1 e
  50. #define DMA_FN_IN: {" u) P8 C7 l9 f; T4 s1 ?2 H0 A+ Y5 A
  51. #define DMA_FN_OUT
    . A+ w% G2 d: o- W* U0 o
  52. #endif1 ]. V7 O3 i; ], B
  53. 0 a  h% M% c$ S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! s* k% `  Y/ b
  55. #define STATIC_SHIFT                3
    + |# ^. P1 I% _2 s. K3 M
  56. #define TCINTEN_SHIFT               20% F' I# w5 \# ~) C7 f
  57. #define ITCINTEN_SHIFT              21( h4 f8 K  x. w8 r& ~6 @% w* R
  58. #define TCCHEN_SHIFT                22
    . {5 B/ E! K: ^. y# C6 k
  59. #define ITCCHEN_SHIFT               23. |  o- p. q# q. d7 Z  C) E% i- k, E

  60. / E4 L- ]$ z7 k0 }3 ^
  61. static volatile int irqraised1 = 0;
    & F% D: M% A7 S4 A/ N0 g& ^
  62. static volatile int irqraised2 = 0;
    5 B, P* k( z5 j. O
  63.   H+ b4 D3 n7 W9 s$ k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 D9 Q* `& \% o2 T9 P5 v( H/ g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 P, l' C4 @: N; T3 o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 _0 D/ [! E9 H9 e5 _# H" j& Y
  67. 4 ]- Z4 M0 h$ u& n
  68. dma_addr_t dmaphyssrc1 = 0;
    4 r6 a& q, l# C# }0 x
  69. dma_addr_t dmaphyssrc2 = 0;2 z2 s3 Z) I1 V7 j6 {
  70. dma_addr_t dmaphysdest1 = 0;4 Y6 ~+ j, r) P. v; q
  71. dma_addr_t dmaphysdest2 = 0;
    # @, r' O5 W- w+ B
  72. 0 X( w' d1 |+ f; G
  73. char *dmabufsrc1 = NULL;
    5 o+ A3 V3 {/ Y  ^/ c. q
  74. char *dmabufsrc2 = NULL;- I/ V6 c" p0 d" Y3 M4 w0 u0 ?( S# ?
  75. char *dmabufdest1 = NULL;
    % ?% b  ]+ j$ B& X/ w, U
  76. char *dmabufdest2 = NULL;  M7 ~+ Q/ e. T1 g

  77. " x/ }7 z. F( Y
  78. static int acnt = 512;
    5 |6 e0 C5 T  C  M; m
  79. static int bcnt = 8;0 @2 B( \) `* k
  80. static int ccnt = 8;
    " N3 [) g2 f0 m  j8 U$ g# ~
  81. 3 X$ z7 H" z; x% w2 b8 ~1 }* A; ]1 \
  82. module_param(acnt, int, S_IRUGO);
    & Y* k: c( p  D4 }. ?. X8 o
  83. module_param(bcnt, int, S_IRUGO);
    ; P3 T& Q; H$ P" O+ n$ v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 ^+ M% q8 ^# m8 e% V7 f, w4 J
: ]8 B$ a6 n$ U9 n6 T
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# z- d. a+ C/ |  [" barm-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 u8 P! Y. ]( W& t+ H; n9 r2 y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 G9 R3 u* Y# C$ U* z0 k$ ]! X4 l

$ v2 A, I2 `; g  A8 k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-22 15:24 , Processed in 0.043879 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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