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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# a9 i) Z$ K. f' @* A$ `, Q4 t
  1. [code]EDMA sample test application
    1 K+ x! K' V4 e7 f6 g! L
  2. /*; p: T) S0 q8 h9 t( o
  3. * edma_test.c0 m" E, l9 ?- o- }9 G' O
  4. *
    5 ?7 w$ p4 x0 v* E5 O. R+ s" e6 Q
  5. * brief  EDMA3 Test Application" J8 ^. W( t% g  R
  6. *$ z2 w) x: S, Y: }$ ?
  7. *   This file contains EDMA3 Test code.& V; }$ _4 N; h
  8. *  L: F$ h+ i9 _+ A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! O7 p6 H! R" ]/ o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 o) ^8 n% o4 G4 {
  11. *         TO CHANGE.
    * k( }; G3 m1 u9 u. y1 l
  12. *
    7 j6 }% q( N8 U# d+ i+ G% Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 {. D  f3 R3 I# ?9 I# q
  14. *
    & H) U' O; U3 V: S9 D, _( y9 F
  15. * This program is free software; you can redistribute it and/or, _/ f* d* ^; u
  16. * modify it under the terms of the GNU General Public License as& }/ e- `) h1 S* }! L& e- ~9 r
  17. * published by the Free Software Foundation version 2.
    4 r+ l6 i1 j+ j4 J- [- {/ Z5 K' u% R
  18. *" y, z, q( k3 `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  ?0 _! w3 }' @7 M0 i9 [
  20. * kind, whether express or implied; without even the implied warranty! }. ]% L! s) K% d, o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- Q: J" v$ T& _2 ?
  22. * GNU General Public License for more details.6 v- J% r' g8 G2 V" s" I
  23. */
    $ W1 }) s2 f) B( K

  24.   K& @  s0 h7 f' D8 }
  25. #include <linux/module.h>1 L9 J# W9 F, v2 H$ K6 m: j
  26. #include <linux/init.h>% L  T0 j2 f( ?, n) K6 o
  27. #include <linux/errno.h>
    % o& x$ s* G, p* w2 o, y
  28. #include <linux/types.h>7 Q' s+ W4 T% q
  29. #include <linux/interrupt.h>
    1 R/ e: h1 u+ J9 y
  30. #include <asm/io.h>
    ) L- i, V5 w; H% {
  31. #include <linux/moduleparam.h>
    " O/ `1 J) _9 {2 o
  32. #include <linux/sysctl.h>
    - @' H. u8 L6 y+ L# ^
  33. #include <linux/mm.h>
    2 [( Y" g7 B, N) @* ~
  34. #include <linux/dma-mapping.h>/ o( E3 B4 u; {5 H& B
  35. ! \! a- |/ M' T+ b) V7 G) I- t# |
  36. #include <mach/memory.h>
    8 ^, a! b$ A' M$ }% k7 U
  37. #include <mach/hardware.h>
    + @! f( k, K& E) `/ N
  38. #include <mach/irqs.h>8 h1 z) i2 ~' @/ [; a( |
  39. #include <asm/hardware/edma.h>' L+ h: ^- ~& b/ G4 A) x4 R" J& r' E

  40. - j6 K+ i7 r: s, m' _- U
  41. #undef EDMA3_DEBUG
    5 ~. K' u# G) k
  42. /*#define EDMA3_DEBUG*/
    2 T4 z: J6 h$ v) Q5 h

  43. ! \& p. {+ a4 X" t  @( G, j" x
  44. #ifdef EDMA3_DEBUG
    ( w: D1 q. I* O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * S# V+ J' K. l/ O4 a5 {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      Z+ r3 Q' S. H- H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; }- O# K# P" B1 k7 M# J7 f
  48. #else
    # u) M) |' B2 O& }% ]
  49. #define DMA_PRINTK( x... )
    6 r7 o, e- B; Z, o
  50. #define DMA_FN_IN
    ! X) F- f$ o0 r+ H
  51. #define DMA_FN_OUT& f: c  [( \  ~
  52. #endif  h% j$ J5 [, A' z( B$ }" |! m

  53. & @' f# h' ?9 s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ G0 |6 l: Z# W2 Q6 f, L% |
  55. #define STATIC_SHIFT                30 M- a( G5 c7 v$ G+ a0 [' |: X
  56. #define TCINTEN_SHIFT               20
    6 E' F' B: N" ]- z" V1 _
  57. #define ITCINTEN_SHIFT              21
    4 E, C% K6 [5 v7 k+ f* Z% h
  58. #define TCCHEN_SHIFT                22+ u& [; T1 V/ f$ o
  59. #define ITCCHEN_SHIFT               23
    ( b" i: j8 L0 y

  60. - G8 ^5 R0 u; p
  61. static volatile int irqraised1 = 0;
    # @0 ]- s: a* v- c! f; W. w
  62. static volatile int irqraised2 = 0;
    $ }( ^9 B* C, {* f8 Y, J

  63. 0 g2 Q" [7 K; i& F0 n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  U' m4 k2 ?/ \4 \* t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( D% T; b/ P9 h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  \  I% g" _: [
  67. ( n" z* J" [& \% F" z* y+ X) s
  68. dma_addr_t dmaphyssrc1 = 0;
    8 W# ~7 i0 V3 D8 x0 s
  69. dma_addr_t dmaphyssrc2 = 0;/ r  s; a+ ~) E/ h$ q
  70. dma_addr_t dmaphysdest1 = 0;  _9 O1 P7 K8 M- k+ k; f  L8 p
  71. dma_addr_t dmaphysdest2 = 0;+ U( W+ n. q. C& y+ {& [1 E) \! y

  72. 3 x, J) J- X$ G! w9 d& i, @. e
  73. char *dmabufsrc1 = NULL;; t6 [+ J! S7 a; @
  74. char *dmabufsrc2 = NULL;
    ; e" R" D% [0 X
  75. char *dmabufdest1 = NULL;$ @! k( {9 S) j0 p/ t( }
  76. char *dmabufdest2 = NULL;( Y  ?% a+ M' {
  77. ! X6 I5 H2 e7 w$ F0 b0 R0 p
  78. static int acnt = 512;* A5 T; L8 O/ F! r# _: ~! I8 q
  79. static int bcnt = 8;
    . v9 {" ^& s- l6 F9 B% O, P, ]* F
  80. static int ccnt = 8;
    1 n8 C) N, k7 E* b5 o% V
  81. 3 J8 i1 D" N, p$ ]# a) D
  82. module_param(acnt, int, S_IRUGO);- R, D  `. j" F# K- t7 N- |
  83. module_param(bcnt, int, S_IRUGO);7 Z7 I' n' f8 i/ q7 K# v! z) x" b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 c4 }/ I+ I! p8 C

; j' _/ l; P0 P9 [9 ]* ^6 q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* P( g) a  L' O8 i) J  warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 i* o8 T2 a9 A  Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( b9 R+ X, q9 p" ?, r1 `
# u1 e) m9 `! ?+ {; G, f& |- k; u  T* S  v6 _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-19 18:07 , Processed in 0.036451 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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