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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " @* T$ S, H- _# a& z$ o4 S
  1. [code]EDMA sample test application& ^4 p0 b( T8 H; ]( ]% x9 v
  2. /*+ [# z' B( n+ {/ S
  3. * edma_test.c  ~# _, e/ B& ]: Q% K; W
  4. *
    3 n" A! C% ~7 A# @$ \; t+ r" P6 G
  5. * brief  EDMA3 Test Application
    5 E) ]( g' I3 `
  6. *
    9 h6 K7 ]' R0 n9 ^6 K" Z
  7. *   This file contains EDMA3 Test code.6 F- ]4 L4 @/ L+ e
  8. *
    4 a$ G7 n1 K, i( @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 F$ a8 m9 x. z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; g/ U/ A# j5 M# V: S+ `
  11. *         TO CHANGE.8 h0 A& e+ c* |: |' Y
  12. *) I& @0 w1 T# E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// W! K# Z) `; \" Y; Y5 x
  14. *# p1 y' P3 [4 I7 t
  15. * This program is free software; you can redistribute it and/or; |8 D4 h. P; o+ a, e, W
  16. * modify it under the terms of the GNU General Public License as
    2 z! ]! t0 Q) J" D/ o
  17. * published by the Free Software Foundation version 2.
    1 \% w! t% ^% O: f
  18. *
    : k8 \" [+ X; G' a+ p' S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 i/ G2 h/ {, T. Z3 M- J
  20. * kind, whether express or implied; without even the implied warranty1 |( s+ S( ^: p" w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) n+ _2 C- F1 v& \! ?
  22. * GNU General Public License for more details.
    6 P; B! I. J9 |9 w. C$ L
  23. */
    " q# v. ~/ ?* O! W

  24. 9 T4 ?6 M3 Y- P7 ~7 [" `2 T& [1 q
  25. #include <linux/module.h>
    7 w2 p, i- |/ I
  26. #include <linux/init.h>6 V, S  N" ~6 Z6 Z( W6 Y. u
  27. #include <linux/errno.h>
    8 E# f% e' L5 B. J6 E8 e
  28. #include <linux/types.h>
    ( x( A7 Y0 a/ p6 C
  29. #include <linux/interrupt.h>; H, |3 `' b* t  `3 s) X3 d
  30. #include <asm/io.h>$ G1 P6 e' C. X/ a( _' ~% f  `5 ?* D) v
  31. #include <linux/moduleparam.h>
    ( W  Q0 r$ [1 P- _4 W* G
  32. #include <linux/sysctl.h>
    4 ~: l% ~; _! k0 G2 o
  33. #include <linux/mm.h>
    + o; ^1 }& |& C: L; G6 h2 a
  34. #include <linux/dma-mapping.h># {. X# P1 y3 O! L/ ^  s
  35. 8 `% S% M  J. }
  36. #include <mach/memory.h>( J+ [4 P# e- w; ?) B4 W1 t
  37. #include <mach/hardware.h>
    * H6 `* w9 V/ b, w. t( A' t; G
  38. #include <mach/irqs.h>
    * o$ a* Z  x% J6 v& d5 S. n
  39. #include <asm/hardware/edma.h>4 e7 h- l2 u9 M

  40. - D$ {& L) U+ _: G
  41. #undef EDMA3_DEBUG
    . O- N2 q! W7 l6 m5 }. T
  42. /*#define EDMA3_DEBUG*/
    9 a# ?& J0 o$ t+ l% t& ]

  43. 9 f. E- @* a2 c1 X2 z
  44. #ifdef EDMA3_DEBUG
    $ M) @1 v. ?( G' D( z# X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* Y' X+ D, H, x4 \% h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      S/ E& E9 h, X4 Z' ^: b$ {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 m' n9 e3 a8 V  u. x, A
  48. #else
    , q, X/ s: @' K* Q+ X
  49. #define DMA_PRINTK( x... )7 F/ Z5 p, J& r0 k8 f4 q: [
  50. #define DMA_FN_IN; B3 C! K9 W" r; }
  51. #define DMA_FN_OUT' {1 B6 n" N$ v/ r
  52. #endif0 k. g, b% f8 ~( x3 i$ v

  53. 4 Z( r. u0 {* s- n2 i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 \* n/ c- i) ]  g6 R" O1 b
  55. #define STATIC_SHIFT                3
    8 c7 y& q6 N% V. |( Z4 E8 f8 I
  56. #define TCINTEN_SHIFT               20
    4 _4 U8 I* Y/ ^' X! K
  57. #define ITCINTEN_SHIFT              21
    . M1 z8 t, o1 n* ?- ~+ r3 x
  58. #define TCCHEN_SHIFT                22
    . R2 v, ?$ U4 d; R
  59. #define ITCCHEN_SHIFT               23
    4 }1 P- [, ]6 |8 x! f4 ~! K- s

  60. 5 ?9 X8 X) y* M0 i7 ~
  61. static volatile int irqraised1 = 0;5 A  U% V; w5 l, Y: x# f% `
  62. static volatile int irqraised2 = 0;+ l9 o4 Q  b& _8 h2 ~
  63. - I0 x& Y+ _; e4 {1 [7 r0 v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 h6 ^' C* F; H# r3 ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( K3 g2 D& n3 y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 R% C. p" D  E, O) x! _

  67. : l  W' J7 }9 G0 H! E
  68. dma_addr_t dmaphyssrc1 = 0;5 [( C, G; U( h  N+ C4 I/ [- W
  69. dma_addr_t dmaphyssrc2 = 0;& h8 n6 ^* s& p" j' ]) Q4 R8 M
  70. dma_addr_t dmaphysdest1 = 0;
    ) A! F5 H: x4 M' n' f
  71. dma_addr_t dmaphysdest2 = 0;4 X% S0 I2 C% g1 a' M6 P
  72. 0 o6 H" A+ l1 L6 J3 @; a3 N- T
  73. char *dmabufsrc1 = NULL;
    ) D4 E/ [- ^! U+ B
  74. char *dmabufsrc2 = NULL;0 M  }; B* }+ J; p5 e- z
  75. char *dmabufdest1 = NULL;
    & v$ s0 S4 N9 q
  76. char *dmabufdest2 = NULL;
    5 Y: c$ {- j* E7 }$ b, t* H
  77. 9 |9 \8 R. V9 F7 X6 ]. X
  78. static int acnt = 512;( q. X* C# c) o9 J' p
  79. static int bcnt = 8;  ]6 I0 s; W' v( U; r8 G8 ?" I
  80. static int ccnt = 8;
    ; L: V4 m: g, M, N2 `4 |2 T

  81. 7 K! x2 i4 ], X- j2 f7 w4 c' |
  82. module_param(acnt, int, S_IRUGO);8 F, e. H" F/ u6 ~
  83. module_param(bcnt, int, S_IRUGO);8 q( E* ^' X& E1 L- f+ ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 H, p3 i( x/ s3 {
4 I) [! S0 S4 q3 F% G- ~( V1 z8 V! ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 T  G' U/ k0 earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ f5 Y( g1 u) @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 w# T" B: T( ?; C! @* X( D
& @$ z8 E& a& U

  [2 W2 M4 H# r  }0 K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-25 18:16 , Processed in 0.040032 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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