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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 E) n6 S+ y  H# K
  1. [code]EDMA sample test application( O" S4 n1 ]5 U& F
  2. /*4 R6 O% b: I5 |& [- r: i! B
  3. * edma_test.c
    / ^* h& l* ~1 P1 f. @
  4. *
    ) n- L1 f6 Z4 f6 C1 A/ y5 s
  5. * brief  EDMA3 Test Application; C. _# q, k) R! D) |# o# X+ a  Z
  6. *
    8 C' {9 a7 g" ?; U
  7. *   This file contains EDMA3 Test code.% J5 j) f8 |7 x4 r, r
  8. *
    " e" }/ ]: n7 H" H- c- C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 f( h$ s1 {0 |5 `% z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% _+ r* n0 r# o$ W9 Q
  11. *         TO CHANGE.  e( T7 O3 ]+ k! o; s5 {' y# y# C" r# }
  12. *: h4 Q$ K/ ?, X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' u% c. Q3 |, a8 ?
  14. *
    $ R9 }; f* _9 Z: x& M
  15. * This program is free software; you can redistribute it and/or
    ! H  i9 a& s1 i4 Z' q$ b4 U) o+ H3 m
  16. * modify it under the terms of the GNU General Public License as6 X1 k) h6 x8 k" n
  17. * published by the Free Software Foundation version 2.
    + w$ {7 v5 n; p  P6 \
  18. *: \: H7 z: d' G+ f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: X* T3 g: W, q3 v. y
  20. * kind, whether express or implied; without even the implied warranty2 s" A1 p  w6 N* h, L: @5 w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / G7 |$ x) Y! a3 M' \) q: v/ g
  22. * GNU General Public License for more details.
      e8 |5 S) W3 [: L
  23. */  Q/ f8 X+ Z: a! w# }
  24. ' I. V0 X$ }, P
  25. #include <linux/module.h>4 A4 _* B& X. ?
  26. #include <linux/init.h>) J' O/ i5 P% {3 w1 S$ L
  27. #include <linux/errno.h>6 G/ Z: v( N# v, K
  28. #include <linux/types.h>  C5 M- U' E+ B8 n$ y. a
  29. #include <linux/interrupt.h>/ f5 h2 x. T8 E7 k
  30. #include <asm/io.h>
    / t  m& {* T( c/ m7 t& M
  31. #include <linux/moduleparam.h>
    , e0 m$ f! H5 N6 ]
  32. #include <linux/sysctl.h>+ e& s+ A' @9 G3 f% v
  33. #include <linux/mm.h>
    ! h. e1 O; ~0 q, h
  34. #include <linux/dma-mapping.h>
    # G5 B3 N' o% Y! Z3 J
  35. 6 g/ |; h2 c4 J4 M1 K. n9 ]& S. @
  36. #include <mach/memory.h>
      _  `8 P( d% i4 `5 j9 [
  37. #include <mach/hardware.h>
    ! j2 U1 C9 F$ m
  38. #include <mach/irqs.h>
    ) a, d4 E" [- d) G& K1 d+ h- \
  39. #include <asm/hardware/edma.h>2 b  ]8 E' j3 a- z" G; O
  40. . O; W1 o$ ?$ y  |
  41. #undef EDMA3_DEBUG
    3 a5 @1 _$ `8 ?( G+ e) a$ s
  42. /*#define EDMA3_DEBUG*/
    # J2 S0 V8 @- Q

  43. ( B' T5 l9 Y! n1 L' W- o8 P3 B, B! H6 L
  44. #ifdef EDMA3_DEBUG
    - @+ F8 B; ?) ?" b4 _# U3 y& `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) `6 b$ f" l' p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % ?. k; b8 T: K: j4 J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ ?$ c/ b; s8 g0 T2 X: }8 B. y
  48. #else
    9 Z. P$ v1 `7 A9 _: h
  49. #define DMA_PRINTK( x... )4 a# Q* X. {) V) o
  50. #define DMA_FN_IN. ^# t2 f4 ?; x9 i& d) I& n
  51. #define DMA_FN_OUT/ d" Z, D) B  v) j& H2 `
  52. #endif2 Y/ W. O. H2 r  @

  53. ) a9 {! w1 m6 A0 |6 G2 z) l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 I8 ~* o4 L) W: V
  55. #define STATIC_SHIFT                35 w. i7 o) m* Z, a
  56. #define TCINTEN_SHIFT               20/ z% w& O, X4 H2 Q
  57. #define ITCINTEN_SHIFT              21( \. A& ]: j# {
  58. #define TCCHEN_SHIFT                22* f. J9 H; h$ [$ o4 Z
  59. #define ITCCHEN_SHIFT               23
    6 c8 W) U0 j6 H5 b* J
  60. 6 n# y1 |# ^' A* u2 C; {
  61. static volatile int irqraised1 = 0;
    6 i' S$ A6 \6 ?/ p, R9 D' y
  62. static volatile int irqraised2 = 0;
    6 p3 ?' b$ R3 }
  63. - r$ X2 B( F* {: w0 h! T0 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / @0 D9 w8 K0 ?; H4 b% F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 P2 D# p: v- A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 W; x3 C5 A, ?. c2 p
  67. ( O$ C  c5 j9 \& e. Z9 s0 I2 W- F
  68. dma_addr_t dmaphyssrc1 = 0;' M+ }, h) n6 s8 u+ u* z6 Z7 Y
  69. dma_addr_t dmaphyssrc2 = 0;
    / z, V# V3 {$ R- ?' c1 K! s+ r5 D
  70. dma_addr_t dmaphysdest1 = 0;
    + f6 s6 S* M5 j5 p
  71. dma_addr_t dmaphysdest2 = 0;
    6 `) i- ^7 ]+ b  |6 p

  72. 7 a' B/ K6 ^4 H/ u
  73. char *dmabufsrc1 = NULL;
    6 a: ]+ h$ V$ W  o0 _% ?( p* Q
  74. char *dmabufsrc2 = NULL;+ `' D% V9 Z8 B* Y
  75. char *dmabufdest1 = NULL;4 `6 }5 A9 F' J7 j+ Z5 C
  76. char *dmabufdest2 = NULL;: R3 Y; ]3 W8 J0 @+ v

  77. " y% Y" {: {6 Q5 i# u9 A
  78. static int acnt = 512;; ?7 Q( x) K6 n& R
  79. static int bcnt = 8;
    . x: C, n) y1 |! B
  80. static int ccnt = 8;6 v9 J) |" b0 U5 q
  81. ! ~2 G3 H, ~( F7 G+ ]) i2 i8 r
  82. module_param(acnt, int, S_IRUGO);" a7 k) G) H' f, v) L
  83. module_param(bcnt, int, S_IRUGO);
    $ I9 L5 S0 f4 W% J" _% B1 h
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 H: T1 m* X3 T
- \! Z- Q0 |! b) u3 w& s: H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 j5 V+ a) T# f: d) b' Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% @6 R$ U. j8 Y' T! \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( Y# U" y! K  i# v" E( ^

" E, M2 C- S/ C1 j; |( L
+ S7 g$ y# R4 w5 }& `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-6 23:18 , Processed in 0.044406 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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