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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 m2 o  E+ m1 Y3 L1 i3 h
  1. [code]EDMA sample test application$ q9 a- E  o: @: a0 j8 q
  2. /*: x9 ~5 X8 ], B3 X/ w9 [* U" D
  3. * edma_test.c
    / L; E' {, m6 ~- H; t3 j
  4. *# R0 [! A, D3 a. X4 y4 |5 X% j. X: K6 J
  5. * brief  EDMA3 Test Application5 x& \/ L+ s0 M& @7 J4 J
  6. *
    ) D9 k$ K6 x! l9 {9 X9 @7 B
  7. *   This file contains EDMA3 Test code." Q$ ?. o! |) T
  8. *$ A$ P5 V! Z% g# g$ x6 m0 ~0 z4 a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& B! s9 b! ^% `% }& x1 \5 y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. \; @% h6 I2 w/ j. q) S. A
  11. *         TO CHANGE.% ~1 M2 Z7 O& k, Z4 e2 K3 t
  12. *
    ! z% s, I% o" l; p3 x: b: _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( ^, q8 p  T2 \7 u2 r/ c/ c
  14. *" u3 o5 E, M9 ^* J3 n4 E4 W/ K* ~
  15. * This program is free software; you can redistribute it and/or
    ) Y3 }3 K2 z  \4 Y) i9 Q- i
  16. * modify it under the terms of the GNU General Public License as1 h9 p. T9 D& o/ Z, ^- S
  17. * published by the Free Software Foundation version 2." r% Q0 X; V* Y+ A
  18. *
    " \' E+ L( }  j  o1 H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) k5 b8 d& ~. s
  20. * kind, whether express or implied; without even the implied warranty5 t# ], H  H' \; b" [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' G5 L1 A. P. a6 E* L" [
  22. * GNU General Public License for more details.
    4 K% o+ {3 z: f' I
  23. */# h9 H- e4 g  n3 f7 K% d
  24. 9 J) a: Q% h/ X+ W. [
  25. #include <linux/module.h>
    % u! k* q2 w  D3 e$ _2 Z% X6 Q
  26. #include <linux/init.h>/ K: ~) l. n: Z, a# a
  27. #include <linux/errno.h>
    2 T/ G; o6 n0 A/ U, S
  28. #include <linux/types.h>0 ]1 U9 t5 d3 P0 @  i' r8 p
  29. #include <linux/interrupt.h>
    & p2 y/ W$ T8 Y& ?
  30. #include <asm/io.h>: n. k+ S1 A$ d9 g7 P
  31. #include <linux/moduleparam.h>9 o. A' x1 J  ]' T
  32. #include <linux/sysctl.h>
    8 {, q# d( r  K/ F( [% T1 Y9 p
  33. #include <linux/mm.h>
    5 c' b2 Y  K5 I/ ?& |
  34. #include <linux/dma-mapping.h>
    ) h- I0 `0 }7 a0 ~

  35. & r. G3 P* M+ S1 K  g% D$ E. ]
  36. #include <mach/memory.h>
    4 T0 c% u& d! T3 x
  37. #include <mach/hardware.h>" z1 o/ R, C4 j& V. O/ t* y& `
  38. #include <mach/irqs.h>- J( A4 D$ `0 _
  39. #include <asm/hardware/edma.h>' f( ^: {# L1 a$ A
  40. 2 `2 D( S- ^, d8 F( v& h( _
  41. #undef EDMA3_DEBUG2 j) H. b0 }  p6 A1 q2 A
  42. /*#define EDMA3_DEBUG*/; b7 O0 z4 H# z- k) g$ ]

  43. ) `- a7 v7 m9 [0 u
  44. #ifdef EDMA3_DEBUG
    # r- K- d: Q7 x) R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 b  v$ A4 S  `5 Y; K. q: X& r& j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; o7 B& i0 N/ {& [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ J1 h! e2 j& _7 H, S
  48. #else
    ) V" {& H) ]$ t0 M/ V( X! s6 c0 Q9 d
  49. #define DMA_PRINTK( x... )2 |1 c$ Q- {4 q( u5 n& B
  50. #define DMA_FN_IN
    2 C4 T+ J3 g. x; p3 c- Z
  51. #define DMA_FN_OUT* x/ {" G- Q5 N+ h3 Y  s) k$ D8 ]+ U
  52. #endif* z- A+ l, t5 i: i" |8 {$ Y1 U
  53. : P4 ?0 F/ W2 W" }8 c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      y8 v' ]0 j3 S# b* y* ^
  55. #define STATIC_SHIFT                3  r, E  P# [- F+ m+ S! L- O( q+ i
  56. #define TCINTEN_SHIFT               20% B) k, Y: c$ y! _
  57. #define ITCINTEN_SHIFT              217 T  F( W  t% e2 E
  58. #define TCCHEN_SHIFT                22
    & Y& t7 k2 [  r6 Z
  59. #define ITCCHEN_SHIFT               23
    0 L8 ?8 g3 l0 }  W5 m- z3 @+ N6 e

  60. 3 ]3 m8 ^$ n9 I: w5 j5 y0 x
  61. static volatile int irqraised1 = 0;
    * r7 Y  x: y: U
  62. static volatile int irqraised2 = 0;" p, W$ v$ T& p. X1 ~: }8 k
  63. 9 B3 a% _2 l5 j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 w5 ^% k( l; z' I$ `+ e3 Z0 _# w1 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ k; \7 y  H. X5 m' J% }. P3 f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; X- h  v$ @; a4 F
  67. 0 _: E# c/ e/ J# b
  68. dma_addr_t dmaphyssrc1 = 0;; O% s4 @2 }: ?& h' B: F! j( I
  69. dma_addr_t dmaphyssrc2 = 0;
    * w' r  I  f$ O! m
  70. dma_addr_t dmaphysdest1 = 0;0 ?% a" }4 T0 W1 j
  71. dma_addr_t dmaphysdest2 = 0;, w  l7 V3 R1 g4 ~% R! P
  72. % g4 [8 a% A* X4 |& ]
  73. char *dmabufsrc1 = NULL;7 ~$ S4 j: f/ d+ u9 k
  74. char *dmabufsrc2 = NULL;9 ]1 F2 j2 ]/ H& u  @2 }9 s
  75. char *dmabufdest1 = NULL;
    * }* S4 s! W5 _  x( j) ~& t8 ~  Z
  76. char *dmabufdest2 = NULL;2 I" l& _, ?6 j. F- Q& u7 `* a# @, x1 }

  77. - V- v! N; z1 D/ V
  78. static int acnt = 512;
    0 @1 u7 A5 n+ r% }% G! _7 P' g
  79. static int bcnt = 8;% i+ r8 i5 b: [. T. ]
  80. static int ccnt = 8;9 j: m& c) R  d% a1 G5 K5 h" _* I' L

  81. 3 \6 a; C! |; _7 s6 i
  82. module_param(acnt, int, S_IRUGO);
    1 u( x* W3 H* a/ u
  83. module_param(bcnt, int, S_IRUGO);; S$ z, u9 K3 s- R1 ?9 v" _& r
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 k) P# W2 ]9 D6 p/ \$ j
* a, t3 x* B2 Z, P& q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( w+ ?( [+ w: i' M# 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( w( q' ]5 v; y# ^! }1 I4 \$ k
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 L7 q: w- J1 i6 n, q: P
* r. @2 ]  H8 C2 z+ G+ }& ^

4 l: Z' ?  m6 l& l3 L5 U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 07:25 , Processed in 0.038673 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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