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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% G: i& }( m+ ~* z
  1. [code]EDMA sample test application) A! [" O' x8 ]: w( }' D: d! M! E% J
  2. /*% C2 }5 G, Y# ~) Z
  3. * edma_test.c
    7 k; n5 D: ]' W' B& r
  4. *  h0 B6 i9 X8 b8 U& Y% `7 P4 |" i2 n
  5. * brief  EDMA3 Test Application- T% Y) E% U8 w9 R3 I2 @! u
  6. *' y7 g) l8 S' l. T5 D
  7. *   This file contains EDMA3 Test code.: l3 ?: \4 ~; ?
  8. *' B# d) X- \1 F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ D: G) e4 g! @1 f4 I% n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 a& e2 a6 C7 M
  11. *         TO CHANGE.+ g- D$ U1 i) l: A% G
  12. *" S# d( f+ P# K( X" N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 [  A1 J, H( o8 E8 y
  14. *9 r, ^1 x/ s, w9 V% c' }7 w% T  H
  15. * This program is free software; you can redistribute it and/or
    ; T6 y% X  w7 y0 J
  16. * modify it under the terms of the GNU General Public License as8 @3 p1 E# b9 ]7 |
  17. * published by the Free Software Foundation version 2.
      c9 _# P3 }2 j6 e& _
  18. *
    . a( x5 I% A2 |. C! c7 f. J1 f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) O( Q, t: z7 p7 o* K& ~
  20. * kind, whether express or implied; without even the implied warranty
    ! n, j8 y  G# a- Z5 s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: o6 @, e% ~; E) p4 E" p
  22. * GNU General Public License for more details.! E# s' a' q7 c9 _: T) G" k9 n; |
  23. */, [7 W! l+ G# F  S, `) J9 v; ]
  24. ! k7 E4 X  @8 X1 ]+ w, h
  25. #include <linux/module.h>
    % X, |, W. ?% d! o. z6 v8 }/ L8 o+ |
  26. #include <linux/init.h>5 M* j" Y& i4 T* D/ C
  27. #include <linux/errno.h>
    $ ?& m3 |$ ?( J- X4 n! f& u
  28. #include <linux/types.h>( d- m, k. A! q( a
  29. #include <linux/interrupt.h>
    7 ]8 ^8 a+ `1 d, G) }3 l+ i
  30. #include <asm/io.h>) `3 s8 |/ s4 v: N! F
  31. #include <linux/moduleparam.h>
    1 u" v4 H, J! v$ ?
  32. #include <linux/sysctl.h>
    4 M& Z) B( [5 o/ H6 Q2 k
  33. #include <linux/mm.h>
    - Z# O$ {  h8 H4 S% U" ?- b
  34. #include <linux/dma-mapping.h>! u1 \8 e4 m" b0 C0 C8 V
  35. / z% A/ Y5 u' O# ~  o7 T1 P
  36. #include <mach/memory.h>
      O# J0 Q1 ]7 l* b
  37. #include <mach/hardware.h>$ S4 H+ w  y* j: ?+ C+ b4 G
  38. #include <mach/irqs.h>3 B4 }; b+ @2 T* E% ~" C& {# w
  39. #include <asm/hardware/edma.h>
    $ F9 n. P" H9 {  `7 K' s2 H

  40. 5 p7 O- B7 y, A$ q) L; W
  41. #undef EDMA3_DEBUG
    3 ?2 _% `7 A8 c: n
  42. /*#define EDMA3_DEBUG*/
    " B+ Y- I3 r+ g

  43. ! `. v" [* e: w, s! B/ G, k
  44. #ifdef EDMA3_DEBUG
    8 T% g% y% n7 L: j6 u" P( W$ d$ }* D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 E% o. h8 r* C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - r) A8 C* j0 h. Q2 ?8 d4 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  ]6 x! I& j) c. w  u( y# B: @
  48. #else
    * ]+ D1 H  a( I! M9 b* ?) u% z
  49. #define DMA_PRINTK( x... )% `( @2 c. p1 Y) d% g$ U6 u8 R
  50. #define DMA_FN_IN
    $ p- M; L0 `  j4 r. _
  51. #define DMA_FN_OUT2 v- Y, h; Y# ?9 g6 h* k  w3 r
  52. #endif+ E" `1 U/ N* J3 L8 \7 F, t6 ?
  53.   F0 ]; x2 f$ L* _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 j. ]+ S- z. }
  55. #define STATIC_SHIFT                3
    % i6 Y  v0 z5 v( m" L6 P5 w
  56. #define TCINTEN_SHIFT               20+ U4 @% c# i6 c" d8 ?
  57. #define ITCINTEN_SHIFT              21
    8 w7 O/ R- l: Q$ U1 E3 r
  58. #define TCCHEN_SHIFT                22
    $ {/ s" v4 ^; h4 h
  59. #define ITCCHEN_SHIFT               23
    # |) ~; A$ b  }- o& O

  60. 8 i, l" U* H" R" ~
  61. static volatile int irqraised1 = 0;; y& j# w) f7 V
  62. static volatile int irqraised2 = 0;1 ]3 ^' q* `1 T% K
  63.   e2 Y- T. v: n( f9 |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' L9 ~$ C8 i( P0 Q' D1 |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - e. Q% Q3 i* }! H5 f8 d/ X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 L& j9 J3 r; }: v* |) y
  67. * l+ d7 G# ^( r( A1 W  x! \
  68. dma_addr_t dmaphyssrc1 = 0;9 w! O1 ~  w" C# p" I. h
  69. dma_addr_t dmaphyssrc2 = 0;3 y, F, ~5 d7 t3 G+ a
  70. dma_addr_t dmaphysdest1 = 0;5 y" u2 ?) C3 u" e! |' y
  71. dma_addr_t dmaphysdest2 = 0;
    ! j( ?- w! \- @4 d' V

  72. / o* N  N4 P2 z9 d8 t
  73. char *dmabufsrc1 = NULL;2 U; U1 ]. c- B9 S' ]3 T; {
  74. char *dmabufsrc2 = NULL;
    - [6 t" g2 p, B" Q
  75. char *dmabufdest1 = NULL;
      q8 u5 B# @# `/ z7 q" c1 ]
  76. char *dmabufdest2 = NULL;
    ' h# p" J' t, W! a

  77. 9 K  b/ }8 I# I- ?
  78. static int acnt = 512;2 |3 v5 u* @: |6 w. W
  79. static int bcnt = 8;, ^2 r0 n( d2 Y2 u: ?
  80. static int ccnt = 8;
    3 T5 L8 t0 W: k& `# I

  81. ! c, D5 f8 e& {$ H' g5 Z1 J
  82. module_param(acnt, int, S_IRUGO);4 E9 U1 R% {& Q3 E, m5 {
  83. module_param(bcnt, int, S_IRUGO);
      _- k! Z: p- i9 p, J( D+ e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. o  s$ O3 w; y9 t+ `

( K  c5 m3 o1 @1 \" x  G& K) b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 a" E6 {, e/ O3 B: ?( d- farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& ~+ k& |  x' k$ N9 m6 g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- n; l0 F; A5 ~! c+ y

1 g0 y0 n) A. U4 s7 `
0 m# _, Q. {1 K8 V" F4 s% r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-12-5 03:23 , Processed in 0.049412 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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