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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   V9 `* K5 I7 c% l& R8 d
  1. [code]EDMA sample test application: f" |# o8 w; ]0 s; w2 z
  2. /*3 M  g' d7 {# s
  3. * edma_test.c6 a5 [: P; n- G
  4. *6 h0 J3 w5 \$ i4 J* B
  5. * brief  EDMA3 Test Application
    - c& p  C$ A* n) v8 n3 ^4 h0 W
  6. *
    8 p  o) M3 q: v; ]" w' T9 }
  7. *   This file contains EDMA3 Test code.
      b4 E/ f1 \9 H. q% q7 x: `) T5 J
  8. *
    ! @$ X; ]3 K4 s% v0 N3 W1 |7 y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # l4 X$ b# A! @* Q  M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 U8 C+ K% O9 _+ ?* Z
  11. *         TO CHANGE.
    ( s8 X. m  V% u1 t  Y+ f$ v
  12. *
    2 [) X& K& y9 [% Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - \9 E4 X% [9 i! Q% l" T( K: i
  14. *
    / E) P  X8 b7 L/ ]$ @+ @& [/ ?
  15. * This program is free software; you can redistribute it and/or2 |* n* [7 E6 `
  16. * modify it under the terms of the GNU General Public License as( n" f) \5 [: U; h& U( t/ }, _& t
  17. * published by the Free Software Foundation version 2.
    / J5 B* {5 y- [) o' r# y# W  c% k
  18. *9 t  n1 J( l9 G: N: Z0 _  D/ d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, ~5 x* D; t# h" K* ?
  20. * kind, whether express or implied; without even the implied warranty
    5 o, B( I% }' Y! W5 B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 f0 Z& F# P6 W( Z& E- i
  22. * GNU General Public License for more details.8 `6 n3 N2 N$ [3 E3 D( k- a- S
  23. */
    5 q8 {. |4 u" {: q7 x6 M! G

  24. 7 n( m4 p* a6 b" h5 u# _
  25. #include <linux/module.h>
    ' e5 e  [; G: {$ |8 q! S0 S
  26. #include <linux/init.h>
    ! T5 z- j8 }: G! t( z7 |
  27. #include <linux/errno.h>+ j. j: s/ I4 N5 W/ e  a
  28. #include <linux/types.h>
    & a  `: N' l) K" U+ u+ b2 K& k) l
  29. #include <linux/interrupt.h>4 H5 T1 F: T4 T+ d
  30. #include <asm/io.h>9 a) a: [* L6 \" S
  31. #include <linux/moduleparam.h>
    & K6 E6 g, L  S$ P
  32. #include <linux/sysctl.h>6 o2 t# `) a$ B! P, t: g
  33. #include <linux/mm.h>% d) V1 q$ X* z/ m/ {
  34. #include <linux/dma-mapping.h>
    / S, d! V/ U, q9 T3 |6 h
  35. 1 t& N# V! \1 W! N* S' |
  36. #include <mach/memory.h>
    ) \$ k3 M9 ~: b- Z) A( p
  37. #include <mach/hardware.h>4 V6 A- y0 X$ P! x( x
  38. #include <mach/irqs.h>" g. Q* r- h" y! N3 m; D
  39. #include <asm/hardware/edma.h>& D6 k5 B! j! \* m) N9 o; a

  40. 3 {" ^( {8 p; T, g/ ?: i6 v
  41. #undef EDMA3_DEBUG
    " u, k3 Y4 u- W0 T! i7 }1 s; B( h
  42. /*#define EDMA3_DEBUG*/" q- k) R7 |! O1 n- p

  43. " T' g$ B/ H/ \7 K6 G# y" _4 U
  44. #ifdef EDMA3_DEBUG1 U2 ~  [2 K$ U- @3 b) d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( m8 D* _  T, j$ t( h% J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 u. i$ d4 x( t0 [: y0 ~" N0 Z: `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& w2 o6 O( T. x* T# o
  48. #else
    . ?) H3 W/ h3 v! W
  49. #define DMA_PRINTK( x... )1 J8 [- p! {5 Q2 u- ?, y, H; g
  50. #define DMA_FN_IN
    % _- C/ m8 H( C3 e
  51. #define DMA_FN_OUT  |5 \, V2 B* M  ~7 `
  52. #endif+ P3 k1 ~, T' ]( f7 E. x$ n
  53. , I- z8 Q3 ^9 `. _  n8 G* c- R# ?" t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 m; v% v$ O% h' J1 {  V! C
  55. #define STATIC_SHIFT                3
    , L. }% g) s2 E
  56. #define TCINTEN_SHIFT               20
    , L/ N: b1 I# s' P0 c& e1 H
  57. #define ITCINTEN_SHIFT              21
    8 P# [% Q) @3 W5 i# B
  58. #define TCCHEN_SHIFT                22
    ) U3 Y$ d4 U! @" P. g
  59. #define ITCCHEN_SHIFT               23- |( m% k4 T, l- l! c4 w

  60. ) c8 T0 O1 p# z' E* M
  61. static volatile int irqraised1 = 0;: V- ~9 l1 v. V& c4 B/ v
  62. static volatile int irqraised2 = 0;
    * F" ^5 }6 I6 s* j; Q/ X, H0 T- o

  63. 3 r3 U4 _" J( {  N; y# o) s! L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 x) W6 M* m( z, x( R* `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 h3 L7 h7 x# y. e: O  y, V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & r3 z4 a7 m7 w/ T4 l1 x. Z
  67. $ d+ Z% k' I4 f3 b
  68. dma_addr_t dmaphyssrc1 = 0;
    " p* n/ f: e4 E9 t0 W  ^, T
  69. dma_addr_t dmaphyssrc2 = 0;. @$ J) }/ ^1 l2 D
  70. dma_addr_t dmaphysdest1 = 0;1 ~. z. w8 W3 N+ F! p+ s
  71. dma_addr_t dmaphysdest2 = 0;8 q1 ?5 a/ A( x9 c( I
  72. & j: F$ W( n% b* ?0 p
  73. char *dmabufsrc1 = NULL;
    7 g) x2 ?2 U8 {
  74. char *dmabufsrc2 = NULL;6 u. O, M( _) i$ s% c8 y1 P5 ]
  75. char *dmabufdest1 = NULL;  f6 O; Q5 h+ O' ?
  76. char *dmabufdest2 = NULL;4 E% Z" }6 f4 T. s) `

  77. 2 O6 q# `0 I7 B; Q9 ^7 \! V5 z
  78. static int acnt = 512;
    : M& H$ n' ?1 c6 u
  79. static int bcnt = 8;1 R- C# c* W5 y6 K
  80. static int ccnt = 8;3 c# {, M! n. X! Z1 J3 a
  81. ! m$ i& \. t/ b9 d
  82. module_param(acnt, int, S_IRUGO);
    : I! g! Z8 O' U# \
  83. module_param(bcnt, int, S_IRUGO);$ B/ A. Q) \$ n/ e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 M% F9 ~7 A  O6 R, u# |. d

8 T; N6 D9 O$ k% a4 v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ d$ M3 ~; t& k4 ~6 g* [2 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  ]! _; b' H( D6 c' k' a9 D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 U1 U* k: Y7 a2 F  C& ?2 N
; S- p# S8 _+ m( P. I
7 ^8 h1 I; U. ~! }5 o! D! f8 }; i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-24 08:45 , Processed in 0.040833 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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