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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 b4 L5 L7 ]4 r! v% K" E
  1. [code]EDMA sample test application
      M/ P# z0 E" I0 I
  2. /*4 t8 C$ H7 J2 S6 a( t3 P. a
  3. * edma_test.c$ H1 O5 l4 t* d
  4. *
    $ b& m" x& I/ `1 O
  5. * brief  EDMA3 Test Application
    0 s0 E3 E# o$ U0 E+ @: z* Z
  6. *
    + `# F; x; M' l
  7. *   This file contains EDMA3 Test code.
    1 q- z$ O( N) f3 k0 \% B3 e
  8. *: ]# u% m8 H& |* d  P2 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * k- n! m$ s- y/ n$ H3 @$ U( S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 s' E* l) H. a. w& P
  11. *         TO CHANGE.& J3 q. ]. H& _
  12. *
    ! p3 Y+ F5 ~, l5 h: m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 s% |9 e3 ]' I% H% t
  14. *4 |8 {& {2 d# o! k1 I( y8 r
  15. * This program is free software; you can redistribute it and/or. C( n! o2 f: |! I. R- v- U" C
  16. * modify it under the terms of the GNU General Public License as( m" {3 M2 S+ S! O" j% _# {. a
  17. * published by the Free Software Foundation version 2.+ W* g! k! [- V! C9 N6 g0 C  |* S
  18. *5 E9 |4 [9 b, l5 s% b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ l  Z2 B8 {& ]% I7 b% B
  20. * kind, whether express or implied; without even the implied warranty
    3 Q4 S$ b7 ~; e9 y7 j* u9 D6 m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : A; U( S' T! u. q$ y/ v8 @/ W
  22. * GNU General Public License for more details.3 y; Z6 y+ i: K$ o3 Z5 }
  23. */
    5 h5 S5 _2 V7 Z1 L5 g

  24. 3 E7 Y, W) a' L, {4 v8 x
  25. #include <linux/module.h>
    % r% y, n) B- K6 W/ f! g/ g  o
  26. #include <linux/init.h>; H: G/ R9 Z4 m: m: |9 ~5 a+ G
  27. #include <linux/errno.h>
    7 U$ G% o/ T  K; z8 c4 O
  28. #include <linux/types.h>
    & Z: ]: V* ^2 _) b( M' ]: k% d
  29. #include <linux/interrupt.h>
    # Q& x8 G/ I. N5 b( r( R
  30. #include <asm/io.h>
    # r: y2 g" l$ ~" U% s! c2 `8 Z
  31. #include <linux/moduleparam.h>
    3 o# g4 ~" O9 S8 @
  32. #include <linux/sysctl.h>4 m; R$ l' i5 \7 D, [0 z& c3 U
  33. #include <linux/mm.h>7 h! G6 F, u* Y% r. ^
  34. #include <linux/dma-mapping.h>
    5 H2 c( z$ H/ o7 n+ R* Y

  35. $ e6 s5 Q6 K& X1 U
  36. #include <mach/memory.h>
    ! K7 {# r& t3 O5 K1 ~2 x( g! w
  37. #include <mach/hardware.h>+ @6 ]- v' a8 t. u  N: s. z( p
  38. #include <mach/irqs.h>& |2 j  X/ Q  c% }( h
  39. #include <asm/hardware/edma.h>/ U& g  h1 {9 z- K

  40. , \+ e  t* O1 ?
  41. #undef EDMA3_DEBUG" c" O8 n: G2 D$ U
  42. /*#define EDMA3_DEBUG*/2 U8 x+ w% |) [0 F) f8 @; i
  43. 2 K& H' ~7 j7 Z4 ]& O7 C
  44. #ifdef EDMA3_DEBUG/ T# e$ B& B3 Y, F6 X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' Y5 s( e6 q( @0 D( E  l. o* C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ S& ]7 |1 M# ~- g3 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 P# n9 d* y$ c: _5 Q
  48. #else: Z( j0 A- C; q0 `
  49. #define DMA_PRINTK( x... )) ]$ l0 F- M" B
  50. #define DMA_FN_IN2 z# z0 Z+ O7 w! S! w7 K8 I0 D7 I
  51. #define DMA_FN_OUT: g2 M) ~( U- a7 T1 |  P: O3 C
  52. #endif
    ( F+ c- O  i) G' ]7 e

  53. ) w, ]- i8 P: f& a1 J% M' G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " O$ \: \2 o" m( G2 j4 b
  55. #define STATIC_SHIFT                3
    # v( @; k7 ?$ a
  56. #define TCINTEN_SHIFT               20' l3 S% q5 t4 A% M1 U( N5 Q
  57. #define ITCINTEN_SHIFT              21
    * |5 U( \' z) A0 n$ |
  58. #define TCCHEN_SHIFT                22
      O: V6 X+ U6 ?& W) j8 }4 v
  59. #define ITCCHEN_SHIFT               23% C' I  o1 }& W3 s& h

  60. 8 }  N- r) z7 _( s# c* p
  61. static volatile int irqraised1 = 0;- M- |6 d" Z& }( H
  62. static volatile int irqraised2 = 0;
    " q3 C" U) @: S; C
  63. * f0 `5 w: s8 N5 N+ o9 [5 H8 r: q" W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, l4 s, w' u  f- A* M  O7 N3 x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 w: X& J* k; ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % F* Y2 E8 @/ l( C

  67. " X2 l% R0 i  C) Q
  68. dma_addr_t dmaphyssrc1 = 0;  T- C- U( v, G; }! Y
  69. dma_addr_t dmaphyssrc2 = 0;
    2 d# z2 z3 {* d0 M2 a' G4 p( A
  70. dma_addr_t dmaphysdest1 = 0;
    6 n7 s% O1 ~0 e' o
  71. dma_addr_t dmaphysdest2 = 0;
    ' D/ u  d- u" s3 w! w+ k" E9 Y( q
  72. % I! ^' R  x+ A( n) R. m% q" P
  73. char *dmabufsrc1 = NULL;
    ( Z3 O0 ?# k) X3 i
  74. char *dmabufsrc2 = NULL;; u3 R# G$ S& A: v  o' K$ X  o
  75. char *dmabufdest1 = NULL;5 Z. U5 E6 Z; k2 e! I) j, d
  76. char *dmabufdest2 = NULL;
    ; z  C6 W% j  O* v
  77. 8 p1 U9 }5 V5 j- ]0 A. K
  78. static int acnt = 512;
    % M! F6 L0 T  B3 I* t
  79. static int bcnt = 8;
    5 G' P; w$ ?  ?6 E+ f/ e
  80. static int ccnt = 8;5 S; q3 m. b8 u" ~$ i' o8 T

  81. . N9 N% W( @* @" w+ G
  82. module_param(acnt, int, S_IRUGO);$ {" w5 d! j  s: D0 v5 K
  83. module_param(bcnt, int, S_IRUGO);
    * Q% k% W" v- q: e1 R: L- o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ v: D2 z6 D, o& G

' \7 B. D6 Q* Z5 ?  T+ O8 ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ [( V5 e0 L+ U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 I. a7 P% c) ]: J3 m* k
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" M  Q: z4 n- a8 _3 `% P

8 ~9 K, Y0 _# U" y5 j# j, r9 l4 z: C8 t" `9 h: L3 G' p9 |6 W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 14:41 , Processed in 0.039834 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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