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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , U& x) }1 \- L1 F7 s$ _9 g4 @4 c: [5 Q
  1. [code]EDMA sample test application
    & X4 n* y( J+ s5 @
  2. /*
    - l0 c5 Y$ X3 b4 }. z  ]% Q
  3. * edma_test.c% D% ]4 h4 X+ g- _: W3 S1 B; i
  4. *
      m2 }% i" s. @! ]0 [
  5. * brief  EDMA3 Test Application7 i5 s9 i+ h0 |  {' B" Q$ }+ x/ w5 ~
  6. *- k3 a# N6 u9 k( j& j2 X( N
  7. *   This file contains EDMA3 Test code.0 U! \- s& f1 P0 s1 e% R9 P' a! i% W
  8. *
    4 U+ m0 B. V1 u6 B& _: t, A6 w. V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( r/ E2 z# _( q/ _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" L8 _& {% s1 G
  11. *         TO CHANGE.+ I- K% s: x/ j2 k* B1 H
  12. *
    7 {) c; B* ^% W# u) p* c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ i3 U# C" w  R
  14. *
    # s8 l. F- j. _9 r* X3 @$ z" Q8 x
  15. * This program is free software; you can redistribute it and/or
    # x8 F$ A% }4 \" `& Z
  16. * modify it under the terms of the GNU General Public License as0 O; U4 Y2 k4 ^& z* Z, q* H
  17. * published by the Free Software Foundation version 2.
    0 e! k8 S! `! I  D% B% B
  18. *: O- v% ^4 {; _8 b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 O( A8 I. [; T; z4 w( W
  20. * kind, whether express or implied; without even the implied warranty
    0 M  q/ C# h( q4 E* }8 o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! I/ Z) b0 U! Q, r: x" M
  22. * GNU General Public License for more details.$ W, l1 ~2 F) v4 I7 D
  23. */4 |6 H7 V% v# k1 l

  24.   P0 R" _- c  h% M, z8 S
  25. #include <linux/module.h>
    7 I7 p% r7 X/ o+ S1 }# S+ ]
  26. #include <linux/init.h>
    9 ?1 X0 I$ m. a+ C; ^! {
  27. #include <linux/errno.h>9 y1 R$ z! K1 F' ?; V8 ^& v
  28. #include <linux/types.h>
    % F# K) V# ~6 v7 V2 _! T: b2 ~* e
  29. #include <linux/interrupt.h>
    / u* l2 c. U( w/ y+ G3 f
  30. #include <asm/io.h>
    , b( @5 U8 c5 @; e9 j# g' H
  31. #include <linux/moduleparam.h>  a& o. x5 I( z  ^
  32. #include <linux/sysctl.h>4 Z* k; R: S; b+ J
  33. #include <linux/mm.h>
    - @/ R8 M# f5 H& p# W
  34. #include <linux/dma-mapping.h>
    ; F* e) c9 E. X/ u4 R& s/ Q; i

  35. 9 Z* G8 o1 |& E$ e: c
  36. #include <mach/memory.h>
    ' F) z. M2 j% u! q
  37. #include <mach/hardware.h>, z5 L" C3 H, R0 Z) u9 c
  38. #include <mach/irqs.h>
    8 O& C. `/ d, F- R! j
  39. #include <asm/hardware/edma.h>/ a1 R" w3 C4 }/ h# D. l* }

  40. / o" N" k; }3 _, Q( q, r  i
  41. #undef EDMA3_DEBUG
    * s8 {# l/ C6 y3 A9 f; h
  42. /*#define EDMA3_DEBUG*/- `9 J7 u' V! ^) h7 ?6 X. E- b1 m9 _' w

  43. ; ^' E8 t. u6 {8 A+ [
  44. #ifdef EDMA3_DEBUG* D9 X" y7 e$ q% n) y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : O/ X1 `2 j+ M3 L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): v. M) R6 F  E! C# C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); ], j2 s5 ?" Q4 M. A" v
  48. #else* b8 W! ~8 e$ E8 c: h. I9 N
  49. #define DMA_PRINTK( x... )) H" a* k3 c4 A  w7 U
  50. #define DMA_FN_IN) v' Y) x1 t% I* k: N  y
  51. #define DMA_FN_OUT1 Q6 \- R( a6 Q7 m' t) d4 E0 m
  52. #endif, f( y9 z9 Z$ ]) n

  53. ) ]8 E6 h4 M6 \0 I( _* l* |+ O1 h& X9 F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * l- w- m# q+ @9 J: V
  55. #define STATIC_SHIFT                3
    - T. h& j/ r0 M' P
  56. #define TCINTEN_SHIFT               20
    " x- j, G! @, P8 A3 Y
  57. #define ITCINTEN_SHIFT              21% E/ e) v' f  i7 h0 M" Y
  58. #define TCCHEN_SHIFT                22
    & q0 @4 O1 ?8 C. K6 A
  59. #define ITCCHEN_SHIFT               23; f4 ]) e. f& L4 `5 k' K
  60. * g; e/ l* ~5 r
  61. static volatile int irqraised1 = 0;
    1 W6 G1 L) D5 `. f3 E6 F" d$ y
  62. static volatile int irqraised2 = 0;
    $ e" e3 Y+ a; X! }9 {
  63. 0 n& m) x) Z& b) }4 S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , r% q/ ]$ p1 E( j9 z0 R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 c# c8 _* |& @2 g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * N% h: n+ i; ^$ ~: w: [

  67. + H3 ~% k3 l" [- y
  68. dma_addr_t dmaphyssrc1 = 0;
    5 n9 o0 U( k" O* T' [# N, _  A
  69. dma_addr_t dmaphyssrc2 = 0;
    ' g9 f* n& C* f9 x  C% G
  70. dma_addr_t dmaphysdest1 = 0;
    5 F7 M) Q9 ~  k
  71. dma_addr_t dmaphysdest2 = 0;4 k, g. _& J# ?  y

  72. ! h0 {4 d7 K$ Q- E- b4 N
  73. char *dmabufsrc1 = NULL;( Z! ?( Y5 M1 K/ I1 k* |0 N
  74. char *dmabufsrc2 = NULL;: ^1 u1 d, h# U' P. Z3 h7 [
  75. char *dmabufdest1 = NULL;
    8 Q: O0 g2 x- ?9 r" {4 G
  76. char *dmabufdest2 = NULL;$ I/ S9 `" U' g

  77. 8 o/ D- ^  a% n( {6 l* I# u7 Z
  78. static int acnt = 512;
    1 X' |6 s" X* u5 F. X, B' \
  79. static int bcnt = 8;7 p2 [9 K( ]+ \! [7 }9 t
  80. static int ccnt = 8;- y/ C3 ]6 l7 [3 T9 K+ s' x9 w2 W7 l' s

  81. 2 E+ D$ U- ]/ l4 I
  82. module_param(acnt, int, S_IRUGO);
    ! N! V7 f& h9 y- d# p
  83. module_param(bcnt, int, S_IRUGO);
    ) m) p( H; K0 H7 S& j0 f2 i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 t( H0 t6 X  E+ n

9 d/ t) ?- c3 D0 U0 `6 `7 }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 j  _: r0 H1 C  j+ p. G' @+ u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, x5 @5 k- J. v/ W% a( B" E+ q. K
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ [" A8 V: X! k* Z2 Q! Q
* m. r1 g# z8 n6 g* j! ]/ f* n) ]( T% n3 |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 00:39 , Processed in 0.039801 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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