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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: c7 c# Q& ]6 D% e+ h4 E0 r1 E
  1. [code]EDMA sample test application
    $ e7 L% n9 b! N
  2. /*
    : Y0 q4 _( P3 b
  3. * edma_test.c7 q% ]% u  g- {8 W' a; q, o* e
  4. *
    / H1 ~* P/ d; p; x9 k0 k
  5. * brief  EDMA3 Test Application& a5 \' A* x- {
  6. *# C' A- P1 n6 g9 {- j1 i7 O
  7. *   This file contains EDMA3 Test code., e! A. O2 g6 i- f) y
  8. *
    # F# r$ R, L( }" q" H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 u' K+ X7 b9 |4 u! h: T7 ^  n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ \7 [8 A6 }) O  k
  11. *         TO CHANGE.! y, X2 X/ @4 w( X2 b4 D
  12. *8 K  U! P$ A! J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& ^, }8 h6 G! N/ p4 J
  14. *$ I, q+ U3 C  G0 z1 p, L1 x' }
  15. * This program is free software; you can redistribute it and/or
      F; A9 F: O$ k) O. s
  16. * modify it under the terms of the GNU General Public License as, R8 Q7 e. S  a+ n1 @+ @3 i
  17. * published by the Free Software Foundation version 2." ?. Q* \" V' K' m
  18. *! j& ]) V3 D3 c) {6 [1 F5 [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 n& a4 s* d( ?) B3 l: p
  20. * kind, whether express or implied; without even the implied warranty$ b. T- N5 Y4 n' p0 i1 Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * s2 n% e3 y' F$ {# x7 L$ V: r& f( a
  22. * GNU General Public License for more details.
    3 P6 Z1 r1 A( r! U: i! B) j
  23. */
    " F& L3 `9 A0 ]: O" h3 N5 B3 V

  24. ) g; \3 N7 x# D
  25. #include <linux/module.h>
    : h' g- ?0 @" T  L, A! |
  26. #include <linux/init.h>( k+ [( t  J) v# Q; _  R
  27. #include <linux/errno.h>0 `) T0 U9 M1 a2 ~
  28. #include <linux/types.h>/ y9 o0 k* S4 g
  29. #include <linux/interrupt.h>7 M1 @# p0 n7 }
  30. #include <asm/io.h>
    7 i/ N0 Y3 D! t6 P
  31. #include <linux/moduleparam.h>
    0 {9 f3 W: s6 I
  32. #include <linux/sysctl.h>
    & ^  f2 ~" a5 `
  33. #include <linux/mm.h>
    5 _9 v  Z5 I8 `/ |4 r& M- D( \5 e% C
  34. #include <linux/dma-mapping.h>
    : L  h4 f& I  a$ E2 a" p2 B

  35. / F6 h$ f0 n, f/ R  e
  36. #include <mach/memory.h>1 \; g4 ~" i# f5 w. }1 s
  37. #include <mach/hardware.h>0 g( u5 B" F; z2 o) A
  38. #include <mach/irqs.h>
    4 W1 }2 t2 {# U
  39. #include <asm/hardware/edma.h>% D& j- f1 w  p: y8 _8 a5 |8 e
  40. , u$ l6 W) G% k4 u
  41. #undef EDMA3_DEBUG
    6 G, @9 `* E! I! g9 C* T# K  M
  42. /*#define EDMA3_DEBUG*/5 o" f$ a. {* z4 p, i( z
  43. - k0 C' j& Z: y$ T
  44. #ifdef EDMA3_DEBUG
    3 j8 J" l. O3 I2 }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 M8 I& `; l. b+ W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 M; w% V6 p- {$ |0 ]5 ?  I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % Y! x( X" v  }; }
  48. #else2 P  O6 R. D: M- L
  49. #define DMA_PRINTK( x... )
    ) h5 v1 b! a! e& V+ X% |
  50. #define DMA_FN_IN: v2 n3 w: m7 E1 D" I
  51. #define DMA_FN_OUT
    ! E. z# N3 s" H* x% m1 \0 J0 y
  52. #endif
    ( C% a9 x- S6 j5 k
  53. 9 M- d% K  x# [: V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ b0 R! \, I1 Y* F1 Y5 D
  55. #define STATIC_SHIFT                3% y0 `# H8 V; M: u* `) }+ s' v' {
  56. #define TCINTEN_SHIFT               20" O; z1 h: d# d' G" A. D  ~, c
  57. #define ITCINTEN_SHIFT              21
    1 Z0 ^- w* [9 t  F1 j+ W. ~
  58. #define TCCHEN_SHIFT                227 m' |& `  n* n; T* K/ Q1 E
  59. #define ITCCHEN_SHIFT               23' \7 N5 e3 p0 x, c6 z- O" R: V6 ~

  60. 4 Z6 k/ d8 V! W
  61. static volatile int irqraised1 = 0;3 x& x+ q8 K+ I, y: r
  62. static volatile int irqraised2 = 0;
    ' c% B- z# ~# r5 e3 l& o1 Z$ B
  63. ; |9 C) O* m) ]: u8 l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 G5 r& m4 M4 y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ P3 x$ m* A& x- |  S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& z' w! X( M2 l" k
  67. / c$ e( X' i  A: f; L6 @
  68. dma_addr_t dmaphyssrc1 = 0;& S* U& t6 C5 M/ D
  69. dma_addr_t dmaphyssrc2 = 0;
    + g5 Q9 k& I+ [1 o  Q' r
  70. dma_addr_t dmaphysdest1 = 0;( S* w6 m: R0 C' E2 q
  71. dma_addr_t dmaphysdest2 = 0;1 X1 A* h2 n' n2 I
  72. 1 B1 H+ @1 m2 |/ W) m8 }  ?
  73. char *dmabufsrc1 = NULL;
    - O! {& c$ _& ?# o2 I
  74. char *dmabufsrc2 = NULL;& [7 f: @8 b& T6 j7 _# N
  75. char *dmabufdest1 = NULL;
      Z; B( X) [8 T* F1 U* i9 N
  76. char *dmabufdest2 = NULL;
    2 ]+ i3 D: C8 d& _; |; s

  77. " ]! [8 Y% E/ t5 ]
  78. static int acnt = 512;) D6 {' c9 W/ }9 L
  79. static int bcnt = 8;
    5 H0 S- M  d( a# V
  80. static int ccnt = 8;
    ; P3 k+ I2 ?8 U) `  O
  81. # i% o3 z/ N6 e( D% i- D5 R
  82. module_param(acnt, int, S_IRUGO);; h! m9 C  S6 r# t" [9 r$ S
  83. module_param(bcnt, int, S_IRUGO);
    ' P0 D8 m, e& U# L0 A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) {0 v( i# H" n2 Z% x9 S/ O
+ W6 l( B7 j: f9 N( k/ R+ Y% \6 |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( k( J$ K* C9 d' t) C$ p: L6 Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& _$ I& f4 f1 r8 r! k% Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  J$ k( f) k; S% M8 N" _! {- e. y+ A) U' r( ^7 a

! d3 c  x: o% D2 V' J+ V2 S: Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-15 13:01 , Processed in 0.041788 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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