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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* {- d3 d: g: J0 g& U
  1. [code]EDMA sample test application
    ! Z; f$ m, L6 V7 g- J
  2. /*" D% m* x: X5 D" x
  3. * edma_test.c
    & \( n/ @8 ^0 m- `: L) o
  4. *# o8 _9 D  X: J$ `# r. e1 b* V  G2 ]
  5. * brief  EDMA3 Test Application
    * Y6 _' p, C; `" u6 I0 X
  6. *
    2 U2 x' p( s1 N+ c  ~
  7. *   This file contains EDMA3 Test code.
    % o1 k! n& o" Z, j
  8. *8 n+ {% X; G# H; ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 m: O/ s1 [; H# b, B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / k* g, c4 _: w" r; [/ {
  11. *         TO CHANGE.
    . K5 Q4 ~+ c0 F" A# |" C; L
  12. *- A. U, m; W. G) L5 [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , `- F+ W  ~% Q: {) X: J% O% y5 P3 W
  14. *- X! n  }. r  h3 H1 Y6 T* Z
  15. * This program is free software; you can redistribute it and/or2 C/ D5 s, p# }+ ]6 z4 r
  16. * modify it under the terms of the GNU General Public License as, \2 t; {: I# F, Y/ v. [2 W0 C' z  ~
  17. * published by the Free Software Foundation version 2./ H9 G/ J, \- M7 _
  18. *
    ' v: G+ R+ R4 g3 }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& W; K' P) v7 Z! z& b) ?. V
  20. * kind, whether express or implied; without even the implied warranty+ W9 Q' U4 h% k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 z- O. C+ h& u( A  a
  22. * GNU General Public License for more details.
    $ B9 A6 v: m8 c8 u* g. h, f
  23. */. }% `; o5 _# S* ?6 l( b* l
  24. + L+ _/ K: V. }2 r; ^# i' z
  25. #include <linux/module.h>$ @9 o+ r" \- @, s2 I; H( I- I
  26. #include <linux/init.h>
    , n  a0 F' m0 V) Y" ~; q% t
  27. #include <linux/errno.h>
    $ p4 F2 L1 M, p5 {- ?
  28. #include <linux/types.h>& h9 J# r  \1 q
  29. #include <linux/interrupt.h>" `9 B5 P* Q& O* Z- A0 B
  30. #include <asm/io.h># W7 X! y3 {/ k$ h2 a9 Y
  31. #include <linux/moduleparam.h>9 l7 v) D' @8 P8 Z, N$ @4 V
  32. #include <linux/sysctl.h>4 @% @, ]# @5 B2 E) A: D0 A
  33. #include <linux/mm.h>
    ! Y% _' b7 Z% V0 _3 I) |
  34. #include <linux/dma-mapping.h>
    $ N( B4 \0 l  u; ~0 X
  35. 3 w0 W# G7 w8 Z7 c' D- X
  36. #include <mach/memory.h>" D. R) g1 p) {+ y0 Y  j0 e
  37. #include <mach/hardware.h>
    + k7 t6 K8 s5 g
  38. #include <mach/irqs.h>5 v2 g! r0 a6 B" T! f- B- Y5 a
  39. #include <asm/hardware/edma.h>) O7 D! d) c1 @3 f

  40.   u, p% @  K. V; ^* z8 h
  41. #undef EDMA3_DEBUG% J+ g* o! e$ q7 Y4 n* B: [0 c
  42. /*#define EDMA3_DEBUG*/
      @  J9 N2 S7 j- g) [2 i8 Y' G
  43. 0 p% U0 y) b2 J- W" N) B1 D
  44. #ifdef EDMA3_DEBUG" {3 y/ A9 A3 s8 \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  L  S) x: u: w7 T- Z9 w8 l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 h7 M2 [; C+ I( c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ v3 u! j$ t" g6 s
  48. #else; l  \. X# f: R
  49. #define DMA_PRINTK( x... )  h, z9 A+ L  N0 m0 S% ^) Y
  50. #define DMA_FN_IN
    ' F# a6 a# G) Q1 w* [0 a* q
  51. #define DMA_FN_OUT
    ; D0 L5 {+ I6 \' _
  52. #endif' {6 ~. x3 d0 ]* V8 v  |
  53. " e9 J5 T; @6 [/ K7 x8 x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 `. f5 c5 T2 P5 @
  55. #define STATIC_SHIFT                3
    ) |8 E3 P) d# O
  56. #define TCINTEN_SHIFT               20
    1 G7 u* n8 C* G% P7 [: I
  57. #define ITCINTEN_SHIFT              21
    / a' t% r3 t+ q' ~
  58. #define TCCHEN_SHIFT                22
      x9 S6 f/ B( O9 w) D& t, |% N
  59. #define ITCCHEN_SHIFT               23+ A: B. T( m6 n" j; g- \% N$ E
  60. % y1 t3 x' C' P
  61. static volatile int irqraised1 = 0;0 ^" {5 _/ Y4 D* q! S
  62. static volatile int irqraised2 = 0;5 K$ `* ?1 N# L% Z% K

  63. # m6 Z  M, S* e) f; y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( M6 Y. A" h. Q  b- z* g% d" ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 e4 |) `7 d" M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 E2 Z0 u( W; e% m$ K  ~" T( O: U. f

  67. ( c9 o$ m% Y1 L) I7 w, @2 E
  68. dma_addr_t dmaphyssrc1 = 0;0 T0 \( l* R- K& j7 Q: i4 {
  69. dma_addr_t dmaphyssrc2 = 0;
      Y' a* m" d1 J+ b! O1 W
  70. dma_addr_t dmaphysdest1 = 0;% C) o2 c4 H+ V. @
  71. dma_addr_t dmaphysdest2 = 0;
    9 @1 ?  E( p; Q8 r/ |7 w
  72. * a+ D4 g8 }8 M" r5 q
  73. char *dmabufsrc1 = NULL;2 d' P, H  \$ |* h2 k0 p+ x$ k4 P
  74. char *dmabufsrc2 = NULL;
    " A: o* x4 L- M5 x/ s5 T
  75. char *dmabufdest1 = NULL;
    / n7 g7 [# U' q5 l0 o" z
  76. char *dmabufdest2 = NULL;4 Q& F: ?+ K' j: T. ^1 q

  77. 0 |; x* `( C" _" O- L$ ?% z1 s8 F: Y
  78. static int acnt = 512;
    ' F4 A5 j8 ^* E9 T' Z( q3 R, a9 i. i
  79. static int bcnt = 8;* e: C( [0 E! B5 Y, ]' ^/ N
  80. static int ccnt = 8;
    ( T- f5 e' s! `: m

  81. . n$ p2 j$ z# F/ Y7 D
  82. module_param(acnt, int, S_IRUGO);# d# M$ q( `0 Y) k7 J
  83. module_param(bcnt, int, S_IRUGO);
    7 P7 R# c8 S0 R5 L* O  K0 y+ U% I
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 Q7 b' g$ W6 Q* m* O- m( {
! s2 A9 A6 d6 }4 |3 D      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 o5 _9 e( J1 e; A1 V  O1 s- o
arm-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 F# H5 T9 z  O& p: G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  R6 I$ v  h. u0 R8 N9 K

, }0 j" V$ t- D) M5 v+ y
7 T8 k' N7 ]) w* T, g1 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-29 18:51 , Processed in 0.038914 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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