OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* {: i0 V0 G9 w8 m4 {
  1. [code]EDMA sample test application
    & Q& |* K3 ^' Y" O
  2. /*
    * t7 ]2 ^2 p' T: S) E
  3. * edma_test.c5 t- V5 r5 i, ?
  4. *
    9 g9 L: O. x) O# v+ X
  5. * brief  EDMA3 Test Application
    ) g6 ^8 U3 p1 N# l9 p  D
  6. *
    % a4 E/ R/ r. ?: Z/ I+ U3 a5 O( M3 s( E
  7. *   This file contains EDMA3 Test code.0 e5 W, p" C0 G; _" X! f
  8. *3 i; W* u% o4 |) A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      b! [: V6 A, ^* l+ E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* P9 [9 G; ?+ Z$ S' ]6 ^
  11. *         TO CHANGE.) G+ p# h% p# e$ S$ p7 B$ q
  12. *
    5 e0 a9 C6 D" R& X1 }" B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + S# A8 T$ c0 L8 J
  14. *2 q) e  g) e% i2 w6 f% T2 Y
  15. * This program is free software; you can redistribute it and/or6 ^4 z( r8 a' g
  16. * modify it under the terms of the GNU General Public License as
    * u$ t# }/ G3 z. U1 i5 C5 I
  17. * published by the Free Software Foundation version 2.$ q* X$ \' `2 F2 x3 G% \2 {
  18. *) l  t  ~% l) s# c7 [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 \4 o- I' f9 V$ J
  20. * kind, whether express or implied; without even the implied warranty
    5 M& Q4 E2 R* S% r) R! \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) u/ f1 m3 ]1 K9 ~6 d! f; h9 ]
  22. * GNU General Public License for more details.
    9 ^: ?9 @! p6 c* Y& n9 o
  23. */
    % B7 `/ Y$ @# k/ _3 h$ m

  24. - D  y# R6 n- {$ g5 H* L5 H
  25. #include <linux/module.h>8 \$ g, [0 W. v
  26. #include <linux/init.h>
    + M! |7 j9 H* N* y. Z
  27. #include <linux/errno.h>3 H  M3 d1 L# z/ H3 W9 r
  28. #include <linux/types.h>
    ( y$ Y4 d3 I# A9 c
  29. #include <linux/interrupt.h>9 }( @' q& L% w" a
  30. #include <asm/io.h>
    6 |4 [' i6 n/ }' E, X& }4 O- I
  31. #include <linux/moduleparam.h>
    + h1 j4 E9 H. l$ ~0 i( A9 h
  32. #include <linux/sysctl.h>0 }2 o8 Y5 ?, N9 t" Y. |
  33. #include <linux/mm.h>
    ( `6 M0 \; J4 n8 V; G9 Y* }1 B7 Q
  34. #include <linux/dma-mapping.h>  {) w! D& n- n* ]9 l2 j4 i( g

  35. 1 a( l7 F) A) I( n# g" B, M
  36. #include <mach/memory.h>2 Y% Z" @3 ~9 ~# I
  37. #include <mach/hardware.h>
    + q1 m' x( V! x6 w+ U7 t  c% O
  38. #include <mach/irqs.h>
    5 I! k+ K$ P2 ^# r* f
  39. #include <asm/hardware/edma.h>
      W' q8 `* i. [" n; A' a6 U
  40. ! z! I& y7 }! c' S2 x: a! b! V% e
  41. #undef EDMA3_DEBUG; x3 Q- x% A8 P' N9 F! n
  42. /*#define EDMA3_DEBUG*/' Y/ [# A, C& a% H. O4 `, @% H! x
  43. + i, T* ^0 s: m' t
  44. #ifdef EDMA3_DEBUG
    3 a0 s4 z1 I$ g6 E; p9 ^5 W' n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , x5 V: X( y7 B3 z3 I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % S! v5 R7 H' ~' _% a$ h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ Z% ^) L  u* K7 M+ P
  48. #else
    6 h' x7 h  f' J' `4 r  t$ Z. P2 y
  49. #define DMA_PRINTK( x... )
    9 k& l' U8 Y1 ]5 F. K( ]
  50. #define DMA_FN_IN
    # I( N9 X: V% I% \/ v
  51. #define DMA_FN_OUT
    5 q7 T$ g: I4 j* w1 i
  52. #endif8 n. G- ^8 I. b' N5 O

  53. # J3 f/ a* I* w# B! x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 \) y* g  U/ |" p1 z( p, N
  55. #define STATIC_SHIFT                3: v  u, U. H! Z! m7 _9 R- `
  56. #define TCINTEN_SHIFT               20: ]- g0 V( e7 G- f; q
  57. #define ITCINTEN_SHIFT              219 j1 p3 j" n/ Z% }0 \- b/ V
  58. #define TCCHEN_SHIFT                22; k. x& z1 n3 N; @6 N
  59. #define ITCCHEN_SHIFT               23
    , Y; Z; r  ~' C$ L' e& m
  60. ; a# T( m  [# F- w) _- D
  61. static volatile int irqraised1 = 0;/ r. k! x4 L6 R& @
  62. static volatile int irqraised2 = 0;" J. I, ]7 P4 q

  63. " ~$ y4 g0 u4 `; B0 e* k' g% x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, a6 z5 M+ o7 }5 x; k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - w1 W. Z& \3 O/ i4 j9 N- b: f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. L* |' _4 N! g: Y9 L/ s7 E
  67. / b4 D6 I3 z7 ]  Q, d8 ^
  68. dma_addr_t dmaphyssrc1 = 0;
    ( Z- Y7 K+ r- W% ~) e- V  S: t
  69. dma_addr_t dmaphyssrc2 = 0;
    ; `. m8 f& r# M. T! ^# w- T
  70. dma_addr_t dmaphysdest1 = 0;; Y0 B% S, S' Y$ y; {. ]1 v
  71. dma_addr_t dmaphysdest2 = 0;
    7 t* x/ h' u% |7 q" y5 u: b/ E
  72. , I  Q. u( F& \6 S) y
  73. char *dmabufsrc1 = NULL;% d& U& r* a( ~) f2 B7 g
  74. char *dmabufsrc2 = NULL;# b/ N& c+ ?" t& ?0 r3 Y- H
  75. char *dmabufdest1 = NULL;
    ( H: V+ N$ F/ D* m/ j# x$ ]% A, i: b
  76. char *dmabufdest2 = NULL;
    & F7 |  W+ d7 I8 ^

  77. 3 U" U$ o: G: U/ m% I1 V
  78. static int acnt = 512;
    & L6 a" l! b0 ]0 g0 R3 d1 e
  79. static int bcnt = 8;1 g' @4 V  j% Q6 P# N/ E# _. A
  80. static int ccnt = 8;
    - K6 Z; \7 l6 E

  81. ; _+ v1 H- }; ]& d" ?
  82. module_param(acnt, int, S_IRUGO);
    6 _: @; y/ v, f; i& m6 j( b% @6 }
  83. module_param(bcnt, int, S_IRUGO);
    9 a$ z- b, Z/ X% W. {8 w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 j1 ?% L4 e4 _/ d5 M/ \$ ?5 B+ H4 X* e! D2 s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ U  R5 g- i& d" L2 p6 y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 B3 S# B4 p3 l5 b0 i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: e" q& z! B9 ~4 O  ]* ~5 w1 g
$ u. @  _2 }" W3 {4 q) x
; G# b3 [, r  ]. g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 19:46 , Processed in 0.038404 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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