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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* w9 w1 P2 `$ f. u5 Z( B
  1. [code]EDMA sample test application$ m5 \9 R. i/ d1 M2 S# I* f
  2. /*$ F9 \/ c1 z7 q7 V" v  b- r, k
  3. * edma_test.c4 V$ p+ k; J4 E9 z. G
  4. *
    / M2 }$ C0 f. m! g$ Z  u
  5. * brief  EDMA3 Test Application
    & U2 \# F, f+ z9 X  D" H, `
  6. *
    3 m5 e/ Z* Y. q; O' l
  7. *   This file contains EDMA3 Test code.
    , o, B. ^2 ^! ]) j
  8. *! W- I# j% W0 ~: I5 M6 B5 ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 S: L0 h6 A( Z% B5 H" V: W1 P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' I2 V- ]$ A, z, x# x7 m/ t
  11. *         TO CHANGE.2 c6 h8 ]8 |% }2 \
  12. *0 i% m0 T4 }1 C# I! T6 k; V; B! Q2 B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % v2 a% a8 P% L3 ~4 g
  14. *
    # o" h7 r6 x& J& M4 D4 _) C9 J% N
  15. * This program is free software; you can redistribute it and/or
    9 a' o' z# }; a) M" U5 u- B
  16. * modify it under the terms of the GNU General Public License as+ e0 w, M5 r  z7 K1 A6 B
  17. * published by the Free Software Foundation version 2.8 Q3 P  `& O3 g8 {( d1 U8 K$ l9 d
  18. *
    9 G1 |2 x7 f' @0 O+ S! }6 ?$ ^, T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % V% c: r  R) Y0 L' @
  20. * kind, whether express or implied; without even the implied warranty
    ) D9 i. Z  a1 Z2 a$ R9 W+ L. {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. _8 a* n1 d0 d% W: o
  22. * GNU General Public License for more details.6 T$ m6 V) c  y+ t2 B
  23. */
    ; F6 L$ h9 F+ N; T

  24. 7 A0 R; P$ N9 Q( j
  25. #include <linux/module.h>
    8 T7 ^9 \4 X, o8 I
  26. #include <linux/init.h>
    6 q6 z- Q6 ?& _4 g1 k9 T; k( O
  27. #include <linux/errno.h>8 K9 a. R+ j' `: V) ]; c! \/ y
  28. #include <linux/types.h>% {9 \- p& l7 m; [- j/ }9 b
  29. #include <linux/interrupt.h>
    $ e7 C# |% D' e! T, ]5 l5 `
  30. #include <asm/io.h>1 o- c- N/ ?9 m3 M0 h
  31. #include <linux/moduleparam.h>
    ! f7 ~) i( E1 a+ m/ h
  32. #include <linux/sysctl.h>2 ~' x5 u" J, Z8 d. Q9 B' @% w0 E
  33. #include <linux/mm.h>& H. J0 v' b+ G1 y- t% E! b
  34. #include <linux/dma-mapping.h>3 m  S# T' l2 w& {
  35. 2 q# U4 f3 U5 t6 g: _' L& }) f. J: q
  36. #include <mach/memory.h>
    4 F  S8 o: P3 g$ i9 B5 \
  37. #include <mach/hardware.h>5 V8 `5 q" R( e! Q
  38. #include <mach/irqs.h>/ ?$ _9 t1 M! R/ O- _6 ?
  39. #include <asm/hardware/edma.h>
    % O! A* @: q/ Y, H% v

  40. ! r' ^- h* O0 f% C& z
  41. #undef EDMA3_DEBUG9 c+ I0 s9 i" j) U) ^$ H5 W& I
  42. /*#define EDMA3_DEBUG*/
    / b- @, {* [* z% T/ w

  43. ( _2 Z0 R, `- N6 r/ g
  44. #ifdef EDMA3_DEBUG3 d  z. E" J& z8 L5 ]4 y0 e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : Q! [, o3 D+ p4 P7 }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 y+ f5 E5 _' C3 r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * P& j% m) _1 Y$ y2 L
  48. #else
    ) y6 x& I! e' i) o" N  O
  49. #define DMA_PRINTK( x... )) V4 ^7 A0 N: r; ^. T2 q' H
  50. #define DMA_FN_IN1 n4 C3 H: a- r; ~: Q5 F$ k1 M
  51. #define DMA_FN_OUT2 A5 O  n* b9 Y/ w* `4 \
  52. #endif% z7 R: T# y. r3 }! d
  53. ; l- t1 d1 K/ [' h6 M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): B5 {% B/ A7 n: Y5 ]) i
  55. #define STATIC_SHIFT                3; y1 O3 ?1 q! d0 E' M
  56. #define TCINTEN_SHIFT               20' F# p& Z$ B( K* `+ V9 H
  57. #define ITCINTEN_SHIFT              216 i6 p3 M' E: g7 g0 E
  58. #define TCCHEN_SHIFT                22
    " ?% n* ~5 T$ e
  59. #define ITCCHEN_SHIFT               23
    0 g+ _# K+ }8 V0 X* j

  60. % g4 U- L& K; O1 ^+ l
  61. static volatile int irqraised1 = 0;5 Q& |+ E8 C# _# W" \) x
  62. static volatile int irqraised2 = 0;6 r2 x0 M2 w. o# ]0 l. {
  63. % U7 |- B' A' A7 c* D/ H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 k0 s9 |: Z4 C+ c: j; p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' }5 E! S. i5 K4 y- S4 M# I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * J* j( W- R9 \/ E" Z& X
  67. ' N; s, V# @9 _+ K* b* N
  68. dma_addr_t dmaphyssrc1 = 0;0 q0 r! W, }) C3 M$ q- T5 ?
  69. dma_addr_t dmaphyssrc2 = 0;) S3 c1 {( U2 |& N$ l: C
  70. dma_addr_t dmaphysdest1 = 0;
    + ~# Z) j1 |$ v% F
  71. dma_addr_t dmaphysdest2 = 0;
    ' w) c! j/ W. Q6 z6 D0 r2 _

  72. ( y3 [7 A, j; r) q% o- S+ H
  73. char *dmabufsrc1 = NULL;) i7 I- Y. V* ^0 @9 q
  74. char *dmabufsrc2 = NULL;" ]+ W* Y( O) ^' }7 w6 x' t! a
  75. char *dmabufdest1 = NULL;
    6 R8 n4 l9 x. l" q
  76. char *dmabufdest2 = NULL;: c. _" h4 g  k

  77. * o4 n  A+ n: W% j/ ~& E% B& \
  78. static int acnt = 512;
      j3 |) D) h" i3 N  z6 V7 u
  79. static int bcnt = 8;
    9 n+ b8 I* i8 @" m1 ?
  80. static int ccnt = 8;
    & n# O) |  w, J3 q; r3 ?
  81. ' }7 ]$ m9 ~# L5 ^2 O! M
  82. module_param(acnt, int, S_IRUGO);
    ' Y8 M9 K; O1 |
  83. module_param(bcnt, int, S_IRUGO);
    ; s. K' C6 k! m5 T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 c3 m3 ^/ N$ h3 |/ n! R( z; O
/ ]  K( z% ]* ?9 V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 G. Z) ^% D& ]+ \* D$ W3 ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- o5 @7 R8 E8 z$ z4 v4 ?# c4 q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 t/ r5 h" q" v# K3 x' @" M" }1 n6 `7 h/ o  u- y: n3 N7 z6 S& p
+ j9 C8 p$ T1 t5 Z) P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-21 09:36 , Processed in 0.042255 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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