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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , i+ R' x" z; ^% k1 W% }. O
  1. [code]EDMA sample test application
      S9 e0 n2 a* q6 i: B
  2. /*/ a& u/ G( S9 Q5 _8 p" X2 p, [2 P
  3. * edma_test.c
    1 {3 }7 \2 @6 k$ C1 @. X
  4. *
    : d4 D/ p' [3 r# O$ i! d
  5. * brief  EDMA3 Test Application. i5 D3 ?7 x& O& x
  6. *
    , C* [$ l: n; ?- K. W# k$ w5 ^
  7. *   This file contains EDMA3 Test code.: k9 Q  l9 {- ~0 H0 t* N1 q
  8. *  q: L  }" T6 D7 j9 e2 h" B; w" q* p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 n9 P# S3 C; {8 ]  Q. V  r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " ?: J* Q! ~6 e8 C
  11. *         TO CHANGE.
    5 h! R) O2 f2 w
  12. *" n& q/ k2 _5 O+ C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! R( f- k# a$ q0 y9 Y# ~
  14. *
    , ]% j$ ^9 k" Q6 _3 J
  15. * This program is free software; you can redistribute it and/or
    * s3 B9 U9 X1 M: T2 c6 h3 Y' g
  16. * modify it under the terms of the GNU General Public License as% v# A6 m: ^9 m  \0 z
  17. * published by the Free Software Foundation version 2.
    ' ^3 q0 t7 Q0 @* b/ K$ }) o* [! i& _: C
  18. *
    3 {7 O4 N3 h/ z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - f2 v0 L5 i( Z; s1 b/ v
  20. * kind, whether express or implied; without even the implied warranty% Y, E# d* T2 T8 V; ^, c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' y* l8 Q# ]6 j* C% f+ W5 C  S
  22. * GNU General Public License for more details.' l  K' J6 O$ D+ B
  23. */
    # G# v2 G3 U3 e& |
  24. 3 J/ M" N/ ]% M2 h
  25. #include <linux/module.h>5 s/ o2 b$ `5 ]
  26. #include <linux/init.h>8 m  ~' G2 }6 M* |. t1 @5 R7 F
  27. #include <linux/errno.h>1 |0 t4 i6 u& w0 W' U5 z
  28. #include <linux/types.h>
    - C% ], [+ Z( L8 r" Z
  29. #include <linux/interrupt.h>0 a" n- g  ?5 M) W& b0 p0 |
  30. #include <asm/io.h>
    ; S& D6 u3 Y& R8 \* S
  31. #include <linux/moduleparam.h>
    ! u" `4 Z4 @  t7 j1 @0 l
  32. #include <linux/sysctl.h>
    : M; g3 J# e( |: r4 ?
  33. #include <linux/mm.h># J/ N5 x, y5 o3 V/ c8 V) l+ @
  34. #include <linux/dma-mapping.h>/ L: _+ m# \3 q- h

  35. 3 ~; d. t6 q  ?: H* e" S9 q: F
  36. #include <mach/memory.h>
    - ~- I  f# t. d8 \" U
  37. #include <mach/hardware.h>
    : r2 ]7 p) u9 t2 ~( Z  U9 J/ \7 h
  38. #include <mach/irqs.h>
    . k  e( e8 O7 f) ]7 p  r6 e( f
  39. #include <asm/hardware/edma.h>1 l8 M2 n4 U4 X$ |( T

  40. ' E, i6 V. G9 B. c
  41. #undef EDMA3_DEBUG1 Q- m4 D  `( a7 \3 ~# [
  42. /*#define EDMA3_DEBUG*/
    ) H" y+ w* a8 ?2 C
  43. . |9 P, V5 V9 B8 m
  44. #ifdef EDMA3_DEBUG
    / U  S3 z5 A$ c) r; s) E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 O- |2 W1 ?7 W  l( o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" x) p  i8 ?& {( D2 [" p4 U; J. f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 @* j( K7 e2 T" ^7 S% }
  48. #else
    + _* @$ F! p$ E4 B6 B! F+ {
  49. #define DMA_PRINTK( x... )4 G0 V0 k4 G1 u9 `& V
  50. #define DMA_FN_IN
    - D8 ~1 E0 k7 e) _: s. V
  51. #define DMA_FN_OUT
    " h' X' x+ Q8 P/ w6 ?2 b- U# S" t- x
  52. #endif, _/ h+ h9 q/ d& }6 I; {
  53. * O/ j& v4 x9 L3 O/ b7 T# ?+ W. O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  Y+ H0 D+ W9 z8 K
  55. #define STATIC_SHIFT                3% m- \( z8 P% Q( g
  56. #define TCINTEN_SHIFT               20
    ) s& A& i3 {" i4 H
  57. #define ITCINTEN_SHIFT              21
    6 I6 \7 T8 U- e  K. L  n) F8 b5 @
  58. #define TCCHEN_SHIFT                222 m0 H* q2 ~3 c( g) ?, o
  59. #define ITCCHEN_SHIFT               23/ e5 n) ~; p* L' z
  60. / x# K- |8 d! Z# O# D1 o
  61. static volatile int irqraised1 = 0;! K1 G9 ~: n; w
  62. static volatile int irqraised2 = 0;2 j  ~9 }2 u- g) M9 r
  63. 6 e& x& D5 Z* @( @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: c8 M! @- E1 v1 f5 K. Z; |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; {0 t( U+ o- ^# S, _- ]& |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ y% ]6 ~7 f" Y2 M& _6 T
  67. 4 y2 d( J: B( R
  68. dma_addr_t dmaphyssrc1 = 0;
    1 e4 X3 w& I3 V. l8 ]
  69. dma_addr_t dmaphyssrc2 = 0;
    % K. J: U+ F1 {0 n- P: H! c- t& E
  70. dma_addr_t dmaphysdest1 = 0;
    . A# w/ q, O0 f) w6 t
  71. dma_addr_t dmaphysdest2 = 0;
    ; X% w& b: x/ }' V5 b% T+ u

  72. 7 R1 m: }, B% g% |$ |: C3 S2 k: P
  73. char *dmabufsrc1 = NULL;1 D3 X1 E  _8 k& B5 ^
  74. char *dmabufsrc2 = NULL;
    " [# L- v/ @, Z: F
  75. char *dmabufdest1 = NULL;
    6 o1 W7 w7 r  R9 P. z0 m" G
  76. char *dmabufdest2 = NULL;( G' @; ]5 d5 {$ A8 ]: F
  77. 6 i, p0 k3 E3 `# F' t4 A1 o+ d- k6 v
  78. static int acnt = 512;3 s! y7 B7 @) J4 J! B8 _7 ?8 A
  79. static int bcnt = 8;1 M6 ~" l1 l) D
  80. static int ccnt = 8;" c1 t" I* w& J3 Y. p* ~8 ^

  81. , _* G+ ^0 {) Q
  82. module_param(acnt, int, S_IRUGO);
    ' z' \' Q$ M' w5 V5 V
  83. module_param(bcnt, int, S_IRUGO);
    $ q5 y5 m# o' b# g' p
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ T: c; W6 g; Z5 g( ]) P! Y7 ^# H  O
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' t% o" b$ ~  T/ y6 ^% ]; G, marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 |8 s1 g- V1 C" P3 A: Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ }& I. C6 X  T1 l1 s* F

! b/ g; _5 J4 d5 ?5 x2 V5 |; l
9 k( o# O: l& Z6 H" p, t5 B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-27 22:45 , Processed in 0.042700 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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