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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! b) F0 U; f3 q' [" ?7 j- J
  1. [code]EDMA sample test application
    * f+ D2 k( C$ u6 U/ W
  2. /*
    ; V- w4 d8 r7 b1 d3 e
  3. * edma_test.c( J* ?/ L, Z: ]% }
  4. *
    - o1 s5 e6 j' E4 G, a
  5. * brief  EDMA3 Test Application
    1 k, F8 A  W: Z6 C5 C" k) }
  6. *- ~% s6 `9 t1 {6 G/ X& A
  7. *   This file contains EDMA3 Test code.
    % w* y$ i" O9 A
  8. *
    ' v( M' H6 a5 x& F9 G. ?9 F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      V4 a4 r. ^3 s. z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 ]+ `* R, Z- O; P' y5 g
  11. *         TO CHANGE.0 J2 P$ M  F: _0 r0 b
  12. *
    9 F  v2 z% X: N' N+ C  w5 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 f6 x' h5 c- B5 {& `' M3 d1 r9 ?- K
  14. *8 I3 {5 T6 q- {3 k3 p
  15. * This program is free software; you can redistribute it and/or
    ( l: ~- S1 i6 T: Y) m
  16. * modify it under the terms of the GNU General Public License as* d1 @9 _) B; N/ X( B
  17. * published by the Free Software Foundation version 2.
    1 n$ a' I3 g+ |- _8 ~8 p1 \/ V: T
  18. *3 f" W9 ~4 B$ J9 X% @$ c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / F- N- s; w- ?! R$ k
  20. * kind, whether express or implied; without even the implied warranty& p! U* y' a. K2 M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 H, r7 T9 M2 y- H; z) a3 m
  22. * GNU General Public License for more details.
    ' n3 b$ L& i4 H( e: [$ p" p
  23. */
    " t7 G" ?& z+ y" f+ T

  24. * y4 C& `" W% r- t+ V5 w, y1 k7 X  V
  25. #include <linux/module.h>
    2 q9 Z, P2 ^& C, N9 e! O$ W4 h
  26. #include <linux/init.h>  x4 v5 i! j8 `1 W6 P- Z
  27. #include <linux/errno.h>
    7 V5 k  t% H4 G" R( e' @
  28. #include <linux/types.h>
    ) C8 s3 L. o! X0 f' Q& \4 @
  29. #include <linux/interrupt.h>
    ( l* |! o& K  ]. f) T+ R. B
  30. #include <asm/io.h>. K5 r6 Z, g' u/ s2 [
  31. #include <linux/moduleparam.h>
    . b! N) E  l* K
  32. #include <linux/sysctl.h>
    + G6 }4 t! |5 q' w* p+ B! J; H
  33. #include <linux/mm.h>6 A& k  c2 p" Y
  34. #include <linux/dma-mapping.h>
    9 w/ W9 c5 _: o- |# T# R- B7 u1 w

  35. 9 W) b- H0 e  A- x2 K# M" I! h' o
  36. #include <mach/memory.h>
    % T- x) _& S4 w3 J2 a
  37. #include <mach/hardware.h>& Q( C. z9 a5 i  T- G# t. F% F
  38. #include <mach/irqs.h>
    $ ^4 H; M$ C; X6 c! q( H
  39. #include <asm/hardware/edma.h>( D4 f+ H% p4 x+ }9 Y

  40. . a. q# C" ]8 a$ d
  41. #undef EDMA3_DEBUG( ^( _% B: D  Y9 K( `. H* B
  42. /*#define EDMA3_DEBUG*/
    ' w. @, y0 {* |

  43. 8 I) x- r9 E. F, @. _
  44. #ifdef EDMA3_DEBUG! D7 R/ Y! \1 y# r9 D: J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ V3 n# o3 M' v: ?1 k$ Q) l. W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' G4 j+ N  l5 O, X3 d) n% l" T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ l( H, f5 |. m- a5 X% @: A
  48. #else
    ; q& K6 X6 S( t
  49. #define DMA_PRINTK( x... )
    $ d5 N( @' h* T$ P6 Q
  50. #define DMA_FN_IN& G' x7 @. R3 `7 N  s
  51. #define DMA_FN_OUT  N1 F, ]) M2 u
  52. #endif
    $ k+ L- R/ b- d# l$ I3 @  m' w4 ~
  53. % J7 n7 [% z, K/ P% S8 \: K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , @3 h" d" C  g( G/ Y. g/ z& x, D
  55. #define STATIC_SHIFT                3
    2 f2 D/ ?0 J% T8 k8 v' [' ^( D( E) N
  56. #define TCINTEN_SHIFT               20" p; z+ X( N; o
  57. #define ITCINTEN_SHIFT              21
    5 d! }) Z- e7 s' O$ C  J9 r
  58. #define TCCHEN_SHIFT                225 K- T; J5 I2 s
  59. #define ITCCHEN_SHIFT               238 t$ v* q% q) F& t
  60. 8 v- T! a( L; d
  61. static volatile int irqraised1 = 0;4 g0 z5 [7 L+ g0 W; E, |, z" {' c# J
  62. static volatile int irqraised2 = 0;
    ( X3 l! h' ]0 M; b7 E# f% m
  63. ) H% T& j0 S( N+ q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Y3 o+ ?7 z% b1 P6 z+ ]* v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 }7 ^- y; ^. l! `7 ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% i; _1 o2 W) R- T

  67. 9 \5 [8 v/ Z% v9 B
  68. dma_addr_t dmaphyssrc1 = 0;
    5 B  H7 o: n4 w
  69. dma_addr_t dmaphyssrc2 = 0;. M( r8 M) s. \
  70. dma_addr_t dmaphysdest1 = 0;
    . ]6 |# @8 l' }, l
  71. dma_addr_t dmaphysdest2 = 0;
    ! {  `$ V, m+ ?3 N, }$ G% d! d
  72. 0 V$ w) l" r  s& s; ^
  73. char *dmabufsrc1 = NULL;
    6 }  X& ^" d2 x; T
  74. char *dmabufsrc2 = NULL;  ]5 G8 h: O; J$ F0 C8 z) K
  75. char *dmabufdest1 = NULL;8 `3 q  @4 O/ D( e6 [
  76. char *dmabufdest2 = NULL;
    $ A6 a' ]4 V, _1 k6 \& k, @/ Q
  77. , R9 \- a, @" E) [$ [6 b
  78. static int acnt = 512;
    9 @4 ^+ |6 D+ z4 V- U
  79. static int bcnt = 8;
    + H. o) Y2 {/ @# \$ u2 a
  80. static int ccnt = 8;
    2 e7 T. I; l. D4 h! T  q

  81. ' O5 u2 U6 I1 t" M
  82. module_param(acnt, int, S_IRUGO);
    ) l/ d9 k  X1 h3 N: n
  83. module_param(bcnt, int, S_IRUGO);9 d6 o$ f( E, M' Q2 A) h& C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- E6 `, H7 x7 y$ S9 w" j
8 X) F! \; h3 ]$ P2 _# C# A      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% P5 s4 c1 [. F4 Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 [. {! D2 G  E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 j4 J( j  ]8 i. |" U4 k; ^; }& Z) A
+ u3 `; l: G8 O( r2 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-13 23:17 , Processed in 0.042172 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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