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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # \7 R( D2 ~9 @1 p) Z9 h# {6 F. p5 k
  1. [code]EDMA sample test application
    ( B* K( t& p( k3 |" \: Q5 s
  2. /*6 c' G% x5 n) H
  3. * edma_test.c
    ! k: F  q# @6 U$ e2 C
  4. *
    4 ]# z/ [: S, [2 u. r
  5. * brief  EDMA3 Test Application
    % a1 p& D9 h" m! f0 o) x; z
  6. *+ k, q0 i% J" M4 K5 o" o6 S- R
  7. *   This file contains EDMA3 Test code.7 r# }- I' L3 e
  8. *# f( O( L& k( @  p1 e' l' \7 H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  y* [) x% f! A$ e: ~8 k( o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 W1 r+ Q1 a' K$ J& }" I- c
  11. *         TO CHANGE.3 `0 v$ Y& a+ s" K. h  ]# E# ]0 _
  12. *6 v) L7 q# Z6 C9 R# y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : ^, Z8 o: ~6 G
  14. *1 Q8 L" q$ O* I1 F: o* U1 T/ k
  15. * This program is free software; you can redistribute it and/or
    4 V! W( H; @( J1 f
  16. * modify it under the terms of the GNU General Public License as
    : |& y3 q5 l/ Q$ O8 w3 }# T
  17. * published by the Free Software Foundation version 2.
    ; m6 J5 C: h! Y' r5 V4 f
  18. *
    ) b6 m5 |- ~6 [3 C2 ?/ i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . T- u& S4 T( w1 Q6 _7 G
  20. * kind, whether express or implied; without even the implied warranty
    : P, W3 [; ^: h. q0 w; Z7 Y9 @+ A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ j7 T. j" ]7 ?- q7 L
  22. * GNU General Public License for more details.
    9 @" X* a$ d- e
  23. */
    $ a/ k( J; b1 k$ Q. t4 Y0 m

  24. 7 {# D( h; k0 N- N% u6 N4 H( @
  25. #include <linux/module.h>1 D! h# U) z) l0 j/ `) Z
  26. #include <linux/init.h>4 K6 U0 n6 S5 Q4 L
  27. #include <linux/errno.h>
    3 S# f$ S+ Z" u( ~4 O, M4 D
  28. #include <linux/types.h>
    1 \3 J" K7 X% R5 d- \
  29. #include <linux/interrupt.h>
    - i. t' i+ N' }$ N
  30. #include <asm/io.h>  V) ?0 n" Z; h1 t
  31. #include <linux/moduleparam.h>+ ^, [; j$ v3 P" `- S( x/ o" w* [
  32. #include <linux/sysctl.h>; e1 l+ l; k8 Z. j4 R1 _
  33. #include <linux/mm.h>
    % V% ~% W* _4 f7 B
  34. #include <linux/dma-mapping.h>
    5 }( L% S; q+ U3 i0 M* j  z

  35. + {- X; f+ F% L1 _: j
  36. #include <mach/memory.h>( X' t( n2 h, X" M) ?0 R* Y1 s
  37. #include <mach/hardware.h>
    # p- c9 }+ p3 X4 ]+ N2 P" v
  38. #include <mach/irqs.h>
    ! f% I8 x) j/ o+ d: a
  39. #include <asm/hardware/edma.h>
    ( s- ]- p3 D1 x5 Q

  40. & c/ d6 u9 j. A$ j! R; z. Y
  41. #undef EDMA3_DEBUG
    9 G2 F' ^- I) X* u' c% T1 ~
  42. /*#define EDMA3_DEBUG*/
    - t0 M/ z) m) D
  43. 8 [5 _4 N3 w. `, ^8 T: e. f
  44. #ifdef EDMA3_DEBUG6 F( U, Z0 ~" B# K" @  k; @# B% k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  z9 G( |* E# U5 P: q+ @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 Q% }8 C* r+ }0 V/ g6 W1 Q, O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 t! e1 g8 e, ]3 w! Y+ _$ v6 f
  48. #else
    $ C6 U9 R  x# }! D# @: s- l
  49. #define DMA_PRINTK( x... )+ e" _. c2 G; P8 E* S
  50. #define DMA_FN_IN
      I3 w2 ^% @$ e  c
  51. #define DMA_FN_OUT! m1 q9 f. a/ I$ X8 M1 P" L# K/ p
  52. #endif, {+ \+ i- i+ m; d7 Z3 M

  53. ( P1 z  A# j6 p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) @) g6 L8 \  V% d
  55. #define STATIC_SHIFT                3
      r1 N1 I: v# S: }. K7 h# P
  56. #define TCINTEN_SHIFT               20
    ) h3 `8 f$ _# s  r- a# R, j
  57. #define ITCINTEN_SHIFT              21
    " I& d# s; Q2 w8 }, L7 v% s7 j* Q9 Q
  58. #define TCCHEN_SHIFT                22
    " K, Q0 C& z+ ^9 u4 ?# _
  59. #define ITCCHEN_SHIFT               234 e: l9 k) H, S* Y! ~

  60. / A( ?% V/ E/ `- v
  61. static volatile int irqraised1 = 0;
    7 @6 e9 H7 x9 r% S* M1 K. ?
  62. static volatile int irqraised2 = 0;
    4 _$ ~/ L' A# b3 H( N+ b
  63. ; P8 C. |; u7 A3 b6 }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 _6 X3 B+ y5 |7 S, O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* ]4 S# w* Q! o- B. u, M- w1 ]+ K0 m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 |$ K+ ^( c$ r9 s4 m; x

  67. # b$ d0 o( A( j7 T! r7 Z* R- K. O
  68. dma_addr_t dmaphyssrc1 = 0;4 L2 @( Q  p( P9 x+ b$ D" }+ G/ ?7 q
  69. dma_addr_t dmaphyssrc2 = 0;$ z5 [5 s! r% R! D  ~7 ?0 P- Y
  70. dma_addr_t dmaphysdest1 = 0;
    8 s- I4 O  M7 F9 d/ ^: |
  71. dma_addr_t dmaphysdest2 = 0;2 w; W( N  K+ D2 p, I  j

  72. ) x8 J% h4 N7 x' r/ U; _
  73. char *dmabufsrc1 = NULL;; b# V  }7 O: J) v' I2 i' P
  74. char *dmabufsrc2 = NULL;
    # C1 K: O" ]- b
  75. char *dmabufdest1 = NULL;
    % ^5 L6 G/ o+ A( B& a+ C
  76. char *dmabufdest2 = NULL;( U' w( v0 D8 ~" K" D8 Q
  77. . u' K& n5 S$ C; U
  78. static int acnt = 512;
    5 V5 S' T7 t, u$ W
  79. static int bcnt = 8;
    3 S  t, v" U* I: K2 t% {; k. K
  80. static int ccnt = 8;; j9 r1 Y$ R' P) {# y4 b3 x
  81. 6 @+ @/ c: g* x* i' ~" o
  82. module_param(acnt, int, S_IRUGO);
    4 ~9 ]: b# B# X
  83. module_param(bcnt, int, S_IRUGO);
    6 h& w& Q3 D5 x% ]) W# l" i$ I  p& E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% o  ?. `- S/ M/ b

3 D+ q& @6 T1 f5 I, L5 C      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 u. r5 F" t! Y. e* L0 m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; g- d1 ^$ ~. @: ?: W
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, Y- y# g: Q0 J- o

; L6 x! j) U6 H" u
) Q& H4 E3 b" y" l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-5 14:59 , Processed in 0.040908 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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