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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ j- ^$ c9 x9 [. i8 u3 d- r0 k
  1. [code]EDMA sample test application
    ; f/ [  f! S3 f4 P; K- k% Y9 z; e
  2. /*
    3 u6 O. F. W  V7 i$ l
  3. * edma_test.c' o4 [. y9 o  a: a/ d
  4. *+ B  \8 T% l% d7 Z: X" I
  5. * brief  EDMA3 Test Application. z" k; n6 V+ S2 j8 F
  6. *3 X! k% K- \6 O
  7. *   This file contains EDMA3 Test code.
    $ _$ b* B9 w! e2 ?, U
  8. *; ]* }, f# |: m& E7 f6 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - X2 ~! B) ~7 K, P. ]5 f7 B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % |; r3 f' }, X! b' c; K
  11. *         TO CHANGE.
      A5 s/ U. \. n8 r5 k7 t  V
  12. *. v3 C. M( A) n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ D3 L5 C6 e' F- F
  14. *
    8 N$ ]4 J' t" c" L8 H9 f
  15. * This program is free software; you can redistribute it and/or: o% h: ~# l( L; W! ]8 z  M
  16. * modify it under the terms of the GNU General Public License as: H) ^7 Z2 Y% O( i# ]& S  L
  17. * published by the Free Software Foundation version 2.
    9 }7 F! W! J4 s$ [& C$ p! ?6 V* z
  18. *# }8 ~, \1 K$ G; r& j6 c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" ^6 O% W. s6 R' m  F) {) L1 W
  20. * kind, whether express or implied; without even the implied warranty$ @; i8 [* u$ h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 z/ L. W/ f" _0 n& K" ~7 E: [
  22. * GNU General Public License for more details.
    % i6 [$ a! T# ~1 o
  23. */
    ; {# I$ |, _3 F& A% g5 G- F

  24. * c' U8 j$ j% l* @0 Y% O2 p# }% w
  25. #include <linux/module.h>
    * }8 `# g  d" j. }, m, l% j: P
  26. #include <linux/init.h>
    ! q/ j  J7 }0 E' K4 @$ @/ J4 r
  27. #include <linux/errno.h>% E$ }) R/ F+ o7 N4 [
  28. #include <linux/types.h># z8 G( b3 h8 z2 g
  29. #include <linux/interrupt.h>
    : z& H3 v& y' D6 ~5 ^5 R5 i
  30. #include <asm/io.h>
    # i) }+ e. V% @5 P2 E
  31. #include <linux/moduleparam.h>$ b0 n4 L4 J: Z0 m
  32. #include <linux/sysctl.h>0 ^1 A5 R4 q$ N3 G: o
  33. #include <linux/mm.h>
    0 D/ W3 ]( U8 h) j$ Y
  34. #include <linux/dma-mapping.h>
    : E3 E' J. q# I4 K- l  S
  35. / b% ]# K0 ~' G; {' }
  36. #include <mach/memory.h>
    $ f6 C2 D2 Z. Y
  37. #include <mach/hardware.h># w5 B- r; b; i/ t
  38. #include <mach/irqs.h>. q: C! n& T' u: z9 T3 \9 t
  39. #include <asm/hardware/edma.h>
    0 ]$ f% M! g6 ^: j/ V2 S% ?

  40. . Z! J7 k6 U1 b' }. W1 N
  41. #undef EDMA3_DEBUG
    6 }* q  \1 c7 \
  42. /*#define EDMA3_DEBUG*/
    8 ?1 X  g6 n) [

  43. $ S) `5 `. l! O5 ?; D! ]$ W
  44. #ifdef EDMA3_DEBUG
    1 d; ^( y- h4 H: w6 l* V! j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) r0 c: e  W# a) c# m8 }/ C/ x; l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 G( M& r8 j6 K, i3 W8 k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # ^- e+ ~. k6 {1 E
  48. #else; _! Y5 R2 `8 P
  49. #define DMA_PRINTK( x... )
    # T7 ]; u1 W6 m
  50. #define DMA_FN_IN
    & _; v+ P" c  q: [! y( m4 D
  51. #define DMA_FN_OUT3 Q# \2 \& [# b  ^; q* i$ B# V- u
  52. #endif
    ! f9 ]7 k) ~  e; _1 S. T9 |
  53. : f. R/ K1 d. o) J# w& J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( o% `& h3 k4 d# M3 u4 G$ B
  55. #define STATIC_SHIFT                3- v# ]) c! h- ?& B( _& A
  56. #define TCINTEN_SHIFT               20
      L0 b* |0 v7 X1 d
  57. #define ITCINTEN_SHIFT              21
      E! ]8 c6 N1 ^+ v& t1 x1 {: M/ N
  58. #define TCCHEN_SHIFT                22
    , i6 M3 d( b3 _
  59. #define ITCCHEN_SHIFT               23# ^7 f9 E! ?0 A5 _
  60. # A5 D, J' p6 ~1 W
  61. static volatile int irqraised1 = 0;8 p: D& M! q5 W% F
  62. static volatile int irqraised2 = 0;( @6 _# ?% z! E7 h4 s1 [* F

  63. ' w, N! c; D# r# V% B' g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 `- A# r1 E- m4 h- M  Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % p9 Z* ]* W0 D, F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & b! @9 O$ t. O0 f& f
  67. % _; x  U( M# v! G7 e+ i2 P
  68. dma_addr_t dmaphyssrc1 = 0;
    0 I+ X3 o# _2 c! w& y# Z& Z; I
  69. dma_addr_t dmaphyssrc2 = 0;1 ^7 r' z7 \; w4 ?
  70. dma_addr_t dmaphysdest1 = 0;
    4 {8 l3 D6 H- L1 L6 |
  71. dma_addr_t dmaphysdest2 = 0;" }5 s% ~3 R  {, a6 D  r
  72. 3 I2 C7 |( D$ i! U
  73. char *dmabufsrc1 = NULL;
    4 W+ n7 e9 k% }7 {% {' {. k
  74. char *dmabufsrc2 = NULL;0 \& h, H" i1 n6 C/ \7 t. k% G, L
  75. char *dmabufdest1 = NULL;2 p4 `; p  |! n% i& Y9 w! K4 j( a( R8 }
  76. char *dmabufdest2 = NULL;
    1 E- G) r8 y+ t9 h
  77. ) I6 T$ l: l6 Y: C# J6 p( K
  78. static int acnt = 512;
    & ~# ~8 {4 ]4 H- j3 x0 @' o
  79. static int bcnt = 8;! C, T9 N& t! h- ]
  80. static int ccnt = 8;; G, z, H! D, ~" y: ?& m  j  d

  81. * s. @/ r' l6 {, V
  82. module_param(acnt, int, S_IRUGO);
    # |4 n0 A/ P. F% s' s" o4 v
  83. module_param(bcnt, int, S_IRUGO);
    1 d* r, d4 {" ?& ~: m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 h  o( r. @' {7 Q6 \6 b# q$ m1 j% C  _& c; H! Z. y3 ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* H5 D1 Q; N" a) D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 P$ g" U) s" l5 ]. J- o
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 N6 ]7 l. u% r! b+ v, D3 ^
6 w- O% j+ z- v+ ?8 B. \
1 W, t" F/ n( v1 l9 k& J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 08:43 , Processed in 0.037758 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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