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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * a% H2 m* m+ u/ i9 g
  1. [code]EDMA sample test application, {2 M& b. e. q; ?
  2. /*
    ) l. q, ?$ X2 L& i& G% x
  3. * edma_test.c
    4 X5 X% Z' I- u& U. a
  4. *8 @( z$ s7 T8 _5 [* C$ E
  5. * brief  EDMA3 Test Application* X) @/ g0 L' n0 w: A& \. _
  6. *1 v; `, D1 R' S* i2 G2 g7 ]! |0 y
  7. *   This file contains EDMA3 Test code.) l) ]: t' S% k
  8. *' T" @% B" n0 G$ I$ [; k, e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" B3 n  t% H7 L* i! R: D- n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % A: W; H# B9 _3 y$ o# V% o
  11. *         TO CHANGE.
    4 E+ f; |& g" c3 s3 i
  12. *
    4 ?3 l/ q) c* |; Y5 D! Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 f1 T- Z7 @6 Q9 e. h
  14. *
    / s9 f! n7 C2 H3 e: U
  15. * This program is free software; you can redistribute it and/or" M) b' L% j$ m+ b( @, W
  16. * modify it under the terms of the GNU General Public License as3 l) n6 Q  O5 t
  17. * published by the Free Software Foundation version 2.
    ( e: j9 h2 Z+ u( R5 u2 [
  18. *0 P% j9 s- i" T" W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! B3 h4 ^/ g$ w
  20. * kind, whether express or implied; without even the implied warranty' n/ g  ^, v- n+ R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . e- B0 s% H, S
  22. * GNU General Public License for more details.
    , D8 |2 l/ A% j4 A3 E+ n# C
  23. */% c4 K4 ^, m3 j3 h' W3 s
  24. " ^* Q% g) [4 Q. n  U9 p2 x; `- A
  25. #include <linux/module.h>
    8 d/ q5 p% [( ]* b# c
  26. #include <linux/init.h>( C8 i  M( z) P
  27. #include <linux/errno.h>
    # N  o0 l, i/ @8 U
  28. #include <linux/types.h>* O+ L7 @# e- x  [5 o! M
  29. #include <linux/interrupt.h>
    . j* m. S. }1 b, D% c0 Q/ z$ L
  30. #include <asm/io.h>, [% G7 \8 f7 i0 }, E$ D( k1 J
  31. #include <linux/moduleparam.h>' u4 k7 w. l$ t1 C. q. b  r$ S
  32. #include <linux/sysctl.h>9 t" U& ]7 K( w6 \- G
  33. #include <linux/mm.h>7 v" j/ b7 X, i0 F  S+ Y
  34. #include <linux/dma-mapping.h>6 L$ \! H- j5 Q9 a
  35. 6 b  G" k' h- T
  36. #include <mach/memory.h>2 S, N' D- {7 H1 I! |
  37. #include <mach/hardware.h>+ F- g3 W0 ]: |( n
  38. #include <mach/irqs.h>+ `( H6 I0 x. U( ~+ C( o0 s. f
  39. #include <asm/hardware/edma.h>
    . D! u: e6 L% L4 e$ Y. T6 Q

  40. - C& K5 I( j4 p9 t( e& O" m
  41. #undef EDMA3_DEBUG
    : q2 Z. S9 r) k& L# C0 f
  42. /*#define EDMA3_DEBUG*/
      z/ H& K$ r  r2 D1 W4 D$ F

  43. + i4 O7 }6 @, [
  44. #ifdef EDMA3_DEBUG1 z# X1 T4 X' D# M: B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) |2 @2 h0 J2 r; j+ g9 A4 B% l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 X4 [6 F! v0 h" O# x, z5 }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 g$ B  X* J! _3 M3 F. k" g
  48. #else+ x7 l8 ?" V7 R  p/ R: W# |4 r  R
  49. #define DMA_PRINTK( x... )
    , r0 j: V% c. K/ N) W  n: _
  50. #define DMA_FN_IN6 V/ O& `$ o& m
  51. #define DMA_FN_OUT
    6 q0 m( f2 s/ e2 Q5 g: z( j
  52. #endif9 ?* F( a# ]- V% ^' R. M6 q8 i

  53. # _- I9 V' w' v# y( N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): o1 u; r% c" m9 `. w1 C" ^
  55. #define STATIC_SHIFT                3
    7 [8 y1 B$ o8 m! K2 T/ E" }# _
  56. #define TCINTEN_SHIFT               20$ D& z( B! r+ d" L: r6 ?% ^
  57. #define ITCINTEN_SHIFT              21
    ( w7 K/ S  k  k3 s+ m
  58. #define TCCHEN_SHIFT                227 S5 h& K/ {  `6 J! A; H
  59. #define ITCCHEN_SHIFT               23  D1 i4 K. l: ~; Z

  60. 1 Q0 C4 K$ k. [2 |. }. E
  61. static volatile int irqraised1 = 0;- V& Z: ?7 T# o' }% I7 B$ s! M
  62. static volatile int irqraised2 = 0;6 @3 E/ Y0 x9 _8 U

  63. ; d5 a0 H+ H2 G( q% G6 Z  L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 W! [" N  f( r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - b& u+ D- W5 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) H: g8 [3 F# v2 W
  67. $ [+ P- S' L' j2 E; i' b+ s  x
  68. dma_addr_t dmaphyssrc1 = 0;8 r2 M/ Z! o; n) u
  69. dma_addr_t dmaphyssrc2 = 0;3 L$ C# I% e, S6 M6 v
  70. dma_addr_t dmaphysdest1 = 0;6 C+ [- {& V2 q( y
  71. dma_addr_t dmaphysdest2 = 0;. l' R9 e) }# t# \, F' ?; G0 @

  72. 5 q9 r- i* e+ N  W9 }) [
  73. char *dmabufsrc1 = NULL;
      H  W0 d  R  G8 _
  74. char *dmabufsrc2 = NULL;, o1 s2 c9 |# P" H& Q' g2 B$ p& h
  75. char *dmabufdest1 = NULL;
    , \/ N) U+ U  I* z9 L( t
  76. char *dmabufdest2 = NULL;
    , a6 |+ E' n% ]* v# Z' ^( F: N- d

  77. 4 Q9 z! P) J# \- H: E. C
  78. static int acnt = 512;( c' c4 K: V5 |8 D, J+ s
  79. static int bcnt = 8;1 O7 m/ s& H' C
  80. static int ccnt = 8;6 A8 O- \7 ~0 [4 O0 z

  81. * K7 y" t' J6 {5 T) B1 d5 M
  82. module_param(acnt, int, S_IRUGO);
    ! d& t; Y! U0 `; x1 b. J
  83. module_param(bcnt, int, S_IRUGO);
    2 `. j# c3 k( O: |5 L, G- v' _6 `# n& G% Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 w5 R7 U. b$ g2 }; G+ Z, k1 e
+ Z2 Y9 A% L1 B: ]8 ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ |( \( V7 u. u! ~/ }8 u2 z: `  i* ^8 b: o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, Z. }# h8 B# e5 g- u+ z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: b4 z7 o: c- J1 g2 e' }
. I2 T. U0 G* {2 P2 o) c5 B6 y
3 l& O( P, A' J1 ^9 Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-3 17:27 , Processed in 0.042473 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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