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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + E& z" I. b1 V0 f$ L4 U& D
  1. [code]EDMA sample test application
    " p- d( ]2 F; L/ s' d
  2. /*
    % R( r( W$ K) @  U3 y
  3. * edma_test.c
    % B6 b9 Y  @1 H/ v, f* c
  4. *: d; v8 U/ ^: g1 I; a5 E; }
  5. * brief  EDMA3 Test Application8 R2 b4 L. @9 T( y  K! I1 t$ a, d3 K
  6. *5 t5 ]8 R  ?  d+ [# ~! q5 O2 A" Q2 b
  7. *   This file contains EDMA3 Test code.
    # R7 Z% E/ L9 ]4 _' z% `
  8. ** b( P+ v+ H9 H( w# L6 J' C4 j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / j& t0 l/ H: W. _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * U1 o$ b2 U9 M6 `
  11. *         TO CHANGE.
    ) S+ p% E  L( f( \5 r2 G0 z" v
  12. *+ k. U! N# J/ q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; ?" M- a4 j9 R2 t; u7 G6 e# _, Q
  14. *
    # s8 G' \) |& T# Y9 J" j: d  M  h
  15. * This program is free software; you can redistribute it and/or5 k+ _9 h1 g$ H' `  Z8 A0 M" V
  16. * modify it under the terms of the GNU General Public License as& \: `: l, \2 M( l- A. P
  17. * published by the Free Software Foundation version 2.
    9 o2 |3 c) }6 G$ f: E
  18. *; C0 B- C7 b: X# _' o; z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 l+ @/ p+ A! Q: k( |) z
  20. * kind, whether express or implied; without even the implied warranty
    4 b, E/ l  B* \6 ~' Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% f% w1 k% X7 S: o5 w8 V1 v
  22. * GNU General Public License for more details.) Q2 G( G  ~5 y  S
  23. */
    " C9 i; P/ D/ K6 p1 n$ q. a! g
  24. # b8 A3 V4 o* n" v# D  O
  25. #include <linux/module.h>. \% k+ p8 u" s0 S; H8 ~  V
  26. #include <linux/init.h>
    ) {6 u3 a' I% Z4 h( r. u7 q
  27. #include <linux/errno.h>. ^' X. S: d: H3 t! p/ L9 H
  28. #include <linux/types.h>
    # v; H8 K0 T% Y0 F
  29. #include <linux/interrupt.h>7 v0 n8 X: K( `2 J; T  G
  30. #include <asm/io.h>* s# |4 ^9 b; }, V
  31. #include <linux/moduleparam.h># v7 X. ~4 H0 M+ ?5 f
  32. #include <linux/sysctl.h>
    0 p% B" _5 G: u, I' @8 z
  33. #include <linux/mm.h>
    5 Q% Z  E- _1 q) f4 l. C) @( [
  34. #include <linux/dma-mapping.h>2 t( @" P# `% f3 m+ D) A1 G

  35. & `4 F  n+ U/ Z  E6 a( E
  36. #include <mach/memory.h>) u6 V9 S" v, u! h
  37. #include <mach/hardware.h>( T$ g2 p% i2 Z" }
  38. #include <mach/irqs.h>9 [# u! t7 w" J' c1 M+ F3 [  g5 q
  39. #include <asm/hardware/edma.h>+ J. Q: e% L; C4 |) J+ y
  40. 2 n& u! V% C: b( [6 B7 U
  41. #undef EDMA3_DEBUG2 ~+ z4 w; `* W* _
  42. /*#define EDMA3_DEBUG*/
    : y* F5 g1 t1 Q' g, Q

  43.   u1 J% t0 j) e" v9 @
  44. #ifdef EDMA3_DEBUG
    & e$ I. _1 p$ ]; `- ?- R9 P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' c7 k: y4 \/ B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 T! m4 z: i2 e# e. O2 x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - d7 X3 k9 F8 d( I1 |) W
  48. #else
    + Z8 R) z% _/ c, k3 f6 m6 @
  49. #define DMA_PRINTK( x... )
    9 y( C8 F$ r+ j3 x/ m
  50. #define DMA_FN_IN/ `6 P* t: m4 a: E' n/ I
  51. #define DMA_FN_OUT
    ( B5 K# x9 {& S' @, E3 b
  52. #endif8 s( `5 i! n7 W- k8 ]
  53.   w$ h' Y# Y# ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * B9 c8 Y/ E; p* `6 c3 m
  55. #define STATIC_SHIFT                3
    " @$ L# D6 i7 C' E0 k6 C
  56. #define TCINTEN_SHIFT               20* m, v% ], Q  }/ c5 R
  57. #define ITCINTEN_SHIFT              21% e' @$ W0 Q0 h7 U6 C
  58. #define TCCHEN_SHIFT                22
    & X/ h  h5 h, F; H
  59. #define ITCCHEN_SHIFT               23
    9 S+ }. c: \5 a( E- j6 B  D# ?

  60. . x8 Z: e9 W2 f( _$ s
  61. static volatile int irqraised1 = 0;$ W: q: t. ^( `" T
  62. static volatile int irqraised2 = 0;" K& Q6 `5 [$ }1 \. x  ]

  63. 2 ]1 r1 d2 T  {7 W  w" X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 z8 S5 r8 n2 L  y2 L$ p+ C: r0 D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 U$ _7 o) D0 E$ j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- }  y% m8 ^* ~+ O1 {! s

  67. 1 `0 G" ?* |% w: j$ [1 c
  68. dma_addr_t dmaphyssrc1 = 0;' p( h2 r* C* W- J3 o
  69. dma_addr_t dmaphyssrc2 = 0;* s! \; V- x8 }" E9 M) C; a
  70. dma_addr_t dmaphysdest1 = 0;  a* R0 q& g0 [+ L6 ?4 K3 F: U( l0 e+ G
  71. dma_addr_t dmaphysdest2 = 0;
    1 N% t) w, h5 m8 v2 E/ P
  72. + A' G0 R5 F1 e) v$ ]
  73. char *dmabufsrc1 = NULL;
    $ L) [/ R% F+ y3 A
  74. char *dmabufsrc2 = NULL;4 ~' q" Y& d- x4 S- K. k* i: l$ S
  75. char *dmabufdest1 = NULL;( I5 c9 u9 z: {  ^4 C0 r
  76. char *dmabufdest2 = NULL;
    8 F# F( W) b" |, j$ @5 a* M* l' |
  77. 9 F' U* l& H% |' m& x2 ~0 ?
  78. static int acnt = 512;; k3 F, Y; _- _9 Y/ x6 f
  79. static int bcnt = 8;
    4 n0 H3 a# X4 W
  80. static int ccnt = 8;
    & Y0 B8 w$ N7 N% |! y) ]" K

  81. * v& ]6 n+ _$ y( \2 J8 N
  82. module_param(acnt, int, S_IRUGO);+ F) K2 d! ^- n  e& ?2 g
  83. module_param(bcnt, int, S_IRUGO);
    4 k0 n5 \! }( c) R  I7 m/ g; c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 c; h1 q: {0 K) d, U( I$ d% i
2 w* g) v$ m) I  J, t/ q' k: Y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; G* G$ W1 k& }2 d) _' }4 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' \/ {2 q( S9 y4 j! D) v5 i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) u/ H7 o+ [' i
4 n7 d1 |  A$ L+ F3 G* e4 V. h& D( W2 \1 Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-5 02:45 , Processed in 0.041614 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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