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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( ]6 d7 s. t' K2 k
  1. [code]EDMA sample test application2 V- f' o! f9 _& y9 y
  2. /*9 p( d7 |" w5 D+ k- O
  3. * edma_test.c
    8 x: N! g/ |1 Q& n8 e& D( s6 \
  4. *8 W+ j2 E7 A1 b" d
  5. * brief  EDMA3 Test Application9 G" `+ p  F. y+ o* F$ S' o- n
  6. *: Y, k8 B6 L/ A3 ?2 N& C
  7. *   This file contains EDMA3 Test code.
    " V1 Q- v1 C3 e) I# Z9 n
  8. *( z& T, f/ U( M" U! p4 p! ~0 i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- r) s, o6 y$ }. q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 }6 j9 g& P/ c0 k& v
  11. *         TO CHANGE.  X9 c5 n$ f( |$ W- ?# @
  12. *& R& A- M, u( t) y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 H  {$ t5 y4 A% g
  14. *
    1 t5 e* d" a+ n% l
  15. * This program is free software; you can redistribute it and/or) E  r' L2 h8 J4 \
  16. * modify it under the terms of the GNU General Public License as
    / h4 B. J; r7 [% B* V8 _% ^+ q
  17. * published by the Free Software Foundation version 2.
    + r0 a' K1 k8 r3 ?
  18. *
    ! q" f& v5 O" l6 U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / c9 ?  h: Y6 N- C* h; \' Y
  20. * kind, whether express or implied; without even the implied warranty
    # V  l8 |' H' x+ C& T8 \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# P( E* c+ }9 P3 N& T
  22. * GNU General Public License for more details.8 v$ \$ A4 Q, E  T- d
  23. */
    & @1 q: G3 u  a/ o9 k) |2 M
  24. 3 r+ c4 K! r, M( t- b* ^
  25. #include <linux/module.h>- J/ g8 a% Q- a, h4 j, C$ h; {: c
  26. #include <linux/init.h>' B/ r$ N. U9 H7 q
  27. #include <linux/errno.h>& R, [: s$ M5 {, w" i" F# p! I
  28. #include <linux/types.h>6 s, I( b- H# w5 g" O1 R9 T
  29. #include <linux/interrupt.h>
    , }* }$ _; C; s1 n. d5 f
  30. #include <asm/io.h>
    % d  @& w- J. u" v
  31. #include <linux/moduleparam.h>
    : F( ~6 w5 B+ g; e
  32. #include <linux/sysctl.h>8 B; b! F, o7 n, X
  33. #include <linux/mm.h>
    $ _- K+ s& |2 t' a# F. r5 s
  34. #include <linux/dma-mapping.h>3 l- I0 @6 S" D0 D& `
  35. 8 L$ v- b' F# Q" Q& ]
  36. #include <mach/memory.h>
    6 V7 W1 J  z7 p) s; V: e! T& F0 I
  37. #include <mach/hardware.h>
    5 z9 C& W$ p9 D" n- [; L, a
  38. #include <mach/irqs.h>
    : r/ H9 a- ?9 I) _" I% z" y
  39. #include <asm/hardware/edma.h>
    2 s! t: Z% @8 }( N9 Q

  40. 2 ?- i; ^0 o% _0 Y6 R# [/ t
  41. #undef EDMA3_DEBUG* C+ \, Q0 z7 k( r8 Y% R7 C, r
  42. /*#define EDMA3_DEBUG*/: n3 t0 w( ^. c8 G6 R

  43. / N1 E' N  P5 s6 n! i9 B) E
  44. #ifdef EDMA3_DEBUG* F# d. k. j1 y. |9 H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 P4 D1 [7 e5 \) M% R3 O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 x' z% E  W' }, ?0 C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! F! S0 d: f1 ?. E3 S1 K
  48. #else
    9 F$ c& w) t- o) n7 }1 W
  49. #define DMA_PRINTK( x... )6 g# \/ N) P, Y0 t3 h' b, m5 R' x( @
  50. #define DMA_FN_IN
    % j& N4 x! @" u. f5 u- o
  51. #define DMA_FN_OUT
    # o0 j  ]% e. V1 g
  52. #endif) u3 ^" a6 k+ H) j0 l: G! }

  53. 9 t. t, [/ u5 A' H6 @, ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# x1 A8 ?- e0 S$ z  l) K
  55. #define STATIC_SHIFT                3
    : T) S$ A7 Z& w* [8 u6 I
  56. #define TCINTEN_SHIFT               20$ X' H3 g( C7 h
  57. #define ITCINTEN_SHIFT              21
    1 x- m& O+ Z) w0 |
  58. #define TCCHEN_SHIFT                22
    - d; A$ e8 G" q/ V% I. A$ @
  59. #define ITCCHEN_SHIFT               234 `5 E. H1 h* ]2 q( n+ d
  60. " H, z  L6 C) i) y4 _
  61. static volatile int irqraised1 = 0;
    - e% Y1 y, ^3 x" }. c
  62. static volatile int irqraised2 = 0;" W" j# ^) k2 d2 i) R% Q6 h) U1 c

  63. ! v7 R2 k) ]1 w8 A4 w" B3 u- T: ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 ]; v5 ~  o4 C1 i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      v3 I5 E! v; b% I' S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ e3 T: W/ ~3 A. I6 H8 U4 F
  67. 1 z7 c( A: C1 ~, {
  68. dma_addr_t dmaphyssrc1 = 0;
    . d7 |2 C! `/ u
  69. dma_addr_t dmaphyssrc2 = 0;
    ; s" `# ?7 t3 b
  70. dma_addr_t dmaphysdest1 = 0;
    . V/ V, |! V$ W+ J* w4 U+ t
  71. dma_addr_t dmaphysdest2 = 0;
    ! H& v$ H0 {2 R0 a
  72. : Y4 l/ e4 y" Z
  73. char *dmabufsrc1 = NULL;
    ( h* J7 n6 T3 E' y0 q( w
  74. char *dmabufsrc2 = NULL;( X+ o9 {! d/ w, G6 t# h1 v
  75. char *dmabufdest1 = NULL;
    2 T2 W. q3 G5 j* V+ e  T  k
  76. char *dmabufdest2 = NULL;8 _! V$ q! \6 D- |  r
  77. " f0 c% X. P8 I/ q
  78. static int acnt = 512;
    2 I6 ~. x7 Q( E2 \, c1 f. }
  79. static int bcnt = 8;
    ' |7 I6 r- k' q
  80. static int ccnt = 8;
    / \& R( i8 F3 h1 p3 _( d
  81. - u% a. s3 O& T
  82. module_param(acnt, int, S_IRUGO);
    % }6 |4 l7 ^" C: H1 w) q, {7 c
  83. module_param(bcnt, int, S_IRUGO);3 M* S$ s0 n! e) _. z: R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 w. I! E% |. }) G- V/ X5 |8 r" X: f- \" Q5 O) A
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 o9 ]0 r6 W1 p3 {. carm-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 R9 Q0 [1 G3 X8 ?* q2 H
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 K, p( s: Y! f5 O
. T& z9 G8 f% j  r! _, t  G7 v
# D+ i( u  h- C0 }+ ?. w7 `- `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-31 19:31 , Processed in 0.036985 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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