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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" x9 |* @: w7 o. T9 ~  A* {
  1. [code]EDMA sample test application
    7 {+ b0 S0 h0 M" e1 d( Q
  2. /*. V0 h4 W  C. L* ]- M
  3. * edma_test.c
    . f2 w/ e1 B" X0 @! n& V0 _
  4. *
    ! X' q0 R" g8 C4 i6 r5 R7 l
  5. * brief  EDMA3 Test Application
    0 R" S' W2 t$ H- j: i- N
  6. *) s# c# W" Y/ c, g# W( M
  7. *   This file contains EDMA3 Test code.+ g$ a- j) v+ \5 e% j
  8. *5 o! ?* h, K6 v- l# N" Q7 n" Z4 d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # F# r5 ]1 M3 a+ Y; d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + s5 A# I4 O* ]. E
  11. *         TO CHANGE.& \1 ?9 r! a7 A0 ]) `
  12. *
    0 M5 _* W+ @: H; l( q' L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 c* C8 C$ h9 K. L  o5 `5 S5 B
  14. *
    / b/ X7 ^" w/ s( t; E
  15. * This program is free software; you can redistribute it and/or% H8 O8 ^: }' {7 Z( |7 c
  16. * modify it under the terms of the GNU General Public License as3 J. x2 k; j" O6 D
  17. * published by the Free Software Foundation version 2.
    4 S- y- P2 a( y! U5 P
  18. *
    ! I: J8 l1 Q8 }1 W0 x! q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( e9 n1 U" V# D  E
  20. * kind, whether express or implied; without even the implied warranty
    7 L& F+ B( @  ~1 E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 |8 U# |* H, ]9 y/ i
  22. * GNU General Public License for more details.
    , V" ~5 R* w5 k) N3 }) j
  23. */# D& O/ J+ }2 O7 Z6 K

  24. ( c. I' z! [* \& C% {1 L  @
  25. #include <linux/module.h>/ J+ ^1 ^0 P' Z, ?0 K( E8 b
  26. #include <linux/init.h>
    1 ^' Z, X, O$ a! A  z+ h6 j/ x
  27. #include <linux/errno.h>
    " _; v  [$ U  h& _3 M1 |
  28. #include <linux/types.h>* O* f! w1 V$ V" t8 E: u* J
  29. #include <linux/interrupt.h>
    % c, _6 @) O- G+ u7 ^# ?/ o
  30. #include <asm/io.h>( W' t2 w6 B8 C- e& A
  31. #include <linux/moduleparam.h>
    8 K9 _6 s9 M/ S1 n; c7 S1 f# D/ d
  32. #include <linux/sysctl.h>9 u, @# A1 k! c' I% D
  33. #include <linux/mm.h>3 }; n- I+ S8 _! \, M: `
  34. #include <linux/dma-mapping.h>
    ; d- E! \8 C1 r, v/ i* J8 |. c4 w* O
  35. 9 g/ m& q# A3 I% X( J) {& f
  36. #include <mach/memory.h>
    , ~% s& m: M0 R( ~4 L, q8 x
  37. #include <mach/hardware.h>1 @- N( S* u- D  l& q2 B1 \( k
  38. #include <mach/irqs.h>
    - @$ ]! P8 n1 Q2 i, B& Z
  39. #include <asm/hardware/edma.h>
    2 G( f/ l4 C7 ^  `

  40. - H8 O6 E& D7 Z% z+ W; a
  41. #undef EDMA3_DEBUG
    ) _# f3 J% V- ?# p
  42. /*#define EDMA3_DEBUG*/
    ; J+ q8 T- Z5 C/ c& v5 m" m* H
  43. ' G: D1 z4 M! `9 g( ^/ k9 j
  44. #ifdef EDMA3_DEBUG
    " A* k: W6 j8 }( X- `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). }/ n6 k: O9 Z: i9 ?9 Q0 j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ h2 S2 H( L9 P# K; g6 p" F& T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( E5 m) j* [3 J: f9 Q+ h9 i' C( Z
  48. #else
    ' v. Z; Q6 h2 b& _9 z; h
  49. #define DMA_PRINTK( x... )" ?( C, Q" _1 ^1 S. B
  50. #define DMA_FN_IN" i3 L- \/ W! v' ~. ?2 h
  51. #define DMA_FN_OUT7 z$ o6 Q6 Z4 ^
  52. #endif
      M7 f( r! g# [0 M
  53. ; a6 S+ K8 U3 ]- k1 V) R1 H6 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 C* F7 s& ^8 D2 W( s3 X" B
  55. #define STATIC_SHIFT                3& d9 d' h% s, {; K5 k
  56. #define TCINTEN_SHIFT               20/ C2 F7 o1 U8 x2 F) m# l$ `
  57. #define ITCINTEN_SHIFT              213 \: Y8 h, Q3 P! ~- V  @: }
  58. #define TCCHEN_SHIFT                22' @/ i, z5 o% i& D; R) U
  59. #define ITCCHEN_SHIFT               230 a) g3 a5 C  _+ P
  60. 5 x8 q) O! f- D; ]/ Z# w: r
  61. static volatile int irqraised1 = 0;1 o. z+ C% |% t2 I6 v1 X
  62. static volatile int irqraised2 = 0;6 N9 c! G/ g. L
  63. * Y5 W) a: Y" F& N# `$ |( d' o3 R/ j4 G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 F8 s" z+ ^/ [! [. r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( `( C& c% E) G  ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 H5 j/ D. Z/ k( g5 m) X! _8 q

  67. 8 V, D; ?+ b4 P, Y! q
  68. dma_addr_t dmaphyssrc1 = 0;- N# q6 ~+ U9 F
  69. dma_addr_t dmaphyssrc2 = 0;7 g0 k. _! y" X* \& @
  70. dma_addr_t dmaphysdest1 = 0;
    , T& E! P% A  j0 p  n- t9 i
  71. dma_addr_t dmaphysdest2 = 0;
    . G2 k" z3 X5 s. d  r

  72. 8 D. F3 c- `6 [+ X- v
  73. char *dmabufsrc1 = NULL;
    $ q" E& Z' V  y" _, S4 u0 ~, q, X
  74. char *dmabufsrc2 = NULL;
    - E. C# C9 l- ~  j' z8 {7 o: e
  75. char *dmabufdest1 = NULL;
    ; P3 J0 t: u0 I( `; w  H
  76. char *dmabufdest2 = NULL;
    * |# A2 \. @, O$ U0 {

  77. 4 g* G& R0 U: e* l1 B2 u/ O
  78. static int acnt = 512;
    + j6 z9 v6 e, }, ^1 A/ D' M8 _* a
  79. static int bcnt = 8;
    4 B" [3 B) v9 m  ?7 E2 m
  80. static int ccnt = 8;
    ! Y4 N" w) r; O) |6 C. i5 f; q

  81. . c2 ~0 A, u& \
  82. module_param(acnt, int, S_IRUGO);
    " {5 |& X! @! u4 f% C& a! c
  83. module_param(bcnt, int, S_IRUGO);
      K8 ^  c1 w! `# {# @' W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% b7 b  [0 `3 T# I; D6 [: T
, [6 w7 L& O( D+ V" C0 q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 C9 l5 x/ N% x, n! r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- a4 X  O7 w8 k8 p: I0 O2 `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* _/ i& }( l7 v2 u5 Q$ b
" V2 g8 [3 s, x8 D2 l6 Q  `0 S& _5 v+ F+ y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-16 20:26 , Processed in 0.041232 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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