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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 K/ r( n$ \# ^
  1. [code]EDMA sample test application
    1 L+ u1 h; Q, G) Z, `. c* ?2 h7 B5 J1 H
  2. /*
    $ h% _& w9 N4 S9 h- i; [  D: O
  3. * edma_test.c6 [1 O6 y; t) W! t! b
  4. *
    6 t# A, @5 c6 F9 e8 A$ m9 ^2 x
  5. * brief  EDMA3 Test Application6 G) L) _/ i( G7 D
  6. *6 Z2 N$ i9 K, _$ A5 X: L
  7. *   This file contains EDMA3 Test code.
    3 [. m6 q) T1 h) ?
  8. *: m$ J5 w1 r* K: }. N/ K$ h, X& w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 d; n' W  s5 g  V% }3 y5 w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 A# J: `. Z. v, J  v9 }7 p7 ]8 s
  11. *         TO CHANGE.& P- G. p, k6 i$ B( a" w1 {
  12. *) Y" }  Q2 p/ r+ Q* y6 f- Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " |" x( e' l) @5 L: Z
  14. *
    4 q; K% U$ s+ o! ^7 |3 Q8 m
  15. * This program is free software; you can redistribute it and/or
      n. L) `2 ?! ]7 s3 G$ c  I
  16. * modify it under the terms of the GNU General Public License as: X  F" W$ S: A' ?$ \$ h* a7 E- I
  17. * published by the Free Software Foundation version 2.
    + y- y, i1 n- h  @% V
  18. *
    7 f  t- d, f$ V" S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. A$ @& R6 B, o+ J
  20. * kind, whether express or implied; without even the implied warranty0 ^6 U9 K8 t4 Y, o, o7 P/ G5 a: F" k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( q$ r, s2 b1 m: {) ~; G
  22. * GNU General Public License for more details.
    1 A7 m) k) ~) K
  23. */
    + x7 b7 @# g8 l. {: c
  24.   c2 c: e( ~0 A$ E( _1 I' s
  25. #include <linux/module.h>. a' P8 F  {' V* E: p( k( ^3 K
  26. #include <linux/init.h>7 }7 S1 o& B9 U5 s8 Z
  27. #include <linux/errno.h>" ?, x, `4 @( o1 Y
  28. #include <linux/types.h>3 X2 r* M8 z# W6 q$ ^, a
  29. #include <linux/interrupt.h>
    & v' A) T$ k  l% L' ^7 |
  30. #include <asm/io.h>9 L6 a! x, }9 L# y+ Q5 S0 m0 T
  31. #include <linux/moduleparam.h># |! Q: E! A6 \6 f$ F% g' U
  32. #include <linux/sysctl.h>3 L6 P& ^3 \: c. A" Z4 |
  33. #include <linux/mm.h>
    ; k. x. y8 [( N3 ^' x0 V% s0 Y
  34. #include <linux/dma-mapping.h>+ e' H" h: U6 u* [" c; \, c

  35. . D/ Y6 B  l5 H/ E+ E  N% C+ s
  36. #include <mach/memory.h>! @5 c; d8 ~0 x, i
  37. #include <mach/hardware.h>$ k& N3 t# S+ }' k8 `9 d3 d
  38. #include <mach/irqs.h>
    + v0 n8 n7 {; t6 z& e# i
  39. #include <asm/hardware/edma.h>
    % v2 O2 I0 o5 R* ~3 j

  40. * t6 ~  `% z( x2 F3 v
  41. #undef EDMA3_DEBUG% u5 [0 b* [/ O/ S7 ]/ d- v
  42. /*#define EDMA3_DEBUG*/
    7 [* |! D  ~  B) {" I2 G
  43. ( H  [% u) u7 g1 Q
  44. #ifdef EDMA3_DEBUG
    : o$ s" T% o% f/ Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / ]: H0 m( |- ^  v* U6 f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 G" j# y. N, s- u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " b6 W# D+ B5 J3 O# `- a& P
  48. #else
    ! n& `3 p' i1 F+ o9 m4 ]
  49. #define DMA_PRINTK( x... )
    * h% F6 D6 j7 b" B1 m
  50. #define DMA_FN_IN9 a2 S, G' J* T' N6 M# ^( {
  51. #define DMA_FN_OUT
    # p3 }/ R; X# y! ?- A+ Y# S- r
  52. #endif- V1 q5 C: Y# T1 U- Q! L. [

  53. * ~8 v+ E2 e1 a2 s$ I2 C4 H& W& C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% A% x% _6 p0 ?6 g2 A3 D
  55. #define STATIC_SHIFT                34 {. S1 g( n# A9 g. _2 J, M
  56. #define TCINTEN_SHIFT               20
    . x# @  C* h( S6 Q0 }/ w3 y6 f* _5 K
  57. #define ITCINTEN_SHIFT              215 `* u8 c* ]3 _) g
  58. #define TCCHEN_SHIFT                22
    3 k3 z3 d7 ^6 X! f0 d9 G
  59. #define ITCCHEN_SHIFT               236 z( r% o( L8 ]- i: [" M
  60. % C+ F; ~  t# Q9 C8 O
  61. static volatile int irqraised1 = 0;
    $ Y1 b* O  ^5 W5 _2 `9 c- q% m
  62. static volatile int irqraised2 = 0;4 h/ L' {* ^0 H; Z' j* f# T: X
  63. 7 x4 n2 l( r, z! G5 z6 z4 G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 a) c6 I4 @2 [$ a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' a5 ?- ?' D) D# o, ^3 k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& A/ l1 x, s# ]% c! }5 j8 |  F

  67. 3 l* p. n7 q" a. W+ c5 g+ Q
  68. dma_addr_t dmaphyssrc1 = 0;
    2 k7 M+ T  G0 X/ [
  69. dma_addr_t dmaphyssrc2 = 0;: P5 o" \: t3 e9 K& Y" ~* b) @( N
  70. dma_addr_t dmaphysdest1 = 0;
    # g. O# f: _7 b0 {6 J
  71. dma_addr_t dmaphysdest2 = 0;
    0 h8 ?% ^1 ~3 v& \5 ?4 z9 T

  72. / f/ y3 S5 W" v0 F7 M' q3 P6 V& d
  73. char *dmabufsrc1 = NULL;/ u) A+ U: V, I) x
  74. char *dmabufsrc2 = NULL;- J0 y+ |( w, H6 X6 k" Z
  75. char *dmabufdest1 = NULL;+ q. z% Y: _7 {( C
  76. char *dmabufdest2 = NULL;' v1 \9 O& k" b; B3 \
  77. 9 c3 w, K, T! U, J  y$ W& G& @
  78. static int acnt = 512;+ j5 J  U" R' P5 X
  79. static int bcnt = 8;( o) O6 A, l; v6 k0 I8 E
  80. static int ccnt = 8;$ ~0 q) b) q- g( w' k* `* e
  81. 6 d, m3 {  u8 I& N* |
  82. module_param(acnt, int, S_IRUGO);0 j3 V1 g) J9 |/ ^" i; M
  83. module_param(bcnt, int, S_IRUGO);
    1 a7 a( v- Z9 o: g2 l( Z$ F, B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ u7 q0 y6 V3 Q

# {' s6 d! h9 N, ?6 L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 _$ z) ~( {/ U* J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ Z5 {8 A6 F8 v; T     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( o- Q$ g; r. h, `$ F! @3 c0 a
2 g3 g) ?" W% u  B, B
3 j. O1 j# |0 k( f$ x/ m# z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 16:14 , Processed in 0.046076 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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