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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ q4 m0 h; g- w- E8 P" D: {
  1. [code]EDMA sample test application& r' z, h, l- ], G% j
  2. /*$ s" [7 `' U% M$ y* ~
  3. * edma_test.c
    % e" B  v( X0 v, l3 z  e
  4. *
    ! I  ^* P& Z( J
  5. * brief  EDMA3 Test Application$ G( ^0 g! n( t0 ~, R8 v( K0 H  w
  6. *7 h0 A1 V- X2 r4 L
  7. *   This file contains EDMA3 Test code.
    * L) G8 e- @' Y$ D
  8. *
    0 X( j8 h& i& P" @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / w! \  t" h7 B, F0 M2 Y8 m* l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, i; S) _% ?4 j' Q
  11. *         TO CHANGE./ d/ D$ e& i; Q' @+ P" |
  12. *, k& t8 {' c; ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' i' [" ^+ t& y1 t+ U
  14. *
    ; V: S6 C# [7 s# n% B6 U7 u1 ]" Y
  15. * This program is free software; you can redistribute it and/or
    ; W/ k  q7 l' s! K# B
  16. * modify it under the terms of the GNU General Public License as# P$ x  O; q1 `7 H& }- V5 q
  17. * published by the Free Software Foundation version 2.
    3 c8 K# |  w8 ?/ X4 v
  18. *3 @" U* I9 Q3 G7 j7 ~% {5 l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 L9 {2 \. \+ k: i
  20. * kind, whether express or implied; without even the implied warranty
    ; Z8 r& U, d' B, J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& m' g8 M# E$ G9 \
  22. * GNU General Public License for more details.. v  [! v/ v& e3 O
  23. */: ]0 j# X5 E4 r$ ~8 b! B
  24. * L$ Q: [# S! k* |- K1 }
  25. #include <linux/module.h>
    3 }. @& Q( ]3 U1 v3 S6 y
  26. #include <linux/init.h>6 o" ~5 [; a* ]: C9 C: h# c
  27. #include <linux/errno.h>: I9 Y9 N+ F. e% C( d
  28. #include <linux/types.h>7 K/ J$ [4 T$ @" `2 `
  29. #include <linux/interrupt.h>6 U. z- D* I5 _8 |: k7 m: u
  30. #include <asm/io.h>! Y9 R; Y6 c" ^$ {+ [) _3 x- o
  31. #include <linux/moduleparam.h>
    ; O& ^4 M, L. z2 E  a9 ^8 [8 N
  32. #include <linux/sysctl.h>% O9 |3 L7 @( Y9 j" @, q. X
  33. #include <linux/mm.h>+ c$ @; P! D' L3 V$ t
  34. #include <linux/dma-mapping.h>+ A+ L& F! D5 u+ W. j* z

  35. ' ^% B" J7 S6 a
  36. #include <mach/memory.h>7 G5 C! N9 E! I$ K' ~* a
  37. #include <mach/hardware.h>' {( y3 x& V6 _  ^
  38. #include <mach/irqs.h>
      E6 {. M# `6 M9 D( {0 |
  39. #include <asm/hardware/edma.h>
    , g. x% A# h3 B  W- h+ G

  40. " x/ e0 E9 o) B0 ]9 r+ a5 h0 E6 \( w
  41. #undef EDMA3_DEBUG" R8 {2 x# q' K; |' k- @
  42. /*#define EDMA3_DEBUG*/  {/ x; K4 T8 g

  43. $ Y6 t3 }- H, r; Y5 S4 c
  44. #ifdef EDMA3_DEBUG- x' y$ A' m  x& A& Q% R6 m9 v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 _: E1 O) E4 A; D7 ?! S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 M- C" c7 T3 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 E+ v  _4 w" }5 Z* a4 \
  48. #else% W" z& W- Z- a- u
  49. #define DMA_PRINTK( x... )9 F$ S) D: `  G9 B
  50. #define DMA_FN_IN9 j1 k9 ^# ]3 ?4 t- K
  51. #define DMA_FN_OUT, P; c; O1 _+ {& ^9 o5 W% {/ M
  52. #endif
    & v7 _% E. D/ V3 U2 @. f+ A

  53. 7 }! g+ H+ `9 E( Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! D+ F3 q7 c4 v! {8 r2 G
  55. #define STATIC_SHIFT                3
    - ~2 B; d1 w& }( E7 z1 |1 j0 C6 M" \
  56. #define TCINTEN_SHIFT               20
    9 e! e1 Y: O* [' H
  57. #define ITCINTEN_SHIFT              21, j. A2 o+ P& `% M  c
  58. #define TCCHEN_SHIFT                22! j9 f: V0 Y0 w: q% A6 Y
  59. #define ITCCHEN_SHIFT               234 k6 b0 [5 F" }% \8 {1 y

  60. 0 W( C$ R6 [4 b; g: Q6 `8 c5 A/ `
  61. static volatile int irqraised1 = 0;
    % \" c* [% a2 {6 r+ B8 f3 H
  62. static volatile int irqraised2 = 0;
    5 r( u1 t& h! k: @

  63. 5 y* e  o7 W& Y$ W% V& m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 I; F& c6 ]! Y. u2 G; w' v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- t  o8 j# S7 `7 w3 T# S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      N1 t2 R0 I# ?  N. s# y1 Q

  67. 7 |. c1 m0 v* T4 c1 S& ]
  68. dma_addr_t dmaphyssrc1 = 0;
    6 l0 v) `0 M9 A$ ~
  69. dma_addr_t dmaphyssrc2 = 0;
    5 d5 v  P/ d$ Q8 T7 S
  70. dma_addr_t dmaphysdest1 = 0;/ ^5 {8 g% w4 k- r$ o
  71. dma_addr_t dmaphysdest2 = 0;3 b: _+ u0 |# o
  72. ' H! s. U! W! Q% T9 w; Y
  73. char *dmabufsrc1 = NULL;" c; t3 V1 |3 S: A2 s+ Y
  74. char *dmabufsrc2 = NULL;0 O4 }. P$ S5 r9 Q0 a. B) W: V6 T/ M
  75. char *dmabufdest1 = NULL;( S. T# w  V6 d, @
  76. char *dmabufdest2 = NULL;/ K- q6 c: K" E* U4 U( A
  77. ) q3 t& a: L0 S
  78. static int acnt = 512;
    6 G8 O: \  ^' V) q; A+ G' d
  79. static int bcnt = 8;
    : [; [4 E: u1 h8 y3 E
  80. static int ccnt = 8;) o; N9 ^1 g/ a

  81. ) a' }( L) ^* r% w: ~. d
  82. module_param(acnt, int, S_IRUGO);
    7 V4 |' U$ `* I  }
  83. module_param(bcnt, int, S_IRUGO);! B' w/ E+ v. n2 ?" D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. N4 k& g% ?9 ?$ {& O0 Y& @4 {+ U1 u* O. U9 j4 x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 u' B' ?8 C. _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 v1 j& W5 L+ A) p7 t2 |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ a, X9 G0 [, W2 |, f* O- j
* B1 P8 ]6 t/ v+ W3 X

/ D" e7 K% [. J  z6 @* y9 X! y- O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-27 10:12 , Processed in 0.038917 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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