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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- g% a. f% R8 V2 ^5 S" w7 c' e
  1. [code]EDMA sample test application
    9 A+ p7 n4 t1 ]. ]& e/ V
  2. /*/ H8 [. Y$ Q: [7 I' p& q
  3. * edma_test.c3 R2 l+ x" q* e( A2 _/ o4 r" Y. @
  4. *
    9 l" q" R. b6 b! ?1 o0 Z
  5. * brief  EDMA3 Test Application1 }  h3 y( [6 ^( H
  6. *
    8 c; e+ l* r8 P3 J- Y9 b
  7. *   This file contains EDMA3 Test code.0 z& R1 K5 d) f) j9 E' S" x
  8. *4 w2 w+ W! G4 S2 F+ n) L% H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 C9 ^# ]) J' S3 g$ a/ f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - C2 H1 W9 \) I7 h! T
  11. *         TO CHANGE.8 {' U( a) o0 G+ u! j
  12. *
    8 u* W" ~  C9 f# y; D. x) x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 }+ m2 z# v; v6 y  t7 G# _$ K
  14. *6 S6 O: x! A! \) u; C1 W  `
  15. * This program is free software; you can redistribute it and/or( H; q2 J: |0 p% c
  16. * modify it under the terms of the GNU General Public License as
    " j' S/ ~1 v" L6 F9 g, a
  17. * published by the Free Software Foundation version 2.3 R1 S6 r3 _2 I* V" o0 M8 x2 n
  18. *  Q  D% ~6 N+ ?3 D2 p( g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 K; c6 E- a- u! M! y: y7 C6 z
  20. * kind, whether express or implied; without even the implied warranty7 B; N. h# ?7 i; t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 r) S* O- K+ E' P3 a
  22. * GNU General Public License for more details." c; [- _& d" }% N0 a8 {$ H. M
  23. */
    6 ^) o% {! o1 T/ D: r" i7 |
  24. . [3 s! }/ [0 x% j& [3 c2 k
  25. #include <linux/module.h>
    8 {" c% [9 z5 {  B: K
  26. #include <linux/init.h>+ T" g' d4 s0 X; W' L
  27. #include <linux/errno.h>! z+ Z! S' ?& L& Y! g
  28. #include <linux/types.h>$ e4 o/ _" C3 W/ _3 ]$ b
  29. #include <linux/interrupt.h>2 \# G2 N5 R, |1 C; N, H
  30. #include <asm/io.h>
    ! f% r+ @7 ^7 l# `  y( C) Q
  31. #include <linux/moduleparam.h>! ~7 K1 f& Z7 n9 S
  32. #include <linux/sysctl.h>$ r- t- {4 H) p8 D. `
  33. #include <linux/mm.h>% o7 i9 ^- f: b- o: [
  34. #include <linux/dma-mapping.h>
    , h6 ^- [. h( c

  35. + H' o8 r% u: k) C6 B
  36. #include <mach/memory.h>. d8 V. Q  n3 @& O
  37. #include <mach/hardware.h>, v- L7 E% B7 h* m5 i
  38. #include <mach/irqs.h>0 k2 F; w7 j; A: B$ n+ i' X
  39. #include <asm/hardware/edma.h>
    9 A& q  _6 z: B# A1 ^' K

  40. ! s7 j) ]7 Q! f3 w
  41. #undef EDMA3_DEBUG' C, Y& K& G* b9 w2 P
  42. /*#define EDMA3_DEBUG*/
    3 B* x9 N7 I: c8 j9 J) n: B/ C* v9 I

  43. : ]4 D- P6 @+ a- r, ?( ?& b4 W
  44. #ifdef EDMA3_DEBUG( C% z5 x3 J  z$ U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 f; n  ]+ H+ B+ M1 Q5 _) x  _& k' P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ l  d; P2 a; u0 e, Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) n% A/ D* ~! f3 p) t( ?
  48. #else
    ) Z  C. Z- T  _9 r1 D
  49. #define DMA_PRINTK( x... )
      i5 }, M8 v3 q
  50. #define DMA_FN_IN
    7 I6 W0 F6 u+ N) [5 c8 M. m9 E
  51. #define DMA_FN_OUT: ^& \0 T9 Z) }3 C/ C! ]
  52. #endif% t2 \9 U3 Z8 Q: s! R2 ~

  53. 7 |# ^' @/ y  B8 U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' P8 J$ z8 k% ^. {* G  b; N
  55. #define STATIC_SHIFT                3( n1 ]* v0 o: J* w9 ^- n
  56. #define TCINTEN_SHIFT               20/ X; g2 O. r& Y6 e8 h" @" ^: Y
  57. #define ITCINTEN_SHIFT              21
    + a2 x. a) z6 T8 ]6 N% W
  58. #define TCCHEN_SHIFT                22) o) X" {3 U: k$ f# o& z' X4 G
  59. #define ITCCHEN_SHIFT               23$ N) h" ^+ ?. Z$ A  g
  60.   p# o' ^5 n# _- l1 t% u0 n
  61. static volatile int irqraised1 = 0;
    # M6 U5 w; x9 ^
  62. static volatile int irqraised2 = 0;
    . a7 z% F: y7 ?5 y
  63. & b8 h, I5 U, h) q* H) O/ W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' j, D) r* a9 u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % x6 o4 A. a8 S6 j- \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" x# Y# M$ \' C% E
  67. ( f! p1 ~- b6 k! |' l7 i: b; Q
  68. dma_addr_t dmaphyssrc1 = 0;
    8 d! h  ^) M) K, z' l8 k( `4 t
  69. dma_addr_t dmaphyssrc2 = 0;
    9 O& h3 I" [& E* V2 }8 g; ?* b
  70. dma_addr_t dmaphysdest1 = 0;
    ! H. A/ l5 z: F0 U5 |; n% R" o* ]
  71. dma_addr_t dmaphysdest2 = 0;- e& j2 }# t/ n+ s' t4 p

  72. & Y, m+ d# a$ s) j+ z& A
  73. char *dmabufsrc1 = NULL;: M% Z6 M0 q' k' z7 g1 U+ t; B
  74. char *dmabufsrc2 = NULL;
    7 E0 B/ I8 O( {9 E
  75. char *dmabufdest1 = NULL;: x) A! N4 o. m$ @' u
  76. char *dmabufdest2 = NULL;' n: }& `1 {4 M, ^- i, G' g

  77. 9 A2 u# D- _& G$ T; }9 K( R( f
  78. static int acnt = 512;0 R, Y; [3 O# z4 z; H' `+ m
  79. static int bcnt = 8;8 l+ ^4 p; C( p) k- P
  80. static int ccnt = 8;* u% i: }8 {( k; p/ W9 D* h% E4 T$ C! k

  81.   Y  p8 q! r9 k0 c
  82. module_param(acnt, int, S_IRUGO);
    ! j; x( Q6 [" G  @
  83. module_param(bcnt, int, S_IRUGO);( z( O( s, e- ~1 L: M( }% Q5 i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 y+ o4 {2 ~7 S! @
! y7 ]% u/ L6 }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& z% ^) d4 A/ J3 `6 }8 w6 {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' l, }5 D/ O7 A) {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. B4 D2 Z% M: e4 p5 W/ k: ^

9 _' J  S8 _* R2 u$ y: Z7 a' h/ Q
3 D; I3 ?, x) k8 o& v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-30 23:33 , Processed in 0.042801 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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