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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 P" g5 H% h: W) J" j
  1. [code]EDMA sample test application& K, x  ~/ o: z
  2. /*8 u0 E: {6 b, w7 U, F
  3. * edma_test.c
    , x" h( E4 B, Z* l, ~
  4. *9 d: [; w" j$ X3 A
  5. * brief  EDMA3 Test Application
    $ N. D) W1 U, d. C' [
  6. *
    1 }! Y. D0 v+ q* J
  7. *   This file contains EDMA3 Test code.
    ( b; w8 o6 ]* d
  8. *; x, d0 _. T4 c* t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* F5 M9 O: z# d7 j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) O0 A3 n6 T! F% {
  11. *         TO CHANGE.! s) J1 ?) G* V/ J
  12. *
    " {# L. x/ e1 ?5 N& H) ^7 p, t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 w& u0 t  g+ ]& j1 ]$ L5 C
  14. *
    " n- g& q$ v. F
  15. * This program is free software; you can redistribute it and/or
    & r0 I0 p3 w' ~6 m; S
  16. * modify it under the terms of the GNU General Public License as0 g1 z. m) L3 U+ d
  17. * published by the Free Software Foundation version 2.
    # u6 T6 Z6 C' w2 a7 E% ?% k
  18. *  ~# H+ t* k9 [$ Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ l: J2 H0 z6 o2 ^  Q
  20. * kind, whether express or implied; without even the implied warranty% d2 t4 Y$ F" ~, i' ?- I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 a% e7 W) I7 I0 `; D7 Y7 `
  22. * GNU General Public License for more details.$ M, y% ]" J2 k  `
  23. */
    ) |( k" u- [4 c6 E4 ~
  24. 2 I% d* J$ t" U/ ]. P- j
  25. #include <linux/module.h>
    : j8 ^, i$ r2 f. n" i
  26. #include <linux/init.h>
    # D( L: t5 U- ]) T9 ^# {/ [: I
  27. #include <linux/errno.h>
    : i$ n: b& |8 o  [1 [5 C
  28. #include <linux/types.h>
    - a5 V9 p, o7 e% b4 h7 U
  29. #include <linux/interrupt.h>: s- l3 M* S! w$ h
  30. #include <asm/io.h>2 i) G- {: k/ p" r) @6 E( C
  31. #include <linux/moduleparam.h>( P  @' x2 s2 B' |, v# U, e6 F
  32. #include <linux/sysctl.h>" H: D% f! ]: A# Q
  33. #include <linux/mm.h>
    + r: W) z: ]7 M8 m
  34. #include <linux/dma-mapping.h>4 u% a0 R: p$ ]+ `! @% T2 r( U

  35. 8 T9 n5 w" r, w9 n& J
  36. #include <mach/memory.h>
    ( ~, ^/ K8 e$ ]
  37. #include <mach/hardware.h>
    * Y+ m' i% k  e
  38. #include <mach/irqs.h>0 t% @' C  c" ~2 ^. R# e
  39. #include <asm/hardware/edma.h>! y% Y" b1 f+ B! \( d1 s
  40. 7 b6 m0 S/ m  Y. D# ?& Y
  41. #undef EDMA3_DEBUG" o, `5 g! T* n# r' [
  42. /*#define EDMA3_DEBUG*/* J- |0 q/ D& c6 t) j6 _
  43. ; b* z! J8 k( h5 P- O: l
  44. #ifdef EDMA3_DEBUG
    ! N5 W5 ~8 `0 |3 T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 D. c4 \1 ?  z1 ]/ B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! b! D' n: z) }- B8 a$ W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 g( L0 J4 d" E" h# v. W- Z  x
  48. #else
    1 i8 j* @% g9 {7 r
  49. #define DMA_PRINTK( x... )
    ' o! N$ e/ A  M8 ?
  50. #define DMA_FN_IN
    ) b* X$ T. R. h% l' \$ C4 y% h( Q
  51. #define DMA_FN_OUT
    1 h7 N; s& E# k
  52. #endif
    / y4 h; @2 Z) j% u! g7 h7 Y: W

  53. ( R$ F- `" Q; W' ~- m! a& T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). k( G* T9 j( l& ~
  55. #define STATIC_SHIFT                3- ~, {: E4 L7 H) F3 m
  56. #define TCINTEN_SHIFT               20
    5 l0 G6 E' x: E* \
  57. #define ITCINTEN_SHIFT              21
    6 ^) @9 b. {) ~) y: v6 [, z
  58. #define TCCHEN_SHIFT                22; H$ I2 Y' f& F
  59. #define ITCCHEN_SHIFT               23
    9 L0 s4 E: y7 n2 U" l1 J3 ^7 {2 j
  60. ' s4 `2 V$ H( V, j8 z- |3 W
  61. static volatile int irqraised1 = 0;0 e! N/ W8 N) ]4 j7 Q$ ?+ }
  62. static volatile int irqraised2 = 0;
    6 P; K: \$ g5 A& w+ E9 [

  63. ( x$ Q7 s+ s% \  V/ ?% l' A6 N8 O5 U* h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, h, F  d9 P' P; z' T. s6 V& Q" f5 \; U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 `) M$ p5 G2 h) R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 S+ ~: v& u5 k! m% S
  67. ! B$ v. _6 x1 j6 o$ I
  68. dma_addr_t dmaphyssrc1 = 0;; W/ Z4 O( Z& \& M. g& P' R
  69. dma_addr_t dmaphyssrc2 = 0;! |4 r, q: z+ C/ ^
  70. dma_addr_t dmaphysdest1 = 0;# k, }% C2 [3 B  h1 |0 U
  71. dma_addr_t dmaphysdest2 = 0;) ?( n1 X8 |" R+ H# l

  72. - |: W5 q) V1 ?8 A' f$ T
  73. char *dmabufsrc1 = NULL;
    ' D- K% o' A- P7 D4 ^
  74. char *dmabufsrc2 = NULL;
    ! M! i% v' p  }, G) W
  75. char *dmabufdest1 = NULL;
    # ?. k+ `( H: ~4 E" c% a
  76. char *dmabufdest2 = NULL;" m% j1 a  R% |! }+ b; m% l

  77. 5 |2 Y* R: J% e9 n1 m! N
  78. static int acnt = 512;! K+ P" h, @) a/ o2 s3 H
  79. static int bcnt = 8;
    1 G2 o5 t, z' s8 d% [7 A
  80. static int ccnt = 8;
    8 }% i4 H/ d, T7 G6 p
  81. : `/ @, I0 ?/ j+ L% P
  82. module_param(acnt, int, S_IRUGO);
    ( Y' L, |4 U$ e" W: _7 ]: _: n# C
  83. module_param(bcnt, int, S_IRUGO);2 o2 u- t1 `& A. Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 k  h$ _5 h, q/ @* H2 Q7 a4 y6 v0 S! w, _7 e0 X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! v5 |$ M% ?- a4 `; X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* p- y% S5 d% ~# a
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 p4 `3 M3 k0 A" F
8 N2 |& E/ o" w7 F

; A, z# H- f0 V' @/ c* I6 l- Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-2 18:07 , Processed in 0.039626 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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