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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 w. \0 u! d! x: _/ |4 D
  1. [code]EDMA sample test application+ {8 a* @% i; S- z( i7 g  S/ K
  2. /*4 u1 `/ j( X% W) t2 D2 v
  3. * edma_test.c) H' p" R: a0 H0 k
  4. *1 s3 Y8 |5 D0 N9 D& N' L
  5. * brief  EDMA3 Test Application
    9 R$ p( g2 W# {& w& G4 Y$ e& O* K
  6. *1 y) V- Y3 W: |% t
  7. *   This file contains EDMA3 Test code.- w3 c, z8 J4 e: h# w
  8. *& J7 L3 b- m5 I5 n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ S! d, @2 Z. [! {+ ~7 @4 h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ n( H- J- x( N+ D) U0 b; P1 }
  11. *         TO CHANGE.
      w  p8 C8 Q1 {) b% B9 r; N
  12. *+ y/ P% h2 v, i8 Q: J9 k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " v* ~; z" d  P- D3 @2 O( J, g
  14. *
    4 c! K' t2 k3 B1 ~) A
  15. * This program is free software; you can redistribute it and/or
    . P% I/ \: Q/ U; |# T  b* V
  16. * modify it under the terms of the GNU General Public License as
    * q1 G8 |; k' g. G1 f; z
  17. * published by the Free Software Foundation version 2.
    * D- i9 j- o" `1 u( p# f) d
  18. *
    * Z$ O. T$ h; G; P+ W- m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. n# B3 W+ B' Q2 k/ H/ V" c
  20. * kind, whether express or implied; without even the implied warranty
    * ~4 ]1 b" P% E5 X' y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * v) F) W6 n% x8 B+ R
  22. * GNU General Public License for more details.$ x' f5 H& }/ A
  23. */
    0 u6 _3 G) J; x0 O3 H* W. n

  24. 3 X/ {; @( e4 O2 W  Q
  25. #include <linux/module.h>" J3 g* t6 m) h
  26. #include <linux/init.h>9 m* m% o  R9 X' d( O7 R6 x( T& a0 i" p
  27. #include <linux/errno.h>5 V) g3 m5 d5 U9 M
  28. #include <linux/types.h>
    & Z& }! q  c. T2 P& x0 y
  29. #include <linux/interrupt.h>
    3 }& h, E; b% o% ]- q, `
  30. #include <asm/io.h>4 n6 U( T* E3 D: m8 Z/ l
  31. #include <linux/moduleparam.h>; ?+ E9 a: k6 P4 y
  32. #include <linux/sysctl.h>( z% d: M4 I$ R4 m; p
  33. #include <linux/mm.h>
    - {9 Q/ x- C* V$ h
  34. #include <linux/dma-mapping.h>
    9 f- z2 J, E7 E
  35. . t5 }) \! l+ a2 @
  36. #include <mach/memory.h>
    % `1 T. M  N3 D: t( g: B
  37. #include <mach/hardware.h>% |* B5 `$ B1 `  I/ |
  38. #include <mach/irqs.h>
    . T$ V) r) t  [3 J; O
  39. #include <asm/hardware/edma.h>) ~* o5 x! Q3 D! j" |/ e
  40. $ X. |. u4 T2 i8 Y- d" O
  41. #undef EDMA3_DEBUG
    2 q: \' G# f+ o( y( z( @
  42. /*#define EDMA3_DEBUG*/% T5 @3 v4 w" W1 T
  43. $ Z2 @  P# @5 r8 i5 X( k
  44. #ifdef EDMA3_DEBUG
      g9 r; |$ w; }! z" \( x9 s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 Y' x# }, c" n! |( B" n! s( j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 z: K( e4 X7 a1 U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 i4 |8 L9 R# [9 L# b1 q& ~
  48. #else, l5 M! @' `) N3 b
  49. #define DMA_PRINTK( x... )& u6 K+ B$ V0 l  |+ P
  50. #define DMA_FN_IN
    + L1 z$ p6 p  V% M' z
  51. #define DMA_FN_OUT
    1 @6 m; Z: i( ]
  52. #endif* u' I$ y0 I' e/ l) X

  53. " a. z4 ]6 b! Y, E$ B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % z* Z& [  e, r6 P( \" W* M3 j
  55. #define STATIC_SHIFT                3& k' @' d' r4 o6 O4 s* ?# }
  56. #define TCINTEN_SHIFT               20. D$ j' Y% \, G. O. p' a
  57. #define ITCINTEN_SHIFT              212 r; Y! N# C8 V+ [3 `& q
  58. #define TCCHEN_SHIFT                22
    1 k, o5 P6 P: }  E* |. y
  59. #define ITCCHEN_SHIFT               23' ]6 e) F8 s$ R) S  i# ^% U
  60. 9 j2 L# Z% O) k- e5 L( t
  61. static volatile int irqraised1 = 0;' _5 H/ B) \( b% j3 c4 F5 v2 a2 m
  62. static volatile int irqraised2 = 0;
    ' r- F& s% A: [! N; ^
  63. 8 Z* k/ Q) \8 L+ ^& r/ ]+ x/ E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 G' c' f; Y1 Y, w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ~$ w) f0 ?. G! ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 Z5 d: k: T. Y, t' `
  67. + {/ p) N6 f$ l6 Q
  68. dma_addr_t dmaphyssrc1 = 0;, @$ Z$ W) u$ q: O* D: a
  69. dma_addr_t dmaphyssrc2 = 0;
    - I3 p% M- W, @4 X
  70. dma_addr_t dmaphysdest1 = 0;
    0 ]6 d( I6 ]$ n4 P# {6 u  L
  71. dma_addr_t dmaphysdest2 = 0;; Z8 T" b, Y% x1 T, }

  72. ) M" `0 V  E/ A. o2 C, C
  73. char *dmabufsrc1 = NULL;- _/ k1 n7 S  p/ [  Z: S
  74. char *dmabufsrc2 = NULL;
    & t! K9 }" n$ m; i( t* ?
  75. char *dmabufdest1 = NULL;
    5 Z; w' Y/ w! B1 E% |8 K$ ~' ~1 H+ j" s
  76. char *dmabufdest2 = NULL;
    ! z& G- d& j, j4 p
  77. * g& R, v# G( E' S( x2 Q
  78. static int acnt = 512;
    / q; H; Q, P8 E* z. N
  79. static int bcnt = 8;9 e# q# ]! V6 \% Q" F( w( ^
  80. static int ccnt = 8;
    % q# t* M* e5 O+ n- j

  81. ( L* T$ X, ^; J* m
  82. module_param(acnt, int, S_IRUGO);
      b' ?, V( x* m5 P, Q" u2 L0 N, w/ q
  83. module_param(bcnt, int, S_IRUGO);1 d, n3 ]4 j  D5 k" m& d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* e% w9 l3 g  \9 H
4 M' b) E8 r4 f; F& L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" ^. ^0 i- o& V0 V1 ]. @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. i; `- |, z: j2 J* b: s+ |% i
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- X1 z8 J8 r; ^
- W% b0 _6 C+ O' J
6 \* `5 I  D* v0 Q1 v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-23 13:37 , Processed in 0.048281 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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