OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ q5 v, r" w! c5 \
  1. [code]EDMA sample test application
    ( L( D) `. f3 ]# Q& b% B
  2. /*3 f9 @$ J* `! g& q9 d1 N/ J
  3. * edma_test.c5 Y: _. Y8 E; e' L
  4. ** y: ]( X% A! c, s
  5. * brief  EDMA3 Test Application
    ) Z: T  ^) A4 g! h
  6. *
    : r& X3 y- x! r, V0 n, c
  7. *   This file contains EDMA3 Test code.
    / M* E% U0 R2 k  X
  8. *( @/ M$ p  y2 C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 ?2 I- W# q( o. M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( @& M: v$ e4 Z! \# B1 Y1 K
  11. *         TO CHANGE.
    ( @" o" N( {! x. \4 ]  x. i
  12. *' F, D$ O. p8 y) f& u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 G# U' K, i, A0 Y) w& c% D3 ?* ~+ r
  14. *7 A. p4 M! S: r1 k! N6 M* h
  15. * This program is free software; you can redistribute it and/or
    3 ]/ i2 B  x6 C3 [, z
  16. * modify it under the terms of the GNU General Public License as
    5 b" a% U" q2 ]" q1 d) o. e0 X
  17. * published by the Free Software Foundation version 2.
    , k, N3 z; X2 p* s' G  v' h4 U
  18. *
    3 r7 b$ n2 \6 N* p& }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 T4 Q8 B, W3 k# X
  20. * kind, whether express or implied; without even the implied warranty
    ; _1 ~( m  Q: h0 _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 ?& [1 D5 p  Z& C
  22. * GNU General Public License for more details.) j. ~; R, x9 M
  23. */
    " @: F/ l# I8 C* B% E2 V0 u

  24. 3 F  }0 R2 f& E" B2 }6 k( d
  25. #include <linux/module.h>
    : f, |% |% P( B' t
  26. #include <linux/init.h>- T6 T! d+ s9 [% ~8 y# W2 n8 g1 R
  27. #include <linux/errno.h>
    : l0 W% J8 ]( @7 m
  28. #include <linux/types.h>
    " k- Z" C- Z. h- ]$ X- N3 z! S
  29. #include <linux/interrupt.h># B, z3 q5 o( v6 n8 l0 e( P
  30. #include <asm/io.h>" w' u- P6 |: f8 _" g# o5 o
  31. #include <linux/moduleparam.h>+ L, N1 S/ q+ t9 i7 F6 Q6 x" q# x6 r
  32. #include <linux/sysctl.h>
    0 J8 A: L; r4 c$ G1 W
  33. #include <linux/mm.h>/ h+ z( b1 y* u% ^6 H9 W  X& ^0 H
  34. #include <linux/dma-mapping.h>$ e5 {9 r1 W* U) @

  35. / A" o) u+ p9 K' t4 X; n6 F
  36. #include <mach/memory.h>
    " w7 D* b  J! T3 e
  37. #include <mach/hardware.h>
      z" n) _% O& p1 s& ~5 Q
  38. #include <mach/irqs.h>8 B2 r! U' D) j+ ~( E
  39. #include <asm/hardware/edma.h>
    8 a5 J/ `8 i8 ^* I* i( \9 U+ f0 _4 Z8 c

  40. ( i0 W6 z* [4 O
  41. #undef EDMA3_DEBUG
    1 L4 A- W' F. ~/ B5 t6 e) Y
  42. /*#define EDMA3_DEBUG*/% h" O) C) t% a" J& {0 x
  43. 3 n+ W; ~: O' D8 X
  44. #ifdef EDMA3_DEBUG
    2 M: t; |2 k  M( m9 `- s! D, P( Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! r( V7 x1 @9 B& \/ [* M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): f3 [* R) C, n: j( w9 ~8 [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ p- z2 S5 L; I. b8 Z4 Z) D
  48. #else
    3 N4 b9 [( c6 k
  49. #define DMA_PRINTK( x... )
    : F4 l! G, v! e7 R( ?
  50. #define DMA_FN_IN
    + e4 ~$ y$ ^  n
  51. #define DMA_FN_OUT
    $ o% U1 G. x4 y/ f  R4 R  W
  52. #endif
    ) Q& j1 I5 B# y4 v) U

  53. $ N/ y6 \3 ^: `$ Y- s1 S# A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - B' e9 T/ P+ C# i
  55. #define STATIC_SHIFT                3* m2 B) N' S( v7 b! r% B: m7 t
  56. #define TCINTEN_SHIFT               202 N6 B$ N7 A3 h* U: W
  57. #define ITCINTEN_SHIFT              21
    - L- T! O& k+ I: S) T4 j
  58. #define TCCHEN_SHIFT                22
    - p+ \  d- q. o! _: V+ S# \
  59. #define ITCCHEN_SHIFT               232 Y8 }' Q, k- c! z! [# c4 P

  60. 1 H3 k( N, Z$ O% x! z' D3 d" r4 O
  61. static volatile int irqraised1 = 0;
    3 q; x* T$ J/ J5 ]2 |
  62. static volatile int irqraised2 = 0;
    # `6 ]& H, j0 ^0 f; ]
  63. # h2 n0 S: m& }5 N+ e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) E: i6 G$ I; Z; S5 X3 v" Y: N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 W) A/ t# y  }/ E0 y( p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) @; X- Z9 ~" F9 p6 f2 |* p
  67. / q- r. d8 J$ s
  68. dma_addr_t dmaphyssrc1 = 0;& R& ?* S  s) W/ n# a5 k- A
  69. dma_addr_t dmaphyssrc2 = 0;
    8 I. y" ?' E) Y$ G- _5 b) g
  70. dma_addr_t dmaphysdest1 = 0;2 C2 c3 z0 S$ x3 f' f/ h+ N
  71. dma_addr_t dmaphysdest2 = 0;
    7 e2 _6 x( Q( h0 {% V- l
  72. - _' Q% }# f. |# f6 y' k. Z4 t
  73. char *dmabufsrc1 = NULL;$ b+ E- ^' T+ K3 t4 m5 z# i8 x% n
  74. char *dmabufsrc2 = NULL;! ]5 B( ^8 @- ?, [8 I. v, n
  75. char *dmabufdest1 = NULL;
    4 `. Q6 n5 A4 m% U8 E
  76. char *dmabufdest2 = NULL;
    # F* M: \' `- c  q  x! o; `

  77. 4 G/ H! B* P/ @$ p+ y, m7 n, P
  78. static int acnt = 512;0 z3 K. m! B) S8 j
  79. static int bcnt = 8;
    6 ]9 s3 [( f  _6 r! W
  80. static int ccnt = 8;
    $ r% w1 \4 n% D. `( W
  81. - p  H& L! Q, I" ], u! o3 h
  82. module_param(acnt, int, S_IRUGO);! l, J& J' o. B- a" [
  83. module_param(bcnt, int, S_IRUGO);
    * `0 f/ l* S( v- ?, w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 N0 L- p; Y3 B' _

: s1 F9 h! l6 z/ Z' ~; b4 V+ u      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 {9 k: W* E! s  G0 l  ^  S! Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# G9 w  {7 _; _" H0 ]+ t     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* P" U% l) d" n0 a4 a
! u( K1 N, n9 Q; t0 z0 F

  d9 \0 L$ C- r  I5 g9 \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-15 14:07 , Processed in 0.037971 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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