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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' g) g! O. D. V# L; j# ~! X8 z
  1. [code]EDMA sample test application
    " [5 `8 y2 F2 t5 @3 Y- g
  2. /*
    & \# @' m8 D% o6 e
  3. * edma_test.c4 y: @: m; f! M# u/ D/ Y/ F. A* X3 v
  4. *- z5 {: F& U; }9 u0 g, m, R! |) o: G
  5. * brief  EDMA3 Test Application: w) t4 T- e3 @6 |, W5 i" j
  6. *. Y) B8 u8 D) H1 b  e* D  g3 P
  7. *   This file contains EDMA3 Test code.' C' `1 n. E0 V5 |
  8. *3 Y8 }, r& D; g( e) b- n! W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # P' F) f# J8 k& X! ~" h, t) b& }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # d, C: Y/ e5 y; J9 ?+ @$ ^
  11. *         TO CHANGE.
    # g* d. P# _, N1 R+ F
  12. *
    " V% x  x& ]" \; h- |$ y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 l- h& t7 \. p8 D" b, z$ c
  14. *
    6 V, H2 d. K1 S, t0 x0 H8 ~) h9 _
  15. * This program is free software; you can redistribute it and/or
    + A, o% C- b9 `" P! g
  16. * modify it under the terms of the GNU General Public License as( f3 t0 ?0 C! q# {" t
  17. * published by the Free Software Foundation version 2.
    : @+ I* a1 H# R! ~( F! t: q4 Y
  18. *
    7 H5 ]+ y7 f' ]& P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / P* |# [) {' y( a1 J# Y: Y  y2 b
  20. * kind, whether express or implied; without even the implied warranty8 q9 p2 a. i+ S8 |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* y5 U/ Q; \+ @6 f. ]" J( ~' z
  22. * GNU General Public License for more details.
    $ C/ U2 T) O" f! w
  23. */
    # S* z0 k" e) y5 S$ P: o% Z
  24. $ O, U* a( y" V+ C; x9 X
  25. #include <linux/module.h>
    ( ~- H$ p7 E+ Q" q4 e+ }
  26. #include <linux/init.h>6 S% A$ ?+ k: J) v* ]
  27. #include <linux/errno.h>
    8 L/ k' \  s: j4 w
  28. #include <linux/types.h>
    8 C1 m) u) K, _+ a+ {
  29. #include <linux/interrupt.h>
    . P* w& |: j6 o3 r1 [* n0 g7 t
  30. #include <asm/io.h>4 @% c% D5 V& l8 G+ z0 o, k* [/ }- w
  31. #include <linux/moduleparam.h>) w6 N0 U- O& D- y& L7 q
  32. #include <linux/sysctl.h>
    , \  G! I" g) f0 m" F# E
  33. #include <linux/mm.h>) r+ v( m2 A9 P6 y$ l( r
  34. #include <linux/dma-mapping.h>+ F6 N7 k. q5 C- b# R" `7 _
  35. # V- X, g( H2 y* l+ o4 y: i; _
  36. #include <mach/memory.h>
    5 r( u7 u. c1 m- ?( @
  37. #include <mach/hardware.h>
    8 H( w2 |* K8 N; d& L5 b2 A& |9 u
  38. #include <mach/irqs.h>0 P. u9 ?6 x0 I$ C  H" Z5 w- Y
  39. #include <asm/hardware/edma.h>$ J/ X# V) _8 a5 R. o
  40. " m( Y7 ^8 I6 P, h
  41. #undef EDMA3_DEBUG
    0 E# c2 l9 S/ p
  42. /*#define EDMA3_DEBUG*/. J( T* T  H. V" i8 M* |
  43. 1 c& Y- N5 N5 _5 V* R  I5 }1 l
  44. #ifdef EDMA3_DEBUG
    7 R  v0 y. `& Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 f, T" l4 m5 D% e7 t1 K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 a, Y: P; l9 l. |7 a' }% N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 G. I0 _. o2 v; n4 a- g* T/ @! {
  48. #else
    % w; f$ Z3 |* y- G, z  B, e
  49. #define DMA_PRINTK( x... )2 A+ T+ m. E% S4 k! X
  50. #define DMA_FN_IN2 H6 {% \, ^5 G4 m* L9 \/ F% j
  51. #define DMA_FN_OUT
    : f$ {" t2 d5 W+ A: T) m9 C
  52. #endif
    2 z& l2 ?! b; s8 |) m, U

  53. ; ~1 C' b, O5 q, W. l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * S6 {: k3 j* b6 u$ f0 h, T6 e1 W
  55. #define STATIC_SHIFT                32 e6 y5 S+ P' U+ T
  56. #define TCINTEN_SHIFT               20# V; Z7 z+ N  p& d! x5 m% T) D
  57. #define ITCINTEN_SHIFT              21
    ( W0 A8 z( F) h- g$ s9 y
  58. #define TCCHEN_SHIFT                22, _# i. G( _0 a: O
  59. #define ITCCHEN_SHIFT               23: K. _7 N$ [! {8 ~! X3 D& F

  60. - S6 ^& {# K+ {, j+ O9 c6 {. a
  61. static volatile int irqraised1 = 0;
    & D& `8 a1 i# p" d
  62. static volatile int irqraised2 = 0;: ?' o1 B; V  Z2 S- u

  63. 7 ?% v1 S* M" t' ^6 t9 Z9 Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# w* q: R0 x; E* b, {0 l3 t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 ~' Y& e, {, P* w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 G  Z4 b, J9 h: o5 L

  67. 8 Q6 J/ j7 V/ d# V, e0 d0 }
  68. dma_addr_t dmaphyssrc1 = 0;
    * s! H5 X' }! ^% U  u
  69. dma_addr_t dmaphyssrc2 = 0;- k; n/ H, R7 {6 m5 a
  70. dma_addr_t dmaphysdest1 = 0;: t' q/ v2 Q" E
  71. dma_addr_t dmaphysdest2 = 0;" z. N, l1 m1 S
  72. % R9 k% w$ d! G4 Z, ]# x- m! i
  73. char *dmabufsrc1 = NULL;' p! u/ r& r& a' \* X/ ~
  74. char *dmabufsrc2 = NULL;3 i0 M- B6 Q2 B$ K
  75. char *dmabufdest1 = NULL;
    ( @5 O( C" ~* H' M3 _& q
  76. char *dmabufdest2 = NULL;
    ! o' @$ A& F" P* K- o& `
  77. & ~: o. v$ r4 x7 I* ^
  78. static int acnt = 512;# C$ |# m3 S. E; s; |& f
  79. static int bcnt = 8;
    + Q5 D6 k0 o( s. \
  80. static int ccnt = 8;8 Y! F, R- D2 b, i' o

  81. 9 @) Q. L) y4 ~
  82. module_param(acnt, int, S_IRUGO);
    , r$ f$ O) C( Q0 t9 s# s
  83. module_param(bcnt, int, S_IRUGO);4 f  M# t, Q6 I! J/ t& z! I1 }. L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( i0 w: o- ?4 R
8 {- r# u5 m4 |+ m* C      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! L8 x, l. e  P6 [" h1 H' Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- X' y8 y2 Z( P" ~# P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 V$ {; v$ p$ {
+ H4 P# i1 m9 h1 n

! S2 v& A- n, e( ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 06:33 , Processed in 0.040038 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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