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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( x  m8 X8 f) G( G2 b
  1. [code]EDMA sample test application! A# O2 o1 t2 x- {$ l
  2. /*" Z/ I8 v% g& U2 M5 a: H# Q
  3. * edma_test.c
    ) U' j, _( L; i' @9 \- q
  4. *
      N, a7 B8 Z, `
  5. * brief  EDMA3 Test Application7 P2 a1 ?" B) \. k* u4 H
  6. *
    ' m2 v8 S5 M: @/ p3 J, S* Y
  7. *   This file contains EDMA3 Test code.
    , _$ }8 g! i6 a# H$ s
  8. *
    8 D& V: ], K2 Z3 Q7 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 E6 Z& U3 ~3 @* X) \' K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& {) a% _& l3 U. e5 Q+ {6 i
  11. *         TO CHANGE.4 {$ Y" s  `, a3 S8 A
  12. */ v. Q4 L, k2 G5 }( C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 m6 {9 J& e4 `3 {
  14. *
    ! T/ C" h5 P4 S8 k. Z
  15. * This program is free software; you can redistribute it and/or& t8 o% e9 {$ H5 P+ |. }
  16. * modify it under the terms of the GNU General Public License as
      p; f1 t. w) u/ p. U& ]( ~" m
  17. * published by the Free Software Foundation version 2.# U% x: V2 l) Q9 d! S- {, D/ o
  18. *
    ' A- w6 ~4 j. M# t8 w+ k5 h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 A2 f7 h+ ~4 N% o8 b- @: U" b
  20. * kind, whether express or implied; without even the implied warranty5 R: i2 A# e: w) a2 c& u1 j3 V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ b  p' ^, T$ h" h, @" b
  22. * GNU General Public License for more details.
      a5 r8 p/ s" A+ d! t
  23. */
    , |) T1 J+ x) i0 e/ P
  24. $ G4 {! X7 C; c7 Y0 }
  25. #include <linux/module.h>
    % `8 g$ G( N4 ~, L9 V' C
  26. #include <linux/init.h>
      A# g. f( N) V" @% `; S; T
  27. #include <linux/errno.h>
    % M. h+ d3 H" w4 w( ~7 m
  28. #include <linux/types.h>- @( S. Y% Q( q: E% m4 R1 O
  29. #include <linux/interrupt.h>! M& m9 P, S) D& e& C
  30. #include <asm/io.h>- F; O7 M+ Y, J% L, ?: s1 {
  31. #include <linux/moduleparam.h>( R6 e. v4 f( E9 f  _# b" H6 \
  32. #include <linux/sysctl.h>
    ' ]3 d* v$ y& L
  33. #include <linux/mm.h>
    6 x5 D0 a" z5 I
  34. #include <linux/dma-mapping.h>
    7 x1 T1 U5 d& s4 Z4 A* B, Q8 y
  35. 4 g$ r, U" ^, ~% ~$ I" z0 j3 i- o
  36. #include <mach/memory.h>
    8 {( s% x3 {# _- u& W5 a" X' m
  37. #include <mach/hardware.h># V# g7 l: U5 p" M- k; B
  38. #include <mach/irqs.h>. j7 e( V/ H3 x
  39. #include <asm/hardware/edma.h>: }6 Q. W7 c' `6 |* M

  40. + [# x( ]% ~- Q+ k6 A; q
  41. #undef EDMA3_DEBUG/ I- k, D! a8 T2 U, f
  42. /*#define EDMA3_DEBUG*/
    % B: P: L; i1 l3 E( T) H
  43. : S4 i' ~- f+ m4 d) y+ h
  44. #ifdef EDMA3_DEBUG
    ' [: S; m1 P: o4 C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% j0 f/ ]6 h0 |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 U0 o* m  t( J. j) A8 ^* a  h8 b8 z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* \( R% z& L' ~% M
  48. #else
    / \5 M1 u6 q/ Z, @
  49. #define DMA_PRINTK( x... )4 n3 a, ^6 n$ o% J: Y& C2 F
  50. #define DMA_FN_IN
    # g' B0 p* F/ p9 d8 J
  51. #define DMA_FN_OUT
    / D" A, v0 `* C5 f
  52. #endif+ r! C5 F8 Y5 j) k, b

  53. 8 ~" m' {- P/ x' V$ ^/ F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 J& ?* A! }. a
  55. #define STATIC_SHIFT                3
    ; {7 P% X. Q7 Q8 L5 o: }: ^
  56. #define TCINTEN_SHIFT               20
    5 q7 N& Y8 \& P- {
  57. #define ITCINTEN_SHIFT              218 S* a. K0 w/ O( C  ~
  58. #define TCCHEN_SHIFT                22
    ' \% J: S( U5 S6 I$ r3 ]9 N
  59. #define ITCCHEN_SHIFT               23( {0 M' C7 z) m# r) L

  60. 4 ]' p7 C. ~. E# B+ I3 x8 g6 O
  61. static volatile int irqraised1 = 0;7 z! Z1 o1 _7 U. J
  62. static volatile int irqraised2 = 0;
    9 h5 ]* X6 `/ v) [
  63. 2 E/ f( u' N# |# M# T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & i9 ?, F/ r* L) _( B+ x. E5 Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - y, s" f; O" d; [% Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % c) U0 F+ G/ B# x$ c* A) ~- k

  67. " L4 A* Y. s" h9 G0 b
  68. dma_addr_t dmaphyssrc1 = 0;( s( t2 y0 N/ ^# r/ C3 ^0 M. {# o" O5 z
  69. dma_addr_t dmaphyssrc2 = 0;
    " u# q0 e6 i1 \% Y8 z# |
  70. dma_addr_t dmaphysdest1 = 0;( h0 s$ B" s9 ?1 w/ G3 Z% m+ t/ R
  71. dma_addr_t dmaphysdest2 = 0;% O5 X5 K" f# |4 [; E& u
  72. ! r, G0 x! X  f. L3 f7 l/ P
  73. char *dmabufsrc1 = NULL;
    1 [& T2 P* v* {+ e
  74. char *dmabufsrc2 = NULL;
    ; L, }3 y' |( \& F4 `9 h! _5 Z
  75. char *dmabufdest1 = NULL;
    ! i7 k/ _3 ?/ [7 U1 a  E5 m
  76. char *dmabufdest2 = NULL;6 y+ W. P0 N: E( j$ c
  77. ( I0 M9 l) k. i, q* |
  78. static int acnt = 512;  G% m  H3 u& W( C& N! W( a& p/ U
  79. static int bcnt = 8;+ U1 M1 t8 H7 Q5 |" _
  80. static int ccnt = 8;
    6 {% P, q1 Z3 m) K/ ]. O

  81. + ~" j% j1 N' C) A
  82. module_param(acnt, int, S_IRUGO);
    1 P! K% w4 e$ s: v# L9 g  n1 B4 n
  83. module_param(bcnt, int, S_IRUGO);
    3 |8 J* o: r* M
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; ~7 U  r1 G$ M% X. {
9 g$ w, y7 N- }0 i: W, L+ E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# \( ?# ~6 O9 T- P# _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 n/ Y* Q2 f3 E6 _: Y3 X     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 l1 H1 h* y! x! R

9 {) u  ?& ~9 ~6 q1 Z$ W. N3 |& B9 t; q- q' |" T& i6 \/ j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-16 19:08 , Processed in 0.038999 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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