OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 x# r0 N, O1 T: L6 b
  1. [code]EDMA sample test application
    1 o$ X  k% X3 K4 R
  2. /*
    % W: u+ c: K$ u7 K2 ~
  3. * edma_test.c
    6 _; g( ~1 c. p" y0 l
  4. *
    ( S# @, y4 w+ K; K( i; N
  5. * brief  EDMA3 Test Application
    7 [& }/ h& O5 D) R9 ~7 g
  6. *
    0 t# Z; a# z! D( P9 |
  7. *   This file contains EDMA3 Test code.9 _0 l' A0 L) K8 Q. P  P- q
  8. *7 T9 h( u1 i! D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 o$ v% q+ h9 Q5 ]- c+ z8 ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & M$ |, ^9 N+ z
  11. *         TO CHANGE.- `! D7 v) b# v4 q9 a
  12. *4 N  c, I3 @7 D6 ?+ _" P& ?* b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ _% V9 p$ |# q  l: ^
  14. *1 s' g  ?1 B$ _! g2 k
  15. * This program is free software; you can redistribute it and/or
    8 k1 I0 l4 t2 v/ o) _/ _2 Q" T
  16. * modify it under the terms of the GNU General Public License as
    $ M' h3 U- X' N5 e
  17. * published by the Free Software Foundation version 2.- w5 O7 A  F+ _
  18. *
    + {  R# a8 J0 s7 y2 O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( a- A( j6 k# J' Y1 H0 K8 L
  20. * kind, whether express or implied; without even the implied warranty
    , V4 @6 J# ?+ u: }* j% |( F( o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 F! E' O! c: q! i1 Y
  22. * GNU General Public License for more details.
    ) l7 P- Q$ [. \2 Z' r9 V$ ^) _- {
  23. */
    4 B$ p9 V6 B7 I4 S

  24. 8 t5 ?4 w6 I* q, v" k- b
  25. #include <linux/module.h>
    , D2 C2 R1 E6 T
  26. #include <linux/init.h>
    0 S( S; f. M3 |7 k, ~. f6 d3 ]
  27. #include <linux/errno.h>( Y, ], Z* t$ v! F9 J$ Z1 c5 m
  28. #include <linux/types.h>
    - X3 u# _9 \( y% N( c  Y" S
  29. #include <linux/interrupt.h>4 t: Y4 O  K3 C* k  Q
  30. #include <asm/io.h>' J' C& K0 j) J0 d* j4 |
  31. #include <linux/moduleparam.h>
    # q- q' d6 E* N
  32. #include <linux/sysctl.h>
    * O! r1 ^9 X9 [% f
  33. #include <linux/mm.h>
    3 \5 y& S1 `& O9 p
  34. #include <linux/dma-mapping.h>2 J3 b) h$ U( o+ P

  35. - V9 s6 Q3 s: A, C/ M- {" q
  36. #include <mach/memory.h>2 ~* |7 g- `7 ^: P$ S: U9 `% E
  37. #include <mach/hardware.h>3 v4 F- d- @! @2 D/ s0 X
  38. #include <mach/irqs.h>
    5 T( x/ r( y/ A' i6 E& R0 M9 V
  39. #include <asm/hardware/edma.h>
    ' q$ m9 Q3 W6 b6 v# B/ C
  40. # p; `$ M/ G' D. z$ P. c
  41. #undef EDMA3_DEBUG
    5 V/ d5 ?0 B5 j4 o6 U% ?
  42. /*#define EDMA3_DEBUG*/
    7 ?$ i/ P& q; S% v- I

  43. ( E' F7 ?; q9 s3 Z) p6 f$ o
  44. #ifdef EDMA3_DEBUG3 w/ z  U; |2 j. u; j, b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , b$ a% }" }; ~0 S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). d' W9 G# \, W, F8 Q6 p3 R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 N1 v& {5 B- i2 G
  48. #else: I3 J( M) O& T: L/ t- `
  49. #define DMA_PRINTK( x... )% U# c( c, a- |! ^( W* j2 F
  50. #define DMA_FN_IN
    : D# i! U" p( V& x& q2 F: v0 L
  51. #define DMA_FN_OUT: t: E+ E& H( c! ]# ~( ~$ o+ s8 d
  52. #endif
    + n0 _, D% I! v+ N
  53. : H! Y- ]1 s7 }7 k6 U& E+ {9 i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' \+ {) y4 a. h, ~- G9 [
  55. #define STATIC_SHIFT                3& j' w' u& a8 @  C8 D
  56. #define TCINTEN_SHIFT               20
    ( v  }# ]6 W3 u! `' M
  57. #define ITCINTEN_SHIFT              21, F/ V' n; d! h+ e2 q: q) R
  58. #define TCCHEN_SHIFT                22
    7 `! x$ T1 A0 u  W
  59. #define ITCCHEN_SHIFT               238 b1 v, @! q" x# \' P/ y; \

  60. ' T0 G! D& Z+ y1 H0 e/ F3 C
  61. static volatile int irqraised1 = 0;
    % B. k7 Q& T9 u( B+ k
  62. static volatile int irqraised2 = 0;8 O0 c9 f- q+ ]) h' e  s
  63.   [/ D4 h$ C! B4 Q! a# X( u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ]- l7 F+ m# c, q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ r7 s3 q( @& H. Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . q% ?. s: P4 t1 B: s

  67. ! S8 I& J. j, Y
  68. dma_addr_t dmaphyssrc1 = 0;
    % `! f/ K6 r+ f( J  |
  69. dma_addr_t dmaphyssrc2 = 0;$ O( T; Y  k$ g1 E" Q
  70. dma_addr_t dmaphysdest1 = 0;
    2 u5 C- A% b4 F( j1 F+ x
  71. dma_addr_t dmaphysdest2 = 0;
    8 q5 b8 J' p* ]
  72. & B  y+ z" {1 y3 o) X# S% }4 ]
  73. char *dmabufsrc1 = NULL;$ J2 s8 z6 [4 b) y" S7 @
  74. char *dmabufsrc2 = NULL;
    + Y" }3 U, H2 \  [1 m: j
  75. char *dmabufdest1 = NULL;
      ~- s; _3 y- L" m) `. H1 n; p
  76. char *dmabufdest2 = NULL;
    1 f1 h3 y' _0 ^2 U" y+ J6 R
  77. 6 u1 E4 V/ [% w, h. D1 v
  78. static int acnt = 512;: X+ C( C; Y% T- a
  79. static int bcnt = 8;
    ' o+ I' A6 x2 ~. e  K% ?" y
  80. static int ccnt = 8;
    & w+ S7 E1 k; M5 ~: u

  81. ; U/ L( c8 z6 ^' `, I
  82. module_param(acnt, int, S_IRUGO);
    ! P& N5 q2 D5 ^' e, v; I
  83. module_param(bcnt, int, S_IRUGO);
    * r. j2 p# W5 f- q/ A( ?' e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% Z* Z* @$ h/ A7 b% u, h2 S5 O$ H/ p4 m' h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ ~4 s6 S3 J) c" o! Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& k3 O5 u7 A4 S% o( T0 _- S! k
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' u. w! c5 O& U* K: n2 Z' G
  E; V: R& I- Z; p: D5 {" O
1 r5 |2 `& D  k' Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-3 23:36 , Processed in 0.040700 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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