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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   O; \- l. L1 m2 V5 e" I9 ?; n
  1. [code]EDMA sample test application  A- ^1 n1 F$ n: U3 S
  2. /*$ j9 Y$ ~4 L- g# j  W' \
  3. * edma_test.c
    & {3 Z/ X( }8 O
  4. *
      G: C9 w3 e+ F. g+ b
  5. * brief  EDMA3 Test Application
    - u: A$ K$ C+ q0 K
  6. *% g& U  {2 o4 G6 E# B) o$ b- N
  7. *   This file contains EDMA3 Test code.
    ! {0 ]2 s  D9 v# X
  8. *9 n" I  `8 \' |1 o* b* ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 n5 U, i7 ~8 \% L3 a4 }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 h. U1 D( s2 v7 U1 g7 P8 r
  11. *         TO CHANGE.
    # h0 ]2 a1 q( H. f' Q1 c- i+ b
  12. *
    6 O- N+ I& Z# w4 v; W3 X5 j2 B2 x* c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! ?  m5 S: r. l+ C0 f) m$ l
  14. *
    5 c, H/ X# l. }
  15. * This program is free software; you can redistribute it and/or* _) O  |7 D  q2 H! B; _
  16. * modify it under the terms of the GNU General Public License as
    / y3 N7 m7 \" `
  17. * published by the Free Software Foundation version 2.
    : \" d9 ]) {2 Y5 O/ G
  18. *, d6 j2 t6 _$ ?$ L. c7 F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + A9 ]3 f; q& m1 T' P$ E
  20. * kind, whether express or implied; without even the implied warranty! h  U! z0 S, j! S/ J- I8 F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / k. w$ z9 Y4 u; f. S7 j/ U0 d
  22. * GNU General Public License for more details.
    + f$ L6 g! @: y* \2 J+ ?$ E6 n- Q* x
  23. */
    * l- g! `2 S8 z' X$ G! v- E4 g

  24. / B0 w: r. J8 {. d$ o$ o( a" ]
  25. #include <linux/module.h>
    ( Z* I% ]- R: x! }
  26. #include <linux/init.h>
    6 k; n5 m2 r! n3 \8 ^8 w9 K
  27. #include <linux/errno.h>
    9 |" P# P' c0 @- r9 b
  28. #include <linux/types.h>
    # \9 c& |- T# I* y! s3 ~
  29. #include <linux/interrupt.h>
    + z4 U* n+ c' s: u
  30. #include <asm/io.h>
    / c' k- G6 Q- ~; [
  31. #include <linux/moduleparam.h>( f" ]  i. |& l2 `- Y
  32. #include <linux/sysctl.h>  g& p6 B$ g: m$ F% J9 K
  33. #include <linux/mm.h>( \( B7 _. ?. U' T  ]4 r0 ?
  34. #include <linux/dma-mapping.h>
    & G2 M. d9 \( z2 Y! h# y# ~
  35. 5 b7 F8 s6 c: k0 s" c# ]
  36. #include <mach/memory.h>5 m: Y& v6 [8 e2 ?% k& ]
  37. #include <mach/hardware.h>
    ( a- u( X" ~6 D) Q  b, M' H! I$ [- r
  38. #include <mach/irqs.h>
    , B/ l9 }" V' s) T, T) n
  39. #include <asm/hardware/edma.h>: ]+ C) ]: h- o, D( W

  40. , t, e; k9 }5 i: s: c5 A
  41. #undef EDMA3_DEBUG
    ' i) W' M/ N# j/ \
  42. /*#define EDMA3_DEBUG*/
    3 R7 [- a! y8 W" @3 O! s
  43. 9 g7 `9 h- C: I( w
  44. #ifdef EDMA3_DEBUG+ F" U# N9 J$ ^4 z$ a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 g& R1 Q; I1 C5 ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " _, `& v$ X1 U' N! k8 ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " s0 K) @* ~2 R. ^9 Y$ ~
  48. #else
    # O3 |% }2 i% D/ n* F
  49. #define DMA_PRINTK( x... )$ x# k  z9 H2 K9 Q% H5 p2 }# \6 x/ t# z
  50. #define DMA_FN_IN$ @) ^/ L& q% K* j4 O; f
  51. #define DMA_FN_OUT: W; F. u4 S( [, B+ v
  52. #endif
    - v/ o( J" @4 P3 s

  53. ' A" m, y9 t; }7 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( i' z, p. U# _- s  Y  M3 u
  55. #define STATIC_SHIFT                3! x# Z. i3 m  k, R
  56. #define TCINTEN_SHIFT               20
    + }- V6 s3 B  k
  57. #define ITCINTEN_SHIFT              21
    ( Y2 k) g# L! G5 J1 u- o3 i
  58. #define TCCHEN_SHIFT                22
    9 }2 P* ]7 h& I$ n9 ~( X; S4 u
  59. #define ITCCHEN_SHIFT               23) \2 i- f4 G0 H
  60. . j; ^3 U- ]0 v" g! R" M, \, l& ~! P7 `
  61. static volatile int irqraised1 = 0;
    : A. F1 n" N2 @; J
  62. static volatile int irqraised2 = 0;
    0 ~2 U# k7 F" W+ I) e# P. q7 [
  63. . ~+ v# B8 h* b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . z8 j! ^5 n$ z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + m8 i: q5 q6 @2 W8 h& S# T  F5 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 [; e0 B' M7 |4 b5 w* H
  67. 6 r) n( Z2 a. d6 O% L4 p( F
  68. dma_addr_t dmaphyssrc1 = 0;
    ) M2 N9 ~9 D4 f7 O( T
  69. dma_addr_t dmaphyssrc2 = 0;  A- h! l( q6 v8 l" w* a
  70. dma_addr_t dmaphysdest1 = 0;
    ' X$ }) z) l2 b5 }4 P3 E- k
  71. dma_addr_t dmaphysdest2 = 0;
    3 H' R) {. F4 L3 }! h. v! L

  72. - v) `" q# }8 f% Y8 Y& o7 z& r
  73. char *dmabufsrc1 = NULL;
    * ?6 p; x, m5 K# J
  74. char *dmabufsrc2 = NULL;9 i# J" l: k0 ?' M  a
  75. char *dmabufdest1 = NULL;
    , `6 s, t7 y' l/ O# q' L' `
  76. char *dmabufdest2 = NULL;( g# e/ U) Q0 Y  `

  77. , Z* M1 b9 K- c% a
  78. static int acnt = 512;
    ' z6 x' ]' A- A5 m
  79. static int bcnt = 8;" P8 ~3 w- K8 u7 D, s& H
  80. static int ccnt = 8;5 M5 [( C- [( P8 K9 u

  81. 9 B. Y* n3 n' }/ o. M) k
  82. module_param(acnt, int, S_IRUGO);
    $ |3 d9 B" f( s7 s1 L6 W
  83. module_param(bcnt, int, S_IRUGO);4 r2 l% b( p1 r" J  x. m- s$ i8 V: c5 ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: y9 V' u( c# ?+ u8 S0 }: ?! z
& X3 q. y* D. v1 k: K- `( d      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. D$ x* L, t0 q) M! k, Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 @& w. g5 p3 k# I
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 F- X' S. B' f; L/ r' x

" Z1 k  r8 E( l5 J) t) N$ e! w! X  m' ]5 u5 V) q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-24 04:14 , Processed in 0.040710 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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