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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; P* W. ?" g* U1 O
  1. [code]EDMA sample test application! L: o  k& D; }, t9 N) K7 ]% ^  ]8 F
  2. /*4 w7 y/ Q% ]0 X# X& X
  3. * edma_test.c! ?; ?5 G0 n5 P( g1 h8 a
  4. *" r  x; e- z$ ~
  5. * brief  EDMA3 Test Application
    . L, y1 u) X6 [, t( E
  6. *
    - H: R$ a' e) Y5 W# W
  7. *   This file contains EDMA3 Test code.1 T- u. {" O9 N
  8. *. d4 N2 R* {8 @# P1 Q% `& u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  g; V2 j9 O, m1 C' A# t, M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . p1 O8 d$ [' j& j8 Z$ p
  11. *         TO CHANGE.
    # _* {" }( b4 j
  12. *
    9 t8 Z( b2 F, y. r& T, H& O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 q; x9 [" M  y" u( d
  14. *1 Z: f. e- U! V2 z5 u$ a/ m
  15. * This program is free software; you can redistribute it and/or& H6 g8 v1 Z: A( B7 F
  16. * modify it under the terms of the GNU General Public License as( _, y$ z" L: i* V$ k
  17. * published by the Free Software Foundation version 2.! l, H& K1 Y, B- Q# n
  18. *
      I7 z7 V' x% g" W8 R/ x1 h" n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 u" E, Z6 P; \( \
  20. * kind, whether express or implied; without even the implied warranty8 ~9 \1 c3 J6 ~' p8 J- O, q6 I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 h; i& a# M& ~& t3 h2 E4 `" d
  22. * GNU General Public License for more details.
    5 v8 q* h* E$ Q3 J! [/ e
  23. */
    * y& \7 w# ], H$ |, Q  V8 Y

  24. ; t6 o1 z) Y) \' I
  25. #include <linux/module.h>
    ! @& p: k# h0 p6 k0 l
  26. #include <linux/init.h>
    " F! H, |) ~, t4 c
  27. #include <linux/errno.h>
    ! W1 J9 S: A, ~1 K. f0 q( O7 S0 Y& ~
  28. #include <linux/types.h>
    & J6 c% Z0 P2 Y  C; v
  29. #include <linux/interrupt.h>- e" D& c6 f7 B8 x; z
  30. #include <asm/io.h>3 x0 K& V) L9 m: d4 J
  31. #include <linux/moduleparam.h>
    # n, d+ b0 _: F, k! p" H; t
  32. #include <linux/sysctl.h>& v4 {7 B8 n* ]8 Q
  33. #include <linux/mm.h>3 _1 f/ _3 Q! f" \. P
  34. #include <linux/dma-mapping.h>
    + P+ y  r9 m1 C8 }7 W  G$ Z. s
  35. * F5 F# |8 S0 ]0 ?
  36. #include <mach/memory.h>
    . p5 \: h1 G' m2 \/ ?1 @7 @
  37. #include <mach/hardware.h>* x5 |* l8 M- g3 Q( ]
  38. #include <mach/irqs.h>
    " V% ?0 i  T$ d8 p! t
  39. #include <asm/hardware/edma.h>, g, _2 l" o6 J4 c( u

  40. 6 H- g3 E* V- `7 r8 X  S
  41. #undef EDMA3_DEBUG# ]! _+ |9 `; ]5 e3 i
  42. /*#define EDMA3_DEBUG*/9 w. {5 |6 F" T

  43. 0 m9 O' P( ~1 e5 {' }
  44. #ifdef EDMA3_DEBUG
    6 t" k4 x8 w# z% A; Q7 P; }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 E# M* `  E1 C" Q. ^1 F. V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* w/ \# i$ r2 d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 U- y& l- C% `, C* d4 H
  48. #else
    ' L1 _: l+ o4 b) }* Q" z
  49. #define DMA_PRINTK( x... )
    0 q1 h$ c7 t$ q1 i4 d* c, _
  50. #define DMA_FN_IN
    ( t, }  U  H3 y% }/ P
  51. #define DMA_FN_OUT
    ( i8 @, L6 L; W$ [- n
  52. #endif* o; z% O; A: }2 o3 @5 Z0 w/ C

  53. 9 M" B2 N) S8 ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 b# b# n% H! h* \3 N
  55. #define STATIC_SHIFT                3
    , W- n: a1 P9 Q/ d5 C) r
  56. #define TCINTEN_SHIFT               209 n7 b2 l+ Z& [1 z) U$ Z
  57. #define ITCINTEN_SHIFT              21
    : U9 C- J3 W8 a( @. ^
  58. #define TCCHEN_SHIFT                22
    + q# _, c6 [2 r6 b: U4 k
  59. #define ITCCHEN_SHIFT               23
    - {9 `7 ]- U/ c% ^2 C4 u" G

  60. 3 g. ^! ?  t8 N* [
  61. static volatile int irqraised1 = 0;
    + v  d2 ?4 \3 @3 k
  62. static volatile int irqraised2 = 0;5 s' E1 Z1 \0 {4 Z. |7 A

  63.   A9 }' v0 V- q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 t# P- c7 a5 Q' F  T; a% w" D* M+ u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " n3 D/ y% ]' g  y( d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & W) a5 d+ t* S# ?+ V& a! W8 z

  67. # @" b9 X7 _: t) _3 c* x! F, |, Q
  68. dma_addr_t dmaphyssrc1 = 0;  D+ W- Q( L1 {; y3 w+ p4 K/ ^
  69. dma_addr_t dmaphyssrc2 = 0;9 D0 ^. M8 \) A+ w3 J6 ^4 g' R2 N
  70. dma_addr_t dmaphysdest1 = 0;( F3 y( }  w# W/ A- \8 @2 o
  71. dma_addr_t dmaphysdest2 = 0;
    # H3 L. a' w7 i# A' O: ?" i

  72. 8 U- |5 d) s/ \$ Q* V& [
  73. char *dmabufsrc1 = NULL;  j* C/ q0 @' d) V& \6 s' e
  74. char *dmabufsrc2 = NULL;6 l7 D5 M& ~% r
  75. char *dmabufdest1 = NULL;( I+ F2 V9 v9 i# n. \3 V
  76. char *dmabufdest2 = NULL;
    ! q1 g0 b5 F* U6 R* z
  77. * Y+ g  W' E& P* I' \% s
  78. static int acnt = 512;
    & L& ]( J+ b2 r2 j* X% L1 ~
  79. static int bcnt = 8;
    $ g4 M! g6 @7 i0 p
  80. static int ccnt = 8;* p, d# R0 |0 O) H3 b* k
  81. 3 P, |/ N2 G# L4 m7 z
  82. module_param(acnt, int, S_IRUGO);
    ) q- y8 h' u; a9 D. H4 E8 R
  83. module_param(bcnt, int, S_IRUGO);8 o: k" R5 Z: `! A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 r" a% E4 p1 w* G' ?) |7 @0 {

7 O3 X  ?& d- T7 X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' h4 w  q/ Y0 T. {' l0 j) x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' L$ K2 M5 d: L, Z5 T- |3 h
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 I# ~* s$ Z9 O' g: M! A7 H3 t: |2 Y) ?

) r: N' [+ A( [, i; s) W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-24 09:55 , Processed in 0.040525 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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