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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - u$ r5 w1 G, X! f; C$ H1 Q
  1. [code]EDMA sample test application! x/ f/ Y9 ], o: C6 u- X
  2. /*& [: _7 Z5 t" B9 W+ r) ]
  3. * edma_test.c
    # j$ V' u6 Y7 u/ p( v  G
  4. *5 @, @0 \5 g5 Z( \' ?! N
  5. * brief  EDMA3 Test Application
    . j9 ^- `- A" m& U
  6. *8 f( O4 \7 N( Z8 X- [8 H
  7. *   This file contains EDMA3 Test code.# U' J: X: H$ ]# z
  8. *1 ]3 \/ Y0 d! H2 j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 d$ z- N! a8 W% A* |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ T# T, u! v9 x  P! r/ O8 M1 K
  11. *         TO CHANGE.
    5 X9 g* A. w7 o+ @+ T. L, R
  12. *# b$ U  b) z" h; [) r$ ~$ V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 h" _5 C9 l- S+ U7 d6 {0 f1 I0 W
  14. *
    * _8 a" R0 v) X7 q2 ^) B& S
  15. * This program is free software; you can redistribute it and/or  j. i0 j* @, R& Y3 ~
  16. * modify it under the terms of the GNU General Public License as& D. y9 p! B( v
  17. * published by the Free Software Foundation version 2.
    - F; x, ~/ T3 A) Z, ?  p3 [) g, {
  18. *
    # j* ]: I8 u! l' K! f+ j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - g3 s5 [( q, j7 K
  20. * kind, whether express or implied; without even the implied warranty
    . Y- p  I: O  X* a9 I, m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; m' i+ B3 h2 E' f; d$ R6 P5 C
  22. * GNU General Public License for more details.
    ! J3 _4 K5 v, m- m
  23. */
    ) z9 ?; D: W. I" a/ _

  24. % h2 q, y  M# g! d& S' z5 V
  25. #include <linux/module.h>
    # e" g, K& O5 e$ E9 c) q3 i! O
  26. #include <linux/init.h>8 }: T9 q+ y4 V
  27. #include <linux/errno.h>( c: ?/ j# q& j, {& V; {! l
  28. #include <linux/types.h>
    % Q; K+ w. U( \0 K; g3 ~- L8 `
  29. #include <linux/interrupt.h>
    $ f5 j) Y7 t) b" V5 {
  30. #include <asm/io.h>
    - i" B& E- D/ g% [/ V. R4 S
  31. #include <linux/moduleparam.h>; F8 c' q* {% ^" n/ i+ x
  32. #include <linux/sysctl.h>; K& ?# k% G( J9 D
  33. #include <linux/mm.h>
    , }, G) g. N. |" l  I8 m( k" K/ z
  34. #include <linux/dma-mapping.h>- I1 U0 b+ c. V1 ~, f8 U' D/ I

  35. ( i8 I5 E) ~7 d% O* ?/ ?- b1 b3 ^
  36. #include <mach/memory.h>; _& f3 T/ [5 D2 `! @; B  `& @
  37. #include <mach/hardware.h>! R7 t9 Q7 E4 E! g  V
  38. #include <mach/irqs.h>( n; b  V2 o2 X, O! l: O/ r! S6 C9 H
  39. #include <asm/hardware/edma.h>" C1 w! h0 [6 ~$ [9 D

  40. 9 g' b9 O2 R' j6 L" Y5 w. K* ^0 }; h
  41. #undef EDMA3_DEBUG8 I" ?; W& G: e7 S: e
  42. /*#define EDMA3_DEBUG*/
    . b& i; K( |6 v! j& x
  43. & ^7 m/ y& J+ h/ J/ O% m0 L( W* n: B
  44. #ifdef EDMA3_DEBUG
      v$ s- R/ `. q% S9 j. N& d7 F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : t; R% b* x% R- S+ j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! k7 Q$ ^) x& K+ f; @3 U- k  s" @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      C/ p# G! u) `, U/ A8 w" E
  48. #else: R( m$ ?1 ~$ l: n( h9 Q; B
  49. #define DMA_PRINTK( x... )0 A5 \6 `$ q( p& w
  50. #define DMA_FN_IN
    6 k  N. L' C; Z9 E, y0 F9 N
  51. #define DMA_FN_OUT. r$ F( l# N  G
  52. #endif
      ~2 b  U# y+ r' v3 n  J

  53. 4 M& c2 a$ g) H5 b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' N5 o+ l& j' ^& e6 j/ {$ `4 b
  55. #define STATIC_SHIFT                3
    , N0 u2 h* r  i$ ^8 t3 g
  56. #define TCINTEN_SHIFT               20" V/ ?1 n# c' @2 c& M* `
  57. #define ITCINTEN_SHIFT              212 f1 Q1 z" e0 A( r
  58. #define TCCHEN_SHIFT                22
    , X3 s" {( Z4 L: Y  E; s
  59. #define ITCCHEN_SHIFT               23
    * L' D' N. U' u2 U% h7 N

  60. 8 y- g" z' Z# `( @6 w
  61. static volatile int irqraised1 = 0;
    $ D( L/ m- B2 f' N2 g1 c9 h  y
  62. static volatile int irqraised2 = 0;
    ! e0 @9 m4 \: T& _0 I

  63. / H* a5 N, H. H* S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' W: @  h7 \$ k- q+ ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  r- |' b) f) y$ U; N0 y- r0 @; O3 C2 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ r, O& [# C: f: t8 T+ t# h2 Q9 U
  67. ' I/ v2 a( W1 _5 ^  P/ N
  68. dma_addr_t dmaphyssrc1 = 0;
    ) U7 g8 Q! O+ F
  69. dma_addr_t dmaphyssrc2 = 0;
    5 J8 D" [" i) u3 e- P+ G
  70. dma_addr_t dmaphysdest1 = 0;4 a: |8 e; h+ _# G5 ^% q
  71. dma_addr_t dmaphysdest2 = 0;
    ) V6 k7 m3 v9 s+ X+ _6 M
  72. 6 L- E+ Y! t- C
  73. char *dmabufsrc1 = NULL;' A7 n2 g+ f/ t/ M$ }
  74. char *dmabufsrc2 = NULL;4 z: A( E% E" @
  75. char *dmabufdest1 = NULL;! T$ |. D4 H) z; ]1 m
  76. char *dmabufdest2 = NULL;
    8 H. Y. j( r+ g, |. w$ f+ u

  77. 0 s! L* ?7 q! m' v# a1 R6 a; V4 U
  78. static int acnt = 512;( }1 @: X: ?! W2 s. D! m) N) w6 j
  79. static int bcnt = 8;
    4 R( P3 v& _4 v; p6 ]+ Q
  80. static int ccnt = 8;
    8 K8 P# D0 u9 X* U

  81. ) A- K% A* ?3 W. s8 X; \6 g
  82. module_param(acnt, int, S_IRUGO);
    ( S: t. k! f7 E: r: a
  83. module_param(bcnt, int, S_IRUGO);" y7 h9 H. x( }0 i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ u  t. i; {! @$ T& m* ]; ]% Z1 E& B
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" _  d. ?& ?  k$ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 J6 q+ i/ L' a% v
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* `- O( d" P+ b( e0 _# j0 z$ N7 I5 P$ F, j$ R% p

+ r7 o  m% h5 ~/ d0 F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-3 12:26 , Processed in 0.044580 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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