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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: w0 U0 J/ ^' K3 W
  1. [code]EDMA sample test application3 M  C7 s: L. z7 f3 l6 P* e
  2. /*3 l! H; X6 ?% g- h
  3. * edma_test.c
    2 H+ ]% z7 ?( ?5 D; |' I- D- n9 Q
  4. *" ^5 p# a7 ]* G& ?( c! G
  5. * brief  EDMA3 Test Application
    # K/ ]$ i% ^: y
  6. *) l8 @6 u6 |0 q% c0 @5 l4 ^. H
  7. *   This file contains EDMA3 Test code.
    9 K1 T9 q' j( {6 }! V
  8. *0 ^- w$ `! \4 L7 t5 F* ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 F* H9 E5 T: S4 @+ E- q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , s: Z4 S, q" _: k2 ?6 a: n
  11. *         TO CHANGE.
    % e) E5 C3 a! p% o7 o; l
  12. *- l# j9 [" [8 X, r  L! U9 k% f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// ^2 A( b) v1 J- i
  14. *, l4 ~: L" U& x. g& T: ~! v
  15. * This program is free software; you can redistribute it and/or
    $ p# X% n  S3 j& d; M
  16. * modify it under the terms of the GNU General Public License as4 T0 [5 V/ l. |9 ~: B& n
  17. * published by the Free Software Foundation version 2.7 k5 y6 Z6 P( y$ W! r; k/ ~8 T
  18. ** R  a4 R  O) A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 A  P/ @9 `3 |! ~- M: {" Q
  20. * kind, whether express or implied; without even the implied warranty$ g/ O# p: Z% f6 h7 U2 T7 ^4 f/ C1 E  N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 W6 |( s- C( e, K, n- |7 N
  22. * GNU General Public License for more details.
    / |9 C  }" A/ Z1 P  c6 O. n
  23. */
    4 Y# |4 r7 }! c3 K$ `, L2 g* u3 D

  24. $ J' J6 ~0 N3 z$ j
  25. #include <linux/module.h>7 e0 Y7 O+ X: v. i) h* K
  26. #include <linux/init.h>6 r# h3 {. I# R0 J
  27. #include <linux/errno.h>
    ' a2 L  o  Y; }3 b
  28. #include <linux/types.h>
    ( r9 S4 g& V( e# W* A; D
  29. #include <linux/interrupt.h>
    . |1 J  m5 H# U* W
  30. #include <asm/io.h>
    + v! O  S. P$ n! q5 B  w$ _
  31. #include <linux/moduleparam.h>9 i* i5 v6 G$ n/ ]) v" G, N# y- t
  32. #include <linux/sysctl.h># p) X9 {  V/ h0 @5 u8 f
  33. #include <linux/mm.h>( w0 d( z  H  N) {
  34. #include <linux/dma-mapping.h>
    - Y0 ~  Z8 s5 Y1 R% P7 W( ?0 d

  35. ( V/ D# \. D' N; m
  36. #include <mach/memory.h>' u2 F& t) j  b6 b' r  u4 X6 ?: n. J
  37. #include <mach/hardware.h>
    2 i6 }  r/ t9 w3 k8 N8 D, d  f: [
  38. #include <mach/irqs.h>
    - [8 C3 T  Z3 w: d
  39. #include <asm/hardware/edma.h>  t# w- F2 \8 A- x+ Q
  40. ' T2 N0 {# _: n; D8 a
  41. #undef EDMA3_DEBUG
    5 @; y  K" V; v+ v. ~% W
  42. /*#define EDMA3_DEBUG*/
    5 B* R7 S- x4 f7 @' D" W6 `3 s
  43. & w) X7 K2 T  Y* S
  44. #ifdef EDMA3_DEBUG
      x1 F, }% B9 w- p3 A) B6 @1 `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). o8 a1 r8 m/ L/ h8 r1 l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . i0 v/ Z) B, s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 Q/ e! F+ h6 W0 }! T% O
  48. #else4 q$ X# z! H) z8 B" z
  49. #define DMA_PRINTK( x... )! p5 f) y( M7 J. Y
  50. #define DMA_FN_IN
    : o% _+ o9 @" s9 n! ^
  51. #define DMA_FN_OUT
    1 I0 [! w1 h% e4 t
  52. #endif
    - m  i& f) S- g. Z2 t

  53. 0 v. O# `8 |2 H3 _' J1 d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 l) R3 n" o) [. I- D- X
  55. #define STATIC_SHIFT                3
    ) w+ u5 N: s% G5 d
  56. #define TCINTEN_SHIFT               20
    ' H: F2 J6 o5 H
  57. #define ITCINTEN_SHIFT              21: Y6 q  f6 p" d2 o# j1 O1 T/ r
  58. #define TCCHEN_SHIFT                22  n* x4 |. D& ~, g& q- S3 F" q
  59. #define ITCCHEN_SHIFT               23. @, q: k/ r) ~: L' {

  60. 3 E, z  [5 p/ \1 [7 R/ _, ]1 w
  61. static volatile int irqraised1 = 0;. G) G, n* @7 X) a
  62. static volatile int irqraised2 = 0;
    3 n# S$ }4 r' l
  63. 1 x$ g  u9 N! Q) e! |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' t9 f! b7 u& K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 p4 g8 N6 E" g( `$ u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 q0 s2 T4 ^; _* I

  67. / J' b5 V8 v1 H" X. r4 c* O1 k
  68. dma_addr_t dmaphyssrc1 = 0;
    % _6 A2 n8 D; k6 t4 @2 k
  69. dma_addr_t dmaphyssrc2 = 0;1 J' `! i5 m* {: |; }
  70. dma_addr_t dmaphysdest1 = 0;) S* W# S/ t/ z& C/ V9 B
  71. dma_addr_t dmaphysdest2 = 0;. l( f* a" _- I* G* ]% i( Q2 ]
  72. % c6 \) a3 {9 n; Y4 s; G7 b" p  A. o
  73. char *dmabufsrc1 = NULL;
    $ W$ i4 K) E1 s  S4 j, V, t
  74. char *dmabufsrc2 = NULL;
    & I9 W$ v" p- p: A- I$ f
  75. char *dmabufdest1 = NULL;
    6 Q( s' `$ }' D$ e* B& N* N
  76. char *dmabufdest2 = NULL;
    + t+ r+ Z) l3 G: W# n
  77. 9 x: s2 x; D+ R: f, }1 X
  78. static int acnt = 512;
    ) K) m* N0 l( u* |* b
  79. static int bcnt = 8;
    7 o* K+ ^) S: S' I9 ^, o" _+ l
  80. static int ccnt = 8;
    " K( Z$ n! V0 i3 V, H4 L

  81. ; J- f; e, r* E8 W" W+ C
  82. module_param(acnt, int, S_IRUGO);4 ^) N' M% ]/ H4 q' g, Q
  83. module_param(bcnt, int, S_IRUGO);: A, A7 H, m& X
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) V9 J7 v. y2 n( }4 k! Q4 e& F. i/ p+ f  s
+ v8 B3 z" j1 i* k. K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: ^3 P9 ]/ c* D/ E. n( P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 T4 D1 i; ^5 C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 d4 x( k7 ~: [: C8 N: N
" G& \7 H6 U9 X1 H& X: \( g( ^# W7 f' z& m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-30 13:40 , Processed in 0.044600 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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