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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " I8 u; O: ~7 \, k. _& D- U2 O, Z
  1. [code]EDMA sample test application9 I$ m) ]7 z0 U8 u8 O  K( \
  2. /*! d* k! f, H( n2 e9 w7 @+ M
  3. * edma_test.c' }- @  P2 p% @" l& u* |
  4. *& b; z, O5 Q2 X9 r2 `3 L
  5. * brief  EDMA3 Test Application$ s8 U$ ^# v! l3 Q1 c  g
  6. *
    8 g+ o, Q. w8 O
  7. *   This file contains EDMA3 Test code.: F. [. k9 U" [* |, f
  8. *
    8 E- G3 t/ P" M) C$ A& j4 y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 A- b3 _3 B; k+ B$ O+ K# Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 K, T- n/ s/ S2 t8 ]2 u
  11. *         TO CHANGE.
    , H+ a7 w0 c/ s4 H
  12. *
    2 b) O& v8 r2 Z/ E* v" m5 _0 P- C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; I6 `( [( R% @; Z
  14. *
    ( \; A; E* {# ]0 F2 R; f/ K! i% N
  15. * This program is free software; you can redistribute it and/or7 A4 W* r' f2 [9 Y3 x
  16. * modify it under the terms of the GNU General Public License as  r% k$ N2 a; q* w2 Z  T% o1 z( s& X
  17. * published by the Free Software Foundation version 2.' r' V6 O. @' g( H1 U3 Z( w( P
  18. *8 u" f8 Q/ G6 C3 X2 S4 b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 q# T! M1 g, G/ C/ S
  20. * kind, whether express or implied; without even the implied warranty
    * t6 h- Y) O0 G; X8 O: M! Q7 p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 `( P' K' \) c! J( k5 f7 s, i/ \5 l
  22. * GNU General Public License for more details.1 Y( u2 t: Z! c+ q, T: `5 `/ Y
  23. */
    $ L$ C- p. J) ~9 V8 W- p: {
  24. ! W; h% O9 T% h: v$ N3 z+ c  n
  25. #include <linux/module.h>
    7 B( @6 O+ x2 e/ X8 v/ ~
  26. #include <linux/init.h>, B; N8 J) G  V. p' O
  27. #include <linux/errno.h>. G1 o5 l- D1 {( t3 [# Y
  28. #include <linux/types.h>
    ' B. e0 j# Z# T$ n& I& Z
  29. #include <linux/interrupt.h>! J  k* E! i5 o- n% S7 p" _4 W
  30. #include <asm/io.h>5 \7 o# e- A' t- H( F+ V5 x& t: Y
  31. #include <linux/moduleparam.h>
    ! {& u! T2 W8 y8 o3 t% @
  32. #include <linux/sysctl.h>
    # {4 M: q1 c* ?
  33. #include <linux/mm.h>
      o. P0 e4 H0 V* K$ x$ {/ N
  34. #include <linux/dma-mapping.h>
    ) t) g" G3 j9 D/ [  Z9 J+ W( G
  35. 9 |. \  e9 u" J0 A8 a8 N
  36. #include <mach/memory.h>9 G% H# l2 v% _* \4 z: N
  37. #include <mach/hardware.h>, }' S. E4 K, U4 q/ A: p
  38. #include <mach/irqs.h>
    7 F0 _- _* \* G+ G0 c
  39. #include <asm/hardware/edma.h>
    ' f. G( [; K. |4 v- n  f
  40. : A. ]  h3 b( u& }, m" Z
  41. #undef EDMA3_DEBUG2 B$ O! ]0 Y- g6 ~: ~5 F+ y
  42. /*#define EDMA3_DEBUG*/
    . G  {" x2 ^$ m( J8 Y- ]( z
  43. 5 L: h/ u% h6 S& r9 w9 L% ?; ~. ?
  44. #ifdef EDMA3_DEBUG
    ; ]) U3 r, h& {& ]  T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      {% o# i. d  @* L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * a% N4 w! V. ^, j* Z! t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 F1 W% B8 l* E
  48. #else: W& s- c6 ^1 N1 `# E
  49. #define DMA_PRINTK( x... )6 K5 r! q4 S7 P+ i1 N! p
  50. #define DMA_FN_IN
    : r/ }4 x! ]3 l  W2 Z1 }4 F) w. N) s  t6 A
  51. #define DMA_FN_OUT' M  \' j+ n, ^8 u9 b
  52. #endif
    + }) Q7 V8 U/ a: n- Y

  53. 1 I6 k/ h1 z$ ]0 o* h- r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) Z8 s: r6 M4 \2 }6 W  o
  55. #define STATIC_SHIFT                3
    8 G7 X4 W' o4 `* Y# @
  56. #define TCINTEN_SHIFT               207 c% _; l6 I: w; }1 C. h! M
  57. #define ITCINTEN_SHIFT              21' j5 r2 H% o- X6 u8 X
  58. #define TCCHEN_SHIFT                22
    ( F1 W. r0 t) ?8 }7 m
  59. #define ITCCHEN_SHIFT               23/ B* y- D8 w7 F7 y
  60. ! h: I2 p. G+ F) D' j
  61. static volatile int irqraised1 = 0;% g* D% `" K, x0 }; W% e1 T
  62. static volatile int irqraised2 = 0;
      t6 q/ [- |+ h

  63. 1 q. e1 o: E. ~9 D" a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 Q) v) |/ v( s. A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : k" D9 Y9 ~9 Z& V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  `& d4 b. u$ n0 M1 R+ @$ ~
  67. 3 I5 q3 ^* M+ h/ d2 k& a
  68. dma_addr_t dmaphyssrc1 = 0;1 f& K9 v% D" \% s1 h
  69. dma_addr_t dmaphyssrc2 = 0;, b  [  j& a6 W
  70. dma_addr_t dmaphysdest1 = 0;5 Y' G! |/ y" j8 x0 p7 \
  71. dma_addr_t dmaphysdest2 = 0;5 E5 Z7 f  A. [8 r6 q2 K5 l) x
  72. / ]" M; V: p# b* o" s' v+ e
  73. char *dmabufsrc1 = NULL;
    ( b& h# v' J8 N/ r
  74. char *dmabufsrc2 = NULL;
    # h6 D% X, J% R; \; b' N
  75. char *dmabufdest1 = NULL;" y2 t3 p. Y: J( J: I
  76. char *dmabufdest2 = NULL;& B' Q) F# E6 @7 H$ d
  77.   d3 I# K& x- V% e  x! C! q
  78. static int acnt = 512;
      {! \4 `. K( s( {
  79. static int bcnt = 8;+ E7 h$ T" i2 Y# k
  80. static int ccnt = 8;+ h; [2 ^, u( l& p, r: {% ]

  81. + I, j* C, a( w$ r" c+ U
  82. module_param(acnt, int, S_IRUGO);, G+ w  |) ?. Z0 C' F. E
  83. module_param(bcnt, int, S_IRUGO);. p% A  t$ j; z1 z' o" Q/ a1 o3 V
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 N, q) ^" Q" l% g0 t
8 u) o- P2 U$ J3 T9 k! p/ A5 N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ u1 |- }' N/ ?4 \7 g0 H6 k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 t8 M  @0 X6 c2 s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  w0 k8 X$ V. C& y) Q

7 P* i9 Q. M3 o* q. s% a* K0 P% \7 _1 k2 b. \& E+ T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 16:00 , Processed in 0.039380 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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