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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. }4 `) ]  E( D  n8 k
  1. [code]EDMA sample test application
    : ~+ h, X* D3 k
  2. /*
    - j0 _! `5 p; ~" f4 I% W
  3. * edma_test.c
    ( E1 P1 z9 Y+ Z7 i1 Y
  4. *
    9 s6 T4 R6 z- f$ b# T
  5. * brief  EDMA3 Test Application8 G/ w( Z* t) X$ ^
  6. *
    1 o  c- i. Y1 A# i# @6 J
  7. *   This file contains EDMA3 Test code.
    9 Q& Q% f# B, k
  8. *9 P/ Z. n% r3 H, f+ o! \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . I6 Q- q* M# l1 J! n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! |7 K. [2 y3 }9 e1 @" y! z
  11. *         TO CHANGE.( y' b2 T! x" \' [
  12. *# f$ G0 g( y8 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# S* L* }, C$ F( B$ M. K7 q/ `
  14. *
    * a+ k$ f. I. h
  15. * This program is free software; you can redistribute it and/or
    / o$ u! a7 A, |  N9 w& w
  16. * modify it under the terms of the GNU General Public License as
      Y, [% k3 a- t# n
  17. * published by the Free Software Foundation version 2./ t  z3 l1 J/ P/ }, [* ~% }
  18. *
    * }. Z0 e" T: a- X7 h: B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * q  P' }. _: ~
  20. * kind, whether express or implied; without even the implied warranty
    / i' `6 R3 n! ~  e: v! M( g) R) G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  R5 H* n6 F5 }9 x
  22. * GNU General Public License for more details.
    0 a' d- y' j' }6 R$ g/ ~
  23. *// x2 D0 w$ O5 j  W: P: u
  24. 7 p$ x3 a& v3 m) k: h
  25. #include <linux/module.h>
      [; C, w, S/ c7 n$ o1 `
  26. #include <linux/init.h>
    9 l8 Y3 Y+ P. D) ]
  27. #include <linux/errno.h>
    3 g. {* p1 s% I) C  g4 d# w* f
  28. #include <linux/types.h>8 w% H1 J' a( y3 T8 U8 e3 y9 L! }
  29. #include <linux/interrupt.h>
    ! l  B, r) ^& w& d- a  f% ~/ W  o
  30. #include <asm/io.h>
    " F. c; {9 V) L/ T2 z8 j) i/ v
  31. #include <linux/moduleparam.h>0 i% l. E* u/ n7 }
  32. #include <linux/sysctl.h>+ F4 o6 j8 `/ K4 K2 p
  33. #include <linux/mm.h>
    - {$ T. U6 ~1 @3 p
  34. #include <linux/dma-mapping.h>
    % L, O* v# b" L' W' E; g

  35. , W2 k& t9 |4 N# A1 h- h- S
  36. #include <mach/memory.h>, F, F! T+ i7 H5 e) B9 l% L# L0 l
  37. #include <mach/hardware.h>4 A+ Z% m8 ]7 u( e. F( Z
  38. #include <mach/irqs.h>( M8 ~$ R) `$ j$ `0 o9 Y& u
  39. #include <asm/hardware/edma.h>
    % ~" ?- _3 n/ }, Q( L1 @2 Y5 z4 V
  40. 8 O. b! s  M; ~" g# q& d9 c: J; ]5 o
  41. #undef EDMA3_DEBUG
    $ J7 T; e; L  ~5 E
  42. /*#define EDMA3_DEBUG*/# P$ m0 _& E7 q  l3 X& O, j
  43. + A9 l! i% h- H$ w; Y7 |' C2 c
  44. #ifdef EDMA3_DEBUG
    7 x" N3 p: [! s( g: B7 s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : q0 |  g0 l. K7 T. N6 \* H8 _2 d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( o& C# f6 `6 ^8 O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 {$ n7 h8 v. Z; `' W
  48. #else, v6 X6 y' d: m) H5 z8 s: v  y: l
  49. #define DMA_PRINTK( x... )
    9 z2 J1 c+ F* Y+ z0 s% w. v  c
  50. #define DMA_FN_IN/ i% z+ H1 q% V; d+ \
  51. #define DMA_FN_OUT7 q$ t5 A% T, h+ t" {
  52. #endif: ]* Z% J5 J2 L9 `) ]2 {
  53. : H- q. O" B0 g$ X7 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# M# Z. C# h4 C. I
  55. #define STATIC_SHIFT                3' @7 e: M. q. z( h
  56. #define TCINTEN_SHIFT               20% \$ {* q: u/ w6 h0 }
  57. #define ITCINTEN_SHIFT              21
    5 |$ c( O' U' W; E6 L
  58. #define TCCHEN_SHIFT                22
    8 v2 E9 w  Z5 }
  59. #define ITCCHEN_SHIFT               23/ {% l7 i5 w6 p$ b8 Q; O1 n
  60. 5 V" p/ m; D9 o$ M7 Q/ j
  61. static volatile int irqraised1 = 0;
    ; `  w: ?- \  L4 v: t* T
  62. static volatile int irqraised2 = 0;
      ~: K8 T8 W* I0 Y6 ?) i

  63. 3 v, y& _$ Q6 N; D: b, H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 T0 S: l6 A" z" r3 I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ Z& q8 Q4 G& L/ g8 t' B9 y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 C$ h2 P) Z* c* E
  67. / B: z8 l+ N( G& z1 x% I
  68. dma_addr_t dmaphyssrc1 = 0;
    , e+ N+ d4 g* {4 v
  69. dma_addr_t dmaphyssrc2 = 0;
    ) \6 F0 s1 T, g* T
  70. dma_addr_t dmaphysdest1 = 0;
    6 y9 X/ `) U; `8 J7 d1 H: x* \  `
  71. dma_addr_t dmaphysdest2 = 0;1 w, o: y/ y+ B0 O& _7 z) v2 g
  72. , Z0 n) [7 Q" T" C& b1 H) Y' B
  73. char *dmabufsrc1 = NULL;3 T4 ~+ @* R; f" V7 C
  74. char *dmabufsrc2 = NULL;
    5 d; j( {/ R" K9 |8 D4 f! k
  75. char *dmabufdest1 = NULL;
    , B4 S: g5 Z! ^3 ?6 h6 G" X
  76. char *dmabufdest2 = NULL;
    / Q3 F* E8 y" ]* S2 R9 B# U
  77. - O2 f2 D3 X2 m
  78. static int acnt = 512;
    : |( n3 N* |% y1 ~: _% n; ~
  79. static int bcnt = 8;
    : m2 y3 z$ i- T
  80. static int ccnt = 8;/ ?  j$ ~2 y( e& f  V  q% z/ i$ {

  81. % e' m1 {) U4 y3 g+ ]: U" C
  82. module_param(acnt, int, S_IRUGO);1 H& g' T. ^9 v3 u1 {/ z; Q* E/ m
  83. module_param(bcnt, int, S_IRUGO);. l# d% S" ~. e3 B& Z2 Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# S8 ^& s# w/ }9 ~6 F

# N( G! `! F" h3 p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 U' M6 R" g  \% D3 b& ~6 C
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 b  ]4 \7 i0 o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" _6 R# _. A2 _# {# M2 P# r3 Y. l
5 O( F8 o9 D1 w3 T  B
' s6 x& o  }+ C% I; H/ h+ y/ f. i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-10-19 02:17 , Processed in 0.036043 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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