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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 x# f( n( s& l# ]9 T" r+ O5 g* W
  1. [code]EDMA sample test application
    # X. a2 I6 x7 Y* K7 Q4 T- z
  2. /*" X3 O: [3 e, ?  R5 k# h
  3. * edma_test.c
    3 k( G2 p; {& D# }
  4. *
    ( v5 k7 d1 [; P' i9 ^
  5. * brief  EDMA3 Test Application
    4 G7 S( b( C( }0 d
  6. *3 Y. B5 l% e4 s: u) B3 e5 q
  7. *   This file contains EDMA3 Test code.  E# }5 Y- |2 [" f5 f" Q$ t
  8. *
    ! ^6 O; C( ?: R! o0 I4 Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; e% p5 O, g( t5 V, O/ E1 j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 X3 }' u! w( `, Q. F3 I
  11. *         TO CHANGE., F' i7 @( C( P. ?+ X
  12. *
    & d. f7 P! ^( n. B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * \# l0 Y- e1 b" F" t. x( e
  14. *% [6 [* U# L8 l! Z7 k
  15. * This program is free software; you can redistribute it and/or
    ; Q4 R& W2 P- S( S3 [2 K. I
  16. * modify it under the terms of the GNU General Public License as
    1 y# R  x  Z1 a# C5 M% |
  17. * published by the Free Software Foundation version 2.
    ( A3 D8 D" }  X% G5 O) n' u$ N8 k
  18. *7 Z, I$ S( o9 h9 u' p9 a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 A0 U# ?" X: s
  20. * kind, whether express or implied; without even the implied warranty
    5 j2 h9 q& D' H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % I% ?# G" B/ K2 i5 y
  22. * GNU General Public License for more details.
    6 s2 q8 @" b7 P! ~  [) M
  23. */: J# d/ U- n6 r. ]; a6 h" `9 |
  24. 8 w6 n( D  I& J  G
  25. #include <linux/module.h>
    5 G2 d$ o3 M2 C$ I
  26. #include <linux/init.h>
      W5 E& S* d' B3 h1 |9 B6 n
  27. #include <linux/errno.h>
    - w. x4 a3 G0 ]: i
  28. #include <linux/types.h>4 N0 j/ l% U  M0 m/ c: \8 S" ~$ Y
  29. #include <linux/interrupt.h>  v& R0 |; s: L4 K( ?; W" L
  30. #include <asm/io.h>8 j# p( V8 r8 f( S+ I8 c; C; A# V
  31. #include <linux/moduleparam.h>
    5 W+ B3 ~& v9 _# F
  32. #include <linux/sysctl.h># G5 P4 E- ^/ x3 _
  33. #include <linux/mm.h>
      g( |& g( Q  J$ j' i
  34. #include <linux/dma-mapping.h>
    ' u( a' P$ h# E- S
  35. 1 J; x  P0 L/ u5 N$ m# Z$ e; O$ h
  36. #include <mach/memory.h>
    4 J2 E: `! R4 {" [5 n4 F- I/ b7 @
  37. #include <mach/hardware.h>9 ~+ U2 n5 S5 k; T
  38. #include <mach/irqs.h>
    5 Q* z) V3 x/ A3 o7 J- [7 |. j
  39. #include <asm/hardware/edma.h>; {- }# B$ }& j0 N0 k

  40. 3 f5 F7 c& A! ?0 i" j) u0 @& [
  41. #undef EDMA3_DEBUG/ A$ S8 t* M7 ^, s2 P: Y& V6 U
  42. /*#define EDMA3_DEBUG*/- h. i9 @( z0 v; g' j! I
  43. 1 N( Q  a' ~# ^% ]5 `
  44. #ifdef EDMA3_DEBUG
    # E+ f3 s& d. M8 o- T: c: \% P% s$ X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " ~  l7 c3 Z0 H$ y. A! Y& n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! p) |% R+ [' C# C% ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! ]1 n; J' @) A; W/ o
  48. #else. {+ s5 q8 J9 k8 f" [5 J. o
  49. #define DMA_PRINTK( x... )
    , N9 L6 f5 m5 \# l1 f
  50. #define DMA_FN_IN  a2 o' f6 }) w: E- D( h  R
  51. #define DMA_FN_OUT
    & ]9 X9 ]3 `& r) w
  52. #endif- v) I" t* f( y

  53. # {  U7 w: y) S8 Z: V* g& ~* X' s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 m! o4 {0 f( \% a7 o8 l2 ]2 h
  55. #define STATIC_SHIFT                3
    % Y2 ~* _0 S2 Q, a( |- r( W
  56. #define TCINTEN_SHIFT               20
    - ^" M6 a" {- v9 c! V
  57. #define ITCINTEN_SHIFT              21
      ^& U0 J+ N9 `# B0 y6 n4 _
  58. #define TCCHEN_SHIFT                22# E/ S( k/ D9 G9 P: S
  59. #define ITCCHEN_SHIFT               23
    ' @4 D7 A& f4 ]
  60. , ]/ n) z8 @. N5 T; M
  61. static volatile int irqraised1 = 0;
    & |! m4 G; T  `4 @# q
  62. static volatile int irqraised2 = 0;; O) E0 t) n, x3 H. z2 d% F2 X
  63.   C' o9 Y( V6 V, o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 S1 c+ c1 e& s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 z7 S! {! u8 I) m: T" V1 Y* v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ U0 d/ j& n5 J' U  v. e, t
  67. + W" H: ~4 A: L  t; X3 k2 E  z9 V
  68. dma_addr_t dmaphyssrc1 = 0;  D7 Q; B/ Z8 F$ g
  69. dma_addr_t dmaphyssrc2 = 0;* n: V6 n( W' p  Y; X
  70. dma_addr_t dmaphysdest1 = 0;, S; J+ |& g7 {) O8 B  j( Y: l/ ~
  71. dma_addr_t dmaphysdest2 = 0;
    ( ]1 t0 H! m# n4 U. l
  72. " c: I  x: ]5 t8 I
  73. char *dmabufsrc1 = NULL;
    1 R: s0 P0 o: ]
  74. char *dmabufsrc2 = NULL;% g. W8 j; ?- K% v4 Z) `
  75. char *dmabufdest1 = NULL;/ j4 D4 o4 z* V. B
  76. char *dmabufdest2 = NULL;
    3 S( Y( E* L" ?
  77. " r/ V$ L  X/ T! k4 {5 c5 q
  78. static int acnt = 512;2 N+ q0 ^' c0 X5 S/ ~- i1 i- E
  79. static int bcnt = 8;
    ) s) |" v, j2 a
  80. static int ccnt = 8;
    0 {2 a, {  F! W3 g- h8 F! J3 u

  81. 2 @/ }7 H1 J0 b# ~% p( c
  82. module_param(acnt, int, S_IRUGO);
    4 m6 P) y. [6 K3 y" z
  83. module_param(bcnt, int, S_IRUGO);' f& p% }0 C* M+ C' S' K8 P) v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 q! D4 L) L" f

- s% k2 B, S& K6 {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 D! C( z2 x5 M/ V8 v. 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' q# d1 w& ~. i! E+ |1 Y4 _; d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 S' G0 D6 N) {0 S5 X* N! V& c0 D1 ?% X

  w0 q; R; ?! w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-1 07:31 , Processed in 0.036509 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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