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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 @8 k, n7 b4 n' T: Q" w
  1. [code]EDMA sample test application: G3 |+ c  w& y0 [- K1 Q% [# O
  2. /*
    2 @$ R( D6 Z0 Y9 a& ]1 E- @
  3. * edma_test.c
    8 e2 t, }' T/ d& V9 |' [8 i
  4. *
    1 m$ H; e$ w( y2 ?) I' ^2 C
  5. * brief  EDMA3 Test Application( i! ~4 i7 l3 s) O+ m9 N7 b
  6. *
    + U  a7 g" t0 y* K8 n0 q8 V
  7. *   This file contains EDMA3 Test code.
    : A& k8 j* _& j, g  K$ W" W
  8. *
    1 q) S9 n0 k4 a# E" m  A; J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 H7 M( B2 k) U9 g7 v8 d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 X( \8 k4 }: F. N0 j: H3 J. L/ Y& ^
  11. *         TO CHANGE.8 i4 Q; j- L! P& F
  12. *9 l% p0 p" a5 w5 d5 H; i( z0 Z% }, h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) x7 Y( e' Y) M9 R1 ^- {
  14. *
    3 D1 o1 y  X" w# X% A8 b% P
  15. * This program is free software; you can redistribute it and/or5 x: g3 ~3 M8 `3 b: ^
  16. * modify it under the terms of the GNU General Public License as
    . \2 F7 o  n# Q4 y9 u% |  S
  17. * published by the Free Software Foundation version 2.
    ! x: Z/ R. W: y4 A- F, ~6 M5 [9 r+ b
  18. */ p6 B6 V$ E( j+ z! M2 w! i+ |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 Q+ {- {+ ^& B% i6 t; j
  20. * kind, whether express or implied; without even the implied warranty
    5 N7 b; [: {6 a/ e- J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& a* Q$ v! x& }- \6 T) w
  22. * GNU General Public License for more details.! p! R* N1 f/ f* x# S1 }7 n- ]6 Q' d
  23. */# V+ z1 w( W4 l; s  R
  24. 9 @1 G  S. `$ ~1 G
  25. #include <linux/module.h>
    / c# C- w) [  d: @7 Y
  26. #include <linux/init.h>. F3 l! L' C  l- w
  27. #include <linux/errno.h>
    8 v, E" [% u7 y2 t& z
  28. #include <linux/types.h>
    3 c; s0 _& f6 u8 B8 b' w0 q
  29. #include <linux/interrupt.h>
    + C2 @5 a- ?/ k# h6 o5 V
  30. #include <asm/io.h>
    3 l4 L! q; L2 t$ C7 M) F( G
  31. #include <linux/moduleparam.h>
    , `, }5 \* q  |$ w
  32. #include <linux/sysctl.h>3 U6 o% f7 d) k; h9 D9 U
  33. #include <linux/mm.h>
    0 h; ^. P! T7 E5 {
  34. #include <linux/dma-mapping.h>. U6 S$ s0 F- _/ R" b

  35. + r  p# e6 t5 @
  36. #include <mach/memory.h>7 \! Q8 `/ l; S
  37. #include <mach/hardware.h>" ]3 G$ [# M. [5 {5 \, o0 n) h
  38. #include <mach/irqs.h>
    , z2 K1 c3 H: d
  39. #include <asm/hardware/edma.h>
    7 \4 _5 G8 d- t4 s# T5 `6 }3 K

  40. ! C* B% h4 ~$ E6 G; O3 P
  41. #undef EDMA3_DEBUG, r; U' U( y) h# G8 Z. x1 G, _/ }
  42. /*#define EDMA3_DEBUG*/" e6 D, b0 e# i! ]* ]3 m/ d- [

  43. 6 C# U; L. e# N  |% u
  44. #ifdef EDMA3_DEBUG# s( S( P4 ?; S/ e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ c1 i2 n: M" ]8 `1 I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& V7 ~7 i* \; \& j7 J: W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ o; K: r6 n' E" o+ l6 {9 S8 e
  48. #else8 H  M1 W- n0 O
  49. #define DMA_PRINTK( x... )
    ' @. N7 }9 X7 T! b/ v& S
  50. #define DMA_FN_IN* O% \5 a/ s- M0 a
  51. #define DMA_FN_OUT
    ! s& ?% b% e8 t# p
  52. #endif& ~2 x+ f2 r; `: M8 P

  53. 9 t3 W( O; c: p; V/ M* b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): j1 h5 J- P& J0 F
  55. #define STATIC_SHIFT                3
    : g" o# A5 \1 [
  56. #define TCINTEN_SHIFT               20
    % J0 V+ r5 q: `% }& [
  57. #define ITCINTEN_SHIFT              21
    & Z* ]+ M$ c+ [# C; L4 x% s4 L
  58. #define TCCHEN_SHIFT                228 p5 w* F0 l4 T+ B
  59. #define ITCCHEN_SHIFT               23
    % E- J; M, Q5 b+ k  l' J

  60. 0 @& K0 k% ?& X9 L5 `8 h
  61. static volatile int irqraised1 = 0;
    - \3 W! T) j/ W' V: I
  62. static volatile int irqraised2 = 0;
    * h" h, ^. |3 E) A

  63. - A* B" i6 o" q0 |0 p7 u( C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ~4 J3 V- V# m' m9 N. b5 z! v! y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( k% ~3 A9 Z- `# w2 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " `* V( p/ f' v$ b
  67. ' q2 t- Y* u& s9 M
  68. dma_addr_t dmaphyssrc1 = 0;. a5 Q4 D, U  E) Q( F
  69. dma_addr_t dmaphyssrc2 = 0;* r9 H4 P8 t2 S7 J; n* ?% d; _/ m
  70. dma_addr_t dmaphysdest1 = 0;
    & H. t8 Q7 }! l+ o- M! h+ O2 j
  71. dma_addr_t dmaphysdest2 = 0;* o1 }/ n  O. X& T9 H
  72. + _, E& L# Q* o8 A* ^/ Y) r
  73. char *dmabufsrc1 = NULL;
    : f( x# F$ h/ |
  74. char *dmabufsrc2 = NULL;
    1 A. D1 T$ x& p8 s0 B1 n+ [
  75. char *dmabufdest1 = NULL;
    ! g3 b# O2 S/ B% |' G  A
  76. char *dmabufdest2 = NULL;
    ) k' b" g8 x. t8 J! M0 N* M/ A

  77. 9 W( M$ T' ~& ]9 ]: }; Q
  78. static int acnt = 512;* k; x* @# b7 V+ q( V# z- N
  79. static int bcnt = 8;
    # R( a" o& ^0 Q6 \9 R2 m
  80. static int ccnt = 8;
    . T* t5 b1 P/ d5 ~

  81. 5 h3 Q* [' j* i
  82. module_param(acnt, int, S_IRUGO);
    ( }# k' y1 W3 R0 e& O. z& a
  83. module_param(bcnt, int, S_IRUGO);
    - X; H/ I( l/ w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 W4 d9 w' }5 t
5 ]+ ?7 v4 W0 ~. ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. C3 B: y2 N8 h. M  C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& D5 r7 s" L+ C* h$ A$ i& u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  ]5 {2 X2 S0 Z8 u, E, M6 i4 L% t3 k( _$ o& \9 ?# ~* q

' m$ B$ r3 W( T& x6 ^7 q6 @7 a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-8 12:24 , Processed in 0.043526 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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