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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 o$ n# l: s, A# Y7 U" ~; e  g
  1. [code]EDMA sample test application" X, J0 |1 ~2 H/ e3 n* x
  2. /*
    ) V+ ^' a) O9 h5 L: p( _
  3. * edma_test.c+ Q) X' n9 _% ?4 x' E# Y" F4 {
  4. *( A$ l! @: e" m+ A* P; ]
  5. * brief  EDMA3 Test Application& d  c+ k# D( x; b+ q
  6. *
    4 K2 j) ~& c; W7 ~0 |+ o9 I
  7. *   This file contains EDMA3 Test code.
    2 E1 ^( ~& }, C1 j0 C2 ~7 z6 V2 p
  8. *8 F7 a2 ^. U: D& U4 G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * d9 E+ [5 `% @6 y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 ]6 f% ?; w# g! }; d- R
  11. *         TO CHANGE.
    * {" I" \, t* F! Y" f' J- y7 G
  12. *8 E' p6 ~/ e- H" C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 y9 Y$ b- p3 r  V# x0 W- Q
  14. *! \% n2 q( M+ {5 r9 G8 g( i
  15. * This program is free software; you can redistribute it and/or1 R2 ]) ]$ H. p5 {: n1 i* _
  16. * modify it under the terms of the GNU General Public License as( F7 k: U) h9 G3 Q) w
  17. * published by the Free Software Foundation version 2.7 }6 l) \$ n/ M, o5 V7 n
  18. *: p2 f( o7 D0 h. o; t$ s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 P+ G  E+ v! o6 M% p3 R+ z
  20. * kind, whether express or implied; without even the implied warranty
      x3 _% `; Q( e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      L, v$ S. i; ?- i2 b  d2 J# L" J
  22. * GNU General Public License for more details.
    ! n* g0 g6 e% m+ R$ [) h# }
  23. */
    3 ]9 c; @* U0 O% y) }
  24. - o1 t( j! ~1 u2 R0 G* c7 _# x! m
  25. #include <linux/module.h>0 t6 m* r2 o5 i) f' j" E, M7 K0 \% O
  26. #include <linux/init.h>* C% c- W. \; n  _
  27. #include <linux/errno.h>* L- P5 w3 E( J6 |, N
  28. #include <linux/types.h>) ]9 s" J7 R$ x, k% V# y
  29. #include <linux/interrupt.h>
    ; A2 [& t8 |8 G1 i6 D# u, ~) {; p
  30. #include <asm/io.h>
    $ F2 o" R  n3 G+ ?7 }; s' n
  31. #include <linux/moduleparam.h>
    ' |- O  @: t3 \. k: c) p
  32. #include <linux/sysctl.h>
    5 N! P, n, e9 L, v5 g9 A( E
  33. #include <linux/mm.h>
    0 x% z- ~! j+ ~) N' v
  34. #include <linux/dma-mapping.h>2 }6 `; g+ Z+ z. B: n

  35. : q8 x% M0 I! X3 W0 S) }/ L$ Q
  36. #include <mach/memory.h>0 c# S) t' `) T
  37. #include <mach/hardware.h>
    3 Q1 T: R, s/ R8 [& t. S: \+ ~1 x
  38. #include <mach/irqs.h>
    9 V9 |( u9 P6 b, V* J6 p
  39. #include <asm/hardware/edma.h>+ h, W% u& T# H$ Y8 `6 z* J" i  B
  40. ! z6 u" W0 N5 d7 m0 d# p
  41. #undef EDMA3_DEBUG
    / a. _- L* j. t3 I
  42. /*#define EDMA3_DEBUG*/; ^& N6 e4 e! G1 |2 F; S3 s

  43. 3 u& C- }6 n: t. C( T5 C; Q, C
  44. #ifdef EDMA3_DEBUG
    9 ~% g4 ]8 z/ h# F4 [0 G1 t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 Y+ C% K9 \8 x8 v6 R& `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 c, a1 V: A! c2 b' T/ [8 Z( n* y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" Y  H# H7 C$ D& ~% O4 z" ?
  48. #else
    $ ?4 y& U8 G) C0 b! \; N) _
  49. #define DMA_PRINTK( x... )4 Z3 v. c9 T' R9 U- q
  50. #define DMA_FN_IN* Y& ?7 r6 _* C3 [& `% ~0 `
  51. #define DMA_FN_OUT# F7 e9 \' S. n  U- j
  52. #endif7 i' }2 q2 R/ p) [, a

  53. / o/ ~8 K0 F) [% Y# ]( T2 R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 H3 Q  ^8 v' }8 V
  55. #define STATIC_SHIFT                3* q8 P' |/ Y+ J7 `; F; v: N" k, D
  56. #define TCINTEN_SHIFT               20
    * z0 |, G5 N% q, g' T  z/ z
  57. #define ITCINTEN_SHIFT              215 [+ q* r" u+ e
  58. #define TCCHEN_SHIFT                22
    % F- z6 _+ q/ Q( Y
  59. #define ITCCHEN_SHIFT               23
    8 w7 O; D. r8 a5 b
  60. 0 Y/ c/ d2 a: T+ C1 F6 m
  61. static volatile int irqraised1 = 0;7 j2 s0 ^3 \" w: a
  62. static volatile int irqraised2 = 0;
    1 }  ?" ]# a) J, D5 }. S, Z, P

  63. 6 T5 b8 @9 b, E) F% A/ y* j8 N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " \2 k8 X! v( r. _8 {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 P7 s# W$ p' e4 P3 j' s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 C# {: x) Y1 K5 G$ d& X. p) m
  67. + M9 B! z, U+ P% C8 G+ k! C
  68. dma_addr_t dmaphyssrc1 = 0;
    ! Y. ]# P+ I! K) {3 w! f0 r
  69. dma_addr_t dmaphyssrc2 = 0;
    0 d/ e& ]. q% m( U9 m1 E9 k
  70. dma_addr_t dmaphysdest1 = 0;
    # O  B( }, V0 d. l1 B  m
  71. dma_addr_t dmaphysdest2 = 0;2 }& k$ A0 ?7 f: g6 R# d

  72. 3 `* P2 L% O) h# [
  73. char *dmabufsrc1 = NULL;
    - @' P6 @0 g( \6 K
  74. char *dmabufsrc2 = NULL;
    $ H0 u1 `1 V& F( D  [# U+ V
  75. char *dmabufdest1 = NULL;
    & u8 u! r- T0 i  X. W; n
  76. char *dmabufdest2 = NULL;0 i/ O6 A( x4 e4 a, ?
  77. 3 O, s3 D" I3 I0 k
  78. static int acnt = 512;
    ' o) V; Z6 ~9 y5 b. N( U. \
  79. static int bcnt = 8;2 _% g8 T9 l$ Y( f: T( q
  80. static int ccnt = 8;* b  ~( A! v7 u- g$ h+ ~/ c5 a
  81. ! t: K! ^3 e: d
  82. module_param(acnt, int, S_IRUGO);) m4 _4 z2 y& p9 n. C5 t) g
  83. module_param(bcnt, int, S_IRUGO);
    9 e8 D1 I! A! Y0 ]5 F. H
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, N- e7 w- F! r) ]& [, N7 q8 t
; {- k) L% @3 N7 u4 d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  r6 v& Z3 M( h& \/ X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" ?. \+ a. z1 ]- [- }, \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. B# C0 K- Y+ w0 D* d0 w. Q) p, v/ z
0 U/ P! [' ~7 w% o/ {" i& |( F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-2 13:46 , Processed in 0.039065 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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