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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : x5 `. K2 R3 I, L6 a/ _. o& D
  1. [code]EDMA sample test application2 `4 a0 c1 e+ p
  2. /*3 v. g5 L0 {8 |. E# M3 Z
  3. * edma_test.c
    * o" f: p  M9 V. ~+ n1 x
  4. *
    3 M  `: @5 I3 [8 k5 L& q* f
  5. * brief  EDMA3 Test Application  a8 \( D( ^# I, O. a
  6. *& W- L2 r9 J5 l1 m  ?0 b9 T1 ^
  7. *   This file contains EDMA3 Test code.( v6 X$ _) r8 o8 K
  8. *
    " n. a8 ^0 u/ m" {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - U8 C+ B! A+ h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- K7 a  d* S0 e, Z. b, c$ t# A
  11. *         TO CHANGE.( S/ ^$ ^9 c1 x/ \/ [0 F: j
  12. *
    ) g" }8 y: Y8 a! F* H# w0 H' W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & v' @' ^. N# b' j
  14. *6 L. [1 K+ Z5 y
  15. * This program is free software; you can redistribute it and/or' V0 _" P6 p8 g9 N
  16. * modify it under the terms of the GNU General Public License as  ^+ M% W" k7 G6 B8 b0 B" S
  17. * published by the Free Software Foundation version 2.
    / m2 c6 ?: N* v- M' z2 `
  18. *! p7 Z: d! S1 h6 C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 F( N% V* K; ?- T  ?* m
  20. * kind, whether express or implied; without even the implied warranty
    * Y$ j( d" O" }8 t4 q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) j" _- b1 {1 s! K
  22. * GNU General Public License for more details.
    % o5 u8 K+ r# v) _
  23. */, \: }) M1 I7 T$ \& c
  24. ' P8 z, ^$ D4 Y
  25. #include <linux/module.h>: k4 U. g3 H# {7 ~  g! r
  26. #include <linux/init.h>
    ( n% M5 B% s( X7 M. ~
  27. #include <linux/errno.h>
    - l7 }9 x. X: q* R4 a  {+ w
  28. #include <linux/types.h>
    # J4 E- P7 n8 H( A
  29. #include <linux/interrupt.h>
    2 c8 @* D* b& a2 c4 b$ j# T
  30. #include <asm/io.h>
    4 P) H" a, [) i6 v
  31. #include <linux/moduleparam.h>( _" T# ~' e5 H& p
  32. #include <linux/sysctl.h>' E# Y3 C9 a+ W& l7 V
  33. #include <linux/mm.h>
    6 y2 G9 o' V+ d7 p) W1 Q  E
  34. #include <linux/dma-mapping.h>, W! i4 w' h1 s+ R0 |8 D
  35. 3 V# B5 B7 i  i" I; u! d( f
  36. #include <mach/memory.h>
    1 ~& D, T# b/ L% r- X2 L/ f
  37. #include <mach/hardware.h>5 h; q* m& a) J, _9 b
  38. #include <mach/irqs.h># ?/ a( z& I/ c6 }9 \8 N  L
  39. #include <asm/hardware/edma.h>* z; Q5 C0 }2 ~, v' ~$ ^
  40. ; _+ i+ P' c+ u7 x0 j
  41. #undef EDMA3_DEBUG6 r4 S, _8 A/ e) y
  42. /*#define EDMA3_DEBUG*/# P: l4 h, V8 i: L! i# Z- ^+ v
  43. 9 Q0 S: J7 ?! U. q
  44. #ifdef EDMA3_DEBUG
    2 K# Q0 I  r$ E/ p$ o) j! O# _! Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 p- |  V4 Z* ]4 ~- b/ c* {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! o# ?8 Q* ?& i9 l2 W. K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  j  i) s. N. x- A: ?  s9 H2 Z
  48. #else
    . |8 |/ \0 F, g3 p: J
  49. #define DMA_PRINTK( x... )# _) M5 e/ R- C
  50. #define DMA_FN_IN
    0 X, |- Q2 O3 e4 w5 ]" i8 |6 X; H
  51. #define DMA_FN_OUT
    ! q! u9 Q; ], X
  52. #endif
    , u$ q- Q- Q  u* \
  53. ) Z" f9 p) _0 t: G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! t' A# p" B. T8 W
  55. #define STATIC_SHIFT                3
    , v+ A; n( f! N& W5 d! K
  56. #define TCINTEN_SHIFT               20
    . [' Y" o) C( l" ~
  57. #define ITCINTEN_SHIFT              21
    $ b# T$ X( o# {% Q
  58. #define TCCHEN_SHIFT                229 H- Q( P% T0 G9 R
  59. #define ITCCHEN_SHIFT               23
    % W% k( M9 f+ e+ p; U8 w

  60. ! Q; _" Z/ A4 T- z( \8 q
  61. static volatile int irqraised1 = 0;! o, d) u! L) y" k
  62. static volatile int irqraised2 = 0;
    : o! D8 M- z% ~, H4 s" Y/ X

  63. ; B! x8 s: U0 s. @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% N& k. T. q5 O, `' d; V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. `% s/ Y* W) x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 _' M; g* I1 i

  67. 4 `8 O2 M3 b" C' h) F& |* r0 @. d
  68. dma_addr_t dmaphyssrc1 = 0;
    - N: x3 C" X$ k# y  H6 ]1 a
  69. dma_addr_t dmaphyssrc2 = 0;( r4 x- o* D" O' b9 `$ {7 d
  70. dma_addr_t dmaphysdest1 = 0;2 C+ H, G  d8 E/ i& i9 O# _' l
  71. dma_addr_t dmaphysdest2 = 0;, [. h8 G8 V$ l2 V. M$ o& b
  72. ! X8 A" i1 d* a3 l% M/ f
  73. char *dmabufsrc1 = NULL;
    ' q/ j' e) O( Z) v
  74. char *dmabufsrc2 = NULL;
    % e% u( G2 }$ W- w8 n* B
  75. char *dmabufdest1 = NULL;
      t9 G; n  d3 O- L. g
  76. char *dmabufdest2 = NULL;8 h) R% e, C; t" ]

  77. % Z/ ~1 D# U+ S' ~) A) ^
  78. static int acnt = 512;
    * H# Q7 _4 _0 ~0 L) F9 g3 U
  79. static int bcnt = 8;
    5 `/ s2 l: S, o" h# r" A: g
  80. static int ccnt = 8;8 n4 W+ T! _" x' R. D0 Q- O+ T

  81. $ Y. E& W) o4 L, T" V" n% g
  82. module_param(acnt, int, S_IRUGO);1 s9 g. N* Q8 k$ }$ _
  83. module_param(bcnt, int, S_IRUGO);5 G- R+ q" v, Z7 c% q- [2 P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; G; D% X% N) d& W3 h6 C$ }) `" r
* z$ e8 v4 G- z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' k# s$ t; P% y( A! y( q2 |  E0 k! 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. F* H0 L' C5 g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# p4 m  c- ?8 o3 @3 o

) G0 ~7 n2 [6 C; |6 O; E1 B/ T3 }' x$ r$ s, Y+ A( m9 M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-31 14:18 , Processed in 0.041817 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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