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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 o% q- ]8 ~& l3 |; L: K: U
  1. [code]EDMA sample test application
    % h+ r0 B0 ^: n' ?. t
  2. /*
    + ?0 H7 H0 Y& E' v" e5 P
  3. * edma_test.c6 p5 i1 ^1 v7 x: T. J! |
  4. *
    9 |" L; T2 ?$ w- R  F! M# l3 h5 K
  5. * brief  EDMA3 Test Application" E( W% ~2 W: e$ g& m- }; p2 T' ~/ x/ r
  6. *
      d4 V' ?2 e* z$ N
  7. *   This file contains EDMA3 Test code.
    + @$ K! ~0 {2 B
  8. *
    $ a/ {$ S$ X7 ~7 I9 g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      m, p! ?5 s' E& P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( M1 I8 ~  \9 ?/ Y1 p, U' F9 D
  11. *         TO CHANGE.
    8 G6 c3 v7 E! @/ k+ O0 e
  12. *8 U2 x8 {3 E& _' r" ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; q& S0 |) W+ \- n9 x
  14. *, q+ V' @" C8 X
  15. * This program is free software; you can redistribute it and/or
    8 ?; i9 s# i, t4 G' K; c
  16. * modify it under the terms of the GNU General Public License as% y1 I7 k7 _/ _% U2 |
  17. * published by the Free Software Foundation version 2.
    $ a% W8 V% _: y8 d2 E
  18. *# r% ?! e0 m0 Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . M! d, ^: b6 w4 _1 O
  20. * kind, whether express or implied; without even the implied warranty; B2 ?# v; N8 d" w& K" Q0 V; {2 M8 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 `0 H- o" X2 g, I* K3 |
  22. * GNU General Public License for more details.  N; V& u- ?9 i: T
  23. */' r& f' V$ t. h9 K, `

  24. ) g! W; c* @8 ~: u, g4 @: Z/ E
  25. #include <linux/module.h>1 E" u; z) [" H1 b8 S8 q
  26. #include <linux/init.h>
      R8 q* [  c) k% H+ u. S. L# N
  27. #include <linux/errno.h>0 Q" \* x8 Q) H9 o1 n) |
  28. #include <linux/types.h>
    ; `% L9 h" g& ^7 p
  29. #include <linux/interrupt.h>
    5 w* c# y6 A0 u
  30. #include <asm/io.h>
    : S( P4 J- ]3 l$ ^
  31. #include <linux/moduleparam.h>
    # [7 e& ~" k( b1 T
  32. #include <linux/sysctl.h>
    5 W2 `7 {4 j7 P: a8 ?
  33. #include <linux/mm.h>
    ! \! k3 E$ Y0 B" |+ j
  34. #include <linux/dma-mapping.h>7 A4 h1 G9 @: l% @( X9 H

  35. : [) b5 Y0 J* V6 \+ U( ~
  36. #include <mach/memory.h>
    # Z  }% h/ \, H
  37. #include <mach/hardware.h>" A. O' U6 N" F
  38. #include <mach/irqs.h>
    ) @* i9 u( s6 u  k6 h: x) E
  39. #include <asm/hardware/edma.h>
    5 D1 [% D( N4 N. i1 M4 {
  40. % X) k$ |$ b" f6 r; `; B' i
  41. #undef EDMA3_DEBUG
    9 e2 `# e- |5 ]3 c( ?1 h1 S
  42. /*#define EDMA3_DEBUG*/
    2 w  M; ?  `) S3 m" e

  43. 7 J; U" Z; V! P' |+ l; N1 j( B
  44. #ifdef EDMA3_DEBUG  `; M2 u( w1 C7 Y: D8 k/ q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # J  c% y6 n) T: D8 ]- `' H- {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% d: d) R& p. q+ C( Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ [" ?+ T9 b8 w' R
  48. #else
    ; J9 |# M0 A  f& _1 O: T$ t
  49. #define DMA_PRINTK( x... ); M; k7 w7 B. u1 t* m
  50. #define DMA_FN_IN' n, V2 M9 D6 d/ y
  51. #define DMA_FN_OUT
    * D8 p( _" ^. s7 O0 G
  52. #endif$ ]" [% T. I7 q4 U
  53. ! ]* A( F7 r  r$ X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* l, B! k: K3 g2 x) w% c* z% Q
  55. #define STATIC_SHIFT                3' T% C( @* A& r" ^' e
  56. #define TCINTEN_SHIFT               20
    7 G7 T- {: ?4 ?
  57. #define ITCINTEN_SHIFT              21* x5 b' U! e' r) d' Y7 W; J
  58. #define TCCHEN_SHIFT                223 ]. [8 _" Y7 \# q
  59. #define ITCCHEN_SHIFT               23
    + z5 C# l+ j) o1 V8 J
  60. 5 x3 @& v; F9 ~! E
  61. static volatile int irqraised1 = 0;
    & R# p0 ], W0 R3 t- z
  62. static volatile int irqraised2 = 0;7 W# Z, S. T- o9 s9 l7 z9 L1 X% Y* C$ W
  63. / X& n9 ]4 L  \: d( X/ `( |9 A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; |6 p' ~1 W. q8 a  \0 p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; @4 ~! i/ l1 f6 i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / ~7 U+ ~, V" k# o' j$ S

  67. ; R/ g$ u0 w8 O3 Y% Y8 W7 }
  68. dma_addr_t dmaphyssrc1 = 0;
    : S5 Q3 Q# Z. s
  69. dma_addr_t dmaphyssrc2 = 0;1 L6 c$ e1 G6 m- k9 M
  70. dma_addr_t dmaphysdest1 = 0;
    8 t  X0 `( m6 j( V+ P/ a( d" J+ C+ d
  71. dma_addr_t dmaphysdest2 = 0;& c: w6 \. Q! }, N/ |; ]7 L
  72. " D* q+ T" s6 Z5 I% g& b" u: @
  73. char *dmabufsrc1 = NULL;
    ! s& c. E* }4 {1 g7 c
  74. char *dmabufsrc2 = NULL;+ B/ t6 S/ l# e) v7 H
  75. char *dmabufdest1 = NULL;. Q* x! u% g9 Z0 g( D* g8 c, ^6 k3 ?
  76. char *dmabufdest2 = NULL;0 i" n% I: B4 V7 u3 N/ Q# H
  77.   J1 L: I  W9 p$ n" Z$ Y
  78. static int acnt = 512;
    " S/ `' v0 N) A6 L5 x
  79. static int bcnt = 8;
    & l0 z8 D! e7 `0 ~& l
  80. static int ccnt = 8;5 W- D2 A+ `/ W% |: ^% d

  81. + B2 I& U4 x, d6 \9 [6 s! M1 R1 b$ g
  82. module_param(acnt, int, S_IRUGO);
    6 ]1 j+ u% n- S' d$ k# E
  83. module_param(bcnt, int, S_IRUGO);, P! `7 u! w; {& g  \; A- x: U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# K2 D8 N; [# n/ ^. R4 Q' z
# O& e) U, o- _+ s6 G; v. w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: K& P( f# P! W: {/ i! Q& S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' G, `. B# v7 Q$ A' }1 [     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: X7 R$ l/ Z7 q4 e/ ^( A' T/ R: {/ {% K
' q: Y4 C, n1 G. e
+ x, H  \- r1 c8 K) V1 c1 f7 X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-28 13:44 , Processed in 0.039041 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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