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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ d0 Z9 Y$ V% M2 }% n
  1. [code]EDMA sample test application* B  w; f( ^% l! ~! {
  2. /*
    2 [4 a7 u7 W- l* Q
  3. * edma_test.c
    ) w, U1 N; F7 g" c  y% E6 D9 H+ A
  4. *$ U1 W0 ]& D: Z. L+ I( O& `
  5. * brief  EDMA3 Test Application
    . S: _8 O4 x' D; j* t
  6. *, l; n/ U4 f  y& X' C" B
  7. *   This file contains EDMA3 Test code.
    / }+ {7 F/ ?6 c) F8 D8 m9 h
  8. *# @1 ]5 z; E3 `) x7 ?' f: U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& S6 i( H' X& ~* Z  R1 _" a6 P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! A$ S8 w5 Y( ?; W% I
  11. *         TO CHANGE.
    , s, [; y& i' ]2 E& e9 {
  12. *
    ! d1 s9 [: B6 t) Y' a  Y; @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! o: g( \8 O, I) s( k; B. Z
  14. *
    2 @" H! W$ X, Y8 z% i+ t7 o" J
  15. * This program is free software; you can redistribute it and/or! J% K* \6 I1 W; m
  16. * modify it under the terms of the GNU General Public License as
    " N* V- n3 L% }) C- \
  17. * published by the Free Software Foundation version 2.
    % m# D) j2 n$ a) m6 B6 J
  18. *
    6 _; z; P& y4 D1 |3 l2 M: j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 w  N( y: n" X& b6 G5 r
  20. * kind, whether express or implied; without even the implied warranty7 x2 q0 P2 K+ e" R( l& l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , P8 g7 ]* ?: ^# o. \- @
  22. * GNU General Public License for more details.& v- ^/ N( ]7 p) c$ Z' i
  23. */
    * {1 A5 S& Q, ~# r) i' I

  24. - C) ^3 q7 j3 ]5 w6 i" \
  25. #include <linux/module.h>8 t% N- f9 k' U) ]
  26. #include <linux/init.h>
    6 u7 |, Q( |# K! ?  X6 C% M$ r. a) b
  27. #include <linux/errno.h>
    - M  P( h4 f0 `# q6 a) ^
  28. #include <linux/types.h>
    " N  O6 S+ u) `  g' a! x9 ~5 X
  29. #include <linux/interrupt.h>
    4 U/ _6 A' q0 ]9 }" @1 A
  30. #include <asm/io.h>. n! z7 W: `( m+ |! q" ^4 q
  31. #include <linux/moduleparam.h>
    : t  j/ o: t6 G( p
  32. #include <linux/sysctl.h>
      r8 n; D* I9 a/ G. v
  33. #include <linux/mm.h>
    5 e! h- n, e9 \( j* O# @
  34. #include <linux/dma-mapping.h>0 p( o; X9 a# _5 ?9 F6 A4 h$ _- N

  35. ( |4 Q9 A. C  N/ B3 u; }
  36. #include <mach/memory.h>) W, I: R, f/ Z: d6 k
  37. #include <mach/hardware.h>
    % x  j$ \  w3 r/ H
  38. #include <mach/irqs.h>7 x. Q! L6 E) _( \5 C
  39. #include <asm/hardware/edma.h>
      |1 m; A) y4 G$ l( E7 ~9 [) S+ ]2 \
  40. + t8 w* W/ t" y% L: w3 A) j. c
  41. #undef EDMA3_DEBUG8 _- H6 v! u$ ]
  42. /*#define EDMA3_DEBUG*/
    + C9 L2 G! o4 X& t& o0 y1 I+ f

  43. ' |; t) T3 T& ~$ g6 }$ S# P% E
  44. #ifdef EDMA3_DEBUG( a, ^/ x  s# M; f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 c1 k1 {5 Q, N% R- ^1 B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( M3 t' }7 ?" g( _# R2 j. Z6 C6 w) }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) l" e/ K; Y5 G9 P- l6 i% M" @
  48. #else3 ?5 E: Z. {8 ?6 S$ |* o2 b& t
  49. #define DMA_PRINTK( x... )
    ' o8 r* k; d9 ^+ y
  50. #define DMA_FN_IN' d, D2 S/ X/ K9 N$ o5 p0 ]
  51. #define DMA_FN_OUT
    , e, @$ p0 h  r; h6 w; `/ {. ^
  52. #endif
    + h; c- W6 j( V3 u2 T) N
  53. 4 x& C; n7 n7 g! o7 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 \: c6 o' B. y# x; W
  55. #define STATIC_SHIFT                3  o3 G2 }6 u5 w: `/ P5 @
  56. #define TCINTEN_SHIFT               20
    : @2 L  Q% j) h) J
  57. #define ITCINTEN_SHIFT              21
    5 J$ L5 m0 C/ q  H9 Y9 H
  58. #define TCCHEN_SHIFT                22
    " r2 w. F; r- f- o0 i1 U
  59. #define ITCCHEN_SHIFT               23
    7 I9 M3 d: ]3 y7 D0 O  h5 X  ^
  60. ) T, B& r/ H* n: ~; Z- s" ]  v
  61. static volatile int irqraised1 = 0;: ?# H) G' s. S& x  h7 Q
  62. static volatile int irqraised2 = 0;
    8 f0 X2 T  p  u# {. V6 k8 V6 Q
  63. 6 g9 U1 n8 m' O" d7 @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' j4 i: |8 t1 |4 x5 h8 P% @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) W8 f# L6 y. I% w) i6 ~  F# _0 T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Q1 v4 T4 Z* L0 X  B+ x9 y
  67. ( A! a' j; {6 x2 k) Q
  68. dma_addr_t dmaphyssrc1 = 0;
    2 a: r6 V1 v  O/ i: v  D
  69. dma_addr_t dmaphyssrc2 = 0;
    : `5 I$ s9 b7 _) {; ]" D: B# t
  70. dma_addr_t dmaphysdest1 = 0;' H9 Q5 y" Z. ?& d# P0 a* J* a
  71. dma_addr_t dmaphysdest2 = 0;! o$ z; b5 ]9 S2 H
  72. 3 v5 D$ r- u/ U4 C( r3 g! s. n
  73. char *dmabufsrc1 = NULL;' V6 Y! x* |2 ?/ p
  74. char *dmabufsrc2 = NULL;
    " `% l0 r5 c! z/ ~, ?; p
  75. char *dmabufdest1 = NULL;' {/ \! \: O4 r  G) M: F: u
  76. char *dmabufdest2 = NULL;7 E  B4 ], }# b

  77. - p" \  a% q  w+ Y
  78. static int acnt = 512;
    ( H% x; Y6 Z" a: X# R
  79. static int bcnt = 8;" y. T" P7 B% a% e7 z* K6 E
  80. static int ccnt = 8;& |5 x) L9 q" U5 o9 U

  81. $ U8 G! Z1 u+ v7 W2 V% u9 ]
  82. module_param(acnt, int, S_IRUGO);8 A% b# @' G9 d( r
  83. module_param(bcnt, int, S_IRUGO);
    $ N! Q+ k0 d/ M+ C- K9 n; B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" z3 i2 i0 Z6 I5 U5 I1 `

" b% ~5 p$ r7 s+ D      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; H) V: s. ?& N  b( H) @& p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 y3 w: K: h" _7 \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. R- M  }  `# x9 P3 k
* j1 l4 y% ~- v, Q* i* K4 P
4 O- B* _8 [+ F# j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-2 02:36 , Processed in 0.046405 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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