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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' O3 D9 _9 ?5 }2 }7 M' x' t
  1. [code]EDMA sample test application+ x* M8 I; Z( r8 \
  2. /*
    % n' D+ a+ r  k+ f: P6 R
  3. * edma_test.c- X1 `9 [6 p! f+ v7 v
  4. *
    ; |! _$ A3 [% e/ D' ^) U
  5. * brief  EDMA3 Test Application# M% N7 h8 d5 o) X3 @
  6. */ [- B; s6 z' Y! b1 l; z( X+ i) C
  7. *   This file contains EDMA3 Test code.+ b& x: f, `! a1 g3 l, W) y- k
  8. *0 ]  K& `9 Z4 {$ w; a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" C* A6 K+ U; B% @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # A6 Z. q; _' q0 }; t1 p
  11. *         TO CHANGE./ I) q2 Y  d* B
  12. *  }8 ?6 H5 h9 o9 c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' \" i% v1 N( J0 l( j1 @) B; t
  14. *9 s* H, E6 J. b0 F. T0 D! z
  15. * This program is free software; you can redistribute it and/or$ a* X5 w$ ]5 L
  16. * modify it under the terms of the GNU General Public License as
    ) A% E  E: i1 C7 v/ g% ^
  17. * published by the Free Software Foundation version 2.
    $ k0 \5 X  E6 ^8 v
  18. *
    5 v! \) l' ~' v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      N9 ~$ N  `) o4 c8 `! o0 c
  20. * kind, whether express or implied; without even the implied warranty
    & a# U" D. a& m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. o) K! [3 M( l3 _. p
  22. * GNU General Public License for more details.5 ~: s0 I: k+ T6 ?3 k% ~
  23. */7 f9 k* E$ `0 `/ r3 w
  24. 4 u) g' s, N" o* S8 R* B' q
  25. #include <linux/module.h>1 N7 ]; O  P" b7 @. ^  W, Z* Z, y
  26. #include <linux/init.h># A4 e# f0 ?  }# ]$ l$ A8 d; \" P8 ^( T0 b
  27. #include <linux/errno.h>9 T" h# v. O2 m- v
  28. #include <linux/types.h>
    , Y. S4 d% u9 g& D9 f
  29. #include <linux/interrupt.h>
    % A0 X* G5 U, ~
  30. #include <asm/io.h># b0 h" r* V! o, R
  31. #include <linux/moduleparam.h>
    ; e- s; c  |. c% g
  32. #include <linux/sysctl.h>' [$ Y5 u1 b+ @' L. s3 F- @, o; x/ J
  33. #include <linux/mm.h>
    ' z9 Z7 R& M0 N% d
  34. #include <linux/dma-mapping.h>
    , E3 Q, x7 ~2 p5 @

  35. + i% ^! ^' y% |2 y
  36. #include <mach/memory.h>
    ' q; a  [1 L5 u; g7 C$ L: Q
  37. #include <mach/hardware.h>
    0 w  A" X9 @/ W2 ]$ H
  38. #include <mach/irqs.h>
    % a. i" _2 I0 @. [4 K
  39. #include <asm/hardware/edma.h>
    - D+ P8 u  G7 a6 U  n/ O
  40. 4 @0 P! }# H' o1 K3 L! @; K
  41. #undef EDMA3_DEBUG& _- _# Q' D' ^4 E
  42. /*#define EDMA3_DEBUG*/
    * j" s- T& P0 S- Q

  43. , Z* \% B. |; P- [
  44. #ifdef EDMA3_DEBUG9 V& P( I( {. T) h) U- G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 K! E3 {* N6 U" V5 L. [) ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : \! j( m& }, b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( Q) {+ E+ n3 U# L# [. ~
  48. #else
    9 A9 h0 k4 i' M- F
  49. #define DMA_PRINTK( x... )8 I- o0 W8 t9 T3 h6 y
  50. #define DMA_FN_IN
    + K2 j9 {( }, x# C" u
  51. #define DMA_FN_OUT, n- U: v9 i  T5 ~, H8 K( t  k4 ~- C
  52. #endif
    1 m! d* \  N  Y" H2 M" W) \% _
  53. 4 w2 i! p8 _5 c' I! ~) p$ e* B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " H( o# ^3 {! V" a/ t
  55. #define STATIC_SHIFT                3
    , i( H: I2 L' p
  56. #define TCINTEN_SHIFT               20' {- X5 `; Z6 X* d: ]7 h8 R% i
  57. #define ITCINTEN_SHIFT              213 z$ |6 f+ _/ w
  58. #define TCCHEN_SHIFT                22* a. H# t, {: o7 [$ o, `
  59. #define ITCCHEN_SHIFT               23% v5 I( @: t9 {3 T4 s
  60. 1 R* L- \* Q/ z6 w) I
  61. static volatile int irqraised1 = 0;
    * J! N8 k) x& L& p. n* I. }7 c* Q
  62. static volatile int irqraised2 = 0;
    + ^6 _* V5 `5 a$ z% A6 [. j
  63. # T7 y' _% s5 S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 A2 q+ r, W, t8 x$ I% i. P0 F! A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ R) U6 M+ l. V; _8 b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" @4 A- P$ F' |" P! J

  67. ' U2 ?- \4 E$ S8 ?
  68. dma_addr_t dmaphyssrc1 = 0;
    0 v1 V! i1 d; s8 A
  69. dma_addr_t dmaphyssrc2 = 0;
    $ J6 ?2 v; s, k  C
  70. dma_addr_t dmaphysdest1 = 0;
    3 T3 U  E$ {) t) X8 y( r
  71. dma_addr_t dmaphysdest2 = 0;3 N4 d0 J* @7 o9 T1 s  f
  72. 3 j4 O1 W4 _4 Z1 G
  73. char *dmabufsrc1 = NULL;
    7 |. t, U1 Z. Z2 M2 Y1 V* F) b/ d
  74. char *dmabufsrc2 = NULL;- ^6 R. Y. Q- I  W" K$ s
  75. char *dmabufdest1 = NULL;$ J9 k4 T' Q7 J- Z
  76. char *dmabufdest2 = NULL;+ g% @" S! e/ Y# o

  77. 8 S/ Y, E$ @& i5 E& ?
  78. static int acnt = 512;! u+ E4 ^. h: `& m% t. W. A$ I
  79. static int bcnt = 8;
    , T: z4 y* B1 W$ w2 _( Y% R
  80. static int ccnt = 8;
    5 c0 f* [$ g' M
  81. # L" u$ d3 u* E% {0 J
  82. module_param(acnt, int, S_IRUGO);
    " C! x  P$ m$ R+ i+ O
  83. module_param(bcnt, int, S_IRUGO);4 q2 ~- |9 r( z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 }6 `8 Q7 ^* V: ]( @% F
5 f6 B& b5 {4 q+ [# x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& h: I6 i0 w, ^1 M6 `4 k4 Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ ?* m' v& o; c8 J; ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ S- s. F3 J; O& ]1 Y6 Z
3 Z4 E" a3 i! b% v3 r
" i7 f8 r" _, {  U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 17:02 , Processed in 0.039834 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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