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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( X* r! d# q6 i. N" {& Y# a
  1. [code]EDMA sample test application" b% U" d5 w6 W# T. P
  2. /*
    $ L2 R: @0 @0 y# h* h% _! b1 q
  3. * edma_test.c; \3 {# `* q% @9 o! V1 f. ^
  4. *) S+ X) K; F3 S4 r5 o$ j' H# t
  5. * brief  EDMA3 Test Application2 v9 S( c) \# f
  6. *7 M1 X) H' z7 W. U  V; M* N" ~
  7. *   This file contains EDMA3 Test code." Z8 M# e3 X5 J6 D8 g3 _
  8. *+ b( k* r* B/ l7 C) C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% w: h$ B  ~9 h3 }6 q( d! X# W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 g  I7 [3 p; \6 }: ^; W$ \- u5 L
  11. *         TO CHANGE.
    4 u* c" ?* Q% e6 H) Y& [+ s% o6 d
  12. *
    ! S4 [8 |2 e/ a+ O3 J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 J1 |% }4 k+ C* h' j5 g
  14. *
    % T4 w- J. p! E# A
  15. * This program is free software; you can redistribute it and/or
    * u/ h5 s1 Z: N
  16. * modify it under the terms of the GNU General Public License as
    8 Q6 Y: c! e6 B+ o4 V3 x
  17. * published by the Free Software Foundation version 2.# m' a- k& O) h) ~7 t
  18. *
    ! C* B3 Y7 O+ Z8 q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + G  C% s0 _* I! T' J
  20. * kind, whether express or implied; without even the implied warranty
    ) ^; M/ x' P7 m- x; |  Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 h. T: d/ }" ]8 X; v
  22. * GNU General Public License for more details.+ u2 r  ]+ W1 F
  23. */
      [( m+ w) t6 W/ U0 O" c" N  t( L
  24. # `4 B7 G# N0 I% o/ D- I  N, F
  25. #include <linux/module.h>
    & s: a6 F% j. i: t( s8 ~
  26. #include <linux/init.h>+ P2 r7 p, j. p! t2 v% P5 [+ L
  27. #include <linux/errno.h>
    " a( _" x! u; a
  28. #include <linux/types.h>
    4 w3 q( C% ?+ M5 V
  29. #include <linux/interrupt.h>
    4 r2 [% s) _, q. ?/ W9 X6 N
  30. #include <asm/io.h>+ U. t' f- N& u+ b; z5 ^8 L
  31. #include <linux/moduleparam.h>
    9 u2 i- F  \/ ^; ]- x# a
  32. #include <linux/sysctl.h>  W" P5 q* _7 F% }  e
  33. #include <linux/mm.h>
    $ n7 g# A1 x# ?  y( m3 d  c: _+ Y
  34. #include <linux/dma-mapping.h>% R8 X& ]6 R& U6 q$ c. h0 ~% t: j
  35. 3 \, Z4 w" E9 s3 K2 k. n; b4 Q
  36. #include <mach/memory.h>% L1 j$ p5 x) V( I  j! g. T. K+ U
  37. #include <mach/hardware.h>! z. @$ f/ o$ ?- V7 |/ N  @
  38. #include <mach/irqs.h>5 q* G% a8 O+ u9 A8 V3 E
  39. #include <asm/hardware/edma.h>
    . p8 t& \* p" b, U0 U5 H

  40. * a% r. y+ i0 X" `' [5 M$ _' M: E
  41. #undef EDMA3_DEBUG2 k2 @% t' v* K9 @4 Z
  42. /*#define EDMA3_DEBUG*/5 N* O2 Q; ~0 c# z2 i$ d! J4 Z. E

  43. / u' l/ G9 Q$ v4 s( p' I& ~
  44. #ifdef EDMA3_DEBUG  i1 C/ y* A* ]! A7 k: R  B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ v: ~2 n- o( ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . Y8 _1 f1 L+ F% E8 t# g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 M' {9 j5 e9 R
  48. #else
    3 l% ]1 a, Z! p/ ~
  49. #define DMA_PRINTK( x... )
    ; ~8 i! r- Q7 ]& A3 i- [
  50. #define DMA_FN_IN  U  l( }' }4 ^  m
  51. #define DMA_FN_OUT
    5 q9 B% H. Z3 y% X' O7 M6 _  Z5 O
  52. #endif
    0 ?$ v6 L2 Z( _% C% O8 Y

  53. 3 Z# e: z. S, p8 V) B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 U0 V$ Q, s# z* d$ A8 y
  55. #define STATIC_SHIFT                3
    ( `$ i0 n; o9 _/ e& p
  56. #define TCINTEN_SHIFT               20
    2 A; b/ t0 L5 \; o' x5 U
  57. #define ITCINTEN_SHIFT              21* ~4 L, T3 y) ?( h
  58. #define TCCHEN_SHIFT                22
    : Y4 `2 z5 |8 G$ U! p
  59. #define ITCCHEN_SHIFT               237 ]& O; K# K% z/ t- w' L

  60. # [3 t. R; @; {1 F* @
  61. static volatile int irqraised1 = 0;' K+ E5 G' a! ~* d4 E
  62. static volatile int irqraised2 = 0;
    4 q* O1 C0 i. j, _: x: Y9 u

  63. # a$ l$ h- L$ E% _9 f  K; }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 ~: T6 j7 M: n- a$ Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( F2 l  p% z2 ]7 i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 ?, @0 \8 U2 S! L
  67. : ~' J( u* i0 q% K
  68. dma_addr_t dmaphyssrc1 = 0;
    8 l1 [0 {, W/ j
  69. dma_addr_t dmaphyssrc2 = 0;3 A/ m! a* @0 @# L5 K6 E& `  `7 L! v6 f
  70. dma_addr_t dmaphysdest1 = 0;
    ' f& a" L$ |$ j- W
  71. dma_addr_t dmaphysdest2 = 0;
    + k6 e" p9 y1 p6 C$ @7 }

  72. & T# @, Q8 m4 q$ j
  73. char *dmabufsrc1 = NULL;1 ?' o. J) v% w; \. \
  74. char *dmabufsrc2 = NULL;8 u" @* V* [4 Y, [6 M6 {
  75. char *dmabufdest1 = NULL;/ w" V/ R# i2 `
  76. char *dmabufdest2 = NULL;
    / d9 s' Z  \4 b$ @) i  w! ^
  77. 8 y  k- ?& D0 T8 i4 {% Z, I9 i! l
  78. static int acnt = 512;
    8 K/ h& F% z7 u5 ]4 V7 Q6 Y
  79. static int bcnt = 8;
    3 h2 V8 h, R, j3 u. q
  80. static int ccnt = 8;
    2 U4 P5 g7 ~+ U! {

  81. ; P' [8 c6 \* Y# R4 Q0 ^/ S$ I& b
  82. module_param(acnt, int, S_IRUGO);; @2 f6 t! W3 b
  83. module_param(bcnt, int, S_IRUGO);) K3 T' d8 y! Q6 n2 E+ |
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' u( l: |+ P- G  F) m3 ^, q% c: W( O# a3 e( k0 s* V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& d# C  B8 z8 s) k6 K. c4 w; varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ c4 E$ k2 n7 y6 O" q& a. K0 _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 m2 X4 E: P0 s' K) J) H& k4 C$ `

) V7 s$ S  h) \6 z# H5 O7 L# W/ Z) p: f  l3 P* v0 ?$ C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 03:11 , Processed in 0.040346 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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