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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 u7 s5 q4 t& w. [7 j2 T& s
  1. [code]EDMA sample test application
    . f( m; `! d2 X
  2. /*
    , d' W$ z8 l3 [  X: H* [  }
  3. * edma_test.c
    / ^  F2 x- L+ ?4 L9 ^
  4. *
    % p, ]" z" Q1 i$ c) ]$ u! d# r$ ~
  5. * brief  EDMA3 Test Application
    9 [3 B6 D9 b( |; p
  6. *, |7 q+ T  P) N. b8 ?
  7. *   This file contains EDMA3 Test code.7 c1 J# |+ z4 p, H. u! l
  8. *
    9 R( @8 g, s% a8 V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ M' m7 u6 k. K1 g& C- }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; I6 _# S) G) p; t6 ]
  11. *         TO CHANGE.
    . y: A: `: R0 F0 T/ k: J- M9 ~& E
  12. *: ?* o9 b1 j* e- P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " P2 W$ M5 m+ T/ M( t4 X5 E
  14. *. e; W! K; V# b6 x1 L
  15. * This program is free software; you can redistribute it and/or, j! p: M8 i% r5 g: M9 p' _
  16. * modify it under the terms of the GNU General Public License as
    : I3 q" ^' T& e; l5 T" E4 q7 U8 V
  17. * published by the Free Software Foundation version 2.
    ' M* g$ a! v; c/ X5 y
  18. */ l, r# A) B" i; U7 Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : N5 |" m) p0 h3 w, ^
  20. * kind, whether express or implied; without even the implied warranty1 g. O7 }" Y$ n( {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 z3 X7 L, X1 C% |; p. Z
  22. * GNU General Public License for more details.
    * O# v2 d% O; v, a: k
  23. */, e* U! L3 z- U
  24. & O) U# m' J# z4 J6 b7 a
  25. #include <linux/module.h>: `+ \' r+ P( M1 o$ T
  26. #include <linux/init.h>
    8 H4 }& B8 d3 g
  27. #include <linux/errno.h>$ f7 z0 X8 ]" Q
  28. #include <linux/types.h>0 A( R; F- T! K% ?
  29. #include <linux/interrupt.h>
    + C. x% O) T( }0 ]/ T$ r0 z
  30. #include <asm/io.h>
    ( B/ B$ B7 q- \. V1 |$ n. G
  31. #include <linux/moduleparam.h>4 w9 h" D, G+ B$ V1 L8 J# _/ Y: l
  32. #include <linux/sysctl.h>
    5 i8 m8 V6 y- O2 X2 l& P6 d
  33. #include <linux/mm.h>
    & q/ Q/ ?- o# J9 V: S; x5 ~
  34. #include <linux/dma-mapping.h>
    ! w0 f, E4 ?. Z. E0 q* R

  35. ( E2 |6 I7 X, @6 `, s2 p
  36. #include <mach/memory.h>$ Q" R- d$ H1 S# x
  37. #include <mach/hardware.h>
    % D2 f( t+ ~9 s
  38. #include <mach/irqs.h>
    * R, c+ J4 Z. P3 O, Q7 `' D+ x
  39. #include <asm/hardware/edma.h>
    % y- o% V) ?; ?: x
  40. 4 h4 H6 s  ^1 S& p+ G* W- g
  41. #undef EDMA3_DEBUG# f* S+ S2 t7 k, z" I+ N
  42. /*#define EDMA3_DEBUG*/
    ; S' ]* E- G2 t! W; A* \
  43. - R( a/ ?2 f4 J0 g' C; A
  44. #ifdef EDMA3_DEBUG
    0 @' s- z, T% ~2 l/ Y1 X! X! M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 f1 `! D+ r, F7 F9 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( l9 k& ^9 N; a, _2 H( K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 L, ?0 C) B; |4 ^3 B
  48. #else5 D+ ~/ r. ]* K
  49. #define DMA_PRINTK( x... ), Z) Y; A- m" y( d/ c8 U/ L7 |
  50. #define DMA_FN_IN
    . t2 u/ P9 q0 U9 E! |- ]+ K
  51. #define DMA_FN_OUT9 _1 m( W4 Q& _+ t% a9 u6 k
  52. #endif7 d: [+ z% q) b# D/ \! F: G
  53. 8 k4 p: r, G$ n; o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): d, x) a' G% y) m  k
  55. #define STATIC_SHIFT                3
    4 X% D2 @# B+ d- \- b
  56. #define TCINTEN_SHIFT               20: y' g5 R6 D8 J2 _/ C
  57. #define ITCINTEN_SHIFT              21& [6 H8 l) ^/ h6 ~6 w
  58. #define TCCHEN_SHIFT                22
    ( N5 g. Z( ~% b! n& C! _& n) y
  59. #define ITCCHEN_SHIFT               23
    # S1 r7 P" a( b) s; b
  60. ) U% D7 A; ^- p: Z- p# }
  61. static volatile int irqraised1 = 0;
    # [; x8 `% u+ ?
  62. static volatile int irqraised2 = 0;, K1 W5 K7 y# c) F; J7 v

  63. 8 r4 S  ~5 Z. O5 W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 [3 f9 l/ p: ~- d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: O! J7 F. X8 Q! w  ^2 P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 V7 {/ A1 W; G2 x, [6 O; x

  67. ! V) ^; w% k; d0 b( E, Z. j- u
  68. dma_addr_t dmaphyssrc1 = 0;
    , i3 i. {/ X5 D  v
  69. dma_addr_t dmaphyssrc2 = 0;, T9 h0 f/ I1 \8 H% Y- l  @! \
  70. dma_addr_t dmaphysdest1 = 0;( h) ~' A. g4 E0 L% X! b* `
  71. dma_addr_t dmaphysdest2 = 0;, W$ T/ }  ^& D' M& z
  72. ' j6 a1 C0 O0 ^5 o/ B8 X: F6 Z# Q
  73. char *dmabufsrc1 = NULL;
    ) d: K& n2 \# B7 p7 D- C1 ]% P
  74. char *dmabufsrc2 = NULL;
    7 h( c, y; V) q( r
  75. char *dmabufdest1 = NULL;
    ! M2 U% s) l8 }1 m* c
  76. char *dmabufdest2 = NULL;
      c. \' g/ A% ?8 K9 M

  77. & {% K# H. I7 J2 z8 B* x
  78. static int acnt = 512;! o; t" ~0 t% n( H8 ~8 e- \6 w
  79. static int bcnt = 8;4 w* ?3 x. ~8 l! b3 G
  80. static int ccnt = 8;
    1 |7 t6 j7 T+ V- }1 O$ p9 E

  81. $ S7 Y9 U' P$ |  S/ ^7 p. `4 w
  82. module_param(acnt, int, S_IRUGO);( O$ q3 c/ U& m, j) M5 O; |+ I
  83. module_param(bcnt, int, S_IRUGO);5 S' j$ d' H! g* c* K, @; M: _
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* D3 r( U; E& b. R* k+ B1 x  b
! f* d: [! l, _1 s4 o      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 F# H$ C7 y+ ]( @& T- _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 m) @0 a7 y, o; M
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' J9 [- G! [5 n; v: v

) u; Y$ h. O' M3 X: j7 F# _( t  K9 H8 Y# E( V+ w  Z. \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 02:01 , Processed in 0.059835 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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