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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 e+ P( j2 j: L, _
  1. [code]EDMA sample test application' ^) ~$ S& b8 A, y
  2. /*! z- q5 c' {2 u2 q2 t* b7 _( d
  3. * edma_test.c/ {* `9 i2 h, \! D2 ~' {8 h
  4. *
    4 J4 \/ I# E' m- z
  5. * brief  EDMA3 Test Application
    7 \8 }/ w* I2 D7 z( ?
  6. *: c  P& v) k: u- u2 h- o) E; L
  7. *   This file contains EDMA3 Test code.. w6 W8 ?, ]$ B$ c1 C( S7 t2 T6 ]
  8. *+ ]9 }! l& x. v0 h; z$ r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ F, {* r- `- ?& K) t5 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! a4 H% r" e1 S, m2 a* y
  11. *         TO CHANGE.
    + ?5 F% d: x, T; T0 [
  12. *
    ! l) B% E. _* C* x" e: q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 I- v  I( t3 `: }& _  v
  14. *
    4 L5 R* N6 Q: x0 g# ?  \- ?
  15. * This program is free software; you can redistribute it and/or2 w/ |8 l/ j: {8 B0 i' O
  16. * modify it under the terms of the GNU General Public License as1 H* A" ~/ \3 c
  17. * published by the Free Software Foundation version 2.1 b/ K- O0 A  O4 h- n
  18. *6 B7 A9 J/ \8 v3 U: i, ?: R$ G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # {7 P' [1 `2 C8 ?
  20. * kind, whether express or implied; without even the implied warranty! {' q3 B2 T/ A  ?! [  S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # p# F8 |1 ^# s/ r$ l+ r
  22. * GNU General Public License for more details.
    ( w6 D. Q% K% L3 X4 [2 l. D
  23. */7 I! m0 E6 e6 e# V& b2 I
  24. 3 K( v4 y  f) v9 M' v
  25. #include <linux/module.h>
    / G% ~3 M2 ]& B4 Y& W' H
  26. #include <linux/init.h>
    ; Y  w! x8 y# T/ }4 p
  27. #include <linux/errno.h>  P) J4 S7 O& M) e
  28. #include <linux/types.h>4 Q+ G* n' \* E$ c9 ~2 ~& K" g
  29. #include <linux/interrupt.h>8 x5 x0 u/ m- ]" ~) w! q
  30. #include <asm/io.h>( B# R! k: h6 V
  31. #include <linux/moduleparam.h>+ m$ z7 T: @3 O) G! z" f+ v
  32. #include <linux/sysctl.h>
    4 T( \; Z! S+ T$ n) N; Y( p7 d4 b
  33. #include <linux/mm.h>0 C7 w% o& c4 M5 z9 q/ Z+ v( u8 |
  34. #include <linux/dma-mapping.h>! R0 t2 I. k. C# [, g

  35. 7 \6 E0 s5 L: ]1 e, }: W5 ]
  36. #include <mach/memory.h>
    1 I# i, P! r2 `" [, o8 t; M( Q
  37. #include <mach/hardware.h>
    3 Q/ a  `/ }. J6 @
  38. #include <mach/irqs.h>) y, W7 P' i. Z! G4 Y# }* z
  39. #include <asm/hardware/edma.h>! i; Q* I2 ^! }% C1 o: |

  40. ) y9 V( x# [9 s1 h; M
  41. #undef EDMA3_DEBUG+ l2 m4 Q# n6 h7 E2 D+ t1 |3 i2 K
  42. /*#define EDMA3_DEBUG*/
    , ~5 F/ h1 s7 H; N

  43. 3 d3 I0 _. B" r2 F7 P' @# N( L
  44. #ifdef EDMA3_DEBUG
    / v# Z) O- c1 F5 I2 o2 w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% Q' c# R& O: Q" ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 @6 q/ B3 S. z) h' j' s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) i7 Z  S  v8 W7 O
  48. #else
      c, J% f  ~: ?4 H( C5 G, E
  49. #define DMA_PRINTK( x... )$ Y& s8 t# Y+ U( F- ?$ y# ^: M+ N
  50. #define DMA_FN_IN
      y, T0 S) x2 k, K# e
  51. #define DMA_FN_OUT% Y: b4 ^6 ^7 U- R8 S
  52. #endif5 g, ?. p/ e+ I( e6 P$ z+ j. Z
  53. 6 y! a( E) Y' ?1 u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 `3 ~4 q' F- F( t+ O& z+ O2 ]. r
  55. #define STATIC_SHIFT                3
    % b3 ?; y7 S8 o; G; l+ c, K$ Q5 P9 j
  56. #define TCINTEN_SHIFT               202 M3 X- w. A" h2 j
  57. #define ITCINTEN_SHIFT              21
    8 z7 j) M, z: P3 ]# d' D
  58. #define TCCHEN_SHIFT                22
      U0 R' y/ }: V3 z+ p& t
  59. #define ITCCHEN_SHIFT               23! R& \. Z0 U9 r% P1 Q' B' [/ a# Z+ H8 I

  60. " y: B! `8 p5 ^! _( b/ W/ g
  61. static volatile int irqraised1 = 0;
    $ c' C) g( j: f, [% u
  62. static volatile int irqraised2 = 0;
    ) K: u) J5 I; t4 }; l
  63. 4 N* q" \' F1 N9 b- f9 B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 v" t% X3 a8 U2 d2 J# V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 `* u7 X0 k' r+ b/ m+ I3 I! c% i! r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 {* C8 v6 c- I

  67. ( _1 d; ~  c2 Z" w
  68. dma_addr_t dmaphyssrc1 = 0;
    ; U8 u( m' v: G) P% _
  69. dma_addr_t dmaphyssrc2 = 0;
    . Z8 S3 M$ m$ W+ F2 s
  70. dma_addr_t dmaphysdest1 = 0;
    ' j* ~1 f! a, O) t5 n7 n  B8 X
  71. dma_addr_t dmaphysdest2 = 0;
    ' E# q1 X2 Z, [- g& N' k- s
  72. 6 Y& `8 i- ?4 {! J$ g6 p) w$ o2 X
  73. char *dmabufsrc1 = NULL;
    5 _6 N- S+ w5 M' p7 Y
  74. char *dmabufsrc2 = NULL;
    * L, F: w7 w" m& D' M. J/ w' d
  75. char *dmabufdest1 = NULL;
    0 u" x$ h9 F. U
  76. char *dmabufdest2 = NULL;
    6 q$ G# A/ W2 i4 P9 }8 ?3 e

  77. 1 i" H' l: x( h6 w% I& n9 R
  78. static int acnt = 512;& [6 J8 ]% z- |# y* X5 n+ X+ \
  79. static int bcnt = 8;
    - `* S! f# N$ a1 P8 Z. ?! L& i
  80. static int ccnt = 8;3 X+ i" P, G9 k! r: K2 d& `

  81. ( j( p6 y! ?. A- K
  82. module_param(acnt, int, S_IRUGO);% T5 y. H/ G. b" K1 Y; f
  83. module_param(bcnt, int, S_IRUGO);7 n* @; }5 z( y" ~7 q: G6 a& \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, D  m: A8 B: e" \: [3 z1 L- |
) t; L) e+ F) ?3 ~) ^6 K& B0 A      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 N' H0 k1 N) 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- c; {- G9 {2 I4 e6 d# V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, E8 I$ x) k" D" x3 z% U

* f4 s. Y6 n: r4 }; ~5 d: ?8 v# p  y4 O* U3 z" l* w! q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-5 17:56 , Processed in 0.040029 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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