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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! F8 f8 k* S. w6 e
  1. [code]EDMA sample test application9 G9 ?9 U( U8 K8 p
  2. /*
    ' l; P1 c* j% ~3 L
  3. * edma_test.c$ i' s, R% Y6 w0 I% [3 E
  4. *, O2 J* o( t/ r3 H
  5. * brief  EDMA3 Test Application
    2 _/ T7 Q0 q% N. F4 s% w/ S& Y
  6. *
    . c# S, X" ~; p$ u1 Z+ a/ E
  7. *   This file contains EDMA3 Test code.
    $ Y+ ~* ]; R6 v3 x
  8. *
    ! J- y4 o5 [" m7 q; |: K. Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 K+ a# H. u# U  S+ B$ I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) V+ g1 I' Y( g; s+ t1 P
  11. *         TO CHANGE.
    ! ^- \6 N% s/ X+ S
  12. *4 Z3 K& U6 J) E$ ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 e; {5 J& ?# C2 }
  14. *
    1 K( x: P4 X/ d# S4 o. B
  15. * This program is free software; you can redistribute it and/or
    / E* `0 W! T% Z' J+ P
  16. * modify it under the terms of the GNU General Public License as" G. r; q! I" g1 x
  17. * published by the Free Software Foundation version 2.
    2 T, K  V- M. a$ F$ ^' m, I
  18. *9 U9 @5 f- ~' }# e7 |" h, A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 H$ P0 ], ~- D" D; c3 Z& m1 _
  20. * kind, whether express or implied; without even the implied warranty
    6 [& o' P/ E/ I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ K* A* S; @9 g6 O. v% p
  22. * GNU General Public License for more details.8 A1 [' n- g. b& f
  23. */
    - _* X. A7 D/ r7 ~3 S! T6 ]
  24. 7 S; K8 K5 p8 t2 k. e
  25. #include <linux/module.h>
    $ ]' f% q, J9 o2 r  u
  26. #include <linux/init.h>
    , u# o) _3 W! W7 M
  27. #include <linux/errno.h>4 _, A; Z0 U7 h! F0 Z
  28. #include <linux/types.h>
    8 F4 A$ m7 G2 W; x
  29. #include <linux/interrupt.h>
      I: p( x+ E, m5 }
  30. #include <asm/io.h>+ B% Y8 K: x: I
  31. #include <linux/moduleparam.h>+ Y  q4 A, ?% d) T
  32. #include <linux/sysctl.h>. X( e# H+ g' J) s3 m: e
  33. #include <linux/mm.h>
    2 ]$ D& W& |2 l) C
  34. #include <linux/dma-mapping.h>% S# }$ x8 a5 r8 F; r: l

  35. 0 A$ @3 n. ~' D0 i8 x& X$ \* s
  36. #include <mach/memory.h>! L5 a" \6 \9 @1 `' x5 [8 J, M
  37. #include <mach/hardware.h>
    % Q0 c+ D% x$ V4 N# i" o
  38. #include <mach/irqs.h>
    0 b+ @9 s! ~# F5 A; T7 e1 d4 s2 k
  39. #include <asm/hardware/edma.h>
    0 m" N* @1 c* G  E+ O! e5 o4 ~
  40. 8 X( y* ?6 w. i! Z, W; X8 e2 Q
  41. #undef EDMA3_DEBUG
    1 j5 p1 f) l4 k  ^) B
  42. /*#define EDMA3_DEBUG*/( a. x( N' w. i+ `
  43. 2 Z& i1 Z, d3 b$ ]+ a: `
  44. #ifdef EDMA3_DEBUG
    8 G* \9 K8 n: r* T; c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) m5 r0 j" e- I; M7 ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ P9 f$ [9 R: p/ }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 Q' g7 ^# n. \9 ?9 j
  48. #else& c0 z$ G" W  d; I( i! d3 `
  49. #define DMA_PRINTK( x... )- F) u8 w6 h! t7 i: y
  50. #define DMA_FN_IN  N) t! A  q* E* l- B1 S+ w
  51. #define DMA_FN_OUT$ M2 T! ?  t- d0 [3 H, j4 V+ h4 b
  52. #endif
    8 e$ t9 O! P/ C6 i. C

  53. ' F! _( p: t: A3 ~2 h" ~! t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  N+ _$ P# `/ D% I1 j( A: Z
  55. #define STATIC_SHIFT                3
    % r0 i: X3 J7 j2 S$ j
  56. #define TCINTEN_SHIFT               20
    4 E! o! e5 ?* ~
  57. #define ITCINTEN_SHIFT              21. Q9 g7 }/ W+ I0 T2 M
  58. #define TCCHEN_SHIFT                22
    5 O4 D+ \$ i3 e* t! ~/ C
  59. #define ITCCHEN_SHIFT               236 m$ P4 S1 M0 y& `

  60. % L; v6 N; S2 |$ O1 r6 e( c
  61. static volatile int irqraised1 = 0;% }; ?' \6 ^9 {' h& b: ]
  62. static volatile int irqraised2 = 0;) y2 R! `) t( t/ k1 }

  63. + u: ?4 l: \8 k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 s8 e' ]6 x  U9 Z5 Q* M8 b: l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 o8 ]9 Z4 \" t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) T& D5 \. ?6 D, W

  67. 8 K1 D  ?# k7 p+ A1 ^7 Y
  68. dma_addr_t dmaphyssrc1 = 0;
      o* P$ x4 ^  c2 }' B
  69. dma_addr_t dmaphyssrc2 = 0;- S& q# E+ P* E& v+ {
  70. dma_addr_t dmaphysdest1 = 0;
    + c6 J, ~* L! ?5 F5 e$ V4 R
  71. dma_addr_t dmaphysdest2 = 0;
    1 g# c+ f. ~+ O3 O8 R

  72. & J' ]" p8 q9 Y
  73. char *dmabufsrc1 = NULL;
    * K4 T) A' J" p" J1 }
  74. char *dmabufsrc2 = NULL;, Z* _2 n  ]+ h0 K( [
  75. char *dmabufdest1 = NULL;
    % v& u. B; F4 H# I$ d7 Y) y
  76. char *dmabufdest2 = NULL;
    7 v( y4 n. l, L8 k3 X( o* h) s# U

  77. $ K: v8 v! I: r( n7 `- M
  78. static int acnt = 512;
    2 G: g& j  J: R" ~8 w5 C* ^
  79. static int bcnt = 8;
    " |3 z8 f6 l* }1 u8 l5 y; r6 b
  80. static int ccnt = 8;
    ) T! G; |% V2 o

  81. % Y; x, G  s9 \. e" x- a: I" u
  82. module_param(acnt, int, S_IRUGO);
    - ]5 H7 @6 i0 E* |( U& [% O
  83. module_param(bcnt, int, S_IRUGO);
    0 {5 y- R# X  Q4 X9 M* k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! `, m: M0 P/ M: U% V
" Q3 p: j  s/ r/ k4 R8 {5 z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: x) `  C+ M: c* n: d* S( q& T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& v* f3 _) s7 W  v! C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 C/ |) f- a2 U8 \8 _# w' n4 _
8 z! n5 l9 x$ |. T
; d% y+ ]& c* ]0 q: a) j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-19 21:41 , Processed in 0.040931 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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