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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 L/ {' L: b+ y: F; F! n+ O) J
  1. [code]EDMA sample test application- x0 f1 q2 E+ [" h: \( m% F" R  S
  2. /*! B% a* @+ ]" j9 v! X
  3. * edma_test.c
    3 k& v' l2 Y. s/ r8 d. {0 z
  4. *( O& S1 h% ^) R
  5. * brief  EDMA3 Test Application6 h# t0 Z) A$ T$ K7 W
  6. *
    $ o0 r7 _8 t* G5 u5 w
  7. *   This file contains EDMA3 Test code.
    3 }+ c1 [5 C1 ~
  8. *& }! d" e) @8 [8 Q1 U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 p, y+ c1 F$ a1 `! T9 F; O0 z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; J: r, [5 f: p( S
  11. *         TO CHANGE.
    & r8 }3 o$ r6 v, T( j+ Y) X
  12. *
    2 @8 i# u6 l& f" w) k. d( G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" G1 w4 g$ t! u( O9 e: C2 l
  14. ** E9 D/ S, e  E# h
  15. * This program is free software; you can redistribute it and/or6 Q, w' ^2 z! S/ C* R
  16. * modify it under the terms of the GNU General Public License as
    - ~  k/ G- x, I2 j+ G
  17. * published by the Free Software Foundation version 2.$ ]; @9 }3 S% q9 C5 c- e
  18. *
    : L7 I) u) B  A+ h, f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 b! _3 L# g" X: B) A8 d
  20. * kind, whether express or implied; without even the implied warranty, ^: K5 f- C* @: J* y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! o! \% `/ r3 r# q5 U" e) |
  22. * GNU General Public License for more details.
    ; s# h- g' b( e1 Y, s" ]
  23. */( z* |2 z8 b  T' [. A, n0 S

  24. 1 ]1 U8 y: V0 N" Q3 t
  25. #include <linux/module.h>& u' ]6 v9 B( y  B
  26. #include <linux/init.h>0 k7 a- K5 t6 x9 x" d- g" c
  27. #include <linux/errno.h>
    4 E0 C/ \. c8 K6 q# _. G
  28. #include <linux/types.h>4 @* T; @) Q4 |7 A1 g& a) Q+ o+ X
  29. #include <linux/interrupt.h>
      k6 ~* Z6 D/ ]" N1 c7 A1 d4 m3 z# U9 m; }
  30. #include <asm/io.h>
    % L( A/ v+ D4 O
  31. #include <linux/moduleparam.h>8 z4 J6 o  P: U* [" J8 S- Y# h
  32. #include <linux/sysctl.h>8 x# A, K1 U$ _7 P% `; D' p
  33. #include <linux/mm.h>$ k$ e: ~* f( b7 t5 G, G7 C3 u
  34. #include <linux/dma-mapping.h>
    , `/ b/ p5 p* M% m

  35. 6 J; P1 q1 y/ F3 }
  36. #include <mach/memory.h>
    : b# H* b+ ?  m% {5 S
  37. #include <mach/hardware.h>
    2 a; |% U0 e6 S: Q; Y* @
  38. #include <mach/irqs.h>
    ( S' q. q/ p! `: j
  39. #include <asm/hardware/edma.h>
    6 V  Y" Q& O6 M& P+ i. N

  40. " Q) n$ u6 I, t# P4 @1 ~7 A
  41. #undef EDMA3_DEBUG
    $ ^/ B, I! B( U' Z+ [
  42. /*#define EDMA3_DEBUG*/
    " u% r+ K' z& N& w/ w

  43. % q3 {1 B. n* @
  44. #ifdef EDMA3_DEBUG
    6 J- ?7 `# P# f( N2 l. X3 \  |2 c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & ]- h  Q( n) g$ Q0 q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% @7 v( m/ W4 q0 ?/ H( b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ D5 c2 E3 Q- b$ m" t+ u% |: x
  48. #else+ y! a( h9 B- l, ?3 f8 T' X; W" f1 f
  49. #define DMA_PRINTK( x... )
    # J7 x' q$ `' u; X- X7 f
  50. #define DMA_FN_IN# q8 I. r3 J& Y! M( K2 @
  51. #define DMA_FN_OUT
    5 {! {9 \0 ?0 d" c# d
  52. #endif3 A: Z7 U8 h4 E3 E" A
  53. ; o) I" Z' f* B  b1 z9 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ u6 I% z0 c9 Y* H& U- s! I
  55. #define STATIC_SHIFT                3# E9 p6 A+ h0 v% @  Y
  56. #define TCINTEN_SHIFT               205 j1 k7 }- r) R  d' e( ^# X5 U
  57. #define ITCINTEN_SHIFT              21  c- }4 V2 Q/ ^; J! q
  58. #define TCCHEN_SHIFT                22
    $ Y9 ?3 u1 I3 C0 q8 p
  59. #define ITCCHEN_SHIFT               23
    4 N: Z8 K) ^- v

  60. : O# h1 r. L6 I" m5 f2 ?5 h
  61. static volatile int irqraised1 = 0;/ R. @2 ?( D5 M& |! L- W$ s8 U5 I
  62. static volatile int irqraised2 = 0;
    * I7 O5 q0 v' m

  63. % v% _  b( M& Y, Q9 [' F7 g4 B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 j+ [5 u4 {% ]/ b3 J* Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ h1 f0 s" g, p0 H# z$ J. V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * [% x% E; Q8 }, S
  67. 4 }/ Q6 n! Y: z8 {
  68. dma_addr_t dmaphyssrc1 = 0;+ s' Z! Y, a6 @8 i
  69. dma_addr_t dmaphyssrc2 = 0;5 d9 {3 ^" Y2 v; }: o1 l8 h1 T1 z
  70. dma_addr_t dmaphysdest1 = 0;
    ! m5 l, }7 K  m( b
  71. dma_addr_t dmaphysdest2 = 0;
    * h5 c" Z, Y9 U0 O8 r. h
  72. 6 Y" f3 a( n2 J- O* |
  73. char *dmabufsrc1 = NULL;
    ! a3 B( c/ }' Q; a
  74. char *dmabufsrc2 = NULL;
    ; A  @. l* l. l7 o% S- K
  75. char *dmabufdest1 = NULL;2 ?: f; U9 h$ a7 ~+ ^4 @+ d0 y
  76. char *dmabufdest2 = NULL;
    * P) k6 ~0 H: ~2 C2 Z
  77. * R0 Y" d. C" a2 \4 E
  78. static int acnt = 512;6 \' j& W' ?0 M. ]
  79. static int bcnt = 8;. a! k+ n6 w5 i6 I1 l: T
  80. static int ccnt = 8;
    * I2 V& p4 }% K9 a% @/ M

  81. . L- ~- T; x8 x9 P3 E2 ]7 A1 l( `
  82. module_param(acnt, int, S_IRUGO);6 n# F* ]9 R, j7 }4 j6 s/ G
  83. module_param(bcnt, int, S_IRUGO);% Z4 i5 O/ R: k1 H
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% y' W' e) Q9 O, l3 ?

4 s4 I& A  e% E. B1 {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 A8 u' m- u5 l+ t2 Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* W) ~* i+ ]  \: f
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; }8 R# |3 u. }

- E) H( e4 G+ q4 W; ?  p& ?4 w. G6 H, _; M6 g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 15:22 , Processed in 0.045338 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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