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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 D9 B& Z3 ]1 T
  1. [code]EDMA sample test application
      X, k. O5 J$ R7 ?$ U
  2. /*
    $ h9 h6 H: u% B$ g
  3. * edma_test.c: w) g& k) E7 e+ S
  4. *6 J. T, [3 i1 c, h: U
  5. * brief  EDMA3 Test Application- X6 Z- o. N+ b8 F# B0 j: C
  6. *& w8 }9 o% ?8 p6 f: ^# v9 ?( P
  7. *   This file contains EDMA3 Test code.
    2 E# [7 n, K2 H. B% t" X
  8. *
    0 m6 L0 X$ n+ C- `8 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 Z+ a* I! e/ C+ B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% }6 _+ H' x1 W( X) }' x' ]& N9 ~
  11. *         TO CHANGE.
    % E+ O6 Q4 z  G( J, p
  12. *
      L" e1 c$ e! D# F0 ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' [) I; l) W4 O# I
  14. *$ b6 {8 B$ R% X( ~& ?6 b
  15. * This program is free software; you can redistribute it and/or
    % Z) i5 j, Z. W7 K1 T3 O: T+ \+ R
  16. * modify it under the terms of the GNU General Public License as! p/ \4 J- H6 D3 |, K6 }9 H4 y
  17. * published by the Free Software Foundation version 2.& _* P* I6 `" S3 Z
  18. *
    + S4 E: [) W: {' g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 ]" _& M' ~0 t4 a, i3 ]: h
  20. * kind, whether express or implied; without even the implied warranty
    2 Q1 c) X9 D& l4 v, w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; G3 e0 f, w8 L9 k/ g2 C
  22. * GNU General Public License for more details.* g, a% B) b% H0 B* y
  23. */6 f% D7 n& r( a" @* E; h% g

  24. 1 K) T  r  g( @6 m6 T+ u5 F6 w! x
  25. #include <linux/module.h>- N% T5 R; ^3 z9 R! r  ?  f
  26. #include <linux/init.h>2 |  ?; j# ^0 P# ^; m7 ^8 A
  27. #include <linux/errno.h>8 {/ @8 o, A' F' m
  28. #include <linux/types.h>& C* p6 t) n, ]# b3 L" c
  29. #include <linux/interrupt.h># z. _5 @9 V' r3 T
  30. #include <asm/io.h>" E* g/ a  o7 k4 Y* `# i  f, R
  31. #include <linux/moduleparam.h>9 p, K5 y% ^2 N* t
  32. #include <linux/sysctl.h>' H$ Q/ l+ \" T/ S; N6 v1 ]
  33. #include <linux/mm.h>
    % ~' g8 @& u  j& z& K( I9 Z
  34. #include <linux/dma-mapping.h>
    + e# T+ F+ b' C( w2 b$ {

  35. ) |% \3 x  }" g' K# F' I) a9 B
  36. #include <mach/memory.h>
    6 c, t! y/ _4 j; H6 K
  37. #include <mach/hardware.h>& Q* [  b! V& Z. t6 a; i
  38. #include <mach/irqs.h>
    1 v$ l3 J: B9 X; K2 P5 X3 k0 s" N
  39. #include <asm/hardware/edma.h>
    $ I: t0 a( s- ]( x; }; v
  40. % Q  j" R5 ?3 D) `
  41. #undef EDMA3_DEBUG- ?, V# [3 ~; r/ {3 f9 b
  42. /*#define EDMA3_DEBUG*/
    , S" w' _5 I$ a, @, `2 I" J

  43. 1 i4 c4 v: i$ q/ k
  44. #ifdef EDMA3_DEBUG
    ( N. H/ ]- T2 R8 ?/ Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / B6 |9 |! K  z. L& K* f- [5 J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 U% J% W1 {3 O4 d: g' S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) L1 S& l& J1 ~2 n; t# F/ Z) L
  48. #else
    , o- k2 a' X  n
  49. #define DMA_PRINTK( x... )
    : P0 Z8 R/ I2 P+ `- ~9 A+ b
  50. #define DMA_FN_IN. Y( M5 F; D- K7 V) N6 w1 t2 u
  51. #define DMA_FN_OUT( m; Q& j# E. [, L5 ]& O4 g
  52. #endif
    ! o) a8 C6 k9 E9 ]" i1 s) z
  53. " c5 B* \7 O0 v( D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " g# b3 b  i- R4 _2 u
  55. #define STATIC_SHIFT                3
    3 }- B+ k& i+ H3 N+ F7 s
  56. #define TCINTEN_SHIFT               20
    * {6 F* j7 B2 \' K9 k: `3 P, G  t
  57. #define ITCINTEN_SHIFT              21% G" h; T* }" d/ x$ H- J9 ^& W0 t
  58. #define TCCHEN_SHIFT                22" k; a1 t$ N! U3 {! P
  59. #define ITCCHEN_SHIFT               23
    - A5 F9 b4 a% A) ]2 M( l2 B

  60. 6 ~: ~) L  ]' Q4 j
  61. static volatile int irqraised1 = 0;
    7 G8 E2 S$ _1 H- M; g  o
  62. static volatile int irqraised2 = 0;
    ' j0 N6 H  B! O2 J! M

  63. ' J' y1 G" Q' A# I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + j/ o/ g/ w) y3 }" H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* A9 s$ R- x  m2 L1 v) W% `& m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 Z) ^& `, V. F- r  Y) f( `0 L
  67. 4 Z% P6 f2 T2 }) \1 ~
  68. dma_addr_t dmaphyssrc1 = 0;4 L7 N, v% }  h# a
  69. dma_addr_t dmaphyssrc2 = 0;
    " o6 [0 a) I1 A- |( }) H# @& A/ r
  70. dma_addr_t dmaphysdest1 = 0;
    2 J: Q( ~  J  i, N
  71. dma_addr_t dmaphysdest2 = 0;# k- I9 g, o+ b, P6 l' |
  72. 9 M- J& p9 ]& o* e) f5 J
  73. char *dmabufsrc1 = NULL;& _. x. e- F5 F1 A; e
  74. char *dmabufsrc2 = NULL;
    0 o4 v6 X' F8 ?6 `
  75. char *dmabufdest1 = NULL;
    0 Y7 e4 x( V: T
  76. char *dmabufdest2 = NULL;
    & ]( i' X0 Q" c7 |

  77. ' h- O9 d. F* ~. I
  78. static int acnt = 512;) u' m  e$ s9 s0 Y/ B
  79. static int bcnt = 8;- _5 n  e( P* }8 r9 _! v
  80. static int ccnt = 8;
    $ o$ p/ e, j/ b+ R. a

  81. $ A8 F$ a1 v$ X( U
  82. module_param(acnt, int, S_IRUGO);
    ( @' Z' E9 C" B* Z
  83. module_param(bcnt, int, S_IRUGO);
    $ A* L; n; T" c* ~) E  T0 x' j* m
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ p+ k0 }- H8 _: C3 R- u) q* W
- H3 Z8 Y8 I; Y9 ]' i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ e: N+ U! z! K) |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* s* N9 d( n) o% ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 N; K! e6 {. |

; O3 v1 Z9 [: h) e5 W8 z3 ^8 H+ [
% @5 Z/ G: E% Y1 h$ x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-25 23:18 , Processed in 0.041311 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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