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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 b0 G" f& B3 G) |* S! Q! A6 t
  1. [code]EDMA sample test application/ \( F- j' N/ f6 |/ h
  2. /*
    " @: ]9 s' ^8 V: K! M" U. M  p! D
  3. * edma_test.c) t& H4 P; s  g" G
  4. *7 h7 k2 n( C3 A, A' i: C+ f" r! P
  5. * brief  EDMA3 Test Application  F: O! T6 `/ p7 C+ U
  6. *
    / R0 l6 E. F. M: A9 K" I9 O
  7. *   This file contains EDMA3 Test code.) M8 B  u* u: Q; Z4 D
  8. *" J3 T  _# u# J2 }  k+ P) b8 ]: b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* n* l; F8 n! e3 U- C# H) ^% R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) E4 e' v* G3 Q% E$ [6 @( y$ {
  11. *         TO CHANGE.$ k3 h. o0 h6 c- |  w! L) d
  12. *
    4 s% ]  q6 T2 C$ v3 w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 G6 q# D5 W3 k# I/ h, A6 V# d
  14. *
    9 p% m$ W2 H2 k) a) F. I
  15. * This program is free software; you can redistribute it and/or' o# q( K% O* e% d5 W& \
  16. * modify it under the terms of the GNU General Public License as
    ; \. P( g$ r+ ^
  17. * published by the Free Software Foundation version 2.
    , F8 ~2 F. O, S& l; G
  18. *
    ! A" n* F# R$ d0 D8 H$ O, I% w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! d& O( [! ^) l7 S/ d
  20. * kind, whether express or implied; without even the implied warranty
    2 q, `; G, U* P( X& }) C# M, s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 v0 X* w' c0 Z9 ]( D* |6 q
  22. * GNU General Public License for more details.
    / F) C# u6 h( z4 X
  23. */( B1 G8 C! U5 s
  24. - U" B& }: y& p/ E9 g5 |5 E
  25. #include <linux/module.h>
    + `4 t; {! x7 ]' N
  26. #include <linux/init.h>3 Y, Q% F: \5 y, `
  27. #include <linux/errno.h>
    3 L# X4 G: x4 t3 }$ n4 W, z  M9 l
  28. #include <linux/types.h>
    : N) Z! @6 p3 G* K* I4 s6 M: D
  29. #include <linux/interrupt.h>* w! U+ q5 E" q  e) w% H
  30. #include <asm/io.h>. f, q, Q) }: O, y2 ~5 z+ t! I# q
  31. #include <linux/moduleparam.h>, E: C  w6 [" t; p7 n- W
  32. #include <linux/sysctl.h>! n2 t& c' x+ E0 @1 T! b- @
  33. #include <linux/mm.h>
    ( J* M( h' U( }2 c0 ?- Z
  34. #include <linux/dma-mapping.h>
    . h/ K" p  }3 x' Q5 u3 g  E
  35.   H- G# O: B2 W
  36. #include <mach/memory.h>. ~* e- F7 z! x8 d
  37. #include <mach/hardware.h>3 e7 P: \' L% T. k! C, n
  38. #include <mach/irqs.h>
    % ]" L# y6 j7 `# U
  39. #include <asm/hardware/edma.h>
    " `; A- r  }9 Y8 _" W8 R
  40. # a! H, x" ?% `7 k6 }, M; r7 K( D3 F
  41. #undef EDMA3_DEBUG* \8 q" Q9 x8 X% M8 [* O7 \
  42. /*#define EDMA3_DEBUG*/1 L( T8 T6 A/ C: S1 ^

  43. * J6 X2 q# N" ?% n( P: a; g
  44. #ifdef EDMA3_DEBUG
    9 j9 X& s8 N* @  X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- g9 W( _! _( ?! t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) n4 B0 f' ]8 d. z0 t& ?( o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 [# [, P0 @/ D+ ^$ C7 `6 X
  48. #else/ q& r' w7 v: U1 D' C. C
  49. #define DMA_PRINTK( x... )  [. V8 ~, ]' |; H3 c
  50. #define DMA_FN_IN
    / L- n: Y8 I, d
  51. #define DMA_FN_OUT
    3 X. \6 d. z2 j7 ~: H
  52. #endif
    ! f6 A  ^' p/ ?$ _. M

  53. : a# A$ s( Z2 ?2 W9 s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 ?  P" \; z9 ~) p0 r: Q8 [. y: ]
  55. #define STATIC_SHIFT                3
    ! o, z" A) C% _$ n- t6 `; R- g
  56. #define TCINTEN_SHIFT               20' n8 N* i& Y& m$ q+ D
  57. #define ITCINTEN_SHIFT              21
    3 h+ F* n) C5 L" N! `. m
  58. #define TCCHEN_SHIFT                22" \8 o9 Q* P; H6 W3 [+ r! Q
  59. #define ITCCHEN_SHIFT               23
    7 p+ x* i% H5 ~
  60. * }" O8 l( ^, f/ C
  61. static volatile int irqraised1 = 0;1 C1 K& {9 C1 g2 K0 R7 U
  62. static volatile int irqraised2 = 0;# p$ ]. {( A* S( q5 m# I1 ^
  63. - ], A$ f3 L3 `+ h: C2 V/ f# }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" D: ]: H0 u3 W, i0 P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 _# e- ~" G7 J$ k* s2 v9 Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 I# G9 O. h  m6 z3 y, |- n

  67. - `% G, i& ]4 \0 H6 b
  68. dma_addr_t dmaphyssrc1 = 0;
    6 M/ F) J4 B; z
  69. dma_addr_t dmaphyssrc2 = 0;
    ' I) u  [4 Z: N. l
  70. dma_addr_t dmaphysdest1 = 0;
    1 j( y4 l; t9 ^" g2 {) ^! S
  71. dma_addr_t dmaphysdest2 = 0;; R. l( t6 y" ]1 o- w% w, L0 Y

  72. 5 ]' H; P( w) k: p6 B
  73. char *dmabufsrc1 = NULL;, ]. a3 R# b) I% `+ }
  74. char *dmabufsrc2 = NULL;
    % B4 G6 N7 q/ V9 k/ ~6 m+ b$ S6 n
  75. char *dmabufdest1 = NULL;- H4 L4 H9 a; o& D: q
  76. char *dmabufdest2 = NULL;
    # \0 T  [* |; ~8 V

  77. - k) V$ V- ^0 {- q, q: I
  78. static int acnt = 512;# a: d0 c6 |/ ~6 [# a* ^
  79. static int bcnt = 8;
      \! \; {  i4 g) O& k/ l' j- F9 ]
  80. static int ccnt = 8;
    2 O. L" K# s2 x" N

  81. 1 }/ F1 W7 N, p$ V$ A& R8 R
  82. module_param(acnt, int, S_IRUGO);8 K& z, a0 o1 t$ x4 L+ c9 H
  83. module_param(bcnt, int, S_IRUGO);
    ) c6 {& K& ~, u5 f: b- b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# Z5 E% @) A% i- K7 p
9 @8 {6 }) S) [! {1 R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# A2 K/ Y5 k% Q% ^0 L7 b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% t7 g, m5 T; {" E& G2 F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: U( D6 l$ J2 v5 _; ^: R2 K7 r

* a" D1 G  j- M4 J4 G  T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-18 21:13 , Processed in 0.040740 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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