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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 O4 E- [# Q; m
  1. [code]EDMA sample test application2 b( e! q- E5 J' @
  2. /** I; W$ J# t3 i4 @
  3. * edma_test.c. X, y9 [$ _7 v- x
  4. *5 s' E6 m$ c5 Y6 L' G. A& r
  5. * brief  EDMA3 Test Application7 `" }4 O* L8 ^8 r) Z2 C/ [
  6. *
    , T; a  C& G0 l* b! T8 Y) O
  7. *   This file contains EDMA3 Test code.
    - D" E5 E3 e% V/ A+ A
  8. *
    9 h( w& f- ]# y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : L0 q5 v+ l$ f# e- E/ W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 f! f. ?+ s- x
  11. *         TO CHANGE.
    5 ~: N. @. U$ D9 t9 P2 f2 a, g
  12. *
    7 G6 |" c9 n, `8 M( {2 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! }/ Y) D+ b7 V1 q2 d; G2 ]
  14. *
    ) s. ^: A; a" }6 X& L
  15. * This program is free software; you can redistribute it and/or
    4 e+ h5 ^, f  x& u6 K" W" C% Z
  16. * modify it under the terms of the GNU General Public License as( [4 E" h/ R9 l1 p% K
  17. * published by the Free Software Foundation version 2.
    ) A) Z+ K  N) {" `
  18. *
    * j$ |$ S! w/ Q5 `) g! J, w1 G3 q* v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: E5 h, e5 T3 o8 E/ f
  20. * kind, whether express or implied; without even the implied warranty
    / L3 j$ c0 Z5 R6 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' w$ R  Z3 v; n+ S8 ]
  22. * GNU General Public License for more details.
    , W: y/ q8 f6 b7 Q& x, s1 O+ B- K4 Q
  23. */
    : X+ u" N4 w% B9 P6 |# [

  24. 9 o- e# k2 X1 S* F( r5 l9 f" F. [7 X
  25. #include <linux/module.h>0 B% V( z8 ~: I6 ^) C( k
  26. #include <linux/init.h>) Z1 y( y8 v) E! k: v% a2 W9 \; w' S
  27. #include <linux/errno.h>3 J* M6 v8 v1 m  u
  28. #include <linux/types.h>! C" m, o  [- Q  d
  29. #include <linux/interrupt.h>
    9 |& U% D+ S9 |, |0 Z- J
  30. #include <asm/io.h>
    % C, a) L, @# T5 e: `/ G  p
  31. #include <linux/moduleparam.h>+ E' F9 }! `! W& ?% p
  32. #include <linux/sysctl.h>1 F) ^3 Z5 h- ?
  33. #include <linux/mm.h>
    : W' S# P6 Q+ I6 N
  34. #include <linux/dma-mapping.h>3 n0 W0 `9 x. L  f. n+ G/ b
  35. 5 G+ ^: o3 Y6 O' m+ f! m; Z/ G
  36. #include <mach/memory.h>
    * w+ P( n, W" v( Q$ c
  37. #include <mach/hardware.h>8 O( I: f, b5 T5 H! u5 \, N
  38. #include <mach/irqs.h>
    ! K- W4 A0 l( @+ m1 S
  39. #include <asm/hardware/edma.h>7 ^2 G( m( D2 {3 E7 m
  40. 6 a3 u2 r. E/ @, b# m( ?2 C9 }
  41. #undef EDMA3_DEBUG+ r+ w% `6 H: @0 r$ {+ U+ h" F7 _5 B
  42. /*#define EDMA3_DEBUG*/3 m& p% L" A. X' v

  43. % Z+ O) h, g2 k+ U" Q
  44. #ifdef EDMA3_DEBUG
    5 E8 T  |4 @3 Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% G# n0 V  b* A4 t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / H, U. D: }/ l  X6 ^( |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- Z, _& d; k4 F2 Y
  48. #else6 L% v* v$ m3 a2 {% y3 x5 N7 G
  49. #define DMA_PRINTK( x... )2 o  ^/ I7 n* L: c9 p$ Y6 F& @
  50. #define DMA_FN_IN
    4 R; l# P- Z& d6 E! K7 v+ {
  51. #define DMA_FN_OUT
    % V# c1 e. f4 d& G$ |; }
  52. #endif
    2 D/ o. o) g0 o

  53. ) P+ E: P( _( o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ R4 e. u' _- Z3 K3 _/ g
  55. #define STATIC_SHIFT                3  b3 E, ?7 ]+ S! N# X2 j0 v8 c
  56. #define TCINTEN_SHIFT               20( C' s* a* `8 R5 I9 y# \3 Q( r# g
  57. #define ITCINTEN_SHIFT              21
    ' W; z3 s! L5 [, ?" j. B
  58. #define TCCHEN_SHIFT                22
    / N7 A5 ~& ]# T$ M& B
  59. #define ITCCHEN_SHIFT               23! l- B: E: j) I6 w

  60. 4 |- G9 O+ A* H) E. B: @. a$ G
  61. static volatile int irqraised1 = 0;
    * k) M3 F2 L' W( l
  62. static volatile int irqraised2 = 0;* H' d# @* h- w/ O
  63. + j% x8 T/ e9 p; e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' ~( h( T5 M6 `7 M! p$ T" I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; P1 k2 ]) Y2 Q$ ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ^% k! f8 Z7 m
  67. ) x5 V' l6 Y6 G  S$ K
  68. dma_addr_t dmaphyssrc1 = 0;! {  s/ K- R  b/ O/ M; N1 k; r, \
  69. dma_addr_t dmaphyssrc2 = 0;, [- ?' A1 |  d$ i- m. I
  70. dma_addr_t dmaphysdest1 = 0;' Y1 m/ f3 Q0 D  e! o9 q1 {
  71. dma_addr_t dmaphysdest2 = 0;+ j+ a3 i1 X9 W5 F, `7 J6 T
  72. 6 ~0 C' ]! |& |6 f9 ]
  73. char *dmabufsrc1 = NULL;
    7 i! O" w( h' m. F$ K8 _2 C
  74. char *dmabufsrc2 = NULL;# L2 @+ a* y4 n" J2 ~$ k3 j2 K
  75. char *dmabufdest1 = NULL;
    ) W$ q5 o: O" N  S
  76. char *dmabufdest2 = NULL;
    5 }! v5 H# U- @. F) R# z7 ~9 m

  77. 3 u: i8 u3 [# `& a! @  L
  78. static int acnt = 512;
    / h; }8 a6 P# F) B7 K. S9 ?# g
  79. static int bcnt = 8;
    ; f# y0 R4 e, R* r1 c( `
  80. static int ccnt = 8;& Z8 Z% ], K( F

  81.   i6 G7 A) l5 f* Y, c" M, I
  82. module_param(acnt, int, S_IRUGO);
    1 F7 q1 P! y7 B: T$ }
  83. module_param(bcnt, int, S_IRUGO);  M$ m% S  u6 K$ H2 x
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 u( T. ]3 t+ c9 s7 I
- @3 ?! Z$ g+ I1 B" l$ v" ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& ?: k# X( C2 a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; r$ S2 ~( x7 H1 s  h/ a/ n0 s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: e  o& L8 h, L6 \
8 h# c2 K3 p2 ?8 x' Z: J
) {0 u6 M: i3 J; H. B+ z3 M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-29 23:52 , Processed in 0.039216 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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