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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! Q% ~/ O% Y1 ~' Y  a3 L$ n% `0 t
  1. [code]EDMA sample test application
    2 `( V$ o1 Y+ u  p0 S: |
  2. /*
    $ S" d- n' V( z
  3. * edma_test.c  C# d9 c9 O7 f0 i+ a
  4. *
    1 M# f. X' y, p7 Z( K) c0 _
  5. * brief  EDMA3 Test Application
    : N2 X1 Q+ }5 o
  6. *
    9 |- v; k- ^4 A( p' x& P. u
  7. *   This file contains EDMA3 Test code.. g# X" A/ T( u3 j" q- h! l7 K$ v
  8. *
    " Z: \) Z) b7 b1 H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: |/ _: s* o& Y( `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " o, b$ Q& J  s- v
  11. *         TO CHANGE.9 N8 g+ g2 p: ]. r. d) V2 K" j3 \
  12. *) x, {6 T8 t- l. Z; E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % t1 _. E0 g* L/ U
  14. *
      j) s* A$ s: f! M5 n
  15. * This program is free software; you can redistribute it and/or
    8 s1 a5 v6 C/ N* {2 p1 g
  16. * modify it under the terms of the GNU General Public License as
    ( u& ~8 ^* \1 ?5 f. ^! D( G
  17. * published by the Free Software Foundation version 2.& G+ ^" e. G; H! N
  18. */ i' d' V: ^/ i" A. t6 [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% Z' Z3 U$ z" U+ v; Q
  20. * kind, whether express or implied; without even the implied warranty8 y, l# t6 k% r  l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ S' O+ G: M8 K3 |
  22. * GNU General Public License for more details.( w$ G: ?3 U6 ^5 K, `$ A
  23. */
    % d  ^" I( r2 @9 p- T7 z% S
  24. 7 m- E- m1 g5 ~; ?& ^: m9 B
  25. #include <linux/module.h>
    1 \4 J0 M: z2 _# |
  26. #include <linux/init.h>0 n( ^  g+ B& s& H# ~: H  \
  27. #include <linux/errno.h>: L0 j& L& Y/ |' q9 {
  28. #include <linux/types.h>
    ! B# e# Y6 Q( v. x; H8 a9 A
  29. #include <linux/interrupt.h>
    7 M, N7 q: N& F& t1 [2 Y
  30. #include <asm/io.h>( z* U9 A6 v7 y+ v% Q; k) P- M
  31. #include <linux/moduleparam.h>
    9 N9 |8 k7 x. z! C, E* o( L
  32. #include <linux/sysctl.h>
    5 D% z+ P  T- |3 e; |4 r7 a. X) z1 t
  33. #include <linux/mm.h>3 @( i5 U2 F2 U* Q; `! D( [
  34. #include <linux/dma-mapping.h>" S$ m& t9 g. K1 e5 m6 O) e% T
  35. # c" s+ `' S9 |3 _& n! ~! I
  36. #include <mach/memory.h>/ k  A6 f1 }" `+ h, B, C- G8 s
  37. #include <mach/hardware.h>
    4 ^, |/ m. I" O1 C$ }3 P6 x
  38. #include <mach/irqs.h>- c' h' V# }& t
  39. #include <asm/hardware/edma.h>
    / c  u2 {/ ^- i# @* X9 q% [

  40. 6 @- J5 n1 e/ |. `5 C
  41. #undef EDMA3_DEBUG
    ( p" ^) S- x6 B* S( G" a
  42. /*#define EDMA3_DEBUG*/6 a8 K* J. l4 h7 V- v5 y
  43. $ O2 M- b: w' w3 }
  44. #ifdef EDMA3_DEBUG, @5 X& t' r& j+ m* C& V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): ~. P3 ?2 G: p. I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 j" v- H6 s4 k9 M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 v2 E$ q# J/ t5 k
  48. #else
    4 V) m$ u$ n& B
  49. #define DMA_PRINTK( x... ), z! B/ Y6 h5 g8 N
  50. #define DMA_FN_IN
    ! i' y( y' b0 X2 a+ N2 q0 R+ v, H
  51. #define DMA_FN_OUT/ Y! {- x* T8 T% }5 u7 ~
  52. #endif
    1 R: b0 Q5 A% \

  53. ! r# ?3 [5 [% V' u7 v* v) {  i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 ?/ q; r1 P5 |& @% M6 e) }/ D
  55. #define STATIC_SHIFT                3* w7 O/ _, P6 j: k$ y8 r9 }
  56. #define TCINTEN_SHIFT               20
    ; T5 m% n) M9 R/ z9 ~3 T/ `: Z
  57. #define ITCINTEN_SHIFT              21
    6 D0 W+ n8 B, n$ r% T8 @$ \$ B
  58. #define TCCHEN_SHIFT                222 u6 A# t/ q* L/ s
  59. #define ITCCHEN_SHIFT               23
    ' f' e% I9 u3 `6 ~: ^$ O* |  I
  60. . o( D, ]. z2 F: L
  61. static volatile int irqraised1 = 0;
    : p9 j( K8 b2 \" O" k7 L: i
  62. static volatile int irqraised2 = 0;
    ) {- Z8 W$ X) k6 @$ N
  63. 1 o/ I4 t9 X; Z/ _5 _8 S/ T. p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% O3 x( {+ }- `8 c; I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ P- A+ G+ I9 A9 n& k6 T1 |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# B% V9 S" y5 Y$ h0 D1 l( C
  67. . l3 A, R6 t  f
  68. dma_addr_t dmaphyssrc1 = 0;- d/ l4 B3 b1 q  j0 B: i
  69. dma_addr_t dmaphyssrc2 = 0;' l' }$ q& Z/ j
  70. dma_addr_t dmaphysdest1 = 0;
    4 u* d+ m' C, b6 b7 X5 I% k2 x$ G4 ~) [
  71. dma_addr_t dmaphysdest2 = 0;
    , I- ]$ o/ ^, `+ k/ D7 k

  72. * L+ K& J1 T+ Y1 F' E$ G" a0 c' j/ q4 _
  73. char *dmabufsrc1 = NULL;' o' \2 q) D# N0 _
  74. char *dmabufsrc2 = NULL;3 x5 ]. b* Q" Y  X( f, o
  75. char *dmabufdest1 = NULL;# c5 b7 r% r: n2 [0 V. T+ ?
  76. char *dmabufdest2 = NULL;5 B4 e% v0 P& s+ t, Z9 Z

  77. + Z+ H  |0 a# i$ Q2 `6 N/ ?
  78. static int acnt = 512;. h$ q1 r6 {, l
  79. static int bcnt = 8;0 a, _: ?* D3 b; e; v& c
  80. static int ccnt = 8;
    1 N# o. k" m& v# f9 }( ]6 D
  81. 1 s* J" S% r/ x! B% Q
  82. module_param(acnt, int, S_IRUGO);
    0 l: d3 h1 L9 x0 J& }; E: Q
  83. module_param(bcnt, int, S_IRUGO);" K& f. x0 U1 Y) V1 H
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 g5 P. T1 z7 N! H$ L1 ~

: K5 Z) B( ?; z9 O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& F! |8 j$ u  V8 u. Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! h& ~: p; @$ W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ m* m5 Y2 g% [: \  S8 Y4 e7 P4 k; Y4 M2 i" j, ~  Z2 [
9 A; a/ _% C+ p4 W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 14:57 , Processed in 0.043276 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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