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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . @& f5 X# {! j+ J1 a( t+ [! a# C
  1. [code]EDMA sample test application* k/ N& }" X, G9 R/ u4 @# s* q# Q
  2. /*6 Z0 ^' [5 Z$ @- b7 ?0 S2 |8 a
  3. * edma_test.c% q9 R& P& b8 I3 a  s9 Z
  4. *. T9 a2 Y& B2 z& y  h7 h, ]
  5. * brief  EDMA3 Test Application4 `$ W% E% L- D
  6. *
    5 g: ~- v+ c, d; {1 g2 D" e! b7 v% I) B
  7. *   This file contains EDMA3 Test code.
    ) G  b# a  u4 E8 a
  8. *! y: k" q3 d1 a7 b" O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + r6 f- M* R( m; w% D+ b. H9 o0 L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* W8 |$ \# `, Z: a* @9 z. w1 B
  11. *         TO CHANGE.* @, `6 s" k. V
  12. *& a; F6 Z9 R7 G! `. X0 ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      \/ [  }2 d( y" c
  14. *7 ]4 U: i5 }' L* z+ Y( q/ H- N
  15. * This program is free software; you can redistribute it and/or5 l1 x+ }8 i: @% U* F& n
  16. * modify it under the terms of the GNU General Public License as
    & ?/ O/ n: ~- k: p0 r
  17. * published by the Free Software Foundation version 2.- T5 w  w6 Z3 @1 M/ l) D8 ^
  18. *" o2 T  H8 E- E) J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 P- r% o# `, q: O! D' r
  20. * kind, whether express or implied; without even the implied warranty
    9 F" o* U  x9 w1 R4 G  n+ m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 A" A2 |! w( d% b% q
  22. * GNU General Public License for more details.
    ; M7 E" S% U$ r. U7 A, }& B
  23. */
    , }9 n, |, R) s$ k& q

  24. 8 H; c3 `; B& g2 y* L
  25. #include <linux/module.h>* _) P+ y) Q6 P) o; {
  26. #include <linux/init.h>
    ( b$ y" b! F& ?4 |9 |( Y
  27. #include <linux/errno.h>
    ) }2 i' L+ T1 I2 q4 j" y, R
  28. #include <linux/types.h>
    9 \6 D! G- i8 F. m1 i
  29. #include <linux/interrupt.h>2 v0 ~( r: q3 ?6 g+ a* V
  30. #include <asm/io.h>/ j4 I+ e& ~0 ?+ Q
  31. #include <linux/moduleparam.h>
    3 r3 N9 d3 X. U- `
  32. #include <linux/sysctl.h>. [" G( X3 A, {& U/ y! _! {
  33. #include <linux/mm.h>& j2 N! n# p: M2 Q7 Y1 ^0 h
  34. #include <linux/dma-mapping.h>: y6 s- T& c) @
  35. ! i9 C: ^' L2 m) S6 I
  36. #include <mach/memory.h>
    2 V2 H8 t5 V' n& E
  37. #include <mach/hardware.h>7 b! p% I$ E" l# p3 v
  38. #include <mach/irqs.h>
    " p0 o1 [: M) F2 G) J) ^; A5 ~$ y5 i
  39. #include <asm/hardware/edma.h>, m: J- D% c2 Q6 x
  40. " {% i  F7 i" k
  41. #undef EDMA3_DEBUG* e8 G! e$ u+ G7 K8 Y. M
  42. /*#define EDMA3_DEBUG*/
    $ w' B: e0 U. |9 j4 _  w3 G9 A# n
  43. 7 W7 ~1 `: c$ n: u6 f
  44. #ifdef EDMA3_DEBUG
    * ^3 I" m4 A) l" v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% w( ~7 O& F, O0 h+ j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " y1 L% U1 ]0 s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). m! ]9 T1 s) X3 K3 h/ {  i
  48. #else" d/ C& D) t& z" o+ O$ y) @! S
  49. #define DMA_PRINTK( x... )
    5 y8 m9 |- w3 E% Z0 [. F
  50. #define DMA_FN_IN
    7 ~1 [! I2 N! o
  51. #define DMA_FN_OUT
      s- @, {* e: a8 X7 q% ^
  52. #endif' e9 d. r1 Y1 b  z  x
  53. 6 t+ D2 n  l3 e' l; c7 `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) d0 J1 P% Z9 a0 r% \
  55. #define STATIC_SHIFT                3. t8 h; r; D% r2 K0 G; h
  56. #define TCINTEN_SHIFT               20( r: W5 I) j+ O2 ]: Q: z$ d
  57. #define ITCINTEN_SHIFT              21, e$ @2 u0 v# Z  A8 z
  58. #define TCCHEN_SHIFT                22
    ! K/ s" R+ }" }$ W
  59. #define ITCCHEN_SHIFT               23
    , _0 w! C# L! L- H  `/ C$ q

  60. # Y4 d& Z9 a2 \, f& _: E
  61. static volatile int irqraised1 = 0;
    1 g4 ~/ Y( r$ |  U7 R5 K0 U. Q
  62. static volatile int irqraised2 = 0;
    ( p: r: U% G9 y- G
  63. ; E0 T  d/ ~9 Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / m' ~2 s; R. u/ X% s- O2 ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 K% q" k! l/ J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 b2 O4 d7 G/ Y. m; o

  67. + J5 p- m5 t6 x- S
  68. dma_addr_t dmaphyssrc1 = 0;* L. T: B. E3 G& O
  69. dma_addr_t dmaphyssrc2 = 0;
    $ a8 w  i; V3 q( D
  70. dma_addr_t dmaphysdest1 = 0;2 ?, b% P. b1 l" `8 _
  71. dma_addr_t dmaphysdest2 = 0;
    # H6 y% i7 |+ k0 Q7 r+ R* g* J

  72. ( y1 }5 Y9 S4 [$ `9 e
  73. char *dmabufsrc1 = NULL;" i" K+ h  C+ d) \9 q
  74. char *dmabufsrc2 = NULL;, `" q  U, S* P6 a; n7 y
  75. char *dmabufdest1 = NULL;
    3 S+ G* J3 q) \) {) B: M* K! r5 R
  76. char *dmabufdest2 = NULL;
      ~) `( x, ~0 a5 q' j

  77. ( [: C& c/ _2 y; F
  78. static int acnt = 512;
    8 Z& E/ I2 k# r# F, q" @
  79. static int bcnt = 8;, }( S8 a+ v) }
  80. static int ccnt = 8;
    + X8 f! }+ v! t. h* f+ v

  81. ( M5 s2 e0 k2 h3 _/ ~. s
  82. module_param(acnt, int, S_IRUGO);
    , `. q  r6 j7 B. g; Q1 M
  83. module_param(bcnt, int, S_IRUGO);
    : x; F" T) n& |) [& L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- z* G; _2 n. M5 A
! x/ G# h  x$ X! |9 i      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ ?9 N' e% x6 C* Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' }' C) F- l  H1 `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ B' W# [5 l6 M4 ~7 v$ r
: v8 M( F3 f7 U0 ^
( F, w6 J% O" x: _+ a  K# t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 08:00 , Processed in 0.039741 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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