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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  V8 B% D, V- t" `0 ]
  1. [code]EDMA sample test application
    : s& N2 _" g9 j4 E* s6 h
  2. /*
    4 l! \0 E" f  |2 F, N
  3. * edma_test.c& _6 V) T) T9 Y% S: ?  c. F; ?
  4. *! K3 r7 p4 p0 t( o0 u& e
  5. * brief  EDMA3 Test Application
    9 k0 P+ w! g1 O  A7 u6 E8 i/ [
  6. *
    ( \3 ~% F( @# |) ?
  7. *   This file contains EDMA3 Test code., R9 Z( I# T  A& ?1 z
  8. *
    ' K, m1 |7 G" B4 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 i) u" y! H0 `+ |; n! a% I9 I, V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 w+ _- Q. y5 ^! V$ u; o8 d: g
  11. *         TO CHANGE.* p2 P! j7 j0 K8 b3 R
  12. */ w9 O# E2 `; q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 e! j4 ?" K$ |/ T
  14. *$ }8 T- q5 X# w: V
  15. * This program is free software; you can redistribute it and/or
    8 q& @: `/ i5 y! a1 r5 d
  16. * modify it under the terms of the GNU General Public License as
    0 o3 r; [+ Z, j4 Y
  17. * published by the Free Software Foundation version 2.& X. n3 h; L! F# B5 f$ L! E$ {
  18. *: _% S2 V9 i& D" Q: o7 X  G3 d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 ?1 b+ ]- K: \" u
  20. * kind, whether express or implied; without even the implied warranty
      p) v6 B8 \8 V# S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 `  ^3 n1 e: z9 r( V
  22. * GNU General Public License for more details.
    . e: [. }0 v, @* P: w
  23. */: ~4 P+ {6 r/ l5 n3 T" x' [1 ^

  24. + H  |4 a( F; J; i0 W- k
  25. #include <linux/module.h># I) s7 F! c1 F2 x$ B9 x
  26. #include <linux/init.h>. S; V5 A1 ?* H. t' g& V
  27. #include <linux/errno.h>
    . `6 K! g2 N- d1 w
  28. #include <linux/types.h>+ n, u: r$ H9 j: P: H
  29. #include <linux/interrupt.h>- b5 l/ d2 L  j  f
  30. #include <asm/io.h>$ ]8 E5 l& q) ~1 A1 c% L
  31. #include <linux/moduleparam.h>+ H- q, M$ z; m% z6 t
  32. #include <linux/sysctl.h>
    # ^& b. V4 |! @, Q5 t
  33. #include <linux/mm.h>
    : e  x3 r7 a, U7 ?6 d% w
  34. #include <linux/dma-mapping.h>7 P  r# Y1 r. G# b

  35.   e( d  j! g% U" p9 Q0 y8 @3 g
  36. #include <mach/memory.h>2 h9 [% Q# {& R9 {
  37. #include <mach/hardware.h>( ?3 |/ J9 n! `+ \$ I
  38. #include <mach/irqs.h>; l( u( r+ S/ G$ X6 i) h% f. L7 r  X
  39. #include <asm/hardware/edma.h>) D( d, D3 u% L2 q3 M3 Y1 T

  40. 7 A* }; N( a9 K& E3 W7 y: ~
  41. #undef EDMA3_DEBUG
    $ s% M+ z# V6 I
  42. /*#define EDMA3_DEBUG*/
    / u  K( z6 }( K8 A$ ]
  43. 3 r, |1 M# A' l) Y6 K
  44. #ifdef EDMA3_DEBUG2 f2 t1 V1 Z/ Q+ h# S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 }: m+ u; _  C* ~( S. ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 T; r+ M* _; x9 ]$ v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ C. P; B/ o/ L+ m4 |: {- I; U( B
  48. #else
    # q4 z7 P: A% J( a% N
  49. #define DMA_PRINTK( x... )+ P+ l0 G" Z# ]0 k( `: v; [$ j: \9 S
  50. #define DMA_FN_IN& u( x5 o7 \+ Q5 @$ e! z8 F$ _- Z
  51. #define DMA_FN_OUT
      t: z- @+ Z7 ~0 {/ G7 R" b' |9 q
  52. #endif
    # z6 k& V; V$ m0 y0 U

  53. ) {) ?% o* A" ~( s) T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 M2 \2 i* ^% ?! l- k
  55. #define STATIC_SHIFT                30 f  c0 G9 q; r3 `: E* F( G9 J; N
  56. #define TCINTEN_SHIFT               202 u% |" \  V! c2 R0 O2 c4 k% W
  57. #define ITCINTEN_SHIFT              21" u6 p; h! ]. e- v" |: p) _$ Y
  58. #define TCCHEN_SHIFT                22
    : @0 H. C: Y' S5 J, ~
  59. #define ITCCHEN_SHIFT               23
    * Z" o  d. j/ W  n; E$ K& {$ C

  60. - z+ B2 @& P. `4 I% f0 {
  61. static volatile int irqraised1 = 0;9 \2 J/ I1 t( w  x4 x5 q& y5 E
  62. static volatile int irqraised2 = 0;
    + ~- G1 S( j! D- m2 I3 T
  63. % U. A- @: a3 l8 [; ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ [1 ~  d3 i; ]4 R/ G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 k+ f5 S8 N! v, H1 V! `+ s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " y. O( k  M9 X

  67. 1 U2 c" w9 s8 C" ]  ^1 D* l. o- U
  68. dma_addr_t dmaphyssrc1 = 0;
    - y) n; @( V- j  d3 c0 w5 t
  69. dma_addr_t dmaphyssrc2 = 0;- Y8 o7 V; H0 Q% _
  70. dma_addr_t dmaphysdest1 = 0;: x" a2 f8 J8 I: W6 X
  71. dma_addr_t dmaphysdest2 = 0;; [6 u3 J7 I9 F) ]( y( A/ K1 L

  72. ( v+ Q3 B$ W5 A0 Y
  73. char *dmabufsrc1 = NULL;( p! D. n% h* ]# T/ z
  74. char *dmabufsrc2 = NULL;7 G/ S* H5 k6 k9 V: q( o0 Y4 \+ O
  75. char *dmabufdest1 = NULL;
    # N  T- l9 \; B; r% \: z' b
  76. char *dmabufdest2 = NULL;/ C5 u. r! X8 z4 |% b3 r7 J: b

  77. 3 @. S8 E: h  t2 I, b6 P* P
  78. static int acnt = 512;
    % c0 Q4 J. S- @  `3 A& y
  79. static int bcnt = 8;
    3 j( K) Z' o* o) d% t( `8 k
  80. static int ccnt = 8;
    : e5 _' e. z; q5 y
  81. $ B/ U5 Q% I5 b4 p+ d- p$ O
  82. module_param(acnt, int, S_IRUGO);
    3 B% p; U9 B7 O" z) S
  83. module_param(bcnt, int, S_IRUGO);$ I; q' U, E$ X3 Z8 [' c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 l( V; b+ k8 |7 P0 X  b3 e
. p# k* a+ f0 c  v: V) z; O3 v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 Z; A  w& K3 e) L, U5 V- W  ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 Y# s. T/ u9 k. A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ D5 @6 O6 n+ l" [

- ^; I* U" P% r0 B& H2 v& n6 y
9 y2 u6 \  T3 G( }; \0 V0 G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-15 12:42 , Processed in 0.039914 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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