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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % Z  o5 d7 i" s& |6 X3 w7 S
  1. [code]EDMA sample test application
    % b, R- j- S! e$ \6 x0 X2 M
  2. /*! _7 c8 ]  `9 j; S  B( d1 k6 l$ l# Z
  3. * edma_test.c
    8 i( J, N; _$ s5 F
  4. *
    $ ^) c* Y% g8 i9 n
  5. * brief  EDMA3 Test Application2 s) \9 j  J! N5 H2 w
  6. *
    3 ~; [) T  f2 e: d. n/ l" w& F
  7. *   This file contains EDMA3 Test code.
    8 k# |  c% q( V3 V0 H
  8. *
    % g$ @( o' D3 X% j, ~* r% p) q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- Q$ f; h1 f7 K; }4 C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' L$ `/ E+ D  U# ]# i
  11. *         TO CHANGE.8 O& E7 m/ v$ E: P# z
  12. *
    3 B. {6 d7 }$ D* h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& N" m" ?3 a; l' V  R
  14. *
    % I7 m) d$ m# w. J5 Y& h3 g
  15. * This program is free software; you can redistribute it and/or
    7 p8 f; n+ x6 ^/ T' r( G
  16. * modify it under the terms of the GNU General Public License as
    6 _5 ?; Y) t( y6 b0 |! l3 U
  17. * published by the Free Software Foundation version 2.
    % S4 F1 S, |/ u
  18. *- Z) _- \0 X. E' y; q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . ]! w0 C6 G, A0 q" B7 {$ g4 T
  20. * kind, whether express or implied; without even the implied warranty
    2 z( p+ Y& Y9 ]3 v5 D2 u; q" l- r) ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 L/ l* k  l3 ~) P2 v
  22. * GNU General Public License for more details.
    4 b+ l5 }+ `) l, c2 C, g( r' \
  23. */1 w+ r- j$ {; i2 t" T+ X. E
  24. 8 u  z) }5 k3 e  h* x* K
  25. #include <linux/module.h>
    0 a+ Y: _; j( X6 D
  26. #include <linux/init.h>
    * A& L& Y7 ~, V! e
  27. #include <linux/errno.h>
    6 p7 n  v) S5 R0 ~+ h1 [3 u
  28. #include <linux/types.h>. f# s- i% T& r2 a
  29. #include <linux/interrupt.h>
    ; M1 Z# ~3 C5 t( w- s
  30. #include <asm/io.h>
    ' V  C. v7 f# m* r4 f! [
  31. #include <linux/moduleparam.h>) y; \0 b. c! U) l7 @  J
  32. #include <linux/sysctl.h>
    # C4 M  c; i5 H# {4 }8 p4 z: S" j
  33. #include <linux/mm.h>
    " ]1 n8 i6 }- B5 ~
  34. #include <linux/dma-mapping.h>5 k1 b: ^( B# A1 a: W

  35. $ e8 y+ {, M+ e# I$ S9 ~
  36. #include <mach/memory.h>0 m/ L& B8 v+ t9 B: |7 o! s
  37. #include <mach/hardware.h>
    " y) M/ {& t+ R5 D& o
  38. #include <mach/irqs.h>
    $ a& \# l3 w- I% z: H
  39. #include <asm/hardware/edma.h>
    : x8 w; V& d6 v5 i- I

  40. 6 d4 Z$ U: L. B$ u4 Q) x
  41. #undef EDMA3_DEBUG4 T/ g" y$ @0 p% q. l
  42. /*#define EDMA3_DEBUG*/  x9 F! r  R+ p' L6 x
  43. : w3 b" q; V& N: y
  44. #ifdef EDMA3_DEBUG
    0 q) Y2 Q+ a, G) }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) `. c5 I" H8 ~4 b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 P7 L9 @$ R* H. Q$ l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), C/ B+ Q' g& d2 X% |+ S
  48. #else7 o2 X0 a3 w# @. U
  49. #define DMA_PRINTK( x... )
    " [  t5 T, M! @6 t: h2 f0 s2 S
  50. #define DMA_FN_IN
    : N* I* J* u; C$ r% ^
  51. #define DMA_FN_OUT
      T; _' |4 h6 V/ c
  52. #endif
    + T; ~: ]1 v5 _, e6 l

  53. 4 W. e" x% l5 y" E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 ?9 P+ q4 m' D" b5 Y& A
  55. #define STATIC_SHIFT                3' M8 W5 y" B6 f: D# S- P) ^
  56. #define TCINTEN_SHIFT               20$ A  n6 [! ]) j  l% X
  57. #define ITCINTEN_SHIFT              21
    * w9 Q, ~; g) ?3 d7 ^& f& L3 p: s
  58. #define TCCHEN_SHIFT                225 a" H! m* k7 B# z, y: K# k+ G
  59. #define ITCCHEN_SHIFT               23" s# R3 X% P) ?5 a; ^
  60. % [0 G) N; _' L8 N% F
  61. static volatile int irqraised1 = 0;1 Z9 y* p* b3 S, g6 M
  62. static volatile int irqraised2 = 0;
    ! ]8 F1 T+ q# ]( f
  63. 9 S' h  F/ e; l% M6 V# `. L9 ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( D  ^. A' i2 @' J/ G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& a2 W- f6 K& q; p! T9 ~" p$ n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" n$ S. \, f! P2 N& q- ~
  67. 0 h% w) e( U2 l6 N" p5 ?
  68. dma_addr_t dmaphyssrc1 = 0;7 A- J* F# X/ a5 X, A2 D- W) p
  69. dma_addr_t dmaphyssrc2 = 0;0 v' v& e9 z1 V2 g5 V% `0 w
  70. dma_addr_t dmaphysdest1 = 0;
    ; u+ B1 ~7 \/ C" r/ A
  71. dma_addr_t dmaphysdest2 = 0;
    / Z4 i- Y8 ~- G/ @! y; a

  72. 9 `/ ^5 ^6 I: j
  73. char *dmabufsrc1 = NULL;! _& w- }8 {- S
  74. char *dmabufsrc2 = NULL;5 P5 N5 l# s+ W# T% i
  75. char *dmabufdest1 = NULL;) U6 m" d5 Q6 l" x2 X) q
  76. char *dmabufdest2 = NULL;
    * y4 v  U. r0 H: J; E" M, i

  77. 5 U8 X3 W& p* O
  78. static int acnt = 512;$ y# D( x3 `# ^
  79. static int bcnt = 8;7 U2 Z- i( d7 J8 }- d* S. {/ W
  80. static int ccnt = 8;, D9 t( Q% f% @% ^9 d4 `$ y. i
  81. 8 i% n6 G7 Z& i* n- G* a, z! O+ ^: g
  82. module_param(acnt, int, S_IRUGO);1 P- d" S1 m2 q
  83. module_param(bcnt, int, S_IRUGO);( _$ j- ]" W' k7 i3 M" A' C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, N  H6 r- K6 n1 m% c7 l2 U  e, p4 Y7 r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* \: T. t; A! q* j* a5 l5 \5 marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 q# G/ q2 E# Z8 h! ~, `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) \! T+ v1 D% U- s+ E6 }5 x. o0 i. E# ]

# X: r' E5 Q3 B2 [% b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 08:31 , Processed in 0.046932 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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