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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 d6 D5 |  {- M: {' z% S& M( `
  1. [code]EDMA sample test application
    # ~1 [3 Z. u/ B9 _
  2. /*
    7 _" X  Y4 a; @  J$ \& m" h
  3. * edma_test.c
    * }& I" C- C0 K2 n8 T5 g% T
  4. *
    ) G+ Z7 W1 r2 p& p3 Q! _: h
  5. * brief  EDMA3 Test Application$ T' a, o9 j" o" s
  6. *4 g4 x1 _+ v3 g+ ?8 _" s% m9 I5 K0 h
  7. *   This file contains EDMA3 Test code.* d. L4 D( c, o; m
  8. *
    , _9 N. ?& r) T0 E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % A, S: L" t' a* z! ~/ B. H3 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" t" l) @9 b/ B5 U* F
  11. *         TO CHANGE.
    9 ~( `; `( M& A- z  W' R4 D
  12. *
    ) J: j4 V4 V3 x! k( v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 |8 J4 v5 u, k5 C  {
  14. *! k9 d/ M; t. {, K: E9 m
  15. * This program is free software; you can redistribute it and/or4 U9 D+ @, A' |9 N, a& C
  16. * modify it under the terms of the GNU General Public License as
    : j" P" d1 Q4 ]3 k
  17. * published by the Free Software Foundation version 2.; M1 r0 ^0 B0 t- B# x
  18. *  |7 G  ]; U4 B9 N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 X7 |; |! x' g
  20. * kind, whether express or implied; without even the implied warranty" o( j& N6 C$ O  Y! C5 W/ s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. h' X2 ]6 Z; i4 W
  22. * GNU General Public License for more details.0 i* w6 ~# Z5 R$ K0 h1 M3 K8 B  t
  23. */: P6 I7 z* b$ O6 X% q

  24. / E* ~% B% `5 j' y/ k
  25. #include <linux/module.h>
    9 @& c% c: o( X7 t0 G# n
  26. #include <linux/init.h>3 ?/ t5 q" ^: M, d2 }- ~& K) Q0 ]
  27. #include <linux/errno.h>% D' D  |2 T- S. \* W) y) k' S
  28. #include <linux/types.h>6 e( o1 ~" {  k7 n* S$ x& |
  29. #include <linux/interrupt.h>8 k) O* S! X) `0 ?7 Y9 [( j- q
  30. #include <asm/io.h>
    ; l8 \1 q9 f9 @8 @# {0 T: K# d
  31. #include <linux/moduleparam.h>+ N7 l" }6 Q  v8 t3 D( y8 v6 K, [
  32. #include <linux/sysctl.h>
    $ i! L3 k0 \; Z! D( O
  33. #include <linux/mm.h>
    ! L# V) d. K5 y( ]! ^: m
  34. #include <linux/dma-mapping.h>
    / _- l7 J; w- }; a6 h3 n! ?
  35. 1 V' D5 a5 F( B
  36. #include <mach/memory.h>
    ; B' H3 X* M% p) }
  37. #include <mach/hardware.h>
      o- W. K/ ^3 V4 j
  38. #include <mach/irqs.h>8 x. N* W0 W4 R: M) c; y
  39. #include <asm/hardware/edma.h>3 U. C, [" k1 v& [0 ?- o2 i& f
  40. 5 N" n3 B3 ~  x
  41. #undef EDMA3_DEBUG
    5 \) y0 ^2 h) w6 F/ k
  42. /*#define EDMA3_DEBUG*/, x0 E6 I! F/ v& w  {

  43. 4 W6 U0 H8 J) Z
  44. #ifdef EDMA3_DEBUG
    5 ]% L! C( I: L5 W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! ~5 a0 }9 Y6 u  D6 K/ S& Y" [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # o5 j. T3 J! \+ ^6 R4 \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ j& F5 S' Y1 q3 d5 S/ d' H
  48. #else
    ' O2 n1 u+ s6 G  R
  49. #define DMA_PRINTK( x... )
    , v& _# \" z+ e- e
  50. #define DMA_FN_IN/ @: C$ @/ ~! ?
  51. #define DMA_FN_OUT& h( L9 y, f) Y  P+ g( h: n  A
  52. #endif! T: r( j2 ~1 ^: h- i* M
  53. 0 B. c# M! i- l) u7 B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# Z7 n3 [+ s4 R$ a, W! V+ H
  55. #define STATIC_SHIFT                3: `6 }, |  t7 E; @7 H% g3 B" p
  56. #define TCINTEN_SHIFT               20
    ! E( Y. ^# D) p
  57. #define ITCINTEN_SHIFT              214 x  ^2 s- @  [6 U$ ]2 g
  58. #define TCCHEN_SHIFT                22
    4 z/ I9 w; I2 \( R+ `
  59. #define ITCCHEN_SHIFT               23
    8 s' x# ^* ?# y9 b7 z- m: T* N
  60. + A7 P0 \% s4 i4 s$ |; \  S
  61. static volatile int irqraised1 = 0;
    $ N% `4 f) I$ V8 J3 a$ P& L) W' w; q
  62. static volatile int irqraised2 = 0;
    7 W* W/ y3 c6 `7 Z/ Q5 m

  63. # F+ j# b" s$ X6 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 b; M7 f1 v4 C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! a. V. o2 C7 `- U% r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + A5 P7 M3 e; m! d# W6 R

  67. 2 o. @6 q/ [9 a
  68. dma_addr_t dmaphyssrc1 = 0;
    $ e8 e: y1 B, H( C" F. W- |6 k
  69. dma_addr_t dmaphyssrc2 = 0;# Y# ], ~* T% r8 a
  70. dma_addr_t dmaphysdest1 = 0;& U% O. n: m/ @8 R& R/ ?* f
  71. dma_addr_t dmaphysdest2 = 0;
    + s$ A" K& a# z  z

  72. : m9 ?* z. c( w) }1 N6 U5 B
  73. char *dmabufsrc1 = NULL;5 l9 {! i  ?( l6 N! z3 F3 v
  74. char *dmabufsrc2 = NULL;! c' n. w+ g& R0 `
  75. char *dmabufdest1 = NULL;( |, n  f4 M: J, ]0 V
  76. char *dmabufdest2 = NULL;& J7 u+ X/ Y5 e2 O: y1 L: q0 |
  77. * V/ t9 }, o* ^9 g/ J. Y, J% s: `
  78. static int acnt = 512;
    % t0 U, z0 d8 d
  79. static int bcnt = 8;0 c3 X* O/ w, i2 T  K3 a
  80. static int ccnt = 8;: ~4 J# j3 N2 U- ?, D' \1 h6 x6 g

  81. 0 u; b0 T6 |+ A! C1 U- e3 L, A, a
  82. module_param(acnt, int, S_IRUGO);
    7 ~; T$ Q$ c( H4 {
  83. module_param(bcnt, int, S_IRUGO);
    ' b$ s) o1 {/ l$ v0 h- c) b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( i" y+ ?7 D5 g7 P8 a, ?. }4 f1 t

: L1 u0 q7 J$ B9 T      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) M3 `1 y' k1 E6 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 s) j. n% ?9 {9 p6 z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 r* ?& w7 b; m$ X; w( R3 b! V0 h# G' `$ C- t0 B- A- T8 h

7 U4 X+ M4 Y% ?- J5 S0 M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-22 06:14 , Processed in 0.039007 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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