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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 Z3 D7 E/ @4 d6 \
  1. [code]EDMA sample test application
    9 K/ s5 S; J0 }4 k# v. Y
  2. /*: b3 z  j* x* g  ]1 B$ w
  3. * edma_test.c! B5 r" r" _) U
  4. *
    & w* N, k! M9 h
  5. * brief  EDMA3 Test Application
    8 h0 ^  K2 K: R+ H, J* f
  6. *0 k, j" f9 d5 R, J$ P, g  A
  7. *   This file contains EDMA3 Test code.- b+ v% D) z' h3 ^! o2 U% h
  8. *
    " P& N$ h$ n7 N% y# W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, @! w! ^$ k2 @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " K7 B4 `" v5 w! h8 c* D3 M4 B" E
  11. *         TO CHANGE.
      T3 r+ |# B% q; S# ?
  12. ** W6 Y" n) i2 P* X7 w! R3 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( J- h6 |9 @9 Y/ z3 k% ^: P, O
  14. *6 q$ ^0 R3 ^* ]+ a- [
  15. * This program is free software; you can redistribute it and/or
    4 C& v0 |  U& Y4 ~3 h$ \
  16. * modify it under the terms of the GNU General Public License as
    + s0 c% u% g" t) I/ C. O
  17. * published by the Free Software Foundation version 2.
    8 v  v% M2 l$ e( w
  18. *
    - {" J: Q3 w3 X9 G+ E) b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ l, M' x& e' m7 |+ S
  20. * kind, whether express or implied; without even the implied warranty
    * L! b$ t1 d/ Q( C0 v1 o1 W) ?7 \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; V- n5 X" D+ a- J
  22. * GNU General Public License for more details.
    ; B# M- Q9 @0 F  S, v& K! X
  23. */; Y0 v: }7 x( i: ?

  24.   B0 G# @5 t& k0 L" c) }( l
  25. #include <linux/module.h>
    # g: P. N) S. @. b
  26. #include <linux/init.h>
      n  ]/ _9 A+ J1 S
  27. #include <linux/errno.h>
    + A! V. C* X7 M$ A1 d, x' f# ?' M
  28. #include <linux/types.h>
    5 r9 b* q9 n0 \" d
  29. #include <linux/interrupt.h>
    7 P! X, n, X. l3 X+ M  _
  30. #include <asm/io.h>
    ' L2 n2 a& P3 ~1 B; Z( r
  31. #include <linux/moduleparam.h>/ W2 o4 c% O& t- y+ e: h( c8 v" Z
  32. #include <linux/sysctl.h>
    2 R- E( q/ n7 l
  33. #include <linux/mm.h>( b: G/ q* T( B' f) Q' w5 `0 {
  34. #include <linux/dma-mapping.h>, O. z9 R1 C' H) Q

  35. ! w/ v) q; _0 |1 h6 i2 G0 E
  36. #include <mach/memory.h>
    $ `  E' e2 [$ P: Q7 s, D% o, `* Z
  37. #include <mach/hardware.h>& Q( W/ {+ i7 l; r& j
  38. #include <mach/irqs.h>
    8 u2 x0 ?+ t, W* m3 Y
  39. #include <asm/hardware/edma.h>
    6 y+ X8 k3 j( V) L. t
  40. 2 @9 [, ?# B9 D+ i$ K; {
  41. #undef EDMA3_DEBUG
    ) }$ h* M+ N  _; D& C# o
  42. /*#define EDMA3_DEBUG*/9 l/ D7 y0 z" {" p. B& t
  43. 5 H6 k6 |4 _) \% |
  44. #ifdef EDMA3_DEBUG9 P5 n* o% e. H  o4 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  t& a0 ?1 [$ W7 F( {# Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      ]. G  Q# k; c! d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# m* W" l% @- Q# i5 m% Z5 f
  48. #else
    # [4 W# p) E4 G) s, H
  49. #define DMA_PRINTK( x... )' n# k/ l: b3 {
  50. #define DMA_FN_IN0 b, F5 l' M+ @* J8 C
  51. #define DMA_FN_OUT& ]8 m1 z. r0 B1 p5 L7 p: o+ d
  52. #endif3 F2 Z1 m! j, B3 U

  53. 8 V$ S2 O8 }# N! P$ z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : r& l+ j. Q9 v( P) c9 `& G
  55. #define STATIC_SHIFT                3
    5 A# G( `2 L& `5 e( k
  56. #define TCINTEN_SHIFT               20
    . J# X. K1 t+ j3 E+ }. F
  57. #define ITCINTEN_SHIFT              21/ d+ A' C; w8 [9 E, M
  58. #define TCCHEN_SHIFT                22
    , p% B( M4 Z/ H/ D/ L5 \/ o) ~
  59. #define ITCCHEN_SHIFT               238 `) w, o* N% q) B' L" s9 F' m. s

  60. - D7 @# m, V& c. Y
  61. static volatile int irqraised1 = 0;
    7 n3 C2 ]7 i+ `- ?8 H7 j% B
  62. static volatile int irqraised2 = 0;- f1 B5 l. i/ J+ u' W
  63. 2 h+ A# u4 O% |6 ^9 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      H8 d6 ]* E& r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! _6 }! A, x& N5 ?# Q1 I; g) k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' o7 ~( e+ u7 k& b( Y) y+ C& h  w) e

  67. + c) z2 c8 t  b! v0 t
  68. dma_addr_t dmaphyssrc1 = 0;9 Y% ^2 s# s; T
  69. dma_addr_t dmaphyssrc2 = 0;
    + M9 o! {, L! ]7 Q& q* L" [, A
  70. dma_addr_t dmaphysdest1 = 0;6 Z9 x# i+ Q" O7 z1 ?
  71. dma_addr_t dmaphysdest2 = 0;2 {0 h- W  b% Q" f& r+ P6 a

  72. ' l( w% J  M9 J* ~3 Y5 D
  73. char *dmabufsrc1 = NULL;
    $ x; P  e  ]: _
  74. char *dmabufsrc2 = NULL;7 f5 W# n& d& _( H5 M9 y' Y. \
  75. char *dmabufdest1 = NULL;1 H& l: H+ T9 E; m3 D( Z
  76. char *dmabufdest2 = NULL;$ ]8 |; x& ~& G3 q4 L' K
  77. $ J% J/ T6 ?; ^- D5 ]
  78. static int acnt = 512;- J# H! Q- b0 Y
  79. static int bcnt = 8;
    ( t; `7 i3 H4 {/ v5 @
  80. static int ccnt = 8;, A" r; {% |& V* ]9 l- `% _

  81. 9 X9 o, m  {) q
  82. module_param(acnt, int, S_IRUGO);: x' G( I+ O' v' w$ n7 m0 q) P& W
  83. module_param(bcnt, int, S_IRUGO);4 _$ B* u- }$ R* E6 ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& r5 w( y% d4 @4 c, x6 p+ t
. ?7 C5 F( n' Q- ]1 i      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 r* h1 [" R$ c7 I% Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 B' X  I# r. H: P) B* ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% g) ]8 ?9 _# J2 E+ w
4 X8 n4 [9 L; y$ z: x2 D& U: c& o0 u$ g! E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 02:37 , Processed in 0.038578 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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