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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' [1 W" ^' q: i. g2 q+ L5 L$ r9 D
  1. [code]EDMA sample test application3 Y) |& f" @8 N; d8 A  G
  2. /*, b( U2 ~5 s- o$ {% D3 i
  3. * edma_test.c
    : v! J2 C5 {9 x: Z
  4. *$ A& J2 q9 b7 y' o# }5 v& D# _
  5. * brief  EDMA3 Test Application
      N' Y7 A+ J6 R8 [9 Z
  6. *
    " o! x6 H5 P# H* C
  7. *   This file contains EDMA3 Test code.
    ( s3 j* x3 V% X- i  X3 L4 \1 y
  8. *3 F' j7 {; q2 ^# N: U$ Q! y6 ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 \6 r7 l+ P( ]. o+ o  d; k$ H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - Z) Z$ T9 z( G  p2 q; c; b
  11. *         TO CHANGE.
    + x; q3 A% W" ?9 h9 z
  12. *
    ) Z% v# i& q9 F( Y' f" O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 d  a) y% V9 O9 F2 v
  14. *
    9 w3 c! a% e. l9 t
  15. * This program is free software; you can redistribute it and/or
    # O7 V# `3 O' u2 g2 T/ v6 D* _
  16. * modify it under the terms of the GNU General Public License as
    7 p0 {3 A& _- B, C
  17. * published by the Free Software Foundation version 2.! a! t4 x. E7 u# ~$ y9 y  J+ [2 E
  18. *
    : x" g- c* u! `1 g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 B( a4 ?0 H' {: N! q
  20. * kind, whether express or implied; without even the implied warranty
    3 Q9 T+ C% a  |: L/ x; T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 t0 `) ?  a! P( ]+ C& S
  22. * GNU General Public License for more details.
    1 U: W: U  k3 j2 ?. I
  23. */
    3 \9 k. {( t3 t7 Y; |( P& F* b

  24. 9 ^# t0 g& [/ h8 {( ^; N5 F
  25. #include <linux/module.h>/ m4 ~6 b: ?3 M6 F
  26. #include <linux/init.h>
    2 a8 F1 p& g  M2 z) y% x- L
  27. #include <linux/errno.h>
    ( s% q9 u& T8 p* I% u
  28. #include <linux/types.h>& X! z- O; z0 g" Q4 {
  29. #include <linux/interrupt.h>
    & l$ z% m, o4 Y
  30. #include <asm/io.h>
    ' A/ \; a3 z0 B4 z5 \! }* q% b
  31. #include <linux/moduleparam.h>
    / v$ k0 z6 u0 }8 M7 h; U& h8 Z
  32. #include <linux/sysctl.h>
    + E: a" M7 t( u" f' x
  33. #include <linux/mm.h>' |, [% n7 i% c
  34. #include <linux/dma-mapping.h>1 @  u. c. q4 |4 A  U& G2 m+ C
  35. 7 l  u9 U  _" w8 M/ _2 k
  36. #include <mach/memory.h>
    ) c- {! |2 \. x5 f% g! G% w
  37. #include <mach/hardware.h>
    ) m% a) X$ u! h- y/ P1 E
  38. #include <mach/irqs.h>
    ! m1 q9 d2 n% p) {: N
  39. #include <asm/hardware/edma.h>
    / ?0 n& J2 i" F% B2 T/ b

  40. 5 \' |: K+ g2 n
  41. #undef EDMA3_DEBUG
    & p2 j6 B* T, }0 l
  42. /*#define EDMA3_DEBUG*/) B) T1 i2 B- M7 |* @, e
  43. : r# I; w* o8 j
  44. #ifdef EDMA3_DEBUG
    6 _+ R' u5 g8 I: v' q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : |6 o1 P9 d" Q6 Y. r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% h  T6 p6 g) e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). v/ a$ c  N1 ]
  48. #else6 u$ F6 V$ R: x1 k
  49. #define DMA_PRINTK( x... )' Q: l2 n: O; V+ I: L" U6 K
  50. #define DMA_FN_IN1 M% b; t& c9 k8 N
  51. #define DMA_FN_OUT9 _9 U( k3 l2 ?3 l( J7 E3 V6 E
  52. #endif
    ! j. k% \9 [5 ~9 x! K  D0 ^

  53.   b8 W7 V1 z) L# p5 n6 o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 w8 O: {( @/ E6 K
  55. #define STATIC_SHIFT                3* i/ T( `3 ~) N: i( _0 T2 q" c
  56. #define TCINTEN_SHIFT               20+ B4 g2 ~& q, ^* d: `2 B
  57. #define ITCINTEN_SHIFT              21  i! ?, }, ?- G
  58. #define TCCHEN_SHIFT                227 o3 `. J/ L: h6 j+ {0 F
  59. #define ITCCHEN_SHIFT               23
    1 u9 O) O2 s2 C" h
  60. ' v9 _2 e/ w0 J# X8 m) s. S
  61. static volatile int irqraised1 = 0;
    . F" d3 c  }% L4 ^
  62. static volatile int irqraised2 = 0;
    , L( e( v6 E% X; A- H  X
  63.   U- n" x2 g6 f1 z% O7 U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 V2 K3 ~8 T. k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- o7 u+ S3 `) @) [+ y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # c/ C5 m0 _: ^9 D
  67. $ f4 X+ N% B: P
  68. dma_addr_t dmaphyssrc1 = 0;4 u" W5 Y1 [  _- i! f) C) \4 I
  69. dma_addr_t dmaphyssrc2 = 0;
    ) N8 |2 f5 G/ Q
  70. dma_addr_t dmaphysdest1 = 0;
    6 x) [- B" x# h3 U; h+ o
  71. dma_addr_t dmaphysdest2 = 0;
    7 z: I( v" {3 k) S" O4 i; @1 a' ~

  72. 2 }  H: m- S; k* F
  73. char *dmabufsrc1 = NULL;8 w. ^" g, E' L( p6 \0 R
  74. char *dmabufsrc2 = NULL;
    1 B) P0 Q: g0 _% c/ N7 q2 H
  75. char *dmabufdest1 = NULL;; V0 w. \( ^0 i* B5 ^% n0 A8 w8 Y
  76. char *dmabufdest2 = NULL;
    . |  [; T8 [; o' s5 y* N! Q
  77. ) ?' _& D! W# S( Y) L
  78. static int acnt = 512;9 v, ~7 b' z+ Y) i7 l
  79. static int bcnt = 8;
    . s  F7 D! ]8 `# z, S: v  ^- B1 l3 [
  80. static int ccnt = 8;" \3 v" D/ ^1 C: O% a" z

  81. 5 a$ a9 ]7 G' y+ z& }
  82. module_param(acnt, int, S_IRUGO);% Y/ i% e+ s8 ]; x. Q  j& W0 i3 L
  83. module_param(bcnt, int, S_IRUGO);
    * b* ~% w! E# x* V' g' I/ G' O
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 o7 ?4 P1 n( ]3 d: I7 [+ p' [4 v/ l  x8 U/ k3 M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& ~5 e5 R2 T: B% T( p- W# X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. I! g) M0 W, q' W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ E7 Y7 [' S, _5 b" r3 `

1 o" c' d5 l+ @
+ [. K5 t$ ]: X( d$ d& n: L* B  Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-9-16 14:30 , Processed in 0.037618 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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