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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! f) T( j" o$ T! @- g
  1. [code]EDMA sample test application
    / ~0 B. ~" S+ z' o
  2. /*( a; s8 e9 ~8 r  V- q+ n+ i
  3. * edma_test.c* i0 ^/ z) h3 _: J* M* Q, i0 }
  4. *; I* }" [# U9 ?1 ^" `
  5. * brief  EDMA3 Test Application
    . I7 q* r/ `$ i) k+ T$ T
  6. *- @8 v3 y: p  V3 G& y" v* T1 p
  7. *   This file contains EDMA3 Test code.
    ; n, A( ?: t  \
  8. *
    + z0 C7 W- S! p3 ^1 a- W& ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& {- }9 d3 W* y! W- ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 F5 H+ q6 X) @7 {* d
  11. *         TO CHANGE.
    ' h8 ^6 n1 r: K2 f: A
  12. *
    ! m; I0 f* {$ a" M7 r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- H( K9 W! L* x  x, h' W5 M3 i
  14. *
    , E" H6 s6 T3 |5 {3 V8 [1 ]
  15. * This program is free software; you can redistribute it and/or9 Q2 _0 [8 B! u) r8 ^; V
  16. * modify it under the terms of the GNU General Public License as! Q8 u/ u, n1 H
  17. * published by the Free Software Foundation version 2.
    $ q9 J3 N0 ?$ f+ \* D: [! E; @: L
  18. *
    % H: k3 }7 \, @) |; |: E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) _* z0 `' x# @; B+ W
  20. * kind, whether express or implied; without even the implied warranty9 m, H5 E* T" @' I1 {3 n: i- ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, K- H) ~0 v- h. H5 q
  22. * GNU General Public License for more details.
    / P2 y+ f) y. g5 i' @
  23. */! r9 b( \  f; q1 J3 U

  24. 2 L6 \( J9 B$ D
  25. #include <linux/module.h>1 i2 W$ s: g# A2 }. i
  26. #include <linux/init.h>% h0 ~( r% S3 A  ~: J" m# o
  27. #include <linux/errno.h>
    ! M. G) X5 K1 U( G  n
  28. #include <linux/types.h>
    ( ]- w! h. ^* [8 o, T! p1 N) r
  29. #include <linux/interrupt.h>7 {% r& P3 x' w3 |3 f. Q
  30. #include <asm/io.h>
    " e. v* o- [! D+ O6 C" a
  31. #include <linux/moduleparam.h>
      O; o$ g- u# ]* L4 ]+ W5 Q
  32. #include <linux/sysctl.h>6 T6 M  r/ v2 a/ J' u
  33. #include <linux/mm.h>6 g9 L- p8 j& L$ y# Q6 o* M
  34. #include <linux/dma-mapping.h>
    4 C7 N6 u  c# r6 m, U' h
  35. 5 p5 X5 u: R5 I4 w2 M
  36. #include <mach/memory.h>" T) M7 h3 S" G/ A8 z1 P. G0 B
  37. #include <mach/hardware.h>3 D" S, \1 f" w- Z2 ^0 z0 I( o
  38. #include <mach/irqs.h>
    % F& p; O* u& A/ H0 Q
  39. #include <asm/hardware/edma.h>
    / i. f% I3 s9 J: o# V1 ]5 q0 W

  40. 6 c& d) k1 C& ?$ k
  41. #undef EDMA3_DEBUG1 `3 l" n/ e6 V! s1 t2 S1 G  [
  42. /*#define EDMA3_DEBUG*/
    ; d- g, f8 i6 y' ]! b
  43. " V% N; u4 g$ a- U
  44. #ifdef EDMA3_DEBUG7 V. i% Y) Z$ H1 J" b7 {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * Z( a4 `' w# P2 P$ o" d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 R  {1 b! |5 }2 j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ e% S$ Q3 }- ^3 q+ O
  48. #else
    . j% K  W: ]" ]
  49. #define DMA_PRINTK( x... )3 ~, t8 P# h6 \1 S5 V
  50. #define DMA_FN_IN
    ) y. p& o# y- Q
  51. #define DMA_FN_OUT
    4 n/ `; S/ g0 }3 ^! J7 f: k
  52. #endif
    ) G( R& u8 e$ _9 u2 p. I
  53. 9 H+ @. L. g& s7 s: Y$ E& |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 {# E; W2 c, ^' F
  55. #define STATIC_SHIFT                3
    $ I3 J4 M( U! N; d) l
  56. #define TCINTEN_SHIFT               20; }# M; w, l) M( f9 u; Q5 R
  57. #define ITCINTEN_SHIFT              21
    7 n6 n# |  o, V* \2 v6 D
  58. #define TCCHEN_SHIFT                22
    4 _1 W3 F0 g- ^: y3 f; _; C
  59. #define ITCCHEN_SHIFT               23! S7 ?6 w8 O/ K% }5 u& h

  60. 9 T: a" L5 X7 c# ~, R' Z3 y
  61. static volatile int irqraised1 = 0;
    3 w: C9 {5 l' p) B# {! G' S1 O* |2 z
  62. static volatile int irqraised2 = 0;
    / [" z! n- ]; o' M

  63. 4 k. l: m( Q4 J/ D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- l8 ]4 B8 a4 G; m( d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % u2 K( V# B0 @) q4 E! u! ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 |5 e* F2 i0 |5 A
  67. 0 d8 O0 s3 m1 F+ Q" o, ~# o
  68. dma_addr_t dmaphyssrc1 = 0;
    / i' I5 o/ D+ P' D/ f
  69. dma_addr_t dmaphyssrc2 = 0;
    6 p( V" G( ?# n2 F
  70. dma_addr_t dmaphysdest1 = 0;
    : a7 r# V- J" S. {. z( B3 n8 K
  71. dma_addr_t dmaphysdest2 = 0;/ p: A$ `# D/ }$ R$ L
  72. / v$ X3 `; y5 ~- F; H
  73. char *dmabufsrc1 = NULL;/ r7 |, F% D" }( m% V0 n* i9 \
  74. char *dmabufsrc2 = NULL;
    * G, X! Q" V  y/ v/ n
  75. char *dmabufdest1 = NULL;. L  s. h7 T( S" d
  76. char *dmabufdest2 = NULL;' L( s. N6 n+ \, P

  77.   k  k& Y  F2 B: S/ I+ j
  78. static int acnt = 512;2 P6 Q" U8 ^0 y3 E/ l& }
  79. static int bcnt = 8;
    ; b4 K. i4 A& C5 s  Z8 z
  80. static int ccnt = 8;
    9 {; [$ P3 E# q/ i, g) Z: c
  81. 9 B* m) y+ }- X5 H
  82. module_param(acnt, int, S_IRUGO);: g" Q$ Y! t& L8 M! H( U# Q
  83. module_param(bcnt, int, S_IRUGO);3 T* c6 x9 R- D/ r) B6 ]  O
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ y, _  c1 }  }6 f' o  E* k) J5 ~3 d* ]" n* w$ z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! |+ K1 }# b/ D: i  c2 J  p) Q; d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; ?/ u+ }: z! s6 |0 h0 k
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& f7 J* k, I% R. h
" y2 R* [' |9 t1 C# j. e' D4 h, l7 ?6 c8 N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 19:40 , Processed in 0.038768 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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