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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; }3 k! i2 ?# b! ]! K
  1. [code]EDMA sample test application/ H) b5 y+ K' e* J: w: ^/ @
  2. /*6 r) e+ Y5 Z9 T- k7 ^- |
  3. * edma_test.c
    + R0 M$ }7 i# F
  4. *
    % E) m/ b7 I4 E  z
  5. * brief  EDMA3 Test Application& s, a* k0 c& v8 M+ A
  6. *
    7 x. p# i7 e1 f. k* [/ s: K  w+ z% E
  7. *   This file contains EDMA3 Test code.0 m4 f3 F7 v( Y( n+ u& g9 R
  8. *
    . G; h9 `' |9 q( h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) r/ K5 A( ]7 ^* P( b3 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 J- }$ T0 e: D8 ]4 g: v% B& r
  11. *         TO CHANGE.
    - W$ [1 c* k: M) l) ^& J" T6 ^, [! m
  12. *
      |) z4 f! x% ~3 @+ e* b0 H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// P5 I! {5 e- P* g! j" L& t0 |
  14. *
    % U4 t" a8 g# H8 M+ r( k. Z* ~
  15. * This program is free software; you can redistribute it and/or
    3 Y9 H" k- _8 H" d
  16. * modify it under the terms of the GNU General Public License as/ v8 U+ i! P' Q* B' C8 e* n; E6 K/ B
  17. * published by the Free Software Foundation version 2.1 _* y& F" Q3 x1 N' G
  18. *
    / W  o" K  a" p0 z% |$ B! ]; o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / V8 l5 \6 ?$ @4 a0 c5 ?
  20. * kind, whether express or implied; without even the implied warranty
    - V: u, m. {0 ~! ?8 I6 O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! w# }8 W7 t" B- s2 C! W
  22. * GNU General Public License for more details.7 ]8 ]' v3 p8 J: }
  23. */
    3 r" g& I2 l. Q$ M7 F6 b5 T

  24. / X/ j9 q2 T/ K- E$ J# f1 |
  25. #include <linux/module.h>( }7 w! B1 K. g/ M8 u3 e
  26. #include <linux/init.h>
    . n5 J# f7 l% O+ x; F; b
  27. #include <linux/errno.h>
    4 {5 i$ ?- R5 H
  28. #include <linux/types.h>
    * f' [0 q* n) \7 _
  29. #include <linux/interrupt.h>
    ( z& R7 Y9 Z1 k& E7 G5 G
  30. #include <asm/io.h>
    * o3 `' o& I  y
  31. #include <linux/moduleparam.h>, T% |  S  d3 U9 x2 d% k$ _+ Q6 ^* h2 V
  32. #include <linux/sysctl.h>
    ! k+ L! V( V6 c/ r2 W
  33. #include <linux/mm.h>
    # H& J# d4 a/ U
  34. #include <linux/dma-mapping.h>
    + `% V& F# N/ N8 p( G5 Z

  35. 0 j1 @- H6 G( P( p( H. {
  36. #include <mach/memory.h>
    : @: C* ~" W/ Y4 b, o
  37. #include <mach/hardware.h>
    ( b  C: }7 u- U' s4 h! l" j
  38. #include <mach/irqs.h>! \4 d1 I( p& H3 p0 z3 I
  39. #include <asm/hardware/edma.h>' ]2 l4 X# j+ H3 f2 ]" Y
  40. & Y, ~: X7 e  R6 s
  41. #undef EDMA3_DEBUG) |8 w. c+ J: `7 `6 j' r
  42. /*#define EDMA3_DEBUG*/' s0 b- d' U9 `! o+ I7 M

  43. ) f7 {! J7 T4 r+ I+ e  X8 N( c
  44. #ifdef EDMA3_DEBUG
    : n6 _( f$ Y  U. l" F$ [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* i9 D) T+ F+ S! _, k$ J9 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + t& ?% S2 ~; M2 t, e$ E" m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), x# Y& Z5 V- m/ T1 V* p) \
  48. #else
    + Y+ d1 a& Q: j. w, F8 h: V
  49. #define DMA_PRINTK( x... )
      W% h* }4 l2 C4 C' ]; ?8 U4 T2 m5 c
  50. #define DMA_FN_IN' y" ?, |% d1 n2 `
  51. #define DMA_FN_OUT
      I4 e8 b8 ~* [8 t3 j% v
  52. #endif
    8 R$ \: e4 D. P4 I* f. L3 S

  53. # b+ _$ G- r- O/ m' J1 S6 X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , A) w; p, I. W$ ]
  55. #define STATIC_SHIFT                3
    & Y: _( u+ B0 G
  56. #define TCINTEN_SHIFT               20
    6 {. c9 o% w$ b5 L+ s2 Y
  57. #define ITCINTEN_SHIFT              21% \  ]9 {- b7 ~' [
  58. #define TCCHEN_SHIFT                22# t* ?: g( B& n
  59. #define ITCCHEN_SHIFT               23
    4 p3 y# A1 i5 E. b

  60. 9 ^* j; N6 A& b7 c  t
  61. static volatile int irqraised1 = 0;
    ! G  h0 X8 f, A' S9 T
  62. static volatile int irqraised2 = 0;0 [7 `* t2 c9 s2 Y- p+ H

  63. " Q+ b1 ^0 t, N# u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 l, G( n7 |# ]% d6 }0 O3 H! u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 c& j" U* g7 x% k/ g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ c* Z+ g5 D8 C2 _4 C2 r
  67. 0 l3 m, Y' x. E! f
  68. dma_addr_t dmaphyssrc1 = 0;
    , {/ b2 o  @4 e( l, s% A
  69. dma_addr_t dmaphyssrc2 = 0;, d" \+ G+ ?. x$ I# \
  70. dma_addr_t dmaphysdest1 = 0;, c1 R( C, \8 Y1 w
  71. dma_addr_t dmaphysdest2 = 0;
    1 H1 V, X, [4 A5 ^2 L& }' {

  72. ! q. r; y% _9 E) l' z
  73. char *dmabufsrc1 = NULL;
    ) o8 P' T! H. _8 z4 Q( m- L
  74. char *dmabufsrc2 = NULL;( v( K+ B' s  h; t- e
  75. char *dmabufdest1 = NULL;
    $ E$ l. C  q7 m5 h9 W! Z8 J
  76. char *dmabufdest2 = NULL;
    + @8 O2 A* Y5 }7 ]
  77. ' e+ q5 F7 e6 Z) V  J6 J- N; v
  78. static int acnt = 512;
    ' A! B5 |$ Z" q; N
  79. static int bcnt = 8;/ z; [4 @3 z  e0 o7 h$ v
  80. static int ccnt = 8;0 G+ T3 E1 U6 y8 m) h& X1 w9 a, J
  81. : e1 r0 e" v$ z
  82. module_param(acnt, int, S_IRUGO);5 m" ^. p1 s$ I; s  Y. I% @, D
  83. module_param(bcnt, int, S_IRUGO);
    ) G5 X) b! ?" k5 r6 |" O- t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. ^% ]9 w) J' A9 {
0 |6 v4 f! C8 `, G# ]$ S
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 _) ^7 L* M5 n5 Q& U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 ~7 x  ?/ p+ }/ {4 o) z, |( N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 x" f& O( `0 ^; w/ y

  j, Y. x8 i& y3 C* w9 b
" \0 G) k6 D7 i8 V. H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-28 15:01 , Processed in 0.038254 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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