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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / g; u" q- |7 C3 Y, @
  1. [code]EDMA sample test application/ H. W# K  b6 K, t; X, s
  2. /*
    / E) X- T+ l: q( h9 T5 g
  3. * edma_test.c$ t8 n! F6 n: u( c1 J, q9 r
  4. *
    7 t. v0 E& Y8 x/ e, R
  5. * brief  EDMA3 Test Application; r- k, f( L# a- T7 g
  6. *: u2 u2 n6 [$ b; I( ]& E
  7. *   This file contains EDMA3 Test code.5 Y, N9 |* j& T0 W( [& f
  8. *0 C+ B# E, c" ~/ O! ]; q; V, t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 S, x, i! a6 Z. C/ n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 e" `0 r# ?( |% N2 A, E
  11. *         TO CHANGE.9 p; D& p4 Y+ k) z$ D  A" e: X
  12. *) G6 L; B# @7 |7 n. t+ H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 ^' I4 t4 O7 b6 m$ b; `
  14. *
    + |" Q7 D( K7 M* k
  15. * This program is free software; you can redistribute it and/or+ _* N5 }  a' O  M
  16. * modify it under the terms of the GNU General Public License as5 h, J+ Y4 W( L/ }* y! f: X
  17. * published by the Free Software Foundation version 2.
    8 }! [" i" d0 E0 w+ P1 K! C
  18. *1 p( }, L' P& l+ _3 t/ i* V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , O8 A, [0 X+ @2 i- L9 g9 `
  20. * kind, whether express or implied; without even the implied warranty0 F9 P5 ~- J; o' z9 V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) t/ f* {6 V; o; J
  22. * GNU General Public License for more details.
    ) a& S4 G% q, y4 ~8 g$ _) `# Z
  23. */, t! \" S0 s, Q
  24. 0 @* {  O3 G4 U& |! T  P7 ~6 J) S. ]$ U
  25. #include <linux/module.h>4 Y: M! u* I5 t6 j* f" Q1 {
  26. #include <linux/init.h>7 H0 W$ M4 `, T" K4 E9 A
  27. #include <linux/errno.h>
    & l7 ?+ G, I' y+ d& e
  28. #include <linux/types.h>
    / j+ {* V% {% S3 P9 Y
  29. #include <linux/interrupt.h>
    / X( F- o% D! k! z
  30. #include <asm/io.h>$ o7 U- d1 O0 W2 g' @. P
  31. #include <linux/moduleparam.h>+ C% g2 a1 p/ J* R
  32. #include <linux/sysctl.h>
    : D3 g- N, ]: E+ Z
  33. #include <linux/mm.h>
    & j7 I: C$ N2 q
  34. #include <linux/dma-mapping.h>/ F7 H0 ]- e3 G- L8 o

  35. * Y( j# o, K  ?
  36. #include <mach/memory.h>
    7 b, [; i' t- E. |& h" O  Z5 A
  37. #include <mach/hardware.h>
    + V2 y  p* P, y  o  G5 b
  38. #include <mach/irqs.h>& o  M/ Z8 Y  _) z5 T8 }
  39. #include <asm/hardware/edma.h>% q5 ~' R: r" e" F/ G% P, @( Q
  40. # p9 E& f2 E% V) n; a5 u, o
  41. #undef EDMA3_DEBUG
    3 E" j' c! v* w9 o
  42. /*#define EDMA3_DEBUG*/, P$ P" \; L8 \+ {% \8 n
  43. 0 ]$ R4 \% ?7 C7 h" u3 w
  44. #ifdef EDMA3_DEBUG. Z9 i' U# K, Z1 M9 n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' F2 }; |# D: q- y; L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * m: f5 y0 A8 B3 {$ V- M( D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % x+ a4 }/ c% F5 m" X+ n
  48. #else6 b. z8 W5 E" ?# I5 G- `& M/ J% ~
  49. #define DMA_PRINTK( x... )
    : @& Z; D1 h) Y* H8 q8 k
  50. #define DMA_FN_IN' a* s; a; F  ^; k8 Q# b
  51. #define DMA_FN_OUT- t9 W& R, r5 `0 Z
  52. #endif5 u( P( q& r! Q) @& F* o; M7 q

  53. 4 l- y" v& J+ z& A4 z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - f4 x2 b4 e5 b* |% B  k5 F( c
  55. #define STATIC_SHIFT                3
    0 ~5 x7 S2 S5 x, y$ U; h
  56. #define TCINTEN_SHIFT               203 _- b& d' f* ?$ Z
  57. #define ITCINTEN_SHIFT              21
    2 \6 r# q8 g3 D$ {# L3 ^( Z, A
  58. #define TCCHEN_SHIFT                220 J1 [/ }- w5 s0 B; u" ^6 v
  59. #define ITCCHEN_SHIFT               23
    3 v' k! h. o3 a' s5 y

  60. " M$ }0 Q/ N5 x8 T9 H9 a+ n
  61. static volatile int irqraised1 = 0;
    % N+ J8 o! |- A% S9 U- B6 f
  62. static volatile int irqraised2 = 0;
    - ~' Z5 ]( z3 _! J+ F
  63. - v7 Y8 l9 r& l0 p) @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ e4 x* w  W4 H1 }4 r7 T) }3 S5 |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 K. R, S5 x, n1 r/ z5 {: I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - x* \5 j. Q( h! y: p/ ?3 z. X
  67. # E1 d& l6 o+ E! c
  68. dma_addr_t dmaphyssrc1 = 0;
    ; W  \) O! D+ q, D, t5 w9 `
  69. dma_addr_t dmaphyssrc2 = 0;
    " V0 Q) M* u$ ~$ v7 G
  70. dma_addr_t dmaphysdest1 = 0;
    : e/ Z4 W! t7 G1 K8 `
  71. dma_addr_t dmaphysdest2 = 0;
      w& i/ r# U4 U

  72. ' ^3 s! {. Z) ^2 V  X- S3 v
  73. char *dmabufsrc1 = NULL;
    7 N9 r7 ~  f; o. {
  74. char *dmabufsrc2 = NULL;
    1 h; Q' o0 ]6 A3 u) z
  75. char *dmabufdest1 = NULL;0 E. o+ {! _9 x: |& m6 x7 f
  76. char *dmabufdest2 = NULL;
    " h; Z' D( Z' F: n
  77. / `; e: i5 X. M9 T" d
  78. static int acnt = 512;( T3 ~1 ?$ S9 q* C1 j
  79. static int bcnt = 8;) G8 S" y# _; q; W
  80. static int ccnt = 8;0 B6 p! ]; M6 S' b) S2 k
  81. ) d% }2 B9 m& a$ O3 n
  82. module_param(acnt, int, S_IRUGO);/ |" v; @* [; \7 @7 X( J
  83. module_param(bcnt, int, S_IRUGO);0 C1 v  {% b0 n  W' V. H+ U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# Y+ b, u' E- i3 a
6 a4 O8 P5 I! ^& T2 r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ t3 M* Q5 Y6 B- s) ]  ]
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  X* z7 X# H9 G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 g: Y/ m8 g' @" u) G
) t$ u* ?# n$ M7 Q
3 d5 e# d: t* Q7 Y$ P2 T( b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 04:22 , Processed in 0.038505 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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