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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  X+ d& ^- K3 l" J/ a& p7 I3 f
  1. [code]EDMA sample test application
    : X. U0 z3 N# x1 v, g" ~
  2. /*
    0 O8 X: K) n5 e% V( A1 a
  3. * edma_test.c
    ! ^9 z4 p! m& C
  4. *
    % c; u3 D* o8 `! J& c* t! ~" K  ?
  5. * brief  EDMA3 Test Application; I4 U/ z6 v; O) ?! T3 d
  6. *
    6 f$ d5 O. I' r" b5 O
  7. *   This file contains EDMA3 Test code.1 L  D) @; |; Z
  8. *8 x0 _6 G6 \& c, k, G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  s: z+ P  Z7 E" ~- b8 @* q/ z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' o; |3 E0 `; J  X" J0 y
  11. *         TO CHANGE.
    $ G9 P- a; K% f
  12. *7 P) e$ X0 R' D5 [7 `1 M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , q( \% B/ t7 b; c* a
  14. *
    / t( `4 q+ e0 C$ h. A
  15. * This program is free software; you can redistribute it and/or
    7 ^  t& E7 H3 [  ]1 D8 |
  16. * modify it under the terms of the GNU General Public License as1 M- e1 Y) I4 D6 d5 |9 p. f" ^
  17. * published by the Free Software Foundation version 2.
    ; I- d9 ~: R8 ^* q8 S; `
  18. *
    . P3 \6 g1 ?& H0 E  N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + c2 h5 d1 V, _/ c; F
  20. * kind, whether express or implied; without even the implied warranty' m! s5 F5 `; Y6 l4 t* J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' U7 M; A% W; l) B
  22. * GNU General Public License for more details." x5 \4 e( @) V" z8 v9 e
  23. */
    ! S% l4 ?. G9 L% o$ f
  24. $ {. P" p" C# m/ H
  25. #include <linux/module.h>
    5 t% x1 @8 T6 c, @+ p! X
  26. #include <linux/init.h>
    " U% \1 n8 G3 }8 C2 m/ O
  27. #include <linux/errno.h>& N; a  \. m, U6 r2 _) S
  28. #include <linux/types.h>  X% k# ]8 P9 u" d/ c
  29. #include <linux/interrupt.h>
    ) E7 \' J$ `8 \2 W7 M( _- o
  30. #include <asm/io.h>' l' v% b' i3 c6 `
  31. #include <linux/moduleparam.h>
    - P$ E2 D& ]6 K2 m8 m+ l5 S- K
  32. #include <linux/sysctl.h>
      ~0 o+ r+ Z* v( ?
  33. #include <linux/mm.h>' ^: I. _" Q$ a# S8 k& M1 G. p
  34. #include <linux/dma-mapping.h>9 z9 P$ m4 F: B/ b# C& z

  35. . \4 W# \2 v3 M
  36. #include <mach/memory.h>8 A+ ]' j! O) _% g/ S8 b
  37. #include <mach/hardware.h>+ B$ I6 M& z/ C4 L" ]9 H
  38. #include <mach/irqs.h>  v; @9 {- [# U
  39. #include <asm/hardware/edma.h>
    7 G6 b4 O% O. h1 j  s  `% K6 X

  40. & v- t+ A/ I7 Z1 s) H6 _
  41. #undef EDMA3_DEBUG
    , P( t6 {# R1 _* q: d5 {
  42. /*#define EDMA3_DEBUG*/
    ' t  d- M% n3 k  O
  43. . P, _6 i# T3 t4 R( w) [
  44. #ifdef EDMA3_DEBUG
      X; s$ G( B: T5 @  C0 }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % ^, K! `" u+ v* L, r, h6 w4 j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      b" G" Z* k' ?$ Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' T2 N7 V, f8 V8 O! n. D5 J
  48. #else
    " Z. X& t1 _$ [! X
  49. #define DMA_PRINTK( x... )8 P, v7 c- f) H1 O1 d4 w6 b
  50. #define DMA_FN_IN1 ^4 A9 m, \* n  @0 z/ z* T* `6 }
  51. #define DMA_FN_OUT
    8 M& ?1 q! F6 r0 ^0 P/ \) C
  52. #endif" p9 S* u& e, S+ E+ m
  53. - @# _; }8 ^- A! c6 D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; I( p3 N9 e- r9 j9 c: }3 C1 j
  55. #define STATIC_SHIFT                3
    " l$ h( t7 E# x+ W1 h+ J/ u
  56. #define TCINTEN_SHIFT               20
    & ?" w( y* z# H$ j; E7 k2 ]
  57. #define ITCINTEN_SHIFT              21
    3 X, ~. W. }8 P  z7 a8 Y0 `0 A/ u
  58. #define TCCHEN_SHIFT                22
    2 d, m* z" }- d% A" J! }
  59. #define ITCCHEN_SHIFT               23, t6 Z" Y9 \! `. o2 I  a
  60. " H: H$ L& u& `1 j
  61. static volatile int irqraised1 = 0;& Y& w) z$ ^$ V1 K. h
  62. static volatile int irqraised2 = 0;- ]0 q, ?7 d" a" L7 ^8 o

  63. " ]! T8 B1 T3 r4 T+ h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; _$ m7 W0 V" C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / g6 B3 K  x: u6 K+ C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' \# ^: }% {/ K5 p: b* g) c
  67. ; |) z. v; M8 Y& t4 B7 g
  68. dma_addr_t dmaphyssrc1 = 0;- a/ e# l: N4 N/ N1 {
  69. dma_addr_t dmaphyssrc2 = 0;8 L  Y+ G! u3 b. G4 n
  70. dma_addr_t dmaphysdest1 = 0;2 L. Y5 `8 O; L$ ~( d) g* p
  71. dma_addr_t dmaphysdest2 = 0;; ]0 ^5 P$ N, i
  72. & Y. a) m. i7 t
  73. char *dmabufsrc1 = NULL;
    7 e6 x0 S% z7 V" f, \4 a  X4 v
  74. char *dmabufsrc2 = NULL;" r7 u0 M% e3 |, f6 W. l3 N
  75. char *dmabufdest1 = NULL;* ^) j6 N" {: o9 q. n
  76. char *dmabufdest2 = NULL;
    5 A' g7 D4 x. ]0 ^

  77. - @3 V- H  m9 H
  78. static int acnt = 512;8 W% C5 i. ]% H3 B
  79. static int bcnt = 8;
    ' W  t- \7 V% i9 U& A6 N
  80. static int ccnt = 8;
    : _/ t" H2 v6 }6 U( _2 B
  81. 4 }- b* m: r+ d4 @/ V1 k  U
  82. module_param(acnt, int, S_IRUGO);
    9 ?/ `! I5 _0 H: P2 R/ z
  83. module_param(bcnt, int, S_IRUGO);
    6 Y# h) a7 I3 a! V+ E. m# u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& G2 M' ]0 h0 ?

$ D8 Z; o' M5 @3 M% c% f      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. F4 ^- e1 ^4 \/ ?( H5 g) B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" m- ?. d) p$ h2 A' e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% ~' x+ l" c$ H
* G' H) [$ P+ }5 W# o2 k
( A/ M+ D" _" L4 f$ n# f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-18 04:49 , Processed in 0.037512 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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