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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 A: r# s# w& g5 E' P' y
  1. [code]EDMA sample test application" a* f* `0 A& S9 a
  2. /*7 j8 c, w! }/ Q. R( S
  3. * edma_test.c$ S! }6 n7 r, K! ~0 c5 w7 S+ X0 Q
  4. *
    . K, B! x% W( \& l* H0 \- e
  5. * brief  EDMA3 Test Application
    ) z2 `8 J* J# i
  6. *
    + a8 k3 M) {# e; A. }6 Z
  7. *   This file contains EDMA3 Test code.
    5 p' s8 ]& X$ H0 @9 M( K# T# C
  8. *
    / q/ x3 w4 A  P9 I" w8 M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - P: C' R# }- m$ I. Q& `( `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 F8 F& C5 V; h6 J+ N2 y# D
  11. *         TO CHANGE.
    . O  L* ^. ]4 [( ~0 q
  12. *
    ' u; m; \# g3 }: J7 f" Z5 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & \% ^+ ?: E/ f2 O# ~$ ]2 L% b
  14. *
    ( {' @& J1 ?$ V
  15. * This program is free software; you can redistribute it and/or
    $ Z0 v" w2 S6 w0 b
  16. * modify it under the terms of the GNU General Public License as7 y  L: g- {  }  x' F
  17. * published by the Free Software Foundation version 2.) s- x! i: V: `' X; X
  18. *! F5 K+ a- T5 p# \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / J: c# S/ L. J/ N5 [5 |' L! }% S
  20. * kind, whether express or implied; without even the implied warranty
    ' I. `/ ?, w) n) W, o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 i6 w  @( I: k/ x& D
  22. * GNU General Public License for more details.
      q: o/ b1 M+ r# d7 O; V) z" c
  23. */
    * c5 k9 M/ B+ H% n* U
  24. 7 E( Z3 q+ k5 E/ s( \
  25. #include <linux/module.h>
    - R; i& U4 i1 b
  26. #include <linux/init.h>
    + p3 b  D8 F. R' a
  27. #include <linux/errno.h>
    1 a* {* o5 T2 x
  28. #include <linux/types.h>0 k& |& }$ x% u
  29. #include <linux/interrupt.h>
    1 x6 |3 [' _5 A6 r+ A5 w
  30. #include <asm/io.h>- {; z' f/ D7 e
  31. #include <linux/moduleparam.h>/ A2 H6 G$ E0 ~" a
  32. #include <linux/sysctl.h>
    7 j7 E5 N+ N; `
  33. #include <linux/mm.h>$ K0 b* n7 E5 G6 Y' e
  34. #include <linux/dma-mapping.h>
    * G: b: B/ J7 w" ?
  35. 9 w7 q* x! j, ]) c" R
  36. #include <mach/memory.h>& `# b9 H! [3 q+ ^: W
  37. #include <mach/hardware.h>( u5 ^' x0 h/ c5 U
  38. #include <mach/irqs.h>3 O" C! M- V4 M/ M' r
  39. #include <asm/hardware/edma.h>( n) ~2 x. U0 r. x* a

  40. 6 w2 S+ p! f# v* p4 l
  41. #undef EDMA3_DEBUG7 W* A) k4 d7 \0 f
  42. /*#define EDMA3_DEBUG*/: \$ R9 [# w/ X
  43. , u- j2 Q; P: Q
  44. #ifdef EDMA3_DEBUG8 e+ T2 L9 z8 Y3 ]: s, g0 Z& I; v' v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 F& {, n& z9 r" f% s' Z8 a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - ?2 i3 ^& T; x, l" Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* |% [. J7 H' s$ [; m
  48. #else$ t2 \/ C+ G' o7 G' e3 s; T) V
  49. #define DMA_PRINTK( x... )
    ; H' L  h! Y1 G0 q3 t+ C8 e
  50. #define DMA_FN_IN
    4 j  x2 D; J) B% G: u, z
  51. #define DMA_FN_OUT$ R) q- i' \! ^7 Y* f9 _* }! [* a
  52. #endif
    : {$ U% g' i! \# A4 ]/ ]0 B; z: H
  53. , T0 O$ U9 Z, T# Q2 `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 S/ r& V9 n$ e! w- }+ [
  55. #define STATIC_SHIFT                3# |0 l' |+ A3 t5 N
  56. #define TCINTEN_SHIFT               20
    ' {3 n, D: q) z, _! _
  57. #define ITCINTEN_SHIFT              21
    9 y8 r; s9 \+ i  ^3 }: N! G2 P
  58. #define TCCHEN_SHIFT                229 y. m: U1 v8 v: [; b; B3 `3 u: c4 |
  59. #define ITCCHEN_SHIFT               23
    : q' q; A4 b6 J4 J" |- U
  60. ) O* J- H% E2 z' N) h; j
  61. static volatile int irqraised1 = 0;7 G6 W8 [# V' k2 `+ q
  62. static volatile int irqraised2 = 0;& L; D; Y1 V* d9 J2 k

  63. * `6 D) |. F- m- e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 K* R9 G0 ]* M1 y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# L  X3 \( R2 m5 c( w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " V4 q5 b( S  V3 N

  67. 7 n3 r0 h: a2 _1 v7 m! c
  68. dma_addr_t dmaphyssrc1 = 0;: E6 o) y! M- m" S5 p/ w; s
  69. dma_addr_t dmaphyssrc2 = 0;4 ?0 w. {5 Q% i" y+ {* S1 X: {# G
  70. dma_addr_t dmaphysdest1 = 0;/ u2 U$ I( t# d8 B* o
  71. dma_addr_t dmaphysdest2 = 0;
    5 |0 I6 B* l- [( I+ E
  72. 3 F; r' M+ l9 ?- ]0 ?- @
  73. char *dmabufsrc1 = NULL;8 _2 B5 }% K! R# I
  74. char *dmabufsrc2 = NULL;
    & b0 A& U4 ?* J3 j$ L1 `. A5 _
  75. char *dmabufdest1 = NULL;
    6 _& Y& a; u  c
  76. char *dmabufdest2 = NULL;
    # J9 A( F' Z6 I. s# g- k) A0 c: d2 x

  77. / [$ }! W: S) _& t: M
  78. static int acnt = 512;
    % _3 {; y5 T% w  h) Q
  79. static int bcnt = 8;
    ) j+ x- v/ a: C& j3 U* [0 `, B9 H5 C
  80. static int ccnt = 8;- b* q. o7 O$ S8 |4 ?- @

  81. 6 m5 N& A6 B0 w) p/ I
  82. module_param(acnt, int, S_IRUGO);
    ( e  X* p+ N6 j
  83. module_param(bcnt, int, S_IRUGO);) i3 @8 G1 G9 R/ g3 t
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 U9 n5 G# ^/ o% L" }& V: @5 C$ N. B
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 M( ^) k" j. @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& \8 y# s1 R. t) D( a8 C) c  T3 x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 U; m2 f2 n% l

! N7 t7 k1 d* L/ e$ `/ s: x& @* W" r7 S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-4 08:58 , Processed in 0.045786 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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