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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' F6 V" N2 ~' z% w7 l
  1. [code]EDMA sample test application
    5 C$ D% e6 F& T( I9 e: o
  2. /*0 L0 q. @" ~+ Q1 a. |2 ~
  3. * edma_test.c
    % C- O# I, [# l/ A
  4. *
    ' ^/ ?+ ^) r% l, K( N
  5. * brief  EDMA3 Test Application
    : Z& l. X" f% `2 i* o
  6. *
    - x" {* o0 m2 n/ k+ A' K
  7. *   This file contains EDMA3 Test code.( v% @8 p$ W9 P
  8. */ x4 M: c+ E: {% t! b' x5 d. _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & ?) w" m" }( P; A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) H3 z% o; V2 X* q( S
  11. *         TO CHANGE.9 h- w) @6 h/ A9 g$ |
  12. *9 Z; s6 {+ F9 L4 W  f1 A& r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      X  ^! Z4 z8 f' @  D
  14. *
    4 M* I5 h% P; B$ }
  15. * This program is free software; you can redistribute it and/or0 R& P* }, p0 f" j4 G* w1 o* n
  16. * modify it under the terms of the GNU General Public License as
    8 k7 Z. [2 c- w, b8 z! n  S
  17. * published by the Free Software Foundation version 2.
    : H" @, ]  C% @4 R
  18. *
    / ~! H+ N) O) ~, t) K4 K0 d$ R+ y6 e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( f0 z4 R5 {' W5 ?4 ~) \, I0 B% e
  20. * kind, whether express or implied; without even the implied warranty
    9 Z  y$ N: C- b/ N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 H4 [/ N7 X4 t. A
  22. * GNU General Public License for more details.
    % ]9 j/ r0 r& I- d5 i' A4 Y
  23. */
    ' z5 C2 ^, s, r6 u" Q

  24. * J- X) G2 w- x" W9 n. C) z
  25. #include <linux/module.h>+ r8 `+ d$ K7 V
  26. #include <linux/init.h>- _* p; F7 l- t# L, c
  27. #include <linux/errno.h>
    * q' z9 t3 f: H/ W
  28. #include <linux/types.h>* x( I) G+ f) I/ O5 A
  29. #include <linux/interrupt.h>5 F( S' ]1 T) c  Q
  30. #include <asm/io.h>
    : W: f# m: l" G5 z" S4 V
  31. #include <linux/moduleparam.h>6 ]3 ]. J+ `6 I$ n  {; \
  32. #include <linux/sysctl.h>( z0 r* D$ u, O
  33. #include <linux/mm.h>
    2 @/ `" h4 m9 Z, O  p5 O8 X8 g
  34. #include <linux/dma-mapping.h>
    # h' K) _4 H1 @0 b3 {7 B

  35. - s# A8 P4 v( m6 q7 A* K! J% a
  36. #include <mach/memory.h>
    3 I5 D' d9 \* X
  37. #include <mach/hardware.h>7 n  A6 N7 w: B' u* Y4 N5 ?) l9 I
  38. #include <mach/irqs.h>4 k( ?3 e9 `# t' T- a
  39. #include <asm/hardware/edma.h>& c" T/ K! t/ P" x- W

  40. 9 e7 r9 Q0 ~, }
  41. #undef EDMA3_DEBUG
    7 J: V  M/ ^& S
  42. /*#define EDMA3_DEBUG*/9 G  P9 e( [% ~4 G. K- B' g
  43. 1 \9 [4 B6 `2 F/ t8 T
  44. #ifdef EDMA3_DEBUG2 y. E* V& ^; [6 _) _& w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( {4 a+ t! i  j9 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * t4 U  e( k, T. m2 ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) P# ~! B' p1 U1 t0 D
  48. #else
    6 z. Z+ W- B, v* j
  49. #define DMA_PRINTK( x... )
    , o- W% i& q* d/ D& D
  50. #define DMA_FN_IN+ D6 t8 F7 u" S
  51. #define DMA_FN_OUT" v  x, \5 J' ]& @
  52. #endif
    0 \" f7 a! t5 D+ b3 g

  53. ' e. n/ p$ F8 q9 T- _, c- T( L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 O5 b! Y) K$ X" e* f9 m/ K1 ^
  55. #define STATIC_SHIFT                3
    ; o7 r7 k. U7 Y0 ?
  56. #define TCINTEN_SHIFT               20
    ) f+ M- O" @3 A- v
  57. #define ITCINTEN_SHIFT              217 a5 ?/ a2 c2 |6 l
  58. #define TCCHEN_SHIFT                22
    2 I2 g( }* b' f: p
  59. #define ITCCHEN_SHIFT               230 \, C. Y* `3 k5 v
  60. % J! F1 S8 \* k2 u. J  b
  61. static volatile int irqraised1 = 0;
    " O7 k. C/ L! g
  62. static volatile int irqraised2 = 0;
      {# s' |: b4 H& O* I7 G

  63. * x/ r; r5 `5 H: ^1 V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; N* [# A# b( B" W4 L5 a3 ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . x6 j9 O4 h! B! }7 ?3 s' }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ ]. T& L9 T5 X* H/ B
  67. ) V5 w- {& ~9 o; M& Y1 \0 R$ j3 o
  68. dma_addr_t dmaphyssrc1 = 0;
    : e, Y. F/ Z$ u
  69. dma_addr_t dmaphyssrc2 = 0;# [# E' l4 q" H+ R* Z
  70. dma_addr_t dmaphysdest1 = 0;' q+ B' |5 ~( O" {
  71. dma_addr_t dmaphysdest2 = 0;& s! X6 N5 M4 m0 F) g3 Z3 s
  72. : m' n3 X( E( K7 G( J- |( z
  73. char *dmabufsrc1 = NULL;  u5 `( d( o  u) J
  74. char *dmabufsrc2 = NULL;
    : c+ j0 \! C& N  |
  75. char *dmabufdest1 = NULL;) b$ p6 ^6 l; t/ C+ i, a
  76. char *dmabufdest2 = NULL;
      {; W+ J2 O; T* @
  77. + F; n: C. n/ Z
  78. static int acnt = 512;
    , c! W# c; ~) k3 \
  79. static int bcnt = 8;
    8 y6 k7 i& |. {2 U' L0 ~
  80. static int ccnt = 8;8 W* d- W; X) y% K- G1 E. T: n
  81. ' Z& H+ ]$ X/ k" x
  82. module_param(acnt, int, S_IRUGO);
    1 q& y, q1 C& ^" e. M3 O7 y
  83. module_param(bcnt, int, S_IRUGO);) H5 a# u# {+ C' G' S* R- u. r2 |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! Z4 U8 n  ~/ R! @. Z# [6 x

+ \8 x8 k7 T9 J# @      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* L9 a# u" ~: i, q' x1 Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 i7 Z2 u4 z! G& G: a7 J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. }! l8 z% X+ s% ]

/ [4 ]7 C* o$ X2 D: R6 l) @+ a( C. X1 @  ]; [  f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 03:45 , Processed in 0.038188 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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