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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . _* b) F1 K( ]+ r8 }, q
  1. [code]EDMA sample test application
    8 w4 s# d6 ~6 X0 l6 G  B9 m: m
  2. /*: @3 D# L6 K1 S1 N9 ^0 I6 ^
  3. * edma_test.c2 T* {+ Q" h) O. @
  4. *  l8 D# f  e; ^
  5. * brief  EDMA3 Test Application
    ) Q' s4 @  R3 O: J; O  a
  6. *
    " ~6 |8 {: e* l3 M
  7. *   This file contains EDMA3 Test code.8 v2 @) ~7 ^6 X# z
  8. *
    & n% W" {% F% d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( a! _5 }! W; G$ o8 \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) P4 e+ a6 w1 N1 a- T
  11. *         TO CHANGE.
    * `# \# \" s$ H
  12. *
    " l' h7 L' `+ K) ]5 ]! z8 N7 Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 g& \! C9 W6 T. a
  14. *7 v: h& e/ K# M& d6 c  W
  15. * This program is free software; you can redistribute it and/or
    * e; u  y" U$ p7 T3 Y
  16. * modify it under the terms of the GNU General Public License as+ V& _1 v$ i+ @. J% W! o: Z
  17. * published by the Free Software Foundation version 2.; A7 P: [4 }6 P) u
  18. *
    " f( ~: k% w2 R7 M8 N/ O% r: C/ F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  c  l3 c6 ]. z$ f: t4 X
  20. * kind, whether express or implied; without even the implied warranty' R: k. m6 Q" M( J, g( a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 R) j" k. h- s4 Y; G2 |* C  \
  22. * GNU General Public License for more details.' v+ f& K+ F  o. h
  23. */, Q2 X, P+ c6 e  o/ {9 A: T
  24.   x* h( U. D: R: _
  25. #include <linux/module.h>
    # q6 v2 C' W) o$ k/ r. ~2 l
  26. #include <linux/init.h>) r% }5 d6 B$ G7 G" o
  27. #include <linux/errno.h>
    4 @5 G6 o# m& }1 U7 y  p8 Q5 B; m
  28. #include <linux/types.h>, k6 E' _) v4 B
  29. #include <linux/interrupt.h>
    3 u5 T! E$ v# _8 S
  30. #include <asm/io.h>
    - E3 E) ?" E- `) \4 s
  31. #include <linux/moduleparam.h>
    $ x; x$ Z' n+ C( G' A4 s- @8 X; f
  32. #include <linux/sysctl.h>
    ( D! J$ I. g$ L  {! M$ B1 {! i
  33. #include <linux/mm.h>+ v! M- X6 C# K% U; }% D
  34. #include <linux/dma-mapping.h>/ o% O3 w) R3 z. i) w3 ?
  35. 8 a( }, h) {- d1 S# w
  36. #include <mach/memory.h>
    $ K- j, x* F; F& [. y7 [, O; |7 M4 U
  37. #include <mach/hardware.h>
    0 t" U) c. W, ^: b  ]- ~6 V0 ~6 q4 ?
  38. #include <mach/irqs.h>
    2 d( k, y  n0 Q
  39. #include <asm/hardware/edma.h>
    * n" Y" ~2 f0 m/ ]4 B

  40. 4 M& T: v* ?9 V0 ]- S: G
  41. #undef EDMA3_DEBUG" v( z+ Z3 ^9 J8 d1 L; \
  42. /*#define EDMA3_DEBUG*/$ C2 v+ Y6 _* r) r  ?2 l: H
  43. , I: _. w& j2 `( ^/ P9 B: e
  44. #ifdef EDMA3_DEBUG; o, A; e! R/ y6 j( a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! h- ^& q) G. y" _6 Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- c8 w4 w$ X: Z' V0 O2 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . x, A: z& f! x; U9 p: u
  48. #else
    4 u# {' V2 L9 @- o0 c9 t
  49. #define DMA_PRINTK( x... )  T- m0 Y& V) F7 I. C9 E1 @- E
  50. #define DMA_FN_IN/ o1 j  h+ t! Z& ?& c9 j) K
  51. #define DMA_FN_OUT/ Y8 u1 ?' y$ z0 ?* @. d
  52. #endif
    / S( ^* y/ C) l- B
  53. 8 _9 W  y8 l8 |/ T9 T5 N5 h) Y5 ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 _4 r( j6 }; G0 x6 T5 ~
  55. #define STATIC_SHIFT                3
    ; X3 N! [, v; ^+ a4 W! v$ h
  56. #define TCINTEN_SHIFT               20
    & z! r, w( H# h$ r
  57. #define ITCINTEN_SHIFT              21
    ; T. H/ D: M7 p# Z/ [
  58. #define TCCHEN_SHIFT                220 e2 q  T, L& h9 |
  59. #define ITCCHEN_SHIFT               23
    # }+ l/ L" b" f5 b- P" i
  60. ; R( |# P: a) C5 a/ W/ g
  61. static volatile int irqraised1 = 0;
    1 G' B! v' ]8 K5 l1 y2 j9 i: m) e
  62. static volatile int irqraised2 = 0;
      p3 G; y) {, U: V/ `

  63. 3 m1 e# q6 G3 d2 g9 h4 y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ T3 N( E/ d0 P& O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) k! x4 ]# E' C. t6 Y: Q7 ]" ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / T; i' m9 I! O- \8 f/ G% N  c

  67. , p+ j& v5 i' v5 M
  68. dma_addr_t dmaphyssrc1 = 0;7 ]2 g6 O6 ^+ q4 I2 K* C& g5 j2 o
  69. dma_addr_t dmaphyssrc2 = 0;
    " i, L, I+ a* ^
  70. dma_addr_t dmaphysdest1 = 0;+ F! V" i% s( ^9 z: Z
  71. dma_addr_t dmaphysdest2 = 0;
    7 p; v  g! q$ T% `
  72. ; y* h9 c) m8 I6 x2 Q6 s! |
  73. char *dmabufsrc1 = NULL;
    3 B) e4 q0 |4 O% o4 @- |
  74. char *dmabufsrc2 = NULL;
    " N& r2 O. x8 R7 Y8 k8 e9 T4 C; A
  75. char *dmabufdest1 = NULL;
    , V* M. Z$ J) v9 Q: V5 [
  76. char *dmabufdest2 = NULL;
    ! r8 N7 `* W7 v5 u& y, G, x

  77. , X2 S: R9 p% @/ D" Q: [+ x% A
  78. static int acnt = 512;. a; q) F% c9 `
  79. static int bcnt = 8;
    6 P+ v6 S( m/ @5 |" s  K9 U
  80. static int ccnt = 8;
    2 F% b2 J1 @; S( n

  81. 0 \1 V: }; n) @4 o
  82. module_param(acnt, int, S_IRUGO);; D% Z1 |7 S9 x' U* V( P3 T
  83. module_param(bcnt, int, S_IRUGO);
    8 s" G" y1 I( U/ b1 k
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: [9 s. I6 B+ f/ s' @

5 Q; J& W+ B9 f1 N" f- z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ }+ t- |8 s/ Q) ]& o! ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% I2 q$ N7 E! a- q" |& r6 U- D9 i
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 k( N  b9 n; Y3 E0 p
1 D" l2 ?1 F5 x# `+ h/ x' u& N

/ ^2 o; C, X9 ~+ x6 Y) d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-6 15:01 , Processed in 0.045694 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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