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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 h: ], O8 V5 h" T$ a, |! ?. T7 q7 S$ ^3 D
  1. [code]EDMA sample test application8 G* K% n0 b# I( I* c2 m4 V' Y6 V  @
  2. /*( S0 P( ?1 y7 O& @7 U6 w
  3. * edma_test.c
    + i9 C+ x: y  H# ?- W' M: O$ o6 Z
  4. *
    " H& b, j% u$ f& `7 C
  5. * brief  EDMA3 Test Application8 l, j3 y/ Z5 k# z
  6. *# q* g1 ^3 R5 S! N: C
  7. *   This file contains EDMA3 Test code.  v0 a1 Q5 w, C2 s9 u, ~
  8. *
    8 S2 R8 B. s: f2 b  F" x8 |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! B7 B5 x  }/ a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. e9 a0 k; K/ D) @+ _" j
  11. *         TO CHANGE.
    : z/ K2 r+ P3 H/ |
  12. *& `9 U9 ]$ z# S" b' U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 w# p) J3 W" n2 a5 r, l
  14. *8 d, r5 Y; @! m" [0 H( j! I
  15. * This program is free software; you can redistribute it and/or& \9 H: F( g2 G' q9 K
  16. * modify it under the terms of the GNU General Public License as4 {7 w2 c* w/ v8 k: H/ k
  17. * published by the Free Software Foundation version 2.4 J8 G$ X6 _/ p: Y( [: f
  18. *
    ) P& X5 V* b9 W* x( Y0 x+ Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) Q, ]3 r/ j- P( {6 y* t, L! p
  20. * kind, whether express or implied; without even the implied warranty
    ' B2 U3 l0 ~7 p) S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. [5 {* s& d  Z- r! M( G% q% ?
  22. * GNU General Public License for more details.
    . G6 P4 [6 f7 J  n& C
  23. */# D8 Z) `! G. j0 P9 v4 S
  24. % N. |" t) E9 e4 s' [. c5 b5 x
  25. #include <linux/module.h>
    ; T$ Z4 F/ Q, p9 y& {) C$ b4 n1 C
  26. #include <linux/init.h>/ P8 H( R1 F; m
  27. #include <linux/errno.h>1 P* u' R3 P& o9 z* }9 M: x
  28. #include <linux/types.h>  x' O' o! }& B- P5 d9 t
  29. #include <linux/interrupt.h>
    6 C+ Q7 M4 y! _5 ?8 y+ ]3 |4 Q) [
  30. #include <asm/io.h>  e% p6 C" z- q/ Y
  31. #include <linux/moduleparam.h>; }: t  v4 q# T
  32. #include <linux/sysctl.h>
      }# g' d; n9 Z. R
  33. #include <linux/mm.h>& e! p, B7 `# c' g  ~7 b1 @
  34. #include <linux/dma-mapping.h>: G/ Y" E) z' q+ I, D) b
  35. / I2 b5 @, p$ F* ?; w
  36. #include <mach/memory.h>
    - X% Z5 t& P  z0 d6 \7 O  Z
  37. #include <mach/hardware.h>
    2 M4 p# _4 ~+ M8 E. T  V
  38. #include <mach/irqs.h>$ A9 R7 |9 F7 R
  39. #include <asm/hardware/edma.h>& Z0 t. @8 Q6 Q7 j/ @0 Y1 ^5 c
  40. 5 j  T) G8 M0 d! A) @
  41. #undef EDMA3_DEBUG
    # d1 T; a; M: P: a
  42. /*#define EDMA3_DEBUG*/
    $ B$ A- U( m; ]# ~8 p' ~

  43. % ?* Q; A# d( t$ n( w  w, v: y* Y
  44. #ifdef EDMA3_DEBUG
    & S* m7 |  W. K$ U7 |) P. r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . M" i0 Q% w! J- O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / Z+ G4 _# l) Z/ G( P. X0 }: w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& t5 r" p' O% m9 u
  48. #else2 }; k8 Q2 j5 z6 s' g- G
  49. #define DMA_PRINTK( x... )
    ' O* [, C8 L+ Y. o! ~# {3 R* X
  50. #define DMA_FN_IN2 x( `9 j# Q9 L$ S- a3 x. z: I
  51. #define DMA_FN_OUT
    5 W& f. @. U0 {; g0 ?
  52. #endif
    ) d% E3 ?9 u& p9 i: |* n, r, d

  53. % W5 t) ~3 m  \# |, k3 S. z) p$ c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- R/ p3 N, F3 _6 i. B6 m
  55. #define STATIC_SHIFT                3
    $ }# j/ N" I2 c: g, l& n0 K
  56. #define TCINTEN_SHIFT               20
    7 {* b! H* D# @9 d4 G; g& Z8 n
  57. #define ITCINTEN_SHIFT              21; u) k  F$ n) {% o9 b
  58. #define TCCHEN_SHIFT                22
    1 i4 h1 \4 B" r6 t
  59. #define ITCCHEN_SHIFT               23$ [+ O5 E1 G' G8 h7 E
  60. 2 P5 G( d: s9 u' C7 V) h% K
  61. static volatile int irqraised1 = 0;
    / @2 }  A! Z( M, ^
  62. static volatile int irqraised2 = 0;, t9 D3 i5 m9 B5 W0 h
  63. ' n8 @1 E, Q, M- ]: |& b. V3 c" {# {9 X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / M5 J3 q; T6 ~' A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 R+ Q3 t% h1 s1 C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * d% ^0 x! M8 l1 \
  67. 6 X! |5 _4 \* m, G* J
  68. dma_addr_t dmaphyssrc1 = 0;
    2 B. K0 j& S8 S; ^- T
  69. dma_addr_t dmaphyssrc2 = 0;: z% ~: T: N% k
  70. dma_addr_t dmaphysdest1 = 0;% L; l, P9 J0 B# s* Z$ _- D
  71. dma_addr_t dmaphysdest2 = 0;3 s0 Y1 N% P, P0 G+ e

  72. & @, V0 U: x+ ^' ]+ B
  73. char *dmabufsrc1 = NULL;% w" y9 Q8 |& x& U
  74. char *dmabufsrc2 = NULL;
    ' p+ r  G! u" L/ @, a( t
  75. char *dmabufdest1 = NULL;' M5 c$ r( O$ [, F/ C5 f8 M0 v: @2 Y
  76. char *dmabufdest2 = NULL;8 w! q2 Z6 S% a8 g) c* j; i
  77. + ], [! v/ i" Q5 n( m7 S7 C( F
  78. static int acnt = 512;
    " V2 L  w! c5 S+ P+ H( m
  79. static int bcnt = 8;
    8 W- ?8 z8 c, L' z* P& g& b, J5 v
  80. static int ccnt = 8;
    + ]( o- w, \/ g$ R5 r  x

  81. . V$ f) s" O! p9 Q0 D- W6 M
  82. module_param(acnt, int, S_IRUGO);
    : \5 \7 e, H( a" n7 B
  83. module_param(bcnt, int, S_IRUGO);
    3 i5 Z; v, `# P! B' \1 {  o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 n3 e6 {3 a1 Z8 M" u' I! ]

7 t/ l6 G* I$ [5 k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, ^( Z) Q# B5 R/ M4 d& M: G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" X: A! y2 K6 A/ Q& D4 K$ w2 R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* @9 k' y5 l8 \( z- W# q
% _; n; O/ v4 T( k* n' k" u+ n( D
9 \. d3 q8 j2 _+ R' ]$ Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 15:23 , Processed in 0.043318 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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