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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: m* V! x: b7 n# u0 Q
  1. [code]EDMA sample test application& T3 \8 C) _( D6 j/ b( J
  2. /*
    3 p" e; l2 u' |: I
  3. * edma_test.c
    % j5 ~; `/ q$ {! u- F
  4. *. D( b7 Z% A0 D( Z
  5. * brief  EDMA3 Test Application
    ! @  }( P/ W. Q. F' K) u' S( a
  6. *- R2 |0 y& q8 l/ x0 R/ {
  7. *   This file contains EDMA3 Test code.
    # p; w- Q  }! H7 I, Q
  8. *$ [7 ~5 s  u: W% }0 ^. m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 }* M9 X) ?8 o  Z% |. t) j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' P- y0 z7 |6 Z% h) C9 l* Q/ L. }0 z
  11. *         TO CHANGE.
    1 S9 \/ J. l, k7 A0 s
  12. */ B0 g. R. \2 Q- g$ j: H6 p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 P6 r& I# p' z- Z( S4 U, c
  14. *2 ]7 E: ~4 }5 \1 k# `0 H$ m3 H
  15. * This program is free software; you can redistribute it and/or. B2 @7 V8 f+ [. ]' A
  16. * modify it under the terms of the GNU General Public License as
    ( n; @  k/ y3 H/ ]
  17. * published by the Free Software Foundation version 2.0 h2 N* b+ e. T9 U' p# K9 b
  18. *
    0 [8 h% n" V5 `- x0 C$ ?1 N" M! e* C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* Y8 j+ F! F% [) ]  w
  20. * kind, whether express or implied; without even the implied warranty" n7 q" k" N# [6 C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 Z+ E& x& ?8 D. w
  22. * GNU General Public License for more details.( k  P* s/ e2 d/ p  X0 J8 R! Q
  23. */; N" T1 p4 M2 ^; @1 }
  24. / J* ?' E; B5 o- N' l9 _
  25. #include <linux/module.h>3 B9 Y( f$ o: x% @. S, R" t
  26. #include <linux/init.h>) Z/ i' j2 Y! ^& x9 H# D* u
  27. #include <linux/errno.h>
    9 y# b# m/ n  B" H7 a
  28. #include <linux/types.h>
    ! D# M  h0 x6 H% _
  29. #include <linux/interrupt.h>$ B8 w  a: Z7 E/ V( ~5 C
  30. #include <asm/io.h>; p) ]9 p! j* g& O
  31. #include <linux/moduleparam.h>
    ; o- |  A# l* }  ~& d/ i5 c+ p
  32. #include <linux/sysctl.h>4 |$ `  N, c+ ?: W' {4 D7 I
  33. #include <linux/mm.h>
    0 ]  I6 K8 y# {$ s4 J  ]6 q
  34. #include <linux/dma-mapping.h>; L  G2 d: w) T. ]; U( c( l

  35. 3 R" H" l# q2 t8 D" U2 J
  36. #include <mach/memory.h>
    5 [9 X. k* s+ V# \$ C% j( @
  37. #include <mach/hardware.h>
    ) P: M3 n1 K0 p  m, s1 c
  38. #include <mach/irqs.h>
    1 M" V& r& \1 K. w! [6 Q! |& I
  39. #include <asm/hardware/edma.h>& T: G- X- A! E  R9 o+ }; O1 G

  40. / }" f. @2 C( e* E& C' i/ y
  41. #undef EDMA3_DEBUG
    * p+ B" D5 g/ r, l, @3 @, s
  42. /*#define EDMA3_DEBUG*/: @" D( z: X* l
  43. $ G8 [! o. u. ?7 {! I- M9 g
  44. #ifdef EDMA3_DEBUG
    1 w8 O, ^7 j7 t5 r( c' H8 D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' [3 R9 S* D9 m: E; @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ n) w. g9 b0 u. Z. |4 m: h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - L6 a1 Z4 g% e* Z. l. m# o  P! I
  48. #else7 V  l8 s3 w- ^! A" A3 q6 b
  49. #define DMA_PRINTK( x... )+ i0 h4 }# U* [6 ^0 [* q6 q; T
  50. #define DMA_FN_IN* [9 M. t' ^0 P: x8 f" h) o
  51. #define DMA_FN_OUT
    ! [2 }6 n# c5 Y! ?! d0 c
  52. #endif
    ( _% {4 M* m8 o. t$ _9 X
  53. ! L" \) Z; t7 h7 s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % E% s' d  s: o. [  {( `* a
  55. #define STATIC_SHIFT                3* X1 [; V3 Q- o. G1 i% r" X
  56. #define TCINTEN_SHIFT               20% |; L3 U4 s. t. r! G- _
  57. #define ITCINTEN_SHIFT              21  }+ B3 _' O' t8 t
  58. #define TCCHEN_SHIFT                222 }! x8 `9 S8 x" X
  59. #define ITCCHEN_SHIFT               23
    ( Z2 L$ Q8 a& H! V9 a0 o& ~% [$ K

  60. 7 d1 ^' t; b; W
  61. static volatile int irqraised1 = 0;& v( C3 X3 p3 f) b" S: f8 Y) V9 o
  62. static volatile int irqraised2 = 0;9 a; d, z% D, n3 Z$ h. x4 r1 v" x
  63. ) }( z) U' m1 e9 K8 d. b% k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- _* q- d' V  I6 r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 K5 i9 O: f' T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 y0 m& D# Z6 U
  67. ' r) s5 ]6 o7 f2 M
  68. dma_addr_t dmaphyssrc1 = 0;& Z8 a# a. \6 d9 {; ~# K
  69. dma_addr_t dmaphyssrc2 = 0;: \9 P- s% ]* R
  70. dma_addr_t dmaphysdest1 = 0;
    * t' \! R" z+ `6 N
  71. dma_addr_t dmaphysdest2 = 0;# ]" y9 O1 Q3 Z9 Q7 ]

  72. ! E5 N" C  E; F( o9 `
  73. char *dmabufsrc1 = NULL;9 O0 \: ]7 q. [8 ~9 A1 u! ]
  74. char *dmabufsrc2 = NULL;, k9 z' o; }+ N
  75. char *dmabufdest1 = NULL;
    + ~9 j+ `: Q" s+ J  s; u
  76. char *dmabufdest2 = NULL;& G$ q& x4 i' e' X

  77. 3 ~. _5 f( y' i
  78. static int acnt = 512;
    * ?! d/ u; ]) P$ z. Q- c
  79. static int bcnt = 8;4 l( i) N3 V, G0 e# e: |* X: m0 s5 V# r
  80. static int ccnt = 8;
    # Y3 g% U! a9 I% `
  81. 4 X+ I7 R& |5 z; Y) @
  82. module_param(acnt, int, S_IRUGO);3 E& @8 J+ R  ^: u% W
  83. module_param(bcnt, int, S_IRUGO);
    4 K* L& i3 j" d  D9 S2 L- P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, E$ h5 n# ]1 S9 @: i3 @6 j7 M- w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 ?' u6 m" Y, d' C2 S% w# t; |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- V" w( P& |( j+ m' F2 N% Q& j3 p
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 Q5 d* t$ y: R2 m  l- X5 k

" u. y$ ?: V$ J1 d) f# ?9 X" L& u; s3 o1 h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-16 19:28 , Processed in 0.038021 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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