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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& j: C+ C1 k) v4 T; m+ Z
  1. [code]EDMA sample test application  J& l' w4 [7 r9 S. x* \
  2. /*
    4 \" {4 f0 |$ y4 r  E+ n
  3. * edma_test.c6 W" V: g2 |0 J
  4. *
    ; e8 m7 V6 V- n. k
  5. * brief  EDMA3 Test Application
    7 w/ O5 ^: \, P9 u" G) j
  6. *
    0 t' N2 I$ Z+ s
  7. *   This file contains EDMA3 Test code.
    9 m7 d5 j3 g6 `. M* |3 X# ~
  8. *7 \  P" o) O3 d$ m8 {; _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      x6 g6 Y7 A9 t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - U9 z- o$ a9 Q& w$ q* Y
  11. *         TO CHANGE.- V1 e6 h) g* z" N# s# h
  12. *
    * Y$ j) a2 a5 u5 x+ \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 s4 Q2 J2 T9 [2 v; z  Y
  14. *9 n4 n, e6 D' t+ A8 [' d. G
  15. * This program is free software; you can redistribute it and/or
    * g) N: X; \  j& o5 A
  16. * modify it under the terms of the GNU General Public License as
    ; E, w' H" Y  B- M. M# p7 Q' `
  17. * published by the Free Software Foundation version 2.. O: g# S2 ]1 h/ F& h$ w
  18. *
    # O9 a; M3 u& v# @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ W+ o, {( v. m1 w
  20. * kind, whether express or implied; without even the implied warranty
    % m/ |# U9 c; e$ V( X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 w7 c. d6 {8 Z# w/ m
  22. * GNU General Public License for more details.
    ! ?! [. L1 M. }, F' I
  23. */$ r( Z% y8 x: j

  24. 5 b' d: d: V& ]9 Z) C7 P- ]
  25. #include <linux/module.h>
    " X- h( v# Z  P+ f5 {6 _; C$ S
  26. #include <linux/init.h>- O$ P5 n. [8 \5 a( {2 f% s2 o* C
  27. #include <linux/errno.h>
    $ ^# }5 Y2 F" D' [! [2 u
  28. #include <linux/types.h>; b4 N/ l* e6 \3 ?) P( P
  29. #include <linux/interrupt.h>
    ) k; C$ k8 \" p% x* r
  30. #include <asm/io.h>) Z9 j: x1 ^; _
  31. #include <linux/moduleparam.h>
    ) Z1 r! v# _# \, Q/ e3 I" b5 y
  32. #include <linux/sysctl.h>' p% W8 c+ v; W' y" Q, s
  33. #include <linux/mm.h>* v# V! R% Y2 p1 p
  34. #include <linux/dma-mapping.h>  m2 J) F. l0 p' K$ x2 S/ H  }# `
  35. 0 r( U4 s8 U4 B: w$ M
  36. #include <mach/memory.h>
    ) t, o6 a6 w) C2 ~2 ~; F1 J
  37. #include <mach/hardware.h>
    4 t& Z$ ?- h5 D$ Q# Z
  38. #include <mach/irqs.h>' W0 J6 ^' f& k. o
  39. #include <asm/hardware/edma.h>
    & Q+ }8 w) m3 }
  40. 5 n$ q. A. S( C0 _
  41. #undef EDMA3_DEBUG
    : j2 Z8 f2 K$ \( I
  42. /*#define EDMA3_DEBUG*/
    $ K- |% E+ W0 n  G3 M

  43. ) C# f: p  m5 u9 x$ G9 v
  44. #ifdef EDMA3_DEBUG
    / q" ^5 P, m7 r2 B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . Y7 O8 Y. u0 a+ P2 ^+ M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* U$ q3 V+ \6 U) ^4 D8 A( N% |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' Y# x8 i" a) q. p
  48. #else
    ; Q4 ]& L4 r0 d9 _$ t; b% i
  49. #define DMA_PRINTK( x... )# k5 I! C6 t4 e3 K
  50. #define DMA_FN_IN
    * A* r" U6 A" Q6 R
  51. #define DMA_FN_OUT1 o8 b% r2 z- ^+ o7 E! P
  52. #endif+ |  b9 N/ |* t  b+ e$ j/ t" J

  53. " i. B: b" b* R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + T1 f& Z/ o5 n1 ?* |
  55. #define STATIC_SHIFT                32 c# a# c% F# P$ _, C
  56. #define TCINTEN_SHIFT               20" ~. A" @" V% J
  57. #define ITCINTEN_SHIFT              21: f9 ?% v" U! {" O
  58. #define TCCHEN_SHIFT                22
    , c9 ]( N" U" x* S' e4 W
  59. #define ITCCHEN_SHIFT               23
    ( b0 O- _3 f4 W. J
  60. 6 U3 f% f& Q0 \: D) _# m2 r
  61. static volatile int irqraised1 = 0;
    % ?3 e6 B1 Y; |3 n& e
  62. static volatile int irqraised2 = 0;0 P. o. t( q* Z. ^" F/ e1 u
  63. 4 G/ C* x0 x& y; B/ D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* W$ v2 [" c0 G* h: X6 ~( L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Z) A7 W3 `; Q3 E  A7 x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. I* C2 A7 P" ^* g5 {; B- S0 k. F

  67. " G5 n! r; L" f$ l
  68. dma_addr_t dmaphyssrc1 = 0;; e5 V; d+ h* q+ O- i& `
  69. dma_addr_t dmaphyssrc2 = 0;) H9 W# q' G9 i6 l
  70. dma_addr_t dmaphysdest1 = 0;
    ! _8 R  T! \2 k# S4 k2 s5 x, v  k, T9 Q
  71. dma_addr_t dmaphysdest2 = 0;
    ' |  d6 t1 Q3 P' `
  72. : N2 ?5 b/ ]$ C+ a* m
  73. char *dmabufsrc1 = NULL;# ~- ^, u# u! U1 l" v4 l
  74. char *dmabufsrc2 = NULL;) Z( T5 X1 B- a
  75. char *dmabufdest1 = NULL;, }% r2 G+ [4 {6 a5 h
  76. char *dmabufdest2 = NULL;! Z% W4 j. }  N  g

  77. & z) e- L+ M9 c4 ^% S% O
  78. static int acnt = 512;1 p$ e6 F0 K2 \# J
  79. static int bcnt = 8;
    6 p6 c% O2 C( ], R$ v. ?/ R
  80. static int ccnt = 8;, r- V7 {- S0 N) X4 \- A1 u
  81. ; K* s9 I  g% ]& E, A: [9 g! E
  82. module_param(acnt, int, S_IRUGO);
    % R6 E. j" ?6 p  V0 ~
  83. module_param(bcnt, int, S_IRUGO);% X  F4 {3 m. j* [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 ~; A& k" T$ U
/ s5 {8 g$ q2 M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 y4 h& F( s1 R- M& g& p1 M1 g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" ?8 j% Q! A- V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" q' H0 p0 ?& t, P2 G

/ a7 `8 l' o2 k: _/ h
+ x/ ~. B4 R: r$ Z9 g- q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-19 05:10 , Processed in 0.038150 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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