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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , X0 Z2 Y  p% g5 {' E6 P, }; k
  1. [code]EDMA sample test application
    ! g- K" U* R1 u: X: F* R; V
  2. /*
    / x8 m/ P+ e3 |0 i5 c0 l$ C8 T9 g# |
  3. * edma_test.c
    $ w+ ?/ p% ~1 ]/ D
  4. */ x, s# r7 \8 C0 Q$ m
  5. * brief  EDMA3 Test Application
    ! b) Z: N- h/ x5 E
  6. *
    , l% d+ z" s9 F% I# R( }
  7. *   This file contains EDMA3 Test code.- c6 E2 E: t; Y- G% u3 }+ S
  8. *
      B1 A8 r5 e& o- b2 ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 n7 z8 A7 X, q3 U  f* _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " R4 I/ ?3 F% z8 [+ W$ C+ k8 e
  11. *         TO CHANGE.% J4 ^7 R4 y' G: I* v
  12. *
    - W, a1 {% h- q# ]- I. ?1 A; R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" u6 K2 k- @) ^
  14. *, p# g5 Z5 |& w( M, [1 x$ z
  15. * This program is free software; you can redistribute it and/or
    & r9 E. {3 j& P
  16. * modify it under the terms of the GNU General Public License as
    0 a! z7 i: Z. p) @% z& d
  17. * published by the Free Software Foundation version 2.; U; r* Z. m7 W. Q$ F8 \
  18. *- k* K2 `: X3 k6 O3 ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) h# M) t3 k7 i" L
  20. * kind, whether express or implied; without even the implied warranty3 `# P; Y) w3 n! N$ \, |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 B( ^* t- V8 P% Z9 Y* q
  22. * GNU General Public License for more details.0 E5 J7 T8 K+ O- E
  23. */4 n" n0 }7 s! J" F) C
  24. ; m/ e- L7 d, T5 f
  25. #include <linux/module.h>
    . i. i+ ?' n& {7 ~5 }$ {' z) [5 T
  26. #include <linux/init.h>
    6 z' T) i+ K8 V+ \/ f, I
  27. #include <linux/errno.h>
    : ?# M% [# ~/ `" T  l
  28. #include <linux/types.h>6 P/ A  o1 F8 C+ s
  29. #include <linux/interrupt.h>
    9 J; [& d2 x+ D6 `3 e% |
  30. #include <asm/io.h>
    - K+ P7 c  [% Z' m
  31. #include <linux/moduleparam.h>& K7 G; R4 R2 j; U1 c! [
  32. #include <linux/sysctl.h>
    # g" N0 z+ o: x" t- [: ]3 V
  33. #include <linux/mm.h>
    ' \# I: h) A. w6 r
  34. #include <linux/dma-mapping.h>6 A2 k1 z* q; b) z; l
  35. 0 ~! J' u  d4 Y
  36. #include <mach/memory.h>7 {9 S% o+ g5 d7 C% g0 T1 F1 ]
  37. #include <mach/hardware.h>
    ! j* C' l% C5 x4 e& D, c% ^
  38. #include <mach/irqs.h>
    , Z( V( z  z$ n0 Q3 s* J5 O! T8 x
  39. #include <asm/hardware/edma.h>
    8 }' f, D/ a4 k- F# J

  40. 7 F$ `- P& y  ^
  41. #undef EDMA3_DEBUG: [* n$ m# ?3 k9 X. F3 j
  42. /*#define EDMA3_DEBUG*/
    # g! a5 r& i" F2 y0 r
  43. / s) z! |9 U( x0 s
  44. #ifdef EDMA3_DEBUG
    ! _) e" h  L6 n+ F9 M7 J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + n0 l9 u5 P( @0 k/ C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 f" ^" Z/ L! t0 B& L9 W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + M' T( j. e! z0 p- [2 s- Q( N1 k
  48. #else
    4 J1 H6 H* I+ p$ Q3 `0 n% z
  49. #define DMA_PRINTK( x... )
    # z; s* n; R" K) d9 J0 Q* x' w  H
  50. #define DMA_FN_IN
    + I5 G4 Z* \2 F5 q
  51. #define DMA_FN_OUT# y. l8 f7 P# I( ~+ j4 ]# e
  52. #endif, @' m& w( Y# i2 ]) C7 ^: v5 a3 b! l
  53. & ]1 g1 P0 `  j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 A3 e. e* C5 X3 {
  55. #define STATIC_SHIFT                35 M6 L+ l0 X# _  _
  56. #define TCINTEN_SHIFT               20
    7 f% E) N) L3 w2 K% P" @/ y7 E0 @$ T
  57. #define ITCINTEN_SHIFT              21
    6 e) o4 e8 }- ~1 c
  58. #define TCCHEN_SHIFT                22. w2 h0 e7 b- [; M2 V
  59. #define ITCCHEN_SHIFT               23
    0 z4 J# \% l2 k0 F

  60. % t" f' \8 r7 h: R3 L' C5 V2 N
  61. static volatile int irqraised1 = 0;
      f$ J* G, j2 f8 D% M5 E
  62. static volatile int irqraised2 = 0;
    4 H! M# k$ ?- u: V% a" y2 Y
  63. 1 B! b5 z3 w4 P- L4 |2 R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 p$ z$ u# ]+ ]8 f0 @5 {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 E; X7 n( o; Q; F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 s5 a: o5 l' E' a  }
  67. * z6 F+ I  n, I: R) s- b
  68. dma_addr_t dmaphyssrc1 = 0;
    ( {# W/ x: r) p+ `& ^9 @5 G6 q! R
  69. dma_addr_t dmaphyssrc2 = 0;+ u4 K2 B2 \. K% A5 I: B
  70. dma_addr_t dmaphysdest1 = 0;
    - L0 O# g* r$ n+ S& g1 @
  71. dma_addr_t dmaphysdest2 = 0;( D# }7 `; `% D; l# u% r

  72. # X* @; @" L6 D0 n, W- F6 [; g
  73. char *dmabufsrc1 = NULL;& h7 o2 Y0 U$ G5 Z. z& i
  74. char *dmabufsrc2 = NULL;1 G- E" Z! f4 a  c+ z! z
  75. char *dmabufdest1 = NULL;1 X3 l6 h1 [& q
  76. char *dmabufdest2 = NULL;
    + {# M  M+ Q+ |( s5 z

  77. 3 [% m" [7 `/ I, f( n  ~& q
  78. static int acnt = 512;1 Q5 j5 Q. @( H3 W& p
  79. static int bcnt = 8;( L2 |. ^% ~* a( q; n5 }
  80. static int ccnt = 8;; u4 B, y- x: X7 X
  81. ' p$ u/ P9 Q) n' r: R& U
  82. module_param(acnt, int, S_IRUGO);
    ; h3 ?$ H" J1 f! A" Z
  83. module_param(bcnt, int, S_IRUGO);
    * k2 n/ b1 Y' a
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' w9 h0 z4 d( Y8 ^, Q0 _7 g

9 f3 E% N) a) R- Y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 {% \" C; u6 {+ E% Q. q0 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: v0 M$ ~0 k( b% G, ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- z3 c8 J/ {2 J8 J4 g
' \4 P* _; A8 \

7 G+ [$ C5 o/ X; ?2 S: v9 J7 b( e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 01:28 , Processed in 0.038620 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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