OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 u7 S0 B+ c. x6 j% j5 M
  1. [code]EDMA sample test application
    $ _( q* O; s) Y8 h
  2. /*' M$ @+ P0 r& u; z+ ]+ F, d/ q5 `
  3. * edma_test.c& G" B% D) M. c3 M
  4. *) \- k# x( C# t5 S5 M
  5. * brief  EDMA3 Test Application
    " B! m: L0 ]# x& }! B
  6. *7 h& T, Y1 C, O* [  u2 v
  7. *   This file contains EDMA3 Test code./ X) m* @/ C4 R9 V8 F
  8. *
    " H1 P6 ]4 C7 B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * \+ _$ z, Z8 r+ q+ b0 m+ ]) C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) C9 H4 B& y; P
  11. *         TO CHANGE.0 {# |: v2 n' S; z& Q
  12. *! ~; Q6 s( x% b; G+ [& ~* N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & d! y  a& P0 M
  14. *; Q" R4 y# p8 D& M/ I: ^
  15. * This program is free software; you can redistribute it and/or
    # O% Y2 E, V$ \+ d9 H, s6 B/ Q7 v
  16. * modify it under the terms of the GNU General Public License as
    " ]3 n) L- C. B$ H. o8 d
  17. * published by the Free Software Foundation version 2.
    ; ^% X& S" h, `) n- f5 m# I* c. r1 d
  18. *
    7 p4 ]3 s% V. I2 Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 p+ H8 R, \$ y. [' S9 X& }% E) ~
  20. * kind, whether express or implied; without even the implied warranty
    , ^- N0 T1 Y+ \/ W0 W5 n8 s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& \* a/ \' J* C9 g
  22. * GNU General Public License for more details.0 O* K. h/ k1 L1 F
  23. */
    1 |1 H2 p1 M, V( i' @
  24. . ]+ m' u/ [1 u' {" l* T8 A
  25. #include <linux/module.h>
    3 t5 f& P5 E) Q6 J
  26. #include <linux/init.h>6 @7 i4 N8 R0 d7 v9 p
  27. #include <linux/errno.h>
      C6 p3 x, b7 m* x+ V3 q- B! U
  28. #include <linux/types.h>
    / s. I0 D4 H0 {$ }% t+ D+ a9 `
  29. #include <linux/interrupt.h>8 u( _: b% S9 ~* a
  30. #include <asm/io.h>
    & F$ R! A/ f0 R
  31. #include <linux/moduleparam.h>$ e2 g  S. x) a+ Q
  32. #include <linux/sysctl.h>
    " m3 r( a1 Z- Q6 E% I7 h& i8 Y
  33. #include <linux/mm.h>/ d# g: G5 m# S. L/ Y
  34. #include <linux/dma-mapping.h>
    , W7 Q. v; C% t0 u" c

  35. " l* S. E# t$ D; ^. J8 q0 T3 f& d
  36. #include <mach/memory.h>
    . S7 S3 P# Z  O$ H4 @5 f, N
  37. #include <mach/hardware.h>
    4 E; Y/ ^* J! T: K( a
  38. #include <mach/irqs.h>* r5 i& s. t6 M4 x% m
  39. #include <asm/hardware/edma.h>9 U1 X) K' b+ F% L) l( {
  40. 7 q/ z7 G( ~* h0 W0 O0 C% P
  41. #undef EDMA3_DEBUG& u3 ]- r6 e) A$ v: D$ ?& W$ ~
  42. /*#define EDMA3_DEBUG*/
    7 z) ]. [* ^! h7 h
  43. . a+ R7 E& G( e1 g3 I
  44. #ifdef EDMA3_DEBUG
    ' z% e, m1 R6 E  Z+ [+ Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ w6 t4 T! M3 R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 u4 j* N" N, ~: O% k2 p9 L2 M' g- a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( w9 L! ^' R1 l  i5 ~' `
  48. #else
    2 z/ p3 \& t1 k+ ]8 B! _9 k
  49. #define DMA_PRINTK( x... )1 P$ r* i% x0 {% W5 {
  50. #define DMA_FN_IN/ X0 V* A6 m# d; d! }4 P- `1 D$ `
  51. #define DMA_FN_OUT$ ]( I1 p7 m) A6 S0 a: k( ?
  52. #endif
    ! E  p6 t3 l1 E; z; ^

  53. - p! w+ Y# [/ q; w  s1 B# V7 i1 @: p3 ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) l% Q( |  V  b9 A) m
  55. #define STATIC_SHIFT                3
    6 ]5 O' E( w& L3 x
  56. #define TCINTEN_SHIFT               20
    4 N" |# N& ^* |# |. _; ?
  57. #define ITCINTEN_SHIFT              216 S; g/ @* ]8 c
  58. #define TCCHEN_SHIFT                22
    / s2 C2 p: h( @% m; Q
  59. #define ITCCHEN_SHIFT               23
    9 E  q3 h( s  y+ S

  60. % a" {% Q7 c! ^! o, n- L) R& t' l
  61. static volatile int irqraised1 = 0;7 P) E; s4 Y% V  ^- A
  62. static volatile int irqraised2 = 0;0 O6 p8 g- K7 f4 \' z

  63. 6 g# u3 l0 Y2 N; s3 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  F/ ~) _) H" B5 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, q- G* C& ^! }# g* G* p: p( V! h; g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ q3 n" s) C3 d) w9 [; U

  67. / i8 S7 z8 m2 t% N
  68. dma_addr_t dmaphyssrc1 = 0;
    # L+ e7 D. e; T" u0 f
  69. dma_addr_t dmaphyssrc2 = 0;. p6 R5 K# y6 I$ U5 M6 ~
  70. dma_addr_t dmaphysdest1 = 0;
    7 @0 r3 @7 O7 N% A8 k- }* C
  71. dma_addr_t dmaphysdest2 = 0;
    - g5 Z, a( ^  O" C2 x) j

  72. 1 w+ G4 C) h0 z) e6 V' Y
  73. char *dmabufsrc1 = NULL;
    , P4 h! x  U. G$ F9 e* n& ~( u, D
  74. char *dmabufsrc2 = NULL;( z4 O6 C! r2 o; j
  75. char *dmabufdest1 = NULL;
    1 m3 o9 K% P0 Y# S( u
  76. char *dmabufdest2 = NULL;
    1 m7 v2 @, b8 k+ l4 Z

  77. * }4 z; h8 Z/ U: }! Y. Q3 H7 ~
  78. static int acnt = 512;+ Z# t- B4 s) u4 E0 k9 e0 \+ u
  79. static int bcnt = 8;, s6 Z. X* s1 r3 G' w' T
  80. static int ccnt = 8;9 D3 l: V4 x- d1 v9 n
  81. & y5 }; f5 C( m8 a0 _$ G4 }
  82. module_param(acnt, int, S_IRUGO);
    + G8 C' [6 M1 Y( y+ n/ A& i
  83. module_param(bcnt, int, S_IRUGO);" e& J$ b& b# H. D# m% N* C. M
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 R2 P# R$ l7 I6 _* x
. s1 a+ x+ V% z  ~% |* y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: V1 j  W% ?0 u' a/ _2 G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( f( O3 o& i' B' R     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, h. v! c) W- Q9 h8 W# U" G5 O3 G
' b1 B: g% c2 L1 z5 d  b' X% ^

/ @. }3 g  d" u* Q, ^  E# \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 06:24 , Processed in 0.037388 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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