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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " m8 A$ P4 i7 X3 {1 q  ^' M
  1. [code]EDMA sample test application/ a0 V" ^8 H4 A) T
  2. /*
      C* Y" l& k  z; Y: n! u9 s
  3. * edma_test.c# W' k5 h9 Z; z; X
  4. *' m6 M. Z1 n& e
  5. * brief  EDMA3 Test Application
    " B! A; u, D) [3 u: |: [
  6. *
    " P; P$ J5 |/ l9 ~5 v* K4 Q. e% [
  7. *   This file contains EDMA3 Test code.
    : {4 g! C1 X0 \* o. |7 V
  8. *
    : D: G8 }& i, A- y: n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 |) h5 ~0 ~9 a( n: l) P3 n$ ]: W" r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , D4 ?6 x+ y$ e7 N0 ]5 v
  11. *         TO CHANGE.
    2 L9 Z. |: r: p& O8 M2 s9 t# o- h9 [
  12. *
    7 _) n0 S% @' j! _  X: X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 ]% Y% m9 T" K- |% j; ]. l6 V
  14. *
    # ~# [- R  H- x* L" L, F
  15. * This program is free software; you can redistribute it and/or
    / [: [" Z. o" k, N  o5 |+ r
  16. * modify it under the terms of the GNU General Public License as
    ) K$ O4 f/ w! f3 K) c% g" t
  17. * published by the Free Software Foundation version 2.
    9 \5 j" h7 S  p+ S4 S3 U7 @$ `
  18. *
    . g, L* u; Q: i9 X: Y1 Q" X3 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 @; O& w, ^; N3 T
  20. * kind, whether express or implied; without even the implied warranty
    ; u, o6 m1 q% T& v: G. Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ G& p$ n  ?' _' Q; O8 x' D
  22. * GNU General Public License for more details.
    - C. M6 t! v) [8 r0 [) f
  23. *// A/ ?  c8 b& s! T5 q

  24. $ W* o' [. R# t% z$ `
  25. #include <linux/module.h>
      o+ T4 \' ]9 ~( b
  26. #include <linux/init.h>
    ! J. u0 Y9 O/ h" {8 k7 D8 o+ J7 l
  27. #include <linux/errno.h>$ A( M  P0 u. J; q
  28. #include <linux/types.h>
    ) q; p3 h) {. `$ Y) k
  29. #include <linux/interrupt.h>
    ! S6 t- k" h5 m1 q- x8 `- f
  30. #include <asm/io.h>
      q' d* z/ q8 X" U$ l1 q# K) b
  31. #include <linux/moduleparam.h>0 }& v& h: o6 X& W3 k
  32. #include <linux/sysctl.h>
    " b5 w9 C4 I: Y, A8 s9 u' v
  33. #include <linux/mm.h>
    % ?) _* d4 R6 W  t+ l
  34. #include <linux/dma-mapping.h>
    + W+ Y8 T7 V: d4 L) t  e* X# G

  35. 5 o/ i: r# X) I) j6 J( [0 }
  36. #include <mach/memory.h>* r. p5 g1 C; x7 z* _; {9 M3 i
  37. #include <mach/hardware.h>
    ( f4 B# \. M3 Y5 Z5 p) K
  38. #include <mach/irqs.h>7 ]4 p4 I' b) b# @1 N' a
  39. #include <asm/hardware/edma.h>
    7 w  G+ ]2 F( N5 z* Y7 M
  40. 1 `8 D: z/ ~* x8 E: F& Q( T
  41. #undef EDMA3_DEBUG
    7 b  ^- f; j( p
  42. /*#define EDMA3_DEBUG*// [; M7 Z  ~# C  [( p- R4 {7 y: h

  43. * h- Q& _0 h) y* W
  44. #ifdef EDMA3_DEBUG* c% Y( d. e5 F' C+ C. S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), H, C2 Y" e# J$ V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( T5 G. c* ~' P& d) q- N* T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 E' a! I6 w( N* ?  D6 W4 x
  48. #else
    $ e+ x$ b% D1 P" p, t8 F) r
  49. #define DMA_PRINTK( x... )
    + U& F( S; l( r: v' `4 I
  50. #define DMA_FN_IN* ^! W8 k( y" F; h
  51. #define DMA_FN_OUT
    . ?% R5 x3 s/ i0 B  Y8 V6 w9 z% x
  52. #endif9 g: N: S! N) t
  53.   P  [! z- s, }6 ~2 H' S4 T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): [& j# q* Y; n5 V' b
  55. #define STATIC_SHIFT                3
    . o7 L2 D5 R  S6 |: f( J+ C( e
  56. #define TCINTEN_SHIFT               20
    " J! F( s+ s  b
  57. #define ITCINTEN_SHIFT              219 K! q1 j: U( h# ]
  58. #define TCCHEN_SHIFT                22) I. I: b9 z* s1 L4 F
  59. #define ITCCHEN_SHIFT               23
    0 y9 S. u$ B1 m# f1 s

  60. 1 m& `, _' `* q+ T4 w1 A
  61. static volatile int irqraised1 = 0;
    2 A" X4 t! X% y. g" H
  62. static volatile int irqraised2 = 0;  F  S; U$ C3 H* ~% a

  63. # |% T, i% f/ ]/ \" e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 m! p5 }* R! \0 I, V, `6 }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 y6 u7 p" C8 I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' U. b* a9 P" g) h. ~+ |5 S

  67. ) H8 _1 z; Q; k4 o; W3 L
  68. dma_addr_t dmaphyssrc1 = 0;' K: |, s( P7 ]3 o% M
  69. dma_addr_t dmaphyssrc2 = 0;
    9 E, b( p2 d" j* H
  70. dma_addr_t dmaphysdest1 = 0;( t3 M' i. M0 W$ S; A8 \9 T8 X
  71. dma_addr_t dmaphysdest2 = 0;
    9 K/ Z2 Q" U7 N# [/ A

  72.   K% |3 c- X/ }) @9 c3 ~8 F$ ~
  73. char *dmabufsrc1 = NULL;! K; F/ T* d& z& L3 G0 Z
  74. char *dmabufsrc2 = NULL;) j' y' M4 W, y- i8 m/ R- ^! n* r* \
  75. char *dmabufdest1 = NULL;  B! Q: a( u, I& s4 o" c' i! {
  76. char *dmabufdest2 = NULL;2 h& u$ \+ N+ c9 U7 K$ F$ i
  77. - {- a+ a. _6 Q; E9 V# ~2 w
  78. static int acnt = 512;
    * I2 M; q7 ]" k
  79. static int bcnt = 8;
    4 ^2 g" a( |% _) q
  80. static int ccnt = 8;6 s3 B  y% ?; ^) K

  81. $ K' k. Q! u8 B$ E4 z
  82. module_param(acnt, int, S_IRUGO);
      H4 U8 ~$ h" h( T- w
  83. module_param(bcnt, int, S_IRUGO);9 ]6 U) V! p& e9 D6 T0 Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 ^3 X1 C4 s& ?* j' }- |
1 M  U' @( _2 y9 K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 y7 d4 @' }+ u9 E' \4 G6 [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  ~$ d9 W0 b4 F; ~5 V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 V* N- `6 y0 Z9 S
8 {% H  b! s4 e7 g

) U8 Y- e" N4 p  K: O+ h- h, U. F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

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

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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