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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) U6 V% V! \* W6 V! ?3 i' R5 |
  1. [code]EDMA sample test application1 J; }' ~# s4 a) x
  2. /*
    . Z  }+ K1 r& _1 c+ e  L" j  A
  3. * edma_test.c" T# y' ?1 S: P) w3 U- P
  4. *
    3 h  i0 k% {" q: Y, L  h1 ]) C
  5. * brief  EDMA3 Test Application
    . p  J$ \! w- b! C2 ^+ \
  6. *
    . C1 ~7 [7 {1 T+ c3 p% C+ k
  7. *   This file contains EDMA3 Test code.
    . A3 V( z7 {7 G
  8. *: q% U( M5 X8 u9 N$ F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ L+ s, \3 S  w- P& N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 s# f5 y0 E, [8 x
  11. *         TO CHANGE.
    1 n0 \2 p, p, n, a7 d6 x5 K1 @& X' ~
  12. *
    - H9 S; r8 P& z, U8 W& a6 z5 K9 p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' A1 }5 |0 R! g8 @# v. Z  a5 X
  14. */ Y7 B& t8 w0 T& p5 \
  15. * This program is free software; you can redistribute it and/or5 |  r7 f. q% h5 d- m9 R
  16. * modify it under the terms of the GNU General Public License as
    6 s, |% o' q* a% Z. m2 Z
  17. * published by the Free Software Foundation version 2.8 J* [3 [& ]7 p& k6 J
  18. *& V  r! F8 I/ a. X, m& ^4 H# Z9 a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % l3 d8 ~0 l1 L: Z* u
  20. * kind, whether express or implied; without even the implied warranty
    , d3 {4 _. [8 z# E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) ], V; l, N$ [2 \9 C
  22. * GNU General Public License for more details.5 h( U8 E8 Z2 z3 Q- E0 @; f8 @
  23. */
    ' S& o5 d, f. j" {; i* f, ~

  24. , `- l) o2 f( {3 C
  25. #include <linux/module.h>: g/ S7 G- K' h; t7 N
  26. #include <linux/init.h>6 \/ u/ C( h9 C
  27. #include <linux/errno.h>
    6 R1 t6 M7 r- }+ m7 |* N
  28. #include <linux/types.h>
    : I9 `& {; E! ~+ G
  29. #include <linux/interrupt.h>3 V: _2 J! J" \- ~
  30. #include <asm/io.h>
    # }4 y* o: F. j, Z1 m
  31. #include <linux/moduleparam.h>% r7 J" F/ P& y6 P2 Z
  32. #include <linux/sysctl.h>
    : |6 a, G/ u8 Q- H
  33. #include <linux/mm.h>; I- d9 t! ]" ?" u' n  X( x
  34. #include <linux/dma-mapping.h>7 B0 M* g  e! Q" c) d

  35. 8 j5 T: [8 Y7 m& X% m* y: K, y( r8 z. y
  36. #include <mach/memory.h>
    " w- [/ j8 B) L' P4 ?' u1 R
  37. #include <mach/hardware.h>
    " `# W8 J$ C1 u, T) m
  38. #include <mach/irqs.h>* A% A$ f, M. m$ O7 I( I
  39. #include <asm/hardware/edma.h>
    0 e7 v8 c9 l5 P4 |

  40. 4 h* B% t. e8 `
  41. #undef EDMA3_DEBUG
    ( a& {& ~4 d+ L# T" c
  42. /*#define EDMA3_DEBUG*/
    3 f" [& E. M, X* R0 g  c

  43. : ~8 n" K: i2 b( M7 i. t- P2 y
  44. #ifdef EDMA3_DEBUG) g# p  n/ q+ O& ~6 d: D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % N& Q2 y/ h* P/ ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 O& `, q" _7 C: e+ E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 q( X/ m9 Z/ F; c
  48. #else
    8 m8 O+ B9 G/ X2 n8 J6 {6 S; ^
  49. #define DMA_PRINTK( x... ): q$ W5 X9 n/ \. o4 N; a; F8 j
  50. #define DMA_FN_IN8 o/ W9 r4 c5 n; z) K
  51. #define DMA_FN_OUT
    4 [8 J/ u4 {. q! M+ E( f* ^
  52. #endif' Q( Z& u* e) \# Y3 j9 Q# ?8 n
  53. , `. e2 ]$ B- ^: c, N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) e7 G1 D% M8 [% U+ p* `
  55. #define STATIC_SHIFT                36 b% J1 N; y# D0 C
  56. #define TCINTEN_SHIFT               20
    . F8 W$ U. h: V/ }8 i8 z" h- X; ]6 Z
  57. #define ITCINTEN_SHIFT              21! K) o" Y7 s( Z
  58. #define TCCHEN_SHIFT                22. ]9 _6 c' X: {* l  S! p+ w1 k/ h
  59. #define ITCCHEN_SHIFT               23
    3 U% ]0 Y  e( N/ o) K, t' q

  60. * s. W! p1 Z/ @% Q" }: }
  61. static volatile int irqraised1 = 0;
    ( e) b7 V# l6 h! V. H& a! J2 Q: w7 W
  62. static volatile int irqraised2 = 0;& s2 M& q) ]) n  U7 j4 j
  63. ) s% f+ l1 X. }( O0 `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . B% @- @8 A7 i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : T8 n9 u& j+ Q% m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) j, k7 W" D0 Q! N

  67.   ~8 O' ?7 T9 w" E. r* G6 D
  68. dma_addr_t dmaphyssrc1 = 0;3 I/ S$ }+ h* B
  69. dma_addr_t dmaphyssrc2 = 0;% e2 J- d2 I2 Q( Q1 N
  70. dma_addr_t dmaphysdest1 = 0;3 ^/ A; f. n2 ^' o2 h1 t
  71. dma_addr_t dmaphysdest2 = 0;
    7 s9 @( n$ ?7 _$ V: w6 [4 k. S

  72. & j, n! `3 M8 F
  73. char *dmabufsrc1 = NULL;2 o* Y6 N' L/ p. K
  74. char *dmabufsrc2 = NULL;- ?9 e& [3 E/ k8 w+ d2 l7 c
  75. char *dmabufdest1 = NULL;
    # ]9 X  I& `7 w  q6 q3 ~/ z
  76. char *dmabufdest2 = NULL;
    2 n3 {; p/ y) M; J/ I4 l$ m" \: c

  77. 8 p5 J1 Y# G! m; d9 @* D7 ^) F2 b
  78. static int acnt = 512;
      \! t) t5 G% e% p
  79. static int bcnt = 8;
    6 a$ T; [* U  _5 R5 G' Q( X
  80. static int ccnt = 8;1 X. e! X5 \) z3 n7 x

  81. 4 n# }; d- C% p4 d9 h2 @) D
  82. module_param(acnt, int, S_IRUGO);
    8 d( D5 k; H& d4 v1 q
  83. module_param(bcnt, int, S_IRUGO);
    ) x% s: E1 c. Z: ^9 Z# c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% {. D2 m$ U8 C6 ^) [+ D1 b' a' ]$ P4 B8 i3 I& h. b
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, [4 K2 o+ F( ~1 S: \' e9 K1 a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 Z& ], Q+ y+ \% u: v: a- o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 {# p/ @6 [& ]/ J1 P# z  g

* x# u- h* g! |# y- d8 F# ?9 }0 ~3 H& m, f/ S: f. i6 T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-29 08:02 , Processed in 0.045117 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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