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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( ]; y4 s6 a8 e% P1 v
  1. [code]EDMA sample test application! _. w! V: K, W, Z' x! P" L( B
  2. /*
    . t4 ?) p8 k- Y2 k
  3. * edma_test.c
    7 c' i$ K4 n' E8 t; M4 T
  4. *9 a7 Y; E2 ]. h9 J8 m* T" X2 d
  5. * brief  EDMA3 Test Application9 X  x+ K( j; G5 D" _- n
  6. *$ r' O2 v* @* K$ [2 H- f
  7. *   This file contains EDMA3 Test code.* J3 s2 f2 K* n1 K- k
  8. *5 S9 `4 T* E7 t/ @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 s  `& R  V' p9 ^# X, ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 T, f" R3 z  j4 u- S8 E
  11. *         TO CHANGE.
    # K/ \- X  W0 w' g  [5 m/ n
  12. *
    2 p5 ]8 @+ F% E2 S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 M' i1 W7 p8 L0 F$ f9 d) o0 K
  14. *
    ( ^; b$ |% @% E: @6 D
  15. * This program is free software; you can redistribute it and/or
    % u/ v) n1 y4 X: h1 x: ]5 r) }8 ~
  16. * modify it under the terms of the GNU General Public License as
    , \/ b$ d! x# I! o) h+ |) O
  17. * published by the Free Software Foundation version 2.( b! [) h  Q' i$ k! T" V# M% e
  18. *+ C6 ~+ h0 W0 z) K# I" b1 c- C2 V% Q; y% j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% s0 t* x2 k- D8 m/ \
  20. * kind, whether express or implied; without even the implied warranty
    : v5 T7 L! F; W& R: N/ k  Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % m/ `% G! F6 j5 D/ e
  22. * GNU General Public License for more details.
    + F" ?. r. q/ x
  23. */
    8 e6 V9 t8 s  h2 m6 E

  24. 9 ~: m3 u4 y* m: {5 C& w6 _3 O
  25. #include <linux/module.h>  N' ^6 h' V6 H) g+ G
  26. #include <linux/init.h>1 L1 q6 Z$ `$ s0 V
  27. #include <linux/errno.h>5 A: J( q& `9 Y- w! h* I
  28. #include <linux/types.h>
    & V; [# z' h! q% Y
  29. #include <linux/interrupt.h>+ I  c: f& i- s! l) [
  30. #include <asm/io.h>3 O$ y+ h, E( O5 u
  31. #include <linux/moduleparam.h>/ L7 L$ e( G) \; T& s! H; |% f2 M
  32. #include <linux/sysctl.h>
    : g/ P- _& m) ^/ P; n
  33. #include <linux/mm.h>% s& i5 D- f% z+ ?; V5 F
  34. #include <linux/dma-mapping.h>4 x' `: b& O$ J/ p( @

  35. 4 u5 g- N, L1 T- O& K5 ^
  36. #include <mach/memory.h>  R9 @& f: Y2 m9 L- q
  37. #include <mach/hardware.h>
    2 \* n4 S& `( U; D
  38. #include <mach/irqs.h>
    0 B/ C) p3 ~2 i& F, n5 j+ o. {" z
  39. #include <asm/hardware/edma.h>, G, Y, M3 ?& _  _1 k

  40. 8 O4 U, W4 u& e7 ]5 i+ N
  41. #undef EDMA3_DEBUG1 `' L, c2 v% E: P9 I* r  k6 y
  42. /*#define EDMA3_DEBUG*/3 ^/ }& r3 d% ^* m$ a
  43. 1 D  x3 @4 E4 [; ]; Z
  44. #ifdef EDMA3_DEBUG
    8 z$ y: }9 x$ W: j! K/ h% S" T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' N. Z; ?& ~+ u, y0 G6 X+ |0 n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 Y/ S. h# x2 v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 \" q3 A; P6 ~# S" }, M8 _
  48. #else
    ( `; p, _* ~  h3 j/ \
  49. #define DMA_PRINTK( x... )
    $ z$ z) i+ i. f! R# g7 A7 i( G
  50. #define DMA_FN_IN* P6 N6 w; ]1 i! ]- v
  51. #define DMA_FN_OUT( A. L% X  N3 g3 w& p
  52. #endif: o- R! J1 {+ C: ?

  53. * u! Q* B  w0 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 H; i* A' s/ s+ q0 b
  55. #define STATIC_SHIFT                3: o9 `: B; R) ]
  56. #define TCINTEN_SHIFT               20
    4 R0 ~$ J5 H3 F  g3 w
  57. #define ITCINTEN_SHIFT              211 |, V. m: }: K; h  R# }2 I
  58. #define TCCHEN_SHIFT                22- F# u* Y7 h9 P& [) i' h6 l+ C
  59. #define ITCCHEN_SHIFT               23
    + [8 r' C$ x+ |7 ~

  60. $ \# v  ~! \% L, [0 K3 n9 Z
  61. static volatile int irqraised1 = 0;: k" V$ j: C- F) _+ s7 o
  62. static volatile int irqraised2 = 0;4 I4 ]' h. W' W9 F* e5 J

  63. 8 {. U& a' y- f; H2 M# `  U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 @' i# d. z. l) Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 o+ c8 h! ]0 N6 C8 u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* r9 }5 G7 F/ Y; A& U

  67. 2 s5 E$ O$ }9 g. t
  68. dma_addr_t dmaphyssrc1 = 0;
    3 t$ ]( ^% N) I4 Q* P& L
  69. dma_addr_t dmaphyssrc2 = 0;
    1 {) {- {- R. R  J  l
  70. dma_addr_t dmaphysdest1 = 0;1 p5 H6 U/ W7 _6 l& g
  71. dma_addr_t dmaphysdest2 = 0;8 U. V% a* ]! W$ m' f. d% A! Z6 Z  u
  72. % g3 p9 v8 Z7 I4 w0 ?
  73. char *dmabufsrc1 = NULL;: j: b% K0 K' X1 l
  74. char *dmabufsrc2 = NULL;  @4 s/ I+ m9 U: j( w: n$ P1 ]+ @
  75. char *dmabufdest1 = NULL;
    : l1 R; J/ a9 ?
  76. char *dmabufdest2 = NULL;
      ~0 n2 J2 o8 V8 `5 X9 h
  77. / g  h6 w4 t& I) C: E
  78. static int acnt = 512;
    + v1 x+ ]; B: Q! _& i
  79. static int bcnt = 8;
    6 z8 S! ^6 C2 u- o4 N9 C
  80. static int ccnt = 8;
    9 w& `, Y7 W4 J+ C/ p! _' i

  81. 4 N7 H4 v6 G8 z
  82. module_param(acnt, int, S_IRUGO);( ~& A5 p& e6 ^' U: |2 S' z4 N
  83. module_param(bcnt, int, S_IRUGO);
    . C  @' K+ c! _5 f8 J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 ^+ g- m/ [9 d/ [& \$ |. P
& ?0 K5 S5 r- D" b4 L0 V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ [$ `) ~' @' M3 `( oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 p+ C. N, `7 b, b3 b1 K: g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# E% {4 w* P3 y! `( g2 p* r) h$ D$ Q  ]

- z5 o% u% X; o" V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-22 13:04 , Processed in 0.050031 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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