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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 X, |9 o. d3 Q, v+ C
  1. [code]EDMA sample test application
    ; _/ g0 T. K3 N  c2 t/ o+ a% W0 d
  2. /*& R$ g* i6 G/ b( R0 }" p% j. d6 Y
  3. * edma_test.c8 K+ Y$ u, S+ E% ?( x! Y! e
  4. *3 o% ^+ _' \2 g' Q3 N' t
  5. * brief  EDMA3 Test Application
      F4 m: Q- m5 S; s! X, R
  6. *
    ; Z7 Q$ ]* ?0 J, {4 I( ^
  7. *   This file contains EDMA3 Test code.. @9 S# s- w5 p: }/ D) J1 A
  8. *& `  h; U( A; c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 U" V# A4 x0 X, b& {( p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: ^9 n3 N8 r, |2 F7 Q7 ]4 a" J- a
  11. *         TO CHANGE.
    . S8 o* J! W8 n
  12. *
    % J/ j+ W; W+ ^! ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// J: y4 P9 l( }. @+ x! ~- a7 t
  14. *, L3 ?4 Y( ^: F, J
  15. * This program is free software; you can redistribute it and/or1 O/ ]/ g4 A9 u) [
  16. * modify it under the terms of the GNU General Public License as
    # F0 g8 O; \5 a$ Z9 C6 |6 F2 K/ u
  17. * published by the Free Software Foundation version 2.2 T; x" w: c4 C7 G0 e
  18. *
    2 {# X/ k' u- J% a6 y5 F/ D) y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  ?9 b1 V/ ?* x8 v: t* {5 e& A
  20. * kind, whether express or implied; without even the implied warranty
    1 i. C/ _- ~2 G' Q6 U3 j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 x+ U/ |( F( i! n- q0 [! Z) @
  22. * GNU General Public License for more details.
      M" d+ B* n& M, }
  23. */
    % V% w; [  b$ G3 r0 C1 g

  24. # J/ [* _' V- ^
  25. #include <linux/module.h>- L4 \4 X6 L( G; V- E$ p) u( i
  26. #include <linux/init.h>1 b# _# }  o' |9 F! E8 G0 G
  27. #include <linux/errno.h>
      t8 Y2 s; Y6 o& F. b, x$ t
  28. #include <linux/types.h>0 Q! k" W1 W, T* L! p
  29. #include <linux/interrupt.h>
    2 ]; f" W0 G: S2 j6 c. n6 N/ i% q
  30. #include <asm/io.h>1 ~* o7 j, ^. |* {) B
  31. #include <linux/moduleparam.h>
    & s! v' J7 v; c% D, |
  32. #include <linux/sysctl.h>
    : c1 u6 X9 }4 t: U% I
  33. #include <linux/mm.h>+ @: j* d& J' R3 D' e
  34. #include <linux/dma-mapping.h>& i! e: J, J1 N" }4 F1 y' M* }- t
  35. ; F+ O' D/ x0 O: [) X# `1 x4 [
  36. #include <mach/memory.h>5 m8 ]' L3 v3 i& b8 ~- m& R+ _
  37. #include <mach/hardware.h>% L. K' h) t" e
  38. #include <mach/irqs.h>) d- b  ]% `) A4 Y) b' @
  39. #include <asm/hardware/edma.h>* @* x1 T7 p+ n, I1 R& E& }1 y
  40. 4 c' x9 W2 ]: a5 T$ S
  41. #undef EDMA3_DEBUG% C  g; d* l" Y' {- r
  42. /*#define EDMA3_DEBUG*/
    ! c  f3 Q4 ?1 Y9 Z. u0 }
  43. ) |" }% G5 B2 N7 L/ J+ ^
  44. #ifdef EDMA3_DEBUG
    . H/ K5 a8 g7 y4 x! n0 i' B. P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ ^4 l% \) i- _" J  C" V! Q7 D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 u8 ~# a3 b2 ], C" T" [/ z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ x2 c  J+ d8 ^1 A
  48. #else
    5 @+ c0 H2 Y8 y- ]+ N
  49. #define DMA_PRINTK( x... ), l# E# c) E4 g5 ]( L" E
  50. #define DMA_FN_IN* Z" Q' g( H5 H/ v6 P7 Z
  51. #define DMA_FN_OUT3 I8 ]: h9 K& ]4 q
  52. #endif
    % x4 ]( @: L. Y

  53. 2 j! c5 F3 v" d& Y/ R# j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + h2 t* E& M/ g
  55. #define STATIC_SHIFT                38 [1 i( h  z- e. F
  56. #define TCINTEN_SHIFT               20
    2 L+ t5 m9 `4 @7 l: m
  57. #define ITCINTEN_SHIFT              216 l6 i# J$ e+ m' I( r) S0 o
  58. #define TCCHEN_SHIFT                22
    1 b' c3 n! b1 m3 G: k
  59. #define ITCCHEN_SHIFT               23( |; n( P0 e9 f& P

  60. : u. Q+ \( h! H  p; m0 v
  61. static volatile int irqraised1 = 0;
    8 L3 k/ e" l4 U/ U& S2 T
  62. static volatile int irqraised2 = 0;
    * S; f9 i/ ?9 x) x

  63. 5 ]& \8 \: s/ E9 ]$ y' \1 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % S( z* I% o) N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * p# @; j/ j7 O$ ]: j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 _; x4 ^: `# {
  67. 0 j4 M( \* F- g4 X+ P7 r
  68. dma_addr_t dmaphyssrc1 = 0;
    3 E) c0 j& M: f# C
  69. dma_addr_t dmaphyssrc2 = 0;2 m# c( X$ E" u
  70. dma_addr_t dmaphysdest1 = 0;2 P2 C2 I4 g% \2 c5 H7 l8 \
  71. dma_addr_t dmaphysdest2 = 0;3 k& r1 B( h$ t0 @

  72. 5 d" ~4 {7 q+ p0 X3 m5 I" ]
  73. char *dmabufsrc1 = NULL;
    % H+ a* S+ Q' {5 o
  74. char *dmabufsrc2 = NULL;" i2 }' B2 M# P" c
  75. char *dmabufdest1 = NULL;, e! ?% m9 g7 B  e( E
  76. char *dmabufdest2 = NULL;
    + T# g" \, X9 U

  77. 5 `: _0 p4 n: q1 \
  78. static int acnt = 512;
    / N0 c: F% i5 r5 [, C* G% b
  79. static int bcnt = 8;
    - T$ v9 J, w" c: S2 [
  80. static int ccnt = 8;( v8 \+ N1 d% d
  81. $ r+ f% v% J( O) d9 u. b4 i
  82. module_param(acnt, int, S_IRUGO);
    9 L; ^; v8 z! v. y# N
  83. module_param(bcnt, int, S_IRUGO);/ s2 z% N- _1 `$ r( D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 z0 |1 ^; u8 d) s  h
3 R' e7 k. f/ ?) @$ U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& C1 a+ x  q# ^6 L* }( \. V$ u3 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# q5 G6 n* k/ S  x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 j  f/ A8 Q# w5 b
# e' M6 F: N/ g( r# E6 z5 c4 d/ x: B0 z  P7 l& b1 p4 D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-12 04:16 , Processed in 0.040864 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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