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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 i& k+ i8 ]9 }( D
  1. [code]EDMA sample test application
    $ B; f$ u( ]) x- ?' A( I+ L& e
  2. /*! x% P- E1 ]3 j1 Z5 V
  3. * edma_test.c" I! D. d5 `& e- h$ \. ]
  4. *: c/ o& B& R5 }9 ^- b4 o
  5. * brief  EDMA3 Test Application' N5 ?) p- K& v; k' H6 A
  6. *: m; k7 o; p5 E& r" f
  7. *   This file contains EDMA3 Test code.
      M: V: O1 e( |7 Z; P# W
  8. *6 Z6 V# x* v+ k9 v' `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# ~  X* y; q/ c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - B; E/ o9 h& ]) f' T+ i- s4 s
  11. *         TO CHANGE." G0 L" j" ]6 O/ n! X
  12. *
    / O2 p! H+ J' y" v# C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// ?  g/ b) t) m5 _# A* W, ^( N! k
  14. *
    ' w- |+ q* s0 S  a! O( z2 A
  15. * This program is free software; you can redistribute it and/or1 g6 b. I( a, ?* X) A
  16. * modify it under the terms of the GNU General Public License as
    1 H0 Y' d3 r; B+ E
  17. * published by the Free Software Foundation version 2.4 }/ ?$ m8 J0 f6 v7 e
  18. *' B$ O2 Z$ V6 c" B4 Y8 Y, G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, Y$ W* h# `$ q$ V# \
  20. * kind, whether express or implied; without even the implied warranty
    1 Y9 v8 H, a) Y& d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( h( `: ?9 Q/ x- y0 I5 `
  22. * GNU General Public License for more details.
    ! s3 z/ N" {  ?4 E3 B- w
  23. */
    . ^' z/ U, f: v6 T

  24. 3 K2 C+ b6 t6 v7 y6 ^
  25. #include <linux/module.h>
    # d+ y* {' c8 K- m( e
  26. #include <linux/init.h>
    ' `# o1 [1 F3 F
  27. #include <linux/errno.h>
    ! Y) T' q$ W1 j- o
  28. #include <linux/types.h>
    . N7 p- ?1 }) Y$ W
  29. #include <linux/interrupt.h>
    ! n  o- C+ x) b7 O2 x; f# z- d8 A
  30. #include <asm/io.h>
    6 \+ ]$ d( p/ t6 p/ F
  31. #include <linux/moduleparam.h>
    # X8 s' T* H. C9 @2 `- p
  32. #include <linux/sysctl.h>4 f+ x9 S9 G" b
  33. #include <linux/mm.h>$ D) N7 K2 v5 m$ c# s# F: m
  34. #include <linux/dma-mapping.h>
    7 t+ G; ~- b( T. _

  35. $ w% w& C0 Y6 E5 y' ?, i
  36. #include <mach/memory.h>: v& \" n6 o: @, V: v3 R9 {
  37. #include <mach/hardware.h>
    . Y" Z0 ]3 a  o* W7 V4 J/ j
  38. #include <mach/irqs.h>; C6 K7 ]3 ~& m) J) [9 L& |
  39. #include <asm/hardware/edma.h>$ _6 ~0 |9 M, `" M% H

  40. % b- n& x/ \9 ~, \  k( X
  41. #undef EDMA3_DEBUG
    ) T! m( k' h2 E
  42. /*#define EDMA3_DEBUG*/* E) g0 ^' e+ a" T

  43. + v4 h/ h* t# n1 Q# D
  44. #ifdef EDMA3_DEBUG
    # e* m. V/ Q9 ^- x: X- v. W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 t0 l: ]- F! u2 R; O( J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / Z& F, r5 {& |1 v  p! k; y& n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 e& q" ~( O8 c0 H  `  B7 T8 q
  48. #else
      R* K6 l, d% K* b6 V# N& U
  49. #define DMA_PRINTK( x... )
    1 p6 F7 g: m3 m
  50. #define DMA_FN_IN+ R7 i, m  D* r# C/ t
  51. #define DMA_FN_OUT
    8 B/ M" l) G7 y( ~
  52. #endif
    5 a0 H& M& P% v
  53.   d/ t6 L! r' [* s3 e; Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 c5 E) u! O7 x5 T2 X% M
  55. #define STATIC_SHIFT                3
    * s6 Q: Z9 k* z7 Q5 A: k
  56. #define TCINTEN_SHIFT               20
    3 Q6 x* w. I2 Q' S" Q
  57. #define ITCINTEN_SHIFT              21, w$ z  b5 J# Q  x9 i% \. Y7 Y: r  @
  58. #define TCCHEN_SHIFT                22
    $ E& ~* x8 `8 Y: f9 }( Z) s# l) A
  59. #define ITCCHEN_SHIFT               23
    - o" b. n" F: b' A1 X
  60. ) K% E) f) \% z3 f2 i  d, N9 I
  61. static volatile int irqraised1 = 0;
      y+ V( |2 ^1 E3 x, v+ Y! ?2 Q+ i8 [
  62. static volatile int irqraised2 = 0;
      d5 e6 E& v* j  Z! m  E! D. C
  63. & u) k# a4 l2 r9 U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ J8 }, Y, v& k9 S  w9 Y8 X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. M) @5 g7 ^3 h" r. x# }$ P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . T. Q6 B  d) ]  n1 C/ c
  67. ) Z+ ^" u- j& H7 V
  68. dma_addr_t dmaphyssrc1 = 0;& [" `- L0 y  d2 s
  69. dma_addr_t dmaphyssrc2 = 0;
    5 D  N4 J) U: e: d0 `
  70. dma_addr_t dmaphysdest1 = 0;7 G/ r" I, R# O% M# {7 N
  71. dma_addr_t dmaphysdest2 = 0;5 ]. Y) `# B7 w# [

  72. 4 j5 P: S! j8 s( H4 `/ V2 s
  73. char *dmabufsrc1 = NULL;9 Q1 F: S6 z/ }; g, G5 E# h
  74. char *dmabufsrc2 = NULL;
    1 [7 J! X( e$ r- E/ s+ M
  75. char *dmabufdest1 = NULL;2 d+ ~- ~) }9 w, S  t
  76. char *dmabufdest2 = NULL;2 R1 [$ o% g4 o' Z/ w, _" Q

  77. 3 L" W+ O4 q& a/ b
  78. static int acnt = 512;
    8 u" _0 c: E0 m* A! I
  79. static int bcnt = 8;
    . r1 N1 \5 u6 I: D, H8 B6 h/ O
  80. static int ccnt = 8;
    + D! [3 g, P! x( k7 k4 m
  81. # Y$ n+ t3 y4 O
  82. module_param(acnt, int, S_IRUGO);0 I3 L9 F  f' E. _1 d" c
  83. module_param(bcnt, int, S_IRUGO);. m5 U8 k* N) U; S7 R6 p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 f- n7 X$ t- p1 F6 H  }3 q

$ X3 N: p2 s% j- \      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" ]# _: z+ Z& `& |, S* @: Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 n2 `' E5 U& V6 y; z4 g3 B/ V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ R. I- j" w. P& z7 r4 R+ K3 p4 j/ x" E
& V. d  R  f7 y3 c5 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-25 13:59 , Processed in 0.039955 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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