OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & J( Q3 c. f0 Q7 m, m# Y. J7 K
  1. [code]EDMA sample test application
    / G" K# \7 ?8 C0 f3 J- w. ~, @
  2. /*5 y6 _8 N4 B6 l( N$ s# g; \
  3. * edma_test.c/ A) ], A# S, e, x) |% ^6 z$ L
  4. *
    0 t$ ]- ^* q/ b- w
  5. * brief  EDMA3 Test Application
    9 z( y1 {9 V3 L+ ]6 ]
  6. *
    ; l# J& h* e' |3 E
  7. *   This file contains EDMA3 Test code." U( {7 N8 l) _( Z
  8. *
    4 v' R9 g/ @9 e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: c9 D$ z9 A  ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! i/ |7 p& v% k9 W* ?
  11. *         TO CHANGE.
    ! V& n+ n; l9 E* m# a# G8 z% J
  12. *$ `$ j  d/ \2 V0 V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      c0 \- J" {4 u+ S2 _0 ^* p& ]2 J) S
  14. */ Y7 S* S* B4 E' }1 N& M  V
  15. * This program is free software; you can redistribute it and/or
    + r, v: Q3 A. ^; K) x& O% l
  16. * modify it under the terms of the GNU General Public License as
    8 \# L+ Q; G; R" t4 H6 u1 y
  17. * published by the Free Software Foundation version 2./ l8 a- G6 u7 D+ Z
  18. *) x. f3 {# G* r  C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # ^1 N+ c3 Q6 K& o9 j
  20. * kind, whether express or implied; without even the implied warranty/ |! q3 ?5 _& Z! l9 \0 M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - T* h) X' H4 A- x+ O$ {$ z
  22. * GNU General Public License for more details.
    ( S! j6 V: t$ r! r6 j
  23. */! o' [( W. }# v# o: d

  24. : E3 H0 Z5 T" |/ u1 G+ b# o3 ~
  25. #include <linux/module.h>  o# `. P) ~# E: c, O* b$ V
  26. #include <linux/init.h>! r8 F* v+ [. J
  27. #include <linux/errno.h>
    : _. p! O% M% H" Y$ J
  28. #include <linux/types.h>
    2 k9 m5 x( ]2 ?8 p* o
  29. #include <linux/interrupt.h>
    1 v9 ^7 E$ K2 g# F
  30. #include <asm/io.h>
    6 H; }( w6 O. k/ ~
  31. #include <linux/moduleparam.h>$ u2 ]& M% m0 v( w* S
  32. #include <linux/sysctl.h>
    ! Q9 A9 v. f; G$ V" C( s+ m
  33. #include <linux/mm.h>6 N6 a+ g+ v. q. T
  34. #include <linux/dma-mapping.h>
    + r# X! M( \, e

  35. # v; u  G! q- W1 E: |, {1 t
  36. #include <mach/memory.h>
    # [; {2 ~' B; ]$ @' z# K0 v
  37. #include <mach/hardware.h>4 d6 B/ [. u+ n) N/ u
  38. #include <mach/irqs.h>
    8 A, K* h6 a4 p- }
  39. #include <asm/hardware/edma.h>
    # b4 b  V+ u4 W+ R: M
  40. ) M4 O- X$ B9 t7 U3 `" S
  41. #undef EDMA3_DEBUG# a. s& M) D- ?1 f
  42. /*#define EDMA3_DEBUG*/5 b& o3 m# P2 Z4 }! _
  43. 0 k8 |$ e1 j& [
  44. #ifdef EDMA3_DEBUG
    0 S, w: r0 ]" N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% _, O, l1 M7 V" ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( ~  ]" o4 @+ r5 p8 t" [, J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! I8 K9 B2 ~: d  M3 p
  48. #else' d- O6 z: `% v; A$ }
  49. #define DMA_PRINTK( x... )
    , y4 F; g$ Z3 _2 N0 ~
  50. #define DMA_FN_IN* j/ ]+ N' r0 s: v
  51. #define DMA_FN_OUT2 z2 ~- \* {; K
  52. #endif
    % {' S/ z1 n1 k' g3 s
  53. & f: x* r3 v! A; X* i/ }8 ^: E6 R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) C/ X0 E% Z2 s. ~
  55. #define STATIC_SHIFT                3
    * M/ R( {  I7 V6 K( |, T/ a" V! _
  56. #define TCINTEN_SHIFT               20! h& X: W: W: Q' l* _
  57. #define ITCINTEN_SHIFT              21
    ! _$ N8 M) [) ?+ I
  58. #define TCCHEN_SHIFT                22% T. G) w$ R  {# {1 _
  59. #define ITCCHEN_SHIFT               23
    0 T8 @( r- y& h5 k0 j( m
  60. % c8 E" H. ]4 ^- L, w: \8 }1 |" R, B9 L
  61. static volatile int irqraised1 = 0;# Y2 \: {* B( k5 B5 L3 Y
  62. static volatile int irqraised2 = 0;
    ; {& q; ^+ S2 ]. l" Y! p4 ~

  63. 5 @9 M/ S. B! H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 f8 ~" N: y  K6 j* H4 _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : M$ u2 t( q5 M8 r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 {, r8 f, J: t
  67. 0 q2 \. f5 R: `( f& n. N
  68. dma_addr_t dmaphyssrc1 = 0;
    7 N) v: }$ p/ z" @% \" N5 V
  69. dma_addr_t dmaphyssrc2 = 0;: C! [3 c/ r! m- b
  70. dma_addr_t dmaphysdest1 = 0;
    5 U  M; R: l. ?5 r
  71. dma_addr_t dmaphysdest2 = 0;% @3 J6 z5 v) ^* ?! X
  72. " u5 v# I  Y8 Z! J2 e
  73. char *dmabufsrc1 = NULL;& _& }7 o: P) R& t, Y, J3 h# c& q
  74. char *dmabufsrc2 = NULL;# S5 O  i* Y+ Q
  75. char *dmabufdest1 = NULL;# B. o. w% h" S9 m1 r
  76. char *dmabufdest2 = NULL;' R# t! I7 w, ~& x4 q

  77. . s+ m* F0 R+ M# k
  78. static int acnt = 512;7 P4 f3 \6 ]7 r2 C) m8 O$ q
  79. static int bcnt = 8;
    . D$ ?3 e! z; T3 L
  80. static int ccnt = 8;$ I" m/ b$ D. w% N

  81. 1 \/ l: m! s* i
  82. module_param(acnt, int, S_IRUGO);
    & h6 v: w7 |  `- o' t1 A1 A; U
  83. module_param(bcnt, int, S_IRUGO);
    * x% f2 x3 z$ W" g6 J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. m1 m- M7 s& r. [+ y

$ q1 _! Q1 w/ [) P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) E: B/ m' j4 S" R2 F3 y: u. K' iarm-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. J3 X5 Z% q% U) n* J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, b* G$ b5 m4 F( S2 U" d) |) K

  }1 a+ j4 }0 ^5 W0 z: [# S7 {. x! @; X. Z0 ?- r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-20 20:22 , Processed in 0.055577 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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