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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : W' z( p4 I# R5 k+ n5 ^1 V2 C
  1. [code]EDMA sample test application
    $ g  C5 E6 e* f/ y  K! S+ ^8 [
  2. /*
    $ d$ ]9 b8 T: C2 M% b( D& y7 w
  3. * edma_test.c+ q4 y6 E4 J6 v" U0 Z/ \* y
  4. *- o, P$ N% {; }
  5. * brief  EDMA3 Test Application
    / x3 m; d0 l2 H: |) j& ]3 O
  6. *
    " Y# ?5 g) I. O$ q* |/ O/ S
  7. *   This file contains EDMA3 Test code.9 X5 e7 {/ h7 y% ]
  8. *
    + U; I2 A; s; f6 r* a) W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 {$ q& N; O8 B0 [( S, Y9 I% a* H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & i: K; Q  T4 A( T' ?$ z
  11. *         TO CHANGE.
    ' C& D5 o5 p: ?; D6 d
  12. *
    4 l& E9 R$ q: R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % }* ?* \2 l0 j8 v3 `+ P5 S
  14. *
    & c6 m0 j; a5 f& s8 ~9 a
  15. * This program is free software; you can redistribute it and/or
    - C0 k+ w( D. E+ v4 e- g, I
  16. * modify it under the terms of the GNU General Public License as
    ; P& K+ C, v& ?; `$ J% i
  17. * published by the Free Software Foundation version 2.
    3 K6 y5 c0 F6 T1 A* I3 X8 L
  18. *
    - S; G* x' g6 C( {* b4 j& i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, J+ C# R( B$ E5 J
  20. * kind, whether express or implied; without even the implied warranty1 I1 D9 p, g, |" \. q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; r( l7 `. J+ ~6 }
  22. * GNU General Public License for more details.
    : ]3 K: \: E1 z6 X* m1 }
  23. */
    2 _4 l, d0 V: i! J! Z  }8 r3 G

  24. ; a" M7 W; f3 R4 h
  25. #include <linux/module.h>& l' f% A! E/ U' C$ i* ^. V
  26. #include <linux/init.h>- g& x8 m4 g2 H0 k5 ]7 R4 j
  27. #include <linux/errno.h>) G7 x! j& u( ?
  28. #include <linux/types.h>* a& |0 l, e1 `; K
  29. #include <linux/interrupt.h>6 @- [: U2 s% z
  30. #include <asm/io.h>$ A* L" o  f4 o5 J/ b' v1 F! E
  31. #include <linux/moduleparam.h>0 z4 b  D( E, Q4 i
  32. #include <linux/sysctl.h>
    ! n" @, f2 D% z, i- x- E
  33. #include <linux/mm.h>
    ) [8 U. }' r* s# Y& v" P/ J/ @4 p
  34. #include <linux/dma-mapping.h>; A# T& `4 N( H# g$ q9 A

  35. - ]% Z$ J/ d; |8 B2 J( m9 u+ X) k0 b
  36. #include <mach/memory.h>
    % `" i8 o0 b8 i- W. h
  37. #include <mach/hardware.h>1 J- `  m8 E3 I6 o+ m" K
  38. #include <mach/irqs.h>
    , u3 Z. a! ]. E" ]" J1 ^% L. U2 s
  39. #include <asm/hardware/edma.h>& [1 r4 i7 D/ @. P1 L. ]: f
  40. 9 v# J# O8 z8 q& Z% L+ L3 Y
  41. #undef EDMA3_DEBUG
    1 M, h' E# h, W. _# R; w
  42. /*#define EDMA3_DEBUG*/4 S2 s6 @. a* w1 y4 ?
  43. * E4 j, `' C+ C/ x. F* }. U5 }
  44. #ifdef EDMA3_DEBUG5 @2 _/ |3 E1 B, y3 ^' u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) @$ K7 Q& v+ Q" D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ J% K7 |" Y2 _9 D3 c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& j% `! [7 g  X6 ?, \9 e2 U2 O
  48. #else
    1 j6 y, \) z% ~! l: t& l  v
  49. #define DMA_PRINTK( x... ). d% G3 P3 U2 z7 [5 Q
  50. #define DMA_FN_IN( O8 l+ h0 n  |$ w4 |6 R
  51. #define DMA_FN_OUT. L6 W; q: |: N; ?" {3 Q6 [
  52. #endif
      d5 i1 U" u& `$ E/ A8 o
  53. / [: _3 N3 L6 T# k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( n( V  e$ f0 g# P8 x
  55. #define STATIC_SHIFT                34 G' F- H6 W5 y7 s% L
  56. #define TCINTEN_SHIFT               20
    6 `0 Y+ |6 D' N# L
  57. #define ITCINTEN_SHIFT              21
    . e1 A0 R6 U8 t  C
  58. #define TCCHEN_SHIFT                22
    " ]- M  C2 l; N  h* R# b5 G
  59. #define ITCCHEN_SHIFT               23$ t4 Y1 Y! L, r3 O, F+ F

  60. 4 F/ U) N: ?8 u1 O; [+ s1 f
  61. static volatile int irqraised1 = 0;' ~7 u  M4 ~- w+ A: g5 V( J
  62. static volatile int irqraised2 = 0;9 a0 b, @, k; ~+ o

  63. # K/ B& [% C( C( @/ g4 t2 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * Y9 h0 D9 g* T' ~' N3 m7 U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 q; B% g. C" i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ \9 f9 [4 Y) b. M, E
  67.   E+ y5 L. _% V; x& J
  68. dma_addr_t dmaphyssrc1 = 0;
    3 S) w7 u- R& a- j
  69. dma_addr_t dmaphyssrc2 = 0;
      @& u' s) ^8 J
  70. dma_addr_t dmaphysdest1 = 0;
    : \6 |# y: x5 }, c) L  l
  71. dma_addr_t dmaphysdest2 = 0;
    4 H0 t1 C; a  K/ H/ S8 T+ @
  72. $ m& W. @+ b) R) Z2 T. n$ S
  73. char *dmabufsrc1 = NULL;& S4 _$ V+ ^  Y7 Y. K% T. Y0 F
  74. char *dmabufsrc2 = NULL;8 f8 J! f4 A0 v$ }6 l- K% |) |, C6 S
  75. char *dmabufdest1 = NULL;
      }, Q- G) Q; ~" [3 V; p- o" P
  76. char *dmabufdest2 = NULL;3 k- e3 t: d6 B0 X6 b5 T6 Q
  77.   m4 j$ Y0 G5 I, p
  78. static int acnt = 512;
    : I4 v9 m% B- B0 v
  79. static int bcnt = 8;
    ) ?- o% j+ H6 B' E( m
  80. static int ccnt = 8;; k4 P- Y, K6 ?; H
  81. 6 T2 Z. W' E; Y5 W" \/ k( E
  82. module_param(acnt, int, S_IRUGO);
    + V! }2 j; _  `8 h7 S+ b+ Y, y) @
  83. module_param(bcnt, int, S_IRUGO);2 Q2 C; k2 a7 @5 p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; S$ ]9 {2 b- t3 R; P

1 v' L* i. u5 y" g! I# i      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 j' K, b; Q/ a( P6 R8 d. m- aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 V# C4 K4 K' ?# H
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 j( `* ?. h% U; g
. }* B& F9 d* W4 I: U/ Q. j1 A$ p/ v, z2 D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 00:03 , Processed in 0.038975 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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