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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  h: U, }/ g2 E
  1. [code]EDMA sample test application
    , k  x0 _+ \, Z9 E) h) B4 a( b
  2. /*4 x0 C# S! k& p2 l2 B* l* {
  3. * edma_test.c* C( d2 t" \) }  g0 B: [! G: I
  4. *% W) O$ n& i7 _5 o$ P- N% R  [
  5. * brief  EDMA3 Test Application- U3 x8 G3 d6 q5 [& Y) ^
  6. *& r4 w  ?6 }3 W) C5 v& |" k4 X5 \0 [
  7. *   This file contains EDMA3 Test code.
    ( f0 ^* U! ~9 h/ r& k" t
  8. *
      i+ m  ?4 L# J8 |4 Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ G7 y' n' @, k* X. R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) e& \& B2 x) A/ Q% A2 R5 a& g/ }
  11. *         TO CHANGE.
    . N; @! A( a% W+ ^+ `# o7 |8 G
  12. *! f" w- o' c" G7 z  N% V" j# M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 ?0 B" k# T( r* x! ]/ q7 Y, Y/ f
  14. *
    8 ^; B, d4 P) E1 p! S7 I
  15. * This program is free software; you can redistribute it and/or: N8 C6 t' q2 y9 M, n. A7 d
  16. * modify it under the terms of the GNU General Public License as  [) p! Q- U- m$ T
  17. * published by the Free Software Foundation version 2.
    7 n3 [- @4 n7 n- e! y& e" A. J
  18. */ @9 n" w' N2 p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , \" U/ o" |6 ?4 f- a
  20. * kind, whether express or implied; without even the implied warranty
    ) E$ l5 @3 y" D9 b: Q4 p1 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 K+ w7 z+ R+ I6 C$ d/ j
  22. * GNU General Public License for more details.
    + N! F. H4 I; W/ S
  23. */
    , m: y" o" s& v5 h1 H$ R/ ?+ l& A
  24. 1 G7 V# a- i% C7 q5 f) [: m4 c
  25. #include <linux/module.h>  ~% _/ z9 x# X8 G- {- F& {
  26. #include <linux/init.h>; U/ E% g! b+ n: J
  27. #include <linux/errno.h>
    ( ]' l6 o, ~& y4 Y  U
  28. #include <linux/types.h>
    % x5 A) t3 B/ [6 q% O: o$ C
  29. #include <linux/interrupt.h>$ Z% ~8 G1 L2 w: q, z) T
  30. #include <asm/io.h>2 g3 ^% s9 n: H* L; H
  31. #include <linux/moduleparam.h>) c" j, L" ]3 N- k0 R# e# \
  32. #include <linux/sysctl.h>. d3 r5 e0 N: V( x& d' w3 _5 G  L, b
  33. #include <linux/mm.h>9 r) C9 i, n2 D# @% r
  34. #include <linux/dma-mapping.h>: I2 I% ?  M: n, ]

  35.   v  J1 j* I1 @4 n
  36. #include <mach/memory.h>
    9 G9 f3 p+ X+ @& x3 W; P
  37. #include <mach/hardware.h>) f% t7 Z9 `+ s; A: n: p/ h
  38. #include <mach/irqs.h>4 @' s4 j8 D0 ]$ `
  39. #include <asm/hardware/edma.h>& `( D3 q& p" U

  40. % b% \1 V- E/ ]% v& w
  41. #undef EDMA3_DEBUG* N8 m8 T$ Y5 z+ @" E2 w7 B
  42. /*#define EDMA3_DEBUG*/
    % r4 j- R0 v  r* L, O) w6 V

  43.   V% Q7 X1 O* @8 J9 a7 R. f
  44. #ifdef EDMA3_DEBUG& Z5 z8 n6 m% J* e2 _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * w- y8 q  F/ {  b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 W1 O9 }/ r# Y! \$ K' A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 ]3 N4 s) N# l/ F% v9 S$ \/ a
  48. #else, k1 V$ J, }, n; D
  49. #define DMA_PRINTK( x... )& e/ w7 r2 ?$ w
  50. #define DMA_FN_IN5 @+ M' f9 U' i7 i* m
  51. #define DMA_FN_OUT; `4 m: j) t! `7 y/ l6 L
  52. #endif2 H4 t& h+ v$ x, _+ n

  53. 1 T+ Z. N* q& [  @( o+ B( ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) t6 m! C7 |# K' I. }' U
  55. #define STATIC_SHIFT                3
    % n  x' r/ S# m; l! `
  56. #define TCINTEN_SHIFT               20
    7 {7 K7 \& |& n6 k' X8 i) [. o
  57. #define ITCINTEN_SHIFT              21
    * f& Y6 E2 e' Q
  58. #define TCCHEN_SHIFT                22
    $ ~! \5 u+ I* E+ S
  59. #define ITCCHEN_SHIFT               23
    + o! I4 c  w1 [& u: G8 `( U. k5 {
  60. 5 j. z0 S. f" V0 v  D3 P
  61. static volatile int irqraised1 = 0;% o' d" B" U7 P2 l3 M- J
  62. static volatile int irqraised2 = 0;# W+ A. `6 i$ ]' [! D* b& P  t
  63.   c  J) e: ]$ x* Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - |) q5 t/ v8 v7 R4 V; U( M+ A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " f% }& F  t' ~4 d; d: w8 j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" Y& V$ V9 [/ q; R' f8 A. D" W) b
  67. ; [9 ^$ u  w; T
  68. dma_addr_t dmaphyssrc1 = 0;& c2 J) |3 f  u, o$ k* }
  69. dma_addr_t dmaphyssrc2 = 0;
    0 }6 i! J* F! D$ _; p6 B& `- q
  70. dma_addr_t dmaphysdest1 = 0;9 [% v% _# t6 X  u! @
  71. dma_addr_t dmaphysdest2 = 0;
    ' w& l" N# e/ a+ F# I! j8 _
  72. 8 v' s0 s; c- i" y: V1 x
  73. char *dmabufsrc1 = NULL;5 N: `7 E1 O# \  Z
  74. char *dmabufsrc2 = NULL;
    ! V1 g; C; w  w/ D! c( l
  75. char *dmabufdest1 = NULL;
    . D# c! l1 L7 f4 O
  76. char *dmabufdest2 = NULL;
      y2 G7 Q/ \( M
  77. 3 G6 r2 O/ {* g/ _3 W3 ~4 k' p4 C& L
  78. static int acnt = 512;
    " ]( A; \% t3 X
  79. static int bcnt = 8;, z: g1 ~5 Q, s, @6 D
  80. static int ccnt = 8;8 ^" I4 [! N4 O2 f3 z2 F
  81. 2 n- E$ B$ \) g" e0 K; D
  82. module_param(acnt, int, S_IRUGO);: g* h2 k! X0 U; p/ G
  83. module_param(bcnt, int, S_IRUGO);  E. h( w5 d+ b9 O/ [+ |7 l: ^  n! ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; m: d( K0 l/ _: H# I' V, [, O' |( W7 L
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# P2 m' V' M+ karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) j# |' z8 {& Q- b. W4 n2 d$ }
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  |& _8 s( t" B1 S
9 N- _( n7 A* v5 h1 Y% B6 ]* t( _* s" c7 U" h, }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 17:59 , Processed in 0.037333 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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