OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 F5 {7 v0 }& h3 x2 m
  1. [code]EDMA sample test application
    , ?7 {( {! t2 S
  2. /*+ Z9 ?; C8 p5 @# r0 J& u
  3. * edma_test.c5 q2 Q7 W4 B( I1 a, }, \% @
  4. *) h9 c. ^4 }+ i4 [; I# ^$ Z" Y" H
  5. * brief  EDMA3 Test Application
    & X1 l8 x0 _( j1 `  C
  6. *" i, |1 n6 b) z9 z
  7. *   This file contains EDMA3 Test code.
    : ^2 [* y3 a/ [! r  V
  8. *9 w4 i" ~( n, E4 M1 [  m4 D4 c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / Y; m1 d( {9 k6 l: z# }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 a- ?  {! h* Z
  11. *         TO CHANGE.
    ; Y' G, v, Y) _
  12. ** \, r' U3 q7 S+ h5 {$ y! B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  c) h( ?/ b4 |! r* q$ E
  14. *1 i* r1 p, j' [* A5 Z, k; \% f
  15. * This program is free software; you can redistribute it and/or+ M, Z1 K9 x* \1 ]3 }
  16. * modify it under the terms of the GNU General Public License as
    8 `6 R$ W9 Z% u
  17. * published by the Free Software Foundation version 2.
    8 q1 p8 u- w, @8 ]0 A' X1 I
  18. *( @% U: H: k& D6 o# d, T! m" `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; k& d8 t/ m9 k
  20. * kind, whether express or implied; without even the implied warranty( b% U" J4 i7 K4 a' Z6 r) ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * N$ R8 f( ^! G
  22. * GNU General Public License for more details.
    0 h2 v9 p( Y! i. E5 H
  23. */
    ! c. X& c* x/ O8 q1 l4 O
  24. 3 f6 u8 z' O; x# F1 r
  25. #include <linux/module.h>" Y7 u2 i1 k6 f8 I: q
  26. #include <linux/init.h>' C4 x7 h, g; {( X/ y# c' {
  27. #include <linux/errno.h>" _  N3 e" v( b! ~. e7 T
  28. #include <linux/types.h>
    & g3 g9 Q1 G6 Q- @8 M. t
  29. #include <linux/interrupt.h>* f& X8 u6 }2 m6 W) }& r
  30. #include <asm/io.h>
    4 `' k% W0 T9 ^- Y1 E3 D
  31. #include <linux/moduleparam.h>" t8 _. ?5 }1 G; J# h" x3 ^3 D
  32. #include <linux/sysctl.h>" ~1 K/ v1 l  Z
  33. #include <linux/mm.h>
    ! p. n& h* I( O4 ~
  34. #include <linux/dma-mapping.h>
    7 T' J7 G( }* L& N7 O

  35. ) F" N) m% N" `2 m% q
  36. #include <mach/memory.h>
    ) d6 t  I: k: Y% a0 C# Q
  37. #include <mach/hardware.h>
    9 O6 Q% {+ s0 b4 S5 J
  38. #include <mach/irqs.h>0 {. ]- A. y) ^/ r2 H
  39. #include <asm/hardware/edma.h>
    8 J* p) `1 U" g

  40. * z2 M% R) V' G0 Q. t. r
  41. #undef EDMA3_DEBUG+ f/ w2 }# D: B2 [
  42. /*#define EDMA3_DEBUG*/
    4 \# K& ?4 O1 c0 F4 V
  43. 4 h+ r* p" ^& z; i
  44. #ifdef EDMA3_DEBUG
    # @3 L& j* r- B, q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 S% M2 Z% N. d# Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - r8 ~- C+ ~7 b& }8 V& M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 E# @1 o' X/ Z# h
  48. #else
      c% e1 [% f5 k; |# t% Y8 @
  49. #define DMA_PRINTK( x... )
    % d6 y/ O6 ?: O7 u  D
  50. #define DMA_FN_IN8 u& e9 W# z5 j9 @
  51. #define DMA_FN_OUT
    / y0 Y% B/ P4 V/ D" ]) g" i
  52. #endif
    2 I1 }- T! x- a

  53. ! P5 q$ L- G( {  q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . g0 D# B2 o+ \+ ^/ p
  55. #define STATIC_SHIFT                3
    ) ~7 r2 x& R. X) d5 U
  56. #define TCINTEN_SHIFT               20
    " z; ~+ X6 ~$ J, l0 d5 i
  57. #define ITCINTEN_SHIFT              21
    0 g* N! h5 c: }9 w% s4 o0 F
  58. #define TCCHEN_SHIFT                22" m2 Y+ I) S) m  k, D2 j9 S
  59. #define ITCCHEN_SHIFT               23
    & s# d3 W, M, Z; J

  60. + u. N) ^9 t+ {; t  G# C/ r  n
  61. static volatile int irqraised1 = 0;0 t6 S) U" o, g: Z6 D0 Z3 R
  62. static volatile int irqraised2 = 0;- E% U0 }7 o7 Q0 r* U

  63. 1 @6 F* U0 k. t# I! \! a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 O' Z: g" ]! G: h8 e3 l" t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ X# p) m8 u/ D. j. u9 h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, {6 ?1 {' T3 h  h# m1 x1 }' T0 a
  67. # ]# X% Q1 n; {2 m8 p9 ^( V5 U
  68. dma_addr_t dmaphyssrc1 = 0;+ l: O6 G, M6 y/ C: \5 i3 z5 _
  69. dma_addr_t dmaphyssrc2 = 0;
    $ f2 u& {; M) i2 w
  70. dma_addr_t dmaphysdest1 = 0;
    4 H8 ~& [8 h* a# T' o( Q7 J
  71. dma_addr_t dmaphysdest2 = 0;' q3 l' _+ t' ?' G! T4 Y

  72. * c8 Y9 ?& F' {
  73. char *dmabufsrc1 = NULL;8 e! Q, U4 q" _: Z; ^  u7 X# J2 Z
  74. char *dmabufsrc2 = NULL;, S, h% H9 f7 y) X* F" A
  75. char *dmabufdest1 = NULL;
    " O; k& B7 Z+ S$ M" [. Y. d9 q
  76. char *dmabufdest2 = NULL;; _' y$ A' C6 V; L6 G! P. E
  77. 3 j9 I0 d4 P/ _3 c4 |$ U
  78. static int acnt = 512;" }' @" ~- j; @8 ?/ m" |
  79. static int bcnt = 8;
    ( M* a' ?( z$ ]- b. H
  80. static int ccnt = 8;3 F6 N) o. t  y) I5 v3 l
  81. - M/ E" b. T9 ?( Z& K0 N
  82. module_param(acnt, int, S_IRUGO);
    2 H; V% I. [1 D
  83. module_param(bcnt, int, S_IRUGO);; ]) @3 c: q. Y" e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ {% L& a! O% ~( \9 A
# {) ?3 F, m. N& m, ?' Q; Z, S  v9 a
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" i# R0 o' H& u4 l. o# G# zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ Z( I. K/ U/ d     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 Q2 h" N, T! k) i6 B
* t2 ^! u! f$ b) I, e2 n8 A# J, @% K6 v# C% l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-16 11:14 , Processed in 0.038790 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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