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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : G/ ?, V5 }2 `$ p
  1. [code]EDMA sample test application5 Z" r, T5 m: }8 I: Z  \3 q8 l/ x
  2. /*
    ) p* O7 @$ b6 A% R
  3. * edma_test.c
    % `+ V' ~; y- B
  4. *3 F; v( d2 e/ `6 o
  5. * brief  EDMA3 Test Application9 G, C/ r( g) r8 F
  6. *
    0 Y( E/ @" O; I
  7. *   This file contains EDMA3 Test code.( R- Q# \; E7 @  [8 y6 @$ h
  8. *
    ; i) ~+ ^5 U+ j6 B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # Z* [* s  j' b& L  o( h* f* J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 G6 i3 g8 `5 w2 K1 H) z
  11. *         TO CHANGE.
    4 \' J, g! m0 A' T: W$ q
  12. *
    + V& d& a3 D& k) Q5 p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  Z( R+ O% J1 J8 J2 T! @, K
  14. *# L/ Z0 O9 x7 S/ i/ H
  15. * This program is free software; you can redistribute it and/or# D; v4 ]( A7 p& Q$ x* v
  16. * modify it under the terms of the GNU General Public License as
    # E6 U3 G" p- m
  17. * published by the Free Software Foundation version 2.
    ) F: b% B* x" s5 j5 t) E* j* ]
  18. *1 F9 n2 R* ~7 H2 r: Z2 k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 ?3 J& R' ^2 g+ j
  20. * kind, whether express or implied; without even the implied warranty
    ' N8 T7 A& x8 ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; [: A2 F5 X: {  ~( L
  22. * GNU General Public License for more details.
    5 l4 w, ]1 ?  r; b& M, V0 ~
  23. */6 c  K. c5 `$ \" ^+ s5 }

  24. ; z# w3 }) T  `+ v% x! J
  25. #include <linux/module.h>6 c) r; w# s1 ~$ [7 Q+ U' U
  26. #include <linux/init.h>
    " f$ E- Z" a9 l* ?
  27. #include <linux/errno.h>
    7 w0 V- e6 D1 f! S* |' X
  28. #include <linux/types.h>
    * Q" o' j6 r" D
  29. #include <linux/interrupt.h>
    . R) F' [& e, _3 G
  30. #include <asm/io.h>6 @  G9 l% r  }, a7 f
  31. #include <linux/moduleparam.h>
      G! I. B, q8 g: h' k9 |3 y! z* K
  32. #include <linux/sysctl.h>
    $ G9 y; W* r) L% k* |
  33. #include <linux/mm.h>+ [3 J# |* m! Q
  34. #include <linux/dma-mapping.h>7 q1 V+ E& B/ I. k5 Q

  35. 4 P: h, j; S" K; w
  36. #include <mach/memory.h>4 l3 U! e( r( }) D: U9 k3 m1 i; R
  37. #include <mach/hardware.h>8 S/ f( |: h7 p: [
  38. #include <mach/irqs.h>5 Y7 w- A8 y5 a8 E! \' ^; e
  39. #include <asm/hardware/edma.h>
    6 e" @1 A# ^% u& y* Z

  40. : m0 A2 t- l, z+ B+ W3 X+ n$ [
  41. #undef EDMA3_DEBUG
    4 S/ o/ O' q1 j% {0 Y) b
  42. /*#define EDMA3_DEBUG*/
    3 r" J" y6 Q+ O7 f9 I) V, y( U& M

  43. 3 R  }9 \4 |0 u
  44. #ifdef EDMA3_DEBUG
    - ^+ G) J4 U- f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* S6 |" ?( f/ E( e  v' E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % a$ ?3 x: y+ b( ?/ B: y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 n9 J: {+ ^8 m- A  ?' S3 ?6 N
  48. #else. H- _4 Q+ Y9 ]
  49. #define DMA_PRINTK( x... )8 E3 g1 w) _5 a
  50. #define DMA_FN_IN
    . e$ y6 f- y6 |
  51. #define DMA_FN_OUT
    1 o% q( `1 C0 j, s' M) a& s) c
  52. #endif! q' Y/ g) O" z) T9 e1 ^, g# O

  53. ' u! q) W5 N* w/ s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , \* ]( {: m0 V0 F: e
  55. #define STATIC_SHIFT                3& i: m; Q* r$ N' }4 ~- s0 L
  56. #define TCINTEN_SHIFT               20, d( j6 E9 ?* `7 P
  57. #define ITCINTEN_SHIFT              21/ a7 Q" l" A, u; G
  58. #define TCCHEN_SHIFT                22; \7 a+ O4 U  l4 {; m7 k
  59. #define ITCCHEN_SHIFT               23
    8 ~. K9 I! K2 k; f( T/ @$ v5 O
  60. 2 F8 v% P7 R2 |! j6 X. Q+ W. w
  61. static volatile int irqraised1 = 0;
    0 o0 ^" o6 ^" S6 u
  62. static volatile int irqraised2 = 0;
    ) v$ r% x* o4 S- k/ m$ {. N

  63. / u6 q' S* p* c$ b- y7 [: f9 A7 n6 e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: m4 D; P$ z) E0 C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# d. p7 p( }- T3 `; O+ ^9 `5 b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( q5 r3 Q. \0 l5 B/ B* s( R- q

  67. ) N9 d5 G% O& k3 d
  68. dma_addr_t dmaphyssrc1 = 0;
    + y, n. q8 y+ O7 {
  69. dma_addr_t dmaphyssrc2 = 0;1 A) C0 _) N" }+ [0 a% S9 a. D
  70. dma_addr_t dmaphysdest1 = 0;. S' w& y$ A8 F
  71. dma_addr_t dmaphysdest2 = 0;
    1 k( ]- I0 [* `# h" r# l# w
  72. ; i: N" t. k' T& J% o
  73. char *dmabufsrc1 = NULL;, B* Q! ]5 v+ P( Z/ _  P
  74. char *dmabufsrc2 = NULL;
    / T6 g4 U, m7 E# {0 ]3 o3 j5 ^/ Q
  75. char *dmabufdest1 = NULL;$ Z1 m3 Q  W# ^2 a+ _; {' S
  76. char *dmabufdest2 = NULL;) z! p( N! Z) H' b$ s
  77. " s1 e' f- }! o. ^" u
  78. static int acnt = 512;
    ' W- t  d3 S. M2 y. T. K0 B
  79. static int bcnt = 8;0 G0 B% q3 e; ^3 w1 ?8 R$ N' n
  80. static int ccnt = 8;" j3 N2 D( P. ?3 `. p, b
  81. " l7 M/ E+ }+ C+ c
  82. module_param(acnt, int, S_IRUGO);0 K1 t2 s, ]( Y9 q' L
  83. module_param(bcnt, int, S_IRUGO);. E2 D0 P+ u+ x* j. J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! N! Z) Y/ `. y4 r! ~

  `) Q& d$ h& j' n; M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& ~$ r; x# H% ?, H1 {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 Y2 V, o) ]: y( C$ t9 m4 T     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 s3 r  M2 P" O8 y) _' d+ Z2 i3 M# G( r3 n
/ }( P% a) T* h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 02:56 , Processed in 0.046533 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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