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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 _: l4 o! C1 D( x
  1. [code]EDMA sample test application
    6 s- D( N' b( c: ]4 Q. ~+ K3 L
  2. /*
    $ c: N; {) V* e6 _& W7 B4 U/ K: e
  3. * edma_test.c1 l4 ~: a5 b! A% H
  4. *$ Y; M% p! `2 o7 M
  5. * brief  EDMA3 Test Application
    9 M6 C  O) |; t4 b$ n
  6. *
    7 J) y- t! C7 {3 J; F
  7. *   This file contains EDMA3 Test code." }9 \* p0 H8 b
  8. */ h0 v" D2 Q. r. L6 d: A/ t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 {: z0 E; j8 Z8 c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; @8 F5 P4 f5 l& v, Y) n6 w
  11. *         TO CHANGE.& L  ~1 z* x- S' ]
  12. *' H/ n0 j4 ~" l1 w/ ]& j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' |" Z( Z8 f3 T5 l1 R
  14. *
    3 _; F7 H) b8 |4 `
  15. * This program is free software; you can redistribute it and/or+ G7 j+ j6 }3 x5 v
  16. * modify it under the terms of the GNU General Public License as  x2 u  G) g9 e2 o+ P, J
  17. * published by the Free Software Foundation version 2.
    9 ^, e7 u. o3 n, j# {+ K
  18. *
    1 F+ c0 O0 e- O: |" n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + ~8 a4 L2 N3 c: D8 o9 z6 Y: \$ o
  20. * kind, whether express or implied; without even the implied warranty, J. m7 D  o; Q/ R( m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- V3 n9 r* D8 c4 q( d0 p
  22. * GNU General Public License for more details.  E7 c: [* q# ~0 G& t5 ~
  23. */
      N" ~2 U0 B; z5 d* |4 Y4 u! s

  24. + T* S+ L- O4 r8 I8 e  ]
  25. #include <linux/module.h>
    ! j& S9 ?7 K0 n' O) b1 [7 ]0 m2 w; r
  26. #include <linux/init.h>4 u' N7 s; Z+ R" e1 _9 L/ Y
  27. #include <linux/errno.h>: ~6 p9 o  U* i7 t
  28. #include <linux/types.h>, c( I  _$ |0 L/ p
  29. #include <linux/interrupt.h>* Q' C8 b' s- |* t/ e: i, n! J& d
  30. #include <asm/io.h>$ j' G* ]) y5 `. I3 `
  31. #include <linux/moduleparam.h>
    * B0 t  v3 M1 y% R, H
  32. #include <linux/sysctl.h>
    . `' }- u- L6 a+ m1 V( Z' b: o
  33. #include <linux/mm.h>- K' U9 R8 F: `6 q% p
  34. #include <linux/dma-mapping.h>
    # i0 \4 M7 M5 i* v" R

  35. $ n7 C1 A' d0 J9 M! z
  36. #include <mach/memory.h>2 X2 Z8 }0 ~4 ?5 i5 X1 q. V# Q* {  h
  37. #include <mach/hardware.h>( y$ n+ a- l5 S" ]! g6 `
  38. #include <mach/irqs.h>7 a& ?, Z- f( L# z* `5 j8 h" C$ T
  39. #include <asm/hardware/edma.h>, s7 p& v! B) W! V

  40. ; h+ Z( t, I* a; O9 Z0 K  p  H
  41. #undef EDMA3_DEBUG8 s1 L$ X! e; w) x/ Z5 E) i9 M2 j
  42. /*#define EDMA3_DEBUG*/
      u2 E* Y9 Z! T
  43. ( c0 X2 E1 J6 r# X. c/ R) R; e
  44. #ifdef EDMA3_DEBUG4 `4 S4 W' e4 z4 `1 l% H  g; X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ F/ [0 S0 S; i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 S5 O) k- S* V  o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 M/ x0 r! ^! h5 {4 O- p& t' p3 _
  48. #else
    ' H% T9 W: z9 L0 J  {
  49. #define DMA_PRINTK( x... )
    ' C7 E6 a- p# E8 m) Y5 H
  50. #define DMA_FN_IN) o5 G+ ]5 }* J/ Q% R" c
  51. #define DMA_FN_OUT
    . G0 L7 @% g2 f+ r, {5 J  b
  52. #endif
    4 ]8 w8 s; y/ d- f, j1 p

  53. 5 h* o- K! P8 g; H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ j3 w3 Y8 \6 t
  55. #define STATIC_SHIFT                37 N5 |& G  @0 o" f: R; S
  56. #define TCINTEN_SHIFT               20) k$ m. a& o: n% T% J; O
  57. #define ITCINTEN_SHIFT              21
    4 ]! `  B  v# [
  58. #define TCCHEN_SHIFT                22
    5 @3 u. W) O2 V0 _+ }
  59. #define ITCCHEN_SHIFT               23
    4 j, @9 D5 @7 n9 E" M0 J( ]- V

  60. $ L2 U/ `2 _) e& Z
  61. static volatile int irqraised1 = 0;6 R9 O" u: u$ ?1 D. Y
  62. static volatile int irqraised2 = 0;
    2 f& B6 f( s' ?( l3 H

  63. & W' F; a8 G' E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! z3 R6 G. S/ E  O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 G& r" u, Y& E; |2 `* z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& B, a9 u9 J, ?  |

  67. 8 k4 B4 |3 Z3 ?9 x0 v1 I9 o# Z
  68. dma_addr_t dmaphyssrc1 = 0;
    7 g9 K' e, y4 V! C# }
  69. dma_addr_t dmaphyssrc2 = 0;5 x* i; B! M& U
  70. dma_addr_t dmaphysdest1 = 0;
    $ N/ {; j6 s' D  H. ~0 {
  71. dma_addr_t dmaphysdest2 = 0;
    1 i* [7 |5 I$ s" N4 e5 T& E

  72. 6 `6 D% U5 `6 f$ e5 Y
  73. char *dmabufsrc1 = NULL;$ C' ]2 w2 o4 u" t/ \6 s6 p2 a
  74. char *dmabufsrc2 = NULL;
    ' \6 v4 r4 R5 O% a  S7 S( i7 p( F! @
  75. char *dmabufdest1 = NULL;! A0 V' }4 x' N: v$ K
  76. char *dmabufdest2 = NULL;% P  D1 m# A* K3 q$ ^4 C$ m9 ^( N
  77. % k/ |8 C4 r/ ^* u! w/ H  d4 Z
  78. static int acnt = 512;* ]9 P& J0 t  C  C- ^( B$ X: L
  79. static int bcnt = 8;0 m7 d3 n' f7 z2 w9 V4 \! g7 d" e5 _
  80. static int ccnt = 8;
    - v& B4 `6 E0 k& ]3 q9 I

  81. $ h; G' a; ^# A
  82. module_param(acnt, int, S_IRUGO);2 y2 E  b' a1 W5 m6 v
  83. module_param(bcnt, int, S_IRUGO);
    4 ~2 ]. o( b- j7 r
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: p. O% L/ v' j, [( g/ h8 f

8 Z4 [9 Y' D6 z# `- }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* K2 ]/ X; s$ ]( \( r- Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) m, t$ }4 F, s4 Q6 |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* }$ Y9 v' ^' [4 t1 ]7 j4 n. o' P& g( d$ |3 ?
5 T1 s! Y3 x- m' {$ S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 05:06 , Processed in 0.039387 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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