OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 A6 X% m9 [$ C) G, ^% h0 }
  1. [code]EDMA sample test application+ H+ z1 q6 R' B/ B. @, s- M& f
  2. /*/ e  h, z. \4 i7 c, n! w: y7 Y
  3. * edma_test.c$ w4 k5 C, I, P
  4. ** H- [1 H6 A; z, a) e+ w
  5. * brief  EDMA3 Test Application- z8 l* V2 e2 k% ~5 u& w  @& p
  6. *4 w$ C$ ^$ h3 K1 k. v) ^) a! A, p
  7. *   This file contains EDMA3 Test code.; X) L. v; [; t) K/ i  U: C; a3 E
  8. *
    ( s+ Y# X  ~& G6 g2 B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 N; D6 p4 ^) Q8 s* T3 r5 b. Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; s/ N: @! U3 X% P& O) d$ @
  11. *         TO CHANGE.
      r# p4 E/ v- x" Q# p& w
  12. *
    * w4 F# Z) T9 m' w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 }- H* R& d' P0 V2 {
  14. *
    3 M, }. J: Z2 Z
  15. * This program is free software; you can redistribute it and/or) o5 s  _5 O: y. y4 T
  16. * modify it under the terms of the GNU General Public License as
    6 f! [6 W. ]* G$ V' W7 j
  17. * published by the Free Software Foundation version 2.
    - w0 r+ R8 [4 y7 I) s
  18. *' \8 s% {4 ]* v2 f6 i% V2 [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ x6 J) W; E: h8 P% E
  20. * kind, whether express or implied; without even the implied warranty) e" L" D1 q7 r7 a% h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . ^* t7 V% X- q0 m/ I, m4 ?
  22. * GNU General Public License for more details.7 ?1 {/ [  i% @2 `4 r" q
  23. */. R! T* O( q/ F

  24. ) }4 ?7 A7 e; j& w! U, b8 Y  v
  25. #include <linux/module.h>
    ( e9 L/ r$ p/ M
  26. #include <linux/init.h>7 t, w% S6 k" |4 L* w5 Z/ Y3 J
  27. #include <linux/errno.h>
    & ~  q* K0 f: R" G4 \6 |
  28. #include <linux/types.h>
    - F9 o1 }5 T& P- a$ a+ A0 ~! t
  29. #include <linux/interrupt.h>0 {( {! M. O# B8 r, K
  30. #include <asm/io.h>6 p5 ]( c/ j1 b9 J" G
  31. #include <linux/moduleparam.h>- G0 }  o. D7 X+ M6 T- t
  32. #include <linux/sysctl.h>
    " J3 A, W% A- I; q  X
  33. #include <linux/mm.h>
    5 h0 _; l( y! d& Y- N
  34. #include <linux/dma-mapping.h>
    ' I* k( f) n. i5 Z( I

  35. 9 p. N3 L7 w1 h; V
  36. #include <mach/memory.h>
    * o. x' t* w4 v8 P9 R4 j3 y2 R1 I
  37. #include <mach/hardware.h>
    * u/ x7 ~' B$ \' _3 T
  38. #include <mach/irqs.h>1 m5 |* M; ^8 G' O: S! F$ x. j1 n
  39. #include <asm/hardware/edma.h>
    : B5 O6 B% G8 R/ a! f2 J! v% G

  40. . A; ]7 U; s# b5 X" h& ?9 b; [
  41. #undef EDMA3_DEBUG) E* Y/ A" {9 f) D/ O5 j, x
  42. /*#define EDMA3_DEBUG*/# G. U4 V% W5 ^  c) R. l8 {" K

  43. 6 U* [+ j0 |# v9 Q
  44. #ifdef EDMA3_DEBUG
    $ v$ R! `* r' a4 W/ l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 R: m4 m# ^) \' U) e: _0 v" R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . O' `$ Q. q' ^# _% M# l8 C$ f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - ~( q6 V+ m5 |4 J5 r  I# \
  48. #else( ^4 V4 z7 h$ D* ]/ C$ h: Q
  49. #define DMA_PRINTK( x... )# Z; `4 j+ Q# o6 Z5 O3 f
  50. #define DMA_FN_IN
    & M) f8 M' V3 N2 Q6 w
  51. #define DMA_FN_OUT1 q0 o2 j) b9 K! v) u
  52. #endif
    4 h1 G; l9 p" m

  53. 9 L7 J2 I" a( ?7 ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 V/ A% ~" L( R, z! l; Z( }/ _+ R
  55. #define STATIC_SHIFT                3' b8 x8 U8 R3 i, _! \4 }
  56. #define TCINTEN_SHIFT               20) h4 G: m* G& D' Y# B0 f
  57. #define ITCINTEN_SHIFT              21
    0 H3 n8 {) t% ~* p3 V
  58. #define TCCHEN_SHIFT                22  L) F; z6 N: c( _* m1 J5 D
  59. #define ITCCHEN_SHIFT               23
    4 v% t1 g" `. H

  60. ; S" V+ F) F  \, X9 d7 m
  61. static volatile int irqraised1 = 0;$ Y1 O& h: A: r6 c: e, w
  62. static volatile int irqraised2 = 0;
    * x, v1 B4 g# d  F
  63.   J* {8 K9 E! ]7 V+ _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 y: p: c7 V( `0 S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 C4 e# L: g5 O- f8 m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Q* G) p( F1 S3 L9 p7 F2 v+ n

  67. / ^' y) q0 e5 ]- B
  68. dma_addr_t dmaphyssrc1 = 0;
    * ^* D+ G  e) O, w4 f! C
  69. dma_addr_t dmaphyssrc2 = 0;
    5 @) ]: ~; Q5 V& s
  70. dma_addr_t dmaphysdest1 = 0;; @- N1 o4 o$ _; r# N4 h; J
  71. dma_addr_t dmaphysdest2 = 0;$ P9 D( w8 ]4 d7 m3 X  Q9 m9 g1 X

  72. & n' d# n# w, y+ @3 {% I3 b
  73. char *dmabufsrc1 = NULL;
    $ b; M" \. Y: G; W
  74. char *dmabufsrc2 = NULL;5 @  J, s4 F5 R8 b0 i
  75. char *dmabufdest1 = NULL;" [# l" \# s7 D! p) |
  76. char *dmabufdest2 = NULL;
    3 e# ]& {/ I  K) {9 N0 ]
  77. # W' i4 q% W! N6 {+ s- X
  78. static int acnt = 512;
    + P9 ^/ G9 m6 L2 V& J9 B% ^
  79. static int bcnt = 8;9 U  K; M4 s) @! ^3 N- _. u6 ?
  80. static int ccnt = 8;
    0 i9 \+ X. {1 Q+ y
  81. " Q* a9 \4 V, m2 i- k+ K- p, R
  82. module_param(acnt, int, S_IRUGO);
      A9 d8 H4 H) p7 i
  83. module_param(bcnt, int, S_IRUGO);* Z. z5 d4 W* d) p& Y3 `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 o1 P4 w4 ~% A
; q& V# X* ]0 }! L5 m2 B( K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 @; F$ H# j) J* zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: p2 e" R" y5 z# ?7 e* u. H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ |& o4 F7 Z  _6 o  {& B$ L+ i! U

" `' m/ S3 S# P- L3 X7 L0 c9 O* a' M% `' m& Q2 Z5 W- Y6 r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-2 17:23 , Processed in 0.038650 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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