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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 {; w8 B- Y/ Z" ~
  1. [code]EDMA sample test application
    + ?& M2 q9 j" e
  2. /*/ h+ Z7 ~) ~2 o$ e4 v% j& s6 R+ u9 _' c
  3. * edma_test.c
    # N5 o' s: `! K* a5 p6 J
  4. *0 |$ }9 E, e- p! ^
  5. * brief  EDMA3 Test Application
    1 b& b( m/ O1 n$ Z* B! I
  6. *
    6 b9 T& `  A# S+ d; q
  7. *   This file contains EDMA3 Test code.* [) f" J  d# Z9 J( f
  8. *9 ^! u- A" L) U. ?$ ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  d9 U% X4 v( E0 U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 }: [  s9 \; h* F7 l  G
  11. *         TO CHANGE.$ M* |2 O. S' L7 S; Z
  12. */ O1 H6 Y4 I6 ~( v& H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : j7 z( R1 J, t7 C4 }1 m! ^' X
  14. *
    0 _3 B0 u# Z! P- M" b  Y- A  w
  15. * This program is free software; you can redistribute it and/or8 N% k7 p% y5 G/ y
  16. * modify it under the terms of the GNU General Public License as
    & d6 h& R4 {; O5 b; G
  17. * published by the Free Software Foundation version 2.& `( E4 w5 x, j1 A6 R# G% c! v
  18. *' p8 {, Q3 [! q# }5 ^" ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 _, l, j, ^9 @7 i
  20. * kind, whether express or implied; without even the implied warranty
    $ W7 j' F) |6 e/ [6 F( x% @) O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ m2 Z& j8 ~: u- }- I
  22. * GNU General Public License for more details.
    3 s5 z- U' d) h
  23. */& X2 b6 E# f  z( \9 w

  24. 6 S) O: o. a  h. A0 O
  25. #include <linux/module.h>
    5 I9 }3 s0 f0 Y3 r5 P/ e
  26. #include <linux/init.h>6 S9 q5 \3 b/ u, m  [$ O
  27. #include <linux/errno.h>( F+ A( w2 X, y# j4 Z
  28. #include <linux/types.h>
    4 V* ~& w4 D, d% f
  29. #include <linux/interrupt.h>
    7 @0 `+ k1 i% {, [, z
  30. #include <asm/io.h># `: C$ L1 d) F; N4 b' m: y
  31. #include <linux/moduleparam.h>
    0 \$ J5 ?& F  `+ B: ?8 v6 V3 a
  32. #include <linux/sysctl.h>) |8 Q/ I( v/ ~6 G/ k& u+ N  {+ d
  33. #include <linux/mm.h>
    8 u8 j5 \' V/ u, g
  34. #include <linux/dma-mapping.h>
      q- ^: t$ r7 E  i* c2 t% d- b. B- O

  35. 4 G' v- ]+ {/ L% z. B
  36. #include <mach/memory.h>6 J% f- a6 n- e( g9 \. k8 I
  37. #include <mach/hardware.h>
    8 X' u- x& Q" f- v0 p" B
  38. #include <mach/irqs.h>! y! d( t. l$ e+ k: g+ u
  39. #include <asm/hardware/edma.h>3 {2 B- K7 _* ]$ J  b3 s' [! R
  40. 8 G, L5 ]8 X4 c# x) l
  41. #undef EDMA3_DEBUG
    3 }: r, ?$ X2 f- u4 [( |5 o& s2 l
  42. /*#define EDMA3_DEBUG*/
    $ q' @! f' E: r6 e

  43. " G& H3 B& A+ Y
  44. #ifdef EDMA3_DEBUG! N" V. x% g& p. A9 w* G: ~# }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ H: }- v4 z, M' l2 q% J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), w2 ?- l4 o4 I. h7 c# D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + u5 |( ~- Z  E8 Z! E* D
  48. #else0 J2 F7 R# e/ D+ F
  49. #define DMA_PRINTK( x... )
    & o$ q6 F& ~8 }: L0 }- i& z
  50. #define DMA_FN_IN
    % N. s; t& D8 V
  51. #define DMA_FN_OUT
    : e' T% e& k0 p5 c  U( q/ a$ {
  52. #endif
    0 ]2 X( ?( i( M# B! G* `

  53. " c; b+ y3 [' P" E. o6 }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) N, Z0 o7 e+ W5 v' Z/ l- l
  55. #define STATIC_SHIFT                3
    ! C) \2 C; t* d6 G
  56. #define TCINTEN_SHIFT               20
    ' A( U& J: G4 G, j) e/ Z
  57. #define ITCINTEN_SHIFT              21
    8 n6 J  c/ U1 A
  58. #define TCCHEN_SHIFT                224 E, ]1 L2 t. H% L4 H8 t
  59. #define ITCCHEN_SHIFT               23: }% c9 s4 g4 s* W+ o; G; \$ e
  60. $ W6 z9 [8 G% r, K$ u9 x
  61. static volatile int irqraised1 = 0;
    : y- R/ @5 c' J0 i" a8 t4 U0 g
  62. static volatile int irqraised2 = 0;
    2 K) t1 E+ P$ y) ]* k
  63. : R* w1 c% K- k& n$ `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( u) i$ r- H5 ^! E# |2 i! o( X' p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! f! g$ G. I+ z9 b! _, a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 ?& V- G6 v  y+ D

  67. 1 t: w4 b- q) ?3 T
  68. dma_addr_t dmaphyssrc1 = 0;
    , z/ g5 t2 F9 x5 ^6 P  g
  69. dma_addr_t dmaphyssrc2 = 0;# _  O# p2 i0 x$ k. B: {
  70. dma_addr_t dmaphysdest1 = 0;" a" ^" m+ m1 q# q4 }' F- Y
  71. dma_addr_t dmaphysdest2 = 0;
    * W! @1 Y% d, k* L0 z( a
  72. # M6 i% b' w0 D$ ?5 k0 x4 [: k8 ^
  73. char *dmabufsrc1 = NULL;
    " A- H) a2 t4 m+ b
  74. char *dmabufsrc2 = NULL;1 @3 P) R( M" k& q5 r
  75. char *dmabufdest1 = NULL;
    4 H0 q  F) d. o- z8 A2 C
  76. char *dmabufdest2 = NULL;
    2 O( y3 H; o7 h7 Y" G/ g& N
  77. 7 U2 U/ r% f2 I' Z* B$ O
  78. static int acnt = 512;
    * q, ?% _7 f7 h5 r' L4 c
  79. static int bcnt = 8;
    & e, W6 Z3 S9 B& F4 o9 ^- T
  80. static int ccnt = 8;
    6 j3 E5 n& I* Q) f, p( l

  81. 3 l4 n9 @) p" s: }) `" g
  82. module_param(acnt, int, S_IRUGO);, R8 ]6 k0 U! O
  83. module_param(bcnt, int, S_IRUGO);3 S, a5 M, T6 i; w/ C/ H. T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' U5 \$ j9 u, ]& n
- w. W3 O, D, G; T      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ l; ^" |; A4 e) ?% A1 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 I. V  e  Z( J2 L0 X3 k     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 y- t  D) _. Y8 H( m
$ e8 O* I& z  L  ]! F2 h, ^
& }' z4 Y  f# a! J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-11 11:51 , Processed in 0.038191 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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