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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 c! t6 M, z0 y9 S" k) ?2 g( j5 i% [
  1. [code]EDMA sample test application( e: I9 z2 i3 D( B
  2. /*
    2 Z6 G7 r3 R+ T5 k  R
  3. * edma_test.c
    + W, |8 q( \, X3 t8 R, x
  4. *
    1 j* g! s* k, a  e) N) _/ L/ i
  5. * brief  EDMA3 Test Application
    7 C; U/ g; s2 }
  6. *
    . ?6 f$ [1 t. i5 S9 _4 B4 t
  7. *   This file contains EDMA3 Test code.
    * l. _: T8 S0 S: J: n2 A2 J  b  r
  8. *0 }& X  b% s0 K( ?# D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ ^+ D4 e" ?. g2 H/ x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 R' ]  ]7 h0 H! I" x
  11. *         TO CHANGE.
    " f$ m, N8 M5 j0 u
  12. *
    ( w4 ^. w" d  M+ j! f) w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + G0 n6 ]  z( u' _0 U
  14. *- R2 _/ q/ L3 e' i- o( r
  15. * This program is free software; you can redistribute it and/or
    4 e; C2 t4 s# `7 m. I* |# a
  16. * modify it under the terms of the GNU General Public License as
    % i9 y. y& f& C6 a2 B
  17. * published by the Free Software Foundation version 2.
    : ~0 h/ f' ^3 D: w( m0 g" O
  18. *
    . \  L/ j1 r# Y- _' {2 X" @6 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 U6 l1 S1 v# _% r& m
  20. * kind, whether express or implied; without even the implied warranty
    , z; ?! t3 A1 S/ A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* b- P& V8 J# w
  22. * GNU General Public License for more details.
    / i4 P3 _. U5 t7 @9 H2 w% N( |! ~# _6 h
  23. */
    1 J6 B! G5 t9 a- N, \4 P

  24. 1 C5 z. c1 E+ l: K' y
  25. #include <linux/module.h>
    7 m+ W/ }" m& u5 g4 N
  26. #include <linux/init.h>
    ! f* r3 g; z6 E
  27. #include <linux/errno.h>
    % j/ v* P" F2 {  T/ ~
  28. #include <linux/types.h>8 _% d4 i- u3 L( G2 B  @4 }
  29. #include <linux/interrupt.h>
    # ]7 {2 O% K4 k! P% X+ j* K+ E
  30. #include <asm/io.h>  J/ L6 o( J9 T  n+ G
  31. #include <linux/moduleparam.h>( y$ B2 w1 e0 g6 _' e. A/ c- C: ~
  32. #include <linux/sysctl.h>. ~  v, A4 r1 Y1 y/ Q3 E
  33. #include <linux/mm.h>% E, X' u( X, S. H( [
  34. #include <linux/dma-mapping.h>1 k  T* M# Y" @* ]( k( @

  35. " t/ T( N- Y8 m7 H7 L. q
  36. #include <mach/memory.h>
    * ]' M* ^  I% N/ j3 f4 Q, h0 ^
  37. #include <mach/hardware.h>/ n; c8 Z, ]  `) E6 ]2 |2 t
  38. #include <mach/irqs.h>
    8 `# i0 ~7 V7 j, C' S  K
  39. #include <asm/hardware/edma.h>. q+ P/ D+ R! t% E$ M

  40. 6 C+ i$ j& X) k
  41. #undef EDMA3_DEBUG) X# q! H5 O8 H. G6 I
  42. /*#define EDMA3_DEBUG*/: V- L; y) G6 D8 K% Y$ W/ e7 o! t$ ~

  43. ! p6 E/ r0 |" D! I, `9 h6 X( S" l& R
  44. #ifdef EDMA3_DEBUG
    ) y6 _6 i6 `: B) \1 u; `! }$ u  U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 o* q/ }+ f! D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( m* k) ^4 ^, T5 P: A) l4 t& P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * @1 w2 |% `9 b2 Y6 P
  48. #else9 i# b/ \$ G5 R/ g2 L
  49. #define DMA_PRINTK( x... )2 Z8 g. p% N9 C, K( ^! k& b
  50. #define DMA_FN_IN
    6 K1 t4 E1 z' V( Z
  51. #define DMA_FN_OUT
    / T; b" ?4 O" u) ^: K  u/ [2 m1 Y
  52. #endif+ h0 v  g* q2 a0 k
  53. ) }- ~* }% X3 s  r0 q" g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . @- j0 C( |$ }% U
  55. #define STATIC_SHIFT                3. I! D+ V; x! S( j( U# m5 \
  56. #define TCINTEN_SHIFT               20
      F: {2 z1 \0 ]0 P( S# s$ w
  57. #define ITCINTEN_SHIFT              21: `/ X! r9 `/ `
  58. #define TCCHEN_SHIFT                22
      Y4 r; z. p5 J3 {
  59. #define ITCCHEN_SHIFT               23; L/ O! \5 ~* v+ b* r0 [# I

  60. - L4 |" w  @4 i( K# o
  61. static volatile int irqraised1 = 0;
    4 s( x, A& x1 j; T
  62. static volatile int irqraised2 = 0;
    $ W6 t9 L1 T" J0 e
  63. 7 R  D! }' n- b; n0 k1 }2 R1 H5 c5 Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' S, q, |" Q. D7 R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 l" x9 g' Y8 ~, Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      [& |2 y3 C8 y4 X+ f
  67. ! T2 U( C7 @; y) N7 G8 h
  68. dma_addr_t dmaphyssrc1 = 0;
    $ j. P: f2 Q0 M6 J
  69. dma_addr_t dmaphyssrc2 = 0;
    7 P9 m/ p8 h: V, r! J/ `* o
  70. dma_addr_t dmaphysdest1 = 0;
    $ M  [/ G7 ?! q. @2 g+ q# y
  71. dma_addr_t dmaphysdest2 = 0;8 `0 X5 ]6 I) @! u! O0 W$ Y
  72. ) S, ^% n3 P6 D# z% m
  73. char *dmabufsrc1 = NULL;
    . f9 M- m% F) a1 O& s5 `; x
  74. char *dmabufsrc2 = NULL;  b/ r2 Y# `# K& m: p5 \
  75. char *dmabufdest1 = NULL;3 G+ r* r4 G2 n  e) n
  76. char *dmabufdest2 = NULL;5 a2 _) Y; C  d
  77. # o: }4 M& L6 a( ~! X
  78. static int acnt = 512;
    * P7 }, \2 o8 u. _+ [8 \" \8 q
  79. static int bcnt = 8;
    3 Z; E+ U' K+ P
  80. static int ccnt = 8;3 B$ ^& X2 P  y1 ^* F: l# b, p
  81. ) h0 f6 h$ D7 B# L5 w- D$ t( U
  82. module_param(acnt, int, S_IRUGO);& _/ c; Y& g3 R- [5 a: L9 W/ U6 J
  83. module_param(bcnt, int, S_IRUGO);. J, O( \8 c; d8 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ @: `4 B+ J. o1 l' w* O- e, U. D8 I, Z3 s: a' j1 L7 s) O+ h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 y% H7 q% [7 W+ @4 k
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ V- y# a2 I% p9 g+ J% x7 ?- u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- G- q7 B$ b$ L, t) C
* j' ~0 a( v) \% l$ T9 j9 k3 t, g' ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 01:27 , Processed in 0.039645 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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