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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 n: F: Z# K. f3 n" m
  1. [code]EDMA sample test application
    ( P( a3 z. y/ T8 `( x
  2. /*$ k% {% r! i& L/ z$ a7 t. a
  3. * edma_test.c1 G# E3 i4 C) S4 L* n& |  N
  4. *& j4 z0 [- v/ W3 D; Y4 V2 K
  5. * brief  EDMA3 Test Application0 a  z( S3 z9 o* K- c7 @
  6. *
    $ A' U. Q, [: Y
  7. *   This file contains EDMA3 Test code.) Z" Q$ r* F/ q5 a- g
  8. *
    9 W$ T7 ^8 z  ~3 E( n: r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 e, h( q, F* A  ~2 Q+ q, o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; D9 _& `8 b* u+ }6 r
  11. *         TO CHANGE.+ q0 f0 z& @7 V1 X6 g/ N. t
  12. *1 Y! M  k# j( Q  t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' y2 Q3 l/ K0 n2 b+ q  Y
  14. *; }+ {% I3 U/ w3 F1 X/ K
  15. * This program is free software; you can redistribute it and/or4 m" T2 D6 }* A, Y" [
  16. * modify it under the terms of the GNU General Public License as
    ; R3 z, U) ?* X
  17. * published by the Free Software Foundation version 2.  N8 N- i4 q6 H+ ~0 }+ |6 `4 e
  18. *4 {+ N. g6 D8 {/ k+ k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ L" L9 ]( T) z
  20. * kind, whether express or implied; without even the implied warranty
    1 R9 c# H7 k$ H* r+ ~  d4 Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : n9 u8 B. n. R+ x
  22. * GNU General Public License for more details.% Q' P9 T* B$ W7 h+ W* f
  23. */
    * }) A2 B0 D+ _6 |( V
  24. ( u. J7 J3 g& `" L, p0 B
  25. #include <linux/module.h>& J* _1 q( k  U& N. E1 s
  26. #include <linux/init.h>
    / K' u4 O  ^! J6 V' i% L4 C$ P+ Z
  27. #include <linux/errno.h>
    9 s/ D4 \' Z+ g9 n& @0 T/ b7 [
  28. #include <linux/types.h>
    + g, S/ n0 C4 K. j" j& r$ t" o
  29. #include <linux/interrupt.h>
    * g- {3 D( k& S+ h" {6 f8 s
  30. #include <asm/io.h>$ K4 h+ x) ^  |
  31. #include <linux/moduleparam.h>' t5 ^* S. O1 N* m
  32. #include <linux/sysctl.h>) N* z1 K$ o( M  f' m
  33. #include <linux/mm.h>
    4 ?( [. p1 _4 f6 K
  34. #include <linux/dma-mapping.h>- }+ x7 z. h/ R) X) P

  35. ! M1 n& i( {0 |* _6 {2 I
  36. #include <mach/memory.h>' H( Q9 V$ J- ^( o- P' n5 H
  37. #include <mach/hardware.h>4 S9 j6 J* L! m; Q8 G' g6 G2 z$ c
  38. #include <mach/irqs.h>- _; p) B! |) k/ t* ]% e
  39. #include <asm/hardware/edma.h>* Q8 o( _) a& z; \
  40. & A3 H' f% g( j$ V- t4 i" Y- k% r
  41. #undef EDMA3_DEBUG
    " j/ Y# }* e# ^: i+ @
  42. /*#define EDMA3_DEBUG*/
    ; d+ y1 h" Z' v
  43. ! \- B0 r: N' B2 L) I
  44. #ifdef EDMA3_DEBUG& S  i5 \; k  j+ s* f3 l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). K5 F; F1 R8 X! r( n; X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 U( c% _! F3 |& [% s! Y+ y5 I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  e' t: C6 D# z
  48. #else
    + W; f7 f" [0 i5 b* I' R. i
  49. #define DMA_PRINTK( x... )
    ( s* q# l1 S! i9 v+ P2 I7 g
  50. #define DMA_FN_IN
    % ?- ~7 @: n: R% I) n
  51. #define DMA_FN_OUT
    + @# e) W% F: Q5 c: s  d" q9 A
  52. #endif) c3 o* W- I# G$ U

  53. 8 F, S( U  h6 V1 T+ F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& D) _4 Z( L' Z. _
  55. #define STATIC_SHIFT                3
    . x( c7 f) y  A1 o; w$ t
  56. #define TCINTEN_SHIFT               20. X0 _! O# H8 ^' t
  57. #define ITCINTEN_SHIFT              21
    ! F" x3 a5 \- _( r3 z
  58. #define TCCHEN_SHIFT                224 X7 |9 x1 C9 f3 J) x
  59. #define ITCCHEN_SHIFT               23! ^+ J( u0 N0 _5 n9 f- }* x

  60. ; v: C; p0 E) f/ D' d9 n; B0 _
  61. static volatile int irqraised1 = 0;2 S' P1 s6 I. z4 `+ ]
  62. static volatile int irqraised2 = 0;
    * m: @* r+ e1 a+ B
  63. 3 E* |1 n3 ?  E- N" Q* Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " R1 o7 e, Q; p! C9 M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 A3 t' g3 G' m& x6 }  T: D8 b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# H4 o/ `4 E, k( S) v/ m

  67. " ^0 h4 q) w  L- ]
  68. dma_addr_t dmaphyssrc1 = 0;
    / `! d# R4 C0 ^) q8 D, H
  69. dma_addr_t dmaphyssrc2 = 0;
    $ k" Q8 L$ I* t5 H4 C: g- C  F3 o
  70. dma_addr_t dmaphysdest1 = 0;, n- X1 F0 X+ F
  71. dma_addr_t dmaphysdest2 = 0;
    ; Z& y( I- C& P& n4 ~
  72. , I2 I1 U) y, K2 m7 C) W2 a
  73. char *dmabufsrc1 = NULL;: E4 Q* V1 y9 f0 E; L9 n
  74. char *dmabufsrc2 = NULL;
      E& m% ?) E4 z0 _
  75. char *dmabufdest1 = NULL;
    ) t  N8 F; ]  ?
  76. char *dmabufdest2 = NULL;/ x9 M2 P  N; G9 A; h' _. ^
  77. 9 m, f) X9 B! d8 g! a& a: i
  78. static int acnt = 512;
    # N4 b0 C6 }, a+ S' i. z
  79. static int bcnt = 8;
    / {& k- G3 u8 Y/ a
  80. static int ccnt = 8;
    * q, ~0 k. M6 o. A
  81. - ~; B, H2 e9 L- ^& N/ T: l
  82. module_param(acnt, int, S_IRUGO);9 M. @, V: X2 }: T. {, P& g9 s+ V
  83. module_param(bcnt, int, S_IRUGO);& q, G2 p. r8 O' Q" Z- q5 m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, r, p" n/ s7 n3 i; y. b+ [' Y: a. z7 ^2 n( I0 p' @+ j
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; ^! C- \- |% t1 ~/ {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 G% X+ _; Y1 t3 j0 i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' b( w+ E8 Q0 _6 @! M& K% `( a' s' z3 @; o- H; J) @

% `& Y( G+ T4 g! R; w, M6 n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-1 04:49 , Processed in 0.040677 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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